-
-
Notifications
You must be signed in to change notification settings - Fork 768
/
Copy pathcore.ts
56 lines (49 loc) · 1.37 KB
/
core.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
56
import type { Request } from 'express';
import type EventEmitter from 'events';
import type * as https from 'https';
import type * as http from 'http';
import type User from './user';
import type { IAuditUser, IUser } from './user';
import type { IUnleashConfig } from './option';
import type { IUnleashStores } from './stores';
import type { IUnleashServices } from './services';
export interface AuthedRequest extends Request {
user: User;
}
export interface IUnleash {
app: any;
config: IUnleashConfig;
eventBus: EventEmitter;
stores: IUnleashStores;
server?: http.Server | https.Server;
services: IUnleashServices;
stop: () => Promise<void>;
version: string;
}
export const SYSTEM_USER: Omit<IUser, 'email'> = {
id: -1337,
imageUrl: '',
isAPI: false,
name: 'Unleash System',
permissions: [],
username: 'unleash_system_user',
};
export const ADMIN_TOKEN_USER: Omit<IUser, 'email'> = {
id: -42,
imageUrl: '',
isAPI: true,
name: 'Unleash Admin Token',
permissions: [],
username: 'unleash_admin_token',
};
export const SYSTEM_USER_AUDIT: IAuditUser = {
id: SYSTEM_USER.id,
username: SYSTEM_USER.username!,
ip: '',
};
export const TEST_AUDIT_USER: IAuditUser = {
id: -9999,
username: 'test@example.com',
ip: '999.999.999.999',
};
export const SYSTEM_USER_ID: number = SYSTEM_USER.id;