@crossauth/sveltekit 1.1.1 → 1.1.2
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/index.d.ts +4 -4
- package/dist/sveltekitadminclientendpoints.d.ts +19 -19
- package/dist/sveltekitadminclientendpoints.js +3 -3
- package/dist/sveltekitadminendpoints.d.ts +102 -74
- package/dist/sveltekitadminendpoints.js +10 -0
- package/dist/sveltekitoauthserver.d.ts +7 -7
- package/dist/sveltekitoauthserver.js +1 -1
- package/dist/sveltekitsharedclientendpoints.d.ts +33 -26
- package/dist/sveltekitsharedclientendpoints.js +8 -3
- package/dist/sveltekituserclientendpoints.d.ts +19 -19
- package/dist/sveltekituserclientendpoints.js +3 -3
- package/dist/sveltekituserendpoints.d.ts +214 -108
- package/dist/sveltekituserendpoints.js +23 -0
- package/dist/tests/testshared.d.ts +2 -2
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
export { SvelteKitSessionServer, type Header } from './sveltekitsession';
|
|
2
2
|
export type { SvelteKitSessionServerOptions } from './sveltekitsession';
|
|
3
|
-
export type {
|
|
4
|
-
export type {
|
|
3
|
+
export type { LoginPageData, LoginActionData, LogoutPageData, LogoutActionData, SignupPageData, SignupActionData, ConfigureFactor2PageData, ConfigureFactor2ActionData, VerifyEmailPageData, RequestPasswordResetPageData, RequestPasswordActionData, ResetPasswordPageData, ResetPasswordActionData, RequestFactor2PageData, RequestFactor2ActionData, ChangePasswordPageData, ChangePasswordActionData, ChangeFactor2PageData, ChangeFactor2ActionData, DeleteUserPageData, DeleteUserActionData, UpdateUserPageData, UpdateUserActionData, } from './sveltekituserendpoints';
|
|
4
|
+
export type { SearchUsersPageData, SearchUsersActionData, AdminUpdateUserPageData, AdminUpdateUserActionData, AdminCreateUserPageData, AdminCreateUserActionData, AdminDeleteUserPageData, AdminDeleteUserActionData, AdminChangePasswordPageData, AdminChangePasswordActionData, } from './sveltekitadminendpoints';
|
|
5
5
|
export { SvelteKitServer } from './sveltekitserver';
|
|
6
6
|
export type { SvelteKitServerOptions, Resolver, SveltekitEndpoint } from './sveltekitserver';
|
|
7
7
|
import type { User, ApiKey } from '@crossauth/common';
|
|
8
8
|
export { JsonOrFormData } from './utils';
|
|
9
9
|
export {} from './sveltekitoauthserver';
|
|
10
10
|
export { SvelteKitAuthorizationServer } from './sveltekitoauthserver';
|
|
11
|
-
export type { AuthorizeQueryType, ReturnBase, AuthorizePageData,
|
|
11
|
+
export type { AuthorizeQueryType, ReturnBase, AuthorizePageData, AuthorizeActionData, DevicePageData, DeviceActionData, MfaChallengeBodyType, MfaChallengeReturn, SvelteKitAuthorizationServerOptions } from './sveltekitoauthserver';
|
|
12
12
|
export { SvelteKitOAuthClient } from './sveltekitoauthclient';
|
|
13
13
|
export type { SvelteKitErrorFn, SvelteKitOAuthClientOptions, AuthorizationCodeFlowReturn, TokenReturn, RedirectUriReturn, } from './sveltekitoauthclient';
|
|
14
14
|
export { SvelteKitOAuthResourceServer } from './sveltekitresserver';
|
|
15
15
|
export type { SvelteKitOAuthResourceServerOptions } from './sveltekitresserver';
|
|
16
16
|
export { SvelteKitSharedClientEndpoints, defaultClientSearchFn } from './sveltekitsharedclientendpoints';
|
|
17
|
-
export type { SearchClientsPageData, UpdateClientPageData,
|
|
17
|
+
export type { BasePageData, SearchClientsPageData, UpdateClientPageData, UpdateClientActionData, CreateClientPageData, CreateClientActionData, DeleteClientPageData, DeleteClientActionData, } from './sveltekitsharedclientendpoints';
|
|
18
18
|
export { SvelteKitUserClientEndpoints } from './sveltekituserclientendpoints';
|
|
19
19
|
export { SvelteKitAdminClientEndpoints } from './sveltekitadminclientendpoints';
|
|
20
20
|
export { SvelteKitSessionAdapter } from './sveltekitsessionadapter';
|
|
@@ -2,7 +2,7 @@ import { SvelteKitSessionServer } from './sveltekitsession';
|
|
|
2
2
|
import type { SvelteKitSessionServerOptions } from './sveltekitsession';
|
|
3
3
|
import type { RequestEvent } from '@sveltejs/kit';
|
|
4
4
|
import { SvelteKitSharedClientEndpoints } from './sveltekitsharedclientendpoints';
|
|
5
|
-
import type { SearchClientsPageData, UpdateClientPageData,
|
|
5
|
+
import type { SearchClientsPageData, UpdateClientPageData, UpdateClientActionData, DeleteClientPageData, DeleteClientActionData } from './sveltekitsharedclientendpoints';
|
|
6
6
|
/**
|
|
7
7
|
* Endpoints for manipulating the OAuth client table, for use by admins.
|
|
8
8
|
*
|
|
@@ -23,13 +23,13 @@ import type { SearchClientsPageData, UpdateClientPageData, UpdateClientFormData,
|
|
|
23
23
|
* | searchClientsEndpoint | Returns a paginated set of clients or those matching search | See {@link SearchClientsPageData} | *Not provided* | | |
|
|
24
24
|
* | -------------------------- | ----------------------------------------------------------- | -------------------------------------------------------------------------------- | ---------------------------------------------------------------- | ---------------------------------------------------------------- | --------- |
|
|
25
25
|
* | updateClientEndpoint | Updates a client | See {@link UpdateClientPageData} | `default`: | | |
|
|
26
|
-
* | | | | See {@link
|
|
26
|
+
* | | | | See {@link UpdateClientActionData} | See {@link SvelteKitSharedClientEndpoints.updateClient_internal} | client_id |
|
|
27
27
|
* | -------------------------- | ----------------------------------------------------------- | -------------------------------------------------------------------------------- | ---------------------------------------------------------------- | ---------------------------------------------------------------- | --------- |
|
|
28
28
|
* | createClientEndpoint | Creates a new client | See {@link CreateClientPageData} | `default`: | | |
|
|
29
|
-
* | | | | See {@link
|
|
29
|
+
* | | | | See {@link CreateClientActionData} | See {@link SvelteKitSharedClientEndpoints.createClient_internal} | client_id |
|
|
30
30
|
* | -------------------------- | ----------------------------------------------------------- | -------------------------------------------------------------------------------- | ---------------------------------------------------------------- | ---------------------------------------------------------------- | --------- |
|
|
31
31
|
* | deleteClientEndpoint | Deletes a client | See {@link DeleteClientPageData} | `default`: | | |
|
|
32
|
-
* | | | | See {@link
|
|
32
|
+
* | | | | See {@link DeleteClientActionData} | See {@link SvelteKitSharedClientEndpoints.deleteClient_internal} | client_id |
|
|
33
33
|
* | -------------------------- | ----------------------------------------------------------- | -------------------------------------------------------------------------------- | ---------------------------------------------------------------- | ---------------------------------------------------------------- | --------- |
|
|
34
34
|
*/
|
|
35
35
|
export declare class SvelteKitAdminClientEndpoints extends SvelteKitSharedClientEndpoints {
|
|
@@ -50,7 +50,7 @@ export declare class SvelteKitAdminClientEndpoints extends SvelteKitSharedClient
|
|
|
50
50
|
/**
|
|
51
51
|
* See {@link SvelteKitSharedClientEndpoints.updateClient_internal}
|
|
52
52
|
*/
|
|
53
|
-
updateClient(event: RequestEvent): Promise<
|
|
53
|
+
updateClient(event: RequestEvent): Promise<UpdateClientActionData>;
|
|
54
54
|
/**
|
|
55
55
|
* See {@link SvelteKitSharedClientEndpoints.emptyClient_internal}
|
|
56
56
|
*/
|
|
@@ -58,7 +58,7 @@ export declare class SvelteKitAdminClientEndpoints extends SvelteKitSharedClient
|
|
|
58
58
|
/**
|
|
59
59
|
* See {@link SvelteKitSharedClientEndpoints.createClient_internal}
|
|
60
60
|
*/
|
|
61
|
-
createClient(event: RequestEvent): Promise<
|
|
61
|
+
createClient(event: RequestEvent): Promise<UpdateClientActionData>;
|
|
62
62
|
/**
|
|
63
63
|
* See {@link SvelteKitSharedClientEndpoints.loadDeleteClient_internal}
|
|
64
64
|
*/
|
|
@@ -66,7 +66,7 @@ export declare class SvelteKitAdminClientEndpoints extends SvelteKitSharedClient
|
|
|
66
66
|
/**
|
|
67
67
|
* See {@link SvelteKitSharedClientEndpoints.deleteClient_internal}
|
|
68
68
|
*/
|
|
69
|
-
deleteClient(event: RequestEvent): Promise<
|
|
69
|
+
deleteClient(event: RequestEvent): Promise<DeleteClientActionData>;
|
|
70
70
|
/**
|
|
71
71
|
* See class documentation.
|
|
72
72
|
*/
|
|
@@ -92,22 +92,22 @@ export declare class SvelteKitAdminClientEndpoints extends SvelteKitSharedClient
|
|
|
92
92
|
*/
|
|
93
93
|
readonly updateClientEndpoint: {
|
|
94
94
|
load: (event: RequestEvent) => Promise<{
|
|
95
|
-
ok
|
|
95
|
+
ok?: boolean | undefined;
|
|
96
96
|
client?: import("@crossauth/common").OAuthClient | undefined;
|
|
97
97
|
client_id?: string | undefined;
|
|
98
98
|
clientUsername?: string | undefined;
|
|
99
99
|
error?: string | undefined;
|
|
100
100
|
errorCode?: number | undefined;
|
|
101
101
|
errorCodeName?: string | undefined;
|
|
102
|
-
validFlows
|
|
103
|
-
valid_flowNames
|
|
102
|
+
validFlows?: string[] | undefined;
|
|
103
|
+
valid_flowNames?: {
|
|
104
104
|
[key: string]: string;
|
|
105
|
-
};
|
|
105
|
+
} | undefined;
|
|
106
106
|
user: import("@crossauth/common").User | undefined;
|
|
107
107
|
csrfToken: string | undefined;
|
|
108
108
|
}>;
|
|
109
109
|
actions: {
|
|
110
|
-
default: (event: RequestEvent) => Promise<
|
|
110
|
+
default: (event: RequestEvent) => Promise<UpdateClientActionData>;
|
|
111
111
|
};
|
|
112
112
|
};
|
|
113
113
|
/**
|
|
@@ -115,22 +115,22 @@ export declare class SvelteKitAdminClientEndpoints extends SvelteKitSharedClient
|
|
|
115
115
|
*/
|
|
116
116
|
readonly createClientEndpoint: {
|
|
117
117
|
load: (event: RequestEvent) => Promise<{
|
|
118
|
-
ok
|
|
118
|
+
ok?: boolean | undefined;
|
|
119
119
|
client?: import("@crossauth/common").OAuthClient | undefined;
|
|
120
120
|
client_id?: string | undefined;
|
|
121
121
|
clientUsername?: string | undefined;
|
|
122
122
|
error?: string | undefined;
|
|
123
123
|
errorCode?: number | undefined;
|
|
124
124
|
errorCodeName?: string | undefined;
|
|
125
|
-
validFlows
|
|
126
|
-
valid_flowNames
|
|
125
|
+
validFlows?: string[] | undefined;
|
|
126
|
+
valid_flowNames?: {
|
|
127
127
|
[key: string]: string;
|
|
128
|
-
};
|
|
128
|
+
} | undefined;
|
|
129
129
|
user: import("@crossauth/common").User | undefined;
|
|
130
130
|
csrfToken: string | undefined;
|
|
131
131
|
}>;
|
|
132
132
|
actions: {
|
|
133
|
-
default: (event: RequestEvent) => Promise<
|
|
133
|
+
default: (event: RequestEvent) => Promise<UpdateClientActionData>;
|
|
134
134
|
};
|
|
135
135
|
};
|
|
136
136
|
/**
|
|
@@ -138,7 +138,7 @@ export declare class SvelteKitAdminClientEndpoints extends SvelteKitSharedClient
|
|
|
138
138
|
*/
|
|
139
139
|
readonly deleteClientEndpoint: {
|
|
140
140
|
load: (event: RequestEvent) => Promise<{
|
|
141
|
-
ok
|
|
141
|
+
ok?: boolean | undefined;
|
|
142
142
|
client?: import("@crossauth/common").OAuthClient | undefined;
|
|
143
143
|
client_id?: string | undefined;
|
|
144
144
|
clientUsername?: string | undefined;
|
|
@@ -149,7 +149,7 @@ export declare class SvelteKitAdminClientEndpoints extends SvelteKitSharedClient
|
|
|
149
149
|
csrfToken: string | undefined;
|
|
150
150
|
}>;
|
|
151
151
|
actions: {
|
|
152
|
-
default: (event: RequestEvent) => Promise<
|
|
152
|
+
default: (event: RequestEvent) => Promise<DeleteClientActionData>;
|
|
153
153
|
};
|
|
154
154
|
};
|
|
155
155
|
}
|
|
@@ -26,13 +26,13 @@ import { SvelteKitSharedClientEndpoints } from './sveltekitsharedclientendpoints
|
|
|
26
26
|
* | searchClientsEndpoint | Returns a paginated set of clients or those matching search | See {@link SearchClientsPageData} | *Not provided* | | |
|
|
27
27
|
* | -------------------------- | ----------------------------------------------------------- | -------------------------------------------------------------------------------- | ---------------------------------------------------------------- | ---------------------------------------------------------------- | --------- |
|
|
28
28
|
* | updateClientEndpoint | Updates a client | See {@link UpdateClientPageData} | `default`: | | |
|
|
29
|
-
* | | | | See {@link
|
|
29
|
+
* | | | | See {@link UpdateClientActionData} | See {@link SvelteKitSharedClientEndpoints.updateClient_internal} | client_id |
|
|
30
30
|
* | -------------------------- | ----------------------------------------------------------- | -------------------------------------------------------------------------------- | ---------------------------------------------------------------- | ---------------------------------------------------------------- | --------- |
|
|
31
31
|
* | createClientEndpoint | Creates a new client | See {@link CreateClientPageData} | `default`: | | |
|
|
32
|
-
* | | | | See {@link
|
|
32
|
+
* | | | | See {@link CreateClientActionData} | See {@link SvelteKitSharedClientEndpoints.createClient_internal} | client_id |
|
|
33
33
|
* | -------------------------- | ----------------------------------------------------------- | -------------------------------------------------------------------------------- | ---------------------------------------------------------------- | ---------------------------------------------------------------- | --------- |
|
|
34
34
|
* | deleteClientEndpoint | Deletes a client | See {@link DeleteClientPageData} | `default`: | | |
|
|
35
|
-
* | | | | See {@link
|
|
35
|
+
* | | | | See {@link DeleteClientActionData} | See {@link SvelteKitSharedClientEndpoints.deleteClient_internal} | client_id |
|
|
36
36
|
* | -------------------------- | ----------------------------------------------------------- | -------------------------------------------------------------------------------- | ---------------------------------------------------------------- | ---------------------------------------------------------------- | --------- |
|
|
37
37
|
*/
|
|
38
38
|
export class SvelteKitAdminClientEndpoints extends SvelteKitSharedClientEndpoints {
|
|
@@ -1,15 +1,33 @@
|
|
|
1
1
|
import { SvelteKitSessionServer } from './sveltekitsession';
|
|
2
2
|
import type { SvelteKitSessionServerOptions } from './sveltekitsession';
|
|
3
3
|
import type { User, UserInputFields } from '@crossauth/common';
|
|
4
|
-
import { ErrorCode } from '@crossauth/common';
|
|
5
4
|
import type { RequestEvent } from '@sveltejs/kit';
|
|
5
|
+
/**
|
|
6
|
+
* Return type for {@link SvelteKitAdminEndpoints.updateUser}
|
|
7
|
+
* {@link SvelteKitAdminEndpoints.updateUserEndpoint} load.
|
|
8
|
+
*
|
|
9
|
+
* See class documentation for {@link SvelteKitUserEndpoints} for more details.
|
|
10
|
+
*/
|
|
11
|
+
export interface AdminUpdateUserPageData {
|
|
12
|
+
user?: User;
|
|
13
|
+
csrfToken?: string;
|
|
14
|
+
error?: string;
|
|
15
|
+
errorCode?: number;
|
|
16
|
+
errorCodeName?: string;
|
|
17
|
+
allowedFactor2: {
|
|
18
|
+
name: string;
|
|
19
|
+
friendlyName: string;
|
|
20
|
+
configurable: boolean;
|
|
21
|
+
}[];
|
|
22
|
+
editUser?: User;
|
|
23
|
+
}
|
|
6
24
|
/**
|
|
7
25
|
* Return type for {@link SvelteKitAdminEndpoints.updateUser}
|
|
8
26
|
* {@link SvelteKitAdminEndpoints.updateUserEndpoint} action.
|
|
9
27
|
*
|
|
10
28
|
* See class documentation for {@link SvelteKitUserEndpoints} for more details.
|
|
11
29
|
*/
|
|
12
|
-
export
|
|
30
|
+
export interface AdminUpdateUserActionData {
|
|
13
31
|
user?: User;
|
|
14
32
|
error?: string;
|
|
15
33
|
errorCode?: number;
|
|
@@ -19,14 +37,27 @@ export type AdminUpdateUserReturn = {
|
|
|
19
37
|
};
|
|
20
38
|
ok: boolean;
|
|
21
39
|
info?: string;
|
|
22
|
-
}
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Return type for {@link SvelteKitAdminEndpoints.changePassword}
|
|
43
|
+
* {@link SvelteKitAdminEndpoints.changePasswordEndpoint} load.
|
|
44
|
+
*
|
|
45
|
+
* See class documentation for {@link SvelteKitUserEndpoints} for more details.
|
|
46
|
+
*/
|
|
47
|
+
export interface AdminChangePasswordPageData {
|
|
48
|
+
user?: User;
|
|
49
|
+
csrfToken?: string;
|
|
50
|
+
error?: string;
|
|
51
|
+
errorCode?: number;
|
|
52
|
+
errorCodeName?: string;
|
|
53
|
+
}
|
|
23
54
|
/**
|
|
24
55
|
* Return type for {@link SvelteKitAdminEndpoints.changePassword}
|
|
25
56
|
* {@link SvelteKitAdminEndpoints.changePasswordEndpoint} action.
|
|
26
57
|
*
|
|
27
58
|
* See class documentation for {@link SvelteKitUserEndpoints} for more details.
|
|
28
59
|
*/
|
|
29
|
-
export
|
|
60
|
+
export interface AdminChangePasswordActionData {
|
|
30
61
|
user?: User;
|
|
31
62
|
error?: string;
|
|
32
63
|
errorCode?: number;
|
|
@@ -35,14 +66,32 @@ export type AdminChangePasswordReturn = {
|
|
|
35
66
|
[key: string]: string;
|
|
36
67
|
};
|
|
37
68
|
ok: boolean;
|
|
38
|
-
}
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Return type for {@link SvelteKitAdminEndpoints.createUser}
|
|
72
|
+
* {@link SvelteKitAdminEndpoints.createUserEndpoint} load.
|
|
73
|
+
*
|
|
74
|
+
* See class documentation for {@link SvelteKitUserEndpoints} for more details.
|
|
75
|
+
*/
|
|
76
|
+
export interface AdminCreateUserPageData {
|
|
77
|
+
user?: User;
|
|
78
|
+
csrfToken?: string;
|
|
79
|
+
error?: string;
|
|
80
|
+
errorCode?: number;
|
|
81
|
+
errorCodeName?: string;
|
|
82
|
+
allowedFactor2: {
|
|
83
|
+
name: string;
|
|
84
|
+
friendlyName: string;
|
|
85
|
+
configurable: boolean;
|
|
86
|
+
}[];
|
|
87
|
+
}
|
|
39
88
|
/**
|
|
40
89
|
* Return type for {@link SvelteKitAdminEndpoints.createUser}
|
|
41
90
|
* {@link SvelteKitAdminEndpoints.createUserEndpoint} action.
|
|
42
91
|
*
|
|
43
92
|
* See class documentation for {@link SvelteKitUserEndpoints} for more details.
|
|
44
93
|
*/
|
|
45
|
-
export
|
|
94
|
+
export interface AdminCreateUserActionData {
|
|
46
95
|
user?: UserInputFields;
|
|
47
96
|
factor2Data?: {
|
|
48
97
|
userData: {
|
|
@@ -59,27 +108,55 @@ export type AdminCreateUserReturn = {
|
|
|
59
108
|
[key: string]: string | undefined;
|
|
60
109
|
};
|
|
61
110
|
ok: boolean;
|
|
62
|
-
}
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Return type for {@link SvelteKitAdminEndpoints.deleteUser}
|
|
114
|
+
* {@link SvelteKitAdminEndpoints.deleteUserEndpoint} load.
|
|
115
|
+
*
|
|
116
|
+
* See class documentation for {@link SvelteKitUserEndpoints} for more details.
|
|
117
|
+
*/
|
|
118
|
+
export interface AdminDeleteUserPageData {
|
|
119
|
+
user?: User;
|
|
120
|
+
csrfToken?: string;
|
|
121
|
+
error?: string;
|
|
122
|
+
errorCode?: number;
|
|
123
|
+
errorCodeName?: string;
|
|
124
|
+
username?: string;
|
|
125
|
+
}
|
|
63
126
|
/**
|
|
64
127
|
* Return type for {@link SvelteKitAdminEndpoints.deleteUser}
|
|
65
128
|
* {@link SvelteKitAdminEndpoints.deleteUserEndpoint} action.
|
|
66
129
|
*
|
|
67
130
|
* See class documentation for {@link SvelteKitUserEndpoints} for more details.
|
|
68
131
|
*/
|
|
69
|
-
export
|
|
132
|
+
export interface AdminDeleteUserActionData {
|
|
70
133
|
user?: User;
|
|
71
134
|
error?: string;
|
|
72
135
|
errorCode?: number;
|
|
73
136
|
errorCodeName?: string;
|
|
74
137
|
ok: boolean;
|
|
75
|
-
}
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* Return type for {@link SvelteKitAdminEndpoints.searchUsers}
|
|
141
|
+
* {@link SvelteKitAdminEndpoints.searchUsersEndpoint} load.
|
|
142
|
+
*
|
|
143
|
+
* See class documentation for {@link SvelteKitUserEndpoints} for more details.
|
|
144
|
+
*/
|
|
145
|
+
export interface SearchUsersPageData {
|
|
146
|
+
user?: User;
|
|
147
|
+
editUser?: User;
|
|
148
|
+
csrfToken?: string;
|
|
149
|
+
error?: string;
|
|
150
|
+
errorCode?: number;
|
|
151
|
+
errorCodeName?: string;
|
|
152
|
+
}
|
|
76
153
|
/**
|
|
77
154
|
* Return type for {@link SvelteKitAdminEndpoints.searchUsers}
|
|
78
155
|
* {@link SvelteKitAdminEndpoints.searchUsersEndpoint} action.
|
|
79
156
|
*
|
|
80
157
|
* See class documentation for {@link SvelteKitUserEndpoints} for more details.
|
|
81
158
|
*/
|
|
82
|
-
export
|
|
159
|
+
export interface SearchUsersActionData {
|
|
83
160
|
ok: boolean;
|
|
84
161
|
users?: User[];
|
|
85
162
|
skip: number;
|
|
@@ -90,7 +167,7 @@ export type SearchUsersReturn = {
|
|
|
90
167
|
errorCodeName?: string;
|
|
91
168
|
hasPrevious: boolean;
|
|
92
169
|
hasNext: boolean;
|
|
93
|
-
}
|
|
170
|
+
}
|
|
94
171
|
/**
|
|
95
172
|
* Provides endpoints for users to login, logout and maintain their
|
|
96
173
|
* own account.
|
|
@@ -181,7 +258,7 @@ export declare class SvelteKitAdminEndpoints {
|
|
|
181
258
|
* - `hasPrevious` whether there are more results before the ones that
|
|
182
259
|
* were returned.
|
|
183
260
|
*/
|
|
184
|
-
searchUsers(event: RequestEvent, searchTerm?: string, skip?: number, take?: number): Promise<
|
|
261
|
+
searchUsers(event: RequestEvent, searchTerm?: string, skip?: number, take?: number): Promise<SearchUsersActionData>;
|
|
185
262
|
/**
|
|
186
263
|
* Call this to update a user's details.
|
|
187
264
|
*
|
|
@@ -213,7 +290,7 @@ export declare class SvelteKitAdminEndpoints {
|
|
|
213
290
|
* - `exception` a {@link @crossauth/common!CrossauthError} if an
|
|
214
291
|
* exception was raised
|
|
215
292
|
*/
|
|
216
|
-
updateUser(user: User, event: RequestEvent): Promise<
|
|
293
|
+
updateUser(user: User, event: RequestEvent): Promise<AdminUpdateUserActionData>;
|
|
217
294
|
/**
|
|
218
295
|
* Call this with POST data to change the logged-in user's password
|
|
219
296
|
*
|
|
@@ -233,7 +310,7 @@ export declare class SvelteKitAdminEndpoints {
|
|
|
233
310
|
* exception was raised
|
|
234
311
|
* - `formData` the form fields extracted from the request
|
|
235
312
|
*/
|
|
236
|
-
changePassword(user: User, event: RequestEvent): Promise<
|
|
313
|
+
changePassword(user: User, event: RequestEvent): Promise<AdminChangePasswordActionData>;
|
|
237
314
|
/**
|
|
238
315
|
* Creates an account.
|
|
239
316
|
*
|
|
@@ -279,7 +356,7 @@ export declare class SvelteKitAdminEndpoints {
|
|
|
279
356
|
* - `emailVerificationRequired` if true, the user needs to click on
|
|
280
357
|
* the link emailed to them to complete signup.
|
|
281
358
|
*/
|
|
282
|
-
createUser(event: RequestEvent): Promise<
|
|
359
|
+
createUser(event: RequestEvent): Promise<AdminCreateUserActionData>;
|
|
283
360
|
/**
|
|
284
361
|
* Call this to delete the logged-in user
|
|
285
362
|
*
|
|
@@ -293,86 +370,37 @@ export declare class SvelteKitAdminEndpoints {
|
|
|
293
370
|
* - `exception` a {@link @crossauth/common!CrossauthError} if an
|
|
294
371
|
* exception was raised
|
|
295
372
|
*/
|
|
296
|
-
deleteUser(event: RequestEvent): Promise<
|
|
373
|
+
deleteUser(event: RequestEvent): Promise<AdminDeleteUserActionData>;
|
|
297
374
|
baseEndpoint(event: RequestEvent): {
|
|
298
375
|
user: User | undefined;
|
|
299
376
|
csrfToken: string | undefined;
|
|
300
377
|
};
|
|
301
378
|
readonly searchUsersEndpoint: {
|
|
302
|
-
load: (event: RequestEvent) => Promise<
|
|
303
|
-
ok: boolean;
|
|
304
|
-
users?: User[] | undefined;
|
|
305
|
-
skip: number;
|
|
306
|
-
take: number;
|
|
307
|
-
search?: string | undefined;
|
|
308
|
-
error?: string | undefined;
|
|
309
|
-
errorCode?: number | undefined;
|
|
310
|
-
errorCodeName?: string | undefined;
|
|
311
|
-
hasPrevious: boolean;
|
|
312
|
-
hasNext: boolean;
|
|
313
|
-
user: User | undefined;
|
|
314
|
-
csrfToken: string | undefined;
|
|
315
|
-
}>;
|
|
379
|
+
load: (event: RequestEvent) => Promise<SearchUsersPageData>;
|
|
316
380
|
};
|
|
317
381
|
private getUserFromParam;
|
|
318
382
|
readonly updateUserEndpoint: {
|
|
319
383
|
actions: {
|
|
320
|
-
default: (event: RequestEvent) => Promise<
|
|
384
|
+
default: (event: RequestEvent) => Promise<AdminUpdateUserActionData>;
|
|
321
385
|
};
|
|
322
|
-
load: (event: RequestEvent) => Promise<
|
|
323
|
-
user: User | undefined;
|
|
324
|
-
csrfToken: string | undefined;
|
|
325
|
-
allowedFactor2: {
|
|
326
|
-
name: string;
|
|
327
|
-
friendlyName: string;
|
|
328
|
-
configurable: boolean;
|
|
329
|
-
}[];
|
|
330
|
-
editUser: User | undefined;
|
|
331
|
-
}>;
|
|
386
|
+
load: (event: RequestEvent) => Promise<AdminUpdateUserPageData>;
|
|
332
387
|
};
|
|
333
388
|
readonly changePasswordEndpoint: {
|
|
334
389
|
actions: {
|
|
335
|
-
default: (event: RequestEvent) => Promise<
|
|
390
|
+
default: (event: RequestEvent) => Promise<AdminChangePasswordActionData>;
|
|
336
391
|
};
|
|
337
|
-
load: (event: RequestEvent) => Promise<
|
|
338
|
-
user: User | undefined;
|
|
339
|
-
csrfToken: string | undefined;
|
|
340
|
-
editUser: User | undefined;
|
|
341
|
-
} | {
|
|
342
|
-
user: User | undefined;
|
|
343
|
-
csrfToken: string | undefined;
|
|
344
|
-
editUser: User;
|
|
345
|
-
next?: string | undefined;
|
|
346
|
-
}>;
|
|
392
|
+
load: (event: RequestEvent) => Promise<SearchUsersPageData>;
|
|
347
393
|
};
|
|
348
394
|
readonly createUserEndpoint: {
|
|
349
|
-
load: (event: RequestEvent) => Promise<
|
|
350
|
-
user: User | undefined;
|
|
351
|
-
csrfToken: string | undefined;
|
|
352
|
-
allowedFactor2: {
|
|
353
|
-
name: string;
|
|
354
|
-
friendlyName: string;
|
|
355
|
-
configurable: boolean;
|
|
356
|
-
}[];
|
|
357
|
-
}>;
|
|
395
|
+
load: (event: RequestEvent) => Promise<AdminCreateUserPageData>;
|
|
358
396
|
actions: {
|
|
359
|
-
default: (event: RequestEvent) => Promise<
|
|
397
|
+
default: (event: RequestEvent) => Promise<AdminCreateUserActionData>;
|
|
360
398
|
};
|
|
361
399
|
};
|
|
362
400
|
readonly deleteUserEndpoint: {
|
|
363
401
|
actions: {
|
|
364
|
-
default: (event: RequestEvent) => Promise<
|
|
402
|
+
default: (event: RequestEvent) => Promise<AdminDeleteUserActionData>;
|
|
365
403
|
};
|
|
366
|
-
load: (event: RequestEvent) => Promise<
|
|
367
|
-
user: User | undefined;
|
|
368
|
-
csrfToken: string | undefined;
|
|
369
|
-
error: string;
|
|
370
|
-
errorCode: ErrorCode | undefined;
|
|
371
|
-
errorCodeName: string | undefined;
|
|
372
|
-
} | {
|
|
373
|
-
user: User | undefined;
|
|
374
|
-
csrfToken: string | undefined;
|
|
375
|
-
username: string;
|
|
376
|
-
}>;
|
|
404
|
+
load: (event: RequestEvent) => Promise<AdminDeleteUserPageData>;
|
|
377
405
|
};
|
|
378
406
|
}
|
|
@@ -4,6 +4,16 @@ import { SvelteKitSessionServer } from './sveltekitsession';
|
|
|
4
4
|
import { TokenEmailer } from '@crossauth/backend';
|
|
5
5
|
import { CrossauthError, CrossauthLogger, j, ErrorCode, UserState } from '@crossauth/common';
|
|
6
6
|
import { JsonOrFormData } from './utils';
|
|
7
|
+
;
|
|
8
|
+
;
|
|
9
|
+
;
|
|
10
|
+
;
|
|
11
|
+
;
|
|
12
|
+
;
|
|
13
|
+
;
|
|
14
|
+
;
|
|
15
|
+
;
|
|
16
|
+
;
|
|
7
17
|
/**
|
|
8
18
|
* Default function for searching users.
|
|
9
19
|
*
|
|
@@ -47,7 +47,7 @@ export interface AuthorizePageData extends ReturnBase {
|
|
|
47
47
|
user?: User;
|
|
48
48
|
csrfToken?: string;
|
|
49
49
|
}
|
|
50
|
-
export interface
|
|
50
|
+
export interface AuthorizeActionData extends ReturnBase {
|
|
51
51
|
formData?: {
|
|
52
52
|
[key: string]: string;
|
|
53
53
|
};
|
|
@@ -62,7 +62,7 @@ export interface DevicePageData extends ReturnBase {
|
|
|
62
62
|
csrfToken?: string;
|
|
63
63
|
};
|
|
64
64
|
completed: boolean;
|
|
65
|
-
retryAllowed
|
|
65
|
+
retryAllowed?: boolean;
|
|
66
66
|
user?: User;
|
|
67
67
|
csrfToken?: string;
|
|
68
68
|
ok: boolean;
|
|
@@ -70,7 +70,7 @@ export interface DevicePageData extends ReturnBase {
|
|
|
70
70
|
error_description?: string;
|
|
71
71
|
user_code?: string;
|
|
72
72
|
}
|
|
73
|
-
export interface
|
|
73
|
+
export interface DeviceActionData extends ReturnBase {
|
|
74
74
|
authorizationNeeded?: {
|
|
75
75
|
user: User;
|
|
76
76
|
client_id: string;
|
|
@@ -239,7 +239,7 @@ export interface SvelteKitAuthorizationServerOptions extends OAuthAuthorizationS
|
|
|
239
239
|
* | | | - `error_description` if there was an error | | |
|
|
240
240
|
* | --------------------------- | ---------------------------------------------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------- | --------------------------------------------------------------- |
|
|
241
241
|
* | deviceEndpoint | Device flow - authorization endpoint on other device | `load`: | `authorize`: to authorize scopes (call after `userCode`) | `user_code` query param for GET, form field for POST. Optional |
|
|
242
|
-
* | | | See {@link DevicePageData} | See {@link
|
|
242
|
+
* | | | See {@link DevicePageData} | See {@link DeviceActionData} | If not provided, user will be prompted |
|
|
243
243
|
* | | | | `userCode` to submit the user code | `authorize`: `client_id`, `user_code`, `authorized` |
|
|
244
244
|
* | --------------------------- | ---------------------------------------------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------- | --------------------------------------------------------------- |
|
|
245
245
|
*
|
|
@@ -353,7 +353,7 @@ export declare class SvelteKitAuthorizationServer {
|
|
|
353
353
|
readonly authorizeEndpoint: {
|
|
354
354
|
load: (event: RequestEvent) => Promise<AuthorizePageData>;
|
|
355
355
|
actions: {
|
|
356
|
-
default: (event: RequestEvent) => Promise<
|
|
356
|
+
default: (event: RequestEvent) => Promise<AuthorizeActionData>;
|
|
357
357
|
};
|
|
358
358
|
};
|
|
359
359
|
/**
|
|
@@ -405,8 +405,8 @@ export declare class SvelteKitAuthorizationServer {
|
|
|
405
405
|
readonly deviceEndpoint: {
|
|
406
406
|
load: (event: RequestEvent) => Promise<DevicePageData>;
|
|
407
407
|
actions: {
|
|
408
|
-
userCode: (event: RequestEvent) => Promise<
|
|
409
|
-
authorize: (event: RequestEvent) => Promise<
|
|
408
|
+
userCode: (event: RequestEvent) => Promise<DevicePageData>;
|
|
409
|
+
authorize: (event: RequestEvent) => Promise<DevicePageData>;
|
|
410
410
|
};
|
|
411
411
|
};
|
|
412
412
|
}
|
|
@@ -72,7 +72,7 @@ const DEFAULT_UPSTREAM_SESSION_DATA_NAME = "upstreamoauth";
|
|
|
72
72
|
* | | | - `error_description` if there was an error | | |
|
|
73
73
|
* | --------------------------- | ---------------------------------------------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------- | --------------------------------------------------------------- |
|
|
74
74
|
* | deviceEndpoint | Device flow - authorization endpoint on other device | `load`: | `authorize`: to authorize scopes (call after `userCode`) | `user_code` query param for GET, form field for POST. Optional |
|
|
75
|
-
* | | | See {@link DevicePageData} | See {@link
|
|
75
|
+
* | | | See {@link DevicePageData} | See {@link DeviceActionData} | If not provided, user will be prompted |
|
|
76
76
|
* | | | | `userCode` to submit the user code | `authorize`: `client_id`, `user_code`, `authorized` |
|
|
77
77
|
* | --------------------------- | ---------------------------------------------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------- | --------------------------------------------------------------- |
|
|
78
78
|
*
|