@camunda/ccma-shared-types 16.0.0 → 16.1.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/approvals/approval-rules.d.ts +3 -0
- package/dist/approvals/approval-rules.js +1 -0
- package/dist/approvals/approval-rules.js.map +2 -2
- package/dist/approvals/use-cases.const.d.ts +1 -0
- package/dist/approvals/use-cases.const.js +3 -0
- package/dist/approvals/use-cases.const.js.map +2 -2
- package/dist/dtos/ApprovalJob.dto.d.ts +6 -5
- package/dist/dtos/ApprovalJob.dto.js.map +1 -1
- package/package.json +1 -1
|
@@ -7,6 +7,7 @@ const APPROVAL_RULES = {
|
|
|
7
7
|
[T.clusterTtlDeletion]: { prod: 0 },
|
|
8
8
|
[T.createPersonalOrganisation]: { prod: 0 },
|
|
9
9
|
[T.convertTrialToInternal]: { prod: 0 },
|
|
10
|
+
[T.deleteOwnTestOrg]: { prod: 0 },
|
|
10
11
|
[T.createCustomHardwareSizing]: { prod: 0 },
|
|
11
12
|
[T.removeCustomHardwareSizing]: { prod: 0 },
|
|
12
13
|
[T.createCustomGeneration]: { prod: 0 },
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/approvals/approval-rules.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 { Stage } from '../constants/misc.const.js'\nimport {\n type ApprovalUseCaseType,\n APPROVAL_USE_CASE_TYPES as T,\n} from './use-cases.const.js'\n\n/**\n * The approvals of one type of request.\n *\n * The count is the number of approvals from holders of the run permissions of\n * the request (`requiredPermissions`). The opener counts too: when the opener\n * holds every run permission, the request gets the approval of the opener\n * when it is created. The opener cannot approve the request by hand\n * (`canAcknowledge`).\n */\nexport interface ApprovalRule {\n /** The approvals on prod. */\n prod: number\n /** The approvals on int, and on dev and local unless `dev` is set. When it is not set, `prod` applies. */\n testStages?: number\n /** The approvals on dev and local. When it is not set, `testStages` applies. */\n dev?: number\n}\n\n/**\n * How many approvals each type of request needs. This table is the one source\n * of that number, for control-backend, control-frontend, and the routes of\n * accounts and console that run an approved action.\n *\n * - **0**: no approval. Only a holder, or a person whom the use case opens the\n * request to, can open it.\n * - **1**: a holder does the action alone. The request of a holder runs when\n * it is created. The request of a person who is not a holder waits for one\n * holder.\n * - **2**: four eyes. The request of a holder waits for one other holder. The\n * request of a person who is not a holder waits for two holders.\n * - **3**: six eyes on prod.\n *\n * Before #10483 a use case counted only the approvals of people other than\n * the opener. Thus an old count and a count of this table are not the same\n * unit.\n */\nexport const APPROVAL_RULES = {\n // No approval. A use case that is open to every Camundi, or that only a\n // system opens.\n [T.clusterTtlDeletion]: { prod: 0 },\n [T.createPersonalOrganisation]: { prod: 0 },\n [T.convertTrialToInternal]: { prod: 0 },\n [T.createCustomHardwareSizing]: { prod: 0 },\n [T.removeCustomHardwareSizing]: { prod: 0 },\n [T.createCustomGeneration]: { prod: 0 },\n [T.removeCustomGeneration]: { prod: 0 },\n [T.selfServiceClusterModification]: { prod: 0 },\n // Only the run of a grant opens it, as the system, and it runs by itself at\n // the end of the grant. Ending a grant takes power away.\n [T.revokeApprovalOverride]: { prod: 0 },\n\n // A holder does it alone. Before #10483 a holder did these actions in\n // accounts-frontend or console-frontend with no second person.\n [T.extendTrial]: { prod: 1 },\n [T.changeOrgLimits]: { prod: 1 },\n // The create and the edit of an SSO connection start with the count of the\n // direct route, so the people who use it today see no change. Raise it\n // when the approvers are in place (#11340).\n [T.createSsoConnection]: { prod: 1 },\n [T.updateSsoConnection]: { prod: 1 },\n [T.llmBudgetTopUp]: { prod: 1 },\n [T.changeSalesPlan]: { prod: 1 },\n [T.requestInNegotiation]: { prod: 1 },\n [T.onboardToEnterprise]: { prod: 1 },\n [T.automatedEnterpriseOnboarding]: { prod: 1 },\n [T.changeClusterPlanType]: { prod: 1 },\n [T.deleteInternalBackup]: { prod: 1 },\n [T.releaseTrainPublish]: { prod: 1 },\n [T.releaseTrainRollback]: { prod: 1 },\n\n // Four eyes. The action removes data or access, changes a person, moves a\n // cluster to another customer, or restarts every cluster of a generation.\n [T.changePlatformRoles]: { prod: 2 },\n // A wrong pattern blocks real signups, and a removed one lets spam in.\n [T.changeSignupSpamPatterns]: { prod: 2 },\n [T.changeUserEmail]: { prod: 2 },\n [T.deleteUser]: { prod: 2 },\n [T.removeOrgMember]: { prod: 2 },\n [T.purgeUsers]: { prod: 2 },\n [T.updateUserMetadata]: { prod: 2 },\n [T.deleteOrganization]: { prod: 2 },\n [T.sendToExpiredTrial]: { prod: 2 },\n [T.deleteSsoConnection]: { prod: 2 },\n [T.deleteApiClient]: { prod: 2 },\n [T.moveClusterOrg]: { prod: 2 },\n [T.editGeneration]: { prod: 2 },\n [T.changeGenerationVersions]: { prod: 2 },\n\n // A reservation is a commercial commitment that the customer pays for, and\n // the force path skips every check of the sales plan. Four eyes on prod.\n // On the test stages a holder does it alone, as the direct route did.\n [T.changeOrgReservations]: { prod: 2, testStages: 1 },\n\n // One decision changes many clusters. A deletion cannot be undone, so it\n // needs six eyes on prod. On the test stages, the opener runs every other\n // type alone: the console team rolls out generations there with no second\n // person.\n [T.clusterBulkGenerationUpdate]: { prod: 2, testStages: 1 },\n [T.clusterBulkPlanUpdate]: { prod: 2, testStages: 1 },\n [T.clusterBulkPlanTypeUpdate]: { prod: 2, testStages: 1 },\n [T.clusterBulkSleepWakeup]: { prod: 2, testStages: 1 },\n [T.clusterBulkSpecUpdate]: { prod: 2, testStages: 1 },\n [T.clusterBulkDeletion]: { prod: 3, testStages: 2 },\n // Many organizations in one request, and a deletion cannot be undone: six\n // eyes on prod, as the bulk deletion of clusters.\n [T.orgBulkDeletion]: { prod: 3, testStages: 2 },\n [T.deleteClusterCorpses]: { prod: 3, testStages: 2 },\n [T.forceDeleteClusterPlanType]: { prod: 3, testStages: 2 },\n // The contract of an enterprise customer sets what the customer pays for.\n // On prod the opener and one other holder. On the test stages a holder\n // changes a test contract alone.\n [T.changeEnterpriseContract]: { prod: 2, testStages: 1 },\n // A shorter retention limit deletes the old data of every cluster of the\n // plan type.\n [T.changePlanTypeRetentionLimits]: { prod: 3, testStages: 2 },\n\n // A generation upgrade of one cluster that skips the upgrade graph\n // (`--yolo`) or the upgrade gate. The gate keeps an upgrade from a cluster\n // that has not finished its last migration, so a forced upgrade on prod\n // needs the opener and one other holder. On the test stages the opener\n // runs it alone.\n [T.forceGenerationUpgrade]: { prod: 2, testStages: 1 },\n // The deletion of the managed LLM tenant removes the key and the spend\n // history, and nothing brings them back. Four eyes on prod. On the test\n // stages the opener does it alone, as the direct route did before.\n [T.deleteManagedLlmTenant]: { prod: 2, testStages: 1 },\n\n // A flag of prod turns a feature on or off for every customer.\n [T.changeFeatureFlag]: { prod: 3, testStages: 2 },\n // Turning a flag off lowers the risk, thus it needs fewer approvals than a\n // change. On prod the opener with `aafw` gives one, and one other holder\n // gives the second. On int the opener with `aafw` does it alone. On dev\n // and local no approval is needed: opening the request runs it.\n [T.disableFeatureFlag]: { prod: 2, testStages: 1, dev: 0 },\n // A kill switch stops one action in an incident, thus it is as fast as a\n // rollback: the same counts as `disableFeatureFlag`.\n [T.engageKillSwitch]: { prod: 2, testStages: 1, dev: 0 },\n\n // The licensing model sets which value metrics an enterprise customer pays\n // for. On prod the opener and one other holder. On the test stages a holder\n // changes a test organization alone.\n [T.changeLicensingModel]: { prod: 2, testStages: 1 },\n\n // A grant lets one Camundi run many requests with no second person. The\n // opener and one other holder, on every stage. The grantee approves\n // neither by hand nor when they open it, thus a grant for oneself needs\n // two other holders. The console team has three people, so a third\n // approval would block a grant for oneself.\n [T.grantApprovalOverride]: { prod: 2 },\n} as const satisfies Record<ApprovalUseCaseType, ApprovalRule>\n\n/** The types whose count on the test stages is not the count on prod. */\nexport type StageDependentApprovalType = {\n [K in ApprovalUseCaseType]: (typeof APPROVAL_RULES)[K] extends {\n testStages: number\n }\n ? K\n : (typeof APPROVAL_RULES)[K] extends { dev: number }\n ? K\n : never\n}[ApprovalUseCaseType]\n\n/** The approvals that a request of `type` needs on `stage`. */\nexport function approvalsRequiredFor(\n type: ApprovalUseCaseType,\n stage: Stage,\n): number {\n const rule: ApprovalRule = APPROVAL_RULES[type]\n if (stage === 'prod') {\n return rule.prod\n }\n const testStages = rule.testStages ?? rule.prod\n return stage === 'int' ? testStages : (rule.dev ?? testStages)\n}\n"],
|
|
5
|
-
"mappings": "AAOA;AAAA,EAEE,2BAA2B;AAAA,OACtB;AAsCA,MAAM,iBAAiB;AAAA;AAAA;AAAA,EAG5B,CAAC,EAAE,kBAAkB,GAAG,EAAE,MAAM,EAAE;AAAA,EAClC,CAAC,EAAE,0BAA0B,GAAG,EAAE,MAAM,EAAE;AAAA,EAC1C,CAAC,EAAE,sBAAsB,GAAG,EAAE,MAAM,EAAE;AAAA,EACtC,CAAC,EAAE,0BAA0B,GAAG,EAAE,MAAM,EAAE;AAAA,EAC1C,CAAC,EAAE,0BAA0B,GAAG,EAAE,MAAM,EAAE;AAAA,EAC1C,CAAC,EAAE,sBAAsB,GAAG,EAAE,MAAM,EAAE;AAAA,EACtC,CAAC,EAAE,sBAAsB,GAAG,EAAE,MAAM,EAAE;AAAA,EACtC,CAAC,EAAE,8BAA8B,GAAG,EAAE,MAAM,EAAE;AAAA;AAAA;AAAA,EAG9C,CAAC,EAAE,sBAAsB,GAAG,EAAE,MAAM,EAAE;AAAA;AAAA;AAAA,EAItC,CAAC,EAAE,WAAW,GAAG,EAAE,MAAM,EAAE;AAAA,EAC3B,CAAC,EAAE,eAAe,GAAG,EAAE,MAAM,EAAE;AAAA;AAAA;AAAA;AAAA,EAI/B,CAAC,EAAE,mBAAmB,GAAG,EAAE,MAAM,EAAE;AAAA,EACnC,CAAC,EAAE,mBAAmB,GAAG,EAAE,MAAM,EAAE;AAAA,EACnC,CAAC,EAAE,cAAc,GAAG,EAAE,MA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AA;AAAA,EAKhD,CAAC,EAAE,kBAAkB,GAAG,EAAE,MAAM,GAAG,YAAY,GAAG,KAAK,EAAE;AAAA;AAAA;AAAA,EAGzD,CAAC,EAAE,gBAAgB,GAAG,EAAE,MAAM,GAAG,YAAY,GAAG,KAAK,EAAE;AAAA;AAAA;AAAA;AAAA,EAKvD,CAAC,EAAE,oBAAoB,GAAG,EAAE,MAAM,GAAG,YAAY,EAAE;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOnD,CAAC,EAAE,qBAAqB,GAAG,EAAE,MAAM,EAAE;AACvC;AAcO,SAAS,qBACd,MACA,OACQ;AACR,QAAM,OAAqB,eAAe,IAAI;AAC9C,MAAI,UAAU,QAAQ;AACpB,WAAO,KAAK;AAAA,EACd;AACA,QAAM,aAAa,KAAK,cAAc,KAAK;AAC3C,SAAO,UAAU,QAAQ,aAAc,KAAK,OAAO;AACrD;",
|
|
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 { Stage } from '../constants/misc.const.js'\nimport {\n type ApprovalUseCaseType,\n APPROVAL_USE_CASE_TYPES as T,\n} from './use-cases.const.js'\n\n/**\n * The approvals of one type of request.\n *\n * The count is the number of approvals from holders of the run permissions of\n * the request (`requiredPermissions`). The opener counts too: when the opener\n * holds every run permission, the request gets the approval of the opener\n * when it is created. The opener cannot approve the request by hand\n * (`canAcknowledge`).\n */\nexport interface ApprovalRule {\n /** The approvals on prod. */\n prod: number\n /** The approvals on int, and on dev and local unless `dev` is set. When it is not set, `prod` applies. */\n testStages?: number\n /** The approvals on dev and local. When it is not set, `testStages` applies. */\n dev?: number\n}\n\n/**\n * How many approvals each type of request needs. This table is the one source\n * of that number, for control-backend, control-frontend, and the routes of\n * accounts and console that run an approved action.\n *\n * - **0**: no approval. Only a holder, or a person whom the use case opens the\n * request to, can open it.\n * - **1**: a holder does the action alone. The request of a holder runs when\n * it is created. The request of a person who is not a holder waits for one\n * holder.\n * - **2**: four eyes. The request of a holder waits for one other holder. The\n * request of a person who is not a holder waits for two holders.\n * - **3**: six eyes on prod.\n *\n * Before #10483 a use case counted only the approvals of people other than\n * the opener. Thus an old count and a count of this table are not the same\n * unit.\n */\nexport const APPROVAL_RULES = {\n // No approval. A use case that is open to every Camundi, or that only a\n // system opens.\n [T.clusterTtlDeletion]: { prod: 0 },\n [T.createPersonalOrganisation]: { prod: 0 },\n [T.convertTrialToInternal]: { prod: 0 },\n [T.deleteOwnTestOrg]: { prod: 0 },\n [T.createCustomHardwareSizing]: { prod: 0 },\n [T.removeCustomHardwareSizing]: { prod: 0 },\n [T.createCustomGeneration]: { prod: 0 },\n [T.removeCustomGeneration]: { prod: 0 },\n [T.selfServiceClusterModification]: { prod: 0 },\n // Only the run of a grant opens it, as the system, and it runs by itself at\n // the end of the grant. Ending a grant takes power away.\n [T.revokeApprovalOverride]: { prod: 0 },\n\n // A holder does it alone. Before #10483 a holder did these actions in\n // accounts-frontend or console-frontend with no second person.\n [T.extendTrial]: { prod: 1 },\n [T.changeOrgLimits]: { prod: 1 },\n // The create and the edit of an SSO connection start with the count of the\n // direct route, so the people who use it today see no change. Raise it\n // when the approvers are in place (#11340).\n [T.createSsoConnection]: { prod: 1 },\n [T.updateSsoConnection]: { prod: 1 },\n [T.llmBudgetTopUp]: { prod: 1 },\n [T.changeSalesPlan]: { prod: 1 },\n [T.requestInNegotiation]: { prod: 1 },\n [T.onboardToEnterprise]: { prod: 1 },\n [T.automatedEnterpriseOnboarding]: { prod: 1 },\n [T.changeClusterPlanType]: { prod: 1 },\n [T.deleteInternalBackup]: { prod: 1 },\n [T.releaseTrainPublish]: { prod: 1 },\n [T.releaseTrainRollback]: { prod: 1 },\n\n // Four eyes. The action removes data or access, changes a person, moves a\n // cluster to another customer, or restarts every cluster of a generation.\n [T.changePlatformRoles]: { prod: 2 },\n // A wrong pattern blocks real signups, and a removed one lets spam in.\n [T.changeSignupSpamPatterns]: { prod: 2 },\n [T.changeUserEmail]: { prod: 2 },\n [T.deleteUser]: { prod: 2 },\n [T.removeOrgMember]: { prod: 2 },\n [T.purgeUsers]: { prod: 2 },\n [T.updateUserMetadata]: { prod: 2 },\n [T.deleteOrganization]: { prod: 2 },\n [T.sendToExpiredTrial]: { prod: 2 },\n [T.deleteSsoConnection]: { prod: 2 },\n [T.deleteApiClient]: { prod: 2 },\n [T.moveClusterOrg]: { prod: 2 },\n [T.editGeneration]: { prod: 2 },\n [T.changeGenerationVersions]: { prod: 2 },\n\n // A reservation is a commercial commitment that the customer pays for, and\n // the force path skips every check of the sales plan. Four eyes on prod.\n // On the test stages a holder does it alone, as the direct route did.\n [T.changeOrgReservations]: { prod: 2, testStages: 1 },\n\n // One decision changes many clusters. A deletion cannot be undone, so it\n // needs six eyes on prod. On the test stages, the opener runs every other\n // type alone: the console team rolls out generations there with no second\n // person.\n [T.clusterBulkGenerationUpdate]: { prod: 2, testStages: 1 },\n [T.clusterBulkPlanUpdate]: { prod: 2, testStages: 1 },\n [T.clusterBulkPlanTypeUpdate]: { prod: 2, testStages: 1 },\n [T.clusterBulkSleepWakeup]: { prod: 2, testStages: 1 },\n [T.clusterBulkSpecUpdate]: { prod: 2, testStages: 1 },\n [T.clusterBulkDeletion]: { prod: 3, testStages: 2 },\n // Many organizations in one request, and a deletion cannot be undone: six\n // eyes on prod, as the bulk deletion of clusters.\n [T.orgBulkDeletion]: { prod: 3, testStages: 2 },\n [T.deleteClusterCorpses]: { prod: 3, testStages: 2 },\n [T.forceDeleteClusterPlanType]: { prod: 3, testStages: 2 },\n // The contract of an enterprise customer sets what the customer pays for.\n // On prod the opener and one other holder. On the test stages a holder\n // changes a test contract alone.\n [T.changeEnterpriseContract]: { prod: 2, testStages: 1 },\n // A shorter retention limit deletes the old data of every cluster of the\n // plan type.\n [T.changePlanTypeRetentionLimits]: { prod: 3, testStages: 2 },\n\n // A generation upgrade of one cluster that skips the upgrade graph\n // (`--yolo`) or the upgrade gate. The gate keeps an upgrade from a cluster\n // that has not finished its last migration, so a forced upgrade on prod\n // needs the opener and one other holder. On the test stages the opener\n // runs it alone.\n [T.forceGenerationUpgrade]: { prod: 2, testStages: 1 },\n // The deletion of the managed LLM tenant removes the key and the spend\n // history, and nothing brings them back. Four eyes on prod. On the test\n // stages the opener does it alone, as the direct route did before.\n [T.deleteManagedLlmTenant]: { prod: 2, testStages: 1 },\n\n // A flag of prod turns a feature on or off for every customer.\n [T.changeFeatureFlag]: { prod: 3, testStages: 2 },\n // Turning a flag off lowers the risk, thus it needs fewer approvals than a\n // change. On prod the opener with `aafw` gives one, and one other holder\n // gives the second. On int the opener with `aafw` does it alone. On dev\n // and local no approval is needed: opening the request runs it.\n [T.disableFeatureFlag]: { prod: 2, testStages: 1, dev: 0 },\n // A kill switch stops one action in an incident, thus it is as fast as a\n // rollback: the same counts as `disableFeatureFlag`.\n [T.engageKillSwitch]: { prod: 2, testStages: 1, dev: 0 },\n\n // The licensing model sets which value metrics an enterprise customer pays\n // for. On prod the opener and one other holder. On the test stages a holder\n // changes a test organization alone.\n [T.changeLicensingModel]: { prod: 2, testStages: 1 },\n\n // A grant lets one Camundi run many requests with no second person. The\n // opener and one other holder, on every stage. The grantee approves\n // neither by hand nor when they open it, thus a grant for oneself needs\n // two other holders. The console team has three people, so a third\n // approval would block a grant for oneself.\n [T.grantApprovalOverride]: { prod: 2 },\n} as const satisfies Record<ApprovalUseCaseType, ApprovalRule>\n\n/** The types whose count on the test stages is not the count on prod. */\nexport type StageDependentApprovalType = {\n [K in ApprovalUseCaseType]: (typeof APPROVAL_RULES)[K] extends {\n testStages: number\n }\n ? K\n : (typeof APPROVAL_RULES)[K] extends { dev: number }\n ? K\n : never\n}[ApprovalUseCaseType]\n\n/** The approvals that a request of `type` needs on `stage`. */\nexport function approvalsRequiredFor(\n type: ApprovalUseCaseType,\n stage: Stage,\n): number {\n const rule: ApprovalRule = APPROVAL_RULES[type]\n if (stage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KAAK,EAAE;AAAA;AAAA;AAAA;AAAA,EAKvD,CAAC,EAAE,oBAAoB,GAAG,EAAE,MAAM,GAAG,YAAY,EAAE;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOnD,CAAC,EAAE,qBAAqB,GAAG,EAAE,MAAM,EAAE;AACvC;AAcO,SAAS,qBACd,MACA,OACQ;AACR,QAAM,OAAqB,eAAe,IAAI;AAC9C,MAAI,UAAU,QAAQ;AACpB,WAAO,KAAK;AAAA,EACd;AACA,QAAM,aAAa,KAAK,cAAc,KAAK;AAC3C,SAAO,UAAU,QAAQ,aAAc,KAAK,OAAO;AACrD;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -47,6 +47,7 @@ export declare const APPROVAL_USE_CASE_TYPES: {
|
|
|
47
47
|
readonly releaseTrainRollback: "release-train-rollback";
|
|
48
48
|
readonly createPersonalOrganisation: "create-personal-organisation";
|
|
49
49
|
readonly convertTrialToInternal: "convert-trial-to-internal";
|
|
50
|
+
readonly deleteOwnTestOrg: "delete-own-test-org";
|
|
50
51
|
readonly createCustomHardwareSizing: "create-custom-hardware-sizing";
|
|
51
52
|
readonly removeCustomHardwareSizing: "remove-custom-hardware-sizing";
|
|
52
53
|
readonly changeGenerationVersions: "change-generation-versions";
|
|
@@ -60,6 +60,9 @@ const APPROVAL_USE_CASE_TYPES = {
|
|
|
60
60
|
// Open to the owner of a trial organization, who must be a Camundi. It needs
|
|
61
61
|
// no approval on any stage and moves the organization to the internal plan.
|
|
62
62
|
convertTrialToInternal: "convert-trial-to-internal",
|
|
63
|
+
// Open to the owner of an internal or trial organization, who must be a
|
|
64
|
+
// Camundi. It needs no approval on any stage and deletes the organization.
|
|
65
|
+
deleteOwnTestOrg: "delete-own-test-org",
|
|
63
66
|
// Open to every Camundi, runs on dev only, and needs no approval. The two
|
|
64
67
|
// use cases of custom hardware sizing.
|
|
65
68
|
createCustomHardwareSizing: "create-custom-hardware-sizing",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/approvals/use-cases.const.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 { AccountsPermissions } from '../permissions/accounts.permissions.js'\n\n/**\n * The names and the value ranges of the registered use cases.\n *\n * control-backend owns the registry, and a frontend reads it at run time\n * (`GET /api/approvals/use-cases`). Two things cannot wait for that answer:\n *\n * - **The identifier**, because a caller must NAME a use case to find it in the\n * registry, and to open a request of it.\n * - **The range of a payload field**, because a form holds the value before any\n * call goes out.\n *\n * Both live here, so the schema of the service and the form of the browser can\n * never hold different numbers.\n */\n\n/** The identifier of each use case, on the wire and in the table. */\nexport const APPROVAL_USE_CASE_TYPES = {\n sendToExpiredTrial: 'send-to-expired-trial',\n extendTrial: 'extend-trial',\n moveClusterOrg: 'move-cluster-org',\n // One use case for each type of a cluster bulk operation. The types need\n // different permissions and different approval counts, and a use case holds\n // one of each. See `cluster-bulk-operation.ts` beside this file.\n clusterBulkGenerationUpdate: 'cluster-bulk-generation-update',\n clusterBulkPlanUpdate: 'cluster-bulk-plan-update',\n clusterBulkPlanTypeUpdate: 'cluster-bulk-plan-type-update',\n clusterBulkSleepWakeup: 'cluster-bulk-sleep-wakeup',\n clusterBulkDeletion: 'cluster-bulk-deletion',\n clusterBulkSpecUpdate: 'cluster-bulk-spec-update',\n // The second group, behind `control.camundiApprovalFlow`.\n changePlatformRoles: 'change-platform-roles',\n deleteInternalBackup: 'delete-internal-backup',\n changeOrgLimits: 'change-org-limits',\n // The cluster reservations of one organization, behind\n // `control.camundiApprovalFlow`. It is not the enterprise contract: a\n // reservation change and a contract change are two requests. See\n // `change-org-reservations.ts` in control-backend.\n changeOrgReservations: 'change-org-reservations',\n deleteSsoConnection: 'delete-sso-connection',\n createSsoConnection: 'create-sso-connection',\n updateSsoConnection: 'update-sso-connection',\n changeSalesPlan: 'change-sales-plan',\n llmBudgetTopUp: 'llm-budget-top-up',\n requestInNegotiation: 'request-in-negotiation',\n // Behind its own flag `control.removeOrgMember`, and not\n // `control.camundiApprovalFlow`. See `REMOVE_ORG_MEMBER_FLAG`.\n removeOrgMember: 'remove-org-member',\n // The third group, behind `control.camundiApprovalFlow`.\n deleteOrganization: 'delete-organization',\n // Many organizations in one request. Behind `control.camundiApprovalFlow`\n // and its own flag `control.orgBulkDeletion`. See `org-bulk-deletion.ts`\n // beside this file.\n orgBulkDeletion: 'org-bulk-deletion',\n deleteUser: 'delete-user',\n changeUserEmail: 'change-user-email',\n purgeUsers: 'purge-users',\n updateUserMetadata: 'update-user-metadata',\n // A change of the feature flag table, on a stage where\n // `isFeatureFlagApprovalRequired` is true.\n changeFeatureFlag: 'change-feature-flag',\n // Turns one flag off, and nothing else. A rollback needs fewer approvals\n // than a change.\n disableFeatureFlag: 'disable-feature-flag',\n // Engages one kill switch: the action that it guards stops for everybody,\n // or for the items of the lists of the request. To release a switch with\n // lists, empty the lists with a `change-feature-flag` request. To release\n // any other switch, use a `disable-feature-flag` request.\n engageKillSwitch: 'engage-kill-switch',\n // The publish and the rollback of a release-train generation. See\n // `release-train.ts` beside this file.\n releaseTrainPublish: 'release-train-publish',\n releaseTrainRollback: 'release-train-rollback',\n // Open to every Camundi, and it needs no approval on any stage.\n createPersonalOrganisation: 'create-personal-organisation',\n // Open to the owner of a trial organization, who must be a Camundi. It needs\n // no approval on any stage and moves the organization to the internal plan.\n convertTrialToInternal: 'convert-trial-to-internal',\n // Open to every Camundi, runs on dev only, and needs no approval. The two\n // use cases of custom hardware sizing.\n createCustomHardwareSizing: 'create-custom-hardware-sizing',\n removeCustomHardwareSizing: 'remove-custom-hardware-sizing',\n // The mutable versions of one or more generations, behind\n // `control.camundiApprovalFlow`. Console restarts every cluster of\n // each generation, which is why the write needs a second Camundi.\n changeGenerationVersions: 'change-generation-versions',\n // The name and the env vars of one generation, behind\n // `control.camundiApprovalFlow`. Console sends a new spec to every cluster of\n // the generation, which is why the write needs a second Camundi.\n editGeneration: 'edit-generation',\n // A new enterprise customer: a production and a development organization\n // in one step, behind `control.camundiApprovalFlow`. See\n // `automated-enterprise-onboarding.ts` in control-backend.\n automatedEnterpriseOnboarding: 'automated-enterprise-onboarding',\n // Open to every Camundi, runs on dev only, and needs no approval. The two\n // use cases of custom generations.\n createCustomGeneration: 'create-custom-generation',\n removeCustomGeneration: 'remove-custom-generation',\n // Open to org owners, runs on dev only, and needs no approval. It applies\n // or deactivates a cluster modification config of one cluster.\n selfServiceClusterModification: 'self-service-cluster-modification',\n // The enterprise onboarding of one organization, behind\n // `control.camundiApprovalFlow`: the contract, the plan type of\n // each cluster, and the reservations, in one request.\n onboardToEnterprise: 'onboard-to-enterprise',\n // The term, the start date and the included value metrics of the contract\n // of one enterprise organization, behind `control.camundiApprovalFlow`. See\n // `change-enterprise-contract.ts` in control-backend.\n changeEnterpriseContract: 'change-enterprise-contract',\n // The plan type and the hardware packages of ONE cluster, behind\n // `control.camundiApprovalFlow`. The bulk plan type update beside it also\n // checks the reservations and moves the cluster plan, but each cluster\n // keeps its packages there. This one can change the packages, and it has a\n // stale guard. See `change-cluster-plan-type.ts` in control-backend.\n changeClusterPlanType: 'change-cluster-plan-type',\n // The deletion of one cluster whose TTL ran out. Only the delete cron of\n // console-backend opens it, and it needs no approval. It is a record of the\n // deletion. See `cluster-ttl-deletion.ts` in control-backend.\n clusterTtlDeletion: 'cluster-ttl-deletion',\n // The deletion of the DB corpses or of the Kubernetes corpses that console\n // finds, behind `control.camundiApprovalFlow`. See\n // `delete-cluster-corpses.ts` in control-backend.\n deleteClusterCorpses: 'delete-cluster-corpses',\n // The force delete of a cluster plan type and of every cluster on it,\n // behind `control.camundiApprovalFlow`. See\n // `force-delete-cluster-plan-type.ts` in control-backend.\n forceDeleteClusterPlanType: 'force-delete-cluster-plan-type',\n // A change of the data retention limits of a cluster plan type, which\n // console sends to every cluster of the type. Behind\n // `control.camundiApprovalFlow`. See\n // `change-plan-type-retention-limits.ts` in control-backend.\n changePlanTypeRetentionLimits: 'change-plan-type-retention-limits',\n // The generation upgrade of one cluster with `--yolo` or with the upgrade\n // gate ignored, behind `control.camundiApprovalFlow`. A plain upgrade stays\n // a direct call. See `force-generation-upgrade.ts` in control-backend.\n forceGenerationUpgrade: 'force-generation-upgrade',\n // The deletion of one Console API client of an organization. See\n // `delete-api-client.ts` in control-backend.\n deleteApiClient: 'delete-api-client',\n // The licensing model of one enterprise organization, behind\n // `control.camundiApprovalFlow`. See `change-licensing-model.ts` in\n // control-backend.\n changeLicensingModel: 'change-licensing-model',\n // A time-limited grant that lets one Camundi run a pending request with no\n // approval, and the scheduled request that ends it. Behind\n // `control.approvalOverride`. See `approval-override.ts` in control-backend.\n grantApprovalOverride: 'grant-approval-override',\n revokeApprovalOverride: 'revoke-approval-override',\n // The deletion of the managed LLM tenant of one organization: the tenant,\n // the key and the spend history. Behind `control.camundiApprovalFlow`. See\n // `delete-managed-llm-tenant.ts` in control-backend.\n deleteManagedLlmTenant: 'delete-managed-llm-tenant',\n // The signup spam patterns of accounts, behind `control.camundiApprovalFlow`.\n changeSignupSpamPatterns: 'change-signup-spam-patterns',\n} as const\n\n/** The longest approval override grant, in hours: 14 days. */\nexport const APPROVAL_OVERRIDE_MAX_HOURS = 14 * 24\n\n/** The duration that the form of control-frontend offers first: one day. */\nexport const APPROVAL_OVERRIDE_DEFAULT_HOURS = 24\n\n/**\n * The use cases that an approval override grant can NOT run.\n *\n * Every other use case is overridable. These change who holds a permission,\n * the override mechanism itself, the feature flags of a stage, the address\n * that a person signs in with, or delete customer data, a backup, a sign-in\n * path, or a whole fleet of clusters. None of them is an emergency that one\n * Camundi must fix alone.\n *\n * The list fails open: a use case that is not here IS overridable. Thus a new\n * use case that deletes or that changes access must be added here. Its route\n * in accounts-backend or console-backend then refuses `overriddenBy` by\n * itself: `approvalActorSchemaFor` of their `AdminApprovalsRouter.ts` reads\n * this list.\n */\nexport const APPROVAL_OVERRIDE_DENYLIST: readonly string[] = [\n APPROVAL_USE_CASE_TYPES.changePlatformRoles,\n APPROVAL_USE_CASE_TYPES.grantApprovalOverride,\n APPROVAL_USE_CASE_TYPES.revokeApprovalOverride,\n APPROVAL_USE_CASE_TYPES.changeFeatureFlag,\n APPROVAL_USE_CASE_TYPES.disableFeatureFlag,\n APPROVAL_USE_CASE_TYPES.engageKillSwitch,\n APPROVAL_USE_CASE_TYPES.purgeUsers,\n APPROVAL_USE_CASE_TYPES.deleteUser,\n APPROVAL_USE_CASE_TYPES.deleteOrganization,\n APPROVAL_USE_CASE_TYPES.orgBulkDeletion,\n APPROVAL_USE_CASE_TYPES.clusterBulkDeletion,\n APPROVAL_USE_CASE_TYPES.forceDeleteClusterPlanType,\n APPROVAL_USE_CASE_TYPES.releaseTrainPublish,\n APPROVAL_USE_CASE_TYPES.releaseTrainRollback,\n APPROVAL_USE_CASE_TYPES.deleteSsoConnection,\n APPROVAL_USE_CASE_TYPES.changeUserEmail,\n APPROVAL_USE_CASE_TYPES.deleteInternalBackup,\n APPROVAL_USE_CASE_TYPES.deleteApiClient,\n APPROVAL_USE_CASE_TYPES.removeOrgMember,\n APPROVAL_USE_CASE_TYPES.deleteManagedLlmTenant,\n]\n\n/** isApprovalOverridable reports whether a grant can run a request of this type. */\nexport const isApprovalOverridable = (type: string): boolean =>\n !APPROVAL_OVERRIDE_DENYLIST.includes(type)\n\n/**\n * The most personal organizations that one Camundi can request.\n *\n * The request runs with no approval, so this cap is the only guard against a\n * loop that creates organizations without end. It counts the requests that a\n * Camundi opened, and a person who needs more asks a Camundi who holds\n * `AccountsPermissions.CREATE_ORG`.\n */\nexport const PERSONAL_ORGANIZATION_MAX_PER_REQUESTER = 10\n\n/** The shortest and longest name of a personal organization. */\nexport const PERSONAL_ORGANIZATION_NAME_MIN_LENGTH = 3\nexport const PERSONAL_ORGANIZATION_NAME_MAX_LENGTH = 100\n\nexport type ApprovalUseCaseType =\n (typeof APPROVAL_USE_CASE_TYPES)[keyof typeof APPROVAL_USE_CASE_TYPES]\n\n/**\n * The shortest extension that accounts-backend accepts.\n *\n * `POST /:orgId/extendtrial` refuses a date that is less than 14 days away\n * when the body carries `onBehalfOf`, and it measures those 14 days when the\n * CALL arrives. The floor here is 15 and not 14, for two reasons:\n *\n * - The two clocks are not the same instant. Accounts builds its own \"14 days\n * from now\" a few milliseconds after control-backend builds the date, so a\n * date of exactly 14 days is already in the past for the comparison.\n * - Accounts counts with `setDate`, which is calendar arithmetic. A change of\n * the daylight saving time moves its limit by an hour.\n */\nexport const EXTEND_TRIAL_MIN_DAYS = 15\n\n/**\n * The longest extension that accounts-backend accepts.\n *\n * The same route refuses a date more than 62 days away. 61 keeps the same\n * margin as the floor above.\n */\nexport const EXTEND_TRIAL_MAX_DAYS = 61\n\n/**\n * The most roles that one change-platform-roles request adds, or removes.\n *\n * The form of control-frontend offers every platform role, and a person who\n * gives a Camundi a new position rarely changes more than a few. A request with\n * more roles than this is a request that nobody reads before they approve it.\n */\nexport const PLATFORM_ROLE_CHANGE_MAX_ROLES = 10\n\n/**\n * The bounds of one change-signup-spam-patterns request. A pattern set is a\n * map from a signup field (`first`, `last`) to the text that blocks a signup.\n * The bounds keep a request readable for the person who approves it, and keep\n * a typo from writing a set that nobody can review. The limits allow about\n * 2 MB (20 \u00D7 500 \u00D7 200 characters). A request body over 1 MiB, `previous`\n * included, gets a 413 from control-backend. A real set is far smaller.\n */\nexport const SIGNUP_SPAM_PATTERNS_MAX_FIELDS = 20\nexport const SIGNUP_SPAM_PATTERNS_MAX_PER_FIELD = 500\nexport const SIGNUP_SPAM_PATTERN_MAX_LENGTH = 200\n\n/**\n * The longest text value that one change-org-limits request writes.\n *\n * A text limit holds a short value, such as a list of regions. The bound keeps\n * a request readable for the person who approves it.\n */\nexport const ORG_LIMIT_TEXT_MAX_LENGTH = 2000\n\n/**\n * LLM_BUDGET_TOP_UP_THRESHOLD is the share of the budget that the spend of a\n * managed LLM key must reach before a top-up is the normal case.\n *\n * A request below it is still possible, but the person who asks must confirm\n * it, and the request says so to the approver. Accounts refuses a top-up\n * below it that does not carry that confirmation.\n */\nexport const LLM_BUDGET_TOP_UP_THRESHOLD = 0.9\n\n/**\n * isLlmSpendBelowTopUpThreshold reports whether a top-up of a managed LLM key\n * needs the explicit confirmation of `LLM_BUDGET_TOP_UP_THRESHOLD`.\n */\nexport const isLlmSpendBelowTopUpThreshold = (\n spend: number,\n maxBudget: number,\n): boolean => spend < maxBudget * LLM_BUDGET_TOP_UP_THRESHOLD\n\n/**\n * The most users that one purge-users request deletes.\n *\n * The God Mode purge deletes one user after the other, and Auth0 limits how\n * fast that goes. A list longer than this is also a list that no approver\n * reads before they agree.\n */\nexport const PURGE_USERS_MAX_USERS = 1000\n\n/**\n * What a person must hold to open or to approve a purge-users request.\n *\n * The purge route of accounts, `DELETE /api/users/:userId/purge`, needs both\n * of the caller. The approval route of accounts checks both of the person who\n * asked, when control-backend sends `purge: true`. The use case of\n * control-backend returns this list from `permissionsFor`, and the form passes\n * it to `canCreate`, so the button and the server never disagree.\n */\nexport const PURGE_USERS_REQUIRED_PERMISSIONS: readonly string[] = [\n AccountsPermissions.GOD_PURGE_USERS,\n AccountsPermissions.DELETE_USER,\n]\n\n/**\n * The flag that opens the create route of remove-org-member. It is its own\n * flag, so the removal of an owner can go live on a stage where\n * `control.camundiApprovalFlow` is off.\n */\nexport const REMOVE_ORG_MEMBER_FLAG = 'control.removeOrgMember'\n\n/**\n * What a person must hold to open or to approve a remove-org-member request,\n * with or without a new owner. CS holds it through the Camundi permission\n * rules. Accounts checks the same list for the person who asked.\n */\nexport const REMOVE_ORG_MEMBER_REQUIRED_PERMISSIONS: readonly string[] = [\n AccountsPermissions.REMOVE_FROM_ORG_WITH_APPROVAL,\n]\n\n/**\n * The largest metadata object that one update-user-metadata request writes,\n * in characters of its JSON text.\n *\n * This is a bound of the product, and not the limit of Auth0, which is far\n * larger. The approvers read the whole object before they agree, and an\n * object that is longer than this is an object that nobody reads.\n */\nexport const USER_METADATA_MAX_LENGTH = 16_000\n\n/**\n * The largest metadata object that a request carries as the object that the\n * person who asked READ.\n *\n * It is larger than `USER_METADATA_MAX_LENGTH`, so a user whose metadata grew\n * past that bound can still get an edit that makes it smaller. It still has a\n * bound, because the request keeps the copy in its row.\n */\nexport const USER_METADATA_EXPECTED_MAX_LENGTH = 500_000\n\n/**\n * The bounds of an automated-enterprise-onboarding request.\n *\n * The accounts wizard holds the first four, and the schema of control-backend\n * and the form of control-frontend read them here, so the form never sends\n * what the service refuses.\n */\nexport const ENTERPRISE_ONBOARDING_NAME_MAX_LENGTH = 50\nexport const ENTERPRISE_ONBOARDING_SFDC_ID_MAX_LENGTH = 50\nexport const ENTERPRISE_ONBOARDING_TERM_MIN_MONTHS = 1\nexport const ENTERPRISE_ONBOARDING_TERM_MAX_MONTHS = 60\n/** The most of one value metric that a contract includes. */\nexport const ENTERPRISE_ONBOARDING_METRIC_MAX = 1_000_000_000_000\n/**\n * The most clusters of one plan type that an onboarding reserves: the cap of\n * the accounts wizard. Accounts checks the limit of the plan only when it\n * reserves, after it created the two organizations, so the request must not\n * carry a count that the plan refuses.\n */\nexport const ENTERPRISE_ONBOARDING_RESERVATION_MAX = 20\n\n/**\n * The most clusters of one plan type that a change-org-reservations request\n * reserves. The approval route of accounts-ng has the same bound.\n * `PATCH /api/salesplans/reserved` has no bound. A request with `force`\n * skips the maximum of the sales plan, thus this bound is its only bound.\n */\nexport const ORG_RESERVATION_MAX = 1000\n\n/**\n * Whether a string is a calendar day, `YYYY-MM-DD`, that exists.\n *\n * The shape alone is not enough: `Date` rolls `2026-02-30` to March 2 with\n * no error, and `2026-13-45` becomes an invalid date that a database refuses\n * only at the write. A request carries the day for days before it runs, so\n * the check is at the open, and in the form.\n */\nexport const isCalendarDay = (value: string): boolean =>\n /^\\d{4}-\\d{2}-\\d{2}$/.test(value) &&\n !Number.isNaN(Date.parse(value)) &&\n new Date(value).toISOString().startsWith(value)\n\n/**\n * What a person must hold to open or to approve a change-enterprise-contract\n * request.\n *\n * `PATCH /:orgId/enterprise` of accounts needs `ENTERPRISE_ORG_MODIFY`, and\n * also `ENTERPRISE_ORG_MODIFY_START_DATE` for a new start date. The approval\n * route of accounts checks the same list for the person who asked. The use\n * case of control-backend returns this list from `permissionsFor`, and the\n * form passes it to `canCreate`, so the button and the server never disagree.\n */\nexport const enterpriseContractChangePermissions = (\n changesStartDate: boolean,\n): string[] =>\n changesStartDate\n ? [\n AccountsPermissions.ENTERPRISE_ORG_MODIFY,\n AccountsPermissions.ENTERPRISE_ORG_MODIFY_START_DATE,\n ]\n : [AccountsPermissions.ENTERPRISE_ORG_MODIFY]\n\n/** The longest email address that a change-user-email request carries. */\nexport const APPROVAL_EMAIL_MAX_LENGTH = 320\n\n/**\n * The email addresses that a change-user-email request accepts.\n *\n * It is the email pattern of zod 4.6. The pattern is here, so the schema of\n * control-backend and the form of control-frontend accept the same addresses,\n * and a form never sends an address that the service refuses.\n */\nexport const APPROVAL_EMAIL_PATTERN =\n // biome-ignore lint/complexity/noUselessEscapeInRegex: the same source as zod, character for character\n /^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$/\n\n/**\n * The most generations that one change-generation-versions request changes.\n *\n * Each generation restarts every cluster on it. A request over more\n * generations than this is a request that no approver reads to the end.\n *\n * The two bounds of this use case also keep a request under the body limit\n * of control-backend (1 MiB, `server-options.ts` of the shared Fastify\n * layer): 20 generations, each with the expected value of the 2 image\n * versions of 2000 characters, is 80 000 characters before the rest of the\n * payload.\n */\nexport const GENERATION_VERSIONS_MAX_GENERATIONS = 20\n\n/**\n * The longest value of one mutable version of a generation.\n *\n * An image reference is short, and only the two image versions go through\n * the use case (`GENERATION_IMAGE_VERSION_KEYS`). The bound keeps a request\n * readable for the approver. See `GENERATION_VERSIONS_MAX_GEN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,MAAM,kCAAkC;AACxC,MAAM,qCAAqC;AAC3C,MAAM,iCAAiC;AAQvC,MAAM,4BAA4B;AAUlC,MAAM,8BAA8B;AAMpC,MAAM,gCAAgC,CAC3C,OACA,cACY,QAAQ,YAAY;AAS3B,MAAM,wBAAwB;AAW9B,MAAM,mCAAsD;AAAA,EACjE,oBAAoB;AAAA,EACpB,oBAAoB;AACtB;AAOO,MAAM,yBAAyB;AAO/B,MAAM,yCAA4D;AAAA,EACvE,oBAAoB;AACtB;AAUO,MAAM,2BAA2B;AAUjC,MAAM,oCAAoC;AAS1C,MAAM,wCAAwC;AAC9C,MAAM,2CAA2C;AACjD,MAAM,wCAAwC;AAC9C,MAAM,wCAAwC;AAE9C,MAAM,mCAAmC;AAOzC,MAAM,wCAAwC;AAQ9C,MAAM,sBAAsB;AAU5B,MAAM,gBAAgB,CAAC,UAC5B,sBAAsB,KAAK,KAAK,KAChC,CAAC,OAAO,MAAM,KAAK,MAAM,KAAK,CAAC,KAC/B,IAAI,KAAK,KAAK,EAAE,YAAY,EAAE,WAAW,KAAK;AAYzC,MAAM,sCAAsC,CACjD,qBAEA,mBACI;AAAA,EACE,oBAAoB;AAAA,EACpB,oBAAoB;AACtB,IACA,CAAC,oBAAoB,qBAAqB;AAGzC,MAAM,4BAA4B;AASlC,MAAM;AAAA;AAAA,EAEX;AAAA;AAcK,MAAM,sCAAsC;AAU5C,MAAM,sCAAsC;",
|
|
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 { AccountsPermissions } from '../permissions/accounts.permissions.js'\n\n/**\n * The names and the value ranges of the registered use cases.\n *\n * control-backend owns the registry, and a frontend reads it at run time\n * (`GET /api/approvals/use-cases`). Two things cannot wait for that answer:\n *\n * - **The identifier**, because a caller must NAME a use case to find it in the\n * registry, and to open a request of it.\n * - **The range of a payload field**, because a form holds the value before any\n * call goes out.\n *\n * Both live here, so the schema of the service and the form of the browser can\n * never hold different numbers.\n */\n\n/** The identifier of each use case, on the wire and in the table. */\nexport const APPROVAL_USE_CASE_TYPES = {\n sendToExpiredTrial: 'send-to-expired-trial',\n extendTrial: 'extend-trial',\n moveClusterOrg: 'move-cluster-org',\n // One use case for each type of a cluster bulk operation. The types need\n // different permissions and different approval counts, and a use case holds\n // one of each. See `cluster-bulk-operation.ts` beside this file.\n clusterBulkGenerationUpdate: 'cluster-bulk-generation-update',\n clusterBulkPlanUpdate: 'cluster-bulk-plan-update',\n clusterBulkPlanTypeUpdate: 'cluster-bulk-plan-type-update',\n clusterBulkSleepWakeup: 'cluster-bulk-sleep-wakeup',\n clusterBulkDeletion: 'cluster-bulk-deletion',\n clusterBulkSpecUpdate: 'cluster-bulk-spec-update',\n // The second group, behind `control.camundiApprovalFlow`.\n changePlatformRoles: 'change-platform-roles',\n deleteInternalBackup: 'delete-internal-backup',\n changeOrgLimits: 'change-org-limits',\n // The cluster reservations of one organization, behind\n // `control.camundiApprovalFlow`. It is not the enterprise contract: a\n // reservation change and a contract change are two requests. See\n // `change-org-reservations.ts` in control-backend.\n changeOrgReservations: 'change-org-reservations',\n deleteSsoConnection: 'delete-sso-connection',\n createSsoConnection: 'create-sso-connection',\n updateSsoConnection: 'update-sso-connection',\n changeSalesPlan: 'change-sales-plan',\n llmBudgetTopUp: 'llm-budget-top-up',\n requestInNegotiation: 'request-in-negotiation',\n // Behind its own flag `control.removeOrgMember`, and not\n // `control.camundiApprovalFlow`. See `REMOVE_ORG_MEMBER_FLAG`.\n removeOrgMember: 'remove-org-member',\n // The third group, behind `control.camundiApprovalFlow`.\n deleteOrganization: 'delete-organization',\n // Many organizations in one request. Behind `control.camundiApprovalFlow`\n // and its own flag `control.orgBulkDeletion`. See `org-bulk-deletion.ts`\n // beside this file.\n orgBulkDeletion: 'org-bulk-deletion',\n deleteUser: 'delete-user',\n changeUserEmail: 'change-user-email',\n purgeUsers: 'purge-users',\n updateUserMetadata: 'update-user-metadata',\n // A change of the feature flag table, on a stage where\n // `isFeatureFlagApprovalRequired` is true.\n changeFeatureFlag: 'change-feature-flag',\n // Turns one flag off, and nothing else. A rollback needs fewer approvals\n // than a change.\n disableFeatureFlag: 'disable-feature-flag',\n // Engages one kill switch: the action that it guards stops for everybody,\n // or for the items of the lists of the request. To release a switch with\n // lists, empty the lists with a `change-feature-flag` request. To release\n // any other switch, use a `disable-feature-flag` request.\n engageKillSwitch: 'engage-kill-switch',\n // The publish and the rollback of a release-train generation. See\n // `release-train.ts` beside this file.\n releaseTrainPublish: 'release-train-publish',\n releaseTrainRollback: 'release-train-rollback',\n // Open to every Camundi, and it needs no approval on any stage.\n createPersonalOrganisation: 'create-personal-organisation',\n // Open to the owner of a trial organization, who must be a Camundi. It needs\n // no approval on any stage and moves the organization to the internal plan.\n convertTrialToInternal: 'convert-trial-to-internal',\n // Open to the owner of an internal or trial organization, who must be a\n // Camundi. It needs no approval on any stage and deletes the organization.\n deleteOwnTestOrg: 'delete-own-test-org',\n // Open to every Camundi, runs on dev only, and needs no approval. The two\n // use cases of custom hardware sizing.\n createCustomHardwareSizing: 'create-custom-hardware-sizing',\n removeCustomHardwareSizing: 'remove-custom-hardware-sizing',\n // The mutable versions of one or more generations, behind\n // `control.camundiApprovalFlow`. Console restarts every cluster of\n // each generation, which is why the write needs a second Camundi.\n changeGenerationVersions: 'change-generation-versions',\n // The name and the env vars of one generation, behind\n // `control.camundiApprovalFlow`. Console sends a new spec to every cluster of\n // the generation, which is why the write needs a second Camundi.\n editGeneration: 'edit-generation',\n // A new enterprise customer: a production and a development organization\n // in one step, behind `control.camundiApprovalFlow`. See\n // `automated-enterprise-onboarding.ts` in control-backend.\n automatedEnterpriseOnboarding: 'automated-enterprise-onboarding',\n // Open to every Camundi, runs on dev only, and needs no approval. The two\n // use cases of custom generations.\n createCustomGeneration: 'create-custom-generation',\n removeCustomGeneration: 'remove-custom-generation',\n // Open to org owners, runs on dev only, and needs no approval. It applies\n // or deactivates a cluster modification config of one cluster.\n selfServiceClusterModification: 'self-service-cluster-modification',\n // The enterprise onboarding of one organization, behind\n // `control.camundiApprovalFlow`: the contract, the plan type of\n // each cluster, and the reservations, in one request.\n onboardToEnterprise: 'onboard-to-enterprise',\n // The term, the start date and the included value metrics of the contract\n // of one enterprise organization, behind `control.camundiApprovalFlow`. See\n // `change-enterprise-contract.ts` in control-backend.\n changeEnterpriseContract: 'change-enterprise-contract',\n // The plan type and the hardware packages of ONE cluster, behind\n // `control.camundiApprovalFlow`. The bulk plan type update beside it also\n // checks the reservations and moves the cluster plan, but each cluster\n // keeps its packages there. This one can change the packages, and it has a\n // stale guard. See `change-cluster-plan-type.ts` in control-backend.\n changeClusterPlanType: 'change-cluster-plan-type',\n // The deletion of one cluster whose TTL ran out. Only the delete cron of\n // console-backend opens it, and it needs no approval. It is a record of the\n // deletion. See `cluster-ttl-deletion.ts` in control-backend.\n clusterTtlDeletion: 'cluster-ttl-deletion',\n // The deletion of the DB corpses or of the Kubernetes corpses that console\n // finds, behind `control.camundiApprovalFlow`. See\n // `delete-cluster-corpses.ts` in control-backend.\n deleteClusterCorpses: 'delete-cluster-corpses',\n // The force delete of a cluster plan type and of every cluster on it,\n // behind `control.camundiApprovalFlow`. See\n // `force-delete-cluster-plan-type.ts` in control-backend.\n forceDeleteClusterPlanType: 'force-delete-cluster-plan-type',\n // A change of the data retention limits of a cluster plan type, which\n // console sends to every cluster of the type. Behind\n // `control.camundiApprovalFlow`. See\n // `change-plan-type-retention-limits.ts` in control-backend.\n changePlanTypeRetentionLimits: 'change-plan-type-retention-limits',\n // The generation upgrade of one cluster with `--yolo` or with the upgrade\n // gate ignored, behind `control.camundiApprovalFlow`. A plain upgrade stays\n // a direct call. See `force-generation-upgrade.ts` in control-backend.\n forceGenerationUpgrade: 'force-generation-upgrade',\n // The deletion of one Console API client of an organization. See\n // `delete-api-client.ts` in control-backend.\n deleteApiClient: 'delete-api-client',\n // The licensing model of one enterprise organization, behind\n // `control.camundiApprovalFlow`. See `change-licensing-model.ts` in\n // control-backend.\n changeLicensingModel: 'change-licensing-model',\n // A time-limited grant that lets one Camundi run a pending request with no\n // approval, and the scheduled request that ends it. Behind\n // `control.approvalOverride`. See `approval-override.ts` in control-backend.\n grantApprovalOverride: 'grant-approval-override',\n revokeApprovalOverride: 'revoke-approval-override',\n // The deletion of the managed LLM tenant of one organization: the tenant,\n // the key and the spend history. Behind `control.camundiApprovalFlow`. See\n // `delete-managed-llm-tenant.ts` in control-backend.\n deleteManagedLlmTenant: 'delete-managed-llm-tenant',\n // The signup spam patterns of accounts, behind `control.camundiApprovalFlow`.\n changeSignupSpamPatterns: 'change-signup-spam-patterns',\n} as const\n\n/** The longest approval override grant, in hours: 14 days. */\nexport const APPROVAL_OVERRIDE_MAX_HOURS = 14 * 24\n\n/** The duration that the form of control-frontend offers first: one day. */\nexport const APPROVAL_OVERRIDE_DEFAULT_HOURS = 24\n\n/**\n * The use cases that an approval override grant can NOT run.\n *\n * Every other use case is overridable. These change who holds a permission,\n * the override mechanism itself, the feature flags of a stage, the address\n * that a person signs in with, or delete customer data, a backup, a sign-in\n * path, or a whole fleet of clusters. None of them is an emergency that one\n * Camundi must fix alone.\n *\n * The list fails open: a use case that is not here IS overridable. Thus a new\n * use case that deletes or that changes access must be added here. Its route\n * in accounts-backend or console-backend then refuses `overriddenBy` by\n * itself: `approvalActorSchemaFor` of their `AdminApprovalsRouter.ts` reads\n * this list.\n */\nexport const APPROVAL_OVERRIDE_DENYLIST: readonly string[] = [\n APPROVAL_USE_CASE_TYPES.changePlatformRoles,\n APPROVAL_USE_CASE_TYPES.grantApprovalOverride,\n APPROVAL_USE_CASE_TYPES.revokeApprovalOverride,\n APPROVAL_USE_CASE_TYPES.changeFeatureFlag,\n APPROVAL_USE_CASE_TYPES.disableFeatureFlag,\n APPROVAL_USE_CASE_TYPES.engageKillSwitch,\n APPROVAL_USE_CASE_TYPES.purgeUsers,\n APPROVAL_USE_CASE_TYPES.deleteUser,\n APPROVAL_USE_CASE_TYPES.deleteOrganization,\n APPROVAL_USE_CASE_TYPES.orgBulkDeletion,\n APPROVAL_USE_CASE_TYPES.clusterBulkDeletion,\n APPROVAL_USE_CASE_TYPES.forceDeleteClusterPlanType,\n APPROVAL_USE_CASE_TYPES.releaseTrainPublish,\n APPROVAL_USE_CASE_TYPES.releaseTrainRollback,\n APPROVAL_USE_CASE_TYPES.deleteSsoConnection,\n APPROVAL_USE_CASE_TYPES.changeUserEmail,\n APPROVAL_USE_CASE_TYPES.deleteInternalBackup,\n APPROVAL_USE_CASE_TYPES.deleteApiClient,\n APPROVAL_USE_CASE_TYPES.removeOrgMember,\n APPROVAL_USE_CASE_TYPES.deleteManagedLlmTenant,\n]\n\n/** isApprovalOverridable reports whether a grant can run a request of this type. */\nexport const isApprovalOverridable = (type: string): boolean =>\n !APPROVAL_OVERRIDE_DENYLIST.includes(type)\n\n/**\n * The most personal organizations that one Camundi can request.\n *\n * The request runs with no approval, so this cap is the only guard against a\n * loop that creates organizations without end. It counts the requests that a\n * Camundi opened, and a person who needs more asks a Camundi who holds\n * `AccountsPermissions.CREATE_ORG`.\n */\nexport const PERSONAL_ORGANIZATION_MAX_PER_REQUESTER = 10\n\n/** The shortest and longest name of a personal organization. */\nexport const PERSONAL_ORGANIZATION_NAME_MIN_LENGTH = 3\nexport const PERSONAL_ORGANIZATION_NAME_MAX_LENGTH = 100\n\nexport type ApprovalUseCaseType =\n (typeof APPROVAL_USE_CASE_TYPES)[keyof typeof APPROVAL_USE_CASE_TYPES]\n\n/**\n * The shortest extension that accounts-backend accepts.\n *\n * `POST /:orgId/extendtrial` refuses a date that is less than 14 days away\n * when the body carries `onBehalfOf`, and it measures those 14 days when the\n * CALL arrives. The floor here is 15 and not 14, for two reasons:\n *\n * - The two clocks are not the same instant. Accounts builds its own \"14 days\n * from now\" a few milliseconds after control-backend builds the date, so a\n * date of exactly 14 days is already in the past for the comparison.\n * - Accounts counts with `setDate`, which is calendar arithmetic. A change of\n * the daylight saving time moves its limit by an hour.\n */\nexport const EXTEND_TRIAL_MIN_DAYS = 15\n\n/**\n * The longest extension that accounts-backend accepts.\n *\n * The same route refuses a date more than 62 days away. 61 keeps the same\n * margin as the floor above.\n */\nexport const EXTEND_TRIAL_MAX_DAYS = 61\n\n/**\n * The most roles that one change-platform-roles request adds, or removes.\n *\n * The form of control-frontend offers every platform role, and a person who\n * gives a Camundi a new position rarely changes more than a few. A request with\n * more roles than this is a request that nobody reads before they approve it.\n */\nexport const PLATFORM_ROLE_CHANGE_MAX_ROLES = 10\n\n/**\n * The bounds of one change-signup-spam-patterns request. A pattern set is a\n * map from a signup field (`first`, `last`) to the text that blocks a signup.\n * The bounds keep a request readable for the person who approves it, and keep\n * a typo from writing a set that nobody can review. The limits allow about\n * 2 MB (20 \u00D7 500 \u00D7 200 characters). A request body over 1 MiB, `previous`\n * included, gets a 413 from control-backend. A real set is far smaller.\n */\nexport const SIGNUP_SPAM_PATTERNS_MAX_FIELDS = 20\nexport const SIGNUP_SPAM_PATTERNS_MAX_PER_FIELD = 500\nexport const SIGNUP_SPAM_PATTERN_MAX_LENGTH = 200\n\n/**\n * The longest text value that one change-org-limits request writes.\n *\n * A text limit holds a short value, such as a list of regions. The bound keeps\n * a request readable for the person who approves it.\n */\nexport const ORG_LIMIT_TEXT_MAX_LENGTH = 2000\n\n/**\n * LLM_BUDGET_TOP_UP_THRESHOLD is the share of the budget that the spend of a\n * managed LLM key must reach before a top-up is the normal case.\n *\n * A request below it is still possible, but the person who asks must confirm\n * it, and the request says so to the approver. Accounts refuses a top-up\n * below it that does not carry that confirmation.\n */\nexport const LLM_BUDGET_TOP_UP_THRESHOLD = 0.9\n\n/**\n * isLlmSpendBelowTopUpThreshold reports whether a top-up of a managed LLM key\n * needs the explicit confirmation of `LLM_BUDGET_TOP_UP_THRESHOLD`.\n */\nexport const isLlmSpendBelowTopUpThreshold = (\n spend: number,\n maxBudget: number,\n): boolean => spend < maxBudget * LLM_BUDGET_TOP_UP_THRESHOLD\n\n/**\n * The most users that one purge-users request deletes.\n *\n * The God Mode purge deletes one user after the other, and Auth0 limits how\n * fast that goes. A list longer than this is also a list that no approver\n * reads before they agree.\n */\nexport const PURGE_USERS_MAX_USERS = 1000\n\n/**\n * What a person must hold to open or to approve a purge-users request.\n *\n * The purge route of accounts, `DELETE /api/users/:userId/purge`, needs both\n * of the caller. The approval route of accounts checks both of the person who\n * asked, when control-backend sends `purge: true`. The use case of\n * control-backend returns this list from `permissionsFor`, and the form passes\n * it to `canCreate`, so the button and the server never disagree.\n */\nexport const PURGE_USERS_REQUIRED_PERMISSIONS: readonly string[] = [\n AccountsPermissions.GOD_PURGE_USERS,\n AccountsPermissions.DELETE_USER,\n]\n\n/**\n * The flag that opens the create route of remove-org-member. It is its own\n * flag, so the removal of an owner can go live on a stage where\n * `control.camundiApprovalFlow` is off.\n */\nexport const REMOVE_ORG_MEMBER_FLAG = 'control.removeOrgMember'\n\n/**\n * What a person must hold to open or to approve a remove-org-member request,\n * with or without a new owner. CS holds it through the Camundi permission\n * rules. Accounts checks the same list for the person who asked.\n */\nexport const REMOVE_ORG_MEMBER_REQUIRED_PERMISSIONS: readonly string[] = [\n AccountsPermissions.REMOVE_FROM_ORG_WITH_APPROVAL,\n]\n\n/**\n * The largest metadata object that one update-user-metadata request writes,\n * in characters of its JSON text.\n *\n * This is a bound of the product, and not the limit of Auth0, which is far\n * larger. The approvers read the whole object before they agree, and an\n * object that is longer than this is an object that nobody reads.\n */\nexport const USER_METADATA_MAX_LENGTH = 16_000\n\n/**\n * The largest metadata object that a request carries as the object that the\n * person who asked READ.\n *\n * It is larger than `USER_METADATA_MAX_LENGTH`, so a user whose metadata grew\n * past that bound can still get an edit that makes it smaller. It still has a\n * bound, because the request keeps the copy in its row.\n */\nexport const USER_METADATA_EXPECTED_MAX_LENGTH = 500_000\n\n/**\n * The bounds of an automated-enterprise-onboarding request.\n *\n * The accounts wizard holds the first four, and the schema of control-backend\n * and the form of control-frontend read them here, so the form never sends\n * what the service refuses.\n */\nexport const ENTERPRISE_ONBOARDING_NAME_MAX_LENGTH = 50\nexport const ENTERPRISE_ONBOARDING_SFDC_ID_MAX_LENGTH = 50\nexport const ENTERPRISE_ONBOARDING_TERM_MIN_MONTHS = 1\nexport const ENTERPRISE_ONBOARDING_TERM_MAX_MONTHS = 60\n/** The most of one value metric that a contract includes. */\nexport const ENTERPRISE_ONBOARDING_METRIC_MAX = 1_000_000_000_000\n/**\n * The most clusters of one plan type that an onboarding reserves: the cap of\n * the accounts wizard. Accounts checks the limit of the plan only when it\n * reserves, after it created the two organizations, so the request must not\n * carry a count that the plan refuses.\n */\nexport const ENTERPRISE_ONBOARDING_RESERVATION_MAX = 20\n\n/**\n * The most clusters of one plan type that a change-org-reservations request\n * reserves. The approval route of accounts-ng has the same bound.\n * `PATCH /api/salesplans/reserved` has no bound. A request with `force`\n * skips the maximum of the sales plan, thus this bound is its only bound.\n */\nexport const ORG_RESERVATION_MAX = 1000\n\n/**\n * Whether a string is a calendar day, `YYYY-MM-DD`, that exists.\n *\n * The shape alone is not enough: `Date` rolls `2026-02-30` to March 2 with\n * no error, and `2026-13-45` becomes an invalid date that a database refuses\n * only at the write. A request carries the day for days before it runs, so\n * the check is at the open, and in the form.\n */\nexport const isCalendarDay = (value: string): boolean =>\n /^\\d{4}-\\d{2}-\\d{2}$/.test(value) &&\n !Number.isNaN(Date.parse(value)) &&\n new Date(value).toISOString().startsWith(value)\n\n/**\n * What a person must hold to open or to approve a change-enterprise-contract\n * request.\n *\n * `PATCH /:orgId/enterprise` of accounts needs `ENTERPRISE_ORG_MODIFY`, and\n * also `ENTERPRISE_ORG_MODIFY_START_DATE` for a new start date. The approval\n * route of accounts checks the same list for the person who asked. The use\n * case of control-backend returns this list from `permissionsFor`, and the\n * form passes it to `canCreate`, so the button and the server never disagree.\n */\nexport const enterpriseContractChangePermissions = (\n changesStartDate: boolean,\n): string[] =>\n changesStartDate\n ? [\n AccountsPermissions.ENTERPRISE_ORG_MODIFY,\n AccountsPermissions.ENTERPRISE_ORG_MODIFY_START_DATE,\n ]\n : [AccountsPermissions.ENTERPRISE_ORG_MODIFY]\n\n/** The longest email address that a change-user-email request carries. */\nexport const APPROVAL_EMAIL_MAX_LENGTH = 320\n\n/**\n * The email addresses that a change-user-email request accepts.\n *\n * It is the email pattern of zod 4.6. The pattern is here, so the schema of\n * control-backend and the form of control-frontend accept the same addresses,\n * and a form never sends an address that the service refuses.\n */\nexport const APPROVAL_EMAIL_PATTERN =\n // biome-ignore lint/complexity/noUselessEscapeInRegex: the same source as zod, character for character\n /^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$/\n\n/**\n * The most generations that one change-generation-versions request changes.\n *\n * Each generation restarts every cluster on it. A request over more\n * generations than this is a request that no approver reads to the end.\n *\n * The two bounds of this use case also keep a request under the body limit\n * of control-backend (1 MiB, `server-options.ts` of the shared Fastify\n * layer): 20 generations, each with the expected value of the 2 image\n * versions of 2000 characters, is 80 000 characters before the rest of the\n * payload.\n */\nexport const GENERATION_VERSIONS_MAX_GENERATIONS = 20\n\n/**\n * The longest value of one mutable version of a generation.\n *\n * An image reference is short, and only the two image versions go through\n * the use case (`GENERATION_IMAGE_VERSION_KEYS`). The bound keeps a request\n * readable for the approver. See `GENERATION_VERSIONS_MAX_GENERATIONS` for\n * the sum.\n */\nexport const GENERATION_VERSION_VALUE_MAX_LENGTH = 2000\n"],
|
|
5
|
+
"mappings": "AAMA,SAAS,2BAA2B;AAkB7B,MAAM,0BAA0B;AAAA,EACrC,oBAAoB;AAAA,EACpB,aAAa;AAAA,EACb,gBAAgB;AAAA;AAAA;AAAA;AAAA,EAIhB,6BAA6B;AAAA,EAC7B,uBAAuB;AAAA,EACvB,2BAA2B;AAAA,EAC3B,wBAAwB;AAAA,EACxB,qBAAqB;AAAA,EACrB,uBAAuB;AAAA;AAA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tB;AAUO,MAAM,2BAA2B;AAUjC,MAAM,oCAAoC;AAS1C,MAAM,wCAAwC;AAC9C,MAAM,2CAA2C;AACjD,MAAM,wCAAwC;AAC9C,MAAM,wCAAwC;AAE9C,MAAM,mCAAmC;AAOzC,MAAM,wCAAwC;AAQ9C,MAAM,sBAAsB;AAU5B,MAAM,gBAAgB,CAAC,UAC5B,sBAAsB,KAAK,KAAK,KAChC,CAAC,OAAO,MAAM,KAAK,MAAM,KAAK,CAAC,KAC/B,IAAI,KAAK,KAAK,EAAE,YAAY,EAAE,WAAW,KAAK;AAYzC,MAAM,sCAAsC,CACjD,qBAEA,mBACI;AAAA,EACE,oBAAoB;AAAA,EACpB,oBAAoB;AACtB,IACA,CAAC,oBAAoB,qBAAqB;AAGzC,MAAM,4BAA4B;AASlC,MAAM;AAAA;AAAA,EAEX;AAAA;AAcK,MAAM,sCAAsC;AAU5C,MAAM,sCAAsC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -609,11 +609,12 @@ export interface ApprovalUseCaseDto {
|
|
|
609
609
|
* source, so that nobody can change what is not theirs. The action can
|
|
610
610
|
* touch an organization only when that check lets the person change it.
|
|
611
611
|
*
|
|
612
|
-
* `create-personal-organisation`, `convert-trial-to-internal
|
|
613
|
-
* use cases of custom hardware sizing set
|
|
614
|
-
* does the second check in one way: accounts
|
|
615
|
-
* the organization, and only an OWNER who is
|
|
616
|
-
* cases of custom hardware sizing do the second
|
|
612
|
+
* `create-personal-organisation`, `convert-trial-to-internal`,
|
|
613
|
+
* `delete-own-test-org` and the two use cases of custom hardware sizing set
|
|
614
|
+
* it. `convert-trial-to-internal` does the second check in one way: accounts
|
|
615
|
+
* reads the role of the person in the organization, and only an OWNER who is
|
|
616
|
+
* a Camundi passes. The two use cases of custom hardware sizing do the second
|
|
617
|
+
* check in three ways:
|
|
617
618
|
*
|
|
618
619
|
* - Creating a plan, and unlinking a plan from one organization, read the
|
|
619
620
|
* role of the person in that organization. Only an OWNER passes.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/dtos/ApprovalJob.dto.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\n/**\n * The wire types of the generic approval mechanism.\n *\n * This file holds no logic and no dependency, because three consumers read it:\n * control-backend, control-frontend and cloudbot. The rules that read these\n * types are in `../approvals/policy.js`, and they are pure for the same reason.\n */\n\nimport type { ApprovalIncidentDto } from '../approvals/incident-link.js'\n\n/**\n * Every state that an approval request can hold.\n *\n * A `const` tuple, not an enum, so it is both the union type and the list that\n * validates a status filter at run time.\n *\n * The path of a request: `pending` until it reaches the threshold. Then\n * `executing` (automatic mode) or `approved` (explicit mode, which waits for a\n * person to press the button). `executed` or `failed` after the action ran. A\n * request that never reaches the threshold ends `rejected`, `withdrawn` or\n * `expired`.\n *\n * `scheduled` is a request that the service opened by itself, and that runs\n * at `runAt` with no approval. It does not expire, and nobody can withdraw or\n * reject it. A holder of its permissions can run it before `runAt`.\n */\nexport const APPROVAL_JOB_STATUSES = [\n 'pending',\n 'scheduled',\n 'approved',\n 'executing',\n 'executed',\n 'failed',\n 'rejected',\n 'withdrawn',\n 'expired',\n] as const\n\nexport type ApprovalJobStatus = (typeof APPROVAL_JOB_STATUSES)[number]\n\n/**\n * The states in which the action of a request is still COMING.\n *\n * `pending` waits for approvals, `scheduled` waits for its time, `approved`\n * waits for a person to press the button, and `executing` is running now. Each of them can still change the\n * world, so two requests for one target must not be in these states together.\n * `dedupeKey` reads this set for that reason.\n *\n * `failed` is NOT here, although a person can run a failed request again. A\n * failed request runs only when a person presses the button, and that person\n * sees the row. Blocking a new request on a failed one would also trap the\n * key: `canWithdraw` accepts `pending` alone, so nobody could close it.\n *\n * `executed`, `rejected`, `withdrawn` and `expired` are the end of a request.\n */\nexport const APPROVAL_LIVE_STATUSES = [\n 'pending',\n 'scheduled',\n 'approved',\n 'executing',\n] as const satisfies readonly ApprovalJobStatus[]\n\n/**\n * How many requests one page of the list holds when the caller asks for no\n * number.\n *\n * The list is a work queue that a Camundi reads, so the page is large: a\n * person wants the whole queue and not ten rows at a time. What the number is\n * for is the ceiling below.\n */\nexport const APPROVAL_PAGE_SIZE_DEFAULT = 500\n\n/**\n * The largest page that the service builds, and the largest that a caller may\n * ask for. The API answers 400 above it.\n *\n * The list had no limit at all. One authenticated caller could then make the\n * service read the whole table into memory, serialize it, and do it again, so\n * the cost of a request grew with the age of the service and with nothing that\n * the caller had to pay for. A ceiling turns that into a fixed cost.\n *\n * It is HERE and not only in the service, because the view must know it: a\n * page that asked for more would get a 400 instead of rows.\n */\nexport const APPROVAL_PAGE_SIZE_MAX = 2000\n\n/**\n * The columns that the queue can be ordered by.\n *\n * A NAME and not an SQL expression: the repository maps each one, so a caller\n * can never name a column that this list does not hold. `status` orders by the\n * EFFECTIVE status, because a `pending` row whose time ran out reads as\n * `expired` everywhere else.\n */\nexport const APPROVAL_SORT_FIELDS = [\n 'createdAt',\n 'expiresAt',\n 'status',\n 'type',\n 'createdBy',\n] as const\n\nexport type ApprovalSortField = (typeof APPROVAL_SORT_FIELDS)[number]\n\nexport type ApprovalSortOrder = 'asc' | 'desc'\n\n/** The default order of the queue: the newest request first. */\nexport const APPROVAL_SORT_DEFAULT: {\n sort: ApprovalSortField\n order: ApprovalSortOrder\n} = { sort: 'createdAt', order: 'desc' }\n\n/**\n * The longest reason that a request, a rejection or a withdrawal accepts.\n *\n * ONE number, because three routes of control-backend hold it and three fields\n * of control-frontend must stop there. A field that let a person write more\n * than the schema accepts turns their sentence into a 400 after they wrote it.\n */\nexport const APPROVAL_REASON_MAX_LENGTH = 2000\n\n/**\n * The largest number of approvals that a caller can ask for.\n *\n * A request that asks for 400 approvals can never reach them, so it is a\n * request that only fills the table and expires. The ceiling turns that into a\n * 400 at the moment a person types it. It is HERE because the form of the\n * bulk operation must stop at the same number as the route.\n */\nexport const APPROVAL_ACKS_MAX = 10\n\n/**\n * The longest search text that the list accepts.\n *\n * A search runs `ILIKE` over the payload of every visible row, so the cost of\n * one call follows the length of the text. Nothing a person types to find a\n * request is near this.\n */\nexport const APPROVAL_SEARCH_MAX_LENGTH = 200\n\n/**\n * APPROVAL_TYPE_FILTER_MAX is the most use case types that one `type` filter\n * names. The registry holds fewer, so the ceiling only stops a list with no\n * end. control-backend answers 400 above it.\n */\nexport const APPROVAL_TYPE_FILTER_MAX = 100\n\n/** APPROVAL_TYPE_MAX_LENGTH is the longest type that a `type` filter names. */\nexport const APPROVAL_TYPE_MAX_LENGTH = 200\n\n/**\n * The payload field that names the organization a request acts on.\n *\n * It is a CONVENTION, and this constant is what makes the convention readable\n * from both sides. A use case whose action hits one organization puts the id of\n * that organization in this field, and `GET /api/approvals?orgId=\u2026` then finds\n * the request with no knowledge of the use case. The filter reads this one\n * field of the payload, so it matches the whole id and nothing else. The free\n * text search reads the payload as TEXT, which also matches an id that only\n * appears inside another field, and it cannot answer \"the requests of this\n * organization\".\n *\n * The organization page of control-frontend does NOT read this field. It asks\n * the entity-link filter (`entityType=org`), which reads a row that\n * `relatedEntities` of a use case writes \u2014 see `ApprovalEntityRef`. The summary\n * is separate again: the `org` field of a `summarize` result is what a READER\n * follows.\n */\nexport const APPROVAL_PAYLOAD_ORG_FIELD = 'orgId'\n\n/**\n * How many requests each status and each use case type holds, for the filters\n * of the queue.\n *\n * Every status number answers the SAME question as the list beside it: the\n * counts are built with the visibility rule, the action filter and the search\n * text of the caller, and with the lazy expiry. A count that ignored one of\n * those would send a person to a filter that then shows nothing. `byType` is\n * the exception: see its own note.\n */\nexport interface ApprovalStatusCountsDto {\n /** Every request that matches, whatever its status. */\n all: number\n /** One number for each status. A status with no request is 0, never absent. */\n byStatus: Record<ApprovalJobStatus, number>\n /**\n * One number for each use case type, over every status.\n *\n * It ignores the type filter, so a type facet keeps its number while it is\n * on or off. Every other filter applies. A type with no request has no key,\n * so read a missing key as 0, and read only an own key: a type id such as\n * `__proto__` must not reach the prototype.\n *\n * Optional, because an older control-backend does not send it. Read an\n * absent field as no counts.\n */\n byType?: Record<string, number>\n}\n\n/**\n * What happens when a request reaches its threshold.\n *\n * `auto` runs the action immediately. `explicit` holds the request at\n * `approved` and waits for a person to run it.\n */\nexport type ApprovalExecutionMode = 'auto' | 'explicit'\n\n/**\n * WHERE the action runs. It is a separate question from who starts it.\n *\n * - `inline` runs the action inside the call that started it, and the answer\n * already carries the outcome. Right for one call to another service.\n * - `background` answers as soon as the request is claimed, and the action\n * runs on. It reports into `ApprovalJobDto.progress`, and the row is the\n * only place that holds the progress, so a reload and a second person read\n * the same numbers. A pod that stops loses the run, and the reconciler of\n * control-backend recovers the row.\n *\n * An action over thousands of targets MUST be `background`. `inline` would\n * hold one HTTP request for the whole run, and the ingress, the load balancer\n * and the browser each have their own deadline before it finishes.\n *\n * An `inline` action must not read `context.signal`. The runner trusts the\n * result of an `inline` action that returns after a drain, and it would count\n * a partial run as `executed`. An action that stops between targets is\n * `background`.\n */\nexport type ApprovalActionMode = 'inline' | 'background'\n\n/**\n * A person, as an approval request records them.\n *\n * Both keys are kept. The machine then never has to choose one identity key,\n * which is what split the earlier acknowledgement flows: some held an email and\n * some held a user id, and the two could not be compared.\n */\nexport interface ApprovalActor {\n userId: string\n email: string\n}\n\nexport interface ApprovalAck extends ApprovalActor {\n /** An ISO timestamp. It is in a json column, so it is a string, not a Date. */\n date: string\n}\n\n/**\n * Who asked for an action, and who agreed to it.\n *\n * Every route of `api/admin/approvals` takes this envelope, and control-backend\n * builds it from the request that it runs. The envelope exists because the\n * token cannot carry it: the call is machine to machine, so `sub` holds the id\n * of the Auth0 application and not a person. A service that reads the token\n * alone therefore writes \"control-backend\" into its audit record, which hides\n * the two Camundis that the whole mechanism exists to record.\n *\n * `approvedBy` is a list, because a use case can need more than one approval,\n * and the record must name all of them. It can also be EMPTY: how many\n * approvals an action needs is a number of the use case, and `move-cluster-org`\n * holds zero on purpose. The person in `requestedBy` is never in the list: the\n * four-eyes rule is that the person who asks is not the person who agrees, and\n * control-backend holds that rule.\n *\n * Each person carries both keys of `ApprovalActor`. The email is what a route\n * uses to ask Auth0 about the person, and the user id is what an audit record\n * holds, because every other record of the fleet holds an Auth0 `sub`.\n *\n * CAUTION: The envelope is a CLAIM of the caller, and not proof. A route that\n * acts on it must ask Auth0 again whether `requestedBy` may do the action.\n * That means the permission of the action. For a use case with\n * `openToEveryone`, it means that the person is a Camundi, because no\n * permission runs that action. `api/admin/approvals` in accounts-backend does\n * that. See the note on `M2M_CONTROL_APPROVALS`.\n */\nexport interface ApprovalM2mActor {\n /** The id of the approval request, to join the records of both services. */\n requestId: string\n /** The Camundi who opened the request. */\n requestedBy: ApprovalActor\n /** The Camundis who approved it. Empty when the use case needs none. */\n approvedBy: ApprovalActor[]\n /**\n * The Camundi who ran the request with an approval override grant, in\n * place of the approvals that it still needed. Absent for every other run.\n *\n * control-backend checked the grant, the permissions of this person and\n * `APPROVAL_OVERRIDE_DENYLIST` before the run. A receiver that counts the\n * approvals of an overridable type accepts this person in place of the\n * approvals that are missing, and refuses this field for every other type.\n * This person can be the person in `requestedBy`, because that is what a\n * grant is for. A receiver that refuses the target of an action as an\n * approver refuses this person as well, also when they asked.\n */\n overriddenBy?: ApprovalActor\n}\n\n/**\n * What one value of a summary field is.\n *\n * `text` is what a person reads. `id` is what a link points at, and it is\n * absent when the kind names no entity. The two are separate because the text\n * is a COPY that the request keeps: an organization that gets a new name after\n * the request was opened must still read as the organization that the person\n * chose.\n */\nexport interface ApprovalSummaryValue {\n text: string\n id?: string\n}\n\n/**\n * How a reader must render one field of a summary.\n *\n * `org`, `cluster` and `user` name an entity, so a reader can link to it and\n * can resolve a fresh name. The others are plain: `date` is an ISO timestamp,\n * and `code` is a value that must keep its characters, such as a json fragment.\n */\nexport const APPROVAL_SUMMARY_FIELD_KINDS = [\n 'text',\n 'number',\n 'boolean',\n 'date',\n 'org',\n 'cluster',\n 'user',\n 'code',\n] as const\n\nexport type ApprovalSummaryFieldKind =\n (typeof APPROVAL_SUMMARY_FIELD_KINDS)[number]\n\n/**\n * One labelled field of the payload of a request.\n *\n * This is what makes ONE view able to show EVERY use case. The payload of a\n * request is an object of anything, so a generic view can only print it as\n * json. The use case turns it into labelled fields here, and the view renders\n * a field by its kind: it links an `org`, it formats a `date`, and it lists\n * 300 clusters as 300 links.\n *\n * `values` is always an array. A field that holds one value holds an array of\n * one, so a reader needs no branch for \"one or many\".\n */\nexport interface ApprovalSummaryField {\n label: string\n kind: ApprovalSummaryFieldKind\n values: ApprovalSummaryValue[]\n /**\n * The values that this request replaces, for a field that changes. A view\n * shows them as removed beside `values` as added. A field with no\n * `previous` is not a change.\n */\n previous?: ApprovalSummaryValue[]\n /** The count of `previous`, when the list cut it. Like `total`, for `previous`. */\n previousTotal?: number\n /**\n * How many values the field holds, when `values` holds only the first of\n * them. The list route cuts every field to `APPROVAL_LIST_SUMMARY_VALUES_MAX`\n * values. The detail route sends every value and no `total`.\n */\n total?: number\n}\n\n/**\n * How many values of one summary field a row of the list carries.\n *\n * A bulk operation names up to 3000 clusters in one field. A page of 100 such\n * rows would carry 300,000 values that no row shows. The view shows at most\n * 12 values of a field, so the list stops there, and `total` holds the count.\n */\nexport const APPROVAL_LIST_SUMMARY_VALUES_MAX = 12\n\n/**\n * The kinds of entity that an approval request can concern.\n *\n * These are the entities that a request is findable by: the org and cluster\n * detail pages ask \"which requests touch me\", and the answer reads a row for\n * each entity. It is a subset of `APPROVAL_SUMMARY_FIELD_KINDS` \u2014 the kinds that\n * name an entity \u2014 because only those carry an id that a page can match.\n */\nexport const APPROVAL_ENTITY_TYPES = ['cluster', 'org', 'user'] as const\n\nexport type ApprovalEntityType = (typeof APPROVAL_ENTITY_TYPES)[number]\n\n/**\n * One entity that an approval request concerns.\n *\n * A use case reports these from its payload, and the service writes one row for\n * each into `approval_job_entity`. That row is what makes a request findable by\n * an entity it touches, without a text search over the payload: a cluster-move\n * request names its cluster, its target organization AND its source\n * organization, so it shows on all three detail pages. The `summary` still\n * carries the words a reader sees; this carries only the ids a page matches.\n */\nexport interface ApprovalEntityRef {\n type: ApprovalEntityType\n id: string\n}\n\n/**\n * How long a run may go quiet before a reader calls it stalled.\n *\n * The pod that runs an action writes its progress and renews its lease on one\n * timer, so a healthy run touches the row well inside this window. A row that\n * is `executing` and older than this held a pod that stopped, and the\n * reconciler of control-backend is on its way to it.\n *\n * It lives here, and not in the config of the service, because a READER needs\n * it: the browser must decide what to show without a second call, and a number\n * that only the backend knew would make the two disagree. `ACTION_LEASE_MS` in\n * `config/index.ts` is held below this on purpose.\n */\nexport const APPROVAL_RUN_STALE_MS = 120_000\n\n/**\n * What an action reports while it runs.\n *\n * This is what makes a long action watchable. Every field is in the DATABASE\n * and not in the answer to the call that started the run, so three readers see\n * the same thing: the person who pressed the button, the same person after a\n * reload, and a second person who opens the request.\n *\n * `total` can be 0 while an action counts its targets, and it stays 0 for an\n * action that cannot count them. A reader must then show that it runs, and no\n * percentage.\n */\nexport interface ApprovalProgress {\n /** Targets in total. 0 means the action did not say. */\n total: number\n /** Targets finished, whatever the outcome of each one. */\n done: number\n /** Targets that finished with an error. Part of `done`. */\n failed: number\n /** One short line for a person, such as the step that runs now. */\n note?: string\n /** An ISO timestamp: when the run started. */\n startedAt: string\n /** An ISO timestamp: when the run last wrote anything. */\n updatedAt: string\n}\n\n/** The share of the work that is finished, or `undefined` with no total. */\nexport function progressFraction(\n progress: ApprovalProgress | undefined,\n): number | undefined {\n if (!progress || progress.total <= 0) {\n return undefined\n }\n return Math.min(1, progress.done / progress.total)\n}\n\n/**\n * Reports whether a running request went quiet.\n *\n * True means that the pod which held the run stopped, or lost the row. It does\n * NOT mean that the action failed: the reconciler either runs it again, or it\n * writes `failed` so that a person can. See `APPROVAL_RUN_STALE_MS`.\n */\nexport function isRunStalled(job: ApprovalJobDto, now: Date): boolean {\n if (job.status !== 'executing') {\n return false\n }\n const lastSign = job.progress?.updatedAt ?? job.executingSince\n if (!lastSign) {\n return false\n }\n return now.getTime() - new Date(lastSign).getTime() > APPROVAL_RUN_STALE_MS\n}\n\n/** One approval request, as the API returns it. */\nexport interface ApprovalJobDto {\n id: string\n type: string\n dedupeKey?: string\n payload: Record<string, unknown>\n /**\n * The payload as labelled fields. See `ApprovalSummaryField`.\n *\n * The use case builds it when the request is opened AND every time the\n * request is read, so a field that a later version of the use case adds\n * appears on a request that is already open.\n */\n summary: ApprovalSummaryField[]\n /** Why the person opened the request. Some use cases demand one. */\n reason?: string\n createdBy: ApprovalActor\n acks: ApprovalAck[]\n /**\n * How many approvals THIS request needs.\n *\n * It is on the request and not only on the use case, because the person who\n * opens one can ask for more than the floor of the use case. A bulk\n * operation over 3000 clusters is the same action as one over 3, and it can\n * still deserve a third pair of eyes. `ApprovalUseCaseDto.minAcks` is the\n * floor that a caller cannot go below.\n */\n requiredAcks: number\n /**\n * What a person must hold to approve, reject or run THIS request.\n *\n * It is on the request and not only on the use case, because a payload can\n * raise the guard: a generation update with `yoloForceUpdate` needs the yolo\n * permission on top of the base one, and the same use case without the flag\n * does not. The set is computed ONE time, when the request is opened, so it\n * is also the record of what the request was guarded by.\n *\n * A person needs EVERY permission in the set, not one of them.\n */\n requiredPermissions: string[]\n executionMode: ApprovalExecutionMode\n actionMode: ApprovalActionMode\n status: ApprovalJobStatus\n closedBy?: ApprovalActor\n closedReason?: string\n /** An ISO timestamp. */\n expiresAt: string\n /**\n * An ISO timestamp: when the current run took the request.\n *\n * It is set every time a run starts, so a run that the reconciler starts\n * again moves it. `attempts` says how many runs there were.\n */\n executingSince?: string\n /** How many times a run started. A recovery raises it. */\n attempts: number\n /**\n * What the action reports while it runs. See `ApprovalProgress`.\n *\n * It stays on the row after the run, so the record of a finished run says\n * how many targets it touched and how many refused.\n */\n progress?: ApprovalProgress\n executedAt?: string\n executionError?: string\n /**\n * What the action reported when it ran.\n *\n * The shape belongs to the use case. An action over many targets puts the\n * result of each target here, which is the difference between \"it failed\"\n * and \"it did 2998 of 3000, and these two refused\".\n */\n executionResult?: Record<string, unknown>\n /** An ISO timestamp: when a `scheduled` request runs by itself. */\n runAt?: string\n /**\n * The person who ran this request with an approval override grant, in\n * place of the approvals that it still needed. See `canOverride`.\n */\n overriddenBy?: ApprovalActor\n /**\n * An ISO timestamp: when that person used the override. The run window of\n * an overridden request starts here. See `runWindowEnd`.\n */\n overriddenAt?: string\n /** Why that person used the override. It is necessary. */\n overrideReason?: string\n /**\n * The approval override grant that the override used. A later run needs\n * this grant to be active still. See `canRunOverridden`.\n */\n overrideGrantId?: string\n /**\n * The incident that a person linked to this request, if any. It is a copy\n * of the incident at the time of the link, so a read never calls incident.io.\n */\n incident?: ApprovalIncidentDto\n createdAt: string\n updatedAt: string\n}\n\n/**\n * One approval override grant, as the API returns it.\n *\n * A grant lets one Camundi run a `pending` request of an overridable use case\n * with no approval, until `expiresAt`. A grant is active while `revokedAt` is\n * absent and `expiresAt` is in the future. See `isOverrideGrantActive`.\n */\nexport interface ApprovalOverrideGrantDto {\n id: string\n /** The Auth0 `sub` of the person who holds the grant. */\n userId: string\n email: string\n /** The `grant-approval-override` request that made this grant. */\n grantedByJobId: string\n /** The `revoke-approval-override` request that ends this grant. */\n revokeJobId?: string\n reason: string\n /** An ISO timestamp. */\n createdAt: string\n /** An ISO timestamp. The grant ends here, also when no revoke ran. */\n expiresAt: string\n /** An ISO timestamp: when the revoke request ran. */\n revokedAt?: string\n revokedByJobId?: string\n}\n\n/**\n * What a use case is, as the API reports it.\n *\n * The frontend needs `requiredPermission` to run the same rule as the backend.\n * PR #9301 kept this registry a second time, by hand, in the frontend. A\n * registry that the server owns means a new use case needs no frontend deploy.\n */\nexport interface ApprovalUseCaseDto {\n type: string\n /** A short name for a person to read. */\n label: string\n /** One sentence: what the action does, and what it cannot undo. */\n description: string\n /** The approvals a new request asks for when the caller names no number. */\n defaultAcks: number\n /**\n * The floor. A caller can ask for more approvals, never for fewer.\n *\n * It is a separate number from `defaultAcks` because the two answer\n * different questions: the default is what the form offers, and the floor is\n * what the service refuses to go below.\n */\n minAcks: number\n ttlDays: number\n executionMode: ApprovalExecutionMode\n /** See `ApprovalActionMode`. An action over many targets is `background`. */\n actionMode: ApprovalActionMode\n /**\n * True when a run that was interrupted can start again by itself.\n *\n * It is a promise about the ACTION, and the reconciler reads it. Set it only\n * when the action can run a second time over the same payload and do no harm\n * twice: it must read what the first run already finished, out of\n * `ApprovalJobDto.executionResult`, and skip it.\n *\n * False, the default, is the safe answer. An interrupted run then lands in\n * `failed`, which a person can run again from the detail page, and a person\n * decides whether running it twice is safe.\n */\n resumable: boolean\n /**\n * The permission that every request of this use case needs to approve,\n * reject or run. A payload can add more. See\n * `ApprovalJobDto.requiredPermissions`, which is the effective set.\n *\n * It is also one permission to SEE a request of this use case. A holder of\n * `aara` sees it too, unless the use case sets `restrictedRead`, and the\n * person who opened a request always sees that request (see\n * `canReadUseCase` and `canView`).\n *\n * The one exception to \"or run\" is a use case with `openToEveryone`. It has\n * no approval, so this permission (or `aara`, see `canReadUseCase`) only\n * decides who sees the requests of other people. Any signed-in person can\n * open and run such a request.\n */\n requiredPermission: string\n /**\n * The permission to open a request. Absent means any signed-in Camundi.\n * A list means that any one of its permissions is enough. An empty list\n * opens the request to nobody, so give a list at least one entry.\n *\n * Set it when the pool that can ASK must be as small as the pool that can\n * approve. Leave it absent when the approvals alone are the guard, and the\n * proposal is not. Read it with `createPermissionsOf`.\n */\n createPermission?: string | string[]\n /** True when a request cannot be opened without a reason. */\n reasonRequired: boolean\n /**\n * True when the ACTION needs the email address of the person who asked.\n *\n * A token can carry no address, and the row then stores\n * `UNKNOWN_ACTOR_EMAIL`. An action that sends that placeholder to another\n * service asks it to find a user that does not exist, so the request can\n * only fail \u2014 and it fails at the END, after other people spent their\n * approvals on it. A use case that carries the creator into its call sets\n * this, and `canCreate` then refuses such a caller at the start.\n *\n * `extend-trial` and `send-to-expired-trial` are two: both send the creator\n * to accounts in an `ApprovalM2mActor`, and accounts reads the permissions\n * of that person again before it acts.\n *\n * `move-cluster-org` does NOT set this. Its envelope reaches console, which\n * reads the user id alone and needs no address.\n */\n creatorEmailRequired?: boolean\n /**\n * A use case with no approval that any signed-in person can open AND run.\n *\n * A request with a floor of zero runs when it is opened, so `canCreate`\n * asks the person to hold `requiredPermission`. This flag lifts that one\n * rule, for an action whose run needs no permission of the person. Set it\n * only when two things hold:\n *\n * - Something else bounds how often a person can ask.\n * - The service that runs the action authorizes the person again at its\n * source, so that nobody can change what is not theirs. The action can\n * touch an organization only when that check lets the person change it.\n *\n * `create-personal-organisation`, `convert-trial-to-internal` and the two\n * use cases of custom hardware sizing set it. `convert-trial-to-internal`\n * does the second check in one way: accounts reads the role of the person in\n * the organization, and only an OWNER who is a Camundi passes. The two use\n * cases of custom hardware sizing do the second check in three ways:\n *\n * - Creating a plan, and unlinking a plan from one organization, read the\n * role of the person in that organization. Only an OWNER passes.\n * - Linking an existing plan to an organization reads the same role.\n * Only an OWNER passes. The dedupe key is the only bound on how often a\n * person can ask for a link.\n * - Deleting a plan reads no role. Console checks that the person created\n * the plan. Accounts reads the organizations that the person is a member\n * of, in any role, and removes the plan from their lists.\n */\n openToEveryone?: boolean\n /**\n * A use case with no approval that only a service of the fleet opens.\n *\n * The service holds `createPermission`, an m2m permission, and not\n * `requiredPermission`. This flag lets that holder open and thus run a\n * request with a floor of zero. `requiredPermission` then decides only who\n * sees the requests and who can run a failed one again. Without a\n * `createPermission` the flag lifts nothing.\n *\n * `cluster-ttl-deletion` sets it. The request exists for the record: the\n * list, the entity pages and the audit trail show each deletion.\n */\n openedBySystem?: boolean\n /**\n * True when `READ_ALL` (`aara`) alone does not give read access to the\n * requests of this use case. It changes only who READS. The holders of\n * `requiredPermission`, the person who opened a request and an override\n * grantee still read it (see `canView`).\n *\n * Every other use case is readable with `aara`, the baseline read gate of\n * Control. A payload, summary or result can hold data that `aara` does not\n * read anywhere else. Set this flag when that data must stay with the\n * holders of `requiredPermission`, as for the details of an SSO connection.\n */\n restrictedRead?: boolean\n}\n"],
|
|
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\n/**\n * The wire types of the generic approval mechanism.\n *\n * This file holds no logic and no dependency, because three consumers read it:\n * control-backend, control-frontend and cloudbot. The rules that read these\n * types are in `../approvals/policy.js`, and they are pure for the same reason.\n */\n\nimport type { ApprovalIncidentDto } from '../approvals/incident-link.js'\n\n/**\n * Every state that an approval request can hold.\n *\n * A `const` tuple, not an enum, so it is both the union type and the list that\n * validates a status filter at run time.\n *\n * The path of a request: `pending` until it reaches the threshold. Then\n * `executing` (automatic mode) or `approved` (explicit mode, which waits for a\n * person to press the button). `executed` or `failed` after the action ran. A\n * request that never reaches the threshold ends `rejected`, `withdrawn` or\n * `expired`.\n *\n * `scheduled` is a request that the service opened by itself, and that runs\n * at `runAt` with no approval. It does not expire, and nobody can withdraw or\n * reject it. A holder of its permissions can run it before `runAt`.\n */\nexport const APPROVAL_JOB_STATUSES = [\n 'pending',\n 'scheduled',\n 'approved',\n 'executing',\n 'executed',\n 'failed',\n 'rejected',\n 'withdrawn',\n 'expired',\n] as const\n\nexport type ApprovalJobStatus = (typeof APPROVAL_JOB_STATUSES)[number]\n\n/**\n * The states in which the action of a request is still COMING.\n *\n * `pending` waits for approvals, `scheduled` waits for its time, `approved`\n * waits for a person to press the button, and `executing` is running now. Each of them can still change the\n * world, so two requests for one target must not be in these states together.\n * `dedupeKey` reads this set for that reason.\n *\n * `failed` is NOT here, although a person can run a failed request again. A\n * failed request runs only when a person presses the button, and that person\n * sees the row. Blocking a new request on a failed one would also trap the\n * key: `canWithdraw` accepts `pending` alone, so nobody could close it.\n *\n * `executed`, `rejected`, `withdrawn` and `expired` are the end of a request.\n */\nexport const APPROVAL_LIVE_STATUSES = [\n 'pending',\n 'scheduled',\n 'approved',\n 'executing',\n] as const satisfies readonly ApprovalJobStatus[]\n\n/**\n * How many requests one page of the list holds when the caller asks for no\n * number.\n *\n * The list is a work queue that a Camundi reads, so the page is large: a\n * person wants the whole queue and not ten rows at a time. What the number is\n * for is the ceiling below.\n */\nexport const APPROVAL_PAGE_SIZE_DEFAULT = 500\n\n/**\n * The largest page that the service builds, and the largest that a caller may\n * ask for. The API answers 400 above it.\n *\n * The list had no limit at all. One authenticated caller could then make the\n * service read the whole table into memory, serialize it, and do it again, so\n * the cost of a request grew with the age of the service and with nothing that\n * the caller had to pay for. A ceiling turns that into a fixed cost.\n *\n * It is HERE and not only in the service, because the view must know it: a\n * page that asked for more would get a 400 instead of rows.\n */\nexport const APPROVAL_PAGE_SIZE_MAX = 2000\n\n/**\n * The columns that the queue can be ordered by.\n *\n * A NAME and not an SQL expression: the repository maps each one, so a caller\n * can never name a column that this list does not hold. `status` orders by the\n * EFFECTIVE status, because a `pending` row whose time ran out reads as\n * `expired` everywhere else.\n */\nexport const APPROVAL_SORT_FIELDS = [\n 'createdAt',\n 'expiresAt',\n 'status',\n 'type',\n 'createdBy',\n] as const\n\nexport type ApprovalSortField = (typeof APPROVAL_SORT_FIELDS)[number]\n\nexport type ApprovalSortOrder = 'asc' | 'desc'\n\n/** The default order of the queue: the newest request first. */\nexport const APPROVAL_SORT_DEFAULT: {\n sort: ApprovalSortField\n order: ApprovalSortOrder\n} = { sort: 'createdAt', order: 'desc' }\n\n/**\n * The longest reason that a request, a rejection or a withdrawal accepts.\n *\n * ONE number, because three routes of control-backend hold it and three fields\n * of control-frontend must stop there. A field that let a person write more\n * than the schema accepts turns their sentence into a 400 after they wrote it.\n */\nexport const APPROVAL_REASON_MAX_LENGTH = 2000\n\n/**\n * The largest number of approvals that a caller can ask for.\n *\n * A request that asks for 400 approvals can never reach them, so it is a\n * request that only fills the table and expires. The ceiling turns that into a\n * 400 at the moment a person types it. It is HERE because the form of the\n * bulk operation must stop at the same number as the route.\n */\nexport const APPROVAL_ACKS_MAX = 10\n\n/**\n * The longest search text that the list accepts.\n *\n * A search runs `ILIKE` over the payload of every visible row, so the cost of\n * one call follows the length of the text. Nothing a person types to find a\n * request is near this.\n */\nexport const APPROVAL_SEARCH_MAX_LENGTH = 200\n\n/**\n * APPROVAL_TYPE_FILTER_MAX is the most use case types that one `type` filter\n * names. The registry holds fewer, so the ceiling only stops a list with no\n * end. control-backend answers 400 above it.\n */\nexport const APPROVAL_TYPE_FILTER_MAX = 100\n\n/** APPROVAL_TYPE_MAX_LENGTH is the longest type that a `type` filter names. */\nexport const APPROVAL_TYPE_MAX_LENGTH = 200\n\n/**\n * The payload field that names the organization a request acts on.\n *\n * It is a CONVENTION, and this constant is what makes the convention readable\n * from both sides. A use case whose action hits one organization puts the id of\n * that organization in this field, and `GET /api/approvals?orgId=\u2026` then finds\n * the request with no knowledge of the use case. The filter reads this one\n * field of the payload, so it matches the whole id and nothing else. The free\n * text search reads the payload as TEXT, which also matches an id that only\n * appears inside another field, and it cannot answer \"the requests of this\n * organization\".\n *\n * The organization page of control-frontend does NOT read this field. It asks\n * the entity-link filter (`entityType=org`), which reads a row that\n * `relatedEntities` of a use case writes \u2014 see `ApprovalEntityRef`. The summary\n * is separate again: the `org` field of a `summarize` result is what a READER\n * follows.\n */\nexport const APPROVAL_PAYLOAD_ORG_FIELD = 'orgId'\n\n/**\n * How many requests each status and each use case type holds, for the filters\n * of the queue.\n *\n * Every status number answers the SAME question as the list beside it: the\n * counts are built with the visibility rule, the action filter and the search\n * text of the caller, and with the lazy expiry. A count that ignored one of\n * those would send a person to a filter that then shows nothing. `byType` is\n * the exception: see its own note.\n */\nexport interface ApprovalStatusCountsDto {\n /** Every request that matches, whatever its status. */\n all: number\n /** One number for each status. A status with no request is 0, never absent. */\n byStatus: Record<ApprovalJobStatus, number>\n /**\n * One number for each use case type, over every status.\n *\n * It ignores the type filter, so a type facet keeps its number while it is\n * on or off. Every other filter applies. A type with no request has no key,\n * so read a missing key as 0, and read only an own key: a type id such as\n * `__proto__` must not reach the prototype.\n *\n * Optional, because an older control-backend does not send it. Read an\n * absent field as no counts.\n */\n byType?: Record<string, number>\n}\n\n/**\n * What happens when a request reaches its threshold.\n *\n * `auto` runs the action immediately. `explicit` holds the request at\n * `approved` and waits for a person to run it.\n */\nexport type ApprovalExecutionMode = 'auto' | 'explicit'\n\n/**\n * WHERE the action runs. It is a separate question from who starts it.\n *\n * - `inline` runs the action inside the call that started it, and the answer\n * already carries the outcome. Right for one call to another service.\n * - `background` answers as soon as the request is claimed, and the action\n * runs on. It reports into `ApprovalJobDto.progress`, and the row is the\n * only place that holds the progress, so a reload and a second person read\n * the same numbers. A pod that stops loses the run, and the reconciler of\n * control-backend recovers the row.\n *\n * An action over thousands of targets MUST be `background`. `inline` would\n * hold one HTTP request for the whole run, and the ingress, the load balancer\n * and the browser each have their own deadline before it finishes.\n *\n * An `inline` action must not read `context.signal`. The runner trusts the\n * result of an `inline` action that returns after a drain, and it would count\n * a partial run as `executed`. An action that stops between targets is\n * `background`.\n */\nexport type ApprovalActionMode = 'inline' | 'background'\n\n/**\n * A person, as an approval request records them.\n *\n * Both keys are kept. The machine then never has to choose one identity key,\n * which is what split the earlier acknowledgement flows: some held an email and\n * some held a user id, and the two could not be compared.\n */\nexport interface ApprovalActor {\n userId: string\n email: string\n}\n\nexport interface ApprovalAck extends ApprovalActor {\n /** An ISO timestamp. It is in a json column, so it is a string, not a Date. */\n date: string\n}\n\n/**\n * Who asked for an action, and who agreed to it.\n *\n * Every route of `api/admin/approvals` takes this envelope, and control-backend\n * builds it from the request that it runs. The envelope exists because the\n * token cannot carry it: the call is machine to machine, so `sub` holds the id\n * of the Auth0 application and not a person. A service that reads the token\n * alone therefore writes \"control-backend\" into its audit record, which hides\n * the two Camundis that the whole mechanism exists to record.\n *\n * `approvedBy` is a list, because a use case can need more than one approval,\n * and the record must name all of them. It can also be EMPTY: how many\n * approvals an action needs is a number of the use case, and `move-cluster-org`\n * holds zero on purpose. The person in `requestedBy` is never in the list: the\n * four-eyes rule is that the person who asks is not the person who agrees, and\n * control-backend holds that rule.\n *\n * Each person carries both keys of `ApprovalActor`. The email is what a route\n * uses to ask Auth0 about the person, and the user id is what an audit record\n * holds, because every other record of the fleet holds an Auth0 `sub`.\n *\n * CAUTION: The envelope is a CLAIM of the caller, and not proof. A route that\n * acts on it must ask Auth0 again whether `requestedBy` may do the action.\n * That means the permission of the action. For a use case with\n * `openToEveryone`, it means that the person is a Camundi, because no\n * permission runs that action. `api/admin/approvals` in accounts-backend does\n * that. See the note on `M2M_CONTROL_APPROVALS`.\n */\nexport interface ApprovalM2mActor {\n /** The id of the approval request, to join the records of both services. */\n requestId: string\n /** The Camundi who opened the request. */\n requestedBy: ApprovalActor\n /** The Camundis who approved it. Empty when the use case needs none. */\n approvedBy: ApprovalActor[]\n /**\n * The Camundi who ran the request with an approval override grant, in\n * place of the approvals that it still needed. Absent for every other run.\n *\n * control-backend checked the grant, the permissions of this person and\n * `APPROVAL_OVERRIDE_DENYLIST` before the run. A receiver that counts the\n * approvals of an overridable type accepts this person in place of the\n * approvals that are missing, and refuses this field for every other type.\n * This person can be the person in `requestedBy`, because that is what a\n * grant is for. A receiver that refuses the target of an action as an\n * approver refuses this person as well, also when they asked.\n */\n overriddenBy?: ApprovalActor\n}\n\n/**\n * What one value of a summary field is.\n *\n * `text` is what a person reads. `id` is what a link points at, and it is\n * absent when the kind names no entity. The two are separate because the text\n * is a COPY that the request keeps: an organization that gets a new name after\n * the request was opened must still read as the organization that the person\n * chose.\n */\nexport interface ApprovalSummaryValue {\n text: string\n id?: string\n}\n\n/**\n * How a reader must render one field of a summary.\n *\n * `org`, `cluster` and `user` name an entity, so a reader can link to it and\n * can resolve a fresh name. The others are plain: `date` is an ISO timestamp,\n * and `code` is a value that must keep its characters, such as a json fragment.\n */\nexport const APPROVAL_SUMMARY_FIELD_KINDS = [\n 'text',\n 'number',\n 'boolean',\n 'date',\n 'org',\n 'cluster',\n 'user',\n 'code',\n] as const\n\nexport type ApprovalSummaryFieldKind =\n (typeof APPROVAL_SUMMARY_FIELD_KINDS)[number]\n\n/**\n * One labelled field of the payload of a request.\n *\n * This is what makes ONE view able to show EVERY use case. The payload of a\n * request is an object of anything, so a generic view can only print it as\n * json. The use case turns it into labelled fields here, and the view renders\n * a field by its kind: it links an `org`, it formats a `date`, and it lists\n * 300 clusters as 300 links.\n *\n * `values` is always an array. A field that holds one value holds an array of\n * one, so a reader needs no branch for \"one or many\".\n */\nexport interface ApprovalSummaryField {\n label: string\n kind: ApprovalSummaryFieldKind\n values: ApprovalSummaryValue[]\n /**\n * The values that this request replaces, for a field that changes. A view\n * shows them as removed beside `values` as added. A field with no\n * `previous` is not a change.\n */\n previous?: ApprovalSummaryValue[]\n /** The count of `previous`, when the list cut it. Like `total`, for `previous`. */\n previousTotal?: number\n /**\n * How many values the field holds, when `values` holds only the first of\n * them. The list route cuts every field to `APPROVAL_LIST_SUMMARY_VALUES_MAX`\n * values. The detail route sends every value and no `total`.\n */\n total?: number\n}\n\n/**\n * How many values of one summary field a row of the list carries.\n *\n * A bulk operation names up to 3000 clusters in one field. A page of 100 such\n * rows would carry 300,000 values that no row shows. The view shows at most\n * 12 values of a field, so the list stops there, and `total` holds the count.\n */\nexport const APPROVAL_LIST_SUMMARY_VALUES_MAX = 12\n\n/**\n * The kinds of entity that an approval request can concern.\n *\n * These are the entities that a request is findable by: the org and cluster\n * detail pages ask \"which requests touch me\", and the answer reads a row for\n * each entity. It is a subset of `APPROVAL_SUMMARY_FIELD_KINDS` \u2014 the kinds that\n * name an entity \u2014 because only those carry an id that a page can match.\n */\nexport const APPROVAL_ENTITY_TYPES = ['cluster', 'org', 'user'] as const\n\nexport type ApprovalEntityType = (typeof APPROVAL_ENTITY_TYPES)[number]\n\n/**\n * One entity that an approval request concerns.\n *\n * A use case reports these from its payload, and the service writes one row for\n * each into `approval_job_entity`. That row is what makes a request findable by\n * an entity it touches, without a text search over the payload: a cluster-move\n * request names its cluster, its target organization AND its source\n * organization, so it shows on all three detail pages. The `summary` still\n * carries the words a reader sees; this carries only the ids a page matches.\n */\nexport interface ApprovalEntityRef {\n type: ApprovalEntityType\n id: string\n}\n\n/**\n * How long a run may go quiet before a reader calls it stalled.\n *\n * The pod that runs an action writes its progress and renews its lease on one\n * timer, so a healthy run touches the row well inside this window. A row that\n * is `executing` and older than this held a pod that stopped, and the\n * reconciler of control-backend is on its way to it.\n *\n * It lives here, and not in the config of the service, because a READER needs\n * it: the browser must decide what to show without a second call, and a number\n * that only the backend knew would make the two disagree. `ACTION_LEASE_MS` in\n * `config/index.ts` is held below this on purpose.\n */\nexport const APPROVAL_RUN_STALE_MS = 120_000\n\n/**\n * What an action reports while it runs.\n *\n * This is what makes a long action watchable. Every field is in the DATABASE\n * and not in the answer to the call that started the run, so three readers see\n * the same thing: the person who pressed the button, the same person after a\n * reload, and a second person who opens the request.\n *\n * `total` can be 0 while an action counts its targets, and it stays 0 for an\n * action that cannot count them. A reader must then show that it runs, and no\n * percentage.\n */\nexport interface ApprovalProgress {\n /** Targets in total. 0 means the action did not say. */\n total: number\n /** Targets finished, whatever the outcome of each one. */\n done: number\n /** Targets that finished with an error. Part of `done`. */\n failed: number\n /** One short line for a person, such as the step that runs now. */\n note?: string\n /** An ISO timestamp: when the run started. */\n startedAt: string\n /** An ISO timestamp: when the run last wrote anything. */\n updatedAt: string\n}\n\n/** The share of the work that is finished, or `undefined` with no total. */\nexport function progressFraction(\n progress: ApprovalProgress | undefined,\n): number | undefined {\n if (!progress || progress.total <= 0) {\n return undefined\n }\n return Math.min(1, progress.done / progress.total)\n}\n\n/**\n * Reports whether a running request went quiet.\n *\n * True means that the pod which held the run stopped, or lost the row. It does\n * NOT mean that the action failed: the reconciler either runs it again, or it\n * writes `failed` so that a person can. See `APPROVAL_RUN_STALE_MS`.\n */\nexport function isRunStalled(job: ApprovalJobDto, now: Date): boolean {\n if (job.status !== 'executing') {\n return false\n }\n const lastSign = job.progress?.updatedAt ?? job.executingSince\n if (!lastSign) {\n return false\n }\n return now.getTime() - new Date(lastSign).getTime() > APPROVAL_RUN_STALE_MS\n}\n\n/** One approval request, as the API returns it. */\nexport interface ApprovalJobDto {\n id: string\n type: string\n dedupeKey?: string\n payload: Record<string, unknown>\n /**\n * The payload as labelled fields. See `ApprovalSummaryField`.\n *\n * The use case builds it when the request is opened AND every time the\n * request is read, so a field that a later version of the use case adds\n * appears on a request that is already open.\n */\n summary: ApprovalSummaryField[]\n /** Why the person opened the request. Some use cases demand one. */\n reason?: string\n createdBy: ApprovalActor\n acks: ApprovalAck[]\n /**\n * How many approvals THIS request needs.\n *\n * It is on the request and not only on the use case, because the person who\n * opens one can ask for more than the floor of the use case. A bulk\n * operation over 3000 clusters is the same action as one over 3, and it can\n * still deserve a third pair of eyes. `ApprovalUseCaseDto.minAcks` is the\n * floor that a caller cannot go below.\n */\n requiredAcks: number\n /**\n * What a person must hold to approve, reject or run THIS request.\n *\n * It is on the request and not only on the use case, because a payload can\n * raise the guard: a generation update with `yoloForceUpdate` needs the yolo\n * permission on top of the base one, and the same use case without the flag\n * does not. The set is computed ONE time, when the request is opened, so it\n * is also the record of what the request was guarded by.\n *\n * A person needs EVERY permission in the set, not one of them.\n */\n requiredPermissions: string[]\n executionMode: ApprovalExecutionMode\n actionMode: ApprovalActionMode\n status: ApprovalJobStatus\n closedBy?: ApprovalActor\n closedReason?: string\n /** An ISO timestamp. */\n expiresAt: string\n /**\n * An ISO timestamp: when the current run took the request.\n *\n * It is set every time a run starts, so a run that the reconciler starts\n * again moves it. `attempts` says how many runs there were.\n */\n executingSince?: string\n /** How many times a run started. A recovery raises it. */\n attempts: number\n /**\n * What the action reports while it runs. See `ApprovalProgress`.\n *\n * It stays on the row after the run, so the record of a finished run says\n * how many targets it touched and how many refused.\n */\n progress?: ApprovalProgress\n executedAt?: string\n executionError?: string\n /**\n * What the action reported when it ran.\n *\n * The shape belongs to the use case. An action over many targets puts the\n * result of each target here, which is the difference between \"it failed\"\n * and \"it did 2998 of 3000, and these two refused\".\n */\n executionResult?: Record<string, unknown>\n /** An ISO timestamp: when a `scheduled` request runs by itself. */\n runAt?: string\n /**\n * The person who ran this request with an approval override grant, in\n * place of the approvals that it still needed. See `canOverride`.\n */\n overriddenBy?: ApprovalActor\n /**\n * An ISO timestamp: when that person used the override. The run window of\n * an overridden request starts here. See `runWindowEnd`.\n */\n overriddenAt?: string\n /** Why that person used the override. It is necessary. */\n overrideReason?: string\n /**\n * The approval override grant that the override used. A later run needs\n * this grant to be active still. See `canRunOverridden`.\n */\n overrideGrantId?: string\n /**\n * The incident that a person linked to this request, if any. It is a copy\n * of the incident at the time of the link, so a read never calls incident.io.\n */\n incident?: ApprovalIncidentDto\n createdAt: string\n updatedAt: string\n}\n\n/**\n * One approval override grant, as the API returns it.\n *\n * A grant lets one Camundi run a `pending` request of an overridable use case\n * with no approval, until `expiresAt`. A grant is active while `revokedAt` is\n * absent and `expiresAt` is in the future. See `isOverrideGrantActive`.\n */\nexport interface ApprovalOverrideGrantDto {\n id: string\n /** The Auth0 `sub` of the person who holds the grant. */\n userId: string\n email: string\n /** The `grant-approval-override` request that made this grant. */\n grantedByJobId: string\n /** The `revoke-approval-override` request that ends this grant. */\n revokeJobId?: string\n reason: string\n /** An ISO timestamp. */\n createdAt: string\n /** An ISO timestamp. The grant ends here, also when no revoke ran. */\n expiresAt: string\n /** An ISO timestamp: when the revoke request ran. */\n revokedAt?: string\n revokedByJobId?: string\n}\n\n/**\n * What a use case is, as the API reports it.\n *\n * The frontend needs `requiredPermission` to run the same rule as the backend.\n * PR #9301 kept this registry a second time, by hand, in the frontend. A\n * registry that the server owns means a new use case needs no frontend deploy.\n */\nexport interface ApprovalUseCaseDto {\n type: string\n /** A short name for a person to read. */\n label: string\n /** One sentence: what the action does, and what it cannot undo. */\n description: string\n /** The approvals a new request asks for when the caller names no number. */\n defaultAcks: number\n /**\n * The floor. A caller can ask for more approvals, never for fewer.\n *\n * It is a separate number from `defaultAcks` because the two answer\n * different questions: the default is what the form offers, and the floor is\n * what the service refuses to go below.\n */\n minAcks: number\n ttlDays: number\n executionMode: ApprovalExecutionMode\n /** See `ApprovalActionMode`. An action over many targets is `background`. */\n actionMode: ApprovalActionMode\n /**\n * True when a run that was interrupted can start again by itself.\n *\n * It is a promise about the ACTION, and the reconciler reads it. Set it only\n * when the action can run a second time over the same payload and do no harm\n * twice: it must read what the first run already finished, out of\n * `ApprovalJobDto.executionResult`, and skip it.\n *\n * False, the default, is the safe answer. An interrupted run then lands in\n * `failed`, which a person can run again from the detail page, and a person\n * decides whether running it twice is safe.\n */\n resumable: boolean\n /**\n * The permission that every request of this use case needs to approve,\n * reject or run. A payload can add more. See\n * `ApprovalJobDto.requiredPermissions`, which is the effective set.\n *\n * It is also one permission to SEE a request of this use case. A holder of\n * `aara` sees it too, unless the use case sets `restrictedRead`, and the\n * person who opened a request always sees that request (see\n * `canReadUseCase` and `canView`).\n *\n * The one exception to \"or run\" is a use case with `openToEveryone`. It has\n * no approval, so this permission (or `aara`, see `canReadUseCase`) only\n * decides who sees the requests of other people. Any signed-in person can\n * open and run such a request.\n */\n requiredPermission: string\n /**\n * The permission to open a request. Absent means any signed-in Camundi.\n * A list means that any one of its permissions is enough. An empty list\n * opens the request to nobody, so give a list at least one entry.\n *\n * Set it when the pool that can ASK must be as small as the pool that can\n * approve. Leave it absent when the approvals alone are the guard, and the\n * proposal is not. Read it with `createPermissionsOf`.\n */\n createPermission?: string | string[]\n /** True when a request cannot be opened without a reason. */\n reasonRequired: boolean\n /**\n * True when the ACTION needs the email address of the person who asked.\n *\n * A token can carry no address, and the row then stores\n * `UNKNOWN_ACTOR_EMAIL`. An action that sends that placeholder to another\n * service asks it to find a user that does not exist, so the request can\n * only fail \u2014 and it fails at the END, after other people spent their\n * approvals on it. A use case that carries the creator into its call sets\n * this, and `canCreate` then refuses such a caller at the start.\n *\n * `extend-trial` and `send-to-expired-trial` are two: both send the creator\n * to accounts in an `ApprovalM2mActor`, and accounts reads the permissions\n * of that person again before it acts.\n *\n * `move-cluster-org` does NOT set this. Its envelope reaches console, which\n * reads the user id alone and needs no address.\n */\n creatorEmailRequired?: boolean\n /**\n * A use case with no approval that any signed-in person can open AND run.\n *\n * A request with a floor of zero runs when it is opened, so `canCreate`\n * asks the person to hold `requiredPermission`. This flag lifts that one\n * rule, for an action whose run needs no permission of the person. Set it\n * only when two things hold:\n *\n * - Something else bounds how often a person can ask.\n * - The service that runs the action authorizes the person again at its\n * source, so that nobody can change what is not theirs. The action can\n * touch an organization only when that check lets the person change it.\n *\n * `create-personal-organisation`, `convert-trial-to-internal`,\n * `delete-own-test-org` and the two use cases of custom hardware sizing set\n * it. `convert-trial-to-internal` does the second check in one way: accounts\n * reads the role of the person in the organization, and only an OWNER who is\n * a Camundi passes. The two use cases of custom hardware sizing do the second\n * check in three ways:\n *\n * - Creating a plan, and unlinking a plan from one organization, read the\n * role of the person in that organization. Only an OWNER passes.\n * - Linking an existing plan to an organization reads the same role.\n * Only an OWNER passes. The dedupe key is the only bound on how often a\n * person can ask for a link.\n * - Deleting a plan reads no role. Console checks that the person created\n * the plan. Accounts reads the organizations that the person is a member\n * of, in any role, and removes the plan from their lists.\n */\n openToEveryone?: boolean\n /**\n * A use case with no approval that only a service of the fleet opens.\n *\n * The service holds `createPermission`, an m2m permission, and not\n * `requiredPermission`. This flag lets that holder open and thus run a\n * request with a floor of zero. `requiredPermission` then decides only who\n * sees the requests and who can run a failed one again. Without a\n * `createPermission` the flag lifts nothing.\n *\n * `cluster-ttl-deletion` sets it. The request exists for the record: the\n * list, the entity pages and the audit trail show each deletion.\n */\n openedBySystem?: boolean\n /**\n * True when `READ_ALL` (`aara`) alone does not give read access to the\n * requests of this use case. It changes only who READS. The holders of\n * `requiredPermission`, the person who opened a request and an override\n * grantee still read it (see `canView`).\n *\n * Every other use case is readable with `aara`, the baseline read gate of\n * Control. A payload, summary or result can hold data that `aara` does not\n * read anywhere else. Set this flag when that data must stay with the\n * holders of `requiredPermission`, as for the details of an SSO connection.\n */\n restrictedRead?: boolean\n}\n"],
|
|
5
5
|
"mappings": "AAgCO,MAAM,wBAAwB;AAAA,EACnC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAmBO,MAAM,yBAAyB;AAAA,EACpC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAUO,MAAM,6BAA6B;AAcnC,MAAM,yBAAyB;AAU/B,MAAM,uBAAuB;AAAA,EAClC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAOO,MAAM,wBAGT,EAAE,MAAM,aAAa,OAAO,OAAO;AAShC,MAAM,6BAA6B;AAUnC,MAAM,oBAAoB;AAS1B,MAAM,6BAA6B;AAOnC,MAAM,2BAA2B;AAGjC,MAAM,2BAA2B;AAoBjC,MAAM,6BAA6B;AAqJnC,MAAM,+BAA+B;AAAA,EAC1C;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AA4CO,MAAM,mCAAmC;AAUzC,MAAM,wBAAwB,CAAC,WAAW,OAAO,MAAM;AAgCvD,MAAM,wBAAwB;AA8B9B,SAAS,iBACd,UACoB;AACpB,MAAI,CAAC,YAAY,SAAS,SAAS,GAAG;AACpC,WAAO;AAAA,EACT;AACA,SAAO,KAAK,IAAI,GAAG,SAAS,OAAO,SAAS,KAAK;AACnD;AASO,SAAS,aAAa,KAAqB,KAAoB;AACpE,MAAI,IAAI,WAAW,aAAa;AAC9B,WAAO;AAAA,EACT;AACA,QAAM,WAAW,IAAI,UAAU,aAAa,IAAI;AAChD,MAAI,CAAC,UAAU;AACb,WAAO;AAAA,EACT;AACA,SAAO,IAAI,QAAQ,IAAI,IAAI,KAAK,QAAQ,EAAE,QAAQ,IAAI;AACxD;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/package.json
CHANGED