@lunora/react-native 1.0.0-alpha.7 → 1.0.0-alpha.9
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/auth.mjs +1 -2
- package/dist/index.mjs +1 -2
- package/dist/packem_shared/createLunoraClient-5PwdvVvS.mjs +1 -0
- package/dist/packem_shared/expoBearerToken-CSfRb511.mjs +1 -0
- package/package.json +3 -3
- package/dist/packem_shared/createLunoraClient-D9i-IKbc.mjs +0 -36
- package/dist/packem_shared/expoBearerToken-B0Zorz--.mjs +0 -7
package/dist/auth.mjs
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export { expoClient, setupExpoFocusManager, setupExpoOnlineManager } from '@better-auth/expo/client';
|
|
1
|
+
import{default as p}from"./packem_shared/expoBearerToken-CSfRb511.mjs";import{expoClient as a,setupExpoFocusManager as n,setupExpoOnlineManager as t}from"@better-auth/expo/client";export{p as expoBearerToken,a as expoClient,n as setupExpoFocusManager,t as setupExpoOnlineManager};
|
package/dist/index.mjs
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export * from '@lunora/react';
|
|
1
|
+
import{createLunoraClient as o}from"./packem_shared/createLunoraClient-5PwdvVvS.mjs";export*from"@lunora/react";export{o as createLunoraClient};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{LunoraClient as i,createAsyncStoragePersistence as h}from"@lunora/client";const d=(s,t)=>(o,e)=>{const r=t();if(!r)return s(o,e);const c=new Headers(r);return e?.headers&&new Headers(e.headers).forEach((n,a)=>{c.set(a,n)}),s(o,{...e,headers:c})},f=(s,t)=>class extends s{constructor(o,e){const r=t();super(o,e,r?{headers:r}:void 0)}},b=s=>{const{getAuthHeaders:t,storage:o,...e}=s,r=t&&e.fetch===void 0&&typeof fetch=="function"?d(fetch.bind(globalThis),t):e.fetch,c=t&&e.WebSocket===void 0&&typeof WebSocket=="function"?f(WebSocket,t):e.WebSocket;return new i({...e,persistence:e.persistence??(o?h({storage:o}):void 0),fetch:r,WebSocket:c})};export{b as createLunoraClient,d as withAuthHeaders,f as withAuthWebSocket};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const o=/(?:^|;)[^;=]*session_token=([^;]+)/,t=e=>o.exec(e.getCookie())?.[1]??null;export{t as default};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lunora/react-native",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.9",
|
|
4
4
|
"description": "React Native / Expo integration for Lunora: an AsyncStorage-backed client factory, the useQuery/useMutation/useSubscription hooks, and a one-call better-auth Expo client",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cloudflare",
|
|
@@ -50,8 +50,8 @@
|
|
|
50
50
|
"access": "public"
|
|
51
51
|
},
|
|
52
52
|
"dependencies": {
|
|
53
|
-
"@lunora/client": "1.0.0-alpha.
|
|
54
|
-
"@lunora/react": "1.0.0-alpha.
|
|
53
|
+
"@lunora/client": "1.0.0-alpha.29",
|
|
54
|
+
"@lunora/react": "1.0.0-alpha.33"
|
|
55
55
|
},
|
|
56
56
|
"peerDependencies": {
|
|
57
57
|
"@better-auth/expo": "^1.6.23",
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { LunoraClient, createAsyncStoragePersistence } from '@lunora/client';
|
|
2
|
-
|
|
3
|
-
const withAuthHeaders = (fetchImpl, getAuthHeaders) => (input, init) => {
|
|
4
|
-
const extra = getAuthHeaders();
|
|
5
|
-
if (!extra) {
|
|
6
|
-
return fetchImpl(input, init);
|
|
7
|
-
}
|
|
8
|
-
const merged = new Headers(extra);
|
|
9
|
-
if (init?.headers) {
|
|
10
|
-
new Headers(init.headers).forEach((value, key) => {
|
|
11
|
-
merged.set(key, value);
|
|
12
|
-
});
|
|
13
|
-
}
|
|
14
|
-
return fetchImpl(input, { ...init, headers: merged });
|
|
15
|
-
};
|
|
16
|
-
const withAuthWebSocket = (WebSocketImpl, getAuthHeaders) => class AuthWebSocket extends WebSocketImpl {
|
|
17
|
-
constructor(url, protocols) {
|
|
18
|
-
const headers = getAuthHeaders();
|
|
19
|
-
super(url, protocols, headers ? { headers } : void 0);
|
|
20
|
-
}
|
|
21
|
-
};
|
|
22
|
-
const createLunoraClient = (options) => {
|
|
23
|
-
const { getAuthHeaders, storage, ...rest } = options;
|
|
24
|
-
const authedFetch = getAuthHeaders && rest.fetch === void 0 && typeof fetch === "function" ? withAuthHeaders(fetch.bind(globalThis), getAuthHeaders) : rest.fetch;
|
|
25
|
-
const authedWebSocket = getAuthHeaders && rest.WebSocket === void 0 && typeof WebSocket === "function" ? withAuthWebSocket(WebSocket, getAuthHeaders) : rest.WebSocket;
|
|
26
|
-
return new LunoraClient({
|
|
27
|
-
...rest,
|
|
28
|
-
// Auto-wire AsyncStorage persistence unless the caller passed an explicit
|
|
29
|
-
// `persistence` (including `false` to opt out).
|
|
30
|
-
persistence: rest.persistence ?? (storage ? createAsyncStoragePersistence({ storage }) : void 0),
|
|
31
|
-
fetch: authedFetch,
|
|
32
|
-
WebSocket: authedWebSocket
|
|
33
|
-
});
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
export { createLunoraClient, withAuthHeaders, withAuthWebSocket };
|