@camunda/ccma-api 2.1.0 → 2.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +12 -3
- package/dist/index.js +10 -0
- package/dist/index.js.map +2 -2
- package/dist/services/accounts/approvals.m2m.service.d.ts +33 -0
- package/dist/services/accounts/approvals.m2m.service.js +64 -0
- package/dist/services/accounts/approvals.m2m.service.js.map +7 -0
- package/dist/services/accounts/hdp.service.d.ts +28 -0
- package/dist/services/accounts/hdp.service.js +40 -0
- package/dist/services/accounts/hdp.service.js.map +2 -2
- package/dist/services/accounts/orgs.service.d.ts +6 -2
- package/dist/services/accounts/orgs.service.js +6 -2
- package/dist/services/accounts/orgs.service.js.map +2 -2
- package/dist/services/console/console.approvals.m2m.service.d.ts +47 -0
- package/dist/services/console/console.approvals.m2m.service.js +105 -0
- package/dist/services/console/console.approvals.m2m.service.js.map +7 -0
- package/dist/services/console/console.channel.service.d.ts +4 -2
- package/dist/services/console/console.channel.service.js.map +2 -2
- package/dist/services/console/console.cluster.service.d.ts +15 -0
- package/dist/services/console/console.cluster.service.js +40 -0
- package/dist/services/console/console.cluster.service.js.map +2 -2
- package/dist/services/console/console.cluster.v2.service.d.ts +11 -3
- package/dist/services/console/console.cluster.v2.service.js +37 -2
- package/dist/services/console/console.cluster.v2.service.js.map +2 -2
- package/dist/services/control/control.annotations.service.d.ts +149 -0
- package/dist/services/control/control.annotations.service.js +193 -0
- package/dist/services/control/control.annotations.service.js.map +7 -0
- package/dist/services/control/control.approvals.service.d.ts +130 -6
- package/dist/services/control/control.approvals.service.js +118 -13
- package/dist/services/control/control.approvals.service.js.map +2 -2
- package/dist/services/control/control.feature-flags.service.d.ts +13 -0
- package/dist/services/control/control.feature-flags.service.js +52 -0
- package/dist/services/control/control.feature-flags.service.js.map +7 -0
- package/dist/services/control/control.platform.service.d.ts +24 -0
- package/dist/services/control/control.platform.service.js +36 -0
- package/dist/services/control/control.platform.service.js.map +7 -0
- package/package.json +2 -2
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
import { request } from "../../utils/api.js";
|
|
2
|
+
import { HttpError } from "../../utils/errors.js";
|
|
3
|
+
const BASE = { id: "control" };
|
|
4
|
+
function contextFor(name, url, normalizedUrl, type, source) {
|
|
5
|
+
return {
|
|
6
|
+
method: {
|
|
7
|
+
name: `ControlAnnotationsService.${name}`,
|
|
8
|
+
url,
|
|
9
|
+
normalizedUrl,
|
|
10
|
+
type
|
|
11
|
+
},
|
|
12
|
+
source,
|
|
13
|
+
target: { name: "control", type: "internal" }
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
function queryOf(params = {}) {
|
|
17
|
+
const query = new URLSearchParams();
|
|
18
|
+
for (const [key, value] of Object.entries(params)) {
|
|
19
|
+
if (value !== void 0) {
|
|
20
|
+
query.set(key, String(value));
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
return query.size > 0 ? `?${query.toString()}` : "";
|
|
24
|
+
}
|
|
25
|
+
class ControlAnnotationsService {
|
|
26
|
+
/**
|
|
27
|
+
* Every live note and tag of one entity.
|
|
28
|
+
*
|
|
29
|
+
* An entity that carries nothing answers with two empty lists, and never
|
|
30
|
+
* 404. The call also answers for an entity that the fleet no longer holds,
|
|
31
|
+
* which is what keeps a link out of a search result working.
|
|
32
|
+
*/
|
|
33
|
+
static async forEntity(params) {
|
|
34
|
+
const url = `api/annotations${queryOf(params.params)}`;
|
|
35
|
+
return ControlAnnotationsService.send(
|
|
36
|
+
params,
|
|
37
|
+
"forEntity",
|
|
38
|
+
url,
|
|
39
|
+
"api/annotations",
|
|
40
|
+
"get"
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* The tags, the note count and the newest note of many entities.
|
|
45
|
+
*
|
|
46
|
+
* A POST, because thousands of ids do not fit a request line. The answer
|
|
47
|
+
* holds only the entities that carry something.
|
|
48
|
+
*/
|
|
49
|
+
static async lookup(params) {
|
|
50
|
+
return ControlAnnotationsService.send(
|
|
51
|
+
params,
|
|
52
|
+
"lookup",
|
|
53
|
+
"api/annotations/lookup",
|
|
54
|
+
"api/annotations/lookup",
|
|
55
|
+
"post",
|
|
56
|
+
params.params
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
/** Writes a note on an entity. Any signed-in Camundi can. */
|
|
60
|
+
static async addNote(params) {
|
|
61
|
+
const { annotation } = await ControlAnnotationsService.send(
|
|
62
|
+
params,
|
|
63
|
+
"addNote",
|
|
64
|
+
"api/annotations/notes",
|
|
65
|
+
"api/annotations/notes",
|
|
66
|
+
"post",
|
|
67
|
+
params.params
|
|
68
|
+
);
|
|
69
|
+
return annotation;
|
|
70
|
+
}
|
|
71
|
+
/** Changes the text of a note. Only the person who wrote it can. */
|
|
72
|
+
static async editNote(params) {
|
|
73
|
+
const url = `api/annotations/notes/${params.params.id}`;
|
|
74
|
+
const { annotation } = await ControlAnnotationsService.send(params, "editNote", url, "api/annotations/notes/:id", "patch", {
|
|
75
|
+
body: params.params.body,
|
|
76
|
+
version: params.params.version
|
|
77
|
+
});
|
|
78
|
+
return annotation;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Takes a note or a tag off an entity.
|
|
82
|
+
*
|
|
83
|
+
* The row stays: the removal is a soft delete, so who wrote it and who took
|
|
84
|
+
* it off both stay readable. A note can only be removed by its author; a tag
|
|
85
|
+
* can be removed by anybody.
|
|
86
|
+
*/
|
|
87
|
+
static async remove(params) {
|
|
88
|
+
const url = `api/annotations/${params.params.id}`;
|
|
89
|
+
await ControlAnnotationsService.send(
|
|
90
|
+
params,
|
|
91
|
+
"remove",
|
|
92
|
+
url,
|
|
93
|
+
"api/annotations/:id",
|
|
94
|
+
"delete"
|
|
95
|
+
);
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Attaches a tag to an entity, and adds it to the dictionary when it is new.
|
|
99
|
+
*
|
|
100
|
+
* The name is normalized by the backend, so `Partner` and `partner` reach
|
|
101
|
+
* one tag. A second attach of one tag on one entity answers 409.
|
|
102
|
+
*/
|
|
103
|
+
static async addTag(params) {
|
|
104
|
+
const { annotation } = await ControlAnnotationsService.send(
|
|
105
|
+
params,
|
|
106
|
+
"addTag",
|
|
107
|
+
"api/annotations/tags",
|
|
108
|
+
"api/annotations/tags",
|
|
109
|
+
"post",
|
|
110
|
+
params.params
|
|
111
|
+
);
|
|
112
|
+
return annotation;
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* The tag dictionary, with the live entities of each tag counted, most used
|
|
116
|
+
* first.
|
|
117
|
+
*
|
|
118
|
+
* The autocomplete of the tag field reads this. It is what stops one idea
|
|
119
|
+
* from becoming three spellings.
|
|
120
|
+
*
|
|
121
|
+
* It answers one PAGE, because the dictionary only grows. Read `page.hasMore`
|
|
122
|
+
* to learn whether another follows.
|
|
123
|
+
*/
|
|
124
|
+
static async listTags(params) {
|
|
125
|
+
const url = `api/annotations/tags${queryOf(params.params)}`;
|
|
126
|
+
return ControlAnnotationsService.send(
|
|
127
|
+
params,
|
|
128
|
+
"listTags",
|
|
129
|
+
url,
|
|
130
|
+
"api/annotations/tags",
|
|
131
|
+
"get"
|
|
132
|
+
);
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* One page of the annotations that match, newest first.
|
|
136
|
+
*
|
|
137
|
+
* The answer holds annotations of entities that no longer exist, which is
|
|
138
|
+
* the point: the note about a deleted cluster is often the only record of
|
|
139
|
+
* why it was there.
|
|
140
|
+
*/
|
|
141
|
+
static async search(params) {
|
|
142
|
+
const url = `api/annotations/search${queryOf(params.params)}`;
|
|
143
|
+
return ControlAnnotationsService.send(
|
|
144
|
+
params,
|
|
145
|
+
"search",
|
|
146
|
+
url,
|
|
147
|
+
"api/annotations/search",
|
|
148
|
+
"get"
|
|
149
|
+
);
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* The shared half of every call above.
|
|
153
|
+
*
|
|
154
|
+
* Seven routes differ only in the verb, the path and the body. One private
|
|
155
|
+
* helper keeps the metrics context and the status check in one place.
|
|
156
|
+
*/
|
|
157
|
+
static async send(params, name, url, normalizedUrl, method, body) {
|
|
158
|
+
const serviceContext = contextFor(
|
|
159
|
+
name,
|
|
160
|
+
url,
|
|
161
|
+
normalizedUrl,
|
|
162
|
+
method,
|
|
163
|
+
params.config.metrics?.source || "unset"
|
|
164
|
+
);
|
|
165
|
+
const response = await request({
|
|
166
|
+
// `...params` first, so `cacheControl` and `onCachedResponse` reach the
|
|
167
|
+
// request. Every shape above extends `RequestBaseParams`, so a caller
|
|
168
|
+
// may pass them, and `request` really reads `onCachedResponse` for its
|
|
169
|
+
// stale-while-revalidate path. Passing `config` alone advertised two
|
|
170
|
+
// options in the type and then dropped them both. The named fields
|
|
171
|
+
// below are written after, so they still win.
|
|
172
|
+
...params,
|
|
173
|
+
config: params.config,
|
|
174
|
+
base: BASE,
|
|
175
|
+
url,
|
|
176
|
+
method,
|
|
177
|
+
metricsDetails: serviceContext,
|
|
178
|
+
body
|
|
179
|
+
});
|
|
180
|
+
if (!response.ok) {
|
|
181
|
+
throw new HttpError(
|
|
182
|
+
`${serviceContext.method.name}: ${response.status} ${response.statusText}`,
|
|
183
|
+
response.status,
|
|
184
|
+
response.statusText
|
|
185
|
+
);
|
|
186
|
+
}
|
|
187
|
+
return response.body;
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
export {
|
|
191
|
+
ControlAnnotationsService
|
|
192
|
+
};
|
|
193
|
+
//# sourceMappingURL=control.annotations.service.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/services/control/control.annotations.service.ts"],
|
|
4
|
+
"sourcesContent": ["/*\n * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH\n * under one or more contributor license agreements. Licensed under a commercial license.\n * You may not use this file except in compliance with the commercial license.\n */\n\nimport type {\n AnnotationDto,\n AnnotationEntityKind,\n AnnotationKind,\n AnnotationLookupDto,\n AnnotationTagDto,\n EntityAnnotationsDto,\n} from '@camunda/ccma-shared-types'\nimport type {\n RequestBaseMethodType,\n RequestBaseParams,\n RequestBaseServiceContext,\n} from '../../types/general.types.js'\nimport { request } from '../../utils/api.js'\nimport { HttpError } from '../../utils/errors.js'\n\n/**\n * The annotation surface of control-backend: the notes and the tags that a\n * Camundi attaches to an entity of the fleet.\n *\n * One service for every kind of entity, and not one for each. The routes carry\n * the kind as a value, which is what lets one panel in control-frontend sit on\n * the cluster page, the organization page and every other entity page without\n * a call of its own.\n *\n * Every route answers 404 while the feature flag `control.annotations` is off\n * on the stage, and while the service reaches no stage at all.\n */\n\nconst BASE = { id: 'control' } as const\n\n/** What names the entity. Every write and the entity read carry it. */\nexport interface AnnotationTargetDto {\n entityKind: AnnotationEntityKind\n entityId: string\n /**\n * What the entity is called now. The backend stores it as a COPY, so a\n * search result still reads after the entity is deleted. Send it when the\n * caller knows the name.\n */\n entityLabel?: string\n}\n\nexport interface GetEntityAnnotationsRequest extends RequestBaseParams {\n params: { entityKind: AnnotationEntityKind; entityId: string }\n}\n\nexport interface LookupAnnotationsRequest extends RequestBaseParams {\n params: { entityKind: AnnotationEntityKind; entityIds: string[] }\n}\n\nexport interface AddAnnotationNoteRequest extends RequestBaseParams {\n params: AnnotationTargetDto & { body: string }\n}\n\nexport interface EditAnnotationNoteRequest extends RequestBaseParams {\n params: {\n id: string\n body: string\n /**\n * The `version` of the note that the caller read.\n *\n * The backend writes only while the row still carries it, and answers 409\n * when it does not. Send what came with the note you are editing, never a\n * number of your own: it is what stops a stale tab from replacing an edit\n * that landed after it was opened.\n */\n version: number\n }\n}\n\nexport interface AnnotationIdRequest extends RequestBaseParams {\n params: { id: string }\n}\n\nexport interface AddAnnotationTagRequest extends RequestBaseParams {\n params: AnnotationTargetDto & { tag: string }\n}\n\nexport interface ListAnnotationTagsRequest extends RequestBaseParams {\n params?: { q?: string; limit?: number; offset?: number }\n}\n\nexport interface SearchAnnotationsRequest extends RequestBaseParams {\n params?: {\n kind?: AnnotationKind\n entityKind?: AnnotationEntityKind\n tag?: string\n q?: string\n limit?: number\n offset?: number\n }\n}\n\n/** One page of a read, and whether the table holds more of it. */\nexport interface AnnotationPageInfoDto {\n limit: number\n offset: number\n /** True when the next page holds more. Never read the length instead. */\n hasMore: boolean\n}\n\nexport interface AnnotationPageDto {\n annotations: AnnotationDto[]\n page: AnnotationPageInfoDto\n}\n\nexport interface AnnotationTagPageDto {\n tags: AnnotationTagDto[]\n page: AnnotationPageInfoDto\n}\n\nfunction contextFor(\n name: string,\n url: string,\n normalizedUrl: string,\n type: RequestBaseMethodType,\n source: string,\n): RequestBaseServiceContext {\n return {\n method: {\n name: `ControlAnnotationsService.${name}`,\n url,\n normalizedUrl,\n type,\n },\n source,\n target: { name: 'control', type: 'internal' },\n }\n}\n\n/** Builds `?a=1&b=2` from the values that are set, and `''` from none. */\nfunction queryOf(params: Record<string, unknown> = {}): string {\n const query = new URLSearchParams()\n for (const [key, value] of Object.entries(params)) {\n if (value !== undefined) {\n query.set(key, String(value))\n }\n }\n return query.size > 0 ? `?${query.toString()}` : ''\n}\n\nexport class ControlAnnotationsService {\n /**\n * Every live note and tag of one entity.\n *\n * An entity that carries nothing answers with two empty lists, and never\n * 404. The call also answers for an entity that the fleet no longer holds,\n * which is what keeps a link out of a search result working.\n */\n public static async forEntity(\n params: GetEntityAnnotationsRequest,\n ): Promise<EntityAnnotationsDto> {\n const url = `api/annotations${queryOf(params.params)}`\n return ControlAnnotationsService.send<EntityAnnotationsDto>(\n params,\n 'forEntity',\n url,\n 'api/annotations',\n 'get',\n )\n }\n\n /**\n * The tags, the note count and the newest note of many entities.\n *\n * A POST, because thousands of ids do not fit a request line. The answer\n * holds only the entities that carry something.\n */\n public static async lookup(\n params: LookupAnnotationsRequest,\n ): Promise<AnnotationLookupDto> {\n return ControlAnnotationsService.send<AnnotationLookupDto>(\n params,\n 'lookup',\n 'api/annotations/lookup',\n 'api/annotations/lookup',\n 'post',\n params.params,\n )\n }\n\n /** Writes a note on an entity. Any signed-in Camundi can. */\n public static async addNote(\n params: AddAnnotationNoteRequest,\n ): Promise<AnnotationDto> {\n const { annotation } = await ControlAnnotationsService.send<{\n annotation: AnnotationDto\n }>(\n params,\n 'addNote',\n 'api/annotations/notes',\n 'api/annotations/notes',\n 'post',\n params.params,\n )\n return annotation\n }\n\n /** Changes the text of a note. Only the person who wrote it can. */\n public static async editNote(\n params: EditAnnotationNoteRequest,\n ): Promise<AnnotationDto> {\n const url = `api/annotations/notes/${params.params.id}`\n const { annotation } = await ControlAnnotationsService.send<{\n annotation: AnnotationDto\n }>(params, 'editNote', url, 'api/annotations/notes/:id', 'patch', {\n body: params.params.body,\n version: params.params.version,\n })\n return annotation\n }\n\n /**\n * Takes a note or a tag off an entity.\n *\n * The row stays: the removal is a soft delete, so who wrote it and who took\n * it off both stay readable. A note can only be removed by its author; a tag\n * can be removed by anybody.\n */\n public static async remove(params: AnnotationIdRequest): Promise<void> {\n const url = `api/annotations/${params.params.id}`\n await ControlAnnotationsService.send<undefined>(\n params,\n 'remove',\n url,\n 'api/annotations/:id',\n 'delete',\n )\n }\n\n /**\n * Attaches a tag to an entity, and adds it to the dictionary when it is new.\n *\n * The name is normalized by the backend, so `Partner` and `partner` reach\n * one tag. A second attach of one tag on one entity answers 409.\n */\n public static async addTag(\n params: AddAnnotationTagRequest,\n ): Promise<AnnotationDto> {\n const { annotation } = await ControlAnnotationsService.send<{\n annotation: AnnotationDto\n }>(\n params,\n 'addTag',\n 'api/annotations/tags',\n 'api/annotations/tags',\n 'post',\n params.params,\n )\n return annotation\n }\n\n /**\n * The tag dictionary, with the live entities of each tag counted, most used\n * first.\n *\n * The autocomplete of the tag field reads this. It is what stops one idea\n * from becoming three spellings.\n *\n * It answers one PAGE, because the dictionary only grows. Read `page.hasMore`\n * to learn whether another follows.\n */\n public static async listTags(\n params: ListAnnotationTagsRequest,\n ): Promise<AnnotationTagPageDto> {\n const url = `api/annotations/tags${queryOf(params.params)}`\n return ControlAnnotationsService.send<AnnotationTagPageDto>(\n params,\n 'listTags',\n url,\n 'api/annotations/tags',\n 'get',\n )\n }\n\n /**\n * One page of the annotations that match, newest first.\n *\n * The answer holds annotations of entities that no longer exist, which is\n * the point: the note about a deleted cluster is often the only record of\n * why it was there.\n */\n public static async search(\n params: SearchAnnotationsRequest,\n ): Promise<AnnotationPageDto> {\n const url = `api/annotations/search${queryOf(params.params)}`\n return ControlAnnotationsService.send<AnnotationPageDto>(\n params,\n 'search',\n url,\n 'api/annotations/search',\n 'get',\n )\n }\n\n /**\n * The shared half of every call above.\n *\n * Seven routes differ only in the verb, the path and the body. One private\n * helper keeps the metrics context and the status check in one place.\n */\n private static async send<TResponse>(\n params: RequestBaseParams,\n name: string,\n url: string,\n normalizedUrl: string,\n method: RequestBaseMethodType,\n // `object` and not `Record<string, unknown>`: an interface has no index\n // signature, so the request shapes above would not be assignable to one,\n // and the alternative is `any`.\n body?: object,\n ): Promise<TResponse> {\n const serviceContext = contextFor(\n name,\n url,\n normalizedUrl,\n method,\n params.config.metrics?.source || 'unset',\n )\n const response = await request<TResponse>({\n // `...params` first, so `cacheControl` and `onCachedResponse` reach the\n // request. Every shape above extends `RequestBaseParams`, so a caller\n // may pass them, and `request` really reads `onCachedResponse` for its\n // stale-while-revalidate path. Passing `config` alone advertised two\n // options in the type and then dropped them both. The named fields\n // below are written after, so they still win.\n ...params,\n config: params.config,\n base: BASE,\n url,\n method,\n metricsDetails: serviceContext,\n body,\n })\n if (!response.ok) {\n throw new HttpError(\n `${serviceContext.method.name}: ${response.status} ${response.statusText}`,\n response.status,\n response.statusText,\n )\n }\n // `remove` answers 204, which carries no body. Its caller declares\n // `undefined` and reads nothing, so the assertion below is safe for it\n // too: every other route here answers a body.\n return response.body as TResponse\n }\n}\n"],
|
|
5
|
+
"mappings": "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",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ApprovalJobDto, ApprovalJobStatus, ApprovalUseCaseDto } from '@camunda/ccma-shared-types';
|
|
1
|
+
import type { ApprovalEntityType, ApprovalJobDto, ApprovalJobStatus, ApprovalSortField, ApprovalSortOrder, ApprovalStatusCountsDto, ApprovalUseCaseDto, ClusterBulkOperationPayloadDto, ClusterBulkOperationType, FeatureFlagOverridePayloadDto } from '@camunda/ccma-shared-types';
|
|
2
2
|
import type { RequestBaseParams } from '../../types/general.types.js';
|
|
3
3
|
export interface ApprovalPageDto {
|
|
4
4
|
approvals: ApprovalJobDto[];
|
|
@@ -9,14 +9,66 @@ export interface ApprovalPageDto {
|
|
|
9
9
|
hasMore: boolean;
|
|
10
10
|
};
|
|
11
11
|
}
|
|
12
|
+
/**
|
|
13
|
+
* What narrows the queue. The list and the counts read the same fields.
|
|
14
|
+
*
|
|
15
|
+
* `entityType` and `entityId` are ONE filter, not two. control-backend answers
|
|
16
|
+
* 400 for one without the other, so the type carries both or neither.
|
|
17
|
+
*/
|
|
18
|
+
export type ApprovalFacetParams = {
|
|
19
|
+
type?: string;
|
|
20
|
+
/**
|
|
21
|
+
* One organization, matched whole against `orgId` of the payload.
|
|
22
|
+
*
|
|
23
|
+
* It reads only the payload, so `entityType`/`entityId` is wider. That filter
|
|
24
|
+
* reads the entity link, so it finds a request that touches the organization
|
|
25
|
+
* through another field. The organization page of control-frontend asks the
|
|
26
|
+
* entity-link filter, not this one. `orgId` is also not `q`: the free text
|
|
27
|
+
* reads the whole payload as text.
|
|
28
|
+
*/
|
|
29
|
+
orgId?: string;
|
|
30
|
+
/**
|
|
31
|
+
* Free text. control-backend matches it in the reason, the person who
|
|
32
|
+
* opened the request, the action and its label, and the payload that the
|
|
33
|
+
* summary shows.
|
|
34
|
+
*/
|
|
35
|
+
q?: string;
|
|
36
|
+
/**
|
|
37
|
+
* The queue of one person: what they opened, or what waits for them.
|
|
38
|
+
*
|
|
39
|
+
* `actionable` is the rule of the Approve button asked in SQL — pending,
|
|
40
|
+
* opened by somebody else, not approved by this person yet, and guarded by
|
|
41
|
+
* permissions that they hold.
|
|
42
|
+
*/
|
|
43
|
+
mine?: 'created' | 'actionable';
|
|
44
|
+
} & ({
|
|
45
|
+
/**
|
|
46
|
+
* The kind of entity a request must touch. Read with `entityId`.
|
|
47
|
+
*
|
|
48
|
+
* It reads the entity link of control-backend, so it is wider and truer
|
|
49
|
+
* than `orgId`: a cluster-move request answers for its source
|
|
50
|
+
* organization, its target organization AND the cluster. The organization
|
|
51
|
+
* and cluster detail pages of control-frontend ask this.
|
|
52
|
+
*/
|
|
53
|
+
entityType: ApprovalEntityType;
|
|
54
|
+
/** The id of the entity a request must touch. Read with `entityType`. */
|
|
55
|
+
entityId: string;
|
|
56
|
+
} | {
|
|
57
|
+
entityType?: never;
|
|
58
|
+
entityId?: never;
|
|
59
|
+
});
|
|
12
60
|
export interface ListApprovalsRequest extends RequestBaseParams {
|
|
13
|
-
params?: {
|
|
14
|
-
type?: string;
|
|
61
|
+
params?: ApprovalFacetParams & {
|
|
15
62
|
status?: ApprovalJobStatus;
|
|
63
|
+
sort?: ApprovalSortField;
|
|
64
|
+
order?: ApprovalSortOrder;
|
|
16
65
|
limit?: number;
|
|
17
66
|
offset?: number;
|
|
18
67
|
};
|
|
19
68
|
}
|
|
69
|
+
export interface CountApprovalsRequest extends RequestBaseParams {
|
|
70
|
+
params?: ApprovalFacetParams;
|
|
71
|
+
}
|
|
20
72
|
export interface ApprovalIdRequest extends RequestBaseParams {
|
|
21
73
|
params: {
|
|
22
74
|
id: string;
|
|
@@ -28,6 +80,13 @@ export interface RejectApprovalRequest extends RequestBaseParams {
|
|
|
28
80
|
reason: string;
|
|
29
81
|
};
|
|
30
82
|
}
|
|
83
|
+
/** A withdrawal says why, or says nothing. The reason is not demanded. */
|
|
84
|
+
export interface WithdrawApprovalRequest extends RequestBaseParams {
|
|
85
|
+
params: {
|
|
86
|
+
id: string;
|
|
87
|
+
reason?: string;
|
|
88
|
+
};
|
|
89
|
+
}
|
|
31
90
|
/** The envelope that every create route of every use case shares. */
|
|
32
91
|
export interface CreateApprovalRequest<TPayload> extends RequestBaseParams {
|
|
33
92
|
params: {
|
|
@@ -54,6 +113,14 @@ export interface ExtendTrialPayloadDto {
|
|
|
54
113
|
*/
|
|
55
114
|
days: number;
|
|
56
115
|
}
|
|
116
|
+
export interface MoveClusterOrgPayloadDto {
|
|
117
|
+
clusterId: string;
|
|
118
|
+
/** A copy, so a list shows a name that a person knows. Nothing reads it. */
|
|
119
|
+
clusterName?: string;
|
|
120
|
+
targetOrgId: string;
|
|
121
|
+
/** A copy, for the same reason as `clusterName`. */
|
|
122
|
+
targetOrgName?: string;
|
|
123
|
+
}
|
|
57
124
|
export declare class ControlApprovalsService {
|
|
58
125
|
/**
|
|
59
126
|
* The registered privileged actions, with the rules that guard each one.
|
|
@@ -70,13 +137,51 @@ export declare class ControlApprovalsService {
|
|
|
70
137
|
* the caller cannot act on, unless the caller opened it.
|
|
71
138
|
*/
|
|
72
139
|
static list(params: ListApprovalsRequest): Promise<ApprovalPageDto>;
|
|
140
|
+
/**
|
|
141
|
+
* How many requests each status holds, for the status filters of a queue.
|
|
142
|
+
*
|
|
143
|
+
* It is the same question as `list` without the status, so a filter that
|
|
144
|
+
* shows a number never opens an empty page.
|
|
145
|
+
*/
|
|
146
|
+
static counts(params: CountApprovalsRequest): Promise<ApprovalStatusCountsDto>;
|
|
73
147
|
static get(params: ApprovalIdRequest): Promise<ApprovalJobDto>;
|
|
148
|
+
/**
|
|
149
|
+
* What a create route answers, plus whether it opened a NEW request.
|
|
150
|
+
*
|
|
151
|
+
* The route answers 201 for a fresh request and 200 for the one already
|
|
152
|
+
* open for the same target — `create` deduplicates. A caller that must
|
|
153
|
+
* tell the two apart (a floor-of-one use case, where 200 is the ordinary
|
|
154
|
+
* path and not a failure) reads `created`.
|
|
155
|
+
*/
|
|
156
|
+
static createMoveClusterOrg(params: CreateApprovalRequest<MoveClusterOrgPayloadDto>): Promise<{
|
|
157
|
+
approval: ApprovalJobDto;
|
|
158
|
+
created: boolean;
|
|
159
|
+
}>;
|
|
160
|
+
/**
|
|
161
|
+
* Opens a cluster bulk operation of one type.
|
|
162
|
+
*
|
|
163
|
+
* Each type is its own use case with its own route, because each one has
|
|
164
|
+
* its own permission. The floor of approvals is the same for every type,
|
|
165
|
+
* and it depends on the stage: 2 on prod, 1 on dev, int and local. The
|
|
166
|
+
* route is `api/approvals/<use case>`, as for every other use case. A 200
|
|
167
|
+
* means that the same operation over the same clusters is already open.
|
|
168
|
+
*/
|
|
169
|
+
static createClusterBulkOperation<T extends ClusterBulkOperationType>(type: T, params: CreateApprovalRequest<ClusterBulkOperationPayloadDto<T>>): Promise<{
|
|
170
|
+
approval: ApprovalJobDto;
|
|
171
|
+
created: boolean;
|
|
172
|
+
}>;
|
|
74
173
|
/** Adds the approval of the caller. The last one can run the action. */
|
|
75
174
|
static acknowledge(params: ApprovalIdRequest): Promise<ApprovalJobDto>;
|
|
76
175
|
/** Closes a request without running the action. The reason is necessary. */
|
|
77
176
|
static reject(params: RejectApprovalRequest): Promise<ApprovalJobDto>;
|
|
78
|
-
/**
|
|
79
|
-
|
|
177
|
+
/**
|
|
178
|
+
* Takes back a request. Only the person who opened it can.
|
|
179
|
+
*
|
|
180
|
+
* The reason is optional, and it lands in the same field that a rejection
|
|
181
|
+
* writes. The creator cannot reject their own request, so this is where they
|
|
182
|
+
* say why they closed it.
|
|
183
|
+
*/
|
|
184
|
+
static withdraw(params: WithdrawApprovalRequest): Promise<ApprovalJobDto>;
|
|
80
185
|
/**
|
|
81
186
|
* Runs a request that holds its approvals.
|
|
82
187
|
*
|
|
@@ -94,6 +199,18 @@ export declare class ControlApprovalsService {
|
|
|
94
199
|
* approving needs, and the reason is necessary.
|
|
95
200
|
*/
|
|
96
201
|
static createExtendTrial(params: CreateApprovalRequest<ExtendTrialPayloadDto>): Promise<ApprovalJobDto>;
|
|
202
|
+
/**
|
|
203
|
+
* Opens a feature-flag-override request.
|
|
204
|
+
*
|
|
205
|
+
* Opening one needs the feature flag permission, the same one that
|
|
206
|
+
* approving needs, and the reason is necessary. A stage override that names
|
|
207
|
+
* `prod` needs the prod permission on top, to ask AND to approve.
|
|
208
|
+
*
|
|
209
|
+
* The payload holds a number of DAYS and not a date. Every override ends:
|
|
210
|
+
* without a deadline the store becomes a second, invisible layer of
|
|
211
|
+
* configuration.
|
|
212
|
+
*/
|
|
213
|
+
static createFeatureFlagOverride(params: CreateApprovalRequest<FeatureFlagOverridePayloadDto>): Promise<ApprovalJobDto>;
|
|
97
214
|
/**
|
|
98
215
|
* The shared half of every call that answers one request.
|
|
99
216
|
*
|
|
@@ -102,6 +219,13 @@ export declare class ControlApprovalsService {
|
|
|
102
219
|
* unwrapping in one place.
|
|
103
220
|
*/
|
|
104
221
|
private static readOne;
|
|
105
|
-
/**
|
|
222
|
+
/**
|
|
223
|
+
* The shared half of every create route. See `approvalRequestBody`.
|
|
224
|
+
*
|
|
225
|
+
* The route answers 201 for a fresh request and 200 for the one already
|
|
226
|
+
* open for the same target (`create` deduplicates). `created` carries that
|
|
227
|
+
* difference. `createSendToExpiredTrial` and `createExtendTrial` do not
|
|
228
|
+
* need it, so they read `approval` alone off this result.
|
|
229
|
+
*/
|
|
106
230
|
private static create;
|
|
107
231
|
}
|
|
@@ -1,6 +1,16 @@
|
|
|
1
|
+
import { CLUSTER_BULK_OPERATION_RULES } from "@camunda/ccma-shared-types";
|
|
1
2
|
import { request } from "../../utils/api.js";
|
|
2
3
|
import { HttpError } from "../../utils/errors.js";
|
|
3
4
|
const BASE = { id: "control" };
|
|
5
|
+
function querySuffix(params = {}) {
|
|
6
|
+
const query = new URLSearchParams();
|
|
7
|
+
for (const [key, value] of Object.entries(params)) {
|
|
8
|
+
if (value !== void 0 && value !== "") {
|
|
9
|
+
query.set(key, String(value));
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
return query.size > 0 ? `?${query.toString()}` : "";
|
|
13
|
+
}
|
|
4
14
|
function contextFor(name, url, normalizedUrl, type, source) {
|
|
5
15
|
return {
|
|
6
16
|
method: {
|
|
@@ -52,13 +62,7 @@ class ControlApprovalsService {
|
|
|
52
62
|
* the caller cannot act on, unless the caller opened it.
|
|
53
63
|
*/
|
|
54
64
|
static async list(params) {
|
|
55
|
-
const
|
|
56
|
-
for (const [key, value] of Object.entries(params.params ?? {})) {
|
|
57
|
-
if (value !== void 0) {
|
|
58
|
-
query.set(key, String(value));
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
const suffix = query.size > 0 ? `?${query.toString()}` : "";
|
|
65
|
+
const suffix = querySuffix(params.params);
|
|
62
66
|
const serviceContext = contextFor(
|
|
63
67
|
"list",
|
|
64
68
|
`api/approvals${suffix}`,
|
|
@@ -82,6 +86,37 @@ class ControlApprovalsService {
|
|
|
82
86
|
}
|
|
83
87
|
return response.body;
|
|
84
88
|
}
|
|
89
|
+
/**
|
|
90
|
+
* How many requests each status holds, for the status filters of a queue.
|
|
91
|
+
*
|
|
92
|
+
* It is the same question as `list` without the status, so a filter that
|
|
93
|
+
* shows a number never opens an empty page.
|
|
94
|
+
*/
|
|
95
|
+
static async counts(params) {
|
|
96
|
+
const suffix = querySuffix(params.params);
|
|
97
|
+
const serviceContext = contextFor(
|
|
98
|
+
"counts",
|
|
99
|
+
`api/approvals/counts${suffix}`,
|
|
100
|
+
"api/approvals/counts",
|
|
101
|
+
"get",
|
|
102
|
+
params.config.metrics?.source || "unset"
|
|
103
|
+
);
|
|
104
|
+
const response = await request({
|
|
105
|
+
config: params.config,
|
|
106
|
+
base: BASE,
|
|
107
|
+
url: serviceContext.method.url,
|
|
108
|
+
method: "get",
|
|
109
|
+
metricsDetails: serviceContext
|
|
110
|
+
});
|
|
111
|
+
if (!response.ok) {
|
|
112
|
+
throw new HttpError(
|
|
113
|
+
`${serviceContext.method.name}: ${response.status} ${response.statusText}`,
|
|
114
|
+
response.status,
|
|
115
|
+
response.statusText
|
|
116
|
+
);
|
|
117
|
+
}
|
|
118
|
+
return response.body.counts;
|
|
119
|
+
}
|
|
85
120
|
static async get(params) {
|
|
86
121
|
return ControlApprovalsService.readOne(
|
|
87
122
|
params,
|
|
@@ -91,6 +126,38 @@ class ControlApprovalsService {
|
|
|
91
126
|
"get"
|
|
92
127
|
);
|
|
93
128
|
}
|
|
129
|
+
/**
|
|
130
|
+
* What a create route answers, plus whether it opened a NEW request.
|
|
131
|
+
*
|
|
132
|
+
* The route answers 201 for a fresh request and 200 for the one already
|
|
133
|
+
* open for the same target — `create` deduplicates. A caller that must
|
|
134
|
+
* tell the two apart (a floor-of-one use case, where 200 is the ordinary
|
|
135
|
+
* path and not a failure) reads `created`.
|
|
136
|
+
*/
|
|
137
|
+
static async createMoveClusterOrg(params) {
|
|
138
|
+
return ControlApprovalsService.create(
|
|
139
|
+
params,
|
|
140
|
+
"createMoveClusterOrg",
|
|
141
|
+
"api/approvals/move-cluster-org"
|
|
142
|
+
);
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Opens a cluster bulk operation of one type.
|
|
146
|
+
*
|
|
147
|
+
* Each type is its own use case with its own route, because each one has
|
|
148
|
+
* its own permission. The floor of approvals is the same for every type,
|
|
149
|
+
* and it depends on the stage: 2 on prod, 1 on dev, int and local. The
|
|
150
|
+
* route is `api/approvals/<use case>`, as for every other use case. A 200
|
|
151
|
+
* means that the same operation over the same clusters is already open.
|
|
152
|
+
*/
|
|
153
|
+
static async createClusterBulkOperation(type, params) {
|
|
154
|
+
const useCase = CLUSTER_BULK_OPERATION_RULES[type].useCase;
|
|
155
|
+
return ControlApprovalsService.create(
|
|
156
|
+
params,
|
|
157
|
+
"createClusterBulkOperation",
|
|
158
|
+
`api/approvals/${useCase}`
|
|
159
|
+
);
|
|
160
|
+
}
|
|
94
161
|
/** Adds the approval of the caller. The last one can run the action. */
|
|
95
162
|
static async acknowledge(params) {
|
|
96
163
|
return ControlApprovalsService.readOne(
|
|
@@ -112,14 +179,21 @@ class ControlApprovalsService {
|
|
|
112
179
|
{ reason: params.params.reason }
|
|
113
180
|
);
|
|
114
181
|
}
|
|
115
|
-
/**
|
|
182
|
+
/**
|
|
183
|
+
* Takes back a request. Only the person who opened it can.
|
|
184
|
+
*
|
|
185
|
+
* The reason is optional, and it lands in the same field that a rejection
|
|
186
|
+
* writes. The creator cannot reject their own request, so this is where they
|
|
187
|
+
* say why they closed it.
|
|
188
|
+
*/
|
|
116
189
|
static async withdraw(params) {
|
|
117
190
|
return ControlApprovalsService.readOne(
|
|
118
191
|
params,
|
|
119
192
|
"withdraw",
|
|
120
193
|
`api/approvals/${params.params.id}/withdraw`,
|
|
121
194
|
"api/approvals/:id/withdraw",
|
|
122
|
-
"post"
|
|
195
|
+
"post",
|
|
196
|
+
params.params.reason ? { reason: params.params.reason } : void 0
|
|
123
197
|
);
|
|
124
198
|
}
|
|
125
199
|
/**
|
|
@@ -140,11 +214,12 @@ class ControlApprovalsService {
|
|
|
140
214
|
}
|
|
141
215
|
/** Opens a send-to-expired-trial request. Any signed-in Camundi can. */
|
|
142
216
|
static async createSendToExpiredTrial(params) {
|
|
143
|
-
|
|
217
|
+
const { approval } = await ControlApprovalsService.create(
|
|
144
218
|
params,
|
|
145
219
|
"createSendToExpiredTrial",
|
|
146
220
|
"api/approvals/send-to-expired-trial"
|
|
147
221
|
);
|
|
222
|
+
return approval;
|
|
148
223
|
}
|
|
149
224
|
/**
|
|
150
225
|
* Opens an extend-trial request.
|
|
@@ -153,11 +228,31 @@ class ControlApprovalsService {
|
|
|
153
228
|
* approving needs, and the reason is necessary.
|
|
154
229
|
*/
|
|
155
230
|
static async createExtendTrial(params) {
|
|
156
|
-
|
|
231
|
+
const { approval } = await ControlApprovalsService.create(
|
|
157
232
|
params,
|
|
158
233
|
"createExtendTrial",
|
|
159
234
|
"api/approvals/extend-trial"
|
|
160
235
|
);
|
|
236
|
+
return approval;
|
|
237
|
+
}
|
|
238
|
+
/**
|
|
239
|
+
* Opens a feature-flag-override request.
|
|
240
|
+
*
|
|
241
|
+
* Opening one needs the feature flag permission, the same one that
|
|
242
|
+
* approving needs, and the reason is necessary. A stage override that names
|
|
243
|
+
* `prod` needs the prod permission on top, to ask AND to approve.
|
|
244
|
+
*
|
|
245
|
+
* The payload holds a number of DAYS and not a date. Every override ends:
|
|
246
|
+
* without a deadline the store becomes a second, invisible layer of
|
|
247
|
+
* configuration.
|
|
248
|
+
*/
|
|
249
|
+
static async createFeatureFlagOverride(params) {
|
|
250
|
+
const { approval } = await ControlApprovalsService.create(
|
|
251
|
+
params,
|
|
252
|
+
"createFeatureFlagOverride",
|
|
253
|
+
"api/approvals/feature-flag-override"
|
|
254
|
+
);
|
|
255
|
+
return approval;
|
|
161
256
|
}
|
|
162
257
|
/**
|
|
163
258
|
* The shared half of every call that answers one request.
|
|
@@ -191,7 +286,14 @@ class ControlApprovalsService {
|
|
|
191
286
|
}
|
|
192
287
|
return response.body.approval;
|
|
193
288
|
}
|
|
194
|
-
/**
|
|
289
|
+
/**
|
|
290
|
+
* The shared half of every create route. See `approvalRequestBody`.
|
|
291
|
+
*
|
|
292
|
+
* The route answers 201 for a fresh request and 200 for the one already
|
|
293
|
+
* open for the same target (`create` deduplicates). `created` carries that
|
|
294
|
+
* difference. `createSendToExpiredTrial` and `createExtendTrial` do not
|
|
295
|
+
* need it, so they read `approval` alone off this result.
|
|
296
|
+
*/
|
|
195
297
|
static async create(params, name, url) {
|
|
196
298
|
const serviceContext = contextFor(
|
|
197
299
|
name,
|
|
@@ -219,7 +321,10 @@ class ControlApprovalsService {
|
|
|
219
321
|
response.statusText
|
|
220
322
|
);
|
|
221
323
|
}
|
|
222
|
-
return
|
|
324
|
+
return {
|
|
325
|
+
approval: response.body.approval,
|
|
326
|
+
created: response.status === 201
|
|
327
|
+
};
|
|
223
328
|
}
|
|
224
329
|
}
|
|
225
330
|
export {
|