-
Notifications
You must be signed in to change notification settings - Fork 0
/
types.d.ts
58 lines (54 loc) · 1.55 KB
/
types.d.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
57
58
import type { Reactive } from 'vue'
declare global {
namespace Layer {
type InputValidators = 'string' | 'string-cyrillic' | 'string-latin' | 'number' | 'number-positive'
type InputStatus = 'success' | 'warning' | 'error'
type JoiLocales = 'ukUA' | 'enEn' | 'custom'
type JoiMessages = {
base: Record<string, string>
validators: Record<Partial<InputValidators>, Record<string, string>>
}
type JoiSetup = { locales: JoiLocales; messages: JoiMessages }
type ValidationDirective = Reactive<{ errors: { el: HTMLElement; message: string }[]; state: string }>
type SignIn = { login: string; password: string }
type SignUp = Optionate<
{ repeatedPasword: string; mail: string } & SignIn & Omit<User, 'id'>,
'login' | 'password' | 'repeatedPasword'
>
type User = {
id: number
roleId: number
privileges: number[]
profile: {
firstName: string
lastName: string
middleName: string
}[]
}
type SessionData = { user: User }
}
type _ = unknown
type Optionate<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>
}
declare module '@nuxt/schema' {
interface RuntimeConfig {
baseLayer: {
auth: {
jwtSecret: string
signupKind: 'base' | 'extended'
sesionPrivateKey: string
}
}
}
interface PublicRuntimeConfig {
baseLayer: {
joiSetup: Layer.JoiSetup
auth: {
enabled: boolean
jwtExpiresIn: number
fallbackRoute: string
unprotectedRoutes: string[]
}
}
}
}