@webx-ui/module-auth 0.2.1 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/AdminDialog.d.ts +24 -0
- package/dist/AdminList.d.ts +62 -0
- package/dist/AdminPicker.d.ts +104 -0
- package/dist/AdminsPage.d.ts +104 -0
- package/dist/admins.d.ts +18 -0
- package/dist/i18n.d.ts +8 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +906 -203
- package/dist/index.js.map +1 -1
- package/dist/module.d.ts +22 -0
- package/dist/selectAdmin.d.ts +27 -0
- package/dist/style.css +1 -1
- package/dist/types.d.ts +70 -0
- package/package.json +3 -3
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Component } from 'vue';
|
|
2
|
+
import { Admin } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Creating an administrator and editing one — the same form, because they differ in one field.
|
|
5
|
+
*
|
|
6
|
+
* The password is required the first time and optional afterwards, and a blank one on an edit
|
|
7
|
+
* means "leave it alone" rather than "set it to nothing". That is the only conditional here.
|
|
8
|
+
*/
|
|
9
|
+
type __VLS_Props = {
|
|
10
|
+
/** Absent creates somebody; present edits them. */
|
|
11
|
+
admin?: Admin | null;
|
|
12
|
+
/**
|
|
13
|
+
* The field to pick the photograph with — `WxMediaField` in a panel that has the library.
|
|
14
|
+
*
|
|
15
|
+
* Handed in rather than imported: this package does not depend on the media one, and a
|
|
16
|
+
* panel without a library still edits everything else about a person.
|
|
17
|
+
*/
|
|
18
|
+
avatarField?: Component;
|
|
19
|
+
};
|
|
20
|
+
declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
|
21
|
+
admin: Admin | null;
|
|
22
|
+
avatarField: Component;
|
|
23
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
24
|
+
export default _default;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { Admin } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* The list of administrators — the screen, and the inside of the picker.
|
|
4
|
+
*
|
|
5
|
+
* One component for both so that searching, filtering and paging behave the same wherever
|
|
6
|
+
* somebody is looking at these people. What changes is only what a row is for: opening it, or
|
|
7
|
+
* choosing it.
|
|
8
|
+
*/
|
|
9
|
+
type __VLS_Props = {
|
|
10
|
+
/** Rows are chosen rather than opened. */
|
|
11
|
+
picking?: boolean;
|
|
12
|
+
/** More than one may be chosen at a time. */
|
|
13
|
+
multiple?: boolean;
|
|
14
|
+
/** Adds the column that removes somebody. */
|
|
15
|
+
removable?: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Offers the role and state filters.
|
|
18
|
+
*
|
|
19
|
+
* Off by default: a panel has half a dozen administrators, and a filter over six rows is a
|
|
20
|
+
* control to read and decide about where a glance would have done.
|
|
21
|
+
*/
|
|
22
|
+
filters?: boolean;
|
|
23
|
+
/** Turns an avatar key into an address. The panel wires this; this package cannot. */
|
|
24
|
+
resolveAvatar?: (key: string) => Promise<string | null>;
|
|
25
|
+
};
|
|
26
|
+
declare const _default: import('vue').DefineComponent<__VLS_Props, {
|
|
27
|
+
reload: () => Promise<void>;
|
|
28
|
+
chosen: () => {
|
|
29
|
+
[x: string]: unknown;
|
|
30
|
+
id: number;
|
|
31
|
+
name: string;
|
|
32
|
+
email: string;
|
|
33
|
+
avatar: string | null;
|
|
34
|
+
is_super: boolean;
|
|
35
|
+
is_active: boolean;
|
|
36
|
+
locale: string | null;
|
|
37
|
+
last_login_at: string | null;
|
|
38
|
+
created_at: string | null;
|
|
39
|
+
roles: {
|
|
40
|
+
id: number;
|
|
41
|
+
slug: string;
|
|
42
|
+
name: string;
|
|
43
|
+
}[];
|
|
44
|
+
}[];
|
|
45
|
+
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
46
|
+
chosen: (admins: Admin[]) => any;
|
|
47
|
+
open: (admin: Admin) => any;
|
|
48
|
+
selection: (admins: Admin[]) => any;
|
|
49
|
+
remove: (admin: Admin) => any;
|
|
50
|
+
}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
51
|
+
onChosen?: ((admins: Admin[]) => any) | undefined;
|
|
52
|
+
onOpen?: ((admin: Admin) => any) | undefined;
|
|
53
|
+
onSelection?: ((admins: Admin[]) => any) | undefined;
|
|
54
|
+
onRemove?: ((admin: Admin) => any) | undefined;
|
|
55
|
+
}>, {
|
|
56
|
+
multiple: boolean;
|
|
57
|
+
picking: boolean;
|
|
58
|
+
removable: boolean;
|
|
59
|
+
filters: boolean;
|
|
60
|
+
resolveAvatar: (key: string) => Promise<string | null>;
|
|
61
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLDivElement>;
|
|
62
|
+
export default _default;
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { Admin } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* The list of administrators as a dialog, resolving with whoever was chosen.
|
|
4
|
+
*
|
|
5
|
+
* The same list as the screen — one component, so that searching and filtering behave the same
|
|
6
|
+
* wherever these people are being looked at.
|
|
7
|
+
*/
|
|
8
|
+
type __VLS_Props = {
|
|
9
|
+
multiple?: boolean;
|
|
10
|
+
title?: string;
|
|
11
|
+
resolveAvatar?: (key: string) => Promise<string | null>;
|
|
12
|
+
};
|
|
13
|
+
declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
|
14
|
+
title: string;
|
|
15
|
+
multiple: boolean;
|
|
16
|
+
resolveAvatar: (key: string) => Promise<string | null>;
|
|
17
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
|
|
18
|
+
list: import('vue').CreateComponentPublicInstanceWithMixins<Readonly<{
|
|
19
|
+
picking?: boolean;
|
|
20
|
+
multiple?: boolean;
|
|
21
|
+
removable?: boolean;
|
|
22
|
+
filters?: boolean;
|
|
23
|
+
resolveAvatar?: (key: string) => Promise<string | null>;
|
|
24
|
+
}> & Readonly<{
|
|
25
|
+
onChosen?: ((admins: Admin[]) => any) | undefined;
|
|
26
|
+
onOpen?: ((admin: Admin) => any) | undefined;
|
|
27
|
+
onSelection?: ((admins: Admin[]) => any) | undefined;
|
|
28
|
+
onRemove?: ((admin: Admin) => any) | undefined;
|
|
29
|
+
}>, {
|
|
30
|
+
reload: () => Promise<void>;
|
|
31
|
+
chosen: () => {
|
|
32
|
+
[x: string]: unknown;
|
|
33
|
+
id: number;
|
|
34
|
+
name: string;
|
|
35
|
+
email: string;
|
|
36
|
+
avatar: string | null;
|
|
37
|
+
is_super: boolean;
|
|
38
|
+
is_active: boolean;
|
|
39
|
+
locale: string | null;
|
|
40
|
+
last_login_at: string | null;
|
|
41
|
+
created_at: string | null;
|
|
42
|
+
roles: {
|
|
43
|
+
id: number;
|
|
44
|
+
slug: string;
|
|
45
|
+
name: string;
|
|
46
|
+
}[];
|
|
47
|
+
}[];
|
|
48
|
+
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
49
|
+
chosen: (admins: Admin[]) => any;
|
|
50
|
+
open: (admin: Admin) => any;
|
|
51
|
+
selection: (admins: Admin[]) => any;
|
|
52
|
+
remove: (admin: Admin) => any;
|
|
53
|
+
}, import('vue').PublicProps, {
|
|
54
|
+
multiple: boolean;
|
|
55
|
+
picking: boolean;
|
|
56
|
+
removable: boolean;
|
|
57
|
+
filters: boolean;
|
|
58
|
+
resolveAvatar: (key: string) => Promise<string | null>;
|
|
59
|
+
}, false, {}, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, {}, HTMLDivElement, import('vue').ComponentProvideOptions, {
|
|
60
|
+
P: {};
|
|
61
|
+
B: {};
|
|
62
|
+
D: {};
|
|
63
|
+
C: {};
|
|
64
|
+
M: {};
|
|
65
|
+
Defaults: {};
|
|
66
|
+
}, Readonly<{
|
|
67
|
+
picking?: boolean;
|
|
68
|
+
multiple?: boolean;
|
|
69
|
+
removable?: boolean;
|
|
70
|
+
filters?: boolean;
|
|
71
|
+
resolveAvatar?: (key: string) => Promise<string | null>;
|
|
72
|
+
}> & Readonly<{
|
|
73
|
+
onChosen?: ((admins: Admin[]) => any) | undefined;
|
|
74
|
+
onOpen?: ((admin: Admin) => any) | undefined;
|
|
75
|
+
onSelection?: ((admins: Admin[]) => any) | undefined;
|
|
76
|
+
onRemove?: ((admin: Admin) => any) | undefined;
|
|
77
|
+
}>, {
|
|
78
|
+
reload: () => Promise<void>;
|
|
79
|
+
chosen: () => {
|
|
80
|
+
[x: string]: unknown;
|
|
81
|
+
id: number;
|
|
82
|
+
name: string;
|
|
83
|
+
email: string;
|
|
84
|
+
avatar: string | null;
|
|
85
|
+
is_super: boolean;
|
|
86
|
+
is_active: boolean;
|
|
87
|
+
locale: string | null;
|
|
88
|
+
last_login_at: string | null;
|
|
89
|
+
created_at: string | null;
|
|
90
|
+
roles: {
|
|
91
|
+
id: number;
|
|
92
|
+
slug: string;
|
|
93
|
+
name: string;
|
|
94
|
+
}[];
|
|
95
|
+
}[];
|
|
96
|
+
}, {}, {}, {}, {
|
|
97
|
+
multiple: boolean;
|
|
98
|
+
picking: boolean;
|
|
99
|
+
removable: boolean;
|
|
100
|
+
filters: boolean;
|
|
101
|
+
resolveAvatar: (key: string) => Promise<string | null>;
|
|
102
|
+
}> | null;
|
|
103
|
+
}, any>;
|
|
104
|
+
export default _default;
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { Component } from 'vue';
|
|
2
|
+
import { Admin } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* The administrators section: the list, and the form over it.
|
|
5
|
+
*
|
|
6
|
+
* A dialog rather than a second route. Editing somebody is half a dozen fields, and a screen
|
|
7
|
+
* that takes over the page for that loses the list you were reading — which is where you
|
|
8
|
+
* decide who to open next.
|
|
9
|
+
*/
|
|
10
|
+
type __VLS_Props = {
|
|
11
|
+
avatarField?: Component;
|
|
12
|
+
resolveAvatar?: (key: string) => Promise<string | null>;
|
|
13
|
+
};
|
|
14
|
+
declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
|
15
|
+
avatarField: Component;
|
|
16
|
+
resolveAvatar: (key: string) => Promise<string | null>;
|
|
17
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
|
|
18
|
+
list: import('vue').CreateComponentPublicInstanceWithMixins<Readonly<{
|
|
19
|
+
picking?: boolean;
|
|
20
|
+
multiple?: boolean;
|
|
21
|
+
removable?: boolean;
|
|
22
|
+
filters?: boolean;
|
|
23
|
+
resolveAvatar?: (key: string) => Promise<string | null>;
|
|
24
|
+
}> & Readonly<{
|
|
25
|
+
onChosen?: ((admins: Admin[]) => any) | undefined;
|
|
26
|
+
onOpen?: ((admin: Admin) => any) | undefined;
|
|
27
|
+
onSelection?: ((admins: Admin[]) => any) | undefined;
|
|
28
|
+
onRemove?: ((admin: Admin) => any) | undefined;
|
|
29
|
+
}>, {
|
|
30
|
+
reload: () => Promise<void>;
|
|
31
|
+
chosen: () => {
|
|
32
|
+
[x: string]: unknown;
|
|
33
|
+
id: number;
|
|
34
|
+
name: string;
|
|
35
|
+
email: string;
|
|
36
|
+
avatar: string | null;
|
|
37
|
+
is_super: boolean;
|
|
38
|
+
is_active: boolean;
|
|
39
|
+
locale: string | null;
|
|
40
|
+
last_login_at: string | null;
|
|
41
|
+
created_at: string | null;
|
|
42
|
+
roles: {
|
|
43
|
+
id: number;
|
|
44
|
+
slug: string;
|
|
45
|
+
name: string;
|
|
46
|
+
}[];
|
|
47
|
+
}[];
|
|
48
|
+
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
49
|
+
chosen: (admins: Admin[]) => any;
|
|
50
|
+
open: (admin: Admin) => any;
|
|
51
|
+
selection: (admins: Admin[]) => any;
|
|
52
|
+
remove: (admin: Admin) => any;
|
|
53
|
+
}, import('vue').PublicProps, {
|
|
54
|
+
multiple: boolean;
|
|
55
|
+
picking: boolean;
|
|
56
|
+
removable: boolean;
|
|
57
|
+
filters: boolean;
|
|
58
|
+
resolveAvatar: (key: string) => Promise<string | null>;
|
|
59
|
+
}, false, {}, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, {}, HTMLDivElement, import('vue').ComponentProvideOptions, {
|
|
60
|
+
P: {};
|
|
61
|
+
B: {};
|
|
62
|
+
D: {};
|
|
63
|
+
C: {};
|
|
64
|
+
M: {};
|
|
65
|
+
Defaults: {};
|
|
66
|
+
}, Readonly<{
|
|
67
|
+
picking?: boolean;
|
|
68
|
+
multiple?: boolean;
|
|
69
|
+
removable?: boolean;
|
|
70
|
+
filters?: boolean;
|
|
71
|
+
resolveAvatar?: (key: string) => Promise<string | null>;
|
|
72
|
+
}> & Readonly<{
|
|
73
|
+
onChosen?: ((admins: Admin[]) => any) | undefined;
|
|
74
|
+
onOpen?: ((admin: Admin) => any) | undefined;
|
|
75
|
+
onSelection?: ((admins: Admin[]) => any) | undefined;
|
|
76
|
+
onRemove?: ((admin: Admin) => any) | undefined;
|
|
77
|
+
}>, {
|
|
78
|
+
reload: () => Promise<void>;
|
|
79
|
+
chosen: () => {
|
|
80
|
+
[x: string]: unknown;
|
|
81
|
+
id: number;
|
|
82
|
+
name: string;
|
|
83
|
+
email: string;
|
|
84
|
+
avatar: string | null;
|
|
85
|
+
is_super: boolean;
|
|
86
|
+
is_active: boolean;
|
|
87
|
+
locale: string | null;
|
|
88
|
+
last_login_at: string | null;
|
|
89
|
+
created_at: string | null;
|
|
90
|
+
roles: {
|
|
91
|
+
id: number;
|
|
92
|
+
slug: string;
|
|
93
|
+
name: string;
|
|
94
|
+
}[];
|
|
95
|
+
}[];
|
|
96
|
+
}, {}, {}, {}, {
|
|
97
|
+
multiple: boolean;
|
|
98
|
+
picking: boolean;
|
|
99
|
+
removable: boolean;
|
|
100
|
+
filters: boolean;
|
|
101
|
+
resolveAvatar: (key: string) => Promise<string | null>;
|
|
102
|
+
}> | null;
|
|
103
|
+
}, HTMLElement>;
|
|
104
|
+
export default _default;
|
package/dist/admins.d.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { AdminContext } from '@webx-ui/admin';
|
|
2
|
+
import { Admin, AdminInput, AdminPage, AdminQuery, Role } from './types';
|
|
3
|
+
export interface AdminsApi {
|
|
4
|
+
list(query?: AdminQuery): Promise<AdminPage>;
|
|
5
|
+
get(id: number): Promise<Admin>;
|
|
6
|
+
create(input: AdminInput): Promise<Admin>;
|
|
7
|
+
update(id: number, input: AdminInput): Promise<Admin>;
|
|
8
|
+
remove(id: number): Promise<void>;
|
|
9
|
+
roles(): Promise<Role[]>;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* The calls behind the administrators screen, and behind the picker that opens from code.
|
|
13
|
+
*
|
|
14
|
+
* Reading is separate from managing on the server, so a module that only wants to say who
|
|
15
|
+
* wrote something — or offer a list of people to assign work to — can use `list` and `roles`
|
|
16
|
+
* without being allowed anywhere near the rest.
|
|
17
|
+
*/
|
|
18
|
+
export declare function createAdminsApi(admin: AdminContext): AdminsApi;
|
package/dist/i18n.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Put this package's English under the panel's dictionary, once per panel.
|
|
3
|
+
*
|
|
4
|
+
* The plugin does this too, but a panel can use the administrators screen — or just the picker
|
|
5
|
+
* — without installing the sign-in plugin at all, and a screen showing `admins.title` instead
|
|
6
|
+
* of a word is not a thing to leave to chance.
|
|
7
|
+
*/
|
|
8
|
+
export declare function useAuthMessages(): void;
|
package/dist/index.d.ts
CHANGED
|
@@ -13,6 +13,12 @@ export interface AuthOptions {
|
|
|
13
13
|
* itself knows nothing about authentication — it holds the answer, not the question.
|
|
14
14
|
*/
|
|
15
15
|
export declare function auth(options?: AuthOptions): AdminPlugin;
|
|
16
|
+
export { admins, type AdminsOptions } from './module';
|
|
17
|
+
export { createAdminsApi, type AdminsApi } from './admins';
|
|
18
|
+
export { selectAdmin, selectAdmins, type AdminPickerOptions } from './selectAdmin';
|
|
19
|
+
export { default as WxAdminsPage } from './AdminsPage';
|
|
20
|
+
export { default as WxAdminList } from './AdminList';
|
|
21
|
+
export type { Admin, AdminInput, AdminPage, AdminQuery, AdminRole, Role } from './types';
|
|
16
22
|
export { createAuthSession, provideAuth, useAuth, authKey } from './session';
|
|
17
23
|
export type { AuthSession, Credentials } from './session';
|
|
18
24
|
export { default as WxLoginCard } from './LoginCard';
|