@better-auth/expo 1.1.14 → 1.1.15-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/.turbo/turbo-build.log +9 -9
- package/dist/index.d.mts +29 -3
- package/dist/index.d.ts +29 -3
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +3 -3
- package/src/index.ts +13 -5
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
> @better-auth/expo@1.1.
|
|
2
|
+
> @better-auth/expo@1.1.15-beta.2 build /home/runner/work/better-auth/better-auth/packages/expo
|
|
3
3
|
> tsup --dts --minify --clean
|
|
4
4
|
|
|
5
5
|
[34mCLI[39m Building entry: {"index":"src/index.ts","client":"src/client.ts"}
|
|
@@ -10,15 +10,15 @@
|
|
|
10
10
|
[34mCLI[39m Cleaning output folder
|
|
11
11
|
[34mESM[39m Build start
|
|
12
12
|
[34mCJS[39m Build start
|
|
13
|
-
[32mCJS[39m [1mdist/index.js [22m[32m1.17 KB[39m
|
|
14
|
-
[32mCJS[39m [1mdist/client.js [22m[32m3.26 KB[39m
|
|
15
|
-
[32mCJS[39m ⚡️ Build success in 22ms
|
|
16
|
-
[32mESM[39m [1mdist/index.mjs [22m[32m720.00 B[39m
|
|
17
13
|
[32mESM[39m [1mdist/client.mjs [22m[32m2.63 KB[39m
|
|
18
|
-
[32mESM[39m
|
|
14
|
+
[32mESM[39m [1mdist/index.mjs [22m[32m763.00 B[39m
|
|
15
|
+
[32mESM[39m ⚡️ Build success in 21ms
|
|
16
|
+
[32mCJS[39m [1mdist/client.js [22m[32m3.26 KB[39m
|
|
17
|
+
[32mCJS[39m [1mdist/index.js [22m[32m1.21 KB[39m
|
|
18
|
+
[32mCJS[39m ⚡️ Build success in 20ms
|
|
19
19
|
[34mDTS[39m Build start
|
|
20
|
-
[32mDTS[39m ⚡️ Build success in
|
|
21
|
-
[32mDTS[39m [1mdist/index.d.mts [22m[
|
|
20
|
+
[32mDTS[39m ⚡️ Build success in 4744ms
|
|
21
|
+
[32mDTS[39m [1mdist/index.d.mts [22m[32m917.00 B[39m
|
|
22
22
|
[32mDTS[39m [1mdist/client.d.mts [22m[32m4.45 KB[39m
|
|
23
|
-
[32mDTS[39m [1mdist/index.d.ts [22m[
|
|
23
|
+
[32mDTS[39m [1mdist/index.d.ts [22m[32m917.00 B[39m
|
|
24
24
|
[32mDTS[39m [1mdist/client.d.ts [22m[32m4.45 KB[39m
|
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,31 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as better_call from 'better-call';
|
|
2
|
+
import * as better_auth from 'better-auth';
|
|
2
3
|
|
|
3
|
-
|
|
4
|
+
interface ExpoOptions {
|
|
5
|
+
/**
|
|
6
|
+
* Override origin header for expo api routes
|
|
7
|
+
*/
|
|
8
|
+
overrideOrigin?: boolean;
|
|
9
|
+
}
|
|
10
|
+
declare const expo: (options?: ExpoOptions) => {
|
|
11
|
+
id: "expo";
|
|
12
|
+
init: (ctx: better_auth.AuthContext) => {
|
|
13
|
+
options: {
|
|
14
|
+
trustedOrigins: string[] | undefined;
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
onRequest(request: Request, ctx: better_auth.AuthContext): Promise<{
|
|
18
|
+
request: Request;
|
|
19
|
+
} | undefined>;
|
|
20
|
+
hooks: {
|
|
21
|
+
after: {
|
|
22
|
+
matcher(context: better_auth.HookEndpointContext<{
|
|
23
|
+
returned: better_call.APIError | Response | Record<string, any>;
|
|
24
|
+
endpoint: better_call.Endpoint;
|
|
25
|
+
}>): boolean;
|
|
26
|
+
handler: (ctx: better_auth.HookEndpointContext<{}>) => Promise<void>;
|
|
27
|
+
}[];
|
|
28
|
+
};
|
|
29
|
+
};
|
|
4
30
|
|
|
5
|
-
export { expo };
|
|
31
|
+
export { type ExpoOptions, expo };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,31 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as better_call from 'better-call';
|
|
2
|
+
import * as better_auth from 'better-auth';
|
|
2
3
|
|
|
3
|
-
|
|
4
|
+
interface ExpoOptions {
|
|
5
|
+
/**
|
|
6
|
+
* Override origin header for expo api routes
|
|
7
|
+
*/
|
|
8
|
+
overrideOrigin?: boolean;
|
|
9
|
+
}
|
|
10
|
+
declare const expo: (options?: ExpoOptions) => {
|
|
11
|
+
id: "expo";
|
|
12
|
+
init: (ctx: better_auth.AuthContext) => {
|
|
13
|
+
options: {
|
|
14
|
+
trustedOrigins: string[] | undefined;
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
onRequest(request: Request, ctx: better_auth.AuthContext): Promise<{
|
|
18
|
+
request: Request;
|
|
19
|
+
} | undefined>;
|
|
20
|
+
hooks: {
|
|
21
|
+
after: {
|
|
22
|
+
matcher(context: better_auth.HookEndpointContext<{
|
|
23
|
+
returned: better_call.APIError | Response | Record<string, any>;
|
|
24
|
+
endpoint: better_call.Endpoint;
|
|
25
|
+
}>): boolean;
|
|
26
|
+
handler: (ctx: better_auth.HookEndpointContext<{}>) => Promise<void>;
|
|
27
|
+
}[];
|
|
28
|
+
};
|
|
29
|
+
};
|
|
4
30
|
|
|
5
|
-
export { expo };
|
|
31
|
+
export { type ExpoOptions, expo };
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var o=Object.defineProperty;var
|
|
1
|
+
"use strict";var o=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var g=Object.getOwnPropertyNames;var p=Object.prototype.hasOwnProperty;var d=(e,t)=>{for(var r in t)o(e,r,{get:t[r],enumerable:!0})},h=(e,t,r,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of g(t))!p.call(e,s)&&s!==r&&o(e,s,{get:()=>t[s],enumerable:!(i=u(t,s))||i.enumerable});return e};var l=e=>h(o({},"__esModule",{value:!0}),e);var f={};d(f,{expo:()=>O});module.exports=l(f);var O=e=>({id:"expo",init:t=>({options:{trustedOrigins:process.env.NODE_ENV==="development"?[...t.options.trustedOrigins||[],"exp://"]:t.options.trustedOrigins}}),async onRequest(t,r){if(!e?.overrideOrigin||t.headers.get("origin"))return;let i=t.headers.get("expo-origin");if(!i)return;let s=t.clone();return s.headers.set("origin",i),{request:s}},hooks:{after:[{matcher(t){return t.path?.startsWith("/callback")||t.path?.startsWith("/oauth2/callback")},handler:async t=>{let r=t.responseHeader,i=r.get("location");if(!i||!t.context.trustedOrigins.filter(n=>!n.startsWith("http")).some(n=>i?.startsWith(n)))return;let a=r.get("set-cookie");if(!a)return;let c=new URL(i);c.searchParams.set("cookie",a),t.setHeader("location",c.toString())}}]}});0&&(module.exports={expo});
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var u=
|
|
1
|
+
var u=a=>({id:"expo",init:t=>({options:{trustedOrigins:process.env.NODE_ENV==="development"?[...t.options.trustedOrigins||[],"exp://"]:t.options.trustedOrigins}}),async onRequest(t,r){if(!a?.overrideOrigin||t.headers.get("origin"))return;let e=t.headers.get("expo-origin");if(!e)return;let i=t.clone();return i.headers.set("origin",e),{request:i}},hooks:{after:[{matcher(t){return t.path?.startsWith("/callback")||t.path?.startsWith("/oauth2/callback")},handler:async t=>{let r=t.responseHeader,e=r.get("location");if(!e||!t.context.trustedOrigins.filter(s=>!s.startsWith("http")).some(s=>e?.startsWith(s)))return;let n=r.get("set-cookie");if(!n)return;let o=new URL(e);o.searchParams.set("cookie",n),t.setHeader("location",o.toString())}}]}});export{u as expo};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@better-auth/expo",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.15-beta.2",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -38,10 +38,10 @@
|
|
|
38
38
|
"expo-secure-store": "~13.0.2",
|
|
39
39
|
"expo-web-browser": "~13.0.3",
|
|
40
40
|
"vitest": "^1.6.0",
|
|
41
|
-
"better-auth": "1.1.
|
|
41
|
+
"better-auth": "1.1.15-beta.2"
|
|
42
42
|
},
|
|
43
43
|
"peerDependencies": {
|
|
44
|
-
"better-auth": "1.1.
|
|
44
|
+
"better-auth": "1.1.15-beta.2"
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
47
|
"better-call": "^0.3.3",
|
package/src/index.ts
CHANGED
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
import type { BetterAuthPlugin } from "better-auth";
|
|
2
2
|
|
|
3
|
-
export
|
|
3
|
+
export interface ExpoOptions {
|
|
4
|
+
/**
|
|
5
|
+
* Override origin header for expo api routes
|
|
6
|
+
*/
|
|
7
|
+
overrideOrigin?: boolean;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export const expo = (options?: ExpoOptions) => {
|
|
4
11
|
return {
|
|
5
12
|
id: "expo",
|
|
6
13
|
init: (ctx) => {
|
|
@@ -15,7 +22,7 @@ export const expo: () => BetterAuthPlugin = () => {
|
|
|
15
22
|
};
|
|
16
23
|
},
|
|
17
24
|
async onRequest(request, ctx) {
|
|
18
|
-
if (request.headers.get("origin")) {
|
|
25
|
+
if (!options?.overrideOrigin || request.headers.get("origin")) {
|
|
19
26
|
return;
|
|
20
27
|
}
|
|
21
28
|
/**
|
|
@@ -25,9 +32,10 @@ export const expo: () => BetterAuthPlugin = () => {
|
|
|
25
32
|
if (!expoOrigin) {
|
|
26
33
|
return;
|
|
27
34
|
}
|
|
28
|
-
request.
|
|
35
|
+
const req = request.clone();
|
|
36
|
+
req.headers.set("origin", expoOrigin);
|
|
29
37
|
return {
|
|
30
|
-
request,
|
|
38
|
+
request: req,
|
|
31
39
|
};
|
|
32
40
|
},
|
|
33
41
|
hooks: {
|
|
@@ -66,5 +74,5 @@ export const expo: () => BetterAuthPlugin = () => {
|
|
|
66
74
|
},
|
|
67
75
|
],
|
|
68
76
|
},
|
|
69
|
-
};
|
|
77
|
+
} satisfies BetterAuthPlugin;
|
|
70
78
|
};
|