forked from guacsec/trustify-ui
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmodels.ts
More file actions
68 lines (57 loc) · 1.38 KB
/
models.ts
File metadata and controls
68 lines (57 loc) · 1.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
import type { Labels } from "@app/client";
import type { Severity } from "@app/client";
export type WithUiId<T> = T & { _ui_unique_id: string };
/** Mark an object as "New" therefore does not have an `id` field. */
export type New<T extends { id: number }> = Omit<T, "id">;
export interface HubFilter {
field: string;
operator?: "=" | "!=" | "~" | ">" | ">=" | "<" | "<=";
value:
| string
| number
| {
list: (string | number)[];
operator?: "AND" | "OR";
};
}
export interface HubRequestParams {
filters?: HubFilter[];
sort?: {
field: string;
direction: "asc" | "desc";
};
page?: {
pageNumber: number; // 1-indexed
itemsPerPage: number;
};
}
export interface HubPaginatedResult<T> {
data: T[];
total: number;
params: HubRequestParams;
}
// Common
export type VulnerabilityStatus =
| "fixed"
| "not_affected"
| "known_not_affected"
| "affected";
export interface DecomposedPurl {
type: string;
name: string;
namespace?: string;
version?: string;
qualifiers?: Labels;
path?: string;
}
export type ExtendedSeverity = Severity | "unknown";
export const extendedSeverityFromSeverity = (
value?: Severity | null,
): ExtendedSeverity => value ?? "unknown";
// User preferences
export interface WatchedSboms {
sbom1Id: string | null;
sbom2Id: string | null;
sbom3Id: string | null;
sbom4Id: string | null;
}