@neondatabase/neon-js 0.1.0-alpha.1 → 0.1.0-alpha.3
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 +427 -264
- package/dist/chunk-CYrQad0d.mjs +25 -0
- package/dist/cli/index.d.mts +1 -0
- package/dist/cli/{index.js → index.mjs} +6 -6
- package/dist/index.d.mts +1035 -0
- package/dist/index.mjs +50 -0
- package/dist/package.json +61 -0
- package/package.json +23 -22
- package/CHANGELOG.md +0 -86
- package/LICENSE +0 -201
- package/dist/index.d.ts +0 -147
- package/dist/index.js +0 -1360
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,1035 @@
|
|
|
1
|
+
import * as better_auth_react0 from "better-auth/react";
|
|
2
|
+
import { createAuthClient, useStore as useBetterAuthStore } from "better-auth/react";
|
|
3
|
+
import { AuthClient, BetterAuthClientOptions, createAuthClient as createAuthClient$1 } from "better-auth/client";
|
|
4
|
+
import * as better_auth0 from "better-auth";
|
|
5
|
+
import * as _better_fetch_fetch0 from "@better-fetch/fetch";
|
|
6
|
+
import * as nanostores0 from "nanostores";
|
|
7
|
+
import * as _supabase_auth_js0 from "@supabase/auth-js";
|
|
8
|
+
import { AuthApiError, AuthClient as AuthClient$1, AuthError, JwtHeader, JwtPayload, Session, User, isAuthError } from "@supabase/auth-js";
|
|
9
|
+
import { PostgrestClient } from "@supabase/postgrest-js";
|
|
10
|
+
|
|
11
|
+
//#region ../neon-auth/src/core/adapter-core.d.ts
|
|
12
|
+
interface NeonAuthAdapterCoreAuthOptions extends Omit<BetterAuthClientOptions, 'plugins'> {}
|
|
13
|
+
declare abstract class NeonAuthAdapterCore {
|
|
14
|
+
protected betterAuthOptions: BetterAuthClientOptions;
|
|
15
|
+
/**
|
|
16
|
+
* Better Auth adapter implementing the NeonAuthClient interface.
|
|
17
|
+
* See CLAUDE.md for architecture details and API mappings.
|
|
18
|
+
*/
|
|
19
|
+
constructor(betterAuthClientOptions: NeonAuthAdapterCoreAuthOptions);
|
|
20
|
+
abstract getBetterAuthInstance?(): AuthClient<BetterAuthClientOptions> | ReturnType<typeof createAuthClient>;
|
|
21
|
+
abstract getJWTToken(): Promise<string | null>;
|
|
22
|
+
}
|
|
23
|
+
//#endregion
|
|
24
|
+
//#region ../neon-auth/src/adapters/better-auth-react/better-auth-react-adapter.d.ts
|
|
25
|
+
type BetterAuthReactAdapterOptions = NeonAuthAdapterCoreAuthOptions;
|
|
26
|
+
declare class BetterAuthReactAdapter extends NeonAuthAdapterCore {
|
|
27
|
+
private _betterAuth;
|
|
28
|
+
constructor(betterAuthClientOptions: BetterAuthReactAdapterOptions);
|
|
29
|
+
getBetterAuthInstance(): {
|
|
30
|
+
signIn: {
|
|
31
|
+
social: <FetchOptions extends better_auth0.ClientFetchOption<Partial<{
|
|
32
|
+
provider: (string & {}) | "github" | "apple" | "atlassian" | "cognito" | "discord" | "facebook" | "figma" | "microsoft" | "google" | "huggingface" | "slack" | "spotify" | "twitch" | "twitter" | "dropbox" | "kick" | "linear" | "linkedin" | "gitlab" | "tiktok" | "reddit" | "roblox" | "salesforce" | "vk" | "zoom" | "notion" | "kakao" | "naver" | "line" | "paybin" | "paypal" | "polar";
|
|
33
|
+
callbackURL?: string | undefined;
|
|
34
|
+
newUserCallbackURL?: string | undefined;
|
|
35
|
+
errorCallbackURL?: string | undefined;
|
|
36
|
+
disableRedirect?: boolean | undefined;
|
|
37
|
+
idToken?: {
|
|
38
|
+
token: string;
|
|
39
|
+
nonce?: string | undefined;
|
|
40
|
+
accessToken?: string | undefined;
|
|
41
|
+
refreshToken?: string | undefined;
|
|
42
|
+
expiresAt?: number | undefined;
|
|
43
|
+
} | undefined;
|
|
44
|
+
scopes?: string[] | undefined;
|
|
45
|
+
requestSignUp?: boolean | undefined;
|
|
46
|
+
loginHint?: string | undefined;
|
|
47
|
+
additionalData?: Record<string, any> | undefined;
|
|
48
|
+
}> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: better_auth_react0.Prettify<{
|
|
49
|
+
provider: (string & {}) | "github" | "apple" | "atlassian" | "cognito" | "discord" | "facebook" | "figma" | "microsoft" | "google" | "huggingface" | "slack" | "spotify" | "twitch" | "twitter" | "dropbox" | "kick" | "linear" | "linkedin" | "gitlab" | "tiktok" | "reddit" | "roblox" | "salesforce" | "vk" | "zoom" | "notion" | "kakao" | "naver" | "line" | "paybin" | "paypal" | "polar";
|
|
50
|
+
callbackURL?: string | undefined;
|
|
51
|
+
newUserCallbackURL?: string | undefined;
|
|
52
|
+
errorCallbackURL?: string | undefined;
|
|
53
|
+
disableRedirect?: boolean | undefined;
|
|
54
|
+
idToken?: {
|
|
55
|
+
token: string;
|
|
56
|
+
nonce?: string | undefined;
|
|
57
|
+
accessToken?: string | undefined;
|
|
58
|
+
refreshToken?: string | undefined;
|
|
59
|
+
expiresAt?: number | undefined;
|
|
60
|
+
} | undefined;
|
|
61
|
+
scopes?: string[] | undefined;
|
|
62
|
+
requestSignUp?: boolean | undefined;
|
|
63
|
+
loginHint?: string | undefined;
|
|
64
|
+
additionalData?: Record<string, any> | undefined;
|
|
65
|
+
} & {
|
|
66
|
+
fetchOptions?: FetchOptions | undefined;
|
|
67
|
+
}>, data_1?: FetchOptions | undefined) => Promise<_better_fetch_fetch0.BetterFetchResponse<NonNullable<{
|
|
68
|
+
redirect: boolean;
|
|
69
|
+
url: string;
|
|
70
|
+
} | {
|
|
71
|
+
redirect: boolean;
|
|
72
|
+
token: string;
|
|
73
|
+
url: undefined;
|
|
74
|
+
user: {
|
|
75
|
+
id: string;
|
|
76
|
+
createdAt: Date;
|
|
77
|
+
updatedAt: Date;
|
|
78
|
+
email: string;
|
|
79
|
+
emailVerified: boolean;
|
|
80
|
+
name: string;
|
|
81
|
+
image?: string | null | undefined | undefined;
|
|
82
|
+
};
|
|
83
|
+
}>, {
|
|
84
|
+
code?: string | undefined;
|
|
85
|
+
message?: string | undefined;
|
|
86
|
+
}, FetchOptions["throw"] extends true ? true : false>>;
|
|
87
|
+
};
|
|
88
|
+
} & {
|
|
89
|
+
signOut: <FetchOptions extends better_auth0.ClientFetchOption<never, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0?: better_auth_react0.Prettify<{
|
|
90
|
+
query?: Record<string, any> | undefined;
|
|
91
|
+
fetchOptions?: FetchOptions | undefined;
|
|
92
|
+
}> | undefined, data_1?: FetchOptions | undefined) => Promise<_better_fetch_fetch0.BetterFetchResponse<{
|
|
93
|
+
success: boolean;
|
|
94
|
+
}, {
|
|
95
|
+
code?: string | undefined;
|
|
96
|
+
message?: string | undefined;
|
|
97
|
+
}, FetchOptions["throw"] extends true ? true : false>>;
|
|
98
|
+
} & {
|
|
99
|
+
signUp: {
|
|
100
|
+
email: <FetchOptions extends better_auth0.ClientFetchOption<Partial<{
|
|
101
|
+
name: string;
|
|
102
|
+
email: string;
|
|
103
|
+
password: string;
|
|
104
|
+
image?: string | undefined;
|
|
105
|
+
callbackURL?: string | undefined;
|
|
106
|
+
rememberMe?: boolean | undefined;
|
|
107
|
+
}> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: better_auth_react0.Prettify<{
|
|
108
|
+
email: string;
|
|
109
|
+
name: string;
|
|
110
|
+
password: string;
|
|
111
|
+
image?: string | undefined;
|
|
112
|
+
callbackURL?: string | undefined;
|
|
113
|
+
fetchOptions?: FetchOptions | undefined;
|
|
114
|
+
}>, data_1?: FetchOptions | undefined) => Promise<_better_fetch_fetch0.BetterFetchResponse<NonNullable<{
|
|
115
|
+
token: null;
|
|
116
|
+
user: {
|
|
117
|
+
id: string;
|
|
118
|
+
createdAt: Date;
|
|
119
|
+
updatedAt: Date;
|
|
120
|
+
email: string;
|
|
121
|
+
emailVerified: boolean;
|
|
122
|
+
name: string;
|
|
123
|
+
image?: string | null | undefined | undefined;
|
|
124
|
+
};
|
|
125
|
+
} | {
|
|
126
|
+
token: string;
|
|
127
|
+
user: {
|
|
128
|
+
id: string;
|
|
129
|
+
createdAt: Date;
|
|
130
|
+
updatedAt: Date;
|
|
131
|
+
email: string;
|
|
132
|
+
emailVerified: boolean;
|
|
133
|
+
name: string;
|
|
134
|
+
image?: string | null | undefined | undefined;
|
|
135
|
+
};
|
|
136
|
+
}>, {
|
|
137
|
+
code?: string | undefined;
|
|
138
|
+
message?: string | undefined;
|
|
139
|
+
}, FetchOptions["throw"] extends true ? true : false>>;
|
|
140
|
+
};
|
|
141
|
+
} & {
|
|
142
|
+
signIn: {
|
|
143
|
+
email: <FetchOptions extends better_auth0.ClientFetchOption<Partial<{
|
|
144
|
+
email: string;
|
|
145
|
+
password: string;
|
|
146
|
+
callbackURL?: string | undefined;
|
|
147
|
+
rememberMe?: boolean | undefined;
|
|
148
|
+
}> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: better_auth_react0.Prettify<{
|
|
149
|
+
email: string;
|
|
150
|
+
password: string;
|
|
151
|
+
callbackURL?: string | undefined;
|
|
152
|
+
rememberMe?: boolean | undefined;
|
|
153
|
+
} & {
|
|
154
|
+
fetchOptions?: FetchOptions | undefined;
|
|
155
|
+
}>, data_1?: FetchOptions | undefined) => Promise<_better_fetch_fetch0.BetterFetchResponse<{
|
|
156
|
+
redirect: boolean;
|
|
157
|
+
token: string;
|
|
158
|
+
url?: string | undefined;
|
|
159
|
+
user: {
|
|
160
|
+
id: string;
|
|
161
|
+
createdAt: Date;
|
|
162
|
+
updatedAt: Date;
|
|
163
|
+
email: string;
|
|
164
|
+
emailVerified: boolean;
|
|
165
|
+
name: string;
|
|
166
|
+
image?: string | null | undefined | undefined;
|
|
167
|
+
};
|
|
168
|
+
}, {
|
|
169
|
+
code?: string | undefined;
|
|
170
|
+
message?: string | undefined;
|
|
171
|
+
}, FetchOptions["throw"] extends true ? true : false>>;
|
|
172
|
+
};
|
|
173
|
+
} & {
|
|
174
|
+
resetPassword: <FetchOptions extends better_auth0.ClientFetchOption<Partial<{
|
|
175
|
+
newPassword: string;
|
|
176
|
+
token?: string | undefined;
|
|
177
|
+
}> & Record<string, any>, Partial<{
|
|
178
|
+
token?: string | undefined;
|
|
179
|
+
}> & Record<string, any>, Record<string, any> | undefined>>(data_0: better_auth_react0.Prettify<{
|
|
180
|
+
newPassword: string;
|
|
181
|
+
token?: string | undefined;
|
|
182
|
+
} & {
|
|
183
|
+
fetchOptions?: FetchOptions | undefined;
|
|
184
|
+
}>, data_1?: FetchOptions | undefined) => Promise<_better_fetch_fetch0.BetterFetchResponse<{
|
|
185
|
+
status: boolean;
|
|
186
|
+
}, {
|
|
187
|
+
code?: string | undefined;
|
|
188
|
+
message?: string | undefined;
|
|
189
|
+
}, FetchOptions["throw"] extends true ? true : false>>;
|
|
190
|
+
} & {
|
|
191
|
+
verifyEmail: <FetchOptions extends better_auth0.ClientFetchOption<never, Partial<{
|
|
192
|
+
token: string;
|
|
193
|
+
callbackURL?: string | undefined;
|
|
194
|
+
}> & Record<string, any>, Record<string, any> | undefined>>(data_0: better_auth_react0.Prettify<{
|
|
195
|
+
query: {
|
|
196
|
+
token: string;
|
|
197
|
+
callbackURL?: string | undefined;
|
|
198
|
+
};
|
|
199
|
+
fetchOptions?: FetchOptions | undefined;
|
|
200
|
+
}>, data_1?: FetchOptions | undefined) => Promise<_better_fetch_fetch0.BetterFetchResponse<NonNullable<void | {
|
|
201
|
+
status: boolean;
|
|
202
|
+
}>, {
|
|
203
|
+
code?: string | undefined;
|
|
204
|
+
message?: string | undefined;
|
|
205
|
+
}, FetchOptions["throw"] extends true ? true : false>>;
|
|
206
|
+
} & {
|
|
207
|
+
sendVerificationEmail: <FetchOptions extends better_auth0.ClientFetchOption<Partial<{
|
|
208
|
+
email: string;
|
|
209
|
+
callbackURL?: string | undefined;
|
|
210
|
+
}> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: better_auth_react0.Prettify<{
|
|
211
|
+
email: string;
|
|
212
|
+
callbackURL?: string | undefined;
|
|
213
|
+
} & {
|
|
214
|
+
fetchOptions?: FetchOptions | undefined;
|
|
215
|
+
}>, data_1?: FetchOptions | undefined) => Promise<_better_fetch_fetch0.BetterFetchResponse<{
|
|
216
|
+
status: boolean;
|
|
217
|
+
}, {
|
|
218
|
+
code?: string | undefined;
|
|
219
|
+
message?: string | undefined;
|
|
220
|
+
}, FetchOptions["throw"] extends true ? true : false>>;
|
|
221
|
+
} & {
|
|
222
|
+
changeEmail: <FetchOptions extends better_auth0.ClientFetchOption<Partial<{
|
|
223
|
+
newEmail: string;
|
|
224
|
+
callbackURL?: string | undefined;
|
|
225
|
+
}> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: better_auth_react0.Prettify<{
|
|
226
|
+
newEmail: string;
|
|
227
|
+
callbackURL?: string | undefined;
|
|
228
|
+
} & {
|
|
229
|
+
fetchOptions?: FetchOptions | undefined;
|
|
230
|
+
}>, data_1?: FetchOptions | undefined) => Promise<_better_fetch_fetch0.BetterFetchResponse<{
|
|
231
|
+
status: boolean;
|
|
232
|
+
}, {
|
|
233
|
+
code?: string | undefined;
|
|
234
|
+
message?: string | undefined;
|
|
235
|
+
}, FetchOptions["throw"] extends true ? true : false>>;
|
|
236
|
+
} & {
|
|
237
|
+
changePassword: <FetchOptions extends better_auth0.ClientFetchOption<Partial<{
|
|
238
|
+
newPassword: string;
|
|
239
|
+
currentPassword: string;
|
|
240
|
+
revokeOtherSessions?: boolean | undefined;
|
|
241
|
+
}> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: better_auth_react0.Prettify<{
|
|
242
|
+
newPassword: string;
|
|
243
|
+
currentPassword: string;
|
|
244
|
+
revokeOtherSessions?: boolean | undefined;
|
|
245
|
+
} & {
|
|
246
|
+
fetchOptions?: FetchOptions | undefined;
|
|
247
|
+
}>, data_1?: FetchOptions | undefined) => Promise<_better_fetch_fetch0.BetterFetchResponse<{
|
|
248
|
+
token: string | null;
|
|
249
|
+
user: {
|
|
250
|
+
id: string;
|
|
251
|
+
email: string;
|
|
252
|
+
name: string;
|
|
253
|
+
image: string | null | undefined;
|
|
254
|
+
emailVerified: boolean;
|
|
255
|
+
createdAt: Date;
|
|
256
|
+
updatedAt: Date;
|
|
257
|
+
};
|
|
258
|
+
}, {
|
|
259
|
+
code?: string | undefined;
|
|
260
|
+
message?: string | undefined;
|
|
261
|
+
}, FetchOptions["throw"] extends true ? true : false>>;
|
|
262
|
+
} & {
|
|
263
|
+
updateUser: <FetchOptions extends better_auth0.ClientFetchOption<Partial<Partial<{}> & {
|
|
264
|
+
name?: string | undefined;
|
|
265
|
+
image?: string | undefined;
|
|
266
|
+
}> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0?: better_auth_react0.Prettify<{
|
|
267
|
+
image?: (string | null) | undefined;
|
|
268
|
+
name?: string | undefined;
|
|
269
|
+
fetchOptions?: FetchOptions | undefined;
|
|
270
|
+
} & Partial<{}>> | undefined, data_1?: FetchOptions | undefined) => Promise<_better_fetch_fetch0.BetterFetchResponse<{
|
|
271
|
+
status: boolean;
|
|
272
|
+
}, {
|
|
273
|
+
code?: string | undefined;
|
|
274
|
+
message?: string | undefined;
|
|
275
|
+
}, FetchOptions["throw"] extends true ? true : false>>;
|
|
276
|
+
} & {
|
|
277
|
+
deleteUser: <FetchOptions extends better_auth0.ClientFetchOption<Partial<{
|
|
278
|
+
callbackURL?: string | undefined;
|
|
279
|
+
password?: string | undefined;
|
|
280
|
+
token?: string | undefined;
|
|
281
|
+
}> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0?: better_auth_react0.Prettify<{
|
|
282
|
+
callbackURL?: string | undefined;
|
|
283
|
+
password?: string | undefined;
|
|
284
|
+
token?: string | undefined;
|
|
285
|
+
} & {
|
|
286
|
+
fetchOptions?: FetchOptions | undefined;
|
|
287
|
+
}> | undefined, data_1?: FetchOptions | undefined) => Promise<_better_fetch_fetch0.BetterFetchResponse<{
|
|
288
|
+
success: boolean;
|
|
289
|
+
message: string;
|
|
290
|
+
}, {
|
|
291
|
+
code?: string | undefined;
|
|
292
|
+
message?: string | undefined;
|
|
293
|
+
}, FetchOptions["throw"] extends true ? true : false>>;
|
|
294
|
+
} & {
|
|
295
|
+
requestPasswordReset: <FetchOptions extends better_auth0.ClientFetchOption<Partial<{
|
|
296
|
+
email: string;
|
|
297
|
+
redirectTo?: string | undefined;
|
|
298
|
+
}> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: better_auth_react0.Prettify<{
|
|
299
|
+
email: string;
|
|
300
|
+
redirectTo?: string | undefined;
|
|
301
|
+
} & {
|
|
302
|
+
fetchOptions?: FetchOptions | undefined;
|
|
303
|
+
}>, data_1?: FetchOptions | undefined) => Promise<_better_fetch_fetch0.BetterFetchResponse<{
|
|
304
|
+
status: boolean;
|
|
305
|
+
message: string;
|
|
306
|
+
}, {
|
|
307
|
+
code?: string | undefined;
|
|
308
|
+
message?: string | undefined;
|
|
309
|
+
}, FetchOptions["throw"] extends true ? true : false>>;
|
|
310
|
+
} & {
|
|
311
|
+
resetPassword: {
|
|
312
|
+
":token": <FetchOptions extends better_auth0.ClientFetchOption<never, Partial<{
|
|
313
|
+
callbackURL: string;
|
|
314
|
+
}> & Record<string, any>, {
|
|
315
|
+
token: string;
|
|
316
|
+
}>>(data_0: better_auth_react0.Prettify<{
|
|
317
|
+
query: {
|
|
318
|
+
callbackURL: string;
|
|
319
|
+
};
|
|
320
|
+
fetchOptions?: FetchOptions | undefined;
|
|
321
|
+
}>, data_1?: FetchOptions | undefined) => Promise<_better_fetch_fetch0.BetterFetchResponse<never, {
|
|
322
|
+
code?: string | undefined;
|
|
323
|
+
message?: string | undefined;
|
|
324
|
+
}, FetchOptions["throw"] extends true ? true : false>>;
|
|
325
|
+
};
|
|
326
|
+
} & {
|
|
327
|
+
listSessions: <FetchOptions extends better_auth0.ClientFetchOption<never, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0?: better_auth_react0.Prettify<{
|
|
328
|
+
query?: Record<string, any> | undefined;
|
|
329
|
+
fetchOptions?: FetchOptions | undefined;
|
|
330
|
+
}> | undefined, data_1?: FetchOptions | undefined) => Promise<_better_fetch_fetch0.BetterFetchResponse<better_auth_react0.Prettify<{
|
|
331
|
+
id: string;
|
|
332
|
+
createdAt: Date;
|
|
333
|
+
updatedAt: Date;
|
|
334
|
+
userId: string;
|
|
335
|
+
expiresAt: Date;
|
|
336
|
+
token: string;
|
|
337
|
+
ipAddress?: string | null | undefined | undefined;
|
|
338
|
+
userAgent?: string | null | undefined | undefined;
|
|
339
|
+
}>[], {
|
|
340
|
+
code?: string | undefined;
|
|
341
|
+
message?: string | undefined;
|
|
342
|
+
}, FetchOptions["throw"] extends true ? true : false>>;
|
|
343
|
+
} & {
|
|
344
|
+
revokeSession: <FetchOptions extends better_auth0.ClientFetchOption<Partial<{
|
|
345
|
+
token: string;
|
|
346
|
+
}> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: better_auth_react0.Prettify<{
|
|
347
|
+
token: string;
|
|
348
|
+
} & {
|
|
349
|
+
fetchOptions?: FetchOptions | undefined;
|
|
350
|
+
}>, data_1?: FetchOptions | undefined) => Promise<_better_fetch_fetch0.BetterFetchResponse<{
|
|
351
|
+
status: boolean;
|
|
352
|
+
}, {
|
|
353
|
+
code?: string | undefined;
|
|
354
|
+
message?: string | undefined;
|
|
355
|
+
}, FetchOptions["throw"] extends true ? true : false>>;
|
|
356
|
+
} & {
|
|
357
|
+
revokeSessions: <FetchOptions extends better_auth0.ClientFetchOption<never, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0?: better_auth_react0.Prettify<{
|
|
358
|
+
query?: Record<string, any> | undefined;
|
|
359
|
+
fetchOptions?: FetchOptions | undefined;
|
|
360
|
+
}> | undefined, data_1?: FetchOptions | undefined) => Promise<_better_fetch_fetch0.BetterFetchResponse<{
|
|
361
|
+
status: boolean;
|
|
362
|
+
}, {
|
|
363
|
+
code?: string | undefined;
|
|
364
|
+
message?: string | undefined;
|
|
365
|
+
}, FetchOptions["throw"] extends true ? true : false>>;
|
|
366
|
+
} & {
|
|
367
|
+
revokeOtherSessions: <FetchOptions extends better_auth0.ClientFetchOption<never, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0?: better_auth_react0.Prettify<{
|
|
368
|
+
query?: Record<string, any> | undefined;
|
|
369
|
+
fetchOptions?: FetchOptions | undefined;
|
|
370
|
+
}> | undefined, data_1?: FetchOptions | undefined) => Promise<_better_fetch_fetch0.BetterFetchResponse<{
|
|
371
|
+
status: boolean;
|
|
372
|
+
}, {
|
|
373
|
+
code?: string | undefined;
|
|
374
|
+
message?: string | undefined;
|
|
375
|
+
}, FetchOptions["throw"] extends true ? true : false>>;
|
|
376
|
+
} & {
|
|
377
|
+
linkSocial: <FetchOptions extends better_auth0.ClientFetchOption<Partial<{
|
|
378
|
+
provider: unknown;
|
|
379
|
+
callbackURL?: string | undefined;
|
|
380
|
+
idToken?: {
|
|
381
|
+
token: string;
|
|
382
|
+
nonce?: string | undefined;
|
|
383
|
+
accessToken?: string | undefined;
|
|
384
|
+
refreshToken?: string | undefined;
|
|
385
|
+
scopes?: string[] | undefined;
|
|
386
|
+
} | undefined;
|
|
387
|
+
requestSignUp?: boolean | undefined;
|
|
388
|
+
scopes?: string[] | undefined;
|
|
389
|
+
errorCallbackURL?: string | undefined;
|
|
390
|
+
disableRedirect?: boolean | undefined;
|
|
391
|
+
additionalData?: Record<string, any> | undefined;
|
|
392
|
+
}> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: better_auth_react0.Prettify<{
|
|
393
|
+
provider: unknown;
|
|
394
|
+
callbackURL?: string | undefined;
|
|
395
|
+
idToken?: {
|
|
396
|
+
token: string;
|
|
397
|
+
nonce?: string | undefined;
|
|
398
|
+
accessToken?: string | undefined;
|
|
399
|
+
refreshToken?: string | undefined;
|
|
400
|
+
scopes?: string[] | undefined;
|
|
401
|
+
} | undefined;
|
|
402
|
+
requestSignUp?: boolean | undefined;
|
|
403
|
+
scopes?: string[] | undefined;
|
|
404
|
+
errorCallbackURL?: string | undefined;
|
|
405
|
+
disableRedirect?: boolean | undefined;
|
|
406
|
+
additionalData?: Record<string, any> | undefined;
|
|
407
|
+
} & {
|
|
408
|
+
fetchOptions?: FetchOptions | undefined;
|
|
409
|
+
}>, data_1?: FetchOptions | undefined) => Promise<_better_fetch_fetch0.BetterFetchResponse<{
|
|
410
|
+
url: string;
|
|
411
|
+
redirect: boolean;
|
|
412
|
+
}, {
|
|
413
|
+
code?: string | undefined;
|
|
414
|
+
message?: string | undefined;
|
|
415
|
+
}, FetchOptions["throw"] extends true ? true : false>>;
|
|
416
|
+
} & {
|
|
417
|
+
listAccounts: <FetchOptions extends better_auth0.ClientFetchOption<never, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0?: better_auth_react0.Prettify<{
|
|
418
|
+
query?: Record<string, any> | undefined;
|
|
419
|
+
fetchOptions?: FetchOptions | undefined;
|
|
420
|
+
}> | undefined, data_1?: FetchOptions | undefined) => Promise<_better_fetch_fetch0.BetterFetchResponse<{
|
|
421
|
+
id: string;
|
|
422
|
+
providerId: string;
|
|
423
|
+
createdAt: Date;
|
|
424
|
+
updatedAt: Date;
|
|
425
|
+
accountId: string;
|
|
426
|
+
userId: string;
|
|
427
|
+
scopes: string[];
|
|
428
|
+
}[], {
|
|
429
|
+
code?: string | undefined;
|
|
430
|
+
message?: string | undefined;
|
|
431
|
+
}, FetchOptions["throw"] extends true ? true : false>>;
|
|
432
|
+
} & {
|
|
433
|
+
deleteUser: {
|
|
434
|
+
callback: <FetchOptions extends better_auth0.ClientFetchOption<never, Partial<{
|
|
435
|
+
token: string;
|
|
436
|
+
callbackURL?: string | undefined;
|
|
437
|
+
}> & Record<string, any>, Record<string, any> | undefined>>(data_0: better_auth_react0.Prettify<{
|
|
438
|
+
query: {
|
|
439
|
+
token: string;
|
|
440
|
+
callbackURL?: string | undefined;
|
|
441
|
+
};
|
|
442
|
+
fetchOptions?: FetchOptions | undefined;
|
|
443
|
+
}>, data_1?: FetchOptions | undefined) => Promise<_better_fetch_fetch0.BetterFetchResponse<{
|
|
444
|
+
success: boolean;
|
|
445
|
+
message: string;
|
|
446
|
+
}, {
|
|
447
|
+
code?: string | undefined;
|
|
448
|
+
message?: string | undefined;
|
|
449
|
+
}, FetchOptions["throw"] extends true ? true : false>>;
|
|
450
|
+
};
|
|
451
|
+
} & {
|
|
452
|
+
unlinkAccount: <FetchOptions extends better_auth0.ClientFetchOption<Partial<{
|
|
453
|
+
providerId: string;
|
|
454
|
+
accountId?: string | undefined;
|
|
455
|
+
}> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: better_auth_react0.Prettify<{
|
|
456
|
+
providerId: string;
|
|
457
|
+
accountId?: string | undefined;
|
|
458
|
+
} & {
|
|
459
|
+
fetchOptions?: FetchOptions | undefined;
|
|
460
|
+
}>, data_1?: FetchOptions | undefined) => Promise<_better_fetch_fetch0.BetterFetchResponse<{
|
|
461
|
+
status: boolean;
|
|
462
|
+
}, {
|
|
463
|
+
code?: string | undefined;
|
|
464
|
+
message?: string | undefined;
|
|
465
|
+
}, FetchOptions["throw"] extends true ? true : false>>;
|
|
466
|
+
} & {
|
|
467
|
+
refreshToken: <FetchOptions extends better_auth0.ClientFetchOption<Partial<{
|
|
468
|
+
providerId: string;
|
|
469
|
+
accountId?: string | undefined;
|
|
470
|
+
userId?: string | undefined;
|
|
471
|
+
}> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: better_auth_react0.Prettify<{
|
|
472
|
+
providerId: string;
|
|
473
|
+
accountId?: string | undefined;
|
|
474
|
+
userId?: string | undefined;
|
|
475
|
+
} & {
|
|
476
|
+
fetchOptions?: FetchOptions | undefined;
|
|
477
|
+
}>, data_1?: FetchOptions | undefined) => Promise<_better_fetch_fetch0.BetterFetchResponse<{
|
|
478
|
+
accessToken: string | undefined;
|
|
479
|
+
refreshToken: string | undefined;
|
|
480
|
+
accessTokenExpiresAt: Date | undefined;
|
|
481
|
+
refreshTokenExpiresAt: Date | undefined;
|
|
482
|
+
scope: string | null | undefined;
|
|
483
|
+
idToken: string | null | undefined;
|
|
484
|
+
providerId: string;
|
|
485
|
+
accountId: string;
|
|
486
|
+
}, {
|
|
487
|
+
code?: string | undefined;
|
|
488
|
+
message?: string | undefined;
|
|
489
|
+
}, FetchOptions["throw"] extends true ? true : false>>;
|
|
490
|
+
} & {
|
|
491
|
+
getAccessToken: <FetchOptions extends better_auth0.ClientFetchOption<Partial<{
|
|
492
|
+
providerId: string;
|
|
493
|
+
accountId?: string | undefined;
|
|
494
|
+
userId?: string | undefined;
|
|
495
|
+
}> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: better_auth_react0.Prettify<{
|
|
496
|
+
providerId: string;
|
|
497
|
+
accountId?: string | undefined;
|
|
498
|
+
userId?: string | undefined;
|
|
499
|
+
} & {
|
|
500
|
+
fetchOptions?: FetchOptions | undefined;
|
|
501
|
+
}>, data_1?: FetchOptions | undefined) => Promise<_better_fetch_fetch0.BetterFetchResponse<{
|
|
502
|
+
accessToken: string;
|
|
503
|
+
accessTokenExpiresAt: Date | undefined;
|
|
504
|
+
scopes: string[];
|
|
505
|
+
idToken: string | undefined;
|
|
506
|
+
}, {
|
|
507
|
+
code?: string | undefined;
|
|
508
|
+
message?: string | undefined;
|
|
509
|
+
}, FetchOptions["throw"] extends true ? true : false>>;
|
|
510
|
+
} & {
|
|
511
|
+
accountInfo: <FetchOptions extends better_auth0.ClientFetchOption<never, Partial<{
|
|
512
|
+
accountId?: string | undefined;
|
|
513
|
+
}> & Record<string, any>, Record<string, any> | undefined>>(data_0?: better_auth_react0.Prettify<{
|
|
514
|
+
query?: {
|
|
515
|
+
accountId?: string | undefined;
|
|
516
|
+
} | undefined;
|
|
517
|
+
fetchOptions?: FetchOptions | undefined;
|
|
518
|
+
}> | undefined, data_1?: FetchOptions | undefined) => Promise<_better_fetch_fetch0.BetterFetchResponse<{
|
|
519
|
+
user: better_auth0.OAuth2UserInfo;
|
|
520
|
+
data: Record<string, any>;
|
|
521
|
+
}, {
|
|
522
|
+
code?: string | undefined;
|
|
523
|
+
message?: string | undefined;
|
|
524
|
+
}, FetchOptions["throw"] extends true ? true : false>>;
|
|
525
|
+
} & {
|
|
526
|
+
getSession: <FetchOptions extends better_auth0.ClientFetchOption<never, Partial<{
|
|
527
|
+
disableCookieCache?: unknown;
|
|
528
|
+
disableRefresh?: unknown;
|
|
529
|
+
}> & Record<string, any>, Record<string, any> | undefined>>(data_0?: better_auth_react0.Prettify<{
|
|
530
|
+
query?: {
|
|
531
|
+
disableCookieCache?: unknown;
|
|
532
|
+
disableRefresh?: unknown;
|
|
533
|
+
} | undefined;
|
|
534
|
+
fetchOptions?: FetchOptions | undefined;
|
|
535
|
+
}> | undefined, data_1?: FetchOptions | undefined) => Promise<_better_fetch_fetch0.BetterFetchResponse<{
|
|
536
|
+
user: {
|
|
537
|
+
id: string;
|
|
538
|
+
createdAt: Date;
|
|
539
|
+
updatedAt: Date;
|
|
540
|
+
email: string;
|
|
541
|
+
emailVerified: boolean;
|
|
542
|
+
name: string;
|
|
543
|
+
image?: string | null | undefined;
|
|
544
|
+
};
|
|
545
|
+
session: {
|
|
546
|
+
id: string;
|
|
547
|
+
createdAt: Date;
|
|
548
|
+
updatedAt: Date;
|
|
549
|
+
userId: string;
|
|
550
|
+
expiresAt: Date;
|
|
551
|
+
token: string;
|
|
552
|
+
ipAddress?: string | null | undefined;
|
|
553
|
+
userAgent?: string | null | undefined;
|
|
554
|
+
};
|
|
555
|
+
} | null, {
|
|
556
|
+
code?: string | undefined;
|
|
557
|
+
message?: string | undefined;
|
|
558
|
+
}, FetchOptions["throw"] extends true ? true : false>>;
|
|
559
|
+
} & {
|
|
560
|
+
useSession: () => {
|
|
561
|
+
data: {
|
|
562
|
+
user: {
|
|
563
|
+
id: string;
|
|
564
|
+
createdAt: Date;
|
|
565
|
+
updatedAt: Date;
|
|
566
|
+
email: string;
|
|
567
|
+
emailVerified: boolean;
|
|
568
|
+
name: string;
|
|
569
|
+
image?: string | null | undefined;
|
|
570
|
+
};
|
|
571
|
+
session: {
|
|
572
|
+
id: string;
|
|
573
|
+
createdAt: Date;
|
|
574
|
+
updatedAt: Date;
|
|
575
|
+
userId: string;
|
|
576
|
+
expiresAt: Date;
|
|
577
|
+
token: string;
|
|
578
|
+
ipAddress?: string | null | undefined;
|
|
579
|
+
userAgent?: string | null | undefined;
|
|
580
|
+
};
|
|
581
|
+
} | null;
|
|
582
|
+
isPending: boolean;
|
|
583
|
+
isRefetching: boolean;
|
|
584
|
+
error: _better_fetch_fetch0.BetterFetchError | null;
|
|
585
|
+
refetch: (queryParams?: {
|
|
586
|
+
query?: better_auth0.SessionQueryParams;
|
|
587
|
+
} | undefined) => Promise<void>;
|
|
588
|
+
};
|
|
589
|
+
$Infer: {
|
|
590
|
+
Session: {
|
|
591
|
+
user: {
|
|
592
|
+
id: string;
|
|
593
|
+
createdAt: Date;
|
|
594
|
+
updatedAt: Date;
|
|
595
|
+
email: string;
|
|
596
|
+
emailVerified: boolean;
|
|
597
|
+
name: string;
|
|
598
|
+
image?: string | null | undefined;
|
|
599
|
+
};
|
|
600
|
+
session: {
|
|
601
|
+
id: string;
|
|
602
|
+
createdAt: Date;
|
|
603
|
+
updatedAt: Date;
|
|
604
|
+
userId: string;
|
|
605
|
+
expiresAt: Date;
|
|
606
|
+
token: string;
|
|
607
|
+
ipAddress?: string | null | undefined;
|
|
608
|
+
userAgent?: string | null | undefined;
|
|
609
|
+
};
|
|
610
|
+
};
|
|
611
|
+
};
|
|
612
|
+
$fetch: _better_fetch_fetch0.BetterFetch<{
|
|
613
|
+
plugins: (_better_fetch_fetch0.BetterFetchPlugin | {
|
|
614
|
+
id: string;
|
|
615
|
+
name: string;
|
|
616
|
+
hooks: {
|
|
617
|
+
onSuccess(context: _better_fetch_fetch0.SuccessContext<any>): void;
|
|
618
|
+
};
|
|
619
|
+
} | {
|
|
620
|
+
id: string;
|
|
621
|
+
name: string;
|
|
622
|
+
hooks: {
|
|
623
|
+
onRequest<T extends Record<string, any>>(context: _better_fetch_fetch0.RequestContext<T>): void;
|
|
624
|
+
};
|
|
625
|
+
} | {
|
|
626
|
+
id: string;
|
|
627
|
+
name: string;
|
|
628
|
+
hooks: {
|
|
629
|
+
onSuccess: ((context: _better_fetch_fetch0.SuccessContext<any>) => Promise<void> | void) | undefined;
|
|
630
|
+
onError: ((context: _better_fetch_fetch0.ErrorContext) => Promise<void> | void) | undefined;
|
|
631
|
+
onRequest: (<T extends Record<string, any>>(context: _better_fetch_fetch0.RequestContext<T>) => Promise<_better_fetch_fetch0.RequestContext | void> | _better_fetch_fetch0.RequestContext | void) | undefined;
|
|
632
|
+
onResponse: ((context: _better_fetch_fetch0.ResponseContext) => Promise<Response | void | _better_fetch_fetch0.ResponseContext> | Response | _better_fetch_fetch0.ResponseContext | void) | undefined;
|
|
633
|
+
};
|
|
634
|
+
})[];
|
|
635
|
+
cache?: RequestCache | undefined;
|
|
636
|
+
method: string;
|
|
637
|
+
headers?: (HeadersInit & (HeadersInit | {
|
|
638
|
+
accept: "application/json" | "text/plain" | "application/octet-stream";
|
|
639
|
+
"content-type": "application/json" | "text/plain" | "application/x-www-form-urlencoded" | "multipart/form-data" | "application/octet-stream";
|
|
640
|
+
authorization: "Bearer" | "Basic";
|
|
641
|
+
})) | undefined;
|
|
642
|
+
redirect?: RequestRedirect | undefined;
|
|
643
|
+
credentials?: RequestCredentials;
|
|
644
|
+
integrity?: string | undefined;
|
|
645
|
+
keepalive?: boolean | undefined;
|
|
646
|
+
mode?: RequestMode | undefined;
|
|
647
|
+
priority?: RequestPriority | undefined;
|
|
648
|
+
referrer?: string | undefined;
|
|
649
|
+
referrerPolicy?: ReferrerPolicy | undefined;
|
|
650
|
+
signal?: (AbortSignal | null) | undefined;
|
|
651
|
+
window?: null | undefined;
|
|
652
|
+
onRetry?: ((response: _better_fetch_fetch0.ResponseContext) => Promise<void> | void) | undefined;
|
|
653
|
+
hookOptions?: {
|
|
654
|
+
cloneResponse?: boolean;
|
|
655
|
+
} | undefined;
|
|
656
|
+
timeout?: number | undefined;
|
|
657
|
+
customFetchImpl: _better_fetch_fetch0.FetchEsque;
|
|
658
|
+
baseURL: string;
|
|
659
|
+
throw?: boolean | undefined;
|
|
660
|
+
auth?: ({
|
|
661
|
+
type: "Bearer";
|
|
662
|
+
token: string | Promise<string | undefined> | (() => string | Promise<string | undefined> | undefined) | undefined;
|
|
663
|
+
} | {
|
|
664
|
+
type: "Basic";
|
|
665
|
+
username: string | (() => string | undefined) | undefined;
|
|
666
|
+
password: string | (() => string | undefined) | undefined;
|
|
667
|
+
} | {
|
|
668
|
+
type: "Custom";
|
|
669
|
+
prefix: string | (() => string | undefined) | undefined;
|
|
670
|
+
value: string | (() => string | undefined) | undefined;
|
|
671
|
+
}) | undefined;
|
|
672
|
+
body?: any;
|
|
673
|
+
query?: any;
|
|
674
|
+
params?: any;
|
|
675
|
+
duplex?: "full" | "half" | undefined;
|
|
676
|
+
jsonParser: (text: string) => Promise<any> | any;
|
|
677
|
+
retry?: _better_fetch_fetch0.RetryOptions | undefined;
|
|
678
|
+
retryAttempt?: number | undefined;
|
|
679
|
+
output?: (_better_fetch_fetch0.StandardSchemaV1 | typeof Blob | typeof File) | undefined;
|
|
680
|
+
errorSchema?: _better_fetch_fetch0.StandardSchemaV1 | undefined;
|
|
681
|
+
disableValidation?: boolean | undefined;
|
|
682
|
+
disableSignal?: boolean | undefined;
|
|
683
|
+
}, unknown, unknown, {}>;
|
|
684
|
+
$store: {
|
|
685
|
+
notify: (signal?: (Omit<string, "$sessionSignal"> | "$sessionSignal") | undefined) => void;
|
|
686
|
+
listen: (signal: Omit<string, "$sessionSignal"> | "$sessionSignal", listener: (value: boolean, oldValue?: boolean | undefined) => void) => void;
|
|
687
|
+
atoms: Record<string, nanostores0.WritableAtom<any>>;
|
|
688
|
+
};
|
|
689
|
+
$ERROR_CODES: {
|
|
690
|
+
readonly USER_NOT_FOUND: "User not found";
|
|
691
|
+
readonly FAILED_TO_CREATE_USER: "Failed to create user";
|
|
692
|
+
readonly FAILED_TO_CREATE_SESSION: "Failed to create session";
|
|
693
|
+
readonly FAILED_TO_UPDATE_USER: "Failed to update user";
|
|
694
|
+
readonly FAILED_TO_GET_SESSION: "Failed to get session";
|
|
695
|
+
readonly INVALID_PASSWORD: "Invalid password";
|
|
696
|
+
readonly INVALID_EMAIL: "Invalid email";
|
|
697
|
+
readonly INVALID_EMAIL_OR_PASSWORD: "Invalid email or password";
|
|
698
|
+
readonly SOCIAL_ACCOUNT_ALREADY_LINKED: "Social account already linked";
|
|
699
|
+
readonly PROVIDER_NOT_FOUND: "Provider not found";
|
|
700
|
+
readonly INVALID_TOKEN: "Invalid token";
|
|
701
|
+
readonly ID_TOKEN_NOT_SUPPORTED: "id_token not supported";
|
|
702
|
+
readonly FAILED_TO_GET_USER_INFO: "Failed to get user info";
|
|
703
|
+
readonly USER_EMAIL_NOT_FOUND: "User email not found";
|
|
704
|
+
readonly EMAIL_NOT_VERIFIED: "Email not verified";
|
|
705
|
+
readonly PASSWORD_TOO_SHORT: "Password too short";
|
|
706
|
+
readonly PASSWORD_TOO_LONG: "Password too long";
|
|
707
|
+
readonly USER_ALREADY_EXISTS: "User already exists.";
|
|
708
|
+
readonly USER_ALREADY_EXISTS_USE_ANOTHER_EMAIL: "User already exists. Use another email.";
|
|
709
|
+
readonly EMAIL_CAN_NOT_BE_UPDATED: "Email can not be updated";
|
|
710
|
+
readonly CREDENTIAL_ACCOUNT_NOT_FOUND: "Credential account not found";
|
|
711
|
+
readonly SESSION_EXPIRED: "Session expired. Re-authenticate to perform this action.";
|
|
712
|
+
readonly FAILED_TO_UNLINK_LAST_ACCOUNT: "You can't unlink your last account";
|
|
713
|
+
readonly ACCOUNT_NOT_FOUND: "Account not found";
|
|
714
|
+
readonly USER_ALREADY_HAS_PASSWORD: "User already has a password. Provide that to delete the account.";
|
|
715
|
+
};
|
|
716
|
+
};
|
|
717
|
+
getJWTToken(): Promise<string | null>;
|
|
718
|
+
}
|
|
719
|
+
//#endregion
|
|
720
|
+
//#region ../neon-auth/src/adapters/better-auth-vanilla/better-auth-vanilla-adapter.d.ts
|
|
721
|
+
type BetterAuthVanillaAdapterOptions = NeonAuthAdapterCoreAuthOptions;
|
|
722
|
+
declare class BetterAuthVanillaAdapter extends NeonAuthAdapterCore {
|
|
723
|
+
private _betterAuth;
|
|
724
|
+
constructor(betterAuthClientOptions: BetterAuthVanillaAdapterOptions);
|
|
725
|
+
getBetterAuthInstance(): AuthClient<BetterAuthClientOptions>;
|
|
726
|
+
getJWTToken(): Promise<string | null>;
|
|
727
|
+
}
|
|
728
|
+
//#endregion
|
|
729
|
+
//#region ../neon-auth/src/adapters/supabase/auth-interface.d.ts
|
|
730
|
+
type _UpstreamAuthClientInstance = InstanceType<typeof AuthClient$1>;
|
|
731
|
+
type _AuthClientBase = { [K in keyof _UpstreamAuthClientInstance as _UpstreamAuthClientInstance[K] extends never ? never : K]: _UpstreamAuthClientInstance[K] };
|
|
732
|
+
type SupabaseAuthClientInterface = _AuthClientBase;
|
|
733
|
+
//#endregion
|
|
734
|
+
//#region ../neon-auth/src/adapters/supabase/supabase-adapter.d.ts
|
|
735
|
+
type SupabaseAuthAdapterOptions = NeonAuthAdapterCoreAuthOptions;
|
|
736
|
+
declare class SupabaseAuthAdapter extends NeonAuthAdapterCore implements SupabaseAuthClientInterface {
|
|
737
|
+
admin: SupabaseAuthClientInterface['admin'];
|
|
738
|
+
mfa: SupabaseAuthClientInterface['mfa'];
|
|
739
|
+
oauth: SupabaseAuthClientInterface['oauth'];
|
|
740
|
+
private _betterAuth;
|
|
741
|
+
private _stateChangeEmitters;
|
|
742
|
+
constructor(betterAuthClientOptions: SupabaseAuthAdapterOptions);
|
|
743
|
+
getBetterAuthInstance(): AuthClient<BetterAuthClientOptions>;
|
|
744
|
+
getJWTToken(): Promise<string | null>;
|
|
745
|
+
initialize: SupabaseAuthClientInterface['initialize'];
|
|
746
|
+
getSession(options?: {
|
|
747
|
+
forceFetch?: boolean;
|
|
748
|
+
}): ReturnType<SupabaseAuthClientInterface['getSession']>;
|
|
749
|
+
refreshSession: SupabaseAuthClientInterface['refreshSession'];
|
|
750
|
+
setSession: SupabaseAuthClientInterface['setSession'];
|
|
751
|
+
signUp: SupabaseAuthClientInterface['signUp'];
|
|
752
|
+
signInAnonymously: SupabaseAuthClientInterface['signInAnonymously'];
|
|
753
|
+
signInWithPassword: SupabaseAuthClientInterface['signInWithPassword'];
|
|
754
|
+
signInWithOAuth: SupabaseAuthClientInterface['signInWithOAuth'];
|
|
755
|
+
signInWithOtp: SupabaseAuthClientInterface['signInWithOtp'];
|
|
756
|
+
signInWithIdToken: SupabaseAuthClientInterface['signInWithIdToken'];
|
|
757
|
+
signInWithSSO: SupabaseAuthClientInterface['signInWithSSO'];
|
|
758
|
+
signInWithWeb3: SupabaseAuthClientInterface['signInWithWeb3'];
|
|
759
|
+
signOut: SupabaseAuthClientInterface['signOut'];
|
|
760
|
+
getUser: SupabaseAuthClientInterface['getUser'];
|
|
761
|
+
getClaims: (jwtArg?: string) => Promise<{
|
|
762
|
+
data: {
|
|
763
|
+
header: JwtHeader;
|
|
764
|
+
claims: JwtPayload;
|
|
765
|
+
signature: Uint8Array<ArrayBufferLike>;
|
|
766
|
+
};
|
|
767
|
+
error: null;
|
|
768
|
+
} | {
|
|
769
|
+
data: null;
|
|
770
|
+
error: _supabase_auth_js0.AuthError;
|
|
771
|
+
}>;
|
|
772
|
+
updateUser: SupabaseAuthClientInterface['updateUser'];
|
|
773
|
+
getUserIdentities: SupabaseAuthClientInterface['getUserIdentities'];
|
|
774
|
+
linkIdentity: SupabaseAuthClientInterface['linkIdentity'];
|
|
775
|
+
unlinkIdentity: SupabaseAuthClientInterface['unlinkIdentity'];
|
|
776
|
+
verifyOtp: SupabaseAuthClientInterface['verifyOtp'];
|
|
777
|
+
resetPasswordForEmail: SupabaseAuthClientInterface['resetPasswordForEmail'];
|
|
778
|
+
reauthenticate: SupabaseAuthClientInterface['reauthenticate'];
|
|
779
|
+
resend: SupabaseAuthClientInterface['resend'];
|
|
780
|
+
exchangeCodeForSession: SupabaseAuthClientInterface['exchangeCodeForSession'];
|
|
781
|
+
onAuthStateChange: SupabaseAuthClientInterface['onAuthStateChange'];
|
|
782
|
+
isThrowOnErrorEnabled: SupabaseAuthClientInterface['isThrowOnErrorEnabled'];
|
|
783
|
+
startAutoRefresh: SupabaseAuthClientInterface['startAutoRefresh'];
|
|
784
|
+
stopAutoRefresh: SupabaseAuthClientInterface['stopAutoRefresh'];
|
|
785
|
+
private verifyEmailOtp;
|
|
786
|
+
private verifyPhoneOtp;
|
|
787
|
+
private emitInitialSession;
|
|
788
|
+
}
|
|
789
|
+
//#endregion
|
|
790
|
+
//#region ../neon-auth/src/neon-auth.d.ts
|
|
791
|
+
/**
|
|
792
|
+
* Type representing the Better Auth React client
|
|
793
|
+
*/
|
|
794
|
+
type ReactBetterAuthClient = ReturnType<typeof createAuthClient>;
|
|
795
|
+
/**
|
|
796
|
+
* Type representing the Better Auth Vanilla client
|
|
797
|
+
*/
|
|
798
|
+
type VanillaBetterAuthClient = ReturnType<typeof createAuthClient$1>;
|
|
799
|
+
/**
|
|
800
|
+
* Union type of all supported auth adapter CLASSES (not instances)
|
|
801
|
+
* Use this when you need to pass an adapter class as a parameter
|
|
802
|
+
*/
|
|
803
|
+
type NeonAuthAdapterClass = typeof BetterAuthVanillaAdapter | typeof BetterAuthReactAdapter | typeof SupabaseAuthAdapter;
|
|
804
|
+
/**
|
|
805
|
+
* Union type of all supported auth adapter instances
|
|
806
|
+
*/
|
|
807
|
+
type NeonAuthAdapter = BetterAuthVanillaAdapter | BetterAuthReactAdapter | SupabaseAuthAdapter;
|
|
808
|
+
/**
|
|
809
|
+
* Configuration for createNeonAuth
|
|
810
|
+
* T is the adapter CLASS type (typeof SupabaseAuthAdapter), not the instance type
|
|
811
|
+
*/
|
|
812
|
+
interface NeonAuthConfig<T extends NeonAuthAdapterClass> {
|
|
813
|
+
/** The adapter class to use (e.g., SupabaseAuthAdapter, BetterAuthVanillaAdapter) */
|
|
814
|
+
adapter: T;
|
|
815
|
+
/** Additional options to pass to the adapter (baseURL is auto-injected) */
|
|
816
|
+
options?: Omit<ConstructorParameters<T>[0], 'baseURL'>;
|
|
817
|
+
}
|
|
818
|
+
/**
|
|
819
|
+
* Resolves the public API type for an adapter.
|
|
820
|
+
* - SupabaseAuthAdapter: exposes its own methods directly (Supabase-compatible API)
|
|
821
|
+
* - BetterAuth adapters: expose the Better Auth client directly
|
|
822
|
+
*/
|
|
823
|
+
type NeonAuthPublicApi<T extends NeonAuthAdapter> = T extends BetterAuthVanillaAdapter ? VanillaBetterAuthClient : T extends BetterAuthReactAdapter ? ReactBetterAuthClient : T;
|
|
824
|
+
/**
|
|
825
|
+
* NeonAuth type - combines base functionality with the appropriate public API
|
|
826
|
+
* This is the return type of createNeonAuth()
|
|
827
|
+
*
|
|
828
|
+
* For SupabaseAuthAdapter: exposes Supabase-compatible methods (signInWithPassword, getSession, etc.)
|
|
829
|
+
* For BetterAuth adapters: exposes the Better Auth client directly (signIn.email, signUp.email, etc.)
|
|
830
|
+
*/
|
|
831
|
+
type NeonAuth<T extends NeonAuthAdapter> = {
|
|
832
|
+
adapter: NeonAuthPublicApi<T>;
|
|
833
|
+
getJWTToken: () => Promise<string | null>;
|
|
834
|
+
};
|
|
835
|
+
/**
|
|
836
|
+
* Create a NeonAuth instance that exposes the appropriate API based on the adapter.
|
|
837
|
+
*
|
|
838
|
+
* @param url - The auth service URL (e.g., 'https://auth.example.com')
|
|
839
|
+
* @param config - Configuration with adapter class and optional adapter-specific options
|
|
840
|
+
* @returns NeonAuth instance with the adapter's API exposed directly
|
|
841
|
+
*
|
|
842
|
+
* @example SupabaseAuthAdapter - Supabase-compatible API
|
|
843
|
+
* ```typescript
|
|
844
|
+
* import { createNeonAuth, SupabaseAuthAdapter } from '@neondatabase/neon-auth';
|
|
845
|
+
*
|
|
846
|
+
* const auth = createNeonAuth('https://auth.example.com', {
|
|
847
|
+
* adapter: SupabaseAuthAdapter,
|
|
848
|
+
* });
|
|
849
|
+
*
|
|
850
|
+
* // Supabase-compatible methods
|
|
851
|
+
* await auth.signInWithPassword({ email, password });
|
|
852
|
+
* await auth.getSession();
|
|
853
|
+
* ```
|
|
854
|
+
*
|
|
855
|
+
* @example BetterAuthVanillaAdapter - Direct Better Auth API
|
|
856
|
+
* ```typescript
|
|
857
|
+
* import { createNeonAuth, BetterAuthVanillaAdapter } from '@neondatabase/neon-auth';
|
|
858
|
+
*
|
|
859
|
+
* const auth = createNeonAuth('https://auth.example.com', {
|
|
860
|
+
* adapter: BetterAuthVanillaAdapter,
|
|
861
|
+
* });
|
|
862
|
+
*
|
|
863
|
+
* // Direct Better Auth API access
|
|
864
|
+
* await auth.signIn.email({ email, password });
|
|
865
|
+
* await auth.signUp.email({ email, password, name: 'John' });
|
|
866
|
+
* await auth.getSession();
|
|
867
|
+
* ```
|
|
868
|
+
*
|
|
869
|
+
* @example BetterAuthReactAdapter - Better Auth with React hooks
|
|
870
|
+
* ```typescript
|
|
871
|
+
* import { createNeonAuth, BetterAuthReactAdapter } from '@neondatabase/neon-auth';
|
|
872
|
+
*
|
|
873
|
+
* const auth = createNeonAuth('https://auth.example.com', {
|
|
874
|
+
* adapter: BetterAuthReactAdapter,
|
|
875
|
+
* });
|
|
876
|
+
*
|
|
877
|
+
* // Direct Better Auth API with React hooks
|
|
878
|
+
* await auth.signIn.email({ email, password });
|
|
879
|
+
* const session = auth.useSession(); // React hook
|
|
880
|
+
* ```
|
|
881
|
+
*/
|
|
882
|
+
declare function createInternalNeonAuth<T extends NeonAuthAdapterClass>(url: string, config: NeonAuthConfig<T>): NeonAuth<InstanceType<T>>;
|
|
883
|
+
declare function createNeonAuth<T extends NeonAuthAdapterClass>(url: string, config: NeonAuthConfig<T>): NeonAuthPublicApi<InstanceType<T>>;
|
|
884
|
+
//#endregion
|
|
885
|
+
//#region ../neon-auth/src/utils/jwt.d.ts
|
|
886
|
+
/**
|
|
887
|
+
* Extract expiration timestamp from JWT payload
|
|
888
|
+
* @param jwt - The JWT token string
|
|
889
|
+
* @returns Expiration timestamp in seconds (Unix time) or null if invalid
|
|
890
|
+
*/
|
|
891
|
+
declare function getJwtExpiration(jwt: string): number | null;
|
|
892
|
+
/**
|
|
893
|
+
* Extract expiration timestamp from JWT payload in milliseconds
|
|
894
|
+
* @param jwt - The JWT token string
|
|
895
|
+
* @returns Expiration timestamp in milliseconds or null if invalid
|
|
896
|
+
*/
|
|
897
|
+
declare function getJwtExpirationMs(jwt: string): number | null;
|
|
898
|
+
//#endregion
|
|
899
|
+
//#region ../postgrest-js/src/client/postgrest-client.d.ts
|
|
900
|
+
type NeonPostgrestClientConstructorOptions<SchemaName> = {
|
|
901
|
+
dataApiUrl: string;
|
|
902
|
+
options?: {
|
|
903
|
+
db?: {
|
|
904
|
+
schema?: Exclude<SchemaName, '__InternalSupabase'>;
|
|
905
|
+
};
|
|
906
|
+
global?: {
|
|
907
|
+
fetch: typeof fetch;
|
|
908
|
+
headers?: Record<string, string>;
|
|
909
|
+
};
|
|
910
|
+
};
|
|
911
|
+
};
|
|
912
|
+
type DefaultSchemaName<Database> = 'public' extends keyof Database ? 'public' : string & keyof Database;
|
|
913
|
+
/**
|
|
914
|
+
* Neon PostgreSQL client for querying the Neon Data API
|
|
915
|
+
*
|
|
916
|
+
* This is a generic PostgreSQL client without authentication built-in.
|
|
917
|
+
* For auth-integrated clients, use @neondatabase/neon-js instead.
|
|
918
|
+
*
|
|
919
|
+
* Extends the upstream PostgrestClient with Neon-specific configuration.
|
|
920
|
+
*/
|
|
921
|
+
declare class NeonPostgrestClient<Database = any, SchemaName extends string & keyof Database = DefaultSchemaName<Database>> extends PostgrestClient<Database, {
|
|
922
|
+
PostgrestVersion: '12';
|
|
923
|
+
}, Exclude<SchemaName, '__InternalSupabase'>> {
|
|
924
|
+
constructor({
|
|
925
|
+
dataApiUrl,
|
|
926
|
+
options
|
|
927
|
+
}: NeonPostgrestClientConstructorOptions<SchemaName>);
|
|
928
|
+
}
|
|
929
|
+
//#endregion
|
|
930
|
+
//#region src/client/neon-client.d.ts
|
|
931
|
+
type NeonClientConstructorOptions<SchemaName, TAuth extends NeonAuthAdapter = NeonAuthAdapter> = NeonPostgrestClientConstructorOptions<SchemaName> & {
|
|
932
|
+
authClient: NeonAuth<TAuth>;
|
|
933
|
+
};
|
|
934
|
+
/**
|
|
935
|
+
* Neon client with integrated authentication
|
|
936
|
+
*
|
|
937
|
+
* Extends NeonPostgrestClient with Neon Auth integration.
|
|
938
|
+
* For auth-free clients, use @neondatabase/postgrest-js instead.
|
|
939
|
+
*/
|
|
940
|
+
declare class NeonClient<Database = any, SchemaName extends string & keyof Database = DefaultSchemaName<Database>, TAuth extends NeonAuthAdapter = NeonAuthAdapter> extends NeonPostgrestClient<Database, SchemaName> {
|
|
941
|
+
auth: NeonAuthPublicApi<TAuth>;
|
|
942
|
+
constructor({
|
|
943
|
+
dataApiUrl,
|
|
944
|
+
options,
|
|
945
|
+
authClient
|
|
946
|
+
}: NeonClientConstructorOptions<SchemaName, TAuth>);
|
|
947
|
+
}
|
|
948
|
+
//#endregion
|
|
949
|
+
//#region src/client/client-factory.d.ts
|
|
950
|
+
/**
|
|
951
|
+
* Auth configuration for createClient
|
|
952
|
+
*/
|
|
953
|
+
type CreateClientAuthConfig<T extends NeonAuthAdapterClass> = {
|
|
954
|
+
/** The adapter class to use (e.g., SupabaseAuthAdapter, BetterAuthVanillaAdapter) */
|
|
955
|
+
adapter: T;
|
|
956
|
+
/** The auth service URL */
|
|
957
|
+
url: string;
|
|
958
|
+
/** Additional auth options (baseURL is set from url above) */
|
|
959
|
+
options?: Omit<ConstructorParameters<T>[0], 'baseURL'>;
|
|
960
|
+
};
|
|
961
|
+
/**
|
|
962
|
+
* Data API configuration for createClient
|
|
963
|
+
*/
|
|
964
|
+
type CreateClientDataApiConfig<SchemaName, TAuth extends NeonAuthAdapter> = {
|
|
965
|
+
/** The Data API URL */
|
|
966
|
+
url: string;
|
|
967
|
+
/** Additional client options */
|
|
968
|
+
options?: Omit<NeonClientConstructorOptions<SchemaName, TAuth>, 'dataApiUrl' | 'authClient'>['options'];
|
|
969
|
+
};
|
|
970
|
+
/**
|
|
971
|
+
* Configuration for createClient
|
|
972
|
+
*/
|
|
973
|
+
type CreateClientConfig<SchemaName, T extends NeonAuthAdapterClass> = {
|
|
974
|
+
/** Auth service configuration */
|
|
975
|
+
auth: CreateClientAuthConfig<T>;
|
|
976
|
+
/** Data API configuration */
|
|
977
|
+
dataApi: CreateClientDataApiConfig<SchemaName, InstanceType<T>>;
|
|
978
|
+
};
|
|
979
|
+
/**
|
|
980
|
+
* Factory function to create NeonClient with seamless auth integration.
|
|
981
|
+
*
|
|
982
|
+
* @param config - Configuration with auth and dataApi sections
|
|
983
|
+
* @returns NeonClient instance with auth-aware fetch wrapper
|
|
984
|
+
* @throws AuthRequiredError when making requests without authentication
|
|
985
|
+
*
|
|
986
|
+
* @example
|
|
987
|
+
* ```typescript
|
|
988
|
+
* import { createClient, SupabaseAuthAdapter } from '@neondatabase/neon-js';
|
|
989
|
+
*
|
|
990
|
+
* const client = createClient({
|
|
991
|
+
* auth: {
|
|
992
|
+
* adapter: SupabaseAuthAdapter,
|
|
993
|
+
* url: 'https://auth.example.com',
|
|
994
|
+
* },
|
|
995
|
+
* dataApi: {
|
|
996
|
+
* url: 'https://data-api.example.com/rest/v1',
|
|
997
|
+
* },
|
|
998
|
+
* });
|
|
999
|
+
*
|
|
1000
|
+
* // Auth methods (API depends on adapter)
|
|
1001
|
+
* await client.auth.signInWithPassword({ email, password });
|
|
1002
|
+
*
|
|
1003
|
+
* // Database queries (automatic token injection)
|
|
1004
|
+
* const { data: items } = await client.from('items').select();
|
|
1005
|
+
* ```
|
|
1006
|
+
*
|
|
1007
|
+
* @example
|
|
1008
|
+
* ```typescript
|
|
1009
|
+
* import { createClient, BetterAuthVanillaAdapter } from '@neondatabase/neon-js';
|
|
1010
|
+
*
|
|
1011
|
+
* const client = createClient({
|
|
1012
|
+
* auth: {
|
|
1013
|
+
* adapter: BetterAuthVanillaAdapter,
|
|
1014
|
+
* url: 'https://auth.example.com',
|
|
1015
|
+
* },
|
|
1016
|
+
* dataApi: {
|
|
1017
|
+
* url: 'https://data-api.example.com/rest/v1',
|
|
1018
|
+
* },
|
|
1019
|
+
* });
|
|
1020
|
+
*
|
|
1021
|
+
* // Access raw Better Auth client
|
|
1022
|
+
* const betterAuth = client.auth.getBetterAuthInstance();
|
|
1023
|
+
* await betterAuth.signIn.email({ email, password });
|
|
1024
|
+
* ```
|
|
1025
|
+
*/
|
|
1026
|
+
/**
|
|
1027
|
+
* Helper type to create NeonClient with proper schema resolution.
|
|
1028
|
+
* Uses 'public' as the default schema since it's the most common case.
|
|
1029
|
+
*/
|
|
1030
|
+
type CreateClientResult<Database, TAdapter extends NeonAuthAdapter> = NeonClient<Database, DefaultSchemaName<Database>, TAdapter>;
|
|
1031
|
+
declare function createClient<Database = any>(config: CreateClientConfig<DefaultSchemaName<Database>, typeof SupabaseAuthAdapter>): CreateClientResult<Database, SupabaseAuthAdapter>;
|
|
1032
|
+
declare function createClient<Database = any>(config: CreateClientConfig<DefaultSchemaName<Database>, typeof BetterAuthVanillaAdapter>): CreateClientResult<Database, BetterAuthVanillaAdapter>;
|
|
1033
|
+
declare function createClient<Database = any>(config: CreateClientConfig<DefaultSchemaName<Database>, typeof BetterAuthReactAdapter>): CreateClientResult<Database, BetterAuthReactAdapter>;
|
|
1034
|
+
//#endregion
|
|
1035
|
+
export { AuthApiError, AuthError, BetterAuthReactAdapter, BetterAuthVanillaAdapter, type NeonAuth, type NeonAuthAdapter, type NeonAuthAdapterClass, type NeonAuthConfig, type NeonAuthPublicApi, type ReactBetterAuthClient, type Session, SupabaseAuthAdapter, type SupabaseAuthAdapterOptions, type User, type VanillaBetterAuthClient, createClient, createInternalNeonAuth, createNeonAuth, getJwtExpiration, getJwtExpirationMs, isAuthError, useBetterAuthStore };
|