-
Notifications
You must be signed in to change notification settings - Fork 0
/
applications.ts
55 lines (47 loc) · 1.16 KB
/
applications.ts
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
import type { Auditable } from './shared';
const APPLICATION_TYPES = [
'private',
'public',
'management',
'expiring',
] as const;
const TRANSFORM_TYPES = ['mask', 'redact', 'reveal'] as const;
type ApplicationType = typeof APPLICATION_TYPES[number];
type TransformType = typeof TRANSFORM_TYPES[number];
interface Application extends Auditable {
id: string;
tenantId: string;
name?: string;
key?: string;
type: ApplicationType;
permissions?: string[];
rules?: AccessRule[];
canCreateExpiringApplications?: boolean;
expiresAt?: string;
}
interface AccessRule {
description: string;
priority: number;
container: string;
transform: TransformType;
permissions: string[];
conditions?: Condition[];
}
type Condition = {
attribute: string;
operator: string;
value: string;
};
type CreateApplication = Pick<Application, 'name' | 'type'> &
Partial<Pick<Application, 'permissions' | 'rules'>>;
type UpdateApplication = Partial<
Pick<Application, 'name' | 'permissions' | 'rules'>
>;
export type {
ApplicationType,
Application,
CreateApplication,
TransformType,
UpdateApplication,
};
export { APPLICATION_TYPES, TRANSFORM_TYPES };