@access-dlsu/leapify 0.260505.5 → 0.260506.1
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/app.d.ts +15 -0
- package/dist/app.d.ts.map +1 -0
- package/dist/auth/auth.d.ts +99 -0
- package/dist/auth/auth.d.ts.map +1 -0
- package/dist/auth/middleware.d.ts +20 -0
- package/dist/auth/middleware.d.ts.map +1 -0
- package/dist/auth/types.d.ts +17 -0
- package/dist/auth/types.d.ts.map +1 -0
- package/dist/bun-sqlite-dialect-na--YwnN-CVHVB5NF.js +160 -0
- package/dist/bun-sqlite-dialect-na--YwnN-CVHVB5NF.js.map +1 -0
- package/dist/bun-sqlite-dialect-na--YwnN-QDBSQQTR.cjs +162 -0
- package/dist/bun-sqlite-dialect-na--YwnN-QDBSQQTR.cjs.map +1 -0
- package/dist/chunk-4DPT2KQR.cjs +467 -0
- package/dist/chunk-4DPT2KQR.cjs.map +1 -0
- package/dist/chunk-57ANXUP7.cjs +6191 -0
- package/dist/chunk-57ANXUP7.cjs.map +1 -0
- package/dist/chunk-5JKLV7IE.cjs +2962 -0
- package/dist/chunk-5JKLV7IE.cjs.map +1 -0
- package/dist/{chunk-FLR7TNLN.js → chunk-63CUZGSZ.js} +4 -12
- package/dist/chunk-63CUZGSZ.js.map +1 -0
- package/dist/chunk-ANNHE3PZ.js +2285 -0
- package/dist/chunk-ANNHE3PZ.js.map +1 -0
- package/dist/chunk-DPPGYCX3.cjs +72 -0
- package/dist/chunk-DPPGYCX3.cjs.map +1 -0
- package/dist/chunk-EGRHWZRV.js +3 -0
- package/dist/chunk-EGRHWZRV.js.map +1 -0
- package/dist/chunk-EIF2O2BG.js +6187 -0
- package/dist/chunk-EIF2O2BG.js.map +1 -0
- package/dist/chunk-EMMSS5I5.cjs +37 -0
- package/dist/chunk-EMMSS5I5.cjs.map +1 -0
- package/dist/chunk-FTSMZYD7.js +3025 -0
- package/dist/chunk-FTSMZYD7.js.map +1 -0
- package/dist/chunk-G3PMV62Z.js +33 -0
- package/dist/chunk-G3PMV62Z.js.map +1 -0
- package/dist/chunk-GNRL67OU.js +2949 -0
- package/dist/chunk-GNRL67OU.js.map +1 -0
- package/dist/chunk-HHNEB7YR.js +8 -0
- package/dist/chunk-HHNEB7YR.js.map +1 -0
- package/dist/chunk-IQEWVHLM.js +889 -0
- package/dist/chunk-IQEWVHLM.js.map +1 -0
- package/dist/chunk-JPVIXCF5.cjs +10 -0
- package/dist/chunk-JPVIXCF5.cjs.map +1 -0
- package/dist/chunk-MNEW2V4T.js +447 -0
- package/dist/chunk-MNEW2V4T.js.map +1 -0
- package/dist/chunk-NKIQRCOM.cjs +4 -0
- package/dist/chunk-NKIQRCOM.cjs.map +1 -0
- package/dist/chunk-QARF2YFF.cjs +2296 -0
- package/dist/chunk-QARF2YFF.cjs.map +1 -0
- package/dist/chunk-RFP2X2FA.cjs +903 -0
- package/dist/chunk-RFP2X2FA.cjs.map +1 -0
- package/dist/chunk-SXBTHGIL.js +7138 -0
- package/dist/chunk-SXBTHGIL.js.map +1 -0
- package/dist/chunk-UWXYXU7J.cjs +7166 -0
- package/dist/chunk-UWXYXU7J.cjs.map +1 -0
- package/dist/chunk-XY4KBWXT.cjs +3066 -0
- package/dist/chunk-XY4KBWXT.cjs.map +1 -0
- package/dist/{chunk-3ZWIJNZG.cjs → chunk-YFJBE3AU.cjs} +4 -12
- package/dist/chunk-YFJBE3AU.cjs.map +1 -0
- package/dist/chunk-ZYHBHSSO.js +68 -0
- package/dist/chunk-ZYHBHSSO.js.map +1 -0
- package/dist/client/{index.d.cts → auth.d.ts} +140 -394
- package/dist/client/auth.d.ts.map +1 -0
- package/dist/client/index.cjs +840 -48
- package/dist/client/index.cjs.map +1 -1
- package/dist/client/index.d.ts +34 -1134
- package/dist/client/index.d.ts.map +1 -0
- package/dist/client/index.js +839 -47
- package/dist/client/index.js.map +1 -1
- package/dist/client/pow.d.ts +28 -0
- package/dist/client/pow.d.ts.map +1 -0
- package/dist/client/session.d.ts +29 -0
- package/dist/client/session.d.ts.map +1 -0
- package/dist/client/types.d.ts +25 -23
- package/dist/client/types.d.ts.map +1 -0
- package/dist/cron/batch-release.d.ts +9 -0
- package/dist/cron/batch-release.d.ts.map +1 -0
- package/dist/cron/lifecycle-check.d.ts +10 -0
- package/dist/cron/lifecycle-check.d.ts.map +1 -0
- package/dist/cron/reconcile-slots.d.ts +10 -0
- package/dist/cron/reconcile-slots.d.ts.map +1 -0
- package/dist/cron/reminder-emails.d.ts +9 -0
- package/dist/cron/reminder-emails.d.ts.map +1 -0
- package/dist/cron/renew-watches.d.ts +9 -0
- package/dist/cron/renew-watches.d.ts.map +1 -0
- package/dist/d1-sqlite-dialect-C2B7YsIT-CEUMIZZI.js +122 -0
- package/dist/d1-sqlite-dialect-C2B7YsIT-CEUMIZZI.js.map +1 -0
- package/dist/d1-sqlite-dialect-C2B7YsIT-JUX3YYMX.cjs +124 -0
- package/dist/d1-sqlite-dialect-C2B7YsIT-JUX3YYMX.cjs.map +1 -0
- package/dist/db/index.d.ts +7 -0
- package/dist/db/index.d.ts.map +1 -0
- package/dist/db/migrate.d.ts +23 -0
- package/dist/db/migrate.d.ts.map +1 -0
- package/dist/db/schema/auth.d.ts +649 -0
- package/dist/db/schema/auth.d.ts.map +1 -0
- package/dist/db/schema/bookmarks.d.ts +88 -0
- package/dist/db/schema/bookmarks.d.ts.map +1 -0
- package/dist/db/schema/events.d.ts +539 -0
- package/dist/db/schema/events.d.ts.map +1 -0
- package/dist/db/schema/faqs.d.ts +154 -0
- package/dist/db/schema/faqs.d.ts.map +1 -0
- package/dist/db/schema/index.d.ts +8 -0
- package/dist/db/schema/index.d.ts.map +1 -0
- package/dist/db/schema/site-config.d.ts +64 -0
- package/dist/db/schema/site-config.d.ts.map +1 -0
- package/dist/db/schema/themes.d.ts +123 -0
- package/dist/db/schema/themes.d.ts.map +1 -0
- package/dist/{types-lTjxCp88.d.cts → db/schema/users.d.ts} +11 -96
- package/dist/db/schema/users.d.ts.map +1 -0
- package/dist/dist-DZHA5VYX.cjs +260 -0
- package/dist/dist-DZHA5VYX.cjs.map +1 -0
- package/dist/dist-RRQUBLLO.js +258 -0
- package/dist/dist-RRQUBLLO.js.map +1 -0
- package/dist/index.cjs +36987 -781
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +23 -1818
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +36846 -642
- package/dist/index.js.map +1 -1
- package/dist/kysely-adapter-5ZCECLNV.cjs +27 -0
- package/dist/kysely-adapter-5ZCECLNV.cjs.map +1 -0
- package/dist/kysely-adapter-6CZEASJQ.js +10 -0
- package/dist/kysely-adapter-6CZEASJQ.js.map +1 -0
- package/dist/lib/errors.d.ts +15 -0
- package/dist/lib/errors.d.ts.map +1 -0
- package/dist/lib/middleware/cors.d.ts +3 -0
- package/dist/lib/middleware/cors.d.ts.map +1 -0
- package/dist/lib/middleware/error-handler.d.ts +3 -0
- package/dist/lib/middleware/error-handler.d.ts.map +1 -0
- package/dist/lib/middleware/pow-challenge.cjs +7 -7
- package/dist/lib/middleware/pow-challenge.d.ts +29 -18
- package/dist/lib/middleware/pow-challenge.d.ts.map +1 -0
- package/dist/lib/middleware/pow-challenge.js +2 -2
- package/dist/lib/middleware/rate-limit.d.ts +48 -0
- package/dist/lib/middleware/rate-limit.d.ts.map +1 -0
- package/dist/lib/middleware/referer-guard.d.ts +18 -0
- package/dist/lib/middleware/referer-guard.d.ts.map +1 -0
- package/dist/lib/retry.d.ts +12 -0
- package/dist/lib/retry.d.ts.map +1 -0
- package/dist/node-sqlite-dialect-HEMUZ4B2.js +160 -0
- package/dist/node-sqlite-dialect-HEMUZ4B2.js.map +1 -0
- package/dist/node-sqlite-dialect-QUBEEKKU.cjs +162 -0
- package/dist/node-sqlite-dialect-QUBEEKKU.cjs.map +1 -0
- package/dist/queues/handlers.d.ts +13 -0
- package/dist/queues/handlers.d.ts.map +1 -0
- package/dist/queues/jobs.d.ts +42 -0
- package/dist/queues/jobs.d.ts.map +1 -0
- package/dist/routes/events.d.ts +4 -0
- package/dist/routes/events.d.ts.map +1 -0
- package/dist/routes/faqs.d.ts +4 -0
- package/dist/routes/faqs.d.ts.map +1 -0
- package/dist/routes/health.d.ts +4 -0
- package/dist/routes/health.d.ts.map +1 -0
- package/dist/routes/internal/gforms-webhook.d.ts +4 -0
- package/dist/routes/internal/gforms-webhook.d.ts.map +1 -0
- package/dist/routes/site-config.d.ts +4 -0
- package/dist/routes/site-config.d.ts.map +1 -0
- package/dist/routes/themes.d.ts +4 -0
- package/dist/routes/themes.d.ts.map +1 -0
- package/dist/routes/uploads.d.ts +4 -0
- package/dist/routes/uploads.d.ts.map +1 -0
- package/dist/routes/users.d.ts +4 -0
- package/dist/routes/users.d.ts.map +1 -0
- package/dist/services/cache.d.ts +22 -0
- package/dist/services/cache.d.ts.map +1 -0
- package/dist/services/contentful-management.d.ts +53 -0
- package/dist/services/contentful-management.d.ts.map +1 -0
- package/dist/services/contentful.d.ts +97 -0
- package/dist/services/contentful.d.ts.map +1 -0
- package/dist/services/email.d.ts +75 -0
- package/dist/services/email.d.ts.map +1 -0
- package/dist/services/gforms.d.ts +60 -0
- package/dist/services/gforms.d.ts.map +1 -0
- package/dist/services/resend.d.ts +34 -0
- package/dist/services/resend.d.ts.map +1 -0
- package/dist/services/ses.d.ts +58 -0
- package/dist/services/ses.d.ts.map +1 -0
- package/dist/services/slots.d.ts +48 -0
- package/dist/services/slots.d.ts.map +1 -0
- package/dist/services/snapshot.d.ts +90 -0
- package/dist/services/snapshot.d.ts.map +1 -0
- package/dist/types.d.ts +66 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/worker-handler.d.ts +64 -0
- package/dist/worker-handler.d.ts.map +1 -0
- package/dist/worker.d.ts +36 -0
- package/dist/worker.d.ts.map +1 -0
- package/dist/worker.js +2195 -2553
- package/dist/worker.js.map +1 -1
- package/package.json +152 -152
- package/dist/chunk-3ZWIJNZG.cjs.map +0 -1
- package/dist/chunk-FLR7TNLN.js.map +0 -1
- package/dist/client/types.d.cts +0 -192
- package/dist/index.d.cts +0 -1879
- package/dist/lib/middleware/pow-challenge.d.cts +0 -47
- package/dist/types-lTjxCp88.d.ts +0 -208
package/dist/client/index.d.ts
CHANGED
|
@@ -1,1106 +1,3 @@
|
|
|
1
|
-
import { UserProfile, SiteConfig, LeapEvent, SlotInfo, CreateEventBody, Theme, BookmarkEntry, ToggleBookmarkResult, Faq, CreateFaqBody, SnapshotResult, HealthResponse, RuntimeConfig } from './types.js';
|
|
2
|
-
export { EventStatus, LeapifyErrorBody, UserRole } from './types.js';
|
|
3
|
-
import * as nanostores from 'nanostores';
|
|
4
|
-
import * as _better_auth_core_oauth2 from '@better-auth/core/oauth2';
|
|
5
|
-
import * as _better_fetch_fetch from '@better-fetch/fetch';
|
|
6
|
-
import * as better_auth_client from 'better-auth/client';
|
|
7
|
-
import * as _better_auth_core from '@better-auth/core';
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Better Auth client helper for Leapify API consumers.
|
|
11
|
-
*
|
|
12
|
-
* This module is **browser-safe** — no Cloudflare, Drizzle, or Hono deps.
|
|
13
|
-
* It wraps Better Auth's client SDK with the bearer plugin so that tokens
|
|
14
|
-
* can be stored and retrieved as plain strings (no cookie dependency on
|
|
15
|
-
* the consumer's frontend).
|
|
16
|
-
*
|
|
17
|
-
* @example
|
|
18
|
-
* // lib/auth.ts (frontend)
|
|
19
|
-
* import { createLeapifyAuthClient, signInWithGoogleRedirect } from 'leapify/client'
|
|
20
|
-
*
|
|
21
|
-
* export const authClient = createLeapifyAuthClient(process.env.NEXT_PUBLIC_API_URL!)
|
|
22
|
-
*
|
|
23
|
-
* // Redirect-based Google sign-in:
|
|
24
|
-
* await signInWithGoogleRedirect(authClient, '/dashboard')
|
|
25
|
-
*/
|
|
26
|
-
/**
|
|
27
|
-
* Create a Better Auth client bound to the Leapify Worker URL.
|
|
28
|
-
*
|
|
29
|
-
* It uses the 'Bearer' auth type to send the stored session token
|
|
30
|
-
* in the Authorization header.
|
|
31
|
-
*/
|
|
32
|
-
declare function createLeapifyAuthClient(baseUrl: string): {
|
|
33
|
-
signIn: {
|
|
34
|
-
social: <FetchOptions extends _better_auth_core.ClientFetchOption<Partial<{
|
|
35
|
-
provider: (string & {}) | "linear" | "huggingface" | "github" | "apple" | "atlassian" | "cognito" | "discord" | "facebook" | "figma" | "microsoft" | "google" | "slack" | "spotify" | "twitch" | "twitter" | "dropbox" | "kick" | "linkedin" | "gitlab" | "tiktok" | "reddit" | "roblox" | "salesforce" | "vk" | "zoom" | "notion" | "kakao" | "naver" | "line" | "paybin" | "paypal" | "polar" | "railway" | "vercel" | "wechat";
|
|
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
|
-
user?: {
|
|
47
|
-
name?: {
|
|
48
|
-
firstName?: string | undefined;
|
|
49
|
-
lastName?: string | undefined;
|
|
50
|
-
} | undefined;
|
|
51
|
-
email?: string | undefined;
|
|
52
|
-
} | undefined;
|
|
53
|
-
} | undefined;
|
|
54
|
-
scopes?: string[] | undefined;
|
|
55
|
-
requestSignUp?: boolean | undefined;
|
|
56
|
-
loginHint?: string | undefined;
|
|
57
|
-
additionalData?: Record<string, any> | undefined;
|
|
58
|
-
}> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: better_auth_client.Prettify<{
|
|
59
|
-
provider: (string & {}) | "linear" | "huggingface" | "github" | "apple" | "atlassian" | "cognito" | "discord" | "facebook" | "figma" | "microsoft" | "google" | "slack" | "spotify" | "twitch" | "twitter" | "dropbox" | "kick" | "linkedin" | "gitlab" | "tiktok" | "reddit" | "roblox" | "salesforce" | "vk" | "zoom" | "notion" | "kakao" | "naver" | "line" | "paybin" | "paypal" | "polar" | "railway" | "vercel" | "wechat";
|
|
60
|
-
callbackURL?: string | undefined;
|
|
61
|
-
newUserCallbackURL?: string | undefined;
|
|
62
|
-
errorCallbackURL?: string | undefined;
|
|
63
|
-
disableRedirect?: boolean | undefined;
|
|
64
|
-
idToken?: {
|
|
65
|
-
token: string;
|
|
66
|
-
nonce?: string | undefined;
|
|
67
|
-
accessToken?: string | undefined;
|
|
68
|
-
refreshToken?: string | undefined;
|
|
69
|
-
expiresAt?: number | undefined;
|
|
70
|
-
user?: {
|
|
71
|
-
name?: {
|
|
72
|
-
firstName?: string | undefined;
|
|
73
|
-
lastName?: string | undefined;
|
|
74
|
-
} | undefined;
|
|
75
|
-
email?: string | undefined;
|
|
76
|
-
} | undefined;
|
|
77
|
-
} | undefined;
|
|
78
|
-
scopes?: string[] | undefined;
|
|
79
|
-
requestSignUp?: boolean | undefined;
|
|
80
|
-
loginHint?: string | undefined;
|
|
81
|
-
additionalData?: Record<string, any> | undefined;
|
|
82
|
-
} & {
|
|
83
|
-
fetchOptions?: FetchOptions | undefined;
|
|
84
|
-
}>, data_1?: FetchOptions | undefined) => Promise<_better_fetch_fetch.BetterFetchResponse<{
|
|
85
|
-
redirect: boolean;
|
|
86
|
-
url: string;
|
|
87
|
-
} | (Omit<{
|
|
88
|
-
redirect: boolean;
|
|
89
|
-
token: string;
|
|
90
|
-
url: undefined;
|
|
91
|
-
user: {
|
|
92
|
-
id: string;
|
|
93
|
-
createdAt: Date;
|
|
94
|
-
updatedAt: Date;
|
|
95
|
-
email: string;
|
|
96
|
-
emailVerified: boolean;
|
|
97
|
-
name: string;
|
|
98
|
-
image?: string | null | undefined | undefined;
|
|
99
|
-
};
|
|
100
|
-
}, "user"> & {
|
|
101
|
-
user: better_auth_client.StripEmptyObjects<{
|
|
102
|
-
id: string;
|
|
103
|
-
createdAt: Date;
|
|
104
|
-
updatedAt: Date;
|
|
105
|
-
email: string;
|
|
106
|
-
emailVerified: boolean;
|
|
107
|
-
name: string;
|
|
108
|
-
image?: string | null | undefined;
|
|
109
|
-
}>;
|
|
110
|
-
}), {
|
|
111
|
-
code?: string | undefined;
|
|
112
|
-
message?: string | undefined;
|
|
113
|
-
}, FetchOptions["throw"] extends true ? true : false>>;
|
|
114
|
-
};
|
|
115
|
-
} & {
|
|
116
|
-
signOut: <FetchOptions extends _better_auth_core.ClientFetchOption<never, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0?: better_auth_client.Prettify<{
|
|
117
|
-
query?: Record<string, any> | undefined;
|
|
118
|
-
fetchOptions?: FetchOptions | undefined;
|
|
119
|
-
}> | undefined, data_1?: FetchOptions | undefined) => Promise<_better_fetch_fetch.BetterFetchResponse<{
|
|
120
|
-
success: boolean;
|
|
121
|
-
}, {
|
|
122
|
-
code?: string | undefined;
|
|
123
|
-
message?: string | undefined;
|
|
124
|
-
}, FetchOptions["throw"] extends true ? true : false>>;
|
|
125
|
-
} & {
|
|
126
|
-
signUp: {
|
|
127
|
-
email: <FetchOptions extends _better_auth_core.ClientFetchOption<Partial<{
|
|
128
|
-
name: string;
|
|
129
|
-
email: string;
|
|
130
|
-
password: string;
|
|
131
|
-
image?: string | undefined;
|
|
132
|
-
callbackURL?: string | undefined;
|
|
133
|
-
rememberMe?: boolean | undefined;
|
|
134
|
-
}> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: better_auth_client.Prettify<{
|
|
135
|
-
email: string;
|
|
136
|
-
name: string;
|
|
137
|
-
password: string;
|
|
138
|
-
image?: string | undefined;
|
|
139
|
-
callbackURL?: string | undefined;
|
|
140
|
-
fetchOptions?: FetchOptions | undefined;
|
|
141
|
-
}>, data_1?: FetchOptions | undefined) => Promise<_better_fetch_fetch.BetterFetchResponse<(Omit<{
|
|
142
|
-
token: null;
|
|
143
|
-
user: {
|
|
144
|
-
id: string;
|
|
145
|
-
createdAt: Date;
|
|
146
|
-
updatedAt: Date;
|
|
147
|
-
email: string;
|
|
148
|
-
emailVerified: boolean;
|
|
149
|
-
name: string;
|
|
150
|
-
image?: string | null | undefined | undefined;
|
|
151
|
-
};
|
|
152
|
-
}, "user"> & {
|
|
153
|
-
user: better_auth_client.StripEmptyObjects<{
|
|
154
|
-
id: string;
|
|
155
|
-
createdAt: Date;
|
|
156
|
-
updatedAt: Date;
|
|
157
|
-
email: string;
|
|
158
|
-
emailVerified: boolean;
|
|
159
|
-
name: string;
|
|
160
|
-
image?: string | null | undefined;
|
|
161
|
-
}>;
|
|
162
|
-
}) | (Omit<{
|
|
163
|
-
token: string;
|
|
164
|
-
user: {
|
|
165
|
-
id: string;
|
|
166
|
-
createdAt: Date;
|
|
167
|
-
updatedAt: Date;
|
|
168
|
-
email: string;
|
|
169
|
-
emailVerified: boolean;
|
|
170
|
-
name: string;
|
|
171
|
-
image?: string | null | undefined | undefined;
|
|
172
|
-
};
|
|
173
|
-
}, "user"> & {
|
|
174
|
-
user: better_auth_client.StripEmptyObjects<{
|
|
175
|
-
id: string;
|
|
176
|
-
createdAt: Date;
|
|
177
|
-
updatedAt: Date;
|
|
178
|
-
email: string;
|
|
179
|
-
emailVerified: boolean;
|
|
180
|
-
name: string;
|
|
181
|
-
image?: string | null | undefined;
|
|
182
|
-
}>;
|
|
183
|
-
}), {
|
|
184
|
-
code?: string | undefined;
|
|
185
|
-
message?: string | undefined;
|
|
186
|
-
}, FetchOptions["throw"] extends true ? true : false>>;
|
|
187
|
-
};
|
|
188
|
-
} & {
|
|
189
|
-
signIn: {
|
|
190
|
-
email: <FetchOptions extends _better_auth_core.ClientFetchOption<Partial<{
|
|
191
|
-
email: string;
|
|
192
|
-
password: string;
|
|
193
|
-
callbackURL?: string | undefined;
|
|
194
|
-
rememberMe?: boolean | undefined;
|
|
195
|
-
}> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: better_auth_client.Prettify<{
|
|
196
|
-
email: string;
|
|
197
|
-
password: string;
|
|
198
|
-
callbackURL?: string | undefined;
|
|
199
|
-
rememberMe?: boolean | undefined;
|
|
200
|
-
} & {
|
|
201
|
-
fetchOptions?: FetchOptions | undefined;
|
|
202
|
-
}>, data_1?: FetchOptions | undefined) => Promise<_better_fetch_fetch.BetterFetchResponse<Omit<{
|
|
203
|
-
redirect: boolean;
|
|
204
|
-
token: string;
|
|
205
|
-
url?: string | undefined;
|
|
206
|
-
user: {
|
|
207
|
-
id: string;
|
|
208
|
-
createdAt: Date;
|
|
209
|
-
updatedAt: Date;
|
|
210
|
-
email: string;
|
|
211
|
-
emailVerified: boolean;
|
|
212
|
-
name: string;
|
|
213
|
-
image?: string | null | undefined | undefined;
|
|
214
|
-
};
|
|
215
|
-
}, "user"> & {
|
|
216
|
-
user: better_auth_client.StripEmptyObjects<{
|
|
217
|
-
id: string;
|
|
218
|
-
createdAt: Date;
|
|
219
|
-
updatedAt: Date;
|
|
220
|
-
email: string;
|
|
221
|
-
emailVerified: boolean;
|
|
222
|
-
name: string;
|
|
223
|
-
image?: string | null | undefined;
|
|
224
|
-
}>;
|
|
225
|
-
}, {
|
|
226
|
-
code?: string | undefined;
|
|
227
|
-
message?: string | undefined;
|
|
228
|
-
}, FetchOptions["throw"] extends true ? true : false>>;
|
|
229
|
-
};
|
|
230
|
-
} & {
|
|
231
|
-
resetPassword: <FetchOptions extends _better_auth_core.ClientFetchOption<Partial<{
|
|
232
|
-
newPassword: string;
|
|
233
|
-
token?: string | undefined;
|
|
234
|
-
}> & Record<string, any>, Partial<{
|
|
235
|
-
token?: string | undefined;
|
|
236
|
-
}> & Record<string, any>, Record<string, any> | undefined>>(data_0: better_auth_client.Prettify<{
|
|
237
|
-
newPassword: string;
|
|
238
|
-
token?: string | undefined;
|
|
239
|
-
} & {
|
|
240
|
-
fetchOptions?: FetchOptions | undefined;
|
|
241
|
-
}>, data_1?: FetchOptions | undefined) => Promise<_better_fetch_fetch.BetterFetchResponse<{
|
|
242
|
-
status: boolean;
|
|
243
|
-
}, {
|
|
244
|
-
code?: string | undefined;
|
|
245
|
-
message?: string | undefined;
|
|
246
|
-
}, FetchOptions["throw"] extends true ? true : false>>;
|
|
247
|
-
} & {
|
|
248
|
-
verifyEmail: <FetchOptions extends _better_auth_core.ClientFetchOption<never, Partial<{
|
|
249
|
-
token: string;
|
|
250
|
-
callbackURL?: string | undefined;
|
|
251
|
-
}> & Record<string, any>, Record<string, any> | undefined>>(data_0: better_auth_client.Prettify<{
|
|
252
|
-
query: {
|
|
253
|
-
token: string;
|
|
254
|
-
callbackURL?: string | undefined;
|
|
255
|
-
};
|
|
256
|
-
fetchOptions?: FetchOptions | undefined;
|
|
257
|
-
}>, data_1?: FetchOptions | undefined) => Promise<_better_fetch_fetch.BetterFetchResponse<NonNullable<void | {
|
|
258
|
-
status: boolean;
|
|
259
|
-
}>, {
|
|
260
|
-
code?: string | undefined;
|
|
261
|
-
message?: string | undefined;
|
|
262
|
-
}, FetchOptions["throw"] extends true ? true : false>>;
|
|
263
|
-
} & {
|
|
264
|
-
sendVerificationEmail: <FetchOptions extends _better_auth_core.ClientFetchOption<Partial<{
|
|
265
|
-
email: string;
|
|
266
|
-
callbackURL?: string | undefined;
|
|
267
|
-
}> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: better_auth_client.Prettify<{
|
|
268
|
-
email: string;
|
|
269
|
-
callbackURL?: string | undefined;
|
|
270
|
-
} & {
|
|
271
|
-
fetchOptions?: FetchOptions | undefined;
|
|
272
|
-
}>, data_1?: FetchOptions | undefined) => Promise<_better_fetch_fetch.BetterFetchResponse<{
|
|
273
|
-
status: boolean;
|
|
274
|
-
}, {
|
|
275
|
-
code?: string | undefined;
|
|
276
|
-
message?: string | undefined;
|
|
277
|
-
}, FetchOptions["throw"] extends true ? true : false>>;
|
|
278
|
-
} & {
|
|
279
|
-
changeEmail: <FetchOptions extends _better_auth_core.ClientFetchOption<Partial<{
|
|
280
|
-
newEmail: string;
|
|
281
|
-
callbackURL?: string | undefined;
|
|
282
|
-
}> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: better_auth_client.Prettify<{
|
|
283
|
-
newEmail: string;
|
|
284
|
-
callbackURL?: string | undefined;
|
|
285
|
-
} & {
|
|
286
|
-
fetchOptions?: FetchOptions | undefined;
|
|
287
|
-
}>, data_1?: FetchOptions | undefined) => Promise<_better_fetch_fetch.BetterFetchResponse<{
|
|
288
|
-
status: boolean;
|
|
289
|
-
}, {
|
|
290
|
-
code?: string | undefined;
|
|
291
|
-
message?: string | undefined;
|
|
292
|
-
}, FetchOptions["throw"] extends true ? true : false>>;
|
|
293
|
-
} & {
|
|
294
|
-
changePassword: <FetchOptions extends _better_auth_core.ClientFetchOption<Partial<{
|
|
295
|
-
newPassword: string;
|
|
296
|
-
currentPassword: string;
|
|
297
|
-
revokeOtherSessions?: boolean | undefined;
|
|
298
|
-
}> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: better_auth_client.Prettify<{
|
|
299
|
-
newPassword: string;
|
|
300
|
-
currentPassword: string;
|
|
301
|
-
revokeOtherSessions?: boolean | undefined;
|
|
302
|
-
} & {
|
|
303
|
-
fetchOptions?: FetchOptions | undefined;
|
|
304
|
-
}>, data_1?: FetchOptions | undefined) => Promise<_better_fetch_fetch.BetterFetchResponse<Omit<{
|
|
305
|
-
token: string | null;
|
|
306
|
-
user: {
|
|
307
|
-
id: string;
|
|
308
|
-
createdAt: Date;
|
|
309
|
-
updatedAt: Date;
|
|
310
|
-
email: string;
|
|
311
|
-
emailVerified: boolean;
|
|
312
|
-
name: string;
|
|
313
|
-
image?: string | null | undefined;
|
|
314
|
-
} & Record<string, any> & {
|
|
315
|
-
id: string;
|
|
316
|
-
createdAt: Date;
|
|
317
|
-
updatedAt: Date;
|
|
318
|
-
email: string;
|
|
319
|
-
emailVerified: boolean;
|
|
320
|
-
name: string;
|
|
321
|
-
image?: string | null | undefined;
|
|
322
|
-
};
|
|
323
|
-
}, "user"> & {
|
|
324
|
-
user: better_auth_client.StripEmptyObjects<{
|
|
325
|
-
id: string;
|
|
326
|
-
createdAt: Date;
|
|
327
|
-
updatedAt: Date;
|
|
328
|
-
email: string;
|
|
329
|
-
emailVerified: boolean;
|
|
330
|
-
name: string;
|
|
331
|
-
image?: string | null | undefined;
|
|
332
|
-
}>;
|
|
333
|
-
}, {
|
|
334
|
-
code?: string | undefined;
|
|
335
|
-
message?: string | undefined;
|
|
336
|
-
}, FetchOptions["throw"] extends true ? true : false>>;
|
|
337
|
-
} & {
|
|
338
|
-
updateSession: <FetchOptions extends _better_auth_core.ClientFetchOption<Partial<Partial<{}>> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0?: better_auth_client.Prettify<Partial<{}> & {
|
|
339
|
-
fetchOptions?: FetchOptions | undefined;
|
|
340
|
-
}> | undefined, data_1?: FetchOptions | undefined) => Promise<_better_fetch_fetch.BetterFetchResponse<{
|
|
341
|
-
session: {
|
|
342
|
-
id: string;
|
|
343
|
-
createdAt: Date;
|
|
344
|
-
updatedAt: Date;
|
|
345
|
-
userId: string;
|
|
346
|
-
expiresAt: Date;
|
|
347
|
-
token: string;
|
|
348
|
-
ipAddress?: string | null | undefined;
|
|
349
|
-
userAgent?: string | null | undefined;
|
|
350
|
-
};
|
|
351
|
-
}, {
|
|
352
|
-
code?: string | undefined;
|
|
353
|
-
message?: string | undefined;
|
|
354
|
-
}, FetchOptions["throw"] extends true ? true : false>>;
|
|
355
|
-
} & {
|
|
356
|
-
updateUser: <FetchOptions extends _better_auth_core.ClientFetchOption<Partial<Partial<{}> & {
|
|
357
|
-
name?: string | undefined;
|
|
358
|
-
image?: string | undefined | null;
|
|
359
|
-
}> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0?: better_auth_client.Prettify<better_auth_client.InferUserUpdateCtx<{
|
|
360
|
-
baseURL: string;
|
|
361
|
-
fetchOptions: {
|
|
362
|
-
auth: {
|
|
363
|
-
type: "Bearer";
|
|
364
|
-
token: () => string;
|
|
365
|
-
};
|
|
366
|
-
};
|
|
367
|
-
}, FetchOptions>> | undefined, data_1?: FetchOptions | undefined) => Promise<_better_fetch_fetch.BetterFetchResponse<{
|
|
368
|
-
status: boolean;
|
|
369
|
-
}, {
|
|
370
|
-
code?: string | undefined;
|
|
371
|
-
message?: string | undefined;
|
|
372
|
-
}, FetchOptions["throw"] extends true ? true : false>>;
|
|
373
|
-
} & {
|
|
374
|
-
deleteUser: <FetchOptions extends _better_auth_core.ClientFetchOption<Partial<{
|
|
375
|
-
callbackURL?: string | undefined;
|
|
376
|
-
password?: string | undefined;
|
|
377
|
-
token?: string | undefined;
|
|
378
|
-
}> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0?: better_auth_client.Prettify<{
|
|
379
|
-
callbackURL?: string | undefined;
|
|
380
|
-
password?: string | undefined;
|
|
381
|
-
token?: string | undefined;
|
|
382
|
-
} & {
|
|
383
|
-
fetchOptions?: FetchOptions | undefined;
|
|
384
|
-
}> | undefined, data_1?: FetchOptions | undefined) => Promise<_better_fetch_fetch.BetterFetchResponse<{
|
|
385
|
-
success: boolean;
|
|
386
|
-
message: string;
|
|
387
|
-
}, {
|
|
388
|
-
code?: string | undefined;
|
|
389
|
-
message?: string | undefined;
|
|
390
|
-
}, FetchOptions["throw"] extends true ? true : false>>;
|
|
391
|
-
} & {
|
|
392
|
-
requestPasswordReset: <FetchOptions extends _better_auth_core.ClientFetchOption<Partial<{
|
|
393
|
-
email: string;
|
|
394
|
-
redirectTo?: string | undefined;
|
|
395
|
-
}> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: better_auth_client.Prettify<{
|
|
396
|
-
email: string;
|
|
397
|
-
redirectTo?: string | undefined;
|
|
398
|
-
} & {
|
|
399
|
-
fetchOptions?: FetchOptions | undefined;
|
|
400
|
-
}>, data_1?: FetchOptions | undefined) => Promise<_better_fetch_fetch.BetterFetchResponse<{
|
|
401
|
-
status: boolean;
|
|
402
|
-
message: string;
|
|
403
|
-
}, {
|
|
404
|
-
code?: string | undefined;
|
|
405
|
-
message?: string | undefined;
|
|
406
|
-
}, FetchOptions["throw"] extends true ? true : false>>;
|
|
407
|
-
} & {
|
|
408
|
-
resetPassword: {
|
|
409
|
-
":token": <FetchOptions extends _better_auth_core.ClientFetchOption<never, Partial<{
|
|
410
|
-
callbackURL: string;
|
|
411
|
-
}> & Record<string, any>, {
|
|
412
|
-
token: string;
|
|
413
|
-
}>>(data_0: better_auth_client.Prettify<{
|
|
414
|
-
query: {
|
|
415
|
-
callbackURL: string;
|
|
416
|
-
};
|
|
417
|
-
fetchOptions?: FetchOptions | undefined;
|
|
418
|
-
}>, data_1?: FetchOptions | undefined) => Promise<_better_fetch_fetch.BetterFetchResponse<never, {
|
|
419
|
-
code?: string | undefined;
|
|
420
|
-
message?: string | undefined;
|
|
421
|
-
}, FetchOptions["throw"] extends true ? true : false>>;
|
|
422
|
-
};
|
|
423
|
-
} & {
|
|
424
|
-
listSessions: <FetchOptions extends _better_auth_core.ClientFetchOption<never, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0?: better_auth_client.Prettify<{
|
|
425
|
-
query?: Record<string, any> | undefined;
|
|
426
|
-
fetchOptions?: FetchOptions | undefined;
|
|
427
|
-
}> | undefined, data_1?: FetchOptions | undefined) => Promise<_better_fetch_fetch.BetterFetchResponse<better_auth_client.Prettify<{
|
|
428
|
-
id: string;
|
|
429
|
-
createdAt: Date;
|
|
430
|
-
updatedAt: Date;
|
|
431
|
-
userId: string;
|
|
432
|
-
expiresAt: Date;
|
|
433
|
-
token: string;
|
|
434
|
-
ipAddress?: string | null | undefined | undefined;
|
|
435
|
-
userAgent?: string | null | undefined | undefined;
|
|
436
|
-
}>[], {
|
|
437
|
-
code?: string | undefined;
|
|
438
|
-
message?: string | undefined;
|
|
439
|
-
}, FetchOptions["throw"] extends true ? true : false>>;
|
|
440
|
-
} & {
|
|
441
|
-
revokeSession: <FetchOptions extends _better_auth_core.ClientFetchOption<Partial<{
|
|
442
|
-
token: string;
|
|
443
|
-
}> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: better_auth_client.Prettify<{
|
|
444
|
-
token: string;
|
|
445
|
-
} & {
|
|
446
|
-
fetchOptions?: FetchOptions | undefined;
|
|
447
|
-
}>, data_1?: FetchOptions | undefined) => Promise<_better_fetch_fetch.BetterFetchResponse<{
|
|
448
|
-
status: boolean;
|
|
449
|
-
}, {
|
|
450
|
-
code?: string | undefined;
|
|
451
|
-
message?: string | undefined;
|
|
452
|
-
}, FetchOptions["throw"] extends true ? true : false>>;
|
|
453
|
-
} & {
|
|
454
|
-
revokeSessions: <FetchOptions extends _better_auth_core.ClientFetchOption<never, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0?: better_auth_client.Prettify<{
|
|
455
|
-
query?: Record<string, any> | undefined;
|
|
456
|
-
fetchOptions?: FetchOptions | undefined;
|
|
457
|
-
}> | undefined, data_1?: FetchOptions | undefined) => Promise<_better_fetch_fetch.BetterFetchResponse<{
|
|
458
|
-
status: boolean;
|
|
459
|
-
}, {
|
|
460
|
-
code?: string | undefined;
|
|
461
|
-
message?: string | undefined;
|
|
462
|
-
}, FetchOptions["throw"] extends true ? true : false>>;
|
|
463
|
-
} & {
|
|
464
|
-
revokeOtherSessions: <FetchOptions extends _better_auth_core.ClientFetchOption<never, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0?: better_auth_client.Prettify<{
|
|
465
|
-
query?: Record<string, any> | undefined;
|
|
466
|
-
fetchOptions?: FetchOptions | undefined;
|
|
467
|
-
}> | undefined, data_1?: FetchOptions | undefined) => Promise<_better_fetch_fetch.BetterFetchResponse<{
|
|
468
|
-
status: boolean;
|
|
469
|
-
}, {
|
|
470
|
-
code?: string | undefined;
|
|
471
|
-
message?: string | undefined;
|
|
472
|
-
}, FetchOptions["throw"] extends true ? true : false>>;
|
|
473
|
-
} & {
|
|
474
|
-
linkSocial: <FetchOptions extends _better_auth_core.ClientFetchOption<Partial<{
|
|
475
|
-
provider: unknown;
|
|
476
|
-
callbackURL?: string | undefined;
|
|
477
|
-
idToken?: {
|
|
478
|
-
token: string;
|
|
479
|
-
nonce?: string | undefined;
|
|
480
|
-
accessToken?: string | undefined;
|
|
481
|
-
refreshToken?: string | undefined;
|
|
482
|
-
scopes?: string[] | undefined;
|
|
483
|
-
} | undefined;
|
|
484
|
-
requestSignUp?: boolean | undefined;
|
|
485
|
-
scopes?: string[] | undefined;
|
|
486
|
-
errorCallbackURL?: string | undefined;
|
|
487
|
-
disableRedirect?: boolean | undefined;
|
|
488
|
-
additionalData?: Record<string, any> | undefined;
|
|
489
|
-
}> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: better_auth_client.Prettify<{
|
|
490
|
-
provider: unknown;
|
|
491
|
-
callbackURL?: string | undefined;
|
|
492
|
-
idToken?: {
|
|
493
|
-
token: string;
|
|
494
|
-
nonce?: string | undefined;
|
|
495
|
-
accessToken?: string | undefined;
|
|
496
|
-
refreshToken?: string | undefined;
|
|
497
|
-
scopes?: string[] | undefined;
|
|
498
|
-
} | undefined;
|
|
499
|
-
requestSignUp?: boolean | undefined;
|
|
500
|
-
scopes?: string[] | undefined;
|
|
501
|
-
errorCallbackURL?: string | undefined;
|
|
502
|
-
disableRedirect?: boolean | undefined;
|
|
503
|
-
additionalData?: Record<string, any> | undefined;
|
|
504
|
-
} & {
|
|
505
|
-
fetchOptions?: FetchOptions | undefined;
|
|
506
|
-
}>, data_1?: FetchOptions | undefined) => Promise<_better_fetch_fetch.BetterFetchResponse<{
|
|
507
|
-
url: string;
|
|
508
|
-
redirect: boolean;
|
|
509
|
-
}, {
|
|
510
|
-
code?: string | undefined;
|
|
511
|
-
message?: string | undefined;
|
|
512
|
-
}, FetchOptions["throw"] extends true ? true : false>>;
|
|
513
|
-
} & {
|
|
514
|
-
listAccounts: <FetchOptions extends _better_auth_core.ClientFetchOption<never, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0?: better_auth_client.Prettify<{
|
|
515
|
-
query?: Record<string, any> | undefined;
|
|
516
|
-
fetchOptions?: FetchOptions | undefined;
|
|
517
|
-
}> | undefined, data_1?: FetchOptions | undefined) => Promise<_better_fetch_fetch.BetterFetchResponse<{
|
|
518
|
-
scopes: string[];
|
|
519
|
-
id: string;
|
|
520
|
-
createdAt: Date;
|
|
521
|
-
updatedAt: Date;
|
|
522
|
-
userId: string;
|
|
523
|
-
providerId: string;
|
|
524
|
-
accountId: string;
|
|
525
|
-
}[], {
|
|
526
|
-
code?: string | undefined;
|
|
527
|
-
message?: string | undefined;
|
|
528
|
-
}, FetchOptions["throw"] extends true ? true : false>>;
|
|
529
|
-
} & {
|
|
530
|
-
deleteUser: {
|
|
531
|
-
callback: <FetchOptions extends _better_auth_core.ClientFetchOption<never, Partial<{
|
|
532
|
-
token: string;
|
|
533
|
-
callbackURL?: string | undefined;
|
|
534
|
-
}> & Record<string, any>, Record<string, any> | undefined>>(data_0: better_auth_client.Prettify<{
|
|
535
|
-
query: {
|
|
536
|
-
token: string;
|
|
537
|
-
callbackURL?: string | undefined;
|
|
538
|
-
};
|
|
539
|
-
fetchOptions?: FetchOptions | undefined;
|
|
540
|
-
}>, data_1?: FetchOptions | undefined) => Promise<_better_fetch_fetch.BetterFetchResponse<{
|
|
541
|
-
success: boolean;
|
|
542
|
-
message: string;
|
|
543
|
-
}, {
|
|
544
|
-
code?: string | undefined;
|
|
545
|
-
message?: string | undefined;
|
|
546
|
-
}, FetchOptions["throw"] extends true ? true : false>>;
|
|
547
|
-
};
|
|
548
|
-
} & {
|
|
549
|
-
unlinkAccount: <FetchOptions extends _better_auth_core.ClientFetchOption<Partial<{
|
|
550
|
-
providerId: string;
|
|
551
|
-
accountId?: string | undefined;
|
|
552
|
-
}> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: better_auth_client.Prettify<{
|
|
553
|
-
providerId: string;
|
|
554
|
-
accountId?: string | undefined;
|
|
555
|
-
} & {
|
|
556
|
-
fetchOptions?: FetchOptions | undefined;
|
|
557
|
-
}>, data_1?: FetchOptions | undefined) => Promise<_better_fetch_fetch.BetterFetchResponse<{
|
|
558
|
-
status: boolean;
|
|
559
|
-
}, {
|
|
560
|
-
code?: string | undefined;
|
|
561
|
-
message?: string | undefined;
|
|
562
|
-
}, FetchOptions["throw"] extends true ? true : false>>;
|
|
563
|
-
} & {
|
|
564
|
-
refreshToken: <FetchOptions extends _better_auth_core.ClientFetchOption<Partial<{
|
|
565
|
-
providerId: string;
|
|
566
|
-
accountId?: string | undefined;
|
|
567
|
-
userId?: string | undefined;
|
|
568
|
-
}> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: better_auth_client.Prettify<{
|
|
569
|
-
providerId: string;
|
|
570
|
-
accountId?: string | undefined;
|
|
571
|
-
userId?: string | undefined;
|
|
572
|
-
} & {
|
|
573
|
-
fetchOptions?: FetchOptions | undefined;
|
|
574
|
-
}>, data_1?: FetchOptions | undefined) => Promise<_better_fetch_fetch.BetterFetchResponse<{
|
|
575
|
-
accessToken: string | undefined;
|
|
576
|
-
refreshToken: string;
|
|
577
|
-
accessTokenExpiresAt: Date | undefined;
|
|
578
|
-
refreshTokenExpiresAt: Date | null | undefined;
|
|
579
|
-
scope: string | null | undefined;
|
|
580
|
-
idToken: string | null | undefined;
|
|
581
|
-
providerId: string;
|
|
582
|
-
accountId: string;
|
|
583
|
-
}, {
|
|
584
|
-
code?: string | undefined;
|
|
585
|
-
message?: string | undefined;
|
|
586
|
-
}, FetchOptions["throw"] extends true ? true : false>>;
|
|
587
|
-
} & {
|
|
588
|
-
getAccessToken: <FetchOptions extends _better_auth_core.ClientFetchOption<Partial<{
|
|
589
|
-
providerId: string;
|
|
590
|
-
accountId?: string | undefined;
|
|
591
|
-
userId?: string | undefined;
|
|
592
|
-
}> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: better_auth_client.Prettify<{
|
|
593
|
-
providerId: string;
|
|
594
|
-
accountId?: string | undefined;
|
|
595
|
-
userId?: string | undefined;
|
|
596
|
-
} & {
|
|
597
|
-
fetchOptions?: FetchOptions | undefined;
|
|
598
|
-
}>, data_1?: FetchOptions | undefined) => Promise<_better_fetch_fetch.BetterFetchResponse<{
|
|
599
|
-
accessToken: string;
|
|
600
|
-
accessTokenExpiresAt: Date | undefined;
|
|
601
|
-
scopes: string[];
|
|
602
|
-
idToken: string | undefined;
|
|
603
|
-
}, {
|
|
604
|
-
code?: string | undefined;
|
|
605
|
-
message?: string | undefined;
|
|
606
|
-
}, FetchOptions["throw"] extends true ? true : false>>;
|
|
607
|
-
} & {
|
|
608
|
-
accountInfo: <FetchOptions extends _better_auth_core.ClientFetchOption<never, Partial<{
|
|
609
|
-
accountId?: string | undefined;
|
|
610
|
-
}> & Record<string, any>, Record<string, any> | undefined>>(data_0?: better_auth_client.Prettify<{
|
|
611
|
-
query?: {
|
|
612
|
-
accountId?: string | undefined;
|
|
613
|
-
} | undefined;
|
|
614
|
-
fetchOptions?: FetchOptions | undefined;
|
|
615
|
-
}> | undefined, data_1?: FetchOptions | undefined) => Promise<_better_fetch_fetch.BetterFetchResponse<{
|
|
616
|
-
user: _better_auth_core_oauth2.OAuth2UserInfo;
|
|
617
|
-
data: Record<string, any>;
|
|
618
|
-
}, {
|
|
619
|
-
code?: string | undefined;
|
|
620
|
-
message?: string | undefined;
|
|
621
|
-
}, FetchOptions["throw"] extends true ? true : false>>;
|
|
622
|
-
} & {
|
|
623
|
-
getSession: <FetchOptions extends _better_auth_core.ClientFetchOption<never, Partial<{
|
|
624
|
-
disableCookieCache?: unknown;
|
|
625
|
-
disableRefresh?: unknown;
|
|
626
|
-
}> & Record<string, any>, Record<string, any> | undefined>>(data_0?: better_auth_client.Prettify<{
|
|
627
|
-
query?: {
|
|
628
|
-
disableCookieCache?: unknown;
|
|
629
|
-
disableRefresh?: unknown;
|
|
630
|
-
} | undefined;
|
|
631
|
-
fetchOptions?: FetchOptions | undefined;
|
|
632
|
-
}> | undefined, data_1?: FetchOptions | undefined) => Promise<_better_fetch_fetch.BetterFetchResponse<{
|
|
633
|
-
user: better_auth_client.StripEmptyObjects<{
|
|
634
|
-
id: string;
|
|
635
|
-
createdAt: Date;
|
|
636
|
-
updatedAt: Date;
|
|
637
|
-
email: string;
|
|
638
|
-
emailVerified: boolean;
|
|
639
|
-
name: string;
|
|
640
|
-
image?: string | null | undefined;
|
|
641
|
-
}>;
|
|
642
|
-
session: better_auth_client.StripEmptyObjects<{
|
|
643
|
-
id: string;
|
|
644
|
-
createdAt: Date;
|
|
645
|
-
updatedAt: Date;
|
|
646
|
-
userId: string;
|
|
647
|
-
expiresAt: Date;
|
|
648
|
-
token: string;
|
|
649
|
-
ipAddress?: string | null | undefined;
|
|
650
|
-
userAgent?: string | null | undefined;
|
|
651
|
-
}>;
|
|
652
|
-
} | null, {
|
|
653
|
-
code?: string | undefined;
|
|
654
|
-
message?: string | undefined;
|
|
655
|
-
}, FetchOptions["throw"] extends true ? true : false>>;
|
|
656
|
-
} & {
|
|
657
|
-
useSession: nanostores.Atom<{
|
|
658
|
-
data: {
|
|
659
|
-
user: better_auth_client.StripEmptyObjects<{
|
|
660
|
-
id: string;
|
|
661
|
-
createdAt: Date;
|
|
662
|
-
updatedAt: Date;
|
|
663
|
-
email: string;
|
|
664
|
-
emailVerified: boolean;
|
|
665
|
-
name: string;
|
|
666
|
-
image?: string | null | undefined;
|
|
667
|
-
}>;
|
|
668
|
-
session: better_auth_client.StripEmptyObjects<{
|
|
669
|
-
id: string;
|
|
670
|
-
createdAt: Date;
|
|
671
|
-
updatedAt: Date;
|
|
672
|
-
userId: string;
|
|
673
|
-
expiresAt: Date;
|
|
674
|
-
token: string;
|
|
675
|
-
ipAddress?: string | null | undefined;
|
|
676
|
-
userAgent?: string | null | undefined;
|
|
677
|
-
}>;
|
|
678
|
-
} | null;
|
|
679
|
-
error: _better_fetch_fetch.BetterFetchError | null;
|
|
680
|
-
isPending: boolean;
|
|
681
|
-
isRefetching: boolean;
|
|
682
|
-
refetch: (queryParams?: {
|
|
683
|
-
query?: better_auth_client.SessionQueryParams;
|
|
684
|
-
} | undefined) => Promise<void>;
|
|
685
|
-
}>;
|
|
686
|
-
$fetch: _better_fetch_fetch.BetterFetch<{
|
|
687
|
-
plugins: (_better_fetch_fetch.BetterFetchPlugin<Record<string, any>> | {
|
|
688
|
-
id: string;
|
|
689
|
-
name: string;
|
|
690
|
-
hooks: {
|
|
691
|
-
onSuccess(context: _better_fetch_fetch.SuccessContext<any>): void;
|
|
692
|
-
};
|
|
693
|
-
} | {
|
|
694
|
-
id: string;
|
|
695
|
-
name: string;
|
|
696
|
-
hooks: {
|
|
697
|
-
onSuccess: ((context: _better_fetch_fetch.SuccessContext<any>) => Promise<void> | void) | undefined;
|
|
698
|
-
onError: ((context: _better_fetch_fetch.ErrorContext) => Promise<void> | void) | undefined;
|
|
699
|
-
onRequest: (<T extends Record<string, any>>(context: _better_fetch_fetch.RequestContext<T>) => Promise<_better_fetch_fetch.RequestContext | void> | _better_fetch_fetch.RequestContext | void) | undefined;
|
|
700
|
-
onResponse: ((context: _better_fetch_fetch.ResponseContext) => Promise<Response | void | _better_fetch_fetch.ResponseContext> | Response | _better_fetch_fetch.ResponseContext | void) | undefined;
|
|
701
|
-
};
|
|
702
|
-
})[];
|
|
703
|
-
priority?: RequestPriority | undefined;
|
|
704
|
-
cache?: RequestCache | undefined;
|
|
705
|
-
credentials?: RequestCredentials;
|
|
706
|
-
headers?: (HeadersInit & (HeadersInit | {
|
|
707
|
-
accept: "application/json" | "text/plain" | "application/octet-stream";
|
|
708
|
-
"content-type": "application/json" | "text/plain" | "application/x-www-form-urlencoded" | "multipart/form-data" | "application/octet-stream";
|
|
709
|
-
authorization: "Bearer" | "Basic";
|
|
710
|
-
})) | undefined;
|
|
711
|
-
integrity?: string | undefined;
|
|
712
|
-
keepalive?: boolean | undefined;
|
|
713
|
-
method: string;
|
|
714
|
-
mode?: RequestMode | undefined;
|
|
715
|
-
redirect?: RequestRedirect | undefined;
|
|
716
|
-
referrer?: string | undefined;
|
|
717
|
-
referrerPolicy?: ReferrerPolicy | undefined;
|
|
718
|
-
signal?: (AbortSignal | null) | undefined;
|
|
719
|
-
window?: null | undefined;
|
|
720
|
-
onRetry?: ((response: _better_fetch_fetch.ResponseContext) => Promise<void> | void) | undefined;
|
|
721
|
-
hookOptions?: {
|
|
722
|
-
cloneResponse?: boolean;
|
|
723
|
-
} | undefined;
|
|
724
|
-
timeout?: number | undefined;
|
|
725
|
-
customFetchImpl: _better_fetch_fetch.FetchEsque;
|
|
726
|
-
baseURL: string;
|
|
727
|
-
throw?: boolean | undefined;
|
|
728
|
-
auth?: ({
|
|
729
|
-
type: "Bearer";
|
|
730
|
-
token: string | Promise<string | undefined> | (() => string | Promise<string | undefined> | undefined) | undefined;
|
|
731
|
-
} | {
|
|
732
|
-
type: "Basic";
|
|
733
|
-
username: string | (() => string | undefined) | undefined;
|
|
734
|
-
password: string | (() => string | undefined) | undefined;
|
|
735
|
-
} | {
|
|
736
|
-
type: "Custom";
|
|
737
|
-
prefix: string | (() => string | undefined) | undefined;
|
|
738
|
-
value: string | (() => string | undefined) | undefined;
|
|
739
|
-
}) | undefined;
|
|
740
|
-
body?: any;
|
|
741
|
-
query?: any;
|
|
742
|
-
params?: any;
|
|
743
|
-
duplex?: "full" | "half" | undefined;
|
|
744
|
-
jsonParser: (text: string) => Promise<any> | any;
|
|
745
|
-
retry?: _better_fetch_fetch.RetryOptions | undefined;
|
|
746
|
-
retryAttempt?: number | undefined;
|
|
747
|
-
output?: (_better_fetch_fetch.StandardSchemaV1 | typeof Blob | typeof File) | undefined;
|
|
748
|
-
errorSchema?: _better_fetch_fetch.StandardSchemaV1 | undefined;
|
|
749
|
-
disableValidation?: boolean | undefined;
|
|
750
|
-
disableSignal?: boolean | undefined;
|
|
751
|
-
}, unknown, unknown, {}>;
|
|
752
|
-
$store: {
|
|
753
|
-
notify: (signal?: (Omit<string, "$sessionSignal"> | "$sessionSignal") | undefined) => void;
|
|
754
|
-
listen: (signal: Omit<string, "$sessionSignal"> | "$sessionSignal", listener: (value: boolean, oldValue?: boolean | undefined) => void) => void;
|
|
755
|
-
atoms: Record<string, nanostores.WritableAtom<any>>;
|
|
756
|
-
};
|
|
757
|
-
$Infer: {
|
|
758
|
-
Session: {
|
|
759
|
-
user: better_auth_client.StripEmptyObjects<{
|
|
760
|
-
id: string;
|
|
761
|
-
createdAt: Date;
|
|
762
|
-
updatedAt: Date;
|
|
763
|
-
email: string;
|
|
764
|
-
emailVerified: boolean;
|
|
765
|
-
name: string;
|
|
766
|
-
image?: string | null | undefined;
|
|
767
|
-
}>;
|
|
768
|
-
session: better_auth_client.StripEmptyObjects<{
|
|
769
|
-
id: string;
|
|
770
|
-
createdAt: Date;
|
|
771
|
-
updatedAt: Date;
|
|
772
|
-
userId: string;
|
|
773
|
-
expiresAt: Date;
|
|
774
|
-
token: string;
|
|
775
|
-
ipAddress?: string | null | undefined;
|
|
776
|
-
userAgent?: string | null | undefined;
|
|
777
|
-
}>;
|
|
778
|
-
};
|
|
779
|
-
};
|
|
780
|
-
$ERROR_CODES: {
|
|
781
|
-
USER_NOT_FOUND: {
|
|
782
|
-
readonly code: "USER_NOT_FOUND";
|
|
783
|
-
message: string;
|
|
784
|
-
};
|
|
785
|
-
FAILED_TO_CREATE_USER: {
|
|
786
|
-
readonly code: "FAILED_TO_CREATE_USER";
|
|
787
|
-
message: string;
|
|
788
|
-
};
|
|
789
|
-
FAILED_TO_CREATE_SESSION: {
|
|
790
|
-
readonly code: "FAILED_TO_CREATE_SESSION";
|
|
791
|
-
message: string;
|
|
792
|
-
};
|
|
793
|
-
FAILED_TO_UPDATE_USER: {
|
|
794
|
-
readonly code: "FAILED_TO_UPDATE_USER";
|
|
795
|
-
message: string;
|
|
796
|
-
};
|
|
797
|
-
FAILED_TO_GET_SESSION: {
|
|
798
|
-
readonly code: "FAILED_TO_GET_SESSION";
|
|
799
|
-
message: string;
|
|
800
|
-
};
|
|
801
|
-
INVALID_PASSWORD: {
|
|
802
|
-
readonly code: "INVALID_PASSWORD";
|
|
803
|
-
message: string;
|
|
804
|
-
};
|
|
805
|
-
INVALID_EMAIL: {
|
|
806
|
-
readonly code: "INVALID_EMAIL";
|
|
807
|
-
message: string;
|
|
808
|
-
};
|
|
809
|
-
INVALID_EMAIL_OR_PASSWORD: {
|
|
810
|
-
readonly code: "INVALID_EMAIL_OR_PASSWORD";
|
|
811
|
-
message: string;
|
|
812
|
-
};
|
|
813
|
-
INVALID_USER: {
|
|
814
|
-
readonly code: "INVALID_USER";
|
|
815
|
-
message: string;
|
|
816
|
-
};
|
|
817
|
-
SOCIAL_ACCOUNT_ALREADY_LINKED: {
|
|
818
|
-
readonly code: "SOCIAL_ACCOUNT_ALREADY_LINKED";
|
|
819
|
-
message: string;
|
|
820
|
-
};
|
|
821
|
-
PROVIDER_NOT_FOUND: {
|
|
822
|
-
readonly code: "PROVIDER_NOT_FOUND";
|
|
823
|
-
message: string;
|
|
824
|
-
};
|
|
825
|
-
INVALID_TOKEN: {
|
|
826
|
-
readonly code: "INVALID_TOKEN";
|
|
827
|
-
message: string;
|
|
828
|
-
};
|
|
829
|
-
TOKEN_EXPIRED: {
|
|
830
|
-
readonly code: "TOKEN_EXPIRED";
|
|
831
|
-
message: string;
|
|
832
|
-
};
|
|
833
|
-
ID_TOKEN_NOT_SUPPORTED: {
|
|
834
|
-
readonly code: "ID_TOKEN_NOT_SUPPORTED";
|
|
835
|
-
message: string;
|
|
836
|
-
};
|
|
837
|
-
FAILED_TO_GET_USER_INFO: {
|
|
838
|
-
readonly code: "FAILED_TO_GET_USER_INFO";
|
|
839
|
-
message: string;
|
|
840
|
-
};
|
|
841
|
-
USER_EMAIL_NOT_FOUND: {
|
|
842
|
-
readonly code: "USER_EMAIL_NOT_FOUND";
|
|
843
|
-
message: string;
|
|
844
|
-
};
|
|
845
|
-
EMAIL_NOT_VERIFIED: {
|
|
846
|
-
readonly code: "EMAIL_NOT_VERIFIED";
|
|
847
|
-
message: string;
|
|
848
|
-
};
|
|
849
|
-
PASSWORD_TOO_SHORT: {
|
|
850
|
-
readonly code: "PASSWORD_TOO_SHORT";
|
|
851
|
-
message: string;
|
|
852
|
-
};
|
|
853
|
-
PASSWORD_TOO_LONG: {
|
|
854
|
-
readonly code: "PASSWORD_TOO_LONG";
|
|
855
|
-
message: string;
|
|
856
|
-
};
|
|
857
|
-
USER_ALREADY_EXISTS: {
|
|
858
|
-
readonly code: "USER_ALREADY_EXISTS";
|
|
859
|
-
message: string;
|
|
860
|
-
};
|
|
861
|
-
USER_ALREADY_EXISTS_USE_ANOTHER_EMAIL: {
|
|
862
|
-
readonly code: "USER_ALREADY_EXISTS_USE_ANOTHER_EMAIL";
|
|
863
|
-
message: string;
|
|
864
|
-
};
|
|
865
|
-
EMAIL_CAN_NOT_BE_UPDATED: {
|
|
866
|
-
readonly code: "EMAIL_CAN_NOT_BE_UPDATED";
|
|
867
|
-
message: string;
|
|
868
|
-
};
|
|
869
|
-
CREDENTIAL_ACCOUNT_NOT_FOUND: {
|
|
870
|
-
readonly code: "CREDENTIAL_ACCOUNT_NOT_FOUND";
|
|
871
|
-
message: string;
|
|
872
|
-
};
|
|
873
|
-
ACCOUNT_NOT_FOUND: {
|
|
874
|
-
readonly code: "ACCOUNT_NOT_FOUND";
|
|
875
|
-
message: string;
|
|
876
|
-
};
|
|
877
|
-
SESSION_EXPIRED: {
|
|
878
|
-
readonly code: "SESSION_EXPIRED";
|
|
879
|
-
message: string;
|
|
880
|
-
};
|
|
881
|
-
FAILED_TO_UNLINK_LAST_ACCOUNT: {
|
|
882
|
-
readonly code: "FAILED_TO_UNLINK_LAST_ACCOUNT";
|
|
883
|
-
message: string;
|
|
884
|
-
};
|
|
885
|
-
USER_ALREADY_HAS_PASSWORD: {
|
|
886
|
-
readonly code: "USER_ALREADY_HAS_PASSWORD";
|
|
887
|
-
message: string;
|
|
888
|
-
};
|
|
889
|
-
CROSS_SITE_NAVIGATION_LOGIN_BLOCKED: {
|
|
890
|
-
readonly code: "CROSS_SITE_NAVIGATION_LOGIN_BLOCKED";
|
|
891
|
-
message: string;
|
|
892
|
-
};
|
|
893
|
-
VERIFICATION_EMAIL_NOT_ENABLED: {
|
|
894
|
-
readonly code: "VERIFICATION_EMAIL_NOT_ENABLED";
|
|
895
|
-
message: string;
|
|
896
|
-
};
|
|
897
|
-
EMAIL_ALREADY_VERIFIED: {
|
|
898
|
-
readonly code: "EMAIL_ALREADY_VERIFIED";
|
|
899
|
-
message: string;
|
|
900
|
-
};
|
|
901
|
-
EMAIL_MISMATCH: {
|
|
902
|
-
readonly code: "EMAIL_MISMATCH";
|
|
903
|
-
message: string;
|
|
904
|
-
};
|
|
905
|
-
SESSION_NOT_FRESH: {
|
|
906
|
-
readonly code: "SESSION_NOT_FRESH";
|
|
907
|
-
message: string;
|
|
908
|
-
};
|
|
909
|
-
LINKED_ACCOUNT_ALREADY_EXISTS: {
|
|
910
|
-
readonly code: "LINKED_ACCOUNT_ALREADY_EXISTS";
|
|
911
|
-
message: string;
|
|
912
|
-
};
|
|
913
|
-
INVALID_ORIGIN: {
|
|
914
|
-
readonly code: "INVALID_ORIGIN";
|
|
915
|
-
message: string;
|
|
916
|
-
};
|
|
917
|
-
INVALID_CALLBACK_URL: {
|
|
918
|
-
readonly code: "INVALID_CALLBACK_URL";
|
|
919
|
-
message: string;
|
|
920
|
-
};
|
|
921
|
-
INVALID_REDIRECT_URL: {
|
|
922
|
-
readonly code: "INVALID_REDIRECT_URL";
|
|
923
|
-
message: string;
|
|
924
|
-
};
|
|
925
|
-
INVALID_ERROR_CALLBACK_URL: {
|
|
926
|
-
readonly code: "INVALID_ERROR_CALLBACK_URL";
|
|
927
|
-
message: string;
|
|
928
|
-
};
|
|
929
|
-
INVALID_NEW_USER_CALLBACK_URL: {
|
|
930
|
-
readonly code: "INVALID_NEW_USER_CALLBACK_URL";
|
|
931
|
-
message: string;
|
|
932
|
-
};
|
|
933
|
-
MISSING_OR_NULL_ORIGIN: {
|
|
934
|
-
readonly code: "MISSING_OR_NULL_ORIGIN";
|
|
935
|
-
message: string;
|
|
936
|
-
};
|
|
937
|
-
CALLBACK_URL_REQUIRED: {
|
|
938
|
-
readonly code: "CALLBACK_URL_REQUIRED";
|
|
939
|
-
message: string;
|
|
940
|
-
};
|
|
941
|
-
FAILED_TO_CREATE_VERIFICATION: {
|
|
942
|
-
readonly code: "FAILED_TO_CREATE_VERIFICATION";
|
|
943
|
-
message: string;
|
|
944
|
-
};
|
|
945
|
-
FIELD_NOT_ALLOWED: {
|
|
946
|
-
readonly code: "FIELD_NOT_ALLOWED";
|
|
947
|
-
message: string;
|
|
948
|
-
};
|
|
949
|
-
ASYNC_VALIDATION_NOT_SUPPORTED: {
|
|
950
|
-
readonly code: "ASYNC_VALIDATION_NOT_SUPPORTED";
|
|
951
|
-
message: string;
|
|
952
|
-
};
|
|
953
|
-
VALIDATION_ERROR: {
|
|
954
|
-
readonly code: "VALIDATION_ERROR";
|
|
955
|
-
message: string;
|
|
956
|
-
};
|
|
957
|
-
MISSING_FIELD: {
|
|
958
|
-
readonly code: "MISSING_FIELD";
|
|
959
|
-
message: string;
|
|
960
|
-
};
|
|
961
|
-
METHOD_NOT_ALLOWED_DEFER_SESSION_REQUIRED: {
|
|
962
|
-
readonly code: "METHOD_NOT_ALLOWED_DEFER_SESSION_REQUIRED";
|
|
963
|
-
message: string;
|
|
964
|
-
};
|
|
965
|
-
BODY_MUST_BE_AN_OBJECT: {
|
|
966
|
-
readonly code: "BODY_MUST_BE_AN_OBJECT";
|
|
967
|
-
message: string;
|
|
968
|
-
};
|
|
969
|
-
PASSWORD_ALREADY_SET: {
|
|
970
|
-
readonly code: "PASSWORD_ALREADY_SET";
|
|
971
|
-
message: string;
|
|
972
|
-
};
|
|
973
|
-
};
|
|
974
|
-
};
|
|
975
|
-
type LeapifyAuthClient = ReturnType<typeof createLeapifyAuthClient>;
|
|
976
|
-
/**
|
|
977
|
-
* Sign in with Google via OAuth redirect flow.
|
|
978
|
-
*
|
|
979
|
-
* Redirects the browser to Google's OAuth page. After authentication,
|
|
980
|
-
* Google redirects back to the Better Auth callback endpoint, which
|
|
981
|
-
* creates a session and redirects to `callbackURL`.
|
|
982
|
-
*
|
|
983
|
-
* Call `syncCookieSessionToStorage()` on app init to restore the
|
|
984
|
-
* session from the cookie after a redirect-based sign-in.
|
|
985
|
-
*
|
|
986
|
-
* @param authClient - Client created by createLeapifyAuthClient
|
|
987
|
-
* @param callbackURL - Path or URL to redirect to after successful auth (e.g. '/dashboard')
|
|
988
|
-
*
|
|
989
|
-
* @example
|
|
990
|
-
* import { signInWithGoogleRedirect } from 'leapify/client'
|
|
991
|
-
*
|
|
992
|
-
* document.getElementById('google-btn').onclick = () => {
|
|
993
|
-
* signInWithGoogleRedirect(authClient, '/dashboard')
|
|
994
|
-
* }
|
|
995
|
-
*/
|
|
996
|
-
declare function signInWithGoogleRedirect(authClient: LeapifyAuthClient, callbackURL: string): Promise<void>;
|
|
997
|
-
/**
|
|
998
|
-
* Sync a cookie-based Better Auth session into localStorage.
|
|
999
|
-
*
|
|
1000
|
-
* After an OAuth redirect flow, Better Auth stores the session in an
|
|
1001
|
-
* HTTP-only cookie. This function reads that session via `getSession()`
|
|
1002
|
-
* and stores the token in localStorage so that subsequent API calls
|
|
1003
|
-
* using the Bearer token work correctly.
|
|
1004
|
-
*
|
|
1005
|
-
* Call this once on app initialization, before `initializeSession()`.
|
|
1006
|
-
*
|
|
1007
|
-
* @param authClient - Client created by createLeapifyAuthClient
|
|
1008
|
-
*
|
|
1009
|
-
* @example
|
|
1010
|
-
* import { syncCookieSessionToStorage, initializeSession } from 'leapify/client'
|
|
1011
|
-
*
|
|
1012
|
-
* // On app mount:
|
|
1013
|
-
* await syncCookieSessionToStorage(authClient)
|
|
1014
|
-
* const user = await initializeSession(API_URL, getToken)
|
|
1015
|
-
*/
|
|
1016
|
-
declare function syncCookieSessionToStorage(authClient: LeapifyAuthClient): Promise<void>;
|
|
1017
|
-
/**
|
|
1018
|
-
* Get the current bearer token from storage, or null for guests.
|
|
1019
|
-
* Pass this to `createLeapifyClient` as the `getToken` option.
|
|
1020
|
-
*
|
|
1021
|
-
* @example
|
|
1022
|
-
* import { createLeapifyClient } from 'leapify/client'
|
|
1023
|
-
* import { createLeapifyAuthClient, getLeapifyToken } from 'leapify/client'
|
|
1024
|
-
*
|
|
1025
|
-
* const authClient = createLeapifyAuthClient(API_URL)
|
|
1026
|
-
* const api = createLeapifyClient(API_URL, () => getLeapifyToken(authClient))
|
|
1027
|
-
*/
|
|
1028
|
-
declare function getLeapifyToken(authClient?: LeapifyAuthClient): Promise<string | null>;
|
|
1029
|
-
/**
|
|
1030
|
-
* Sign out the current user.
|
|
1031
|
-
*/
|
|
1032
|
-
declare function signOut(authClient: LeapifyAuthClient): Promise<{
|
|
1033
|
-
data: {
|
|
1034
|
-
success: boolean;
|
|
1035
|
-
};
|
|
1036
|
-
error: null;
|
|
1037
|
-
} | {
|
|
1038
|
-
data: null;
|
|
1039
|
-
error: {
|
|
1040
|
-
code?: string | undefined | undefined;
|
|
1041
|
-
message?: string | undefined | undefined;
|
|
1042
|
-
status: number;
|
|
1043
|
-
statusText: string;
|
|
1044
|
-
};
|
|
1045
|
-
}>;
|
|
1046
|
-
|
|
1047
|
-
/**
|
|
1048
|
-
* Browser-safe Proof-of-Work challenge solver.
|
|
1049
|
-
*
|
|
1050
|
-
* Solves the SHA-256 PoW challenge served by the leapify backend middleware.
|
|
1051
|
-
* After solving, the server sets a signed cookie (1h TTL) so subsequent
|
|
1052
|
-
* requests bypass the challenge automatically.
|
|
1053
|
-
*
|
|
1054
|
-
* Import from 'leapify/client' — no Cloudflare, Drizzle, or Hono deps.
|
|
1055
|
-
*
|
|
1056
|
-
* @example
|
|
1057
|
-
* import { solvePowChallenge } from 'leapify/client'
|
|
1058
|
-
*
|
|
1059
|
-
* // Call once on app load before any API requests
|
|
1060
|
-
* await solvePowChallenge('https://api.leap.yourdomain.com')
|
|
1061
|
-
*/
|
|
1062
|
-
/**
|
|
1063
|
-
* Solve the backend's Proof-of-Work challenge if one is active.
|
|
1064
|
-
*
|
|
1065
|
-
* Probes the given base URL for an HTML challenge page. If detected,
|
|
1066
|
-
* brute-forces a SHA-256 nonce (~100-500ms) and submits the solution.
|
|
1067
|
-
* The resulting cookie covers all API paths for 1 hour.
|
|
1068
|
-
*
|
|
1069
|
-
* @param baseUrl - The Leapify Worker URL (e.g. `https://api.leap.yourdomain.com`).
|
|
1070
|
-
* If omitted, uses the current page origin (same-origin requests).
|
|
1071
|
-
* @returns `true` if a challenge was solved, `false` if no challenge was needed.
|
|
1072
|
-
*/
|
|
1073
|
-
declare function solvePowChallenge(baseUrl?: string): Promise<boolean>;
|
|
1074
|
-
|
|
1075
|
-
/**
|
|
1076
|
-
* Browser-safe session initialization helper.
|
|
1077
|
-
*
|
|
1078
|
-
* Solves the PoW challenge (if active), checks for an existing session token,
|
|
1079
|
-
* and fetches the user profile. Returns the authenticated user or null.
|
|
1080
|
-
*
|
|
1081
|
-
* Import from 'leapify/client' — no Cloudflare, Drizzle, or Hono deps.
|
|
1082
|
-
*
|
|
1083
|
-
* @example
|
|
1084
|
-
* import { initializeSession, createLeapifyClient } from 'leapify/client'
|
|
1085
|
-
*
|
|
1086
|
-
* const user = await initializeSession(
|
|
1087
|
-
* 'https://api.leap.yourdomain.com',
|
|
1088
|
-
* () => getLeapifyToken(),
|
|
1089
|
-
* )
|
|
1090
|
-
* if (user) {
|
|
1091
|
-
* console.log(`Welcome ${user.name} (${user.role})`)
|
|
1092
|
-
* }
|
|
1093
|
-
*/
|
|
1094
|
-
|
|
1095
|
-
/**
|
|
1096
|
-
* Initialize a browser session: solve PoW, restore existing token, fetch profile.
|
|
1097
|
-
*
|
|
1098
|
-
* @param baseUrl - The Leapify Worker URL.
|
|
1099
|
-
* @param getToken - Async function returning the current session token, or null.
|
|
1100
|
-
* @returns The authenticated user profile, or null if not signed in.
|
|
1101
|
-
*/
|
|
1102
|
-
declare function initializeSession(baseUrl: string, getToken: () => Promise<string | null>): Promise<UserProfile | null>;
|
|
1103
|
-
|
|
1104
1
|
/**
|
|
1105
2
|
* Leapify browser-safe API client.
|
|
1106
3
|
*
|
|
@@ -1117,13 +14,17 @@ declare function initializeSession(baseUrl: string, getToken: () => Promise<stri
|
|
|
1117
14
|
*
|
|
1118
15
|
* const events = await api.getEvents()
|
|
1119
16
|
*/
|
|
1120
|
-
|
|
17
|
+
export type { LeapEvent, SlotInfo, UserProfile, BookmarkEntry, Faq, Theme, SiteConfig, ToggleBookmarkResult, LeapifyErrorBody, UserRole, EventStatus, CreateEventBody, CreateFaqBody, SnapshotResult, HealthResponse, RuntimeConfig, } from "./types";
|
|
18
|
+
export { createLeapifyAuthClient, signInWithGoogleRedirect, syncCookieSessionToStorage, getLeapifyToken, signOut, } from "./auth";
|
|
19
|
+
export type { LeapifyAuthClient } from "./auth";
|
|
20
|
+
export { solvePowChallenge } from "./pow";
|
|
21
|
+
export { initializeSession } from "./session";
|
|
1121
22
|
/**
|
|
1122
23
|
* Read the runtime config injected by the worker into HTML pages.
|
|
1123
24
|
* Returns null if not running in a browser or config not injected.
|
|
1124
25
|
*/
|
|
1125
|
-
declare function getClientConfig(): RuntimeConfig | null;
|
|
1126
|
-
|
|
26
|
+
export declare function getClientConfig(): RuntimeConfig | null;
|
|
27
|
+
import type { RuntimeConfig } from "./types";
|
|
1127
28
|
/**
|
|
1128
29
|
* Structured error thrown by all client methods on non-2xx responses.
|
|
1129
30
|
*
|
|
@@ -1138,12 +39,12 @@ declare function getClientConfig(): RuntimeConfig | null;
|
|
|
1138
39
|
* }
|
|
1139
40
|
* }
|
|
1140
41
|
*/
|
|
1141
|
-
declare class LeapifyApiError extends Error {
|
|
42
|
+
export declare class LeapifyApiError extends Error {
|
|
1142
43
|
readonly status: number;
|
|
1143
44
|
readonly code: string;
|
|
1144
45
|
constructor(status: number, code: string, message: string);
|
|
1145
46
|
}
|
|
1146
|
-
declare const LEAPIFY_ERROR_CODES: {
|
|
47
|
+
export declare const LEAPIFY_ERROR_CODES: {
|
|
1147
48
|
readonly UNAUTHORIZED: "UNAUTHORIZED";
|
|
1148
49
|
readonly DOMAIN_RESTRICTED: "DOMAIN_RESTRICTED";
|
|
1149
50
|
readonly FORBIDDEN: "FORBIDDEN";
|
|
@@ -1153,8 +54,8 @@ declare const LEAPIFY_ERROR_CODES: {
|
|
|
1153
54
|
readonly SERVICE_UNAVAILABLE: "SERVICE_UNAVAILABLE";
|
|
1154
55
|
readonly INTERNAL_ERROR: "INTERNAL_ERROR";
|
|
1155
56
|
};
|
|
1156
|
-
type LeapifyErrorCode = keyof typeof LEAPIFY_ERROR_CODES;
|
|
1157
|
-
|
|
57
|
+
export type LeapifyErrorCode = keyof typeof LEAPIFY_ERROR_CODES;
|
|
58
|
+
import type { LeapEvent, SlotInfo, UserProfile, BookmarkEntry, Faq, Theme, SiteConfig, ToggleBookmarkResult, CreateEventBody, CreateFaqBody, SnapshotResult, HealthResponse } from "./types";
|
|
1158
59
|
type GetTokenFn = () => Promise<string | null>;
|
|
1159
60
|
/**
|
|
1160
61
|
* Creates a typed Leapify API client bound to a base URL.
|
|
@@ -1172,7 +73,7 @@ type GetTokenFn = () => Promise<string | null>;
|
|
|
1172
73
|
* () => getLeapifyToken(),
|
|
1173
74
|
* )
|
|
1174
75
|
*/
|
|
1175
|
-
declare function createLeapifyClient(baseUrl: string, getToken?: GetTokenFn): {
|
|
76
|
+
export declare function createLeapifyClient(baseUrl: string, getToken?: GetTokenFn): {
|
|
1176
77
|
/**
|
|
1177
78
|
* GET /config
|
|
1178
79
|
* Returns site-wide configuration. Check `maintenanceMode` and
|
|
@@ -1181,7 +82,7 @@ declare function createLeapifyClient(baseUrl: string, getToken?: GetTokenFn): {
|
|
|
1181
82
|
*/
|
|
1182
83
|
getConfig(): Promise<SiteConfig>;
|
|
1183
84
|
/**
|
|
1184
|
-
* PATCH /config/:key — admin only.
|
|
85
|
+
* PATCH /api/config/:key — admin only.
|
|
1185
86
|
* Upserts a site config value. Requires admin or super_admin role.
|
|
1186
87
|
*/
|
|
1187
88
|
updateConfig<K extends string>(key: K, value: unknown): Promise<{
|
|
@@ -1189,96 +90,96 @@ declare function createLeapifyClient(baseUrl: string, getToken?: GetTokenFn): {
|
|
|
1189
90
|
value: unknown;
|
|
1190
91
|
}>;
|
|
1191
92
|
/**
|
|
1192
|
-
* GET /events
|
|
93
|
+
* GET /api/events
|
|
1193
94
|
* Returns all published events. Response is ETag-cached for 7 days.
|
|
1194
95
|
*/
|
|
1195
96
|
getEvents(): Promise<LeapEvent[]>;
|
|
1196
97
|
/**
|
|
1197
|
-
* GET /events/:slug
|
|
98
|
+
* GET /api/events/:slug
|
|
1198
99
|
* Returns a single published event by slug.
|
|
1199
100
|
*/
|
|
1200
101
|
getEvent(slug: string): Promise<LeapEvent>;
|
|
1201
102
|
/**
|
|
1202
|
-
* GET /events/:slug/slots
|
|
103
|
+
* GET /api/events/:slug/slots
|
|
1203
104
|
* Returns real-time slot availability. CF edge caches this for 5 seconds.
|
|
1204
105
|
* Poll every 8–10 seconds on event detail pages.
|
|
1205
106
|
*/
|
|
1206
107
|
getSlots(slug: string): Promise<SlotInfo>;
|
|
1207
108
|
/**
|
|
1208
|
-
* POST /events — admin only.
|
|
109
|
+
* POST /api/events — admin only.
|
|
1209
110
|
* Creates a new event. Auto-generates slug from title.
|
|
1210
111
|
*/
|
|
1211
112
|
createEvent(data: CreateEventBody): Promise<LeapEvent>;
|
|
1212
113
|
/**
|
|
1213
|
-
* PATCH /events/:slug — admin only.
|
|
114
|
+
* PATCH /api/events/:slug — admin only.
|
|
1214
115
|
* Updates an existing event by slug.
|
|
1215
116
|
*/
|
|
1216
117
|
updateEvent(slug: string, data: Partial<CreateEventBody>): Promise<LeapEvent>;
|
|
1217
118
|
/**
|
|
1218
|
-
* GET /themes
|
|
119
|
+
* GET /api/themes
|
|
1219
120
|
* Returns all themes.
|
|
1220
121
|
*/
|
|
1221
122
|
getThemes(): Promise<Theme[]>;
|
|
1222
123
|
/**
|
|
1223
|
-
* POST /themes — admin only.
|
|
124
|
+
* POST /api/themes — admin only.
|
|
1224
125
|
*/
|
|
1225
126
|
createTheme(data: Omit<Theme, "id" | "createdAt">): Promise<Theme>;
|
|
1226
127
|
/**
|
|
1227
|
-
* PATCH /themes/:id — admin only.
|
|
128
|
+
* PATCH /api/themes/:id — admin only.
|
|
1228
129
|
*/
|
|
1229
130
|
updateTheme(id: string, data: Partial<Omit<Theme, "id" | "createdAt">>): Promise<Theme>;
|
|
1230
131
|
/**
|
|
1231
|
-
* DELETE /themes/:id — admin only.
|
|
132
|
+
* DELETE /api/themes/:id — admin only.
|
|
1232
133
|
*/
|
|
1233
134
|
deleteTheme(id: string): Promise<void>;
|
|
1234
135
|
/**
|
|
1235
|
-
* GET /users/me
|
|
136
|
+
* GET /api/users/me
|
|
1236
137
|
* Returns the authenticated user's profile, or null for guests.
|
|
1237
138
|
* Use `profile.role` to gate admin UI.
|
|
1238
139
|
*/
|
|
1239
140
|
getMe(): Promise<UserProfile | null>;
|
|
1240
141
|
/**
|
|
1241
|
-
* GET /users/me/bookmarks
|
|
142
|
+
* GET /api/users/me/bookmarks
|
|
1242
143
|
* Returns the authenticated user's bookmarked events.
|
|
1243
144
|
* Returns an empty array for unauthenticated users.
|
|
1244
145
|
*/
|
|
1245
146
|
getBookmarks(): Promise<BookmarkEntry[]>;
|
|
1246
147
|
/**
|
|
1247
|
-
* POST /users/me/bookmarks/:eventId
|
|
148
|
+
* POST /api/users/me/bookmarks/:eventId
|
|
1248
149
|
* Toggles a bookmark on/off. Requires authentication.
|
|
1249
150
|
* Returns `{ bookmarked: true }` (201) on add, `{ bookmarked: false }` (200) on remove.
|
|
1250
151
|
*/
|
|
1251
152
|
toggleBookmark(eventId: string): Promise<ToggleBookmarkResult>;
|
|
1252
153
|
/**
|
|
1253
|
-
* DELETE /users/me/bookmarks/:eventId
|
|
154
|
+
* DELETE /api/users/me/bookmarks/:eventId
|
|
1254
155
|
* Removes a bookmark. Requires authentication.
|
|
1255
156
|
*/
|
|
1256
157
|
deleteBookmark(eventId: string): Promise<ToggleBookmarkResult>;
|
|
1257
158
|
/**
|
|
1258
|
-
* GET /faqs
|
|
159
|
+
* GET /api/faqs
|
|
1259
160
|
* Returns all active FAQs. Cached in KV for 10 minutes.
|
|
1260
161
|
* The `answer` field is markdown — render with a markdown library.
|
|
1261
162
|
*/
|
|
1262
163
|
getFaqs(): Promise<Faq[]>;
|
|
1263
164
|
/**
|
|
1264
|
-
* POST /faqs — admin only.
|
|
165
|
+
* POST /api/faqs — admin only.
|
|
1265
166
|
* Creates a new FAQ item.
|
|
1266
167
|
*/
|
|
1267
168
|
createFaq(data: CreateFaqBody): Promise<Faq>;
|
|
1268
169
|
/**
|
|
1269
|
-
* PATCH /faqs/:id — admin only.
|
|
170
|
+
* PATCH /api/faqs/:id — admin only.
|
|
1270
171
|
* Updates an existing FAQ item.
|
|
1271
172
|
*/
|
|
1272
173
|
updateFaq(id: string, data: Partial<CreateFaqBody>): Promise<Faq>;
|
|
1273
174
|
/**
|
|
1274
|
-
* DELETE /faqs/:id — admin only.
|
|
175
|
+
* DELETE /api/faqs/:id — admin only.
|
|
1275
176
|
* Soft-deletes a FAQ (sets isActive: false).
|
|
1276
177
|
*/
|
|
1277
178
|
deleteFaq(id: string): Promise<{
|
|
1278
179
|
deleted: boolean;
|
|
1279
180
|
}>;
|
|
1280
181
|
/**
|
|
1281
|
-
* POST /uploads/images — admin only.
|
|
182
|
+
* POST /api/uploads/images — admin only.
|
|
1282
183
|
* Uploads an image file to R2. Accepts multipart/form-data.
|
|
1283
184
|
* Returns the public URL, storage key, size, and content type.
|
|
1284
185
|
*/
|
|
@@ -1289,7 +190,7 @@ declare function createLeapifyClient(baseUrl: string, getToken?: GetTokenFn): {
|
|
|
1289
190
|
contentType: string;
|
|
1290
191
|
}>;
|
|
1291
192
|
/**
|
|
1292
|
-
* POST /config/sync-content — admin only.
|
|
193
|
+
* POST /api/config/sync-content — admin only.
|
|
1293
194
|
* Pushes all D1 content to Contentful. Auto-generates content types if missing.
|
|
1294
195
|
*/
|
|
1295
196
|
syncContent(): Promise<SnapshotResult>;
|
|
@@ -1299,6 +200,5 @@ declare function createLeapifyClient(baseUrl: string, getToken?: GetTokenFn): {
|
|
|
1299
200
|
*/
|
|
1300
201
|
healthCheck(): Promise<HealthResponse>;
|
|
1301
202
|
};
|
|
1302
|
-
type LeapifyClient = ReturnType<typeof createLeapifyClient>;
|
|
1303
|
-
|
|
1304
|
-
export { BookmarkEntry, CreateEventBody, CreateFaqBody, Faq, HealthResponse, LEAPIFY_ERROR_CODES, LeapEvent, LeapifyApiError, type LeapifyAuthClient, type LeapifyClient, type LeapifyErrorCode, RuntimeConfig, SiteConfig, SlotInfo, SnapshotResult, Theme, ToggleBookmarkResult, UserProfile, createLeapifyAuthClient, createLeapifyClient, getClientConfig, getLeapifyToken, initializeSession, signInWithGoogleRedirect, signOut, solvePowChallenge, syncCookieSessionToStorage };
|
|
203
|
+
export type LeapifyClient = ReturnType<typeof createLeapifyClient>;
|
|
204
|
+
//# sourceMappingURL=index.d.ts.map
|