@better-auth/expo 1.6.23 → 1.6.24
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/client.d.ts +13 -16
- package/dist/client.js +31 -2
- package/dist/index.d.ts +10 -15
- package/dist/index.js +1 -1
- package/dist/plugins/index.d.ts +1 -3
- package/dist/plugins/index.js +14 -1
- package/dist/{version-D8wEp7a2.js → version-DsNmK8I4.js} +1 -1
- package/package.json +6 -6
package/dist/client.d.ts
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import { parseSetCookieHeader } from "better-auth/cookies";
|
|
2
2
|
import { FocusManager, OnlineManager } from "better-auth/client";
|
|
3
|
-
import * as expo_web_browser0 from "expo-web-browser";
|
|
4
|
-
import * as _better_fetch_fetch0 from "@better-fetch/fetch";
|
|
5
3
|
import { ClientFetchOption, ClientStore } from "@better-auth/core";
|
|
6
|
-
|
|
7
4
|
//#region src/focus-manager.d.ts
|
|
8
5
|
declare function setupExpoFocusManager(): FocusManager;
|
|
9
6
|
//#endregion
|
|
@@ -52,7 +49,7 @@ interface ExpoClientOptions {
|
|
|
52
49
|
* });
|
|
53
50
|
* ```
|
|
54
51
|
*/
|
|
55
|
-
webBrowserOptions?:
|
|
52
|
+
webBrowserOptions?: import("expo-web-browser").AuthSessionOpenOptions;
|
|
56
53
|
}
|
|
57
54
|
declare function getSetCookie(header: string, prevCookie?: string | undefined): string;
|
|
58
55
|
declare function getCookie(cookie: string): string;
|
|
@@ -105,7 +102,7 @@ declare function storageAdapter(storage: {
|
|
|
105
102
|
declare const expoClient: (opts: ExpoClientOptions) => {
|
|
106
103
|
id: "expo";
|
|
107
104
|
version: string;
|
|
108
|
-
getActions(_:
|
|
105
|
+
getActions(_: import("@better-fetch/fetch").BetterFetch, $store: ClientStore): {
|
|
109
106
|
/**
|
|
110
107
|
* Get the stored cookie.
|
|
111
108
|
*
|
|
@@ -127,7 +124,7 @@ declare const expoClient: (opts: ExpoClientOptions) => {
|
|
|
127
124
|
id: string;
|
|
128
125
|
name: string;
|
|
129
126
|
hooks: {
|
|
130
|
-
onSuccess(context:
|
|
127
|
+
onSuccess(context: import("@better-fetch/fetch").SuccessContext<any>): Promise<void>;
|
|
131
128
|
};
|
|
132
129
|
init(url: string, options: ({
|
|
133
130
|
priority?: RequestPriority | undefined;
|
|
@@ -142,17 +139,17 @@ declare const expoClient: (opts: ExpoClientOptions) => {
|
|
|
142
139
|
referrer?: string | undefined;
|
|
143
140
|
referrerPolicy?: ReferrerPolicy | undefined;
|
|
144
141
|
signal?: (AbortSignal | null) | undefined;
|
|
145
|
-
onRequest?: (<T extends Record<string, any>>(context:
|
|
146
|
-
onResponse?: ((context:
|
|
147
|
-
onSuccess?: ((context:
|
|
148
|
-
onError?: ((context:
|
|
149
|
-
onRetry?: ((response:
|
|
142
|
+
onRequest?: (<T extends Record<string, any>>(context: import("@better-fetch/fetch").RequestContext<T>) => Promise<import("@better-fetch/fetch").RequestContext | void> | import("@better-fetch/fetch").RequestContext | void) | undefined;
|
|
143
|
+
onResponse?: ((context: import("@better-fetch/fetch").ResponseContext) => Promise<Response | void | import("@better-fetch/fetch").ResponseContext> | Response | import("@better-fetch/fetch").ResponseContext | void) | undefined;
|
|
144
|
+
onSuccess?: ((context: import("@better-fetch/fetch").SuccessContext<any>) => Promise<void> | void) | undefined;
|
|
145
|
+
onError?: ((context: import("@better-fetch/fetch").ErrorContext) => Promise<void> | void) | undefined;
|
|
146
|
+
onRetry?: ((response: import("@better-fetch/fetch").ResponseContext) => Promise<void> | void) | undefined;
|
|
150
147
|
hookOptions?: {
|
|
151
148
|
cloneResponse?: boolean;
|
|
152
149
|
} | undefined;
|
|
153
150
|
timeout?: number | undefined;
|
|
154
|
-
customFetchImpl?:
|
|
155
|
-
plugins?:
|
|
151
|
+
customFetchImpl?: import("@better-fetch/fetch").FetchEsque | undefined;
|
|
152
|
+
plugins?: import("@better-fetch/fetch").BetterFetchPlugin[] | undefined;
|
|
156
153
|
baseURL?: string | undefined;
|
|
157
154
|
throw?: boolean | undefined;
|
|
158
155
|
auth?: ({
|
|
@@ -178,10 +175,10 @@ declare const expoClient: (opts: ExpoClientOptions) => {
|
|
|
178
175
|
params?: any;
|
|
179
176
|
duplex?: "full" | "half" | undefined;
|
|
180
177
|
jsonParser?: ((text: string) => Promise<any> | any) | undefined;
|
|
181
|
-
retry?:
|
|
178
|
+
retry?: import("@better-fetch/fetch").RetryOptions | undefined;
|
|
182
179
|
retryAttempt?: number | undefined;
|
|
183
|
-
output?: (
|
|
184
|
-
errorSchema?:
|
|
180
|
+
output?: (import("@better-fetch/fetch").StandardSchemaV1 | typeof Blob | typeof File) | undefined;
|
|
181
|
+
errorSchema?: import("@better-fetch/fetch").StandardSchemaV1 | undefined;
|
|
185
182
|
disableValidation?: boolean | undefined;
|
|
186
183
|
} & Record<string, any>) | undefined): Promise<{
|
|
187
184
|
url: string;
|
package/dist/client.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as PACKAGE_VERSION } from "./version-
|
|
1
|
+
import { t as PACKAGE_VERSION } from "./version-DsNmK8I4.js";
|
|
2
2
|
import { safeJSONParse } from "@better-auth/core/utils/json";
|
|
3
3
|
import { SECURE_COOKIE_PREFIX, parseSetCookieHeader, parseSetCookieHeader as parseSetCookieHeader$1, stripSecureCookiePrefix } from "better-auth/cookies";
|
|
4
4
|
import Constants from "expo-constants";
|
|
@@ -212,6 +212,11 @@ const STORAGE_VALUE_LIMIT = 1800;
|
|
|
212
212
|
const CHUNK_MARKER = "ba-chunks:";
|
|
213
213
|
function storageAdapter(storage) {
|
|
214
214
|
return {
|
|
215
|
+
/**
|
|
216
|
+
* Reads a value, reassembling it if it was split across chunk keys. A value
|
|
217
|
+
* that fit is returned as-is (values written before chunking still read
|
|
218
|
+
* back); a missing chunk returns `null` so a torn write fails closed.
|
|
219
|
+
*/
|
|
215
220
|
getItem: (name) => {
|
|
216
221
|
const key = normalizeCookieName(name);
|
|
217
222
|
const stored = storage.getItem(key);
|
|
@@ -226,6 +231,14 @@ function storageAdapter(storage) {
|
|
|
226
231
|
}
|
|
227
232
|
return value;
|
|
228
233
|
},
|
|
234
|
+
/**
|
|
235
|
+
* Stores `value`, splitting it across chunk keys when it exceeds the
|
|
236
|
+
* per-write limit. The base key is cleared before the chunks are rewritten
|
|
237
|
+
* and set to the marker last, as the commit point, so a write interrupted
|
|
238
|
+
* partway through reads as absent rather than a mix of old and new chunks.
|
|
239
|
+
* Failures are logged, not thrown: persistence is best-effort and must not
|
|
240
|
+
* break the request.
|
|
241
|
+
*/
|
|
229
242
|
setItem: async (name, value) => {
|
|
230
243
|
const key = normalizeCookieName(name);
|
|
231
244
|
try {
|
|
@@ -284,7 +297,23 @@ const expoClient = (opts) => {
|
|
|
284
297
|
error: null
|
|
285
298
|
});
|
|
286
299
|
}
|
|
287
|
-
return {
|
|
300
|
+
return {
|
|
301
|
+
/**
|
|
302
|
+
* Get the stored cookie.
|
|
303
|
+
*
|
|
304
|
+
* You can use this to get the cookie stored in the device and use it in your fetch
|
|
305
|
+
* requests.
|
|
306
|
+
*
|
|
307
|
+
* @example
|
|
308
|
+
* ```ts
|
|
309
|
+
* const cookie = client.getCookie();
|
|
310
|
+
* fetch("https://api.example.com", {
|
|
311
|
+
* headers: {
|
|
312
|
+
* cookie,
|
|
313
|
+
* },
|
|
314
|
+
* });
|
|
315
|
+
*/
|
|
316
|
+
getCookie: () => {
|
|
288
317
|
return getCookie(storage.getItem(cookieName) || "{}");
|
|
289
318
|
} };
|
|
290
319
|
},
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
import * as better_auth0 from "better-auth";
|
|
2
|
-
import * as zod from "zod";
|
|
3
|
-
import * as better_call0 from "better-call";
|
|
4
|
-
import * as zod_v4_core0 from "zod/v4/core";
|
|
5
|
-
|
|
6
1
|
//#region src/index.d.ts
|
|
7
2
|
interface ExpoOptions {
|
|
8
3
|
/**
|
|
@@ -21,32 +16,32 @@ declare module "@better-auth/core" {
|
|
|
21
16
|
declare const expo: (options?: ExpoOptions | undefined) => {
|
|
22
17
|
id: "expo";
|
|
23
18
|
version: string;
|
|
24
|
-
init: (ctx:
|
|
19
|
+
init: (ctx: import("better-auth").AuthContext) => {
|
|
25
20
|
options: {
|
|
26
21
|
trustedOrigins: string[];
|
|
27
22
|
};
|
|
28
23
|
};
|
|
29
|
-
onRequest(request: Request, ctx:
|
|
24
|
+
onRequest(request: Request, ctx: import("better-auth").AuthContext): Promise<{
|
|
30
25
|
request: Request;
|
|
31
26
|
} | undefined>;
|
|
32
27
|
hooks: {
|
|
33
28
|
after: {
|
|
34
|
-
matcher(context:
|
|
35
|
-
handler: (inputContext:
|
|
29
|
+
matcher(context: import("better-auth").HookEndpointContext): boolean;
|
|
30
|
+
handler: (inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<void>;
|
|
36
31
|
}[];
|
|
37
32
|
};
|
|
38
33
|
endpoints: {
|
|
39
|
-
expoAuthorizationProxy:
|
|
34
|
+
expoAuthorizationProxy: import("better-call").StrictEndpoint<"/expo-authorization-proxy", {
|
|
40
35
|
method: "GET";
|
|
41
|
-
query: zod.ZodObject<{
|
|
42
|
-
authorizationURL: zod.ZodString;
|
|
43
|
-
oauthState: zod.ZodOptional<zod.ZodString>;
|
|
44
|
-
},
|
|
36
|
+
query: import("zod").ZodObject<{
|
|
37
|
+
authorizationURL: import("zod").ZodString;
|
|
38
|
+
oauthState: import("zod").ZodOptional<import("zod").ZodString>;
|
|
39
|
+
}, import("zod/v4/core").$strip>;
|
|
45
40
|
metadata: {
|
|
46
41
|
readonly scope: "server";
|
|
47
42
|
};
|
|
48
43
|
}, {
|
|
49
|
-
status: ("OK" | "CREATED" | "ACCEPTED" | "NO_CONTENT" | "MULTIPLE_CHOICES" | "MOVED_PERMANENTLY" | "FOUND" | "SEE_OTHER" | "NOT_MODIFIED" | "TEMPORARY_REDIRECT" | "BAD_REQUEST" | "UNAUTHORIZED" | "PAYMENT_REQUIRED" | "FORBIDDEN" | "NOT_FOUND" | "METHOD_NOT_ALLOWED" | "NOT_ACCEPTABLE" | "PROXY_AUTHENTICATION_REQUIRED" | "REQUEST_TIMEOUT" | "CONFLICT" | "GONE" | "LENGTH_REQUIRED" | "PRECONDITION_FAILED" | "PAYLOAD_TOO_LARGE" | "URI_TOO_LONG" | "UNSUPPORTED_MEDIA_TYPE" | "RANGE_NOT_SATISFIABLE" | "EXPECTATION_FAILED" | "I'M_A_TEAPOT" | "MISDIRECTED_REQUEST" | "UNPROCESSABLE_ENTITY" | "LOCKED" | "FAILED_DEPENDENCY" | "TOO_EARLY" | "UPGRADE_REQUIRED" | "PRECONDITION_REQUIRED" | "TOO_MANY_REQUESTS" | "REQUEST_HEADER_FIELDS_TOO_LARGE" | "UNAVAILABLE_FOR_LEGAL_REASONS" | "INTERNAL_SERVER_ERROR" | "NOT_IMPLEMENTED" | "BAD_GATEWAY" | "SERVICE_UNAVAILABLE" | "GATEWAY_TIMEOUT" | "HTTP_VERSION_NOT_SUPPORTED" | "VARIANT_ALSO_NEGOTIATES" | "INSUFFICIENT_STORAGE" | "LOOP_DETECTED" | "NOT_EXTENDED" | "NETWORK_AUTHENTICATION_REQUIRED") |
|
|
44
|
+
status: ("OK" | "CREATED" | "ACCEPTED" | "NO_CONTENT" | "MULTIPLE_CHOICES" | "MOVED_PERMANENTLY" | "FOUND" | "SEE_OTHER" | "NOT_MODIFIED" | "TEMPORARY_REDIRECT" | "BAD_REQUEST" | "UNAUTHORIZED" | "PAYMENT_REQUIRED" | "FORBIDDEN" | "NOT_FOUND" | "METHOD_NOT_ALLOWED" | "NOT_ACCEPTABLE" | "PROXY_AUTHENTICATION_REQUIRED" | "REQUEST_TIMEOUT" | "CONFLICT" | "GONE" | "LENGTH_REQUIRED" | "PRECONDITION_FAILED" | "PAYLOAD_TOO_LARGE" | "URI_TOO_LONG" | "UNSUPPORTED_MEDIA_TYPE" | "RANGE_NOT_SATISFIABLE" | "EXPECTATION_FAILED" | "I'M_A_TEAPOT" | "MISDIRECTED_REQUEST" | "UNPROCESSABLE_ENTITY" | "LOCKED" | "FAILED_DEPENDENCY" | "TOO_EARLY" | "UPGRADE_REQUIRED" | "PRECONDITION_REQUIRED" | "TOO_MANY_REQUESTS" | "REQUEST_HEADER_FIELDS_TOO_LARGE" | "UNAVAILABLE_FOR_LEGAL_REASONS" | "INTERNAL_SERVER_ERROR" | "NOT_IMPLEMENTED" | "BAD_GATEWAY" | "SERVICE_UNAVAILABLE" | "GATEWAY_TIMEOUT" | "HTTP_VERSION_NOT_SUPPORTED" | "VARIANT_ALSO_NEGOTIATES" | "INSUFFICIENT_STORAGE" | "LOOP_DETECTED" | "NOT_EXTENDED" | "NETWORK_AUTHENTICATION_REQUIRED") | import("better-call").Status;
|
|
50
45
|
body: ({
|
|
51
46
|
message?: string;
|
|
52
47
|
code?: string;
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as PACKAGE_VERSION } from "./version-
|
|
1
|
+
import { t as PACKAGE_VERSION } from "./version-DsNmK8I4.js";
|
|
2
2
|
import { createAuthMiddleware } from "@better-auth/core/api";
|
|
3
3
|
import { HIDE_METADATA } from "better-auth";
|
|
4
4
|
import { APIError, createAuthEndpoint } from "better-auth/api";
|
package/dist/plugins/index.d.ts
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import * as _better_fetch_fetch0 from "@better-fetch/fetch";
|
|
2
1
|
import { Awaitable } from "@better-auth/core";
|
|
3
|
-
|
|
4
2
|
//#region src/plugins/last-login-method.d.ts
|
|
5
3
|
interface LastLoginMethodClientConfig {
|
|
6
4
|
storage: {
|
|
@@ -25,7 +23,7 @@ declare const lastLoginMethodClient: (config: LastLoginMethodClientConfig) => {
|
|
|
25
23
|
id: string;
|
|
26
24
|
name: string;
|
|
27
25
|
hooks: {
|
|
28
|
-
onResponse: (ctx:
|
|
26
|
+
onResponse: (ctx: import("@better-fetch/fetch").ResponseContext) => Promise<void>;
|
|
29
27
|
};
|
|
30
28
|
}[];
|
|
31
29
|
getActions(): {
|
package/dist/plugins/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as PACKAGE_VERSION } from "../version-
|
|
1
|
+
import { t as PACKAGE_VERSION } from "../version-DsNmK8I4.js";
|
|
2
2
|
//#region src/plugins/last-login-method.ts
|
|
3
3
|
const paths = [
|
|
4
4
|
"/callback/",
|
|
@@ -30,12 +30,25 @@ const lastLoginMethodClient = (config) => {
|
|
|
30
30
|
}],
|
|
31
31
|
getActions() {
|
|
32
32
|
return {
|
|
33
|
+
/**
|
|
34
|
+
* Get the last used login method from storage
|
|
35
|
+
*
|
|
36
|
+
* @returns The last used login method or null if not found
|
|
37
|
+
*/
|
|
33
38
|
getLastUsedLoginMethod: () => {
|
|
34
39
|
return storage.getItem(lastLoginMethodName);
|
|
35
40
|
},
|
|
41
|
+
/**
|
|
42
|
+
* Clear the last used login method from storage
|
|
43
|
+
*/
|
|
36
44
|
clearLastUsedLoginMethod: async () => {
|
|
37
45
|
await storage.deleteItemAsync(lastLoginMethodName);
|
|
38
46
|
},
|
|
47
|
+
/**
|
|
48
|
+
* Check if a specific login method was the last used
|
|
49
|
+
* @param method The method to check
|
|
50
|
+
* @returns True if the method was the last used, false otherwise
|
|
51
|
+
*/
|
|
39
52
|
isLastUsedLoginMethod: (method) => {
|
|
40
53
|
return storage.getItem(lastLoginMethodName) === method;
|
|
41
54
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@better-auth/expo",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.24",
|
|
4
4
|
"description": "Better Auth integration for Expo and React Native applications.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -69,17 +69,17 @@
|
|
|
69
69
|
"expo-network": "~55.0.8",
|
|
70
70
|
"expo-web-browser": "~55.0.9",
|
|
71
71
|
"react-native": "~0.84.1",
|
|
72
|
-
"tsdown": "0.
|
|
73
|
-
"@better-auth/core": "1.6.
|
|
74
|
-
"better-auth": "1.6.
|
|
72
|
+
"tsdown": "0.22.7",
|
|
73
|
+
"@better-auth/core": "1.6.24",
|
|
74
|
+
"better-auth": "1.6.24"
|
|
75
75
|
},
|
|
76
76
|
"peerDependencies": {
|
|
77
77
|
"expo-constants": ">=17.0.0",
|
|
78
78
|
"expo-linking": ">=7.0.0",
|
|
79
79
|
"expo-network": ">=8.0.7",
|
|
80
80
|
"expo-web-browser": ">=14.0.0",
|
|
81
|
-
"@better-auth/core": "^1.6.
|
|
82
|
-
"better-auth": "^1.6.
|
|
81
|
+
"@better-auth/core": "^1.6.24",
|
|
82
|
+
"better-auth": "^1.6.24"
|
|
83
83
|
},
|
|
84
84
|
"peerDependenciesMeta": {
|
|
85
85
|
"expo-constants": {
|