@better-auth/expo 1.7.0-beta.1 → 1.7.0-beta.2

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.js CHANGED
@@ -1,4 +1,4 @@
1
- import { t as PACKAGE_VERSION } from "./version-CxmVFmt9.js";
1
+ import { t as PACKAGE_VERSION } from "./version-C8sKtO-X.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";
@@ -221,6 +221,18 @@ const expoClient = (opts) => {
221
221
  version: PACKAGE_VERSION,
222
222
  getActions(_, $store) {
223
223
  store = $store;
224
+ const sessionAtom = $store.atoms.session;
225
+ if (!isWeb && !opts?.disableCache && sessionAtom) {
226
+ const raw = storage.getItem(localCacheName);
227
+ const cached = raw ? safeJSONParse(raw) : null;
228
+ const exp = cached?.session?.expiresAt;
229
+ const expMs = exp ? new Date(exp).getTime() : NaN;
230
+ if (!!cached?.user?.id && !!cached.session?.id && expMs > Date.now()) sessionAtom.set({
231
+ ...sessionAtom.get(),
232
+ data: cached,
233
+ error: null
234
+ });
235
+ }
224
236
  return { getCookie: () => {
225
237
  return getCookie(storage.getItem(cookieName) || "{}");
226
238
  } };
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { t as PACKAGE_VERSION } from "./version-CxmVFmt9.js";
1
+ import { t as PACKAGE_VERSION } from "./version-C8sKtO-X.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,4 +1,4 @@
1
- import { t as PACKAGE_VERSION } from "../version-CxmVFmt9.js";
1
+ import { t as PACKAGE_VERSION } from "../version-C8sKtO-X.js";
2
2
  //#region src/plugins/last-login-method.ts
3
3
  const paths = [
4
4
  "/callback/",
@@ -1,5 +1,5 @@
1
1
  //#endregion
2
2
  //#region src/version.ts
3
- const PACKAGE_VERSION = "1.7.0-beta.1";
3
+ const PACKAGE_VERSION = "1.7.0-beta.2";
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.7.0-beta.1",
3
+ "version": "1.7.0-beta.2",
4
4
  "description": "Better Auth integration for Expo and React Native applications.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -70,16 +70,16 @@
70
70
  "expo-web-browser": "~55.0.9",
71
71
  "react-native": "~0.84.1",
72
72
  "tsdown": "0.21.1",
73
- "@better-auth/core": "1.7.0-beta.1",
74
- "better-auth": "1.7.0-beta.1"
73
+ "@better-auth/core": "1.7.0-beta.2",
74
+ "better-auth": "1.7.0-beta.2"
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.7.0-beta.1",
82
- "better-auth": "^1.7.0-beta.1"
81
+ "@better-auth/core": "^1.7.0-beta.2",
82
+ "better-auth": "^1.7.0-beta.2"
83
83
  },
84
84
  "peerDependenciesMeta": {
85
85
  "expo-constants": {