@better-auth/expo 1.6.23 → 1.6.25

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 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?: expo_web_browser0.AuthSessionOpenOptions;
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(_: _better_fetch_fetch0.BetterFetch, $store: ClientStore): {
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: _better_fetch_fetch0.SuccessContext<any>): Promise<void>;
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: _better_fetch_fetch0.RequestContext<T>) => Promise<_better_fetch_fetch0.RequestContext | void> | _better_fetch_fetch0.RequestContext | void) | undefined;
146
- onResponse?: ((context: _better_fetch_fetch0.ResponseContext) => Promise<Response | void | _better_fetch_fetch0.ResponseContext> | Response | _better_fetch_fetch0.ResponseContext | void) | undefined;
147
- onSuccess?: ((context: _better_fetch_fetch0.SuccessContext<any>) => Promise<void> | void) | undefined;
148
- onError?: ((context: _better_fetch_fetch0.ErrorContext) => Promise<void> | void) | undefined;
149
- onRetry?: ((response: _better_fetch_fetch0.ResponseContext) => Promise<void> | void) | undefined;
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?: _better_fetch_fetch0.FetchEsque | undefined;
155
- plugins?: _better_fetch_fetch0.BetterFetchPlugin[] | undefined;
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?: _better_fetch_fetch0.RetryOptions | undefined;
178
+ retry?: import("@better-fetch/fetch").RetryOptions | undefined;
182
179
  retryAttempt?: number | undefined;
183
- output?: (_better_fetch_fetch0.StandardSchemaV1 | typeof Blob | typeof File) | undefined;
184
- errorSchema?: _better_fetch_fetch0.StandardSchemaV1 | undefined;
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-D8wEp7a2.js";
1
+ import { t as PACKAGE_VERSION } from "./version-Bbx2FRPo.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 { getCookie: () => {
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: better_auth0.AuthContext) => {
19
+ init: (ctx: import("better-auth").AuthContext) => {
25
20
  options: {
26
21
  trustedOrigins: string[];
27
22
  };
28
23
  };
29
- onRequest(request: Request, ctx: better_auth0.AuthContext): Promise<{
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: better_auth0.HookEndpointContext): boolean;
35
- handler: (inputContext: better_call0.MiddlewareInputContext<better_call0.MiddlewareOptions>) => Promise<void>;
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: better_call0.StrictEndpoint<"/expo-authorization-proxy", {
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
- }, zod_v4_core0.$strip>;
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") | better_call0.Status;
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-D8wEp7a2.js";
1
+ import { t as PACKAGE_VERSION } from "./version-Bbx2FRPo.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";
@@ -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: _better_fetch_fetch0.ResponseContext) => Promise<void>;
26
+ onResponse: (ctx: import("@better-fetch/fetch").ResponseContext) => Promise<void>;
29
27
  };
30
28
  }[];
31
29
  getActions(): {
@@ -1,4 +1,4 @@
1
- import { t as PACKAGE_VERSION } from "../version-D8wEp7a2.js";
1
+ import { t as PACKAGE_VERSION } from "../version-Bbx2FRPo.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
  }
@@ -1,5 +1,5 @@
1
1
  //#endregion
2
2
  //#region src/version.ts
3
- const PACKAGE_VERSION = "1.6.23";
3
+ const PACKAGE_VERSION = "1.6.25";
4
4
  //#endregion
5
5
  export { PACKAGE_VERSION as t };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@better-auth/expo",
3
- "version": "1.6.23",
3
+ "version": "1.6.25",
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.21.1",
73
- "@better-auth/core": "1.6.23",
74
- "better-auth": "1.6.23"
72
+ "tsdown": "0.22.7",
73
+ "@better-auth/core": "1.6.25",
74
+ "better-auth": "1.6.25"
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.23",
82
- "better-auth": "^1.6.23"
81
+ "@better-auth/core": "^1.6.25",
82
+ "better-auth": "^1.6.25"
83
83
  },
84
84
  "peerDependenciesMeta": {
85
85
  "expo-constants": {