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