@webx-ui/module-auth 0.7.3 → 0.8.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/README.md CHANGED
@@ -66,6 +66,27 @@ Placed outside a panel, with no server to ask, the card falls back to the Englis
66
66
 
67
67
  `WxLoginCard` is exported for a panel that wants to place it itself.
68
68
 
69
+ ## The sections
70
+
71
+ Two of them, alongside the plugin:
72
+
73
+ ```ts
74
+ import { admins, connect } from '@webx-ui/module-auth'
75
+
76
+ createAdmin({ modules: [admins(), connect()] })
77
+ ```
78
+
79
+ `admins()` is the people, and two more views of the same section for whoever may see them:
80
+ **Agent calls** (`admins.audit`) — every tool call an agent made, narrowed by person, tool and
81
+ outcome — and **Connections** (`admins.manage`), the agents everybody has let in, with a
82
+ button that ends one.
83
+
84
+ `connect()` is the page that tells somebody how to connect their own agent: the address, a
85
+ button that copies it, three steps per client, one-click links for Cursor and VS Code, and
86
+ their own connections underneath. It carries no permission — whoever got into the panel may
87
+ connect an agent, and the agent cannot do anything they cannot. Both appear only where the
88
+ server reports them, so a panel with no agent server has no such entry.
89
+
69
90
  ## The session
70
91
 
71
92
  ```ts
@@ -53,10 +53,10 @@ declare const _default: import('vue').DefineComponent<__VLS_Props, {
53
53
  onSelection?: ((admins: Admin[]) => any) | undefined;
54
54
  onRemove?: ((admin: Admin) => any) | undefined;
55
55
  }>, {
56
+ filters: boolean;
56
57
  multiple: boolean;
57
58
  picking: boolean;
58
59
  removable: boolean;
59
- filters: boolean;
60
60
  resolveAvatar: (key: string) => Promise<string | null>;
61
61
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
62
62
  root: HTMLDivElement;
@@ -51,10 +51,10 @@ declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {
51
51
  selection: (admins: Admin[]) => any;
52
52
  remove: (admin: Admin) => any;
53
53
  }, import('vue').PublicProps, {
54
+ filters: boolean;
54
55
  multiple: boolean;
55
56
  picking: boolean;
56
57
  removable: boolean;
57
- filters: boolean;
58
58
  resolveAvatar: (key: string) => Promise<string | null>;
59
59
  }, false, {}, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, {
60
60
  root: HTMLDivElement;
@@ -96,10 +96,10 @@ declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {
96
96
  }[];
97
97
  }[];
98
98
  }, {}, {}, {}, {
99
+ filters: boolean;
99
100
  multiple: boolean;
100
101
  picking: boolean;
101
102
  removable: boolean;
102
- filters: boolean;
103
103
  resolveAvatar: (key: string) => Promise<string | null>;
104
104
  }> | null;
105
105
  }, any>;
@@ -1,23 +1,39 @@
1
1
  import { Component } from 'vue';
2
+ import { AdminsView } from './module';
2
3
  import { Admin } from './types';
3
4
  /**
4
- * The administrators section: the list, and the form over it.
5
+ * The administrators section: the list, the form over it, the trail of what their agents did,
6
+ * and the agents themselves.
5
7
  *
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.
8
+ * A dialog rather than a second route for the form. Editing somebody is half a dozen fields,
9
+ * and a screen that takes over the page for that loses the list you were reading — which is
10
+ * where you decide who to open next.
11
+ *
12
+ * The calls and the connections are further views of the same section rather than sections of
13
+ * their own: "who did what" is a question about these people, whether a hand or a program was
14
+ * at the other end. A route each rather than panels of one, because each has its own paging
15
+ * and filters, and a view that quietly resets both when you come back to it is worse than a
16
+ * second address. The calls are behind `admins.audit`, the permission the sign-in trail is
17
+ * behind; everybody's connections are behind `admins.manage`, the one that is about other
18
+ * people's accounts.
9
19
  *
10
20
  * The heading and `Add` used to live inside the card, which made this the one section of the
11
21
  * panel with no line of its own at the top. They stand outside it now, where every other list
12
22
  * keeps them (§19).
13
23
  */
14
24
  type __VLS_Props = {
25
+ /** The section's own path, for the address of the second view. */
26
+ base?: string;
27
+ /** Which view is open. */
28
+ current?: AdminsView;
15
29
  avatarField?: Component;
16
30
  resolveAvatar?: (key: string) => Promise<string | null>;
17
31
  };
18
32
  declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
33
+ base: string;
19
34
  avatarField: Component;
20
35
  resolveAvatar: (key: string) => Promise<string | null>;
36
+ current: AdminsView;
21
37
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
22
38
  list: import('vue').CreateComponentPublicInstanceWithMixins<Readonly<{
23
39
  picking?: boolean;
@@ -55,10 +71,10 @@ declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {
55
71
  selection: (admins: Admin[]) => any;
56
72
  remove: (admin: Admin) => any;
57
73
  }, import('vue').PublicProps, {
74
+ filters: boolean;
58
75
  multiple: boolean;
59
76
  picking: boolean;
60
77
  removable: boolean;
61
- filters: boolean;
62
78
  resolveAvatar: (key: string) => Promise<string | null>;
63
79
  }, false, {}, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, {
64
80
  root: HTMLDivElement;
@@ -100,10 +116,10 @@ declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {
100
116
  }[];
101
117
  }[];
102
118
  }, {}, {}, {}, {
119
+ filters: boolean;
103
120
  multiple: boolean;
104
121
  picking: boolean;
105
122
  removable: boolean;
106
- filters: boolean;
107
123
  resolveAvatar: (key: string) => Promise<string | null>;
108
124
  }> | null;
109
125
  }, HTMLDivElement>;
@@ -0,0 +1,6 @@
1
+ declare const _default: import('vue').DefineComponent<{}, {
2
+ reload: () => Promise<void>;
3
+ }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {
4
+ root: HTMLDivElement;
5
+ }, HTMLDivElement>;
6
+ export default _default;
@@ -0,0 +1,2 @@
1
+ declare const _default: import('vue').DefineComponent<{}, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, HTMLDivElement>;
2
+ export default _default;
@@ -0,0 +1,28 @@
1
+ import { ConnectionScope } from './types';
2
+ /**
3
+ * The agents somebody let in, and the one button that ends one.
4
+ *
5
+ * A row is who is connected, on what terms, and when it was last heard from. The terms are
6
+ * the part worth reading: "read only" is not a scope the client asked for, it is what the
7
+ * person chose on the consent screen, and it outranks their own permissions.
8
+ *
9
+ * Ending a connection is not paged, sorted or searched, and the list is not either. A person
10
+ * has one agent, or three; a table of them that needed a search would mean something else had
11
+ * gone wrong.
12
+ *
13
+ * A connection that was ended stays in the list, greyed, because it is what the call log
14
+ * points at — the rows an agent left behind outlive the connection that made them.
15
+ */
16
+ type __VLS_Props = {
17
+ /** Whose connections: this person's, or everybody's (`admins.manage`). */
18
+ scope?: ConnectionScope;
19
+ };
20
+ declare function load(): Promise<void>;
21
+ declare const _default: import('vue').DefineComponent<__VLS_Props, {
22
+ reload: typeof load;
23
+ }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
24
+ scope: ConnectionScope;
25
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
26
+ root: HTMLDivElement;
27
+ }, HTMLDivElement>;
28
+ export default _default;
package/dist/admins.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { AdminContext } from '@webx-ui/module-admin';
2
- import { Admin, AdminInput, AdminPage, AdminQuery, Role } from './types';
2
+ import { Admin, AdminInput, AdminPage, AdminQuery, AgentCallPage, AgentCallQuery, Role } from './types';
3
3
  export interface AdminsApi {
4
4
  list(query?: AdminQuery): Promise<AdminPage>;
5
5
  get(id: number): Promise<Admin>;
@@ -7,6 +7,8 @@ export interface AdminsApi {
7
7
  update(id: number, input: AdminInput): Promise<Admin>;
8
8
  remove(id: number): Promise<void>;
9
9
  roles(): Promise<Role[]>;
10
+ /** What agents did, newest first. Behind `admins.audit`. */
11
+ calls(query?: AgentCallQuery): Promise<AgentCallPage>;
10
12
  }
11
13
  /**
12
14
  * The calls behind the administrators screen, and behind the picker that opens from code.
@@ -0,0 +1,17 @@
1
+ import { AdminContext } from '@webx-ui/module-admin';
2
+ import { Connection, ConnectionScope, Connections } from './types';
3
+ export interface ConnectionsApi {
4
+ /** The agents connected — this person's, or everybody's for whoever may see them. */
5
+ list(scope?: ConnectionScope): Promise<Connections>;
6
+ /** End one. The row survives; the tokens behind it do not. */
7
+ disconnect(id: number): Promise<Connection>;
8
+ }
9
+ /**
10
+ * The two calls behind the connections list.
11
+ *
12
+ * Separate from the administrators API because the audiences are: everybody signed in reads
13
+ * their own connections and ends them, and nothing about that is managing other people's
14
+ * accounts. The server decides which list it hands back — the scope here is a request, not a
15
+ * claim.
16
+ */
17
+ export declare function createConnectionsApi(admin: AdminContext): ConnectionsApi;
package/dist/index.d.ts CHANGED
@@ -28,12 +28,16 @@ export interface AuthOptions {
28
28
  * itself knows nothing about authentication — it holds the answer, not the question.
29
29
  */
30
30
  export declare function auth(options?: AuthOptions): AdminPlugin;
31
- export { admins, type AdminsOptions } from './module';
31
+ export { admins, connect, type AdminsOptions, type AdminsView, type ConnectOptions } from './module';
32
32
  export { createAdminsApi, type AdminsApi } from './admins';
33
+ export { createConnectionsApi, type ConnectionsApi } from './connections';
33
34
  export { selectAdmin, selectAdmins, type AdminPickerOptions } from './selectAdmin';
34
35
  export { default as WxAdminsPage } from './AdminsPage';
35
36
  export { default as WxAdminList } from './AdminList';
36
- export type { Admin, AdminInput, AdminPage, AdminQuery, AdminRole, Role } from './types';
37
+ export { default as WxAgentCallList } from './CallList';
38
+ export { default as WxConnectionList } from './ConnectionList';
39
+ export { default as WxConnectPage } from './ConnectPage';
40
+ export type { Admin, AdminInput, AdminPage, AdminQuery, AdminRole, AgentCall, AgentCallFilters, AgentCallOutcome, AgentCallPage, AgentCallQuery, Connection, ConnectionScope, Connections, Role, } from './types';
37
41
  export { createAuthSession, provideAuth, useAuth, authKey, avatarFieldKey, avatarResolverKey, type ProfileInput, } from './session';
38
42
  export { default as WxProfileDialog } from './ProfileDialog';
39
43
  export type { AuthSession, AvatarResolver, Credentials } from './session';