@payez/next-mvp 4.0.47 → 4.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api-handlers/admin/stats.js +24 -14
- package/dist/auth/better-auth.d.ts +122 -2
- package/dist/auth/better-auth.js +24 -2
- package/dist/client/better-auth-client.d.ts +216 -216
- package/dist/lib/session-store.js +21 -21
- package/dist/server/auth.d.ts +96 -1
- package/dist/vibe/hooks/index.d.ts +1 -1
- package/package.json +1 -1
- package/src/api-handlers/admin/stats.ts +249 -238
- package/src/auth/better-auth.ts +408 -368
- package/src/lib/session-store.ts +689 -689
- package/src/server/auth.ts +78 -78
- package/src/server/decode-session.ts +200 -200
|
@@ -7,89 +7,6 @@
|
|
|
7
7
|
* components written against the legacy hook don't need destructure changes.
|
|
8
8
|
*/
|
|
9
9
|
export declare const authClient: {
|
|
10
|
-
signIn: {
|
|
11
|
-
social: <FetchOptions extends import("@better-auth/core").ClientFetchOption<Partial<{
|
|
12
|
-
provider: "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" | "railway" | "vercel" | "wechat" | (string & {});
|
|
13
|
-
callbackURL?: string | undefined;
|
|
14
|
-
newUserCallbackURL?: string | undefined;
|
|
15
|
-
errorCallbackURL?: string | undefined;
|
|
16
|
-
disableRedirect?: boolean | undefined;
|
|
17
|
-
idToken?: {
|
|
18
|
-
token: string;
|
|
19
|
-
nonce?: string | undefined;
|
|
20
|
-
accessToken?: string | undefined;
|
|
21
|
-
refreshToken?: string | undefined;
|
|
22
|
-
expiresAt?: number | undefined;
|
|
23
|
-
user?: {
|
|
24
|
-
name?: {
|
|
25
|
-
firstName?: string | undefined;
|
|
26
|
-
lastName?: string | undefined;
|
|
27
|
-
} | undefined;
|
|
28
|
-
email?: string | undefined;
|
|
29
|
-
} | undefined;
|
|
30
|
-
} | undefined;
|
|
31
|
-
scopes?: string[] | undefined;
|
|
32
|
-
requestSignUp?: boolean | undefined;
|
|
33
|
-
loginHint?: string | undefined;
|
|
34
|
-
additionalData?: Record<string, any> | undefined;
|
|
35
|
-
}> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: import("better-auth/react").Prettify<{
|
|
36
|
-
provider: "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" | "railway" | "vercel" | "wechat" | (string & {});
|
|
37
|
-
callbackURL?: string | undefined;
|
|
38
|
-
newUserCallbackURL?: string | undefined;
|
|
39
|
-
errorCallbackURL?: string | undefined;
|
|
40
|
-
disableRedirect?: boolean | undefined;
|
|
41
|
-
idToken?: {
|
|
42
|
-
token: string;
|
|
43
|
-
nonce?: string | undefined;
|
|
44
|
-
accessToken?: string | undefined;
|
|
45
|
-
refreshToken?: string | undefined;
|
|
46
|
-
expiresAt?: number | undefined;
|
|
47
|
-
user?: {
|
|
48
|
-
name?: {
|
|
49
|
-
firstName?: string | undefined;
|
|
50
|
-
lastName?: string | undefined;
|
|
51
|
-
} | undefined;
|
|
52
|
-
email?: string | undefined;
|
|
53
|
-
} | undefined;
|
|
54
|
-
} | undefined;
|
|
55
|
-
scopes?: string[] | undefined;
|
|
56
|
-
requestSignUp?: boolean | undefined;
|
|
57
|
-
loginHint?: string | undefined;
|
|
58
|
-
additionalData?: Record<string, any> | undefined;
|
|
59
|
-
} & {
|
|
60
|
-
fetchOptions?: FetchOptions | undefined;
|
|
61
|
-
}>, data_1?: FetchOptions | undefined) => Promise<import("@better-fetch/fetch").BetterFetchResponse<{
|
|
62
|
-
redirect: boolean;
|
|
63
|
-
url: string;
|
|
64
|
-
} | (Omit<{
|
|
65
|
-
redirect: boolean;
|
|
66
|
-
token: string;
|
|
67
|
-
url: undefined;
|
|
68
|
-
user: {
|
|
69
|
-
id: string;
|
|
70
|
-
createdAt: Date;
|
|
71
|
-
updatedAt: Date;
|
|
72
|
-
email: string;
|
|
73
|
-
emailVerified: boolean;
|
|
74
|
-
name: string;
|
|
75
|
-
image?: string | null | undefined | undefined;
|
|
76
|
-
};
|
|
77
|
-
}, "user"> & {
|
|
78
|
-
user: import("better-auth/react").StripEmptyObjects<{
|
|
79
|
-
id: string;
|
|
80
|
-
createdAt: Date;
|
|
81
|
-
updatedAt: Date;
|
|
82
|
-
email: string;
|
|
83
|
-
emailVerified: boolean;
|
|
84
|
-
name: string;
|
|
85
|
-
image?: string | null | undefined;
|
|
86
|
-
}>;
|
|
87
|
-
}), {
|
|
88
|
-
code?: string | undefined;
|
|
89
|
-
message?: string | undefined;
|
|
90
|
-
}, FetchOptions["throw"] extends true ? true : false>>;
|
|
91
|
-
};
|
|
92
|
-
} & {
|
|
93
10
|
signOut: <FetchOptions extends import("@better-auth/core").ClientFetchOption<never, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0?: import("better-auth/react").Prettify<{
|
|
94
11
|
query?: Record<string, any> | undefined;
|
|
95
12
|
fetchOptions?: FetchOptions | undefined;
|
|
@@ -99,111 +16,6 @@ export declare const authClient: {
|
|
|
99
16
|
code?: string | undefined;
|
|
100
17
|
message?: string | undefined;
|
|
101
18
|
}, FetchOptions["throw"] extends true ? true : false>>;
|
|
102
|
-
} & {
|
|
103
|
-
signUp: {
|
|
104
|
-
email: <FetchOptions extends import("@better-auth/core").ClientFetchOption<Partial<{
|
|
105
|
-
name: string;
|
|
106
|
-
email: string;
|
|
107
|
-
password: string;
|
|
108
|
-
image?: string | undefined;
|
|
109
|
-
callbackURL?: string | undefined;
|
|
110
|
-
rememberMe?: boolean | undefined;
|
|
111
|
-
}> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: import("better-auth/react").Prettify<{
|
|
112
|
-
email: string;
|
|
113
|
-
name: string;
|
|
114
|
-
password: string;
|
|
115
|
-
image?: string | undefined;
|
|
116
|
-
callbackURL?: string | undefined;
|
|
117
|
-
fetchOptions?: FetchOptions | undefined;
|
|
118
|
-
}>, data_1?: FetchOptions | undefined) => Promise<import("@better-fetch/fetch").BetterFetchResponse<(Omit<{
|
|
119
|
-
token: null;
|
|
120
|
-
user: {
|
|
121
|
-
id: string;
|
|
122
|
-
createdAt: Date;
|
|
123
|
-
updatedAt: Date;
|
|
124
|
-
email: string;
|
|
125
|
-
emailVerified: boolean;
|
|
126
|
-
name: string;
|
|
127
|
-
image?: string | null | undefined | undefined;
|
|
128
|
-
};
|
|
129
|
-
}, "user"> & {
|
|
130
|
-
user: import("better-auth/react").StripEmptyObjects<{
|
|
131
|
-
id: string;
|
|
132
|
-
createdAt: Date;
|
|
133
|
-
updatedAt: Date;
|
|
134
|
-
email: string;
|
|
135
|
-
emailVerified: boolean;
|
|
136
|
-
name: string;
|
|
137
|
-
image?: string | null | undefined;
|
|
138
|
-
}>;
|
|
139
|
-
}) | (Omit<{
|
|
140
|
-
token: string;
|
|
141
|
-
user: {
|
|
142
|
-
id: string;
|
|
143
|
-
createdAt: Date;
|
|
144
|
-
updatedAt: Date;
|
|
145
|
-
email: string;
|
|
146
|
-
emailVerified: boolean;
|
|
147
|
-
name: string;
|
|
148
|
-
image?: string | null | undefined | undefined;
|
|
149
|
-
};
|
|
150
|
-
}, "user"> & {
|
|
151
|
-
user: import("better-auth/react").StripEmptyObjects<{
|
|
152
|
-
id: string;
|
|
153
|
-
createdAt: Date;
|
|
154
|
-
updatedAt: Date;
|
|
155
|
-
email: string;
|
|
156
|
-
emailVerified: boolean;
|
|
157
|
-
name: string;
|
|
158
|
-
image?: string | null | undefined;
|
|
159
|
-
}>;
|
|
160
|
-
}), {
|
|
161
|
-
code?: string | undefined;
|
|
162
|
-
message?: string | undefined;
|
|
163
|
-
}, FetchOptions["throw"] extends true ? true : false>>;
|
|
164
|
-
};
|
|
165
|
-
} & {
|
|
166
|
-
signIn: {
|
|
167
|
-
email: <FetchOptions extends import("@better-auth/core").ClientFetchOption<Partial<{
|
|
168
|
-
email: string;
|
|
169
|
-
password: string;
|
|
170
|
-
callbackURL?: string | undefined;
|
|
171
|
-
rememberMe?: boolean | undefined;
|
|
172
|
-
}> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: import("better-auth/react").Prettify<{
|
|
173
|
-
email: string;
|
|
174
|
-
password: string;
|
|
175
|
-
callbackURL?: string | undefined;
|
|
176
|
-
rememberMe?: boolean | undefined;
|
|
177
|
-
} & {
|
|
178
|
-
fetchOptions?: FetchOptions | undefined;
|
|
179
|
-
}>, data_1?: FetchOptions | undefined) => Promise<import("@better-fetch/fetch").BetterFetchResponse<Omit<{
|
|
180
|
-
redirect: boolean;
|
|
181
|
-
token: string;
|
|
182
|
-
url?: string | undefined;
|
|
183
|
-
user: {
|
|
184
|
-
id: string;
|
|
185
|
-
createdAt: Date;
|
|
186
|
-
updatedAt: Date;
|
|
187
|
-
email: string;
|
|
188
|
-
emailVerified: boolean;
|
|
189
|
-
name: string;
|
|
190
|
-
image?: string | null | undefined | undefined;
|
|
191
|
-
};
|
|
192
|
-
}, "user"> & {
|
|
193
|
-
user: import("better-auth/react").StripEmptyObjects<{
|
|
194
|
-
id: string;
|
|
195
|
-
createdAt: Date;
|
|
196
|
-
updatedAt: Date;
|
|
197
|
-
email: string;
|
|
198
|
-
emailVerified: boolean;
|
|
199
|
-
name: string;
|
|
200
|
-
image?: string | null | undefined;
|
|
201
|
-
}>;
|
|
202
|
-
}, {
|
|
203
|
-
code?: string | undefined;
|
|
204
|
-
message?: string | undefined;
|
|
205
|
-
}, FetchOptions["throw"] extends true ? true : false>>;
|
|
206
|
-
};
|
|
207
19
|
} & {
|
|
208
20
|
resetPassword: <FetchOptions extends import("@better-auth/core").ClientFetchOption<Partial<{
|
|
209
21
|
newPassword: string;
|
|
@@ -311,34 +123,6 @@ export declare const authClient: {
|
|
|
311
123
|
code?: string | undefined;
|
|
312
124
|
message?: string | undefined;
|
|
313
125
|
}, FetchOptions["throw"] extends true ? true : false>>;
|
|
314
|
-
} & {
|
|
315
|
-
updateSession: <FetchOptions extends import("@better-auth/core").ClientFetchOption<Partial<Partial<{}>> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0?: import("better-auth/react").Prettify<Partial<{}> & {
|
|
316
|
-
fetchOptions?: FetchOptions | undefined;
|
|
317
|
-
}> | undefined, data_1?: FetchOptions | undefined) => Promise<import("@better-fetch/fetch").BetterFetchResponse<{
|
|
318
|
-
session: {
|
|
319
|
-
id: string;
|
|
320
|
-
createdAt: Date;
|
|
321
|
-
updatedAt: Date;
|
|
322
|
-
userId: string;
|
|
323
|
-
expiresAt: Date;
|
|
324
|
-
token: string;
|
|
325
|
-
ipAddress?: string | null | undefined;
|
|
326
|
-
userAgent?: string | null | undefined;
|
|
327
|
-
};
|
|
328
|
-
}, {
|
|
329
|
-
code?: string | undefined;
|
|
330
|
-
message?: string | undefined;
|
|
331
|
-
}, FetchOptions["throw"] extends true ? true : false>>;
|
|
332
|
-
} & {
|
|
333
|
-
updateUser: <FetchOptions extends import("@better-auth/core").ClientFetchOption<Partial<Partial<{}> & {
|
|
334
|
-
name?: string | undefined;
|
|
335
|
-
image?: string | undefined | null;
|
|
336
|
-
}> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0?: import("better-auth/react").Prettify<import("better-auth/dist/client/path-to-object.mjs").InferUserUpdateCtx<{}, FetchOptions>> | undefined, data_1?: FetchOptions | undefined) => Promise<import("@better-fetch/fetch").BetterFetchResponse<{
|
|
337
|
-
status: boolean;
|
|
338
|
-
}, {
|
|
339
|
-
code?: string | undefined;
|
|
340
|
-
message?: string | undefined;
|
|
341
|
-
}, FetchOptions["throw"] extends true ? true : false>>;
|
|
342
126
|
} & {
|
|
343
127
|
deleteUser: <FetchOptions extends import("@better-auth/core").ClientFetchOption<Partial<{
|
|
344
128
|
callbackURL?: string | undefined;
|
|
@@ -588,6 +372,222 @@ export declare const authClient: {
|
|
|
588
372
|
code?: string | undefined;
|
|
589
373
|
message?: string | undefined;
|
|
590
374
|
}, FetchOptions["throw"] extends true ? true : false>>;
|
|
375
|
+
} & {
|
|
376
|
+
signIn: {
|
|
377
|
+
social: <FetchOptions extends import("@better-auth/core").ClientFetchOption<Partial<{
|
|
378
|
+
provider: "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" | "railway" | "vercel" | "wechat" | (string & {});
|
|
379
|
+
callbackURL?: string | undefined;
|
|
380
|
+
newUserCallbackURL?: string | undefined;
|
|
381
|
+
errorCallbackURL?: string | undefined;
|
|
382
|
+
disableRedirect?: boolean | undefined;
|
|
383
|
+
idToken?: {
|
|
384
|
+
token: string;
|
|
385
|
+
nonce?: string | undefined;
|
|
386
|
+
accessToken?: string | undefined;
|
|
387
|
+
refreshToken?: string | undefined;
|
|
388
|
+
expiresAt?: number | undefined;
|
|
389
|
+
user?: {
|
|
390
|
+
name?: {
|
|
391
|
+
firstName?: string | undefined;
|
|
392
|
+
lastName?: string | undefined;
|
|
393
|
+
} | undefined;
|
|
394
|
+
email?: string | undefined;
|
|
395
|
+
} | undefined;
|
|
396
|
+
} | undefined;
|
|
397
|
+
scopes?: string[] | undefined;
|
|
398
|
+
requestSignUp?: boolean | undefined;
|
|
399
|
+
loginHint?: string | undefined;
|
|
400
|
+
additionalData?: Record<string, any> | undefined;
|
|
401
|
+
}> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: import("better-auth/react").Prettify<{
|
|
402
|
+
provider: "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" | "railway" | "vercel" | "wechat" | (string & {});
|
|
403
|
+
callbackURL?: string | undefined;
|
|
404
|
+
newUserCallbackURL?: string | undefined;
|
|
405
|
+
errorCallbackURL?: string | undefined;
|
|
406
|
+
disableRedirect?: boolean | undefined;
|
|
407
|
+
idToken?: {
|
|
408
|
+
token: string;
|
|
409
|
+
nonce?: string | undefined;
|
|
410
|
+
accessToken?: string | undefined;
|
|
411
|
+
refreshToken?: string | undefined;
|
|
412
|
+
expiresAt?: number | undefined;
|
|
413
|
+
user?: {
|
|
414
|
+
name?: {
|
|
415
|
+
firstName?: string | undefined;
|
|
416
|
+
lastName?: string | undefined;
|
|
417
|
+
} | undefined;
|
|
418
|
+
email?: string | undefined;
|
|
419
|
+
} | undefined;
|
|
420
|
+
} | undefined;
|
|
421
|
+
scopes?: string[] | undefined;
|
|
422
|
+
requestSignUp?: boolean | undefined;
|
|
423
|
+
loginHint?: string | undefined;
|
|
424
|
+
additionalData?: Record<string, any> | undefined;
|
|
425
|
+
} & {
|
|
426
|
+
fetchOptions?: FetchOptions | undefined;
|
|
427
|
+
}>, data_1?: FetchOptions | undefined) => Promise<import("@better-fetch/fetch").BetterFetchResponse<{
|
|
428
|
+
redirect: boolean;
|
|
429
|
+
url: string;
|
|
430
|
+
} | (Omit<{
|
|
431
|
+
redirect: boolean;
|
|
432
|
+
token: string;
|
|
433
|
+
url: undefined;
|
|
434
|
+
user: {
|
|
435
|
+
id: string;
|
|
436
|
+
createdAt: Date;
|
|
437
|
+
updatedAt: Date;
|
|
438
|
+
email: string;
|
|
439
|
+
emailVerified: boolean;
|
|
440
|
+
name: string;
|
|
441
|
+
image?: string | null | undefined | undefined;
|
|
442
|
+
};
|
|
443
|
+
}, "user"> & {
|
|
444
|
+
user: import("better-auth/react").StripEmptyObjects<{
|
|
445
|
+
id: string;
|
|
446
|
+
createdAt: Date;
|
|
447
|
+
updatedAt: Date;
|
|
448
|
+
email: string;
|
|
449
|
+
emailVerified: boolean;
|
|
450
|
+
name: string;
|
|
451
|
+
image?: string | null | undefined;
|
|
452
|
+
}>;
|
|
453
|
+
}), {
|
|
454
|
+
code?: string | undefined;
|
|
455
|
+
message?: string | undefined;
|
|
456
|
+
}, FetchOptions["throw"] extends true ? true : false>>;
|
|
457
|
+
};
|
|
458
|
+
} & {
|
|
459
|
+
signUp: {
|
|
460
|
+
email: <FetchOptions extends import("@better-auth/core").ClientFetchOption<Partial<{
|
|
461
|
+
name: string;
|
|
462
|
+
email: string;
|
|
463
|
+
password: string;
|
|
464
|
+
image?: string | undefined;
|
|
465
|
+
callbackURL?: string | undefined;
|
|
466
|
+
rememberMe?: boolean | undefined;
|
|
467
|
+
}> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: import("better-auth/react").Prettify<{
|
|
468
|
+
email: string;
|
|
469
|
+
name: string;
|
|
470
|
+
password: string;
|
|
471
|
+
image?: string | undefined;
|
|
472
|
+
callbackURL?: string | undefined;
|
|
473
|
+
fetchOptions?: FetchOptions | undefined;
|
|
474
|
+
}>, data_1?: FetchOptions | undefined) => Promise<import("@better-fetch/fetch").BetterFetchResponse<(Omit<{
|
|
475
|
+
token: null;
|
|
476
|
+
user: {
|
|
477
|
+
id: string;
|
|
478
|
+
createdAt: Date;
|
|
479
|
+
updatedAt: Date;
|
|
480
|
+
email: string;
|
|
481
|
+
emailVerified: boolean;
|
|
482
|
+
name: string;
|
|
483
|
+
image?: string | null | undefined | undefined;
|
|
484
|
+
};
|
|
485
|
+
}, "user"> & {
|
|
486
|
+
user: import("better-auth/react").StripEmptyObjects<{
|
|
487
|
+
id: string;
|
|
488
|
+
createdAt: Date;
|
|
489
|
+
updatedAt: Date;
|
|
490
|
+
email: string;
|
|
491
|
+
emailVerified: boolean;
|
|
492
|
+
name: string;
|
|
493
|
+
image?: string | null | undefined;
|
|
494
|
+
}>;
|
|
495
|
+
}) | (Omit<{
|
|
496
|
+
token: string;
|
|
497
|
+
user: {
|
|
498
|
+
id: string;
|
|
499
|
+
createdAt: Date;
|
|
500
|
+
updatedAt: Date;
|
|
501
|
+
email: string;
|
|
502
|
+
emailVerified: boolean;
|
|
503
|
+
name: string;
|
|
504
|
+
image?: string | null | undefined | undefined;
|
|
505
|
+
};
|
|
506
|
+
}, "user"> & {
|
|
507
|
+
user: import("better-auth/react").StripEmptyObjects<{
|
|
508
|
+
id: string;
|
|
509
|
+
createdAt: Date;
|
|
510
|
+
updatedAt: Date;
|
|
511
|
+
email: string;
|
|
512
|
+
emailVerified: boolean;
|
|
513
|
+
name: string;
|
|
514
|
+
image?: string | null | undefined;
|
|
515
|
+
}>;
|
|
516
|
+
}), {
|
|
517
|
+
code?: string | undefined;
|
|
518
|
+
message?: string | undefined;
|
|
519
|
+
}, FetchOptions["throw"] extends true ? true : false>>;
|
|
520
|
+
};
|
|
521
|
+
} & {
|
|
522
|
+
signIn: {
|
|
523
|
+
email: <FetchOptions extends import("@better-auth/core").ClientFetchOption<Partial<{
|
|
524
|
+
email: string;
|
|
525
|
+
password: string;
|
|
526
|
+
callbackURL?: string | undefined;
|
|
527
|
+
rememberMe?: boolean | undefined;
|
|
528
|
+
}> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: import("better-auth/react").Prettify<{
|
|
529
|
+
email: string;
|
|
530
|
+
password: string;
|
|
531
|
+
callbackURL?: string | undefined;
|
|
532
|
+
rememberMe?: boolean | undefined;
|
|
533
|
+
} & {
|
|
534
|
+
fetchOptions?: FetchOptions | undefined;
|
|
535
|
+
}>, data_1?: FetchOptions | undefined) => Promise<import("@better-fetch/fetch").BetterFetchResponse<Omit<{
|
|
536
|
+
redirect: boolean;
|
|
537
|
+
token: string;
|
|
538
|
+
url?: string | undefined;
|
|
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 | undefined;
|
|
547
|
+
};
|
|
548
|
+
}, "user"> & {
|
|
549
|
+
user: import("better-auth/react").StripEmptyObjects<{
|
|
550
|
+
id: string;
|
|
551
|
+
createdAt: Date;
|
|
552
|
+
updatedAt: Date;
|
|
553
|
+
email: string;
|
|
554
|
+
emailVerified: boolean;
|
|
555
|
+
name: string;
|
|
556
|
+
image?: string | null | undefined;
|
|
557
|
+
}>;
|
|
558
|
+
}, {
|
|
559
|
+
code?: string | undefined;
|
|
560
|
+
message?: string | undefined;
|
|
561
|
+
}, FetchOptions["throw"] extends true ? true : false>>;
|
|
562
|
+
};
|
|
563
|
+
} & {
|
|
564
|
+
updateSession: <FetchOptions extends import("@better-auth/core").ClientFetchOption<Partial<Partial<{}>> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0?: import("better-auth/react").Prettify<Partial<{}> & {
|
|
565
|
+
fetchOptions?: FetchOptions | undefined;
|
|
566
|
+
}> | undefined, data_1?: FetchOptions | undefined) => Promise<import("@better-fetch/fetch").BetterFetchResponse<{
|
|
567
|
+
session: {
|
|
568
|
+
id: string;
|
|
569
|
+
createdAt: Date;
|
|
570
|
+
updatedAt: Date;
|
|
571
|
+
userId: string;
|
|
572
|
+
expiresAt: Date;
|
|
573
|
+
token: string;
|
|
574
|
+
ipAddress?: string | null | undefined;
|
|
575
|
+
userAgent?: string | null | undefined;
|
|
576
|
+
};
|
|
577
|
+
}, {
|
|
578
|
+
code?: string | undefined;
|
|
579
|
+
message?: string | undefined;
|
|
580
|
+
}, FetchOptions["throw"] extends true ? true : false>>;
|
|
581
|
+
} & {
|
|
582
|
+
updateUser: <FetchOptions extends import("@better-auth/core").ClientFetchOption<Partial<Partial<{}> & {
|
|
583
|
+
name?: string | undefined;
|
|
584
|
+
image?: string | undefined | null;
|
|
585
|
+
}> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0?: import("better-auth/react").Prettify<import("better-auth/dist/client/path-to-object.mjs").InferUserUpdateCtx<{}, FetchOptions>> | undefined, data_1?: FetchOptions | undefined) => Promise<import("@better-fetch/fetch").BetterFetchResponse<{
|
|
586
|
+
status: boolean;
|
|
587
|
+
}, {
|
|
588
|
+
code?: string | undefined;
|
|
589
|
+
message?: string | undefined;
|
|
590
|
+
}, FetchOptions["throw"] extends true ? true : false>>;
|
|
591
591
|
} & {
|
|
592
592
|
getSession: <FetchOptions extends import("@better-auth/core").ClientFetchOption<never, Partial<{
|
|
593
593
|
disableCookieCache?: unknown;
|
|
@@ -482,27 +482,27 @@ async function releaseRefreshLock(sessionToken, requestId, lockVersion) {
|
|
|
482
482
|
const lockKey = getRefreshLockKey(sessionToken);
|
|
483
483
|
try {
|
|
484
484
|
// Lua script for atomic lock validation and release
|
|
485
|
-
const luaScript = `
|
|
486
|
-
local lockKey = KEYS[1]
|
|
487
|
-
local expectedRequestId = ARGV[1]
|
|
488
|
-
local expectedVersion = ARGV[2]
|
|
489
|
-
|
|
490
|
-
local lockData = redis.call('GET', lockKey)
|
|
491
|
-
if not lockData then
|
|
492
|
-
return 0 -- Lock doesn't exist
|
|
493
|
-
end
|
|
494
|
-
|
|
495
|
-
local lockInfo = cjson.decode(lockData)
|
|
496
|
-
if lockInfo.acquiredBy == expectedRequestId then
|
|
497
|
-
if not expectedVersion or expectedVersion == '' or tostring(lockInfo.lockVersion) == expectedVersion then
|
|
498
|
-
redis.call('DEL', lockKey)
|
|
499
|
-
return 1 -- Successfully released
|
|
500
|
-
else
|
|
501
|
-
return -2 -- Version mismatch
|
|
502
|
-
end
|
|
503
|
-
else
|
|
504
|
-
return -1 -- Wrong owner
|
|
505
|
-
end
|
|
485
|
+
const luaScript = `
|
|
486
|
+
local lockKey = KEYS[1]
|
|
487
|
+
local expectedRequestId = ARGV[1]
|
|
488
|
+
local expectedVersion = ARGV[2]
|
|
489
|
+
|
|
490
|
+
local lockData = redis.call('GET', lockKey)
|
|
491
|
+
if not lockData then
|
|
492
|
+
return 0 -- Lock doesn't exist
|
|
493
|
+
end
|
|
494
|
+
|
|
495
|
+
local lockInfo = cjson.decode(lockData)
|
|
496
|
+
if lockInfo.acquiredBy == expectedRequestId then
|
|
497
|
+
if not expectedVersion or expectedVersion == '' or tostring(lockInfo.lockVersion) == expectedVersion then
|
|
498
|
+
redis.call('DEL', lockKey)
|
|
499
|
+
return 1 -- Successfully released
|
|
500
|
+
else
|
|
501
|
+
return -2 -- Version mismatch
|
|
502
|
+
end
|
|
503
|
+
else
|
|
504
|
+
return -1 -- Wrong owner
|
|
505
|
+
end
|
|
506
506
|
`;
|
|
507
507
|
const result = await redis_1.default.eval(luaScript, 1, lockKey, requestId, lockVersion ? lockVersion.toString() : '');
|
|
508
508
|
if (result === 1) {
|
package/dist/server/auth.d.ts
CHANGED
|
@@ -45,7 +45,102 @@ export declare function getAuthInstance(): Promise<import("better-auth/types").A
|
|
|
45
45
|
handler: (inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<void>;
|
|
46
46
|
}[];
|
|
47
47
|
};
|
|
48
|
-
}
|
|
48
|
+
}, ...{
|
|
49
|
+
id: "magic-link";
|
|
50
|
+
endpoints: {
|
|
51
|
+
signInMagicLink: import("better-call").StrictEndpoint<"/sign-in/magic-link", {
|
|
52
|
+
method: "POST";
|
|
53
|
+
requireHeaders: true;
|
|
54
|
+
body: import("zod").ZodObject<{
|
|
55
|
+
email: import("zod").ZodEmail;
|
|
56
|
+
name: import("zod").ZodOptional<import("zod").ZodString>;
|
|
57
|
+
callbackURL: import("zod").ZodOptional<import("zod").ZodString>;
|
|
58
|
+
newUserCallbackURL: import("zod").ZodOptional<import("zod").ZodString>;
|
|
59
|
+
errorCallbackURL: import("zod").ZodOptional<import("zod").ZodString>;
|
|
60
|
+
metadata: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodAny>>;
|
|
61
|
+
}, import("better-auth/*").$strip>;
|
|
62
|
+
metadata: {
|
|
63
|
+
openapi: {
|
|
64
|
+
operationId: string;
|
|
65
|
+
description: string;
|
|
66
|
+
responses: {
|
|
67
|
+
200: {
|
|
68
|
+
description: string;
|
|
69
|
+
content: {
|
|
70
|
+
"application/json": {
|
|
71
|
+
schema: {
|
|
72
|
+
type: "object";
|
|
73
|
+
properties: {
|
|
74
|
+
status: {
|
|
75
|
+
type: string;
|
|
76
|
+
};
|
|
77
|
+
};
|
|
78
|
+
};
|
|
79
|
+
};
|
|
80
|
+
};
|
|
81
|
+
};
|
|
82
|
+
};
|
|
83
|
+
};
|
|
84
|
+
};
|
|
85
|
+
}, {
|
|
86
|
+
status: boolean;
|
|
87
|
+
}>;
|
|
88
|
+
magicLinkVerify: import("better-call").StrictEndpoint<"/magic-link/verify", {
|
|
89
|
+
method: "GET";
|
|
90
|
+
query: import("zod").ZodObject<{
|
|
91
|
+
token: import("zod").ZodString;
|
|
92
|
+
callbackURL: import("zod").ZodOptional<import("zod").ZodString>;
|
|
93
|
+
errorCallbackURL: import("zod").ZodOptional<import("zod").ZodString>;
|
|
94
|
+
newUserCallbackURL: import("zod").ZodOptional<import("zod").ZodString>;
|
|
95
|
+
}, import("better-auth/*").$strip>;
|
|
96
|
+
use: ((inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<void>)[];
|
|
97
|
+
requireHeaders: true;
|
|
98
|
+
metadata: {
|
|
99
|
+
openapi: {
|
|
100
|
+
operationId: string;
|
|
101
|
+
description: string;
|
|
102
|
+
responses: {
|
|
103
|
+
200: {
|
|
104
|
+
description: string;
|
|
105
|
+
content: {
|
|
106
|
+
"application/json": {
|
|
107
|
+
schema: {
|
|
108
|
+
type: "object";
|
|
109
|
+
properties: {
|
|
110
|
+
session: {
|
|
111
|
+
$ref: string;
|
|
112
|
+
};
|
|
113
|
+
user: {
|
|
114
|
+
$ref: string;
|
|
115
|
+
};
|
|
116
|
+
};
|
|
117
|
+
};
|
|
118
|
+
};
|
|
119
|
+
};
|
|
120
|
+
};
|
|
121
|
+
};
|
|
122
|
+
};
|
|
123
|
+
};
|
|
124
|
+
}, {
|
|
125
|
+
token: string;
|
|
126
|
+
user: {
|
|
127
|
+
id: string;
|
|
128
|
+
createdAt: Date;
|
|
129
|
+
updatedAt: Date;
|
|
130
|
+
email: string;
|
|
131
|
+
emailVerified: boolean;
|
|
132
|
+
name: string;
|
|
133
|
+
image?: string | null | undefined;
|
|
134
|
+
};
|
|
135
|
+
}>;
|
|
136
|
+
};
|
|
137
|
+
rateLimit: {
|
|
138
|
+
pathMatcher(path: string): boolean;
|
|
139
|
+
window: number;
|
|
140
|
+
max: number;
|
|
141
|
+
}[];
|
|
142
|
+
options: import("better-auth/plugins/magic-link").MagicLinkOptions;
|
|
143
|
+
}[]];
|
|
49
144
|
}>>;
|
|
50
145
|
/**
|
|
51
146
|
* Get the current session from a request.
|
|
@@ -141,7 +141,7 @@ export declare function useVibeMutation<T extends VibeTableName, Op extends Muta
|
|
|
141
141
|
/**
|
|
142
142
|
* Convenience hook for creating records.
|
|
143
143
|
*/
|
|
144
|
-
export declare function useVibeCreate<T extends VibeTableName>(table: T, options?: Omit<UseVibeMutationOptions<T, 'create'>, never>): import("@tanstack/react-query").UseMutationResult<VibeTableType<T>, VibeError, Omit<VibeTableType<T>, "
|
|
144
|
+
export declare function useVibeCreate<T extends VibeTableName>(table: T, options?: Omit<UseVibeMutationOptions<T, 'create'>, never>): import("@tanstack/react-query").UseMutationResult<VibeTableType<T>, VibeError, Omit<VibeTableType<T>, "id" | "created_at" | "updated_at">, unknown>;
|
|
145
145
|
/**
|
|
146
146
|
* Convenience hook for updating records.
|
|
147
147
|
*/
|