@camunda/ccma-shared-types 18.5.0 → 18.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/dist/agent-tokens/agent-tokens.d.ts +1 -1
  2. package/dist/agent-tokens/agent-tokens.js.map +1 -1
  3. package/dist/approvals/expected-value.d.ts +1 -1
  4. package/dist/approvals/expected-value.js.map +1 -1
  5. package/dist/approvals/policy.d.ts +1 -1
  6. package/dist/approvals/policy.js.map +1 -1
  7. package/dist/approvals/use-cases.const.d.ts +3 -3
  8. package/dist/approvals/use-cases.const.js.map +1 -1
  9. package/dist/charts/chart-metrics.js.map +1 -1
  10. package/dist/charts/chart-spec.js.map +1 -1
  11. package/dist/constants/direct-route-lock.const.d.ts +2 -2
  12. package/dist/constants/direct-route-lock.const.js.map +1 -1
  13. package/dist/constants/tsuga.const.d.ts +5 -0
  14. package/dist/constants/tsuga.const.js +5 -0
  15. package/dist/constants/tsuga.const.js.map +7 -0
  16. package/dist/dtos/ActiveUsers.dto.d.ts +1 -1
  17. package/dist/dtos/Annotation.dto.d.ts +1 -1
  18. package/dist/dtos/Annotation.dto.js.map +1 -1
  19. package/dist/dtos/ApprovalJob.dto.d.ts +1 -1
  20. package/dist/dtos/ApprovalJob.dto.js.map +1 -1
  21. package/dist/dtos/ApprovalSummaryNames.dto.d.ts +1 -1
  22. package/dist/dtos/ControlV2.dto.js.map +1 -1
  23. package/dist/dtos/Dashboard.dto.d.ts +1 -1
  24. package/dist/dtos/Dashboard.dto.js.map +1 -1
  25. package/dist/dtos/ExternalWebapp.dto.d.ts +1 -1
  26. package/dist/dtos/FeatureFlags.dto.d.ts +2 -2
  27. package/dist/dtos/FeatureFlags.dto.js.map +1 -1
  28. package/dist/dtos/Hdp.dto.d.ts +1 -1
  29. package/dist/dtos/M2mTokenCount.dto.d.ts +1 -1
  30. package/dist/dtos/PermissionHolders.dto.d.ts +1 -1
  31. package/dist/dtos/PermissionHolders.dto.js.map +1 -1
  32. package/dist/index.d.ts +1 -0
  33. package/dist/index.js +2 -0
  34. package/dist/index.js.map +2 -2
  35. package/dist/permissions/combo.js.map +1 -1
  36. package/dist/permissions/console.permissions.d.ts +2 -2
  37. package/dist/permissions/console.permissions.js.map +1 -1
  38. package/dist/utils/camundiPermissionAugmenter.utils.d.ts +1 -1
  39. package/dist/utils/camundiPermissionAugmenter.utils.js.map +1 -1
  40. package/dist/utils/qa-user.utils.d.ts +1 -1
  41. package/dist/utils/qa-user.utils.js.map +1 -1
  42. package/package.json +1 -1
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/constants/direct-route-lock.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\n/**\n * The flag of the approval flow of Camunda Control for Camundis.\n *\n * Four places read it, always by the email of the Camundi. control-backend\n * opens the create routes of the approval use cases only while it is on.\n * control-frontend shows the approval entries only while it is on.\n * accounts-backend and console-backend lock the direct routes only while it\n * is on.\n */\nexport const CAMUNDI_APPROVAL_FLOW_FLAG = 'control.camundiApprovalFlow'\n\n/**\n * The code of the refusal of a locked direct route.\n *\n * While `control.camundiApprovalFlow` is on, accounts-backend and\n * console-backend refuse a person on a route that Camunda Control runs\n * through a request.\n * The answer is 403 with the message as a text body, as for each other error.\n * The headers that follow carry the code and the approval entry, so that a\n * client does not parse the text to find a refusal.\n */\nexport const DIRECT_ROUTE_LOCKED = 'DIRECT_ROUTE_LOCKED'\n\n/** The response header that holds the code of an error. */\nexport const ERROR_CODE_HEADER = 'x-camunda-error-code'\n\n/**\n * The response header that holds the name of the approval entry in Camunda\n * Control. The value is URI-encoded, because Node refuses a header value with\n * a character outside Latin-1.\n */\nexport const APPROVAL_ENTRY_HEADER = 'x-camunda-approval-entry'\n\n/**\n * The `exposedHeaders` of a CORS configuration. Without them, a browser on\n * another origin does not give the headers to the frontend.\n */\nexport const DIRECT_ROUTE_LOCK_HEADERS = [\n ERROR_CODE_HEADER,\n APPROVAL_ENTRY_HEADER,\n]\n\n/** The headers of the refusal of a locked direct route. */\nexport const directRouteLockHeaders = (\n approvalEntry: string,\n): Record<string, string> => ({\n [ERROR_CODE_HEADER]: DIRECT_ROUTE_LOCKED,\n [APPROVAL_ENTRY_HEADER]: encodeURIComponent(approvalEntry),\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 flag of the approval flow of Camunda Control for Camundis.\n *\n * Four places read it, always by the email of the Camundi. control-backend\n * opens the create routes of the approval use cases only while it is on.\n * control-frontend shows the approval entries only while it is on.\n * accounts-ng and console-backend lock the direct routes only while it\n * is on.\n */\nexport const CAMUNDI_APPROVAL_FLOW_FLAG = 'control.camundiApprovalFlow'\n\n/**\n * The code of the refusal of a locked direct route.\n *\n * While `control.camundiApprovalFlow` is on, accounts-ng and\n * console-backend refuse a person on a route that Camunda Control runs\n * through a request.\n * The answer is 403 with the message as a text body, as for each other error.\n * The headers that follow carry the code and the approval entry, so that a\n * client does not parse the text to find a refusal.\n */\nexport const DIRECT_ROUTE_LOCKED = 'DIRECT_ROUTE_LOCKED'\n\n/** The response header that holds the code of an error. */\nexport const ERROR_CODE_HEADER = 'x-camunda-error-code'\n\n/**\n * The response header that holds the name of the approval entry in Camunda\n * Control. The value is URI-encoded, because Node refuses a header value with\n * a character outside Latin-1.\n */\nexport const APPROVAL_ENTRY_HEADER = 'x-camunda-approval-entry'\n\n/**\n * The `exposedHeaders` of a CORS configuration. Without them, a browser on\n * another origin does not give the headers to the frontend.\n */\nexport const DIRECT_ROUTE_LOCK_HEADERS = [\n ERROR_CODE_HEADER,\n APPROVAL_ENTRY_HEADER,\n]\n\n/** The headers of the refusal of a locked direct route. */\nexport const directRouteLockHeaders = (\n approvalEntry: string,\n): Record<string, string> => ({\n [ERROR_CODE_HEADER]: DIRECT_ROUTE_LOCKED,\n [APPROVAL_ENTRY_HEADER]: encodeURIComponent(approvalEntry),\n})\n"],
5
5
  "mappings": "AAeO,MAAM,6BAA6B;AAYnC,MAAM,sBAAsB;AAG5B,MAAM,oBAAoB;AAO1B,MAAM,wBAAwB;AAM9B,MAAM,4BAA4B;AAAA,EACvC;AAAA,EACA;AACF;AAGO,MAAM,yBAAyB,CACpC,mBAC4B;AAAA,EAC5B,CAAC,iBAAiB,GAAG;AAAA,EACrB,CAAC,qBAAqB,GAAG,mBAAmB,aAAa;AAC3D;",
6
6
  "names": []
7
7
  }
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Base URL of the Tsuga web app. On dev, the dashboard links of CloudBot,
3
+ * Control and Accounts open Tsuga. Int and prod keep Grafana.
4
+ */
5
+ export declare const TSUGA_BASE_URL = "https://app.tsuga.com";
@@ -0,0 +1,5 @@
1
+ const TSUGA_BASE_URL = "https://app.tsuga.com";
2
+ export {
3
+ TSUGA_BASE_URL
4
+ };
5
+ //# sourceMappingURL=tsuga.const.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/constants/tsuga.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\n/**\n * Base URL of the Tsuga web app. On dev, the dashboard links of CloudBot,\n * Control and Accounts open Tsuga. Int and prod keep Grafana.\n */\nexport const TSUGA_BASE_URL = 'https://app.tsuga.com'\n"],
5
+ "mappings": "AAUO,MAAM,iBAAiB;",
6
+ "names": []
7
+ }
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * The active user count of the Auth0 tenant (`GET /api/logs/active-users` of
3
- * accounts-backend). Auth0 counts the users that logged in during the last
3
+ * accounts-ng). Auth0 counts the users that logged in during the last
4
4
  * `windowDays` days. Auth0 sets the window, not the caller.
5
5
  */
6
6
  export interface ActiveUsersDto {
@@ -21,7 +21,7 @@
21
21
  *
22
22
  * The kind is a STRING on the row and not a foreign key, because the entity is
23
23
  * in a different database: a cluster belongs to console-backend and an
24
- * organization to accounts-backend. That is also what keeps an annotation after
24
+ * organization to accounts-ng. That is also what keeps an annotation after
25
25
  * the entity goes away. See `AnnotationDto.entityLabel`.
26
26
  *
27
27
  * Add a kind here and in `ANNOTATION_ENTITY_KIND_LABELS` below. The two lists
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/dtos/Annotation.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 annotations of the fleet: the notes and the tags that a\n * Camundi attaches to an entity.\n *\n * An annotation adds CONTEXT that the fleet itself does not hold. A cluster row\n * says how much memory it has; it does not say \"this is the playground of the\n * demo team\". A Camundi writes that here, and the next Camundi reads it.\n *\n * This file holds no logic and no dependency, because control-backend and\n * control-frontend both read it. The rules that read these types are in\n * `../annotations/policy.js`, and they are pure for the same reason.\n *\n * The feature is INTERNAL. No annotation reaches a customer, and no route of\n * another service reads one.\n */\n\n/**\n * Every kind of fleet entity that can carry an annotation.\n *\n * A `const` tuple, not an enum, so it is both the union type and the list that\n * validates a request at run time.\n *\n * The kind is a STRING on the row and not a foreign key, because the entity is\n * in a different database: a cluster belongs to console-backend and an\n * organization to accounts-backend. That is also what keeps an annotation after\n * the entity goes away. See `AnnotationDto.entityLabel`.\n *\n * Add a kind here and in `ANNOTATION_ENTITY_KIND_LABELS` below. The two lists\n * are one `Record`, so a kind with no label does not compile.\n *\n * Every kind here is a THING of the fleet, and none of them is a person. That\n * is a rule and not an accident. A `user` kind was in this list and came out\n * again: an annotation outlives its entity on purpose, which is right for a\n * cluster that somebody deleted and wrong for a colleague who left, and this\n * feature has no retention rule, no reaper, and no way for the person written\n * about to read or correct it. Add a kind that names a PERSON only with those\n * three answered.\n */\nexport const ANNOTATION_ENTITY_KINDS = [\n 'cluster',\n 'organization',\n 'cluster-plan',\n 'cluster-plan-type',\n 'generation',\n 'channel',\n 'sales-plan',\n 'k8s-context',\n 'cluster-modification',\n 'cluster-bulk-operation',\n 'approval',\n 'dashboard',\n] as const\n\nexport type AnnotationEntityKind = (typeof ANNOTATION_ENTITY_KINDS)[number]\n\n/**\n * What a reader sees for each kind, in the singular.\n *\n * The label is here and not in the frontend, because the search page shows\n * results of every kind together and the backend writes the same word into a\n * log line. Two spellings of one kind would read as two kinds.\n */\nexport const ANNOTATION_ENTITY_KIND_LABELS: Record<\n AnnotationEntityKind,\n string\n> = {\n cluster: 'Cluster',\n organization: 'Organization',\n 'cluster-plan': 'Cluster plan',\n 'cluster-plan-type': 'Cluster plan type',\n generation: 'Generation',\n channel: 'Channel',\n 'sales-plan': 'Sales plan',\n 'k8s-context': 'Kubernetes context',\n 'cluster-modification': 'Cluster modification',\n 'cluster-bulk-operation': 'Cluster bulk operation',\n approval: 'Approval request',\n dashboard: 'Dashboard',\n}\n\n/**\n * What an annotation IS: a written note, or a tag out of the dictionary.\n *\n * One row type carries both, because both answer the same question \u2014 what does\n * a Camundi need to know about this entity? \u2014 and both are read, listed and\n * removed the same way. The difference is what the row points at: a note holds\n * `body`, and a tag holds `tag`.\n */\nexport const ANNOTATION_KINDS = ['note', 'tag'] as const\n\nexport type AnnotationKind = (typeof ANNOTATION_KINDS)[number]\n\n/** Who wrote an annotation. The same shape as `ApprovalActor`. */\nexport interface AnnotationActor {\n userId: string\n email: string\n}\n\n/**\n * One tag of the dictionary.\n *\n * A tag is its own row, and not a string on the annotation, for one reason:\n * a Camundi must be able to ask \"what else carries `partner`?\". A string on\n * each row answers that only with a scan, and it drifts: `Partner`, `partner `\n * and `partner` would be three tags that read as one.\n */\nexport interface AnnotationTagDto {\n id: string\n /** What a reader sees. The first spelling that anybody wrote wins. */\n name: string\n /** `name` through `normalizeTagName`. It is the identity of the tag. */\n normalizedName: string\n createdBy: AnnotationActor\n createdAt: string\n /**\n * How many LIVE entities carry this tag.\n *\n * It is counted at read time and never stored, so a removed assignment\n * lowers it with no second write. A list of the dictionary needs it to sort\n * by use, which is how a Camundi finds the tag that the team already uses\n * instead of inventing a second spelling of it.\n */\n usageCount: number\n}\n\n/**\n * One note, or one tag, on one entity.\n *\n * `entityKind` and `entityId` together name the entity. Neither is checked\n * against the fleet: the entity lives in another service, and an annotation\n * must survive its entity. See `entityLabel`.\n */\nexport interface AnnotationDto {\n id: string\n kind: AnnotationKind\n entityKind: AnnotationEntityKind\n entityId: string\n /**\n * What the entity was CALLED when somebody wrote the annotation.\n *\n * This is the only reason a search result stays readable after the entity is\n * deleted: the id of a cluster that no longer exists says nothing, and the\n * fleet can no longer answer what its name was. The label is a copy on\n * purpose, so it can be stale \u2014 it says what the entity was called then, not\n * what it is called now.\n */\n entityLabel?: string\n /** The text of a note. Absent on a tag. */\n body?: string\n /** The tag of a tag annotation. Absent on a note. */\n tag?: AnnotationTagDto\n /**\n * Why the tag hangs on this entity. Absent on a note.\n *\n * It belongs to the LINK and not to the dictionary entry: `white-glove` on\n * one org has another reason than on the next. It is optional for every tag\n * and required for `white-glove` (see `checkTagReason`).\n */\n reason?: string\n createdBy: AnnotationActor\n createdAt: string\n updatedAt: string\n /** True when `body` was changed after it was written. */\n edited: boolean\n /**\n * How many times this row was written. A new one carries 1.\n *\n * An edit sends the version that it read, and the route refuses the write\n * when the row moved on since. Without it the tab that somebody left open at\n * breakfast silently replaces the edit they made at lunch, and neither write\n * tells them that one of the two is gone.\n */\n version: number\n}\n\n/** The annotations of one entity, in one answer. */\nexport interface EntityAnnotationsDto {\n entityKind: AnnotationEntityKind\n entityId: string\n notes: AnnotationDto[]\n tags: AnnotationDto[]\n /**\n * True when the entity carries more than `ANNOTATION_ENTITY_MAX` rows, so\n * the two lists above are the newest of them and not all of them.\n *\n * A panel that showed no sign of this would be a page that quietly stops\n * being the whole story, which is worse for documentation than a page that\n * says where the rest is.\n */\n hasMore: boolean\n}\n\n/**\n * What one entity carries, in the answer of a lookup over many entities.\n *\n * A table of 3000 clusters cannot read 3000 panels. The lookup answers the\n * two questions that a row of such a table needs: which tags, and whether a\n * colleague wrote something that a person must read before they act.\n */\nexport interface AnnotationLookupEntryDto {\n entityId: string\n /**\n * The live tag annotations of the entity, oldest first, and at most\n * `ANNOTATION_LOOKUP_TAGS_MAX` of them.\n */\n tags: AnnotationDto[]\n /** How many live tags the entity carries. More than `tags` holds is cut. */\n tagCount: number\n /** How many live notes the entity carries. */\n noteCount: number\n /** The newest live note, so a row can show it with no second read. */\n latestNote?: AnnotationDto\n}\n\n/**\n * The answer of a lookup. It holds ONLY the entities that carry something,\n * so an entity with no entry carries nothing.\n */\nexport interface AnnotationLookupDto {\n entityKind: AnnotationEntityKind\n entries: AnnotationLookupEntryDto[]\n}\n\n/**\n * The most entities that one lookup names.\n *\n * The same number as the largest cluster bulk operation, which is the table\n * that asks the largest question.\n */\nexport const ANNOTATION_LOOKUP_MAX_ENTITIES = 3000\n\n/**\n * The most tags that a lookup answers for ONE entity.\n *\n * An entity can carry any number of tags. Without this cap, one lookup of\n * 3000 entities has no bound on its rows. A row of a table shows a few chips,\n * and `tagCount` tells it how many it did not get.\n */\nexport const ANNOTATION_LOOKUP_TAGS_MAX = 20\n\n/**\n * The most annotations that the read of ONE entity answers with.\n *\n * The read has no page of its own: a panel is a thread that a person scrolls,\n * not a table they walk. But it cannot be unbounded either \u2014 an entity that\n * collects notes for a year would make every load of that page serialize\n * thousands of rows of up to `ANNOTATION_BODY_MAX` characters each. So the\n * answer is the NEWEST rows up to this number, with `hasMore` to say that\n * older ones exist. The search page reads the rest.\n */\nexport const ANNOTATION_ENTITY_MAX = 200\n\n/**\n * The longest note that a route accepts.\n *\n * A note is context for a colleague and not a document. The ceiling keeps one\n * paste of a log file out of every read of the entity page, and a person who\n * needs more has a handbook page to link to.\n */\nexport const ANNOTATION_BODY_MAX = 4000\n\n/**\n * The longest reason of a tag assignment.\n *\n * A reason is a sentence for the next Camundi, not a document. It is also in\n * every lookup answer of a white-glove entity, so the ceiling keeps that\n * payload small.\n */\nexport const ANNOTATION_REASON_MAX = 500\n\n/** The longest tag name. A tag is a label, so it is short by design. */\nexport const ANNOTATION_TAG_NAME_MAX = 60\n\n/**\n * The longest free text that the search accepts.\n *\n * The VIEW needs it as much as the route: a field with no ceiling lets a\n * person paste more than the route takes, and the answer is then a 400 that\n * reads like a broken search. The field holds them here instead, and a deep\n * link that carries more is cut to this length rather than breaking the page.\n */\nexport const ANNOTATION_SEARCH_MAX_LENGTH = 200\n\n/** Annotations for each page when the caller asks for no number. */\nexport const ANNOTATION_PAGE_SIZE_DEFAULT = 100\n\n/**\n * The most annotations that one page can hold.\n *\n * The view needs this number too: a page that asked for more rows than the\n * service allows would get a 400 instead of rows.\n */\nexport const ANNOTATION_PAGE_SIZE_MAX = 500\n\n/**\n * The identity of a tag, from what a person typed.\n *\n * The case and the outer spaces go, and every run of inner whitespace becomes\n * one hyphen. `Partner`, ` partner ` and `Partner ` are then one tag, and\n * `key account` is `key-account`.\n *\n * Both sides run this: the backend writes the result into `normalizedName` and\n * holds it unique, and the frontend runs it to tell a person, before they\n * press the button, that the tag they are typing already exists.\n */\nexport function normalizeTagName(name: string): string {\n return name.trim().toLowerCase().replace(/\\s+/g, '-')\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 annotations of the fleet: the notes and the tags that a\n * Camundi attaches to an entity.\n *\n * An annotation adds CONTEXT that the fleet itself does not hold. A cluster row\n * says how much memory it has; it does not say \"this is the playground of the\n * demo team\". A Camundi writes that here, and the next Camundi reads it.\n *\n * This file holds no logic and no dependency, because control-backend and\n * control-frontend both read it. The rules that read these types are in\n * `../annotations/policy.js`, and they are pure for the same reason.\n *\n * The feature is INTERNAL. No annotation reaches a customer, and no route of\n * another service reads one.\n */\n\n/**\n * Every kind of fleet entity that can carry an annotation.\n *\n * A `const` tuple, not an enum, so it is both the union type and the list that\n * validates a request at run time.\n *\n * The kind is a STRING on the row and not a foreign key, because the entity is\n * in a different database: a cluster belongs to console-backend and an\n * organization to accounts-ng. That is also what keeps an annotation after\n * the entity goes away. See `AnnotationDto.entityLabel`.\n *\n * Add a kind here and in `ANNOTATION_ENTITY_KIND_LABELS` below. The two lists\n * are one `Record`, so a kind with no label does not compile.\n *\n * Every kind here is a THING of the fleet, and none of them is a person. That\n * is a rule and not an accident. A `user` kind was in this list and came out\n * again: an annotation outlives its entity on purpose, which is right for a\n * cluster that somebody deleted and wrong for a colleague who left, and this\n * feature has no retention rule, no reaper, and no way for the person written\n * about to read or correct it. Add a kind that names a PERSON only with those\n * three answered.\n */\nexport const ANNOTATION_ENTITY_KINDS = [\n 'cluster',\n 'organization',\n 'cluster-plan',\n 'cluster-plan-type',\n 'generation',\n 'channel',\n 'sales-plan',\n 'k8s-context',\n 'cluster-modification',\n 'cluster-bulk-operation',\n 'approval',\n 'dashboard',\n] as const\n\nexport type AnnotationEntityKind = (typeof ANNOTATION_ENTITY_KINDS)[number]\n\n/**\n * What a reader sees for each kind, in the singular.\n *\n * The label is here and not in the frontend, because the search page shows\n * results of every kind together and the backend writes the same word into a\n * log line. Two spellings of one kind would read as two kinds.\n */\nexport const ANNOTATION_ENTITY_KIND_LABELS: Record<\n AnnotationEntityKind,\n string\n> = {\n cluster: 'Cluster',\n organization: 'Organization',\n 'cluster-plan': 'Cluster plan',\n 'cluster-plan-type': 'Cluster plan type',\n generation: 'Generation',\n channel: 'Channel',\n 'sales-plan': 'Sales plan',\n 'k8s-context': 'Kubernetes context',\n 'cluster-modification': 'Cluster modification',\n 'cluster-bulk-operation': 'Cluster bulk operation',\n approval: 'Approval request',\n dashboard: 'Dashboard',\n}\n\n/**\n * What an annotation IS: a written note, or a tag out of the dictionary.\n *\n * One row type carries both, because both answer the same question \u2014 what does\n * a Camundi need to know about this entity? \u2014 and both are read, listed and\n * removed the same way. The difference is what the row points at: a note holds\n * `body`, and a tag holds `tag`.\n */\nexport const ANNOTATION_KINDS = ['note', 'tag'] as const\n\nexport type AnnotationKind = (typeof ANNOTATION_KINDS)[number]\n\n/** Who wrote an annotation. The same shape as `ApprovalActor`. */\nexport interface AnnotationActor {\n userId: string\n email: string\n}\n\n/**\n * One tag of the dictionary.\n *\n * A tag is its own row, and not a string on the annotation, for one reason:\n * a Camundi must be able to ask \"what else carries `partner`?\". A string on\n * each row answers that only with a scan, and it drifts: `Partner`, `partner `\n * and `partner` would be three tags that read as one.\n */\nexport interface AnnotationTagDto {\n id: string\n /** What a reader sees. The first spelling that anybody wrote wins. */\n name: string\n /** `name` through `normalizeTagName`. It is the identity of the tag. */\n normalizedName: string\n createdBy: AnnotationActor\n createdAt: string\n /**\n * How many LIVE entities carry this tag.\n *\n * It is counted at read time and never stored, so a removed assignment\n * lowers it with no second write. A list of the dictionary needs it to sort\n * by use, which is how a Camundi finds the tag that the team already uses\n * instead of inventing a second spelling of it.\n */\n usageCount: number\n}\n\n/**\n * One note, or one tag, on one entity.\n *\n * `entityKind` and `entityId` together name the entity. Neither is checked\n * against the fleet: the entity lives in another service, and an annotation\n * must survive its entity. See `entityLabel`.\n */\nexport interface AnnotationDto {\n id: string\n kind: AnnotationKind\n entityKind: AnnotationEntityKind\n entityId: string\n /**\n * What the entity was CALLED when somebody wrote the annotation.\n *\n * This is the only reason a search result stays readable after the entity is\n * deleted: the id of a cluster that no longer exists says nothing, and the\n * fleet can no longer answer what its name was. The label is a copy on\n * purpose, so it can be stale \u2014 it says what the entity was called then, not\n * what it is called now.\n */\n entityLabel?: string\n /** The text of a note. Absent on a tag. */\n body?: string\n /** The tag of a tag annotation. Absent on a note. */\n tag?: AnnotationTagDto\n /**\n * Why the tag hangs on this entity. Absent on a note.\n *\n * It belongs to the LINK and not to the dictionary entry: `white-glove` on\n * one org has another reason than on the next. It is optional for every tag\n * and required for `white-glove` (see `checkTagReason`).\n */\n reason?: string\n createdBy: AnnotationActor\n createdAt: string\n updatedAt: string\n /** True when `body` was changed after it was written. */\n edited: boolean\n /**\n * How many times this row was written. A new one carries 1.\n *\n * An edit sends the version that it read, and the route refuses the write\n * when the row moved on since. Without it the tab that somebody left open at\n * breakfast silently replaces the edit they made at lunch, and neither write\n * tells them that one of the two is gone.\n */\n version: number\n}\n\n/** The annotations of one entity, in one answer. */\nexport interface EntityAnnotationsDto {\n entityKind: AnnotationEntityKind\n entityId: string\n notes: AnnotationDto[]\n tags: AnnotationDto[]\n /**\n * True when the entity carries more than `ANNOTATION_ENTITY_MAX` rows, so\n * the two lists above are the newest of them and not all of them.\n *\n * A panel that showed no sign of this would be a page that quietly stops\n * being the whole story, which is worse for documentation than a page that\n * says where the rest is.\n */\n hasMore: boolean\n}\n\n/**\n * What one entity carries, in the answer of a lookup over many entities.\n *\n * A table of 3000 clusters cannot read 3000 panels. The lookup answers the\n * two questions that a row of such a table needs: which tags, and whether a\n * colleague wrote something that a person must read before they act.\n */\nexport interface AnnotationLookupEntryDto {\n entityId: string\n /**\n * The live tag annotations of the entity, oldest first, and at most\n * `ANNOTATION_LOOKUP_TAGS_MAX` of them.\n */\n tags: AnnotationDto[]\n /** How many live tags the entity carries. More than `tags` holds is cut. */\n tagCount: number\n /** How many live notes the entity carries. */\n noteCount: number\n /** The newest live note, so a row can show it with no second read. */\n latestNote?: AnnotationDto\n}\n\n/**\n * The answer of a lookup. It holds ONLY the entities that carry something,\n * so an entity with no entry carries nothing.\n */\nexport interface AnnotationLookupDto {\n entityKind: AnnotationEntityKind\n entries: AnnotationLookupEntryDto[]\n}\n\n/**\n * The most entities that one lookup names.\n *\n * The same number as the largest cluster bulk operation, which is the table\n * that asks the largest question.\n */\nexport const ANNOTATION_LOOKUP_MAX_ENTITIES = 3000\n\n/**\n * The most tags that a lookup answers for ONE entity.\n *\n * An entity can carry any number of tags. Without this cap, one lookup of\n * 3000 entities has no bound on its rows. A row of a table shows a few chips,\n * and `tagCount` tells it how many it did not get.\n */\nexport const ANNOTATION_LOOKUP_TAGS_MAX = 20\n\n/**\n * The most annotations that the read of ONE entity answers with.\n *\n * The read has no page of its own: a panel is a thread that a person scrolls,\n * not a table they walk. But it cannot be unbounded either \u2014 an entity that\n * collects notes for a year would make every load of that page serialize\n * thousands of rows of up to `ANNOTATION_BODY_MAX` characters each. So the\n * answer is the NEWEST rows up to this number, with `hasMore` to say that\n * older ones exist. The search page reads the rest.\n */\nexport const ANNOTATION_ENTITY_MAX = 200\n\n/**\n * The longest note that a route accepts.\n *\n * A note is context for a colleague and not a document. The ceiling keeps one\n * paste of a log file out of every read of the entity page, and a person who\n * needs more has a handbook page to link to.\n */\nexport const ANNOTATION_BODY_MAX = 4000\n\n/**\n * The longest reason of a tag assignment.\n *\n * A reason is a sentence for the next Camundi, not a document. It is also in\n * every lookup answer of a white-glove entity, so the ceiling keeps that\n * payload small.\n */\nexport const ANNOTATION_REASON_MAX = 500\n\n/** The longest tag name. A tag is a label, so it is short by design. */\nexport const ANNOTATION_TAG_NAME_MAX = 60\n\n/**\n * The longest free text that the search accepts.\n *\n * The VIEW needs it as much as the route: a field with no ceiling lets a\n * person paste more than the route takes, and the answer is then a 400 that\n * reads like a broken search. The field holds them here instead, and a deep\n * link that carries more is cut to this length rather than breaking the page.\n */\nexport const ANNOTATION_SEARCH_MAX_LENGTH = 200\n\n/** Annotations for each page when the caller asks for no number. */\nexport const ANNOTATION_PAGE_SIZE_DEFAULT = 100\n\n/**\n * The most annotations that one page can hold.\n *\n * The view needs this number too: a page that asked for more rows than the\n * service allows would get a 400 instead of rows.\n */\nexport const ANNOTATION_PAGE_SIZE_MAX = 500\n\n/**\n * The identity of a tag, from what a person typed.\n *\n * The case and the outer spaces go, and every run of inner whitespace becomes\n * one hyphen. `Partner`, ` partner ` and `Partner ` are then one tag, and\n * `key account` is `key-account`.\n *\n * Both sides run this: the backend writes the result into `normalizedName` and\n * holds it unique, and the frontend runs it to tell a person, before they\n * press the button, that the tag they are typing already exists.\n */\nexport function normalizeTagName(name: string): string {\n return name.trim().toLowerCase().replace(/\\s+/g, '-')\n}\n"],
5
5
  "mappings": "AA4CO,MAAM,0BAA0B;AAAA,EACrC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAWO,MAAM,gCAGT;AAAA,EACF,SAAS;AAAA,EACT,cAAc;AAAA,EACd,gBAAgB;AAAA,EAChB,qBAAqB;AAAA,EACrB,YAAY;AAAA,EACZ,SAAS;AAAA,EACT,cAAc;AAAA,EACd,eAAe;AAAA,EACf,wBAAwB;AAAA,EACxB,0BAA0B;AAAA,EAC1B,UAAU;AAAA,EACV,WAAW;AACb;AAUO,MAAM,mBAAmB,CAAC,QAAQ,KAAK;AA6IvC,MAAM,iCAAiC;AASvC,MAAM,6BAA6B;AAYnC,MAAM,wBAAwB;AAS9B,MAAM,sBAAsB;AAS5B,MAAM,wBAAwB;AAG9B,MAAM,0BAA0B;AAUhC,MAAM,+BAA+B;AAGrC,MAAM,+BAA+B;AAQrC,MAAM,2BAA2B;AAajC,SAAS,iBAAiB,MAAsB;AACrD,SAAO,KAAK,KAAK,EAAE,YAAY,EAAE,QAAQ,QAAQ,GAAG;AACtD;",
6
6
  "names": []
7
7
  }
@@ -226,7 +226,7 @@ export interface ApprovalAck extends ApprovalActor {
226
226
  * acts on it must ask Auth0 again whether `requestedBy` may do the action.
227
227
  * That means the permission of the action. For a use case with
228
228
  * `openToEveryone`, it means that the person is a Camundi, because no
229
- * permission runs that action. `api/admin/approvals` in accounts-backend does
229
+ * permission runs that action. `api/admin/approvals` in accounts-ng does
230
230
  * that. See the note on `M2M_CONTROL_APPROVALS`.
231
231
  */
232
232
  export interface ApprovalM2mActor {
@@ -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`,\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"],
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-ng 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
  }
@@ -29,7 +29,7 @@ export interface ApprovalSummaryNamesResult {
29
29
  }
30
30
  /**
31
31
  * The answer of `GET api/admin/approvals/organizations/:orgId/name` of
32
- * accounts-backend.
32
+ * accounts-ng.
33
33
  */
34
34
  export interface ApprovalOrganizationNameResult {
35
35
  id: string;
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/dtos/ControlV2.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\nimport type { CamundaClusterStage } from '../types/CamundaClusterLabels.type.js'\nimport type { ClusterPlanTypesToReserved } from '../types/ClusterPlanTypesToReserved.type.js'\nimport type { ClusterTtlDto } from '../types/ClusterTtl.type.js'\nimport type { SalesPlanType } from '../types/SalesPlanType.type.js'\nimport type { LicensingModelType } from './Organization.dto.js'\n\n// ============================================================================\n// Control (v2) API contract\n//\n// Purpose-built, list-optimized DTOs for the new Control frontend, served by the\n// `/v2` routers on accounts-backend and console-backend. Cursor-paginated, and\n// pre-shaped server-side so the client does no normalization. See\n// copilot/CONTROL_FRONTEND_SPEC.md \u00A710.\n// ============================================================================\n\n/** Generic cursor-paginated response. `nextCursor === null` on the last page. */\nexport interface CursorPage<T> {\n items: T[]\n nextCursor: string | null\n}\n\n/** Cursor pagination query params shared by all v2 list endpoints. */\nexport interface CursorParams {\n cursor?: string\n limit?: number\n}\n\n// ---- Session (GET /v2/session) -------------------------------------------\n\nexport interface ControlSessionUser {\n id: string\n email: string\n name: string\n}\n\n/**\n * Flat map of resolved capability flags for the signed-in user, computed\n * server-side from the existing JWT-claim + Auth0-metadata model (kept as-is,\n * spec Q12). The shell uses these to gate navigation; the backend flattens its\n * `Features` object into the subset the nav needs.\n */\nexport type ControlResolvedPermissions = Record<string, boolean>\n\nexport interface OrgSummaryV2Dto {\n id: string\n name: string\n role: string\n clusterCount: number\n}\n\nexport interface ControlSessionDto {\n user: ControlSessionUser\n permissions: ControlResolvedPermissions\n organizations: OrgSummaryV2Dto[]\n}\n\n// ---- Organizations (GET /v2/organizations) -------------------------------\n\nexport interface OrgListItemV2Dto {\n id: string\n name: string\n /** ISO-8601; part of the cursor key. */\n created: string\n internal: boolean\n salesPlanType?: SalesPlanType\n /** Concrete plan name (`SalesPlan.name`), distinct from the tier `salesPlanType`. */\n salesPlanName?: string\n salesForceId?: string\n /** ISO-8601 end of the trial, when the org is or was on a trial plan. */\n trialExpiresAt?: string\n /**\n * Persisted trial state: `true` when the trial ran out, `false` while it\n * runs. Absent when the org is not on a trial plan or the state is not set.\n */\n trialExpired?: boolean\n /** Org metadata flag: the org can only create clusters on AWS. */\n awsOnly?: boolean\n /** Org metadata flag: enterprise plan limited to development use. */\n enterpriseDevOnly?: boolean\n /** Org metadata: which licensing model prices the org. */\n licensingModel?: LicensingModelType\n /**\n * The cluster plan types the org reserved, by plan type uuid, with the\n * count. Absent when the org has no sales plan, and also when it has one\n * that holds no reserved map (the column is nullable). The export of\n * reservations and clusters of the Organizations page reads it.\n */\n clusterPlanTypesToReserved?: ClusterPlanTypesToReserved\n}\n\nexport interface ListOrganizationsV2Params extends CursorParams {\n q?: string\n /**\n * Lucene-style query over the org fields (see `ORGANIZATION_SEARCH_FIELDS`).\n * ANDed with `q`/`filter` server-side; a bare term behaves like `q`.\n */\n query?: string\n sort?: 'name' | 'created' | 'internal' | 'salesPlanType' | 'salesPlanName'\n order?: 'asc' | 'desc'\n filter?: {\n internal?: boolean\n /** Sales plan tiers (`SalesPlanType`); multi-select, matched with `IN (...)`. */\n salesPlanTypes?: SalesPlanType[]\n /**\n * Concrete plan names (`SalesPlan.name`, distinct from the tier); backs the\n * \"Sales plan name\" filter. Multi-select, matched with `IN (...)`.\n */\n salesPlanNames?: string[]\n /** ISO-8601 lower bound on `created` (age-bucket filters). */\n createdAfter?: string\n /** ISO-8601 upper bound on `created` (age-bucket filters). */\n createdBefore?: string\n /**\n * Restrict to these org uuids. Backs cross-backend lookups (e.g. org by\n * cluster name / client id: resolve owner ids on console, then filter\n * here \u2014 spec \u00A714.1 L).\n */\n ids?: string[]\n /**\n * Only organizations that can create clusters on AWS alone (true), or\n * every other organization (false). Reads `metadata.awsOnly`; an\n * organization with no value counts as not AWS-only, as the accounts\n * tool reads it.\n */\n awsOnly?: boolean\n /**\n * Only organizations that hold a reservation above zero for one of\n * these cluster plan type uuids. Reads\n * `organizationToSalesPlan.clusterPlanTypesToReserved`.\n */\n reservedPlanTypeIds?: string[]\n /**\n * Only organizations whose trial expired (true), or every other\n * organization (false). Reads `otsp.trialStateExpired`; an organization\n * with no value counts as not expired.\n */\n trialExpired?: boolean\n /** ISO-8601 lower bound on `otsp.trialExpirationDate`. */\n trialExpiresAfter?: string\n /** ISO-8601 upper bound on `otsp.trialExpirationDate`. */\n trialExpiresBefore?: string\n }\n}\n\nexport interface OrgDetailV2Dto extends OrgListItemV2Dto {\n /** Full detail fields are added as the detail page is built (Phase 3). */\n metadata?: Record<string, unknown>\n}\n\nexport interface OrgMemberV2Dto {\n userId: string\n email: string\n name?: string\n roles: string[]\n status: 'active' | 'invited'\n /** ISO-8601. */\n invitedAt?: string\n /** ISO-8601. */\n joinedAt?: string\n}\n\nexport interface ListOrgMembersV2Params extends CursorParams {\n q?: string\n}\n\n// ---- Clusters (GET /v2/clusters) -----------------------------------------\n\nexport interface ClusterListItemV2Dto {\n id: string\n name: string\n orgId: string\n orgName: string\n /** Normalized server-side; augmented on the fly from the K8s watcher (\u00A79.4 B1). */\n status: string\n /**\n * The `metadata.generation` of the ZeebeCluster CR, from the K8s watcher at\n * the time of the read, as in `ClusterLiveStateV2Entry`. A row thus carries\n * the baseline that a poll of `GET /v2/clusters/live-state` compares with.\n * Absent when the watcher does not know the cluster, or on an older\n * console-backend.\n */\n specGeneration?: number\n /**\n * Cluster environment stage (dev/test/stage/prod), from the single `camunda`\n * label. Absent when the cluster has no camunda label or more than one, so a\n * surface can only trust it when it is set \u2014 the same guard the cluster\n * detail page and accounts use.\n */\n stageTag?: CamundaClusterStage\n /** Plan type name (`ClusterPlanType.name`). Backs the \"Plan type\" column. */\n planTypeName: string\n /**\n * Plan type uuid (`ClusterPlanType.uuid`). The key that the org reserved map\n * (`clusterPlanTypesToReserved`) uses, so the Control org \"Reservations\" tab\n * can group clusters by plan type to compute the used count.\n */\n planTypeId?: string\n /**\n * Hardware-package count for the cluster (advanced offering). One cluster can\n * use more than one package, so the used-reservation total sums this value\n * across the org's clusters. Undefined when the source value is unknown; the\n * client then counts the cluster as one package.\n */\n numberOfAllocatedHwPackages?: number\n /** Concrete plan name (`ClusterPlan.name`). Backs the \"Plan\" column. */\n planName?: string\n /**\n * Concrete plan uuid (`ClusterPlan.uuid`). Names are not unique, so this is\n * the key to compare a cluster with a target plan.\n */\n planId?: string\n /** Generation name, for display. Group and filter by `generationId`. */\n generation: string\n /** Generation uuid. Names are not unique, so this is the grouping key. */\n generationId?: string\n region: string\n /** Display-only; not a sort/filter key (\u00A79.4 B2). */\n load?: number\n updateAvailable: boolean\n /** Auto-update setting (distinct from `updateAvailable`). */\n autoUpdate: boolean\n /** Release channel name, when the cluster is on one. */\n channel?: string\n /** ISO-8601; part of the cursor key. */\n created: string\n /**\n * User id of the creator, e.g. `samlp|Okta|jane.doe@camunda.com`. Absent\n * when a background flow created the cluster, for an old cluster that has\n * no record of its creator, or on an older console-backend. Also absent\n * for a caller without `canReadAllClusterInfo`: the org clusters route\n * serves members of the org too (see `canReadClusterCreator`).\n */\n createdBy?: string\n /**\n * ISO-8601 instant of the last suspend. Absent when the cluster is awake:\n * `Cluster.wakeUp()` clears the column, thus this is the time since the last\n * suspend and not the total time that the cluster was asleep.\n */\n suspendedAt?: string\n /** The \"Authorizations\" toggle of cluster create. */\n identityBackendChecksEnabled?: boolean\n multiTenancyEnabled?: boolean\n /** BYOIDP. */\n externalIdpEnabled?: boolean\n /** Session idle timeout. */\n sessionMaxInactiveIntervalMinutes?: number\n sessionHeartbeatEnabled?: boolean\n /** BYOK: `encryption` is `External`. The key can still be missing. */\n byokEnabled?: boolean\n /** The cluster has at least one external monitoring (BYOM) client. */\n externalMonitoringEnabled?: boolean\n /** The cluster has a `secure_connectivity` row (AWS PrivateLink). */\n privateConnectivityEnabled?: boolean\n /**\n * The cluster TTL. Absent where `CommonClusterDto.ttl` is absent for the\n * same reader: on every stage other than dev and int, prod included. Also\n * absent for a member of the org on the org clusters route, and on an older\n * console-backend.\n */\n ttl?: ClusterTtlDto\n}\n\n/** Detail extends the list shape; richer fields are added in Phase 3. */\nexport type ClusterDetailV2Dto = ClusterListItemV2Dto\n\n/**\n * How much work a cluster did, inside the 30-day activity window.\n *\n * `idle` and `unknown` are different facts and must stay apart. `idle` is\n * evidence that the cluster did no work. `unknown` is the absence of\n * evidence: on the dev stage most clusters have no row at all.\n *\n * The source is the Holistic Data Platform (HDP), which holds one row per\n * cluster, per day, per value metric. The window is 30 days, thus a bucket\n * for \"did work, but more than 30 days ago\" is not possible.\n */\nexport type ClusterActivityBucket =\n /** Work inside the 30-day window. */\n | 'active'\n /** Rows exist inside the window. All values are zero. */\n | 'idle'\n /** No row at all inside the window. */\n | 'unknown'\n\n/** Quick-filter tiles on the clusters list. */\nexport type ClusterActivityTile =\n | 'all'\n | 'active'\n | 'idle'\n | 'unknown'\n /** More than 90 days old, and not active. */\n | 'old-idle'\n /** No more than 30 days old, with no work and no data. */\n | 'new-idle'\n\nexport interface ClusterActivityV2Dto {\n clusterId: string\n /**\n * ISO-8601 instant of the last UTC day with work. HDP buckets by day, thus\n * the time part is always midnight. Absent when the cluster did no work\n * inside the window.\n */\n lastActiveAt?: string\n processInstances30d: number\n bucket: ClusterActivityBucket\n}\n\nexport interface ClusterActivityV2Response {\n /**\n * One entry per live cluster that has an HDP row inside the window. A\n * cluster in the `unknown` bucket has no entry, because the bucket means\n * that no row exists.\n */\n items: ClusterActivityV2Dto[]\n /** Fleet-wide tile counts. The server joins `cluster.created` for the age tiles. */\n counts: Record<ClusterActivityTile, number>\n /** ISO-8601 instant when the server assembled this response. */\n fetchedAt: string\n /** The number of days that the window covers. */\n windowDays: number\n}\n\n/** The modification state of a cluster, as the Clusters list filters it. */\nexport const CLUSTER_MODIFICATION_STATES = [\n 'active',\n 'planned',\n 'archived',\n 'none',\n] as const\nexport type ClusterModificationState =\n (typeof CLUSTER_MODIFICATION_STATES)[number]\n\nexport interface ListClustersV2Params extends CursorParams {\n q?: string\n /**\n * Lucene-style query over the cluster fields (see `CLUSTER_SEARCH_FIELDS`).\n * ANDed with `q`/`filter` server-side; a bare term behaves like `q`.\n */\n query?: string\n /**\n * Server-side sort key. Beyond `name`/`created`, the clusters list also sorts\n * by the DB-backed columns behind these list columns (the values are the\n * frontend column `key`s, mapped to SQL expressions in the controller):\n * `orgName` (owner id), `autoUpdate`, `planName`, `planTypeName`, `generation`,\n * `channel`, `stageTag` (the single `camunda` label), `ttlExpiresAt` (a\n * cluster with no expiry is last in both directions; a reader who may not\n * see the TTL gets the default sort). `status`/`region` are intentionally\n * excluded \u2014 they're computed from live K8s state / context config, not SQL\n * columns.\n */\n sort?:\n | 'name'\n | 'created'\n | 'orgName'\n | 'autoUpdate'\n | 'planName'\n | 'planTypeName'\n | 'generation'\n | 'channel'\n | 'stageTag'\n | 'ttlExpiresAt'\n order?: 'asc' | 'desc'\n filter?: {\n status?: string\n /**\n * Cluster plan TYPE name (maps to `planType.name`; legacy single-value\n * param, still used by the plan-type detail page's cluster-distribution\n * read \u2014 kept alongside `planTypeNames` rather than replaced).\n */\n plan?: string\n /**\n * Restrict to these plan TYPE names (`planType.name`); the Control\n * clusters list's multi-select \"Plan type\" filter.\n */\n planTypeNames?: string[]\n /**\n * Restrict to these concrete plan names (`plan.name`, the `ClusterPlan`\n * entity \u2014 NOT the plan type); backs the Control clusters list's \"Plan\"\n * filter, whose dropdown is sourced from `ClusterPlan` via\n * `/clusters/parameters`. Corrected in #9325 (second pass): a prior fix\n * on this branch mistakenly repointed this at `planType.name` to match a\n * dropdown that was, at the time, wrongly sourced from `ClusterPlanType`\n * \u2014 but the dropdown was the actual bug. Both the dropdown and this query\n * now consistently reference `ClusterPlan`. Distinct from `planTypeNames`\n * above, which is the separate \"Plan type\" filter over `ClusterPlanType`.\n */\n planNames?: string[]\n /**\n * Restrict to these generation uuids (`generation.uuid`). Never by name:\n * a generation name is not unique, so one name can match two generations.\n */\n generationIds?: string[]\n /** Restrict to these cloud providers (resolved via the k8s-context config). */\n providers?: string[]\n /** Exact k8s context uuid. */\n k8sContext?: string\n /**\n * Restrict to these k8s context (datacenter) uuids; the Control clusters\n * list's multi-select \"Datacenter\" filter, which matches the context\n * identity, mirroring the accounts clusters list's \"Filter by Datacenter\".\n */\n k8sContexts?: string[]\n orgId?: string\n /** Restrict to these owner org uuids (cross-backend sales-plan filters). */\n orgIds?: string[]\n /** Restrict to these cluster uuids (prefilter-by-id). */\n ids?: string[]\n /** Restrict to clusters that these user ids created (`cluster.createdBy`). */\n createdBy?: string[]\n /** Auto-update on/off. */\n autoUpdate?: boolean\n /** Internal (Camunda-owned) clusters only / excluded. */\n internal?: boolean\n /** Only clusters with (true) / without (false) an active modification. */\n hasActiveModification?: boolean\n /**\n * Only clusters whose plan is (true) / is not (false) the active plan of\n * their plan type. The accounts clusters list calls it \"on most recent\n * ClusterPlan\"; a cluster that is not is one a plan update would move.\n */\n onActivePlan?: boolean\n /**\n * Only clusters whose generation is (true) / is not (false) unsupported\n * now: `isUnsupportedStarting` is set and in the past.\n */\n unsupportedGeneration?: boolean\n /**\n * Only clusters with (true) / without (false) the legacy environment\n * variable override of the cluster row (`overrideEnvVars`). Modification\n * configs replaced it; a cluster that still has one needs a look.\n */\n legacyEnvVars?: boolean\n /**\n * Restrict to clusters in one of these modification states. `active` is\n * an active config, `planned` a modification with no active config that\n * is not archived, `archived` only archived modifications, `none` no\n * modification at all. The states are exclusive, so several select the\n * union.\n */\n modificationStates?: ClusterModificationState[]\n /** Only clusters with (true) / without (false) the flag of the same name. */\n byokEnabled?: boolean\n externalMonitoringEnabled?: boolean\n privateConnectivityEnabled?: boolean\n /**\n * Zeebe minor-version prefix match on the generation's versions (e.g.\n * \"8.7\" matches zeebe 8.7.x).\n */\n minorVersion?: string\n /** Restrict to these release channel names. */\n channels?: string[]\n /**\n * ISO-8601 lower bound on `created` (e.g. \"created in the last 7 days\").\n * Inclusive: a cluster created at this instant matches.\n */\n createdAfter?: string\n /**\n * ISO-8601 upper bound on `created`. Pairs with `createdAfter` for the\n * age axis. Exclusive: a cluster created at this instant does not match.\n */\n createdBefore?: string\n /**\n * ISO-8601 upper bound on `suspendedAt`, thus \"asleep since at least N\n * days\". Exclusive, as `createdBefore` is. A cluster that is awake never\n * matches: `Cluster.wakeUp()` clears the column.\n *\n * The bound is the time since the last suspend. A cluster that woke up for\n * one minute and then slept again starts from zero, thus this filter finds\n * the clusters that nobody touched, not the clusters that did no work.\n */\n suspendedBefore?: string\n /**\n * ISO-8601 lower bound on `suspendedAt`, thus \"asleep for not more than N\n * days\". Inclusive, as `createdAfter` is. It makes the suspension-age\n * range together with `suspendedBefore`.\n *\n * A cluster that is awake never matches, for the same reason as\n * `suspendedBefore`.\n */\n suspendedAfter?: string\n /**\n * Restrict to these activity buckets. The controller resolves the buckets\n * to a cluster id set from the cached HDP activity map, the same way\n * `filter.status` resolves K8s state to a cluster id set.\n */\n activity?: ClusterActivityBucket[]\n /**\n * `expiring` keeps the clusters whose TTL has an expiry, `unlimited` the\n * clusters whose TTL is unlimited.\n */\n ttl?: ClusterTtlFilter\n /**\n * ISO-8601 upper bound on the TTL expiry. Exclusive, as `createdBefore`\n * is. A cluster with an unlimited TTL never matches.\n */\n ttlExpiresBefore?: string\n }\n}\n\n/** ClusterTtlFilter is the value of `ListClustersV2Params.filter.ttl`. */\nexport type ClusterTtlFilter = 'expiring' | 'unlimited'\n\nexport interface ClusterParameterOptionV2Dto {\n id: string\n name: string\n}\n\n/**\n * A datacenter (k8s context) option for the clusters list's \"Datacenter\" filter.\n * `id` is the context uuid (matched by `filter.k8sContexts`); `region`/`provider`\n * come from the context config and let the dropdown be grouped by provider and\n * show the region, mirroring the accounts clusters list.\n */\nexport interface ClusterDatacenterOptionV2Dto\n extends ClusterParameterOptionV2Dto {\n region?: string\n provider?: string\n}\n\nexport interface ClusterParametersV2Dto {\n plans: ClusterParameterOptionV2Dto[]\n generations: ClusterParameterOptionV2Dto[]\n datacenters: ClusterDatacenterOptionV2Dto[]\n}\n\n/**\n * One cluster in the watcher memory of console-backend: `[id, status,\n * specGeneration]`. `status` is lowercase, as in `ClusterListItemV2Dto`.\n * `specGeneration` is the `metadata.generation` of the ZeebeCluster CR.\n * Kubernetes increments it on each change of the spec, for example a new\n * generation or a new plan. It is `0` when the CR does not give one.\n */\nexport type ClusterLiveStateV2Entry = [\n id: string,\n status: string,\n specGeneration: number,\n]\n\n/**\n * The whole fleet as the watcher sees it (GET /v2/clusters/live-state). The\n * route reads memory only, never the database, thus a client can poll it every\n * second. The entries are sorted by id, thus two equal states give the same\n * body and the same ETag, also on two pods. A pod that is late gives a\n * different body until it gets the same watch events.\n */\nexport interface ClusterLiveStateV2Dto {\n items: ClusterLiveStateV2Entry[]\n}\n\n/**\n * Aggregated cluster distribution counts (GET /v2/clusters/facets), backing\n * the list page's distribution charts and quick-filter tiles without a\n * client-side full-table scan (spec \u00A714.0 hybrid model). SQL-backed facets\n * (generation/planType/channel/autoUpdate) come from GROUP BYs; status and\n * provider are aggregated in-app from the K8s watcher / context config.\n */\nexport interface ClusterFacetsV2Dto {\n total: number\n status: Record<string, number>\n /** Keyed by generation uuid, not name: names are not unique. */\n generation: Record<string, number>\n planType: Record<string, number>\n channel: Record<string, number>\n provider: Record<string, number>\n autoUpdate: { on: number; off: number }\n /** Clusters with an active (non-archived) modification. */\n activeModifications: number\n /**\n * Keyed by the user id of the creator. Only Camundi ids (see\n * `isCamundaUserId`): the \"Created by\" filter lists Camundis, and the id of\n * a customer does not belong in a fleet-wide facet. Absent on an older\n * console-backend.\n */\n createdBy?: Record<string, number>\n}\n\n/** Cluster/owner resolution for a Zeebe client id (cross-backend org search). */\nexport interface ClusterByClientV2Dto {\n clusterId: string\n orgId: string\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\nimport type { CamundaClusterStage } from '../types/CamundaClusterLabels.type.js'\nimport type { ClusterPlanTypesToReserved } from '../types/ClusterPlanTypesToReserved.type.js'\nimport type { ClusterTtlDto } from '../types/ClusterTtl.type.js'\nimport type { SalesPlanType } from '../types/SalesPlanType.type.js'\nimport type { LicensingModelType } from './Organization.dto.js'\n\n// ============================================================================\n// Control (v2) API contract\n//\n// Purpose-built, list-optimized DTOs for the new Control frontend, served by the\n// `/v2` routers on accounts-ng and console-backend. Cursor-paginated, and\n// pre-shaped server-side so the client does no normalization. See\n// copilot/CONTROL_FRONTEND_SPEC.md \u00A710.\n// ============================================================================\n\n/** Generic cursor-paginated response. `nextCursor === null` on the last page. */\nexport interface CursorPage<T> {\n items: T[]\n nextCursor: string | null\n}\n\n/** Cursor pagination query params shared by all v2 list endpoints. */\nexport interface CursorParams {\n cursor?: string\n limit?: number\n}\n\n// ---- Session (GET /v2/session) -------------------------------------------\n\nexport interface ControlSessionUser {\n id: string\n email: string\n name: string\n}\n\n/**\n * Flat map of resolved capability flags for the signed-in user, computed\n * server-side from the existing JWT-claim + Auth0-metadata model (kept as-is,\n * spec Q12). The shell uses these to gate navigation; the backend flattens its\n * `Features` object into the subset the nav needs.\n */\nexport type ControlResolvedPermissions = Record<string, boolean>\n\nexport interface OrgSummaryV2Dto {\n id: string\n name: string\n role: string\n clusterCount: number\n}\n\nexport interface ControlSessionDto {\n user: ControlSessionUser\n permissions: ControlResolvedPermissions\n organizations: OrgSummaryV2Dto[]\n}\n\n// ---- Organizations (GET /v2/organizations) -------------------------------\n\nexport interface OrgListItemV2Dto {\n id: string\n name: string\n /** ISO-8601; part of the cursor key. */\n created: string\n internal: boolean\n salesPlanType?: SalesPlanType\n /** Concrete plan name (`SalesPlan.name`), distinct from the tier `salesPlanType`. */\n salesPlanName?: string\n salesForceId?: string\n /** ISO-8601 end of the trial, when the org is or was on a trial plan. */\n trialExpiresAt?: string\n /**\n * Persisted trial state: `true` when the trial ran out, `false` while it\n * runs. Absent when the org is not on a trial plan or the state is not set.\n */\n trialExpired?: boolean\n /** Org metadata flag: the org can only create clusters on AWS. */\n awsOnly?: boolean\n /** Org metadata flag: enterprise plan limited to development use. */\n enterpriseDevOnly?: boolean\n /** Org metadata: which licensing model prices the org. */\n licensingModel?: LicensingModelType\n /**\n * The cluster plan types the org reserved, by plan type uuid, with the\n * count. Absent when the org has no sales plan, and also when it has one\n * that holds no reserved map (the column is nullable). The export of\n * reservations and clusters of the Organizations page reads it.\n */\n clusterPlanTypesToReserved?: ClusterPlanTypesToReserved\n}\n\nexport interface ListOrganizationsV2Params extends CursorParams {\n q?: string\n /**\n * Lucene-style query over the org fields (see `ORGANIZATION_SEARCH_FIELDS`).\n * ANDed with `q`/`filter` server-side; a bare term behaves like `q`.\n */\n query?: string\n sort?: 'name' | 'created' | 'internal' | 'salesPlanType' | 'salesPlanName'\n order?: 'asc' | 'desc'\n filter?: {\n internal?: boolean\n /** Sales plan tiers (`SalesPlanType`); multi-select, matched with `IN (...)`. */\n salesPlanTypes?: SalesPlanType[]\n /**\n * Concrete plan names (`SalesPlan.name`, distinct from the tier); backs the\n * \"Sales plan name\" filter. Multi-select, matched with `IN (...)`.\n */\n salesPlanNames?: string[]\n /** ISO-8601 lower bound on `created` (age-bucket filters). */\n createdAfter?: string\n /** ISO-8601 upper bound on `created` (age-bucket filters). */\n createdBefore?: string\n /**\n * Restrict to these org uuids. Backs cross-backend lookups (e.g. org by\n * cluster name / client id: resolve owner ids on console, then filter\n * here \u2014 spec \u00A714.1 L).\n */\n ids?: string[]\n /**\n * Only organizations that can create clusters on AWS alone (true), or\n * every other organization (false). Reads `metadata.awsOnly`; an\n * organization with no value counts as not AWS-only, as the accounts\n * tool reads it.\n */\n awsOnly?: boolean\n /**\n * Only organizations that hold a reservation above zero for one of\n * these cluster plan type uuids. Reads\n * `organizationToSalesPlan.clusterPlanTypesToReserved`.\n */\n reservedPlanTypeIds?: string[]\n /**\n * Only organizations whose trial expired (true), or every other\n * organization (false). Reads `otsp.trialStateExpired`; an organization\n * with no value counts as not expired.\n */\n trialExpired?: boolean\n /** ISO-8601 lower bound on `otsp.trialExpirationDate`. */\n trialExpiresAfter?: string\n /** ISO-8601 upper bound on `otsp.trialExpirationDate`. */\n trialExpiresBefore?: string\n }\n}\n\nexport interface OrgDetailV2Dto extends OrgListItemV2Dto {\n /** Full detail fields are added as the detail page is built (Phase 3). */\n metadata?: Record<string, unknown>\n}\n\nexport interface OrgMemberV2Dto {\n userId: string\n email: string\n name?: string\n roles: string[]\n status: 'active' | 'invited'\n /** ISO-8601. */\n invitedAt?: string\n /** ISO-8601. */\n joinedAt?: string\n}\n\nexport interface ListOrgMembersV2Params extends CursorParams {\n q?: string\n}\n\n// ---- Clusters (GET /v2/clusters) -----------------------------------------\n\nexport interface ClusterListItemV2Dto {\n id: string\n name: string\n orgId: string\n orgName: string\n /** Normalized server-side; augmented on the fly from the K8s watcher (\u00A79.4 B1). */\n status: string\n /**\n * The `metadata.generation` of the ZeebeCluster CR, from the K8s watcher at\n * the time of the read, as in `ClusterLiveStateV2Entry`. A row thus carries\n * the baseline that a poll of `GET /v2/clusters/live-state` compares with.\n * Absent when the watcher does not know the cluster, or on an older\n * console-backend.\n */\n specGeneration?: number\n /**\n * Cluster environment stage (dev/test/stage/prod), from the single `camunda`\n * label. Absent when the cluster has no camunda label or more than one, so a\n * surface can only trust it when it is set \u2014 the same guard the cluster\n * detail page and accounts use.\n */\n stageTag?: CamundaClusterStage\n /** Plan type name (`ClusterPlanType.name`). Backs the \"Plan type\" column. */\n planTypeName: string\n /**\n * Plan type uuid (`ClusterPlanType.uuid`). The key that the org reserved map\n * (`clusterPlanTypesToReserved`) uses, so the Control org \"Reservations\" tab\n * can group clusters by plan type to compute the used count.\n */\n planTypeId?: string\n /**\n * Hardware-package count for the cluster (advanced offering). One cluster can\n * use more than one package, so the used-reservation total sums this value\n * across the org's clusters. Undefined when the source value is unknown; the\n * client then counts the cluster as one package.\n */\n numberOfAllocatedHwPackages?: number\n /** Concrete plan name (`ClusterPlan.name`). Backs the \"Plan\" column. */\n planName?: string\n /**\n * Concrete plan uuid (`ClusterPlan.uuid`). Names are not unique, so this is\n * the key to compare a cluster with a target plan.\n */\n planId?: string\n /** Generation name, for display. Group and filter by `generationId`. */\n generation: string\n /** Generation uuid. Names are not unique, so this is the grouping key. */\n generationId?: string\n region: string\n /** Display-only; not a sort/filter key (\u00A79.4 B2). */\n load?: number\n updateAvailable: boolean\n /** Auto-update setting (distinct from `updateAvailable`). */\n autoUpdate: boolean\n /** Release channel name, when the cluster is on one. */\n channel?: string\n /** ISO-8601; part of the cursor key. */\n created: string\n /**\n * User id of the creator, e.g. `samlp|Okta|jane.doe@camunda.com`. Absent\n * when a background flow created the cluster, for an old cluster that has\n * no record of its creator, or on an older console-backend. Also absent\n * for a caller without `canReadAllClusterInfo`: the org clusters route\n * serves members of the org too (see `canReadClusterCreator`).\n */\n createdBy?: string\n /**\n * ISO-8601 instant of the last suspend. Absent when the cluster is awake:\n * `Cluster.wakeUp()` clears the column, thus this is the time since the last\n * suspend and not the total time that the cluster was asleep.\n */\n suspendedAt?: string\n /** The \"Authorizations\" toggle of cluster create. */\n identityBackendChecksEnabled?: boolean\n multiTenancyEnabled?: boolean\n /** BYOIDP. */\n externalIdpEnabled?: boolean\n /** Session idle timeout. */\n sessionMaxInactiveIntervalMinutes?: number\n sessionHeartbeatEnabled?: boolean\n /** BYOK: `encryption` is `External`. The key can still be missing. */\n byokEnabled?: boolean\n /** The cluster has at least one external monitoring (BYOM) client. */\n externalMonitoringEnabled?: boolean\n /** The cluster has a `secure_connectivity` row (AWS PrivateLink). */\n privateConnectivityEnabled?: boolean\n /**\n * The cluster TTL. Absent where `CommonClusterDto.ttl` is absent for the\n * same reader: on every stage other than dev and int, prod included. Also\n * absent for a member of the org on the org clusters route, and on an older\n * console-backend.\n */\n ttl?: ClusterTtlDto\n}\n\n/** Detail extends the list shape; richer fields are added in Phase 3. */\nexport type ClusterDetailV2Dto = ClusterListItemV2Dto\n\n/**\n * How much work a cluster did, inside the 30-day activity window.\n *\n * `idle` and `unknown` are different facts and must stay apart. `idle` is\n * evidence that the cluster did no work. `unknown` is the absence of\n * evidence: on the dev stage most clusters have no row at all.\n *\n * The source is the Holistic Data Platform (HDP), which holds one row per\n * cluster, per day, per value metric. The window is 30 days, thus a bucket\n * for \"did work, but more than 30 days ago\" is not possible.\n */\nexport type ClusterActivityBucket =\n /** Work inside the 30-day window. */\n | 'active'\n /** Rows exist inside the window. All values are zero. */\n | 'idle'\n /** No row at all inside the window. */\n | 'unknown'\n\n/** Quick-filter tiles on the clusters list. */\nexport type ClusterActivityTile =\n | 'all'\n | 'active'\n | 'idle'\n | 'unknown'\n /** More than 90 days old, and not active. */\n | 'old-idle'\n /** No more than 30 days old, with no work and no data. */\n | 'new-idle'\n\nexport interface ClusterActivityV2Dto {\n clusterId: string\n /**\n * ISO-8601 instant of the last UTC day with work. HDP buckets by day, thus\n * the time part is always midnight. Absent when the cluster did no work\n * inside the window.\n */\n lastActiveAt?: string\n processInstances30d: number\n bucket: ClusterActivityBucket\n}\n\nexport interface ClusterActivityV2Response {\n /**\n * One entry per live cluster that has an HDP row inside the window. A\n * cluster in the `unknown` bucket has no entry, because the bucket means\n * that no row exists.\n */\n items: ClusterActivityV2Dto[]\n /** Fleet-wide tile counts. The server joins `cluster.created` for the age tiles. */\n counts: Record<ClusterActivityTile, number>\n /** ISO-8601 instant when the server assembled this response. */\n fetchedAt: string\n /** The number of days that the window covers. */\n windowDays: number\n}\n\n/** The modification state of a cluster, as the Clusters list filters it. */\nexport const CLUSTER_MODIFICATION_STATES = [\n 'active',\n 'planned',\n 'archived',\n 'none',\n] as const\nexport type ClusterModificationState =\n (typeof CLUSTER_MODIFICATION_STATES)[number]\n\nexport interface ListClustersV2Params extends CursorParams {\n q?: string\n /**\n * Lucene-style query over the cluster fields (see `CLUSTER_SEARCH_FIELDS`).\n * ANDed with `q`/`filter` server-side; a bare term behaves like `q`.\n */\n query?: string\n /**\n * Server-side sort key. Beyond `name`/`created`, the clusters list also sorts\n * by the DB-backed columns behind these list columns (the values are the\n * frontend column `key`s, mapped to SQL expressions in the controller):\n * `orgName` (owner id), `autoUpdate`, `planName`, `planTypeName`, `generation`,\n * `channel`, `stageTag` (the single `camunda` label), `ttlExpiresAt` (a\n * cluster with no expiry is last in both directions; a reader who may not\n * see the TTL gets the default sort). `status`/`region` are intentionally\n * excluded \u2014 they're computed from live K8s state / context config, not SQL\n * columns.\n */\n sort?:\n | 'name'\n | 'created'\n | 'orgName'\n | 'autoUpdate'\n | 'planName'\n | 'planTypeName'\n | 'generation'\n | 'channel'\n | 'stageTag'\n | 'ttlExpiresAt'\n order?: 'asc' | 'desc'\n filter?: {\n status?: string\n /**\n * Cluster plan TYPE name (maps to `planType.name`; legacy single-value\n * param, still used by the plan-type detail page's cluster-distribution\n * read \u2014 kept alongside `planTypeNames` rather than replaced).\n */\n plan?: string\n /**\n * Restrict to these plan TYPE names (`planType.name`); the Control\n * clusters list's multi-select \"Plan type\" filter.\n */\n planTypeNames?: string[]\n /**\n * Restrict to these concrete plan names (`plan.name`, the `ClusterPlan`\n * entity \u2014 NOT the plan type); backs the Control clusters list's \"Plan\"\n * filter, whose dropdown is sourced from `ClusterPlan` via\n * `/clusters/parameters`. Corrected in #9325 (second pass): a prior fix\n * on this branch mistakenly repointed this at `planType.name` to match a\n * dropdown that was, at the time, wrongly sourced from `ClusterPlanType`\n * \u2014 but the dropdown was the actual bug. Both the dropdown and this query\n * now consistently reference `ClusterPlan`. Distinct from `planTypeNames`\n * above, which is the separate \"Plan type\" filter over `ClusterPlanType`.\n */\n planNames?: string[]\n /**\n * Restrict to these generation uuids (`generation.uuid`). Never by name:\n * a generation name is not unique, so one name can match two generations.\n */\n generationIds?: string[]\n /** Restrict to these cloud providers (resolved via the k8s-context config). */\n providers?: string[]\n /** Exact k8s context uuid. */\n k8sContext?: string\n /**\n * Restrict to these k8s context (datacenter) uuids; the Control clusters\n * list's multi-select \"Datacenter\" filter, which matches the context\n * identity, mirroring the accounts clusters list's \"Filter by Datacenter\".\n */\n k8sContexts?: string[]\n orgId?: string\n /** Restrict to these owner org uuids (cross-backend sales-plan filters). */\n orgIds?: string[]\n /** Restrict to these cluster uuids (prefilter-by-id). */\n ids?: string[]\n /** Restrict to clusters that these user ids created (`cluster.createdBy`). */\n createdBy?: string[]\n /** Auto-update on/off. */\n autoUpdate?: boolean\n /** Internal (Camunda-owned) clusters only / excluded. */\n internal?: boolean\n /** Only clusters with (true) / without (false) an active modification. */\n hasActiveModification?: boolean\n /**\n * Only clusters whose plan is (true) / is not (false) the active plan of\n * their plan type. The accounts clusters list calls it \"on most recent\n * ClusterPlan\"; a cluster that is not is one a plan update would move.\n */\n onActivePlan?: boolean\n /**\n * Only clusters whose generation is (true) / is not (false) unsupported\n * now: `isUnsupportedStarting` is set and in the past.\n */\n unsupportedGeneration?: boolean\n /**\n * Only clusters with (true) / without (false) the legacy environment\n * variable override of the cluster row (`overrideEnvVars`). Modification\n * configs replaced it; a cluster that still has one needs a look.\n */\n legacyEnvVars?: boolean\n /**\n * Restrict to clusters in one of these modification states. `active` is\n * an active config, `planned` a modification with no active config that\n * is not archived, `archived` only archived modifications, `none` no\n * modification at all. The states are exclusive, so several select the\n * union.\n */\n modificationStates?: ClusterModificationState[]\n /** Only clusters with (true) / without (false) the flag of the same name. */\n byokEnabled?: boolean\n externalMonitoringEnabled?: boolean\n privateConnectivityEnabled?: boolean\n /**\n * Zeebe minor-version prefix match on the generation's versions (e.g.\n * \"8.7\" matches zeebe 8.7.x).\n */\n minorVersion?: string\n /** Restrict to these release channel names. */\n channels?: string[]\n /**\n * ISO-8601 lower bound on `created` (e.g. \"created in the last 7 days\").\n * Inclusive: a cluster created at this instant matches.\n */\n createdAfter?: string\n /**\n * ISO-8601 upper bound on `created`. Pairs with `createdAfter` for the\n * age axis. Exclusive: a cluster created at this instant does not match.\n */\n createdBefore?: string\n /**\n * ISO-8601 upper bound on `suspendedAt`, thus \"asleep since at least N\n * days\". Exclusive, as `createdBefore` is. A cluster that is awake never\n * matches: `Cluster.wakeUp()` clears the column.\n *\n * The bound is the time since the last suspend. A cluster that woke up for\n * one minute and then slept again starts from zero, thus this filter finds\n * the clusters that nobody touched, not the clusters that did no work.\n */\n suspendedBefore?: string\n /**\n * ISO-8601 lower bound on `suspendedAt`, thus \"asleep for not more than N\n * days\". Inclusive, as `createdAfter` is. It makes the suspension-age\n * range together with `suspendedBefore`.\n *\n * A cluster that is awake never matches, for the same reason as\n * `suspendedBefore`.\n */\n suspendedAfter?: string\n /**\n * Restrict to these activity buckets. The controller resolves the buckets\n * to a cluster id set from the cached HDP activity map, the same way\n * `filter.status` resolves K8s state to a cluster id set.\n */\n activity?: ClusterActivityBucket[]\n /**\n * `expiring` keeps the clusters whose TTL has an expiry, `unlimited` the\n * clusters whose TTL is unlimited.\n */\n ttl?: ClusterTtlFilter\n /**\n * ISO-8601 upper bound on the TTL expiry. Exclusive, as `createdBefore`\n * is. A cluster with an unlimited TTL never matches.\n */\n ttlExpiresBefore?: string\n }\n}\n\n/** ClusterTtlFilter is the value of `ListClustersV2Params.filter.ttl`. */\nexport type ClusterTtlFilter = 'expiring' | 'unlimited'\n\nexport interface ClusterParameterOptionV2Dto {\n id: string\n name: string\n}\n\n/**\n * A datacenter (k8s context) option for the clusters list's \"Datacenter\" filter.\n * `id` is the context uuid (matched by `filter.k8sContexts`); `region`/`provider`\n * come from the context config and let the dropdown be grouped by provider and\n * show the region, mirroring the accounts clusters list.\n */\nexport interface ClusterDatacenterOptionV2Dto\n extends ClusterParameterOptionV2Dto {\n region?: string\n provider?: string\n}\n\nexport interface ClusterParametersV2Dto {\n plans: ClusterParameterOptionV2Dto[]\n generations: ClusterParameterOptionV2Dto[]\n datacenters: ClusterDatacenterOptionV2Dto[]\n}\n\n/**\n * One cluster in the watcher memory of console-backend: `[id, status,\n * specGeneration]`. `status` is lowercase, as in `ClusterListItemV2Dto`.\n * `specGeneration` is the `metadata.generation` of the ZeebeCluster CR.\n * Kubernetes increments it on each change of the spec, for example a new\n * generation or a new plan. It is `0` when the CR does not give one.\n */\nexport type ClusterLiveStateV2Entry = [\n id: string,\n status: string,\n specGeneration: number,\n]\n\n/**\n * The whole fleet as the watcher sees it (GET /v2/clusters/live-state). The\n * route reads memory only, never the database, thus a client can poll it every\n * second. The entries are sorted by id, thus two equal states give the same\n * body and the same ETag, also on two pods. A pod that is late gives a\n * different body until it gets the same watch events.\n */\nexport interface ClusterLiveStateV2Dto {\n items: ClusterLiveStateV2Entry[]\n}\n\n/**\n * Aggregated cluster distribution counts (GET /v2/clusters/facets), backing\n * the list page's distribution charts and quick-filter tiles without a\n * client-side full-table scan (spec \u00A714.0 hybrid model). SQL-backed facets\n * (generation/planType/channel/autoUpdate) come from GROUP BYs; status and\n * provider are aggregated in-app from the K8s watcher / context config.\n */\nexport interface ClusterFacetsV2Dto {\n total: number\n status: Record<string, number>\n /** Keyed by generation uuid, not name: names are not unique. */\n generation: Record<string, number>\n planType: Record<string, number>\n channel: Record<string, number>\n provider: Record<string, number>\n autoUpdate: { on: number; off: number }\n /** Clusters with an active (non-archived) modification. */\n activeModifications: number\n /**\n * Keyed by the user id of the creator. Only Camundi ids (see\n * `isCamundaUserId`): the \"Created by\" filter lists Camundis, and the id of\n * a customer does not belong in a fleet-wide facet. Absent on an older\n * console-backend.\n */\n createdBy?: Record<string, number>\n}\n\n/** Cluster/owner resolution for a Zeebe client id (cross-backend org search). */\nexport interface ClusterByClientV2Dto {\n clusterId: string\n orgId: string\n}\n"],
5
5
  "mappings": "AAyUO,MAAM,8BAA8B;AAAA,EACzC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;",
6
6
  "names": []
7
7
  }
@@ -192,7 +192,7 @@ export interface DashboardDefinitionV2 {
192
192
  schemaVersion: 2;
193
193
  tiles: DashboardTileV2[];
194
194
  }
195
- /** A chart of a metric of HDP. accounts-backend runs the query. */
195
+ /** A chart of a metric of HDP. accounts-ng runs the query. */
196
196
  export interface DashboardChartTileV3 extends DashboardTileBaseV1 {
197
197
  kind: 'chart';
198
198
  query: DashboardChartQuery;
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/dtos/Dashboard.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\nimport type {\n ChartGrain,\n ChartSpec,\n ChartUnit,\n ChartWindowUnit,\n} from '../charts/chart-spec.js'\nimport type {\n SearchFieldCapability,\n SearchFieldType,\n} from '../search/fields.js'\nimport type { AnnotationEntityKind, AnnotationKind } from './Annotation.dto.js'\n\n/**\n * The wire types of the dashboards of Camunda Control.\n *\n * A dashboard stores QUESTIONS and never answers. A tile holds the filters of\n * the page that it came from, and the dashboard runs them again each time a\n * reader opens it. So a stored dashboard stays small, and it never holds a\n * copy of fleet data that can go stale or leak.\n *\n * control-backend and control-frontend both read this file, so it holds no\n * logic with I/O and no dependency.\n */\n\n/** DASHBOARD_TILES_MAX is the most tiles that one dashboard can hold. */\nexport const DASHBOARD_TILES_MAX = 20\n\n/** DASHBOARD_GRID_COLUMNS is the width of the tile grid, in columns. */\nexport const DASHBOARD_GRID_COLUMNS = 12\n\n/** DASHBOARD_TILE_ROWS_MAX is the tallest tile, in grid rows. */\nexport const DASHBOARD_TILE_ROWS_MAX = 24\n\n/**\n * DASHBOARD_GRID_ROWS_MAX is the lowest row that a tile can start on. It is\n * the height of 20 tiles of the tallest size, one under the other, so a\n * compact grid never reaches it.\n */\nexport const DASHBOARD_GRID_ROWS_MAX =\n DASHBOARD_TILES_MAX * DASHBOARD_TILE_ROWS_MAX\n\n/** DASHBOARD_TITLE_MAX is the longest title of a dashboard or of a tile. */\nexport const DASHBOARD_TITLE_MAX = 120\n\n/**\n * DASHBOARD_DEFINITION_BYTES_MAX is the largest definition that the backend\n * stores, as JSON text. Twenty tiles of filters need a few kilobytes, so a\n * larger body is a client that tries to store data and not filters.\n */\nexport const DASHBOARD_DEFINITION_BYTES_MAX = 32_768\n\n/** DASHBOARD_PAGE_SIZE_MAX is the most dashboards that one list page holds. */\nexport const DASHBOARD_PAGE_SIZE_MAX = 200\n\n/** DASHBOARD_PAGE_SIZE_DEFAULT is the list page size when a caller sends none. */\nexport const DASHBOARD_PAGE_SIZE_DEFAULT = 200\n\n/**\n * DASHBOARD_DEFINITION_VERSION is the `schemaVersion` that this code writes.\n *\n * Raise it when the shape of the definition changes, add the old shape to\n * `StoredDashboardDefinition`, and teach `upgradeDashboardDefinition` to read\n * it. A row is never rewritten in place: it moves to the new version on its\n * next save.\n */\nexport const DASHBOARD_DEFINITION_VERSION = 3\n\n/**\n * Every kind of tile.\n *\n * `fleet-query` and `annotations` run saved filters. `cluster-detail` and\n * `org-detail` show one card of the page of one cluster or one organization.\n * `heading`, `note` and `link` hold text that a person wrote, and fetch\n * nothing. `chart` runs a chart query on HDP.\n */\nexport const DASHBOARD_TILE_KINDS = [\n 'fleet-query',\n 'annotations',\n 'cluster-detail',\n 'org-detail',\n 'heading',\n 'note',\n 'link',\n 'chart',\n] as const\n\nexport type DashboardTileKind = (typeof DASHBOARD_TILE_KINDS)[number]\n\n/** Where a tile sits on the grid, in columns and rows from the top left. */\nexport interface DashboardTileLayout {\n x: number\n y: number\n w: number\n h: number\n}\n\n/**\n * The search params of a Fleet query page, as that page writes them.\n *\n * The backend stores them as they are and checks only their shape: flat\n * values, no objects. The keys belong to the Fleet query page, so the\n * frontend validates them on read with the same function that validates the\n * URL. A tile with a key that this function drops does not run, because the\n * query would be wider than the one that was saved.\n */\nexport type DashboardFleetQuery = Record<\n string,\n string | number | boolean | string[]\n>\n\n/** The filters of the Notes & tags page. */\nexport interface DashboardAnnotationsQuery {\n kind?: AnnotationKind\n entityKind?: AnnotationEntityKind\n tag?: string\n q?: string\n}\n\n/**\n * The cards of the Overview tab of a cluster that a dashboard can show.\n *\n * The id names the card and never its content. The tile reads the cluster\n * again each time it is in view, so it shows the current state.\n */\nexport const DASHBOARD_CLUSTER_CARDS = [\n 'identity',\n 'component-status',\n 'datacenter',\n 'generation',\n 'plan',\n 'backup-encryption',\n 'settings-flags',\n 'external-idp',\n 'data-filters',\n 'auto-pause',\n 'change-history',\n 'disk-usage',\n] as const\n\nexport type DashboardClusterCard = (typeof DASHBOARD_CLUSTER_CARDS)[number]\n\n/** The cards of the Overview tab of an organization. */\nexport const DASHBOARD_ORG_CARDS = [\n 'summary',\n 'details',\n 'sales-plan',\n 'queued-operations',\n 'clusters',\n 'managed-llm',\n 'recent-activity',\n] as const\n\nexport type DashboardOrgCard = (typeof DASHBOARD_ORG_CARDS)[number]\n\n/**\n * DASHBOARD_ENTITY_ID_MAX was the longest cluster id or organization id of a\n * detail tile.\n *\n * @deprecated control-backend accepts only a GUID as the id of a detail\n * tile, and no code reads this constant. It stays for the consumers of the\n * published package.\n */\nexport const DASHBOARD_ENTITY_ID_MAX = 64\n\n/**\n * DASHBOARD_NOTE_MAX is the longest text of a note tile.\n *\n * Twenty full notes of ASCII text fit in `DASHBOARD_DEFINITION_BYTES_MAX`.\n * Text with characters of more than one UTF-8 byte can pass that limit first,\n * so the frontend measures the whole definition with\n * `dashboardDefinitionBytes` before it saves.\n */\nexport const DASHBOARD_NOTE_MAX = 1000\n\n/** DASHBOARD_LINK_URL_MAX is the longest address of a link tile. */\nexport const DASHBOARD_LINK_URL_MAX = 1000\n\n/**\n * How a chart tile draws its result. `stat` is one number with a sparkline.\n * Each render is a chart of `@camunda/design-system`, which has no area chart.\n */\nexport const DASHBOARD_CHART_RENDERS = [\n 'line',\n 'bar',\n 'stacked-bar',\n 'stat',\n] as const\n\nexport type DashboardChartRender = (typeof DASHBOARD_CHART_RENDERS)[number]\n\n/**\n * A chart query and how to draw it. The tile stores the structured spec and\n * not the text, so a later change of the grammar cannot break a stored tile.\n */\nexport interface DashboardChartQuery extends ChartSpec {\n render: DashboardChartRender\n}\n\n/** One card of one cluster. */\nexport interface DashboardClusterDetailQuery {\n clusterId: string\n card: DashboardClusterCard\n}\n\n/** One card of one organization. */\nexport interface DashboardOrgDetailQuery {\n orgId: string\n card: DashboardOrgCard\n}\n\ninterface DashboardTileBaseV1 {\n /** Unique in its dashboard. The client makes it. */\n id: string\n title: string\n layout: DashboardTileLayout\n}\n\nexport interface DashboardFleetQueryTileV1 extends DashboardTileBaseV1 {\n kind: 'fleet-query'\n query: DashboardFleetQuery\n}\n\nexport interface DashboardAnnotationsTileV1 extends DashboardTileBaseV1 {\n kind: 'annotations'\n query: DashboardAnnotationsQuery\n}\n\nexport type DashboardTileV1 =\n | DashboardFleetQueryTileV1\n | DashboardAnnotationsTileV1\n\nexport interface DashboardDefinitionV1 {\n schemaVersion: 1\n tiles: DashboardTileV1[]\n}\n\nexport interface DashboardClusterDetailTileV2 extends DashboardTileBaseV1 {\n kind: 'cluster-detail'\n query: DashboardClusterDetailQuery\n}\n\nexport interface DashboardOrgDetailTileV2 extends DashboardTileBaseV1 {\n kind: 'org-detail'\n query: DashboardOrgDetailQuery\n}\n\n/** A section title. The `title` of the tile is the text. */\nexport interface DashboardHeadingTileV2 extends DashboardTileBaseV1 {\n kind: 'heading'\n}\n\n/** Plain text. Line breaks stay, and nothing in it is markup. */\nexport interface DashboardNoteTileV2 extends DashboardTileBaseV1 {\n kind: 'note'\n body: string\n}\n\n/**\n * A link to a page of Control (a path that starts with `/`) or to an\n * `https://` address. `isSafeDashboardLink` holds the rule.\n */\nexport interface DashboardLinkTileV2 extends DashboardTileBaseV1 {\n kind: 'link'\n url: string\n}\n\n/**\n * Version 2 adds kinds of tiles and changes no tile of version 1. A version 1\n * row is a version 2 row with a lower number, so an upgrade only sets the\n * number.\n *\n * The number moved because the kinds are new. A pod with version 1 code\n * answers `unsupportedVersion` for a row with a new kind, and not a 500 from\n * its serializer. A row with no new kind stays version 1, so that pod still\n * reads it (`toStoredDashboardDefinition`).\n */\nexport type DashboardTileV2 =\n | DashboardTileV1\n | DashboardClusterDetailTileV2\n | DashboardOrgDetailTileV2\n | DashboardHeadingTileV2\n | DashboardNoteTileV2\n | DashboardLinkTileV2\n\nexport interface DashboardDefinitionV2 {\n schemaVersion: 2\n tiles: DashboardTileV2[]\n}\n\n/** A chart of a metric of HDP. accounts-backend runs the query. */\nexport interface DashboardChartTileV3 extends DashboardTileBaseV1 {\n kind: 'chart'\n query: DashboardChartQuery\n}\n\n/**\n * Version 3 adds the `chart` kind and changes no tile of version 2, for the\n * same reason that version 2 moved the number. A row with no chart tile stays\n * at version 1 or 2 (`toStoredDashboardDefinition`).\n */\nexport type DashboardTileV3 = DashboardTileV2 | DashboardChartTileV3\n\nexport interface DashboardDefinitionV3 {\n schemaVersion: 3\n tiles: DashboardTileV3[]\n}\n\n/**\n * Every shape that a row can hold. A row keeps its old shape until somebody\n * saves the dashboard again.\n */\nexport type StoredDashboardDefinition =\n | DashboardDefinitionV1\n | DashboardDefinitionV2\n | DashboardDefinitionV3\n\n/** The current shape. Every DTO carries this one. */\nexport type DashboardDefinition = DashboardDefinitionV3\nexport type DashboardTile = DashboardTileV3\nexport type DashboardFleetQueryTile = DashboardFleetQueryTileV1\nexport type DashboardAnnotationsTile = DashboardAnnotationsTileV1\nexport type DashboardClusterDetailTile = DashboardClusterDetailTileV2\nexport type DashboardOrgDetailTile = DashboardOrgDetailTileV2\nexport type DashboardHeadingTile = DashboardHeadingTileV2\nexport type DashboardNoteTile = DashboardNoteTileV2\nexport type DashboardLinkTile = DashboardLinkTileV2\nexport type DashboardChartTile = DashboardChartTileV3\n\n/**\n * `Omit` on a union merges its members into one shape. This one omits from\n * each member, so the kinds stay apart.\n */\ntype OmitEach<T, K extends PropertyKey> = T extends unknown ? Omit<T, K> : never\n\n/** A tile as a client adds it to a dashboard. The backend places it. */\nexport type DashboardNewTile = OmitEach<DashboardTile, 'layout'>\n\n/** Who created or archived a dashboard. The same shape as `ApprovalActor`. */\nexport interface DashboardActor {\n userId: string\n email: string\n}\n\n/**\n * One dashboard in a list, without its tiles.\n *\n * The sidebar reads a list of these, so it never parses a definition.\n */\nexport interface DashboardSummaryDto {\n id: string\n title: string\n tileCount: number\n createdBy: DashboardActor\n createdAt: string\n updatedAt: string\n /** Set when the dashboard is archived. An archived dashboard is read-only. */\n archivedAt?: string\n archivedBy?: DashboardActor\n /** True when the CALLER pinned it. A pin is personal. */\n pinned: boolean\n}\n\nexport interface DashboardDto extends DashboardSummaryDto {\n definition: DashboardDefinition\n /**\n * The version that the optimistic lock of a save compares. Send back the\n * value of the read that the edit started from.\n */\n version: number\n}\n\nexport interface DashboardListDto {\n dashboards: DashboardSummaryDto[]\n page: { limit: number; offset: number; hasMore: boolean }\n}\n\n/** One Lucene field that a search or a chart filter can use. */\nexport interface DashboardCatalogueSearchField {\n field: string\n label: string\n description: string\n type: SearchFieldType\n capabilities: SearchFieldCapability[]\n enumValues?: string[]\n example: string\n}\n\n/** One metric of the chart tiles, without its SQL. */\nexport interface DashboardCatalogueChartMetric {\n id: string\n label: string\n description: string\n unit: ChartUnit\n dimensions: { id: string; label: string; description: string }[]\n filters: DashboardCatalogueSearchField[]\n grains: ChartGrain[]\n maxWindowDays: number\n}\n\n/**\n * What a client must know to write a dashboard definition: the kinds of tiles,\n * the cards, the chart metrics and the limits. The answer of\n * `GET /api/dashboards/catalogue`.\n */\nexport interface DashboardCatalogue {\n definitionVersion: number\n limits: {\n tiles: number\n gridColumns: number\n tileRowsMax: number\n titleMax: number\n noteMax: number\n linkUrlMax: number\n definitionBytesMax: number\n }\n tileKinds: { kind: DashboardTileKind; description: string }[]\n clusterCards: DashboardClusterCard[]\n orgCards: DashboardOrgCard[]\n fleetSearchFields: {\n cluster: DashboardCatalogueSearchField[]\n org: DashboardCatalogueSearchField[]\n }\n charts: {\n /** False where the flag `control.dashboardCharts` is off. */\n enabled: boolean\n grammar: string\n queryMaxLength: number\n renders: DashboardChartRender[]\n grains: ChartGrain[]\n windowUnits: ChartWindowUnit[]\n defaults: {\n grain: ChartGrain\n window: { amount: number; unit: ChartWindowUnit }\n top: number\n }\n topMax: number\n metrics: DashboardCatalogueChartMetric[]\n }\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\nimport type {\n ChartGrain,\n ChartSpec,\n ChartUnit,\n ChartWindowUnit,\n} from '../charts/chart-spec.js'\nimport type {\n SearchFieldCapability,\n SearchFieldType,\n} from '../search/fields.js'\nimport type { AnnotationEntityKind, AnnotationKind } from './Annotation.dto.js'\n\n/**\n * The wire types of the dashboards of Camunda Control.\n *\n * A dashboard stores QUESTIONS and never answers. A tile holds the filters of\n * the page that it came from, and the dashboard runs them again each time a\n * reader opens it. So a stored dashboard stays small, and it never holds a\n * copy of fleet data that can go stale or leak.\n *\n * control-backend and control-frontend both read this file, so it holds no\n * logic with I/O and no dependency.\n */\n\n/** DASHBOARD_TILES_MAX is the most tiles that one dashboard can hold. */\nexport const DASHBOARD_TILES_MAX = 20\n\n/** DASHBOARD_GRID_COLUMNS is the width of the tile grid, in columns. */\nexport const DASHBOARD_GRID_COLUMNS = 12\n\n/** DASHBOARD_TILE_ROWS_MAX is the tallest tile, in grid rows. */\nexport const DASHBOARD_TILE_ROWS_MAX = 24\n\n/**\n * DASHBOARD_GRID_ROWS_MAX is the lowest row that a tile can start on. It is\n * the height of 20 tiles of the tallest size, one under the other, so a\n * compact grid never reaches it.\n */\nexport const DASHBOARD_GRID_ROWS_MAX =\n DASHBOARD_TILES_MAX * DASHBOARD_TILE_ROWS_MAX\n\n/** DASHBOARD_TITLE_MAX is the longest title of a dashboard or of a tile. */\nexport const DASHBOARD_TITLE_MAX = 120\n\n/**\n * DASHBOARD_DEFINITION_BYTES_MAX is the largest definition that the backend\n * stores, as JSON text. Twenty tiles of filters need a few kilobytes, so a\n * larger body is a client that tries to store data and not filters.\n */\nexport const DASHBOARD_DEFINITION_BYTES_MAX = 32_768\n\n/** DASHBOARD_PAGE_SIZE_MAX is the most dashboards that one list page holds. */\nexport const DASHBOARD_PAGE_SIZE_MAX = 200\n\n/** DASHBOARD_PAGE_SIZE_DEFAULT is the list page size when a caller sends none. */\nexport const DASHBOARD_PAGE_SIZE_DEFAULT = 200\n\n/**\n * DASHBOARD_DEFINITION_VERSION is the `schemaVersion` that this code writes.\n *\n * Raise it when the shape of the definition changes, add the old shape to\n * `StoredDashboardDefinition`, and teach `upgradeDashboardDefinition` to read\n * it. A row is never rewritten in place: it moves to the new version on its\n * next save.\n */\nexport const DASHBOARD_DEFINITION_VERSION = 3\n\n/**\n * Every kind of tile.\n *\n * `fleet-query` and `annotations` run saved filters. `cluster-detail` and\n * `org-detail` show one card of the page of one cluster or one organization.\n * `heading`, `note` and `link` hold text that a person wrote, and fetch\n * nothing. `chart` runs a chart query on HDP.\n */\nexport const DASHBOARD_TILE_KINDS = [\n 'fleet-query',\n 'annotations',\n 'cluster-detail',\n 'org-detail',\n 'heading',\n 'note',\n 'link',\n 'chart',\n] as const\n\nexport type DashboardTileKind = (typeof DASHBOARD_TILE_KINDS)[number]\n\n/** Where a tile sits on the grid, in columns and rows from the top left. */\nexport interface DashboardTileLayout {\n x: number\n y: number\n w: number\n h: number\n}\n\n/**\n * The search params of a Fleet query page, as that page writes them.\n *\n * The backend stores them as they are and checks only their shape: flat\n * values, no objects. The keys belong to the Fleet query page, so the\n * frontend validates them on read with the same function that validates the\n * URL. A tile with a key that this function drops does not run, because the\n * query would be wider than the one that was saved.\n */\nexport type DashboardFleetQuery = Record<\n string,\n string | number | boolean | string[]\n>\n\n/** The filters of the Notes & tags page. */\nexport interface DashboardAnnotationsQuery {\n kind?: AnnotationKind\n entityKind?: AnnotationEntityKind\n tag?: string\n q?: string\n}\n\n/**\n * The cards of the Overview tab of a cluster that a dashboard can show.\n *\n * The id names the card and never its content. The tile reads the cluster\n * again each time it is in view, so it shows the current state.\n */\nexport const DASHBOARD_CLUSTER_CARDS = [\n 'identity',\n 'component-status',\n 'datacenter',\n 'generation',\n 'plan',\n 'backup-encryption',\n 'settings-flags',\n 'external-idp',\n 'data-filters',\n 'auto-pause',\n 'change-history',\n 'disk-usage',\n] as const\n\nexport type DashboardClusterCard = (typeof DASHBOARD_CLUSTER_CARDS)[number]\n\n/** The cards of the Overview tab of an organization. */\nexport const DASHBOARD_ORG_CARDS = [\n 'summary',\n 'details',\n 'sales-plan',\n 'queued-operations',\n 'clusters',\n 'managed-llm',\n 'recent-activity',\n] as const\n\nexport type DashboardOrgCard = (typeof DASHBOARD_ORG_CARDS)[number]\n\n/**\n * DASHBOARD_ENTITY_ID_MAX was the longest cluster id or organization id of a\n * detail tile.\n *\n * @deprecated control-backend accepts only a GUID as the id of a detail\n * tile, and no code reads this constant. It stays for the consumers of the\n * published package.\n */\nexport const DASHBOARD_ENTITY_ID_MAX = 64\n\n/**\n * DASHBOARD_NOTE_MAX is the longest text of a note tile.\n *\n * Twenty full notes of ASCII text fit in `DASHBOARD_DEFINITION_BYTES_MAX`.\n * Text with characters of more than one UTF-8 byte can pass that limit first,\n * so the frontend measures the whole definition with\n * `dashboardDefinitionBytes` before it saves.\n */\nexport const DASHBOARD_NOTE_MAX = 1000\n\n/** DASHBOARD_LINK_URL_MAX is the longest address of a link tile. */\nexport const DASHBOARD_LINK_URL_MAX = 1000\n\n/**\n * How a chart tile draws its result. `stat` is one number with a sparkline.\n * Each render is a chart of `@camunda/design-system`, which has no area chart.\n */\nexport const DASHBOARD_CHART_RENDERS = [\n 'line',\n 'bar',\n 'stacked-bar',\n 'stat',\n] as const\n\nexport type DashboardChartRender = (typeof DASHBOARD_CHART_RENDERS)[number]\n\n/**\n * A chart query and how to draw it. The tile stores the structured spec and\n * not the text, so a later change of the grammar cannot break a stored tile.\n */\nexport interface DashboardChartQuery extends ChartSpec {\n render: DashboardChartRender\n}\n\n/** One card of one cluster. */\nexport interface DashboardClusterDetailQuery {\n clusterId: string\n card: DashboardClusterCard\n}\n\n/** One card of one organization. */\nexport interface DashboardOrgDetailQuery {\n orgId: string\n card: DashboardOrgCard\n}\n\ninterface DashboardTileBaseV1 {\n /** Unique in its dashboard. The client makes it. */\n id: string\n title: string\n layout: DashboardTileLayout\n}\n\nexport interface DashboardFleetQueryTileV1 extends DashboardTileBaseV1 {\n kind: 'fleet-query'\n query: DashboardFleetQuery\n}\n\nexport interface DashboardAnnotationsTileV1 extends DashboardTileBaseV1 {\n kind: 'annotations'\n query: DashboardAnnotationsQuery\n}\n\nexport type DashboardTileV1 =\n | DashboardFleetQueryTileV1\n | DashboardAnnotationsTileV1\n\nexport interface DashboardDefinitionV1 {\n schemaVersion: 1\n tiles: DashboardTileV1[]\n}\n\nexport interface DashboardClusterDetailTileV2 extends DashboardTileBaseV1 {\n kind: 'cluster-detail'\n query: DashboardClusterDetailQuery\n}\n\nexport interface DashboardOrgDetailTileV2 extends DashboardTileBaseV1 {\n kind: 'org-detail'\n query: DashboardOrgDetailQuery\n}\n\n/** A section title. The `title` of the tile is the text. */\nexport interface DashboardHeadingTileV2 extends DashboardTileBaseV1 {\n kind: 'heading'\n}\n\n/** Plain text. Line breaks stay, and nothing in it is markup. */\nexport interface DashboardNoteTileV2 extends DashboardTileBaseV1 {\n kind: 'note'\n body: string\n}\n\n/**\n * A link to a page of Control (a path that starts with `/`) or to an\n * `https://` address. `isSafeDashboardLink` holds the rule.\n */\nexport interface DashboardLinkTileV2 extends DashboardTileBaseV1 {\n kind: 'link'\n url: string\n}\n\n/**\n * Version 2 adds kinds of tiles and changes no tile of version 1. A version 1\n * row is a version 2 row with a lower number, so an upgrade only sets the\n * number.\n *\n * The number moved because the kinds are new. A pod with version 1 code\n * answers `unsupportedVersion` for a row with a new kind, and not a 500 from\n * its serializer. A row with no new kind stays version 1, so that pod still\n * reads it (`toStoredDashboardDefinition`).\n */\nexport type DashboardTileV2 =\n | DashboardTileV1\n | DashboardClusterDetailTileV2\n | DashboardOrgDetailTileV2\n | DashboardHeadingTileV2\n | DashboardNoteTileV2\n | DashboardLinkTileV2\n\nexport interface DashboardDefinitionV2 {\n schemaVersion: 2\n tiles: DashboardTileV2[]\n}\n\n/** A chart of a metric of HDP. accounts-ng runs the query. */\nexport interface DashboardChartTileV3 extends DashboardTileBaseV1 {\n kind: 'chart'\n query: DashboardChartQuery\n}\n\n/**\n * Version 3 adds the `chart` kind and changes no tile of version 2, for the\n * same reason that version 2 moved the number. A row with no chart tile stays\n * at version 1 or 2 (`toStoredDashboardDefinition`).\n */\nexport type DashboardTileV3 = DashboardTileV2 | DashboardChartTileV3\n\nexport interface DashboardDefinitionV3 {\n schemaVersion: 3\n tiles: DashboardTileV3[]\n}\n\n/**\n * Every shape that a row can hold. A row keeps its old shape until somebody\n * saves the dashboard again.\n */\nexport type StoredDashboardDefinition =\n | DashboardDefinitionV1\n | DashboardDefinitionV2\n | DashboardDefinitionV3\n\n/** The current shape. Every DTO carries this one. */\nexport type DashboardDefinition = DashboardDefinitionV3\nexport type DashboardTile = DashboardTileV3\nexport type DashboardFleetQueryTile = DashboardFleetQueryTileV1\nexport type DashboardAnnotationsTile = DashboardAnnotationsTileV1\nexport type DashboardClusterDetailTile = DashboardClusterDetailTileV2\nexport type DashboardOrgDetailTile = DashboardOrgDetailTileV2\nexport type DashboardHeadingTile = DashboardHeadingTileV2\nexport type DashboardNoteTile = DashboardNoteTileV2\nexport type DashboardLinkTile = DashboardLinkTileV2\nexport type DashboardChartTile = DashboardChartTileV3\n\n/**\n * `Omit` on a union merges its members into one shape. This one omits from\n * each member, so the kinds stay apart.\n */\ntype OmitEach<T, K extends PropertyKey> = T extends unknown ? Omit<T, K> : never\n\n/** A tile as a client adds it to a dashboard. The backend places it. */\nexport type DashboardNewTile = OmitEach<DashboardTile, 'layout'>\n\n/** Who created or archived a dashboard. The same shape as `ApprovalActor`. */\nexport interface DashboardActor {\n userId: string\n email: string\n}\n\n/**\n * One dashboard in a list, without its tiles.\n *\n * The sidebar reads a list of these, so it never parses a definition.\n */\nexport interface DashboardSummaryDto {\n id: string\n title: string\n tileCount: number\n createdBy: DashboardActor\n createdAt: string\n updatedAt: string\n /** Set when the dashboard is archived. An archived dashboard is read-only. */\n archivedAt?: string\n archivedBy?: DashboardActor\n /** True when the CALLER pinned it. A pin is personal. */\n pinned: boolean\n}\n\nexport interface DashboardDto extends DashboardSummaryDto {\n definition: DashboardDefinition\n /**\n * The version that the optimistic lock of a save compares. Send back the\n * value of the read that the edit started from.\n */\n version: number\n}\n\nexport interface DashboardListDto {\n dashboards: DashboardSummaryDto[]\n page: { limit: number; offset: number; hasMore: boolean }\n}\n\n/** One Lucene field that a search or a chart filter can use. */\nexport interface DashboardCatalogueSearchField {\n field: string\n label: string\n description: string\n type: SearchFieldType\n capabilities: SearchFieldCapability[]\n enumValues?: string[]\n example: string\n}\n\n/** One metric of the chart tiles, without its SQL. */\nexport interface DashboardCatalogueChartMetric {\n id: string\n label: string\n description: string\n unit: ChartUnit\n dimensions: { id: string; label: string; description: string }[]\n filters: DashboardCatalogueSearchField[]\n grains: ChartGrain[]\n maxWindowDays: number\n}\n\n/**\n * What a client must know to write a dashboard definition: the kinds of tiles,\n * the cards, the chart metrics and the limits. The answer of\n * `GET /api/dashboards/catalogue`.\n */\nexport interface DashboardCatalogue {\n definitionVersion: number\n limits: {\n tiles: number\n gridColumns: number\n tileRowsMax: number\n titleMax: number\n noteMax: number\n linkUrlMax: number\n definitionBytesMax: number\n }\n tileKinds: { kind: DashboardTileKind; description: string }[]\n clusterCards: DashboardClusterCard[]\n orgCards: DashboardOrgCard[]\n fleetSearchFields: {\n cluster: DashboardCatalogueSearchField[]\n org: DashboardCatalogueSearchField[]\n }\n charts: {\n /** False where the flag `control.dashboardCharts` is off. */\n enabled: boolean\n grammar: string\n queryMaxLength: number\n renders: DashboardChartRender[]\n grains: ChartGrain[]\n windowUnits: ChartWindowUnit[]\n defaults: {\n grain: ChartGrain\n window: { amount: number; unit: ChartWindowUnit }\n top: number\n }\n topMax: number\n metrics: DashboardCatalogueChartMetric[]\n }\n}\n"],
5
5
  "mappings": "AA+BO,MAAM,sBAAsB;AAG5B,MAAM,yBAAyB;AAG/B,MAAM,0BAA0B;AAOhC,MAAM,0BACX,sBAAsB;AAGjB,MAAM,sBAAsB;AAO5B,MAAM,iCAAiC;AAGvC,MAAM,0BAA0B;AAGhC,MAAM,8BAA8B;AAUpC,MAAM,+BAA+B;AAUrC,MAAM,uBAAuB;AAAA,EAClC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAwCO,MAAM,0BAA0B;AAAA,EACrC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAKO,MAAM,sBAAsB;AAAA,EACjC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAYO,MAAM,0BAA0B;AAUhC,MAAM,qBAAqB;AAG3B,MAAM,yBAAyB;AAM/B,MAAM,0BAA0B;AAAA,EACrC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;",
6
6
  "names": []
7
7
  }
@@ -62,7 +62,7 @@ export interface ExternalOrganizationDto {
62
62
  * Clickwrap config as returned by `GET external/clickwrap-config`.
63
63
  *
64
64
  * Names the PactSafe group that records a customer's opt-in to alpha features.
65
- * The deployed accounts-backend owns the identifiers, thus a host does not hold
65
+ * The deployed accounts-ng owns the identifiers, thus a host does not hold
66
66
  * a copy. Each field is optional: the backend omits it when its environment
67
67
  * variable is unset, and a host with no `accessId` shows no opt-in.
68
68
  */
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * The flags of one caller, as `GET /api/feature-flags/evaluate` of
3
- * control-backend and `GET external/feature-flags` of accounts-backend send
3
+ * control-backend and `GET external/feature-flags` of accounts-ng send
4
4
  * them. Nested by the segments of the key: `console.myFeature` is
5
5
  * `{ console: { myFeature: true } }`.
6
6
  *
@@ -107,7 +107,7 @@ export interface FeatureFlagListDto {
107
107
  tableVersion: number;
108
108
  /**
109
109
  * The version that the Redis key holds, which console-backend and
110
- * accounts-backend read. Absent on a stage with no Redis, and when
110
+ * accounts-ng read. Absent on a stage with no Redis, and when
111
111
  * control-backend cannot read the key. While it is lower than
112
112
  * `tableVersion`, those services still answer from the rows before.
113
113
  */
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/dtos/FeatureFlags.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 flags of one caller, as `GET /api/feature-flags/evaluate` of\n * control-backend and `GET external/feature-flags` of accounts-backend send\n * them. Nested by the segments of the key: `console.myFeature` is\n * `{ console: { myFeature: true } }`.\n *\n * The keys are not typed. The flag table of each stage holds them, and a key\n * that the table does not hold is not in the answer. A reader takes one flag\n * by its key and reads a missing one as off: `isFeatureOn` of\n * `@camunda-cloud/featureflags`, or `useC4FeatureFlag('console.myFeature')` in\n * c4.\n */\nexport interface FeatureFlagAnswer {\n [segment: string]: boolean | FeatureFlagAnswer\n}\n\n/**\n * The kinds of a row.\n *\n * - `feature`: the flag turns a feature ON. Most rows are of this kind.\n * - `kill-switch`: the flag turns an action OFF while it is on, for example\n * `accounts.signupBlocked`. Its key ends in `Blocked`, and it has no\n * `expiresAt`, because it stays for the next incident. Its lists work as\n * the lists of a feature: a switch that is off and holds an org blocks the\n * action only for that org.\n */\nexport const FEATURE_FLAG_KINDS = ['feature', 'kill-switch'] as const\n\nexport type FeatureFlagKind = (typeof FEATURE_FLAG_KINDS)[number]\n\n/** The last segment of the key of a kill switch ends in this word. */\nexport const KILL_SWITCH_KEY_SUFFIX = 'Blocked'\n\n/**\n * Why a row cannot be a kill switch, or `undefined` when it can. The backend\n * refuses such a write, and the page shows the same rule.\n */\nexport function killSwitchProblem(row: {\n key: string\n expiresAt?: string\n}): 'key-suffix' | 'expires-at' | undefined {\n if (!row.key.endsWith(KILL_SWITCH_KEY_SUFFIX)) {\n return 'key-suffix'\n }\n if (row.expiresAt) {\n return 'expires-at'\n }\n return undefined\n}\n\n/**\n * The state of a kill switch in words: `Blocking everybody`, `Blocking 1 org,\n * 2 domains`, or `Open`. The kill switches page and the summary of an engage\n * request show it.\n */\nexport function killSwitchStateText(row: {\n enabled: boolean\n orgIds: string[]\n emailDomains: string[]\n salesPlanIds?: string[]\n}): string {\n if (row.enabled) {\n return 'Blocking everybody'\n }\n const parts = [\n countOf(row.orgIds.length, 'org'),\n countOf(row.emailDomains.length, 'domain'),\n countOf(row.salesPlanIds?.length ?? 0, 'sales plan'),\n ].filter((part) => part !== undefined)\n return parts.length === 0 ? 'Open' : `Blocking ${parts.join(', ')}`\n}\n\nconst countOf = (count: number, noun: string) =>\n count === 0 ? undefined : `${count} ${noun}${count === 1 ? '' : 's'}`\n\n/**\n * One feature flag, as a row of the table of control-backend.\n *\n * Each stage holds its own database, thus a row is the value of THAT stage. A\n * flag is on for a caller when `enabled` is true, when the org of the caller\n * is in `orgIds`, when the domain of the email of the caller is in\n * `emailDomains`, or when the sales plan of the org of the caller is in\n * `salesPlanIds`. `evaluateFlags` of `@camunda-cloud/featureflags` holds that\n * rule.\n */\nexport interface FeatureFlagDto {\n id: string\n /** The dot path, for example `console.myFeature`. It cannot change. */\n key: string\n /** `feature` or `kill-switch`. See `FEATURE_FLAG_KINDS`. */\n kind: FeatureFlagKind\n /** Why the flag exists. */\n description: string\n /** The value for everybody. */\n enabled: boolean\n /** Organizations that get the flag when `enabled` is false. */\n orgIds: string[]\n /** Lower-case email domains, with no `@`. */\n emailDomains: string[]\n /** Ids of `SalesPlan` rows. Orgs on these sales plans get the flag. */\n salesPlanIds: string[]\n /**\n * The team that owns the flag, for example `team-console`. Absent on an\n * older row that nobody gave an owner.\n */\n owner?: string\n /**\n * The day after which the flag is late, as `YYYY-MM-DD`. The page warns\n * from that day on. Absent for a flag that has no end, such as a permission.\n */\n expiresAt?: string\n /**\n * The issue that tracks the flag, as an `http` or `https` URL. Absent on an\n * older row. A write of a row without one must give one.\n */\n issueUrl?: string\n createdAt: string\n /**\n * The email of the person who made the row, or the name of the seed\n * migration. `UNKNOWN_ACTOR_EMAIL` for a token with no email.\n */\n createdBy: string\n updatedAt: string\n /** The email of the person who changed the row last, as `createdBy`. */\n updatedBy: string\n}\n\n/**\n * The answer of `GET /api/feature-flags`: every row of the stage, and the two\n * versions that show whether the other services read the rows yet.\n */\nexport interface FeatureFlagListDto {\n flags: FeatureFlagDto[]\n /** The version of the table. Every write raises it. */\n tableVersion: number\n /**\n * The version that the Redis key holds, which console-backend and\n * accounts-backend read. Absent on a stage with no Redis, and when\n * control-backend cannot read the key. While it is lower than\n * `tableVersion`, those services still answer from the rows before.\n */\n publishedVersion?: number\n}\n\n/** What a create sends. The key cannot change after this. */\nexport interface CreateFeatureFlagDto {\n key: string\n /** Absent means `feature`. */\n kind?: FeatureFlagKind\n description: string\n enabled: boolean\n orgIds: string[]\n emailDomains: string[]\n /** Absent means no sales plan. */\n salesPlanIds?: string[]\n /** Required for a new flag: a flag with no owner is a flag nobody removes. */\n owner: string\n /** `YYYY-MM-DD`. Give it for a flag that gates a rollout. */\n expiresAt?: string\n /** Required for a new flag: the issue that tracks the flag. */\n issueUrl: string\n}\n\ntype EditableFeatureFlagFields = Omit<CreateFeatureFlagDto, 'key'>\n\n/**\n * What an edit sends: at least one field. A field that is absent stays as it\n * is. The route answers 400 to an empty body, and to an edit of a row with no\n * `issueUrl` that does not give one.\n */\nexport type UpdateFeatureFlagDto = {\n [Field in keyof EditableFeatureFlagFields]: Pick<\n EditableFeatureFlagFields,\n Field\n > &\n Partial<EditableFeatureFlagFields>\n}[keyof EditableFeatureFlagFields]\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 flags of one caller, as `GET /api/feature-flags/evaluate` of\n * control-backend and `GET external/feature-flags` of accounts-ng send\n * them. Nested by the segments of the key: `console.myFeature` is\n * `{ console: { myFeature: true } }`.\n *\n * The keys are not typed. The flag table of each stage holds them, and a key\n * that the table does not hold is not in the answer. A reader takes one flag\n * by its key and reads a missing one as off: `isFeatureOn` of\n * `@camunda-cloud/featureflags`, or `useC4FeatureFlag('console.myFeature')` in\n * c4.\n */\nexport interface FeatureFlagAnswer {\n [segment: string]: boolean | FeatureFlagAnswer\n}\n\n/**\n * The kinds of a row.\n *\n * - `feature`: the flag turns a feature ON. Most rows are of this kind.\n * - `kill-switch`: the flag turns an action OFF while it is on, for example\n * `accounts.signupBlocked`. Its key ends in `Blocked`, and it has no\n * `expiresAt`, because it stays for the next incident. Its lists work as\n * the lists of a feature: a switch that is off and holds an org blocks the\n * action only for that org.\n */\nexport const FEATURE_FLAG_KINDS = ['feature', 'kill-switch'] as const\n\nexport type FeatureFlagKind = (typeof FEATURE_FLAG_KINDS)[number]\n\n/** The last segment of the key of a kill switch ends in this word. */\nexport const KILL_SWITCH_KEY_SUFFIX = 'Blocked'\n\n/**\n * Why a row cannot be a kill switch, or `undefined` when it can. The backend\n * refuses such a write, and the page shows the same rule.\n */\nexport function killSwitchProblem(row: {\n key: string\n expiresAt?: string\n}): 'key-suffix' | 'expires-at' | undefined {\n if (!row.key.endsWith(KILL_SWITCH_KEY_SUFFIX)) {\n return 'key-suffix'\n }\n if (row.expiresAt) {\n return 'expires-at'\n }\n return undefined\n}\n\n/**\n * The state of a kill switch in words: `Blocking everybody`, `Blocking 1 org,\n * 2 domains`, or `Open`. The kill switches page and the summary of an engage\n * request show it.\n */\nexport function killSwitchStateText(row: {\n enabled: boolean\n orgIds: string[]\n emailDomains: string[]\n salesPlanIds?: string[]\n}): string {\n if (row.enabled) {\n return 'Blocking everybody'\n }\n const parts = [\n countOf(row.orgIds.length, 'org'),\n countOf(row.emailDomains.length, 'domain'),\n countOf(row.salesPlanIds?.length ?? 0, 'sales plan'),\n ].filter((part) => part !== undefined)\n return parts.length === 0 ? 'Open' : `Blocking ${parts.join(', ')}`\n}\n\nconst countOf = (count: number, noun: string) =>\n count === 0 ? undefined : `${count} ${noun}${count === 1 ? '' : 's'}`\n\n/**\n * One feature flag, as a row of the table of control-backend.\n *\n * Each stage holds its own database, thus a row is the value of THAT stage. A\n * flag is on for a caller when `enabled` is true, when the org of the caller\n * is in `orgIds`, when the domain of the email of the caller is in\n * `emailDomains`, or when the sales plan of the org of the caller is in\n * `salesPlanIds`. `evaluateFlags` of `@camunda-cloud/featureflags` holds that\n * rule.\n */\nexport interface FeatureFlagDto {\n id: string\n /** The dot path, for example `console.myFeature`. It cannot change. */\n key: string\n /** `feature` or `kill-switch`. See `FEATURE_FLAG_KINDS`. */\n kind: FeatureFlagKind\n /** Why the flag exists. */\n description: string\n /** The value for everybody. */\n enabled: boolean\n /** Organizations that get the flag when `enabled` is false. */\n orgIds: string[]\n /** Lower-case email domains, with no `@`. */\n emailDomains: string[]\n /** Ids of `SalesPlan` rows. Orgs on these sales plans get the flag. */\n salesPlanIds: string[]\n /**\n * The team that owns the flag, for example `team-console`. Absent on an\n * older row that nobody gave an owner.\n */\n owner?: string\n /**\n * The day after which the flag is late, as `YYYY-MM-DD`. The page warns\n * from that day on. Absent for a flag that has no end, such as a permission.\n */\n expiresAt?: string\n /**\n * The issue that tracks the flag, as an `http` or `https` URL. Absent on an\n * older row. A write of a row without one must give one.\n */\n issueUrl?: string\n createdAt: string\n /**\n * The email of the person who made the row, or the name of the seed\n * migration. `UNKNOWN_ACTOR_EMAIL` for a token with no email.\n */\n createdBy: string\n updatedAt: string\n /** The email of the person who changed the row last, as `createdBy`. */\n updatedBy: string\n}\n\n/**\n * The answer of `GET /api/feature-flags`: every row of the stage, and the two\n * versions that show whether the other services read the rows yet.\n */\nexport interface FeatureFlagListDto {\n flags: FeatureFlagDto[]\n /** The version of the table. Every write raises it. */\n tableVersion: number\n /**\n * The version that the Redis key holds, which console-backend and\n * accounts-ng read. Absent on a stage with no Redis, and when\n * control-backend cannot read the key. While it is lower than\n * `tableVersion`, those services still answer from the rows before.\n */\n publishedVersion?: number\n}\n\n/** What a create sends. The key cannot change after this. */\nexport interface CreateFeatureFlagDto {\n key: string\n /** Absent means `feature`. */\n kind?: FeatureFlagKind\n description: string\n enabled: boolean\n orgIds: string[]\n emailDomains: string[]\n /** Absent means no sales plan. */\n salesPlanIds?: string[]\n /** Required for a new flag: a flag with no owner is a flag nobody removes. */\n owner: string\n /** `YYYY-MM-DD`. Give it for a flag that gates a rollout. */\n expiresAt?: string\n /** Required for a new flag: the issue that tracks the flag. */\n issueUrl: string\n}\n\ntype EditableFeatureFlagFields = Omit<CreateFeatureFlagDto, 'key'>\n\n/**\n * What an edit sends: at least one field. A field that is absent stays as it\n * is. The route answers 400 to an empty body, and to an edit of a row with no\n * `issueUrl` that does not give one.\n */\nexport type UpdateFeatureFlagDto = {\n [Field in keyof EditableFeatureFlagFields]: Pick<\n EditableFeatureFlagFields,\n Field\n > &\n Partial<EditableFeatureFlagFields>\n}[keyof EditableFeatureFlagFields]\n"],
5
5
  "mappings": "AAgCO,MAAM,qBAAqB,CAAC,WAAW,aAAa;AAKpD,MAAM,yBAAyB;AAM/B,SAAS,kBAAkB,KAGU;AAC1C,MAAI,CAAC,IAAI,IAAI,SAAS,sBAAsB,GAAG;AAC7C,WAAO;AAAA,EACT;AACA,MAAI,IAAI,WAAW;AACjB,WAAO;AAAA,EACT;AACA,SAAO;AACT;AAOO,SAAS,oBAAoB,KAKzB;AACT,MAAI,IAAI,SAAS;AACf,WAAO;AAAA,EACT;AACA,QAAM,QAAQ;AAAA,IACZ,QAAQ,IAAI,OAAO,QAAQ,KAAK;AAAA,IAChC,QAAQ,IAAI,aAAa,QAAQ,QAAQ;AAAA,IACzC,QAAQ,IAAI,cAAc,UAAU,GAAG,YAAY;AAAA,EACrD,EAAE,OAAO,CAAC,SAAS,SAAS,MAAS;AACrC,SAAO,MAAM,WAAW,IAAI,SAAS,YAAY,MAAM,KAAK,IAAI,CAAC;AACnE;AAEA,MAAM,UAAU,CAAC,OAAe,SAC9B,UAAU,IAAI,SAAY,GAAG,KAAK,IAAI,IAAI,GAAG,UAAU,IAAI,KAAK,GAAG;",
6
6
  "names": []
7
7
  }