@neondatabase/auth 0.1.0-beta.9 → 0.3.0-beta
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/LICENSE +201 -0
- package/README.md +108 -18
- package/dist/{adapter-core-Bw9mn_AS.d.mts → adapter-core-B9uDhoYq.d.mts} +270 -375
- package/dist/{adapter-core-C_NEMs0b.mjs → adapter-core-D00qcqMo.mjs} +392 -67
- package/dist/better-auth-react-adapter-BO4jLN4H.d.mts +2170 -0
- package/dist/{better-auth-react-adapter-BbM3jLLv.mjs → better-auth-react-adapter-Xdj-69i9.mjs} +10 -8
- package/dist/constants-Cupc_bln.mjs +28 -0
- package/dist/{index-BXlAjlSt.d.mts → index-B_Q0Tp1D.d.mts} +0 -1
- package/dist/index.d.mts +13 -19
- package/dist/index.mjs +2 -1
- package/dist/{neon-auth-DdlToh7_.mjs → neon-auth-DBOB8sXF.mjs} +7 -4
- package/dist/next/index.d.mts +77 -186
- package/dist/next/index.mjs +4 -311
- package/dist/next/server/index.d.mts +536 -0
- package/dist/next/server/index.mjs +1461 -0
- package/dist/react/adapters/index.d.mts +4 -4
- package/dist/react/adapters/index.mjs +2 -1
- package/dist/react/index.d.mts +6 -5
- package/dist/react/index.mjs +5 -4
- package/dist/react/ui/index.d.mts +1 -2
- package/dist/react/ui/index.mjs +2 -4
- package/dist/react/ui/server.mjs +2 -2
- package/dist/{supabase-adapter-CAqbpOC7.mjs → supabase-adapter-CIBMebXB.mjs} +28 -45
- package/dist/supabase-adapter-CSDRL1ZU.d.mts +2227 -0
- package/dist/types/index.d.mts +2 -7
- package/dist/ui/.safelist.html +3 -0
- package/dist/ui/css.css +2 -2
- package/dist/ui/tailwind.css +2 -1
- package/dist/ui/theme-inline.css +44 -0
- package/dist/ui/theme.css +103 -76
- package/dist/ui-CnVnqGns.mjs +3 -0
- package/dist/vanilla/adapters/index.d.mts +3 -3
- package/dist/vanilla/adapters/index.mjs +2 -1
- package/dist/vanilla/index.d.mts +3 -3
- package/dist/vanilla/index.mjs +2 -1
- package/llms.txt +330 -0
- package/package.json +32 -23
- package/dist/better-auth-react-adapter-JoscqoDc.d.mts +0 -722
- package/dist/better-auth-types-CE4hLv9E.d.mts +0 -9
- package/dist/chunk-5DLVHPZS-Bxj7snpZ-DoVNlsyk.mjs +0 -533
- package/dist/supabase-adapter-Clxlqg1x.d.mts +0 -127
- package/dist/ui-aMoA-9nq.mjs +0 -9449
- /package/dist/{adapters-D0mxG3F-.mjs → adapters-CUvhsAvY.mjs} +0 -0
- /package/dist/{adapters-Df6Dd3KK.mjs → adapters-CivF9wql.mjs} +0 -0
- /package/dist/{index-ClXLQ1fw.d.mts → index-CPnFzULh.d.mts} +0 -0
- /package/dist/{index-DCQ5Y2ED.d.mts → index-UW23fDSn.d.mts} +0 -0
package/dist/next/index.d.mts
CHANGED
|
@@ -1,108 +1,9 @@
|
|
|
1
|
-
import
|
|
2
|
-
import * as better_auth_client0 from "better-auth/client";
|
|
3
|
-
import * as better_auth_client_plugins0 from "better-auth/client/plugins";
|
|
1
|
+
import * as better_auth_react0 from "better-auth/react";
|
|
4
2
|
import * as jose0 from "jose";
|
|
5
|
-
import
|
|
3
|
+
import * as better_auth_plugins0 from "better-auth/plugins";
|
|
6
4
|
import * as better_auth0 from "better-auth";
|
|
7
5
|
import * as _better_fetch_fetch0 from "@better-fetch/fetch";
|
|
8
|
-
import * as nanostores0 from "nanostores";
|
|
9
6
|
|
|
10
|
-
//#region src/next/handler/index.d.ts
|
|
11
|
-
type Params = {
|
|
12
|
-
path: string[];
|
|
13
|
-
};
|
|
14
|
-
/**
|
|
15
|
-
*
|
|
16
|
-
* An API route handler to handle the auth requests from the client and proxy them to the Neon Auth.
|
|
17
|
-
*
|
|
18
|
-
* @returns A Next.js API handler functions those can be used in a Next.js route.
|
|
19
|
-
*
|
|
20
|
-
* @example
|
|
21
|
-
*
|
|
22
|
-
* Mount the `authApiHandler` to an API route. Create a route file inside `/api/auth/[...all]/route.ts` directory.
|
|
23
|
-
* And add the following code:
|
|
24
|
-
*
|
|
25
|
-
* ```ts
|
|
26
|
-
*
|
|
27
|
-
* import { authApiHandler } from '@neondatabase/auth/next';
|
|
28
|
-
*
|
|
29
|
-
* export const { GET, POST } = authApiHandler();
|
|
30
|
-
* ```
|
|
31
|
-
*
|
|
32
|
-
*/
|
|
33
|
-
declare function authApiHandler(): {
|
|
34
|
-
GET: (request: Request, {
|
|
35
|
-
params
|
|
36
|
-
}: {
|
|
37
|
-
params: Promise<Params>;
|
|
38
|
-
}) => Promise<Response>;
|
|
39
|
-
POST: (request: Request, {
|
|
40
|
-
params
|
|
41
|
-
}: {
|
|
42
|
-
params: Promise<Params>;
|
|
43
|
-
}) => Promise<Response>;
|
|
44
|
-
PUT: (request: Request, {
|
|
45
|
-
params
|
|
46
|
-
}: {
|
|
47
|
-
params: Promise<Params>;
|
|
48
|
-
}) => Promise<Response>;
|
|
49
|
-
DELETE: (request: Request, {
|
|
50
|
-
params
|
|
51
|
-
}: {
|
|
52
|
-
params: Promise<Params>;
|
|
53
|
-
}) => Promise<Response>;
|
|
54
|
-
PATCH: (request: Request, {
|
|
55
|
-
params
|
|
56
|
-
}: {
|
|
57
|
-
params: Promise<Params>;
|
|
58
|
-
}) => Promise<Response>;
|
|
59
|
-
};
|
|
60
|
-
//#endregion
|
|
61
|
-
//#region src/next/middleware/index.d.ts
|
|
62
|
-
type NeonAuthMiddlewareOptions = {
|
|
63
|
-
loginUrl?: string;
|
|
64
|
-
};
|
|
65
|
-
/**
|
|
66
|
-
* A Next.js middleware to protect routes from unauthenticated requests and refresh the session if required.
|
|
67
|
-
*
|
|
68
|
-
* @param loginUrl - The URL to redirect to when the user is not authenticated.
|
|
69
|
-
* @returns A middleware function that can be used in the Next.js app.
|
|
70
|
-
*
|
|
71
|
-
* @example
|
|
72
|
-
* ```ts
|
|
73
|
-
* import { neonAuthMiddleware } from "@neondatabase/auth/next"
|
|
74
|
-
*
|
|
75
|
-
* export default neonAuthMiddleware({
|
|
76
|
-
* loginUrl: '/auth/sign-in',
|
|
77
|
-
* });
|
|
78
|
-
* ```
|
|
79
|
-
*/
|
|
80
|
-
declare function neonAuthMiddleware({
|
|
81
|
-
loginUrl
|
|
82
|
-
}: NeonAuthMiddlewareOptions): (request: NextRequest) => Promise<NextResponse<unknown>>;
|
|
83
|
-
//#endregion
|
|
84
|
-
//#region src/next/auth/session.d.ts
|
|
85
|
-
type SessionData = {
|
|
86
|
-
session: BetterAuthSession;
|
|
87
|
-
user: BetterAuthUser;
|
|
88
|
-
} | {
|
|
89
|
-
session: null;
|
|
90
|
-
user: null;
|
|
91
|
-
};
|
|
92
|
-
/**
|
|
93
|
-
* A utility function to be used in react server components fetch the session details from the Neon Auth API, if session token is available in cookie.
|
|
94
|
-
*
|
|
95
|
-
* @returns - `{ session: Session, user: User }` | `{ session: null, user: null}`.
|
|
96
|
-
*
|
|
97
|
-
* @example
|
|
98
|
-
* ```ts
|
|
99
|
-
* import { neonAuth } from "@neondatabase/auth/next"
|
|
100
|
-
*
|
|
101
|
-
* const { session, user } = await neonAuth()
|
|
102
|
-
* ```
|
|
103
|
-
*/
|
|
104
|
-
declare const neonAuth: () => Promise<SessionData>;
|
|
105
|
-
//#endregion
|
|
106
7
|
//#region src/next/index.d.ts
|
|
107
8
|
declare function createAuthClient(): {
|
|
108
9
|
useActiveOrganization: () => {
|
|
@@ -132,7 +33,7 @@ declare function createAuthClient(): {
|
|
|
132
33
|
organizationId: string;
|
|
133
34
|
email: string;
|
|
134
35
|
role: "admin" | "member" | "owner";
|
|
135
|
-
status:
|
|
36
|
+
status: better_auth_plugins0.InvitationStatus;
|
|
136
37
|
inviterId: string;
|
|
137
38
|
expiresAt: Date;
|
|
138
39
|
createdAt: Date;
|
|
@@ -208,7 +109,7 @@ declare function createAuthClient(): {
|
|
|
208
109
|
} & {
|
|
209
110
|
fetchOptions?: FetchOptions | undefined;
|
|
210
111
|
}>, data_1?: FetchOptions | undefined) => Promise<_better_fetch_fetch0.BetterFetchResponse<{
|
|
211
|
-
user:
|
|
112
|
+
user: better_auth_plugins0.UserWithRole;
|
|
212
113
|
}, {
|
|
213
114
|
code?: string | undefined;
|
|
214
115
|
message?: string | undefined;
|
|
@@ -253,7 +154,7 @@ declare function createAuthClient(): {
|
|
|
253
154
|
} & {
|
|
254
155
|
fetchOptions?: FetchOptions | undefined;
|
|
255
156
|
}>, data_1?: FetchOptions | undefined) => Promise<_better_fetch_fetch0.BetterFetchResponse<{
|
|
256
|
-
user:
|
|
157
|
+
user: better_auth_plugins0.UserWithRole;
|
|
257
158
|
}, {
|
|
258
159
|
code?: string | undefined;
|
|
259
160
|
message?: string | undefined;
|
|
@@ -269,7 +170,7 @@ declare function createAuthClient(): {
|
|
|
269
170
|
data: Record<any, any>;
|
|
270
171
|
} & {
|
|
271
172
|
fetchOptions?: FetchOptions | undefined;
|
|
272
|
-
}>, data_1?: FetchOptions | undefined) => Promise<_better_fetch_fetch0.BetterFetchResponse<
|
|
173
|
+
}>, data_1?: FetchOptions | undefined) => Promise<_better_fetch_fetch0.BetterFetchResponse<better_auth_plugins0.UserWithRole, {
|
|
273
174
|
code?: string | undefined;
|
|
274
175
|
message?: string | undefined;
|
|
275
176
|
}, FetchOptions["throw"] extends true ? true : false>>;
|
|
@@ -302,7 +203,7 @@ declare function createAuthClient(): {
|
|
|
302
203
|
};
|
|
303
204
|
fetchOptions?: FetchOptions | undefined;
|
|
304
205
|
}>, data_1?: FetchOptions | undefined) => Promise<_better_fetch_fetch0.BetterFetchResponse<NonNullable<{
|
|
305
|
-
users:
|
|
206
|
+
users: better_auth_plugins0.UserWithRole[];
|
|
306
207
|
total: number;
|
|
307
208
|
limit: number | undefined;
|
|
308
209
|
offset: number | undefined;
|
|
@@ -323,7 +224,7 @@ declare function createAuthClient(): {
|
|
|
323
224
|
} & {
|
|
324
225
|
fetchOptions?: FetchOptions | undefined;
|
|
325
226
|
}>, data_1?: FetchOptions | undefined) => Promise<_better_fetch_fetch0.BetterFetchResponse<{
|
|
326
|
-
sessions:
|
|
227
|
+
sessions: better_auth_plugins0.SessionWithImpersonatedBy[];
|
|
327
228
|
}, {
|
|
328
229
|
code?: string | undefined;
|
|
329
230
|
message?: string | undefined;
|
|
@@ -398,7 +299,7 @@ declare function createAuthClient(): {
|
|
|
398
299
|
ipAddress?: string | null | undefined;
|
|
399
300
|
userAgent?: string | null | undefined;
|
|
400
301
|
};
|
|
401
|
-
user:
|
|
302
|
+
user: better_auth_plugins0.UserWithRole;
|
|
402
303
|
}, {
|
|
403
304
|
code?: string | undefined;
|
|
404
305
|
message?: string | undefined;
|
|
@@ -483,14 +384,14 @@ declare function createAuthClient(): {
|
|
|
483
384
|
admin: {
|
|
484
385
|
hasPermission: <FetchOptions extends better_auth0.ClientFetchOption<Partial<({
|
|
485
386
|
permission: {
|
|
486
|
-
readonly user?: ("create" | "list" | "set-role" | "ban" | "impersonate" | "
|
|
487
|
-
readonly session?: ("
|
|
387
|
+
readonly user?: ("get" | "delete" | "create" | "list" | "set-role" | "ban" | "impersonate" | "set-password" | "update")[] | undefined;
|
|
388
|
+
readonly session?: ("delete" | "list" | "revoke")[] | undefined;
|
|
488
389
|
};
|
|
489
390
|
permissions?: never | undefined;
|
|
490
391
|
} | {
|
|
491
392
|
permissions: {
|
|
492
|
-
readonly user?: ("create" | "list" | "set-role" | "ban" | "impersonate" | "
|
|
493
|
-
readonly session?: ("
|
|
393
|
+
readonly user?: ("get" | "delete" | "create" | "list" | "set-role" | "ban" | "impersonate" | "set-password" | "update")[] | undefined;
|
|
394
|
+
readonly session?: ("delete" | "list" | "revoke")[] | undefined;
|
|
494
395
|
};
|
|
495
396
|
permission?: never | undefined;
|
|
496
397
|
}) & {
|
|
@@ -498,14 +399,14 @@ declare function createAuthClient(): {
|
|
|
498
399
|
role?: "user" | "admin" | undefined;
|
|
499
400
|
}> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: better_auth0.Prettify<(({
|
|
500
401
|
permission: {
|
|
501
|
-
readonly user?: ("create" | "list" | "set-role" | "ban" | "impersonate" | "
|
|
502
|
-
readonly session?: ("
|
|
402
|
+
readonly user?: ("get" | "delete" | "create" | "list" | "set-role" | "ban" | "impersonate" | "set-password" | "update")[] | undefined;
|
|
403
|
+
readonly session?: ("delete" | "list" | "revoke")[] | undefined;
|
|
503
404
|
};
|
|
504
405
|
permissions?: never | undefined;
|
|
505
406
|
} | {
|
|
506
407
|
permissions: {
|
|
507
|
-
readonly user?: ("create" | "list" | "set-role" | "ban" | "impersonate" | "
|
|
508
|
-
readonly session?: ("
|
|
408
|
+
readonly user?: ("get" | "delete" | "create" | "list" | "set-role" | "ban" | "impersonate" | "set-password" | "update")[] | undefined;
|
|
409
|
+
readonly session?: ("delete" | "list" | "revoke")[] | undefined;
|
|
509
410
|
};
|
|
510
411
|
permission?: never | undefined;
|
|
511
412
|
}) & {
|
|
@@ -643,7 +544,7 @@ declare function createAuthClient(): {
|
|
|
643
544
|
organizationId: string;
|
|
644
545
|
email: string;
|
|
645
546
|
role: "admin" | "member" | "owner";
|
|
646
|
-
status:
|
|
547
|
+
status: better_auth_plugins0.InvitationStatus;
|
|
647
548
|
inviterId: string;
|
|
648
549
|
expiresAt: Date;
|
|
649
550
|
createdAt: Date;
|
|
@@ -692,7 +593,7 @@ declare function createAuthClient(): {
|
|
|
692
593
|
organizationId: string;
|
|
693
594
|
email: string;
|
|
694
595
|
role: "admin" | "member" | "owner";
|
|
695
|
-
status:
|
|
596
|
+
status: better_auth_plugins0.InvitationStatus;
|
|
696
597
|
inviterId: string;
|
|
697
598
|
expiresAt: Date;
|
|
698
599
|
createdAt: Date;
|
|
@@ -745,7 +646,7 @@ declare function createAuthClient(): {
|
|
|
745
646
|
organizationId: string;
|
|
746
647
|
email: string;
|
|
747
648
|
role: "admin" | "member" | "owner";
|
|
748
|
-
status:
|
|
649
|
+
status: better_auth_plugins0.InvitationStatus;
|
|
749
650
|
inviterId: string;
|
|
750
651
|
expiresAt: Date;
|
|
751
652
|
createdAt: Date;
|
|
@@ -767,7 +668,7 @@ declare function createAuthClient(): {
|
|
|
767
668
|
organizationId: string;
|
|
768
669
|
email: string;
|
|
769
670
|
role: "admin" | "member" | "owner";
|
|
770
|
-
status:
|
|
671
|
+
status: better_auth_plugins0.InvitationStatus;
|
|
771
672
|
inviterId: string;
|
|
772
673
|
expiresAt: Date;
|
|
773
674
|
createdAt: Date;
|
|
@@ -790,7 +691,7 @@ declare function createAuthClient(): {
|
|
|
790
691
|
organizationId: string;
|
|
791
692
|
email: string;
|
|
792
693
|
role: "admin" | "member" | "owner";
|
|
793
|
-
status:
|
|
694
|
+
status: better_auth_plugins0.InvitationStatus;
|
|
794
695
|
inviterId: string;
|
|
795
696
|
expiresAt: Date;
|
|
796
697
|
createdAt: Date;
|
|
@@ -821,7 +722,7 @@ declare function createAuthClient(): {
|
|
|
821
722
|
organizationId: string;
|
|
822
723
|
email: string;
|
|
823
724
|
role: "admin" | "member" | "owner";
|
|
824
|
-
status:
|
|
725
|
+
status: better_auth_plugins0.InvitationStatus;
|
|
825
726
|
inviterId: string;
|
|
826
727
|
expiresAt: Date;
|
|
827
728
|
createdAt: Date;
|
|
@@ -848,7 +749,7 @@ declare function createAuthClient(): {
|
|
|
848
749
|
organizationId: string;
|
|
849
750
|
email: string;
|
|
850
751
|
role: "member" | "admin" | "owner";
|
|
851
|
-
status:
|
|
752
|
+
status: better_auth_plugins0.InvitationStatus;
|
|
852
753
|
inviterId: string;
|
|
853
754
|
expiresAt: Date;
|
|
854
755
|
createdAt: Date;
|
|
@@ -873,7 +774,7 @@ declare function createAuthClient(): {
|
|
|
873
774
|
organizationId: string;
|
|
874
775
|
email: string;
|
|
875
776
|
role: "admin" | "member" | "owner";
|
|
876
|
-
status:
|
|
777
|
+
status: better_auth_plugins0.InvitationStatus;
|
|
877
778
|
inviterId: string;
|
|
878
779
|
expiresAt: Date;
|
|
879
780
|
createdAt: Date;
|
|
@@ -1034,7 +935,7 @@ declare function createAuthClient(): {
|
|
|
1034
935
|
organizationId: string;
|
|
1035
936
|
email: string;
|
|
1036
937
|
role: "admin" | "member" | "owner";
|
|
1037
|
-
status:
|
|
938
|
+
status: better_auth_plugins0.InvitationStatus;
|
|
1038
939
|
inviterId: string;
|
|
1039
940
|
expiresAt: Date;
|
|
1040
941
|
createdAt: Date;
|
|
@@ -1131,19 +1032,19 @@ declare function createAuthClient(): {
|
|
|
1131
1032
|
hasPermission: <FetchOptions extends better_auth0.ClientFetchOption<Partial<({
|
|
1132
1033
|
permission: {
|
|
1133
1034
|
readonly organization?: ("delete" | "update")[] | undefined;
|
|
1134
|
-
readonly member?: ("
|
|
1135
|
-
readonly invitation?: ("
|
|
1136
|
-
readonly team?: ("
|
|
1137
|
-
readonly ac?: ("
|
|
1035
|
+
readonly member?: ("delete" | "create" | "update")[] | undefined;
|
|
1036
|
+
readonly invitation?: ("cancel" | "create")[] | undefined;
|
|
1037
|
+
readonly team?: ("delete" | "create" | "update")[] | undefined;
|
|
1038
|
+
readonly ac?: ("delete" | "create" | "update" | "read")[] | undefined;
|
|
1138
1039
|
};
|
|
1139
1040
|
permissions?: never | undefined;
|
|
1140
1041
|
} | {
|
|
1141
1042
|
permissions: {
|
|
1142
1043
|
readonly organization?: ("delete" | "update")[] | undefined;
|
|
1143
|
-
readonly member?: ("
|
|
1144
|
-
readonly invitation?: ("
|
|
1145
|
-
readonly team?: ("
|
|
1146
|
-
readonly ac?: ("
|
|
1044
|
+
readonly member?: ("delete" | "create" | "update")[] | undefined;
|
|
1045
|
+
readonly invitation?: ("cancel" | "create")[] | undefined;
|
|
1046
|
+
readonly team?: ("delete" | "create" | "update")[] | undefined;
|
|
1047
|
+
readonly ac?: ("delete" | "create" | "update" | "read")[] | undefined;
|
|
1147
1048
|
};
|
|
1148
1049
|
permission?: never | undefined;
|
|
1149
1050
|
}) & {
|
|
@@ -1151,19 +1052,19 @@ declare function createAuthClient(): {
|
|
|
1151
1052
|
}> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: better_auth0.Prettify<(({
|
|
1152
1053
|
permission: {
|
|
1153
1054
|
readonly organization?: ("delete" | "update")[] | undefined;
|
|
1154
|
-
readonly member?: ("
|
|
1155
|
-
readonly invitation?: ("
|
|
1156
|
-
readonly team?: ("
|
|
1157
|
-
readonly ac?: ("
|
|
1055
|
+
readonly member?: ("delete" | "create" | "update")[] | undefined;
|
|
1056
|
+
readonly invitation?: ("cancel" | "create")[] | undefined;
|
|
1057
|
+
readonly team?: ("delete" | "create" | "update")[] | undefined;
|
|
1058
|
+
readonly ac?: ("delete" | "create" | "update" | "read")[] | undefined;
|
|
1158
1059
|
};
|
|
1159
1060
|
permissions?: never | undefined;
|
|
1160
1061
|
} | {
|
|
1161
1062
|
permissions: {
|
|
1162
1063
|
readonly organization?: ("delete" | "update")[] | undefined;
|
|
1163
|
-
readonly member?: ("
|
|
1164
|
-
readonly invitation?: ("
|
|
1165
|
-
readonly team?: ("
|
|
1166
|
-
readonly ac?: ("
|
|
1064
|
+
readonly member?: ("delete" | "create" | "update")[] | undefined;
|
|
1065
|
+
readonly invitation?: ("cancel" | "create")[] | undefined;
|
|
1066
|
+
readonly team?: ("delete" | "create" | "update")[] | undefined;
|
|
1067
|
+
readonly ac?: ("delete" | "create" | "update" | "read")[] | undefined;
|
|
1167
1068
|
};
|
|
1168
1069
|
permission?: never | undefined;
|
|
1169
1070
|
}) & {
|
|
@@ -1313,26 +1214,6 @@ declare function createAuthClient(): {
|
|
|
1313
1214
|
message?: string | undefined;
|
|
1314
1215
|
}, FetchOptions["throw"] extends true ? true : false>>;
|
|
1315
1216
|
};
|
|
1316
|
-
} & {
|
|
1317
|
-
signIn: {
|
|
1318
|
-
anonymous: <FetchOptions extends better_auth0.ClientFetchOption<never, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0?: better_auth0.Prettify<{
|
|
1319
|
-
query?: Record<string, any> | undefined;
|
|
1320
|
-
fetchOptions?: FetchOptions | undefined;
|
|
1321
|
-
}> | undefined, data_1?: FetchOptions | undefined) => Promise<_better_fetch_fetch0.BetterFetchResponse<{
|
|
1322
|
-
token: string;
|
|
1323
|
-
user: {
|
|
1324
|
-
id: string;
|
|
1325
|
-
email: string;
|
|
1326
|
-
emailVerified: boolean;
|
|
1327
|
-
name: string;
|
|
1328
|
-
createdAt: Date;
|
|
1329
|
-
updatedAt: Date;
|
|
1330
|
-
};
|
|
1331
|
-
}, {
|
|
1332
|
-
code?: string | undefined;
|
|
1333
|
-
message?: string | undefined;
|
|
1334
|
-
}, FetchOptions["throw"] extends true ? true : false>>;
|
|
1335
|
-
};
|
|
1336
1217
|
} & {
|
|
1337
1218
|
signIn: {
|
|
1338
1219
|
social: <FetchOptions extends better_auth0.ClientFetchOption<Partial<{
|
|
@@ -1418,7 +1299,7 @@ declare function createAuthClient(): {
|
|
|
1418
1299
|
image?: string | undefined;
|
|
1419
1300
|
callbackURL?: string | undefined;
|
|
1420
1301
|
fetchOptions?: FetchOptions | undefined;
|
|
1421
|
-
} & {} & {}
|
|
1302
|
+
} & {} & {}>, data_1?: FetchOptions | undefined) => Promise<_better_fetch_fetch0.BetterFetchResponse<NonNullable<{
|
|
1422
1303
|
token: null;
|
|
1423
1304
|
user: {
|
|
1424
1305
|
id: string;
|
|
@@ -1574,7 +1455,7 @@ declare function createAuthClient(): {
|
|
|
1574
1455
|
image?: (string | null) | undefined;
|
|
1575
1456
|
name?: string | undefined;
|
|
1576
1457
|
fetchOptions?: FetchOptions | undefined;
|
|
1577
|
-
} & Partial<{} & {}
|
|
1458
|
+
} & Partial<{} & {}>> | undefined, data_1?: FetchOptions | undefined) => Promise<_better_fetch_fetch0.BetterFetchResponse<{
|
|
1578
1459
|
status: boolean;
|
|
1579
1460
|
}, {
|
|
1580
1461
|
code?: string | undefined;
|
|
@@ -1852,7 +1733,6 @@ declare function createAuthClient(): {
|
|
|
1852
1733
|
role?: string | null | undefined;
|
|
1853
1734
|
banReason?: string | null | undefined;
|
|
1854
1735
|
banExpires?: Date | null | undefined;
|
|
1855
|
-
isAnonymous: boolean | null | undefined;
|
|
1856
1736
|
};
|
|
1857
1737
|
session: {
|
|
1858
1738
|
id: string;
|
|
@@ -1870,6 +1750,21 @@ declare function createAuthClient(): {
|
|
|
1870
1750
|
code?: string | undefined;
|
|
1871
1751
|
message?: string | undefined;
|
|
1872
1752
|
}, FetchOptions["throw"] extends true ? true : false>>;
|
|
1753
|
+
} & {
|
|
1754
|
+
getAnonymousToken: (fetchOptions?: any) => Promise<{
|
|
1755
|
+
data: {
|
|
1756
|
+
token: string;
|
|
1757
|
+
expires_at: number;
|
|
1758
|
+
};
|
|
1759
|
+
error: null;
|
|
1760
|
+
} | {
|
|
1761
|
+
data: null;
|
|
1762
|
+
error: {
|
|
1763
|
+
message?: string | undefined;
|
|
1764
|
+
status: number;
|
|
1765
|
+
statusText: string;
|
|
1766
|
+
};
|
|
1767
|
+
}>;
|
|
1873
1768
|
} & {
|
|
1874
1769
|
jwks: (fetchOptions?: any) => Promise<{
|
|
1875
1770
|
data: null;
|
|
@@ -1886,14 +1781,14 @@ declare function createAuthClient(): {
|
|
|
1886
1781
|
admin: {
|
|
1887
1782
|
checkRolePermission: <R extends "user" | "admin">(data: ({
|
|
1888
1783
|
permission: {
|
|
1889
|
-
readonly user?: ("create" | "list" | "set-role" | "ban" | "impersonate" | "
|
|
1890
|
-
readonly session?: ("
|
|
1784
|
+
readonly user?: ("get" | "delete" | "create" | "list" | "set-role" | "ban" | "impersonate" | "set-password" | "update")[] | undefined;
|
|
1785
|
+
readonly session?: ("delete" | "list" | "revoke")[] | undefined;
|
|
1891
1786
|
};
|
|
1892
1787
|
permissions?: never | undefined;
|
|
1893
1788
|
} | {
|
|
1894
1789
|
permissions: {
|
|
1895
|
-
readonly user?: ("create" | "list" | "set-role" | "ban" | "impersonate" | "
|
|
1896
|
-
readonly session?: ("
|
|
1790
|
+
readonly user?: ("get" | "delete" | "create" | "list" | "set-role" | "ban" | "impersonate" | "set-password" | "update")[] | undefined;
|
|
1791
|
+
readonly session?: ("delete" | "list" | "revoke")[] | undefined;
|
|
1897
1792
|
};
|
|
1898
1793
|
permission?: never | undefined;
|
|
1899
1794
|
}) & {
|
|
@@ -1921,7 +1816,7 @@ declare function createAuthClient(): {
|
|
|
1921
1816
|
organizationId: string;
|
|
1922
1817
|
email: string;
|
|
1923
1818
|
role: "admin" | "member" | "owner";
|
|
1924
|
-
status:
|
|
1819
|
+
status: better_auth_plugins0.InvitationStatus;
|
|
1925
1820
|
inviterId: string;
|
|
1926
1821
|
expiresAt: Date;
|
|
1927
1822
|
createdAt: Date;
|
|
@@ -1947,7 +1842,7 @@ declare function createAuthClient(): {
|
|
|
1947
1842
|
organizationId: string;
|
|
1948
1843
|
email: string;
|
|
1949
1844
|
role: "admin" | "member" | "owner";
|
|
1950
|
-
status:
|
|
1845
|
+
status: better_auth_plugins0.InvitationStatus;
|
|
1951
1846
|
inviterId: string;
|
|
1952
1847
|
expiresAt: Date;
|
|
1953
1848
|
createdAt: Date;
|
|
@@ -1977,19 +1872,19 @@ declare function createAuthClient(): {
|
|
|
1977
1872
|
checkRolePermission: <R extends "admin" | "member" | "owner">(data: ({
|
|
1978
1873
|
permission: {
|
|
1979
1874
|
readonly organization?: ("delete" | "update")[] | undefined;
|
|
1980
|
-
readonly member?: ("
|
|
1981
|
-
readonly invitation?: ("
|
|
1982
|
-
readonly team?: ("
|
|
1983
|
-
readonly ac?: ("
|
|
1875
|
+
readonly member?: ("delete" | "create" | "update")[] | undefined;
|
|
1876
|
+
readonly invitation?: ("cancel" | "create")[] | undefined;
|
|
1877
|
+
readonly team?: ("delete" | "create" | "update")[] | undefined;
|
|
1878
|
+
readonly ac?: ("delete" | "create" | "update" | "read")[] | undefined;
|
|
1984
1879
|
};
|
|
1985
1880
|
permissions?: never | undefined;
|
|
1986
1881
|
} | {
|
|
1987
1882
|
permissions: {
|
|
1988
1883
|
readonly organization?: ("delete" | "update")[] | undefined;
|
|
1989
|
-
readonly member?: ("
|
|
1990
|
-
readonly invitation?: ("
|
|
1991
|
-
readonly team?: ("
|
|
1992
|
-
readonly ac?: ("
|
|
1884
|
+
readonly member?: ("delete" | "create" | "update")[] | undefined;
|
|
1885
|
+
readonly invitation?: ("cancel" | "create")[] | undefined;
|
|
1886
|
+
readonly team?: ("delete" | "create" | "update")[] | undefined;
|
|
1887
|
+
readonly ac?: ("delete" | "create" | "update" | "read")[] | undefined;
|
|
1993
1888
|
};
|
|
1994
1889
|
permission?: never | undefined;
|
|
1995
1890
|
}) & {
|
|
@@ -2011,7 +1906,6 @@ declare function createAuthClient(): {
|
|
|
2011
1906
|
role?: string | null | undefined;
|
|
2012
1907
|
banReason?: string | null | undefined;
|
|
2013
1908
|
banExpires?: Date | null | undefined;
|
|
2014
|
-
isAnonymous: boolean | null | undefined;
|
|
2015
1909
|
};
|
|
2016
1910
|
session: {
|
|
2017
1911
|
id: string;
|
|
@@ -2047,7 +1941,6 @@ declare function createAuthClient(): {
|
|
|
2047
1941
|
role?: string | null | undefined;
|
|
2048
1942
|
banReason?: string | null | undefined;
|
|
2049
1943
|
banExpires?: Date | null | undefined;
|
|
2050
|
-
isAnonymous: boolean | null | undefined;
|
|
2051
1944
|
};
|
|
2052
1945
|
session: {
|
|
2053
1946
|
id: string;
|
|
@@ -2064,7 +1957,7 @@ declare function createAuthClient(): {
|
|
|
2064
1957
|
};
|
|
2065
1958
|
};
|
|
2066
1959
|
$fetch: _better_fetch_fetch0.BetterFetch<{
|
|
2067
|
-
plugins: (_better_fetch_fetch0.BetterFetchPlugin | {
|
|
1960
|
+
plugins: (_better_fetch_fetch0.BetterFetchPlugin<Record<string, any>> | {
|
|
2068
1961
|
id: string;
|
|
2069
1962
|
name: string;
|
|
2070
1963
|
hooks: {
|
|
@@ -2132,7 +2025,7 @@ declare function createAuthClient(): {
|
|
|
2132
2025
|
$store: {
|
|
2133
2026
|
notify: (signal?: (Omit<string, "$sessionSignal"> | "$sessionSignal") | undefined) => void;
|
|
2134
2027
|
listen: (signal: Omit<string, "$sessionSignal"> | "$sessionSignal", listener: (value: boolean, oldValue?: boolean | undefined) => void) => void;
|
|
2135
|
-
atoms: Record<string,
|
|
2028
|
+
atoms: Record<string, better_auth_react0.WritableAtom<any>>;
|
|
2136
2029
|
};
|
|
2137
2030
|
$ERROR_CODES: {
|
|
2138
2031
|
readonly FAILED_TO_CREATE_USER: "Failed to create user";
|
|
@@ -2155,6 +2048,7 @@ declare function createAuthClient(): {
|
|
|
2155
2048
|
readonly YOU_CANNOT_REMOVE_YOURSELF: "You cannot remove yourself";
|
|
2156
2049
|
readonly YOU_ARE_NOT_ALLOWED_TO_SET_NON_EXISTENT_VALUE: "You are not allowed to set a non-existent role value";
|
|
2157
2050
|
readonly YOU_CANNOT_IMPERSONATE_ADMINS: "You cannot impersonate admins";
|
|
2051
|
+
readonly INVALID_ROLE_TYPE: "Invalid role type";
|
|
2158
2052
|
readonly YOU_ARE_NOT_ALLOWED_TO_CREATE_A_NEW_ORGANIZATION: "You are not allowed to create a new organization";
|
|
2159
2053
|
readonly YOU_HAVE_REACHED_THE_MAXIMUM_NUMBER_OF_ORGANIZATIONS: "You have reached the maximum number of organizations";
|
|
2160
2054
|
readonly ORGANIZATION_ALREADY_EXISTS: "Organization already exists";
|
|
@@ -2214,9 +2108,6 @@ declare function createAuthClient(): {
|
|
|
2214
2108
|
readonly OTP_EXPIRED: "OTP expired";
|
|
2215
2109
|
readonly INVALID_OTP: "Invalid OTP";
|
|
2216
2110
|
readonly TOO_MANY_ATTEMPTS: "Too many attempts";
|
|
2217
|
-
readonly INVALID_EMAIL_FORMAT: "Email was not generated in a valid format";
|
|
2218
|
-
readonly COULD_NOT_CREATE_SESSION: "Could not create session";
|
|
2219
|
-
readonly ANONYMOUS_USERS_CANNOT_SIGN_IN_AGAIN_ANONYMOUSLY: "Anonymous users cannot sign in again anonymously";
|
|
2220
2111
|
readonly USER_NOT_FOUND: "User not found";
|
|
2221
2112
|
readonly FAILED_TO_CREATE_SESSION: "Failed to create session";
|
|
2222
2113
|
readonly FAILED_TO_UPDATE_USER: "Failed to update user";
|
|
@@ -2242,4 +2133,4 @@ declare function createAuthClient(): {
|
|
|
2242
2133
|
};
|
|
2243
2134
|
};
|
|
2244
2135
|
//#endregion
|
|
2245
|
-
export {
|
|
2136
|
+
export { createAuthClient };
|