-
-
Notifications
You must be signed in to change notification settings - Fork 31
/
index.d.ts
62 lines (55 loc) · 1.37 KB
/
index.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
59
60
61
62
declare class Gates {
setRoles: (roles: Array<string>) => void;
setPermissions: (permissions: Array<string>) => void;
getRoles(): Array<string>;
getPermissions(): Array<string>;
isSuperUser(): boolean;
hasRole(role: string): boolean;
unlessRole(role: string): boolean;
hasAnyRole(values: string): boolean;
hasAllRoles(values: string): boolean;
hasPermission(permission: string): boolean;
unlessPermission(permission: string): boolean;
hasAnyPermission(values: string): boolean;
hasAllPermissions(values: string): boolean;
}
declare module '@vue/runtime-core' {
// Vue 3
interface ComponentCustomProperties {
$gates: Gates
}
}
declare module 'vue/types/vue' {
// this.$gates inside Vue components
interface Vue {
$gates: Gates;
}
interface VueConstructor {
gates: Gates;
}
}
declare module '@nuxt/types' {
// context.app.$gates inside asyncData, fetch, plugins, middleware, nuxtServerInit
interface Context {
$gates: Gates;
}
// context.$gates
interface NuxtAppOptions {
$gates: Gates;
}
}
declare module 'vuex/types/index' {
// this.$gates inside Vuex store
interface Store<S> {
$gates: Gates;
}
}
export interface VueGatesOptions {
persistent?: boolean;
superRole?: string;
}
declare class VueGates {
install: (app: any, options?: VueGatesOptions) => void;
[key: string]: any;
}
export default VueGates;