better-auth 0.2.0 → 0.2.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/adapter-D-m9-hQp.d.ts +54 -0
- package/dist/adapters.d.ts +38 -0
- package/dist/adapters.js +1 -0
- package/dist/api.d.ts +4 -2
- package/dist/client/plugins.d.ts +7 -5
- package/dist/client.d.ts +5 -3
- package/dist/{index-8DiMp2ua.d.ts → index-D_ohe9r9.d.ts} +36 -77
- package/dist/{index-C2WEEylB.d.ts → index-DsEvbKjm.d.ts} +2 -2
- package/dist/index.d.ts +6 -4
- package/dist/next-js.d.ts +4 -2
- package/dist/node.d.ts +6 -4
- package/dist/plugins.d.ts +8 -6
- package/dist/react.d.ts +5 -3
- package/dist/schema-D9o3OF80.d.ts +88 -0
- package/dist/social.d.ts +742 -3
- package/dist/solid-start.d.ts +6 -4
- package/dist/solid.d.ts +5 -3
- package/dist/svelte-kit.d.ts +6 -4
- package/dist/svelte.d.ts +5 -3
- package/dist/types.d.ts +5 -3
- package/dist/utils.d.ts +7 -5
- package/dist/vue.d.ts +5 -3
- package/package.json +5 -4
- package/dist/index-CE92ti2Z.d.ts +0 -827
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { S as Session } from './schema-D9o3OF80.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Adapter where clause
|
|
5
|
+
*/
|
|
6
|
+
type Where = {
|
|
7
|
+
operator?: "eq" | "ne" | "lt" | "lte" | "gt" | "gte";
|
|
8
|
+
value: string;
|
|
9
|
+
field: string;
|
|
10
|
+
connector?: "AND" | "OR";
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Adapter Interface
|
|
14
|
+
*/
|
|
15
|
+
interface Adapter {
|
|
16
|
+
create: <T, R = T>(data: {
|
|
17
|
+
model: string;
|
|
18
|
+
data: T;
|
|
19
|
+
select?: string[];
|
|
20
|
+
}) => Promise<R>;
|
|
21
|
+
findOne: <T>(data: {
|
|
22
|
+
model: string;
|
|
23
|
+
where: Where[];
|
|
24
|
+
select?: string[];
|
|
25
|
+
}) => Promise<T | null>;
|
|
26
|
+
findMany: <T>(data: {
|
|
27
|
+
model: string;
|
|
28
|
+
where?: Where[];
|
|
29
|
+
}) => Promise<T[]>;
|
|
30
|
+
update: <T>(data: {
|
|
31
|
+
model: string;
|
|
32
|
+
where: Where[];
|
|
33
|
+
update: Record<string, any>;
|
|
34
|
+
}) => Promise<T | null>;
|
|
35
|
+
delete: <T>(data: {
|
|
36
|
+
model: string;
|
|
37
|
+
where: Where[];
|
|
38
|
+
}) => Promise<void>;
|
|
39
|
+
}
|
|
40
|
+
interface SessionAdapter {
|
|
41
|
+
create: (data: {
|
|
42
|
+
userId: string;
|
|
43
|
+
expiresAt: Date;
|
|
44
|
+
}) => Promise<Session>;
|
|
45
|
+
findOne: (data: {
|
|
46
|
+
userId: string;
|
|
47
|
+
}) => Promise<Session | null>;
|
|
48
|
+
update: (data: Session) => Promise<Session>;
|
|
49
|
+
delete: (data: {
|
|
50
|
+
sessionId: string;
|
|
51
|
+
}) => Promise<void>;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export type { Adapter as A, SessionAdapter as S, Where as W };
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { A as Adapter, W as Where } from './adapter-D-m9-hQp.js';
|
|
2
|
+
import './schema-D9o3OF80.js';
|
|
3
|
+
import 'zod';
|
|
4
|
+
|
|
5
|
+
declare const prismaAdapter: (prisma: any) => Adapter;
|
|
6
|
+
|
|
7
|
+
interface DrizzleAdapterOptions {
|
|
8
|
+
schema: Record<string, any>;
|
|
9
|
+
}
|
|
10
|
+
declare const drizzleAdapter: (db: Record<string, any>, { schema }: DrizzleAdapterOptions) => Adapter;
|
|
11
|
+
|
|
12
|
+
declare const mongodbAdapter: (mongo: any) => {
|
|
13
|
+
create<T, R = T>(data: {
|
|
14
|
+
model: string;
|
|
15
|
+
data: T;
|
|
16
|
+
select?: string[];
|
|
17
|
+
}): Promise<any>;
|
|
18
|
+
findOne<T>(data: {
|
|
19
|
+
model: string;
|
|
20
|
+
where: Where[];
|
|
21
|
+
select?: string[];
|
|
22
|
+
}): Promise<any>;
|
|
23
|
+
findMany<T>(data: {
|
|
24
|
+
model: string;
|
|
25
|
+
where?: Where[];
|
|
26
|
+
}): Promise<any>;
|
|
27
|
+
update<T>(data: {
|
|
28
|
+
model: string;
|
|
29
|
+
where: Where[];
|
|
30
|
+
update: Record<string, any>;
|
|
31
|
+
}): Promise<any>;
|
|
32
|
+
delete<T>(data: {
|
|
33
|
+
model: string;
|
|
34
|
+
where: Where[];
|
|
35
|
+
}): Promise<any>;
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export { type DrizzleAdapterOptions, drizzleAdapter, mongodbAdapter, prismaAdapter };
|
package/dist/adapters.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var D=Object.defineProperty,R=Object.defineProperties;var x=Object.getOwnPropertyDescriptors;var m=Object.getOwnPropertySymbols;var O=Object.prototype.hasOwnProperty,M=Object.prototype.propertyIsEnumerable;var C=(r,o,c)=>o in r?D(r,o,{enumerable:!0,configurable:!0,writable:!0,value:c}):r[o]=c,u=(r,o)=>{for(var c in o||(o={}))O.call(o,c)&&C(r,c,o[c]);if(m)for(var c of m(o))M.call(o,c)&&C(r,c,o[c]);return r},f=(r,o)=>R(r,x(o));var P=(r,o)=>{var c={};for(var t in r)O.call(r,t)&&o.indexOf(t)<0&&(c[t]=r[t]);if(r!=null&&m)for(var t of m(r))o.indexOf(t)<0&&M.call(r,t)&&(c[t]=r[t]);return c};var l=(r,o,c)=>new Promise((t,s)=>{var n=i=>{try{a(c.next(i))}catch(d){s(d)}},e=i=>{try{a(c.throw(i))}catch(d){s(d)}},a=i=>i.done?t(i.value):Promise.resolve(i.value).then(n,e);a((c=c.apply(r,o)).next())});function h(r){if(!r)return{};if(r.length===1){let n=r[0];return n?{[n.field]:n.value}:void 0}let o=r.filter(n=>n.connector==="AND"||!n.connector),c=r.filter(n=>n.connector==="OR"),t=o.map(n=>({[n.field]:n.operator==="eq"||!n.operator?n.value:{[n.operator]:n.value}})),s=c.map(n=>({[n.field]:{[n.operator||"eq"]:n.value}}));return{AND:t.length?t:void 0,OR:s.length?s:void 0}}var q=r=>{let o=r;return{create(t){return l(this,null,function*(){let{model:s,data:n,select:e}=t;return yield o[s].create(u({data:n},e!=null&&e.length?{select:e.reduce((a,i)=>f(u({},a),{[i]:!0}),{})}:{}))})},findOne(t){return l(this,null,function*(){let{model:s,where:n,select:e}=t,a=h(n);return yield o[s].findFirst(u({where:a},e!=null&&e.length?{select:e.reduce((i,d)=>f(u({},i),{[d]:!0}),{})}:{}))})},findMany(t){return l(this,null,function*(){let{model:s,where:n}=t,e=h(n);return yield o[s].findMany({where:e})})},update(t){return l(this,null,function*(){let{model:s,where:n,update:e}=t,a=h(n);return yield o[s].update({where:a,data:e})})},delete(t){return l(this,null,function*(){let{model:s,where:n}=t,e=h(n);return yield o[s].delete({where:e})})}}};import{and as z,eq as v,or as N}from"drizzle-orm";function p(r,o){let c=Object.keys(o).find(t=>{let s=o[t].name;return s===s});if(!c)throw new Error("Model not found");return o[c]}function w(r,o){if(!r)return[];if(r.length===1){let a=r[0];return a?[v(o[a.field],a.value)]:[]}let c=r.filter(a=>a.connector==="AND"||!a.connector),t=r.filter(a=>a.connector==="OR"),s=z(...c.map(a=>v(o[a.field],a.value))),n=N(...t.map(a=>v(o[a.field],a.value))),e=[];return c.length&&e.push(s),t.length&&e.push(n),e}var G=(r,{schema:o})=>({create(t){return l(this,null,function*(){let{model:s,data:n}=t,e=p(s,o);return(yield r.insert(e).values(n).returning())[0]})},findOne(t){return l(this,null,function*(){let{model:s,where:n,select:e}=t,a=p(s,o),i=w(n,a),d=null;return e!=null&&e.length?d=yield r.select(...e.map(y=>({[y]:a[y]}))).from(a).where(...i):d=yield r.select().from(a).where(...i),d.length?d[0]:null})},findMany(t){return l(this,null,function*(){let{model:s,where:n}=t,e=p(s,o),a=n?w(n,e):[];return yield r.select().from(e).findMany(...a)})},update(t){return l(this,null,function*(){let{model:s,where:n,update:e}=t,a=p(s,o),i=w(n,a);return(yield r.update(a).set(e).where(...i).returning())[0]})},delete(t){return l(this,null,function*(){let{model:s,where:n}=t,e=p(s,o),a=w(n,e);return(yield r.delete(e).where(...a))[0]})}});function g(r){if(!r)return{};if(r.length===1){let e=r[0];return e?{[e.field]:e.value}:void 0}let o=r.filter(e=>e.connector==="AND"||!e.connector),c=r.filter(e=>e.connector==="OR"),t=o.map(e=>({[e.field]:e.operator==="eq"||!e.operator?e.value:{[e.field]:e.value}})),s=c.map(e=>({[e.field]:e.value})),n={};return t.length&&(n=f(u({},n),{$and:t})),s.length&&(n=f(u({},n),{$or:s})),n}function A(r){let t=r,{_id:o}=t;return P(t,["_id"])}function W(r){return r.reduce((c,t)=>(c[t]=1,c),{})}var Q=r=>{let o=r;return{create(t){return l(this,null,function*(){let{model:s,data:n}=t,a=(yield o.collection(s).insertOne(u({},n))).insertedId,i=u({id:a},n);return A(i)})},findOne(t){return l(this,null,function*(){let{model:s,where:n,select:e}=t,a=g(n),i={};e&&(i=W(e));let y=(yield o.collection(s).find(u({},a),{projection:i}).toArray())[0];return y?A(y):null})},findMany(t){return l(this,null,function*(){let{model:s,where:n}=t,e=g(n),a=yield o.collection(s).findMany(e);return A(a)})},update(t){return l(this,null,function*(){let{model:s,where:n,update:e}=t,a=g(n),i=yield o.collection(s).findOneAndUpdate(a,{$set:e},{returnDocument:"after"});return A(i)})},delete(t){return l(this,null,function*(){let{model:s,where:n}=t,e=g(n);return yield o.collection(s).findOneAndDelete(e)})}}};export{G as drizzleAdapter,Q as mongodbAdapter,q as prismaAdapter};
|
package/dist/api.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
export { A as AuthEndpoint, b as AuthMiddleware,
|
|
1
|
+
export { A as AuthEndpoint, b as AuthMiddleware, x as callbackOAuth, U as changePassword, a as createAuthEndpoint, c as createAuthMiddleware, O as createEmailVerificationToken, _ as csrfMiddleware, X as error, L as forgetPassword, M as forgetPasswordCallback, W as getCSRFToken, t as getEndpoints, y as getSession, z as getSessionFromCtx, D as listSessions, Y as ok, o as optionsMiddleware, N as resetPassword, E as revokeSession, J as revokeSessions, u as router, Q as sendVerificationEmail, C as sessionMiddleware, V as setPassword, w as signInEmail, v as signInOAuth, K as signOut, Z as signUpEmail, T as updateUser, S as verifyEmail } from './index-D_ohe9r9.js';
|
|
2
2
|
import 'zod';
|
|
3
3
|
import './helper-C1ihmerM.js';
|
|
4
4
|
import 'better-call';
|
|
5
5
|
import 'kysely';
|
|
6
|
-
import './
|
|
6
|
+
import './schema-D9o3OF80.js';
|
|
7
|
+
import './social.js';
|
|
7
8
|
import 'arctic';
|
|
9
|
+
import './adapter-D-m9-hQp.js';
|
package/dist/client/plugins.d.ts
CHANGED
|
@@ -2,15 +2,17 @@ import * as nanostores from 'nanostores';
|
|
|
2
2
|
import { A as AccessControl, S as StatementsPrimitive, R as Role } from '../statement-CU-fdHXK.js';
|
|
3
3
|
import * as _better_fetch_fetch from '@better-fetch/fetch';
|
|
4
4
|
import { BetterFetchOption } from '@better-fetch/fetch';
|
|
5
|
-
import { o as organization, d as Organization, M as Member, I as Invitation, u as username, m as magicLink } from '../index-
|
|
6
|
-
export { g as getPasskeyActions, c as passkeyClient, a as twoFactorClient } from '../index-
|
|
5
|
+
import { o as organization, d as Organization, M as Member, I as Invitation, u as username, m as magicLink } from '../index-DsEvbKjm.js';
|
|
6
|
+
export { g as getPasskeyActions, c as passkeyClient, a as twoFactorClient } from '../index-DsEvbKjm.js';
|
|
7
7
|
import { P as Prettify } from '../helper-C1ihmerM.js';
|
|
8
|
-
import '../
|
|
9
|
-
import 'arctic';
|
|
8
|
+
import '../schema-D9o3OF80.js';
|
|
10
9
|
import 'zod';
|
|
11
10
|
import 'better-call';
|
|
12
|
-
import '../index-
|
|
11
|
+
import '../index-D_ohe9r9.js';
|
|
13
12
|
import 'kysely';
|
|
13
|
+
import '../social.js';
|
|
14
|
+
import 'arctic';
|
|
15
|
+
import '../adapter-D-m9-hQp.js';
|
|
14
16
|
import '@simplewebauthn/types';
|
|
15
17
|
|
|
16
18
|
interface OrganizationClientOptions {
|
package/dist/client.d.ts
CHANGED
|
@@ -3,14 +3,16 @@ import * as nanostores from 'nanostores';
|
|
|
3
3
|
import { PreinitializedWritableAtom } from 'nanostores';
|
|
4
4
|
import * as _better_fetch_fetch from '@better-fetch/fetch';
|
|
5
5
|
import { BetterFetch, BetterFetchError, BetterFetchOption } from '@better-fetch/fetch';
|
|
6
|
-
import { B as BetterAuthPlugin, F as FieldAttribute, I as InferFieldOutput } from './index-
|
|
6
|
+
import { B as BetterAuthPlugin, F as FieldAttribute, I as InferFieldOutput } from './index-D_ohe9r9.js';
|
|
7
7
|
import { U as UnionToIntersection, P as Prettify } from './helper-C1ihmerM.js';
|
|
8
8
|
import { ClientOptions, InferClientAPI, InferActions, BetterAuthClientPlugin, InferSessionFromClient, InferUserFromClient, IsSignal } from './types.js';
|
|
9
9
|
export { AtomListener, InferPluginsFromClient } from './types.js';
|
|
10
10
|
import 'kysely';
|
|
11
|
-
import './
|
|
12
|
-
import 'arctic';
|
|
11
|
+
import './schema-D9o3OF80.js';
|
|
13
12
|
import 'better-call';
|
|
13
|
+
import './social.js';
|
|
14
|
+
import 'arctic';
|
|
15
|
+
import './adapter-D-m9-hQp.js';
|
|
14
16
|
|
|
15
17
|
type InferResolvedHooks<O extends ClientOptions> = O["plugins"] extends Array<infer Plugin> ? Plugin extends BetterAuthClientPlugin ? Plugin["getAtoms"] extends (fetch: any) => infer Atoms ? Atoms extends Record<string, any> ? {
|
|
16
18
|
[key in keyof Atoms as IsSignal<key> extends true ? never : key extends string ? `use${Capitalize<key>}` : never]: Atoms[key];
|
|
@@ -1,63 +1,14 @@
|
|
|
1
1
|
import * as kysely from 'kysely';
|
|
2
2
|
import { Kysely, Migration, Dialect } from 'kysely';
|
|
3
|
-
import {
|
|
3
|
+
import { U as User, A as Account, S as Session } from './schema-D9o3OF80.js';
|
|
4
4
|
import * as better_call from 'better-call';
|
|
5
5
|
import { ContextTools, CookieOptions, Endpoint, EndpointResponse, Context, Prettify as Prettify$1 } from 'better-call';
|
|
6
6
|
import * as zod from 'zod';
|
|
7
7
|
import { ZodSchema, z } from 'zod';
|
|
8
8
|
import { L as LiteralString, U as UnionToIntersection, P as Prettify } from './helper-C1ihmerM.js';
|
|
9
|
+
import { OAuthProvider, AppleProfile, DiscordProfile, FacebookProfile, GithubProfile, GoogleProfile, SpotifyProfile, TwitchProfile, TwitterProfile, SocialProviders, OAuthProviderList } from './social.js';
|
|
9
10
|
import * as arctic from 'arctic';
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Adapter where clause
|
|
13
|
-
*/
|
|
14
|
-
type Where = {
|
|
15
|
-
operator?: "eq" | "ne" | "lt" | "lte" | "gt" | "gte";
|
|
16
|
-
value: string;
|
|
17
|
-
field: string;
|
|
18
|
-
connector?: "AND" | "OR";
|
|
19
|
-
};
|
|
20
|
-
/**
|
|
21
|
-
* Adapter Interface
|
|
22
|
-
*/
|
|
23
|
-
interface Adapter {
|
|
24
|
-
create: <T, R = T>(data: {
|
|
25
|
-
model: string;
|
|
26
|
-
data: T;
|
|
27
|
-
select?: string[];
|
|
28
|
-
}) => Promise<R>;
|
|
29
|
-
findOne: <T>(data: {
|
|
30
|
-
model: string;
|
|
31
|
-
where: Where[];
|
|
32
|
-
select?: string[];
|
|
33
|
-
}) => Promise<T | null>;
|
|
34
|
-
findMany: <T>(data: {
|
|
35
|
-
model: string;
|
|
36
|
-
where?: Where[];
|
|
37
|
-
}) => Promise<T[]>;
|
|
38
|
-
update: <T>(data: {
|
|
39
|
-
model: string;
|
|
40
|
-
where: Where[];
|
|
41
|
-
update: Record<string, any>;
|
|
42
|
-
}) => Promise<T | null>;
|
|
43
|
-
delete: <T>(data: {
|
|
44
|
-
model: string;
|
|
45
|
-
where: Where[];
|
|
46
|
-
}) => Promise<void>;
|
|
47
|
-
}
|
|
48
|
-
interface SessionAdapter {
|
|
49
|
-
create: (data: {
|
|
50
|
-
userId: string;
|
|
51
|
-
expiresAt: Date;
|
|
52
|
-
}) => Promise<Session>;
|
|
53
|
-
findOne: (data: {
|
|
54
|
-
userId: string;
|
|
55
|
-
}) => Promise<Session | null>;
|
|
56
|
-
update: (data: Session) => Promise<Session>;
|
|
57
|
-
delete: (data: {
|
|
58
|
-
sessionId: string;
|
|
59
|
-
}) => Promise<void>;
|
|
60
|
-
}
|
|
11
|
+
import { A as Adapter } from './adapter-D-m9-hQp.js';
|
|
61
12
|
|
|
62
13
|
declare const createInternalAdapter: (adapter: Adapter, options: BetterAuthOptions) => {
|
|
63
14
|
createOAuthUser: (user: User, account: Account) => Promise<{
|
|
@@ -738,6 +689,7 @@ declare const init: (opts: BetterAuthOptions) => {
|
|
|
738
689
|
crossSubDomainCookies?: {
|
|
739
690
|
enabled: boolean;
|
|
740
691
|
eligibleCookies?: string[];
|
|
692
|
+
domain?: string;
|
|
741
693
|
};
|
|
742
694
|
};
|
|
743
695
|
logger?: {
|
|
@@ -1281,6 +1233,13 @@ interface BetterAuthOptions {
|
|
|
1281
1233
|
* cookies will be shared across subdomains
|
|
1282
1234
|
*/
|
|
1283
1235
|
eligibleCookies?: string[];
|
|
1236
|
+
/**
|
|
1237
|
+
* The domain to use for the cookies
|
|
1238
|
+
*
|
|
1239
|
+
* By default, the domain will be the root
|
|
1240
|
+
* domain from the base URL.
|
|
1241
|
+
*/
|
|
1242
|
+
domain?: string;
|
|
1284
1243
|
};
|
|
1285
1244
|
};
|
|
1286
1245
|
logger?: {
|
|
@@ -1375,17 +1334,17 @@ declare const signInOAuth: {
|
|
|
1375
1334
|
/**
|
|
1376
1335
|
* OAuth2 provider to use`
|
|
1377
1336
|
*/
|
|
1378
|
-
provider: z.ZodEnum<["github", ...("
|
|
1337
|
+
provider: z.ZodEnum<["github", ...("apple" | "discord" | "facebook" | "github" | "google" | "spotify" | "twitch" | "twitter")[]]>;
|
|
1379
1338
|
/**
|
|
1380
1339
|
* If this is true the session will only be valid for the current browser session
|
|
1381
1340
|
*/
|
|
1382
1341
|
dontRememberMe: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
|
|
1383
1342
|
}, "strip", z.ZodTypeAny, {
|
|
1384
|
-
provider: "
|
|
1343
|
+
provider: "apple" | "discord" | "facebook" | "github" | "google" | "spotify" | "twitch" | "twitter";
|
|
1385
1344
|
callbackURL?: string | undefined;
|
|
1386
1345
|
dontRememberMe?: boolean | undefined;
|
|
1387
1346
|
}, {
|
|
1388
|
-
provider: "
|
|
1347
|
+
provider: "apple" | "discord" | "facebook" | "github" | "google" | "spotify" | "twitch" | "twitter";
|
|
1389
1348
|
callbackURL?: string | undefined;
|
|
1390
1349
|
dontRememberMe?: boolean | undefined;
|
|
1391
1350
|
}>;
|
|
@@ -1418,17 +1377,17 @@ declare const signInOAuth: {
|
|
|
1418
1377
|
/**
|
|
1419
1378
|
* OAuth2 provider to use`
|
|
1420
1379
|
*/
|
|
1421
|
-
provider: z.ZodEnum<["github", ...("
|
|
1380
|
+
provider: z.ZodEnum<["github", ...("apple" | "discord" | "facebook" | "github" | "google" | "spotify" | "twitch" | "twitter")[]]>;
|
|
1422
1381
|
/**
|
|
1423
1382
|
* If this is true the session will only be valid for the current browser session
|
|
1424
1383
|
*/
|
|
1425
1384
|
dontRememberMe: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
|
|
1426
1385
|
}, "strip", z.ZodTypeAny, {
|
|
1427
|
-
provider: "
|
|
1386
|
+
provider: "apple" | "discord" | "facebook" | "github" | "google" | "spotify" | "twitch" | "twitter";
|
|
1428
1387
|
callbackURL?: string | undefined;
|
|
1429
1388
|
dontRememberMe?: boolean | undefined;
|
|
1430
1389
|
}, {
|
|
1431
|
-
provider: "
|
|
1390
|
+
provider: "apple" | "discord" | "facebook" | "github" | "google" | "spotify" | "twitch" | "twitter";
|
|
1432
1391
|
callbackURL?: string | undefined;
|
|
1433
1392
|
dontRememberMe?: boolean | undefined;
|
|
1434
1393
|
}>;
|
|
@@ -2512,14 +2471,14 @@ declare function getEndpoints<C extends AuthContext, Option extends BetterAuthOp
|
|
|
2512
2471
|
}>>;
|
|
2513
2472
|
body: zod.ZodObject<{
|
|
2514
2473
|
callbackURL: zod.ZodOptional<zod.ZodString>;
|
|
2515
|
-
provider: zod.ZodEnum<["github", ...("
|
|
2474
|
+
provider: zod.ZodEnum<["github", ...("apple" | "discord" | "facebook" | "github" | "google" | "spotify" | "twitch" | "twitter")[]]>;
|
|
2516
2475
|
dontRememberMe: zod.ZodOptional<zod.ZodDefault<zod.ZodBoolean>>;
|
|
2517
2476
|
}, "strip", zod.ZodTypeAny, {
|
|
2518
|
-
provider: "
|
|
2477
|
+
provider: "apple" | "discord" | "facebook" | "github" | "google" | "spotify" | "twitch" | "twitter";
|
|
2519
2478
|
callbackURL?: string | undefined;
|
|
2520
2479
|
dontRememberMe?: boolean | undefined;
|
|
2521
2480
|
}, {
|
|
2522
|
-
provider: "
|
|
2481
|
+
provider: "apple" | "discord" | "facebook" | "github" | "google" | "spotify" | "twitch" | "twitter";
|
|
2523
2482
|
callbackURL?: string | undefined;
|
|
2524
2483
|
dontRememberMe?: boolean | undefined;
|
|
2525
2484
|
}>;
|
|
@@ -2542,14 +2501,14 @@ declare function getEndpoints<C extends AuthContext, Option extends BetterAuthOp
|
|
|
2542
2501
|
}>>;
|
|
2543
2502
|
body: zod.ZodObject<{
|
|
2544
2503
|
callbackURL: zod.ZodOptional<zod.ZodString>;
|
|
2545
|
-
provider: zod.ZodEnum<["github", ...("
|
|
2504
|
+
provider: zod.ZodEnum<["github", ...("apple" | "discord" | "facebook" | "github" | "google" | "spotify" | "twitch" | "twitter")[]]>;
|
|
2546
2505
|
dontRememberMe: zod.ZodOptional<zod.ZodDefault<zod.ZodBoolean>>;
|
|
2547
2506
|
}, "strip", zod.ZodTypeAny, {
|
|
2548
|
-
provider: "
|
|
2507
|
+
provider: "apple" | "discord" | "facebook" | "github" | "google" | "spotify" | "twitch" | "twitter";
|
|
2549
2508
|
callbackURL?: string | undefined;
|
|
2550
2509
|
dontRememberMe?: boolean | undefined;
|
|
2551
2510
|
}, {
|
|
2552
|
-
provider: "
|
|
2511
|
+
provider: "apple" | "discord" | "facebook" | "github" | "google" | "spotify" | "twitch" | "twitter";
|
|
2553
2512
|
callbackURL?: string | undefined;
|
|
2554
2513
|
dontRememberMe?: boolean | undefined;
|
|
2555
2514
|
}>;
|
|
@@ -3509,14 +3468,14 @@ declare const router: <C extends AuthContext, Option extends BetterAuthOptions>(
|
|
|
3509
3468
|
}>>;
|
|
3510
3469
|
body: zod.ZodObject<{
|
|
3511
3470
|
callbackURL: zod.ZodOptional<zod.ZodString>;
|
|
3512
|
-
provider: zod.ZodEnum<["github", ...("
|
|
3471
|
+
provider: zod.ZodEnum<["github", ...("apple" | "discord" | "facebook" | "github" | "google" | "spotify" | "twitch" | "twitter")[]]>;
|
|
3513
3472
|
dontRememberMe: zod.ZodOptional<zod.ZodDefault<zod.ZodBoolean>>;
|
|
3514
3473
|
}, "strip", zod.ZodTypeAny, {
|
|
3515
|
-
provider: "
|
|
3474
|
+
provider: "apple" | "discord" | "facebook" | "github" | "google" | "spotify" | "twitch" | "twitter";
|
|
3516
3475
|
callbackURL?: string | undefined;
|
|
3517
3476
|
dontRememberMe?: boolean | undefined;
|
|
3518
3477
|
}, {
|
|
3519
|
-
provider: "
|
|
3478
|
+
provider: "apple" | "discord" | "facebook" | "github" | "google" | "spotify" | "twitch" | "twitter";
|
|
3520
3479
|
callbackURL?: string | undefined;
|
|
3521
3480
|
dontRememberMe?: boolean | undefined;
|
|
3522
3481
|
}>;
|
|
@@ -3539,14 +3498,14 @@ declare const router: <C extends AuthContext, Option extends BetterAuthOptions>(
|
|
|
3539
3498
|
}>>;
|
|
3540
3499
|
body: zod.ZodObject<{
|
|
3541
3500
|
callbackURL: zod.ZodOptional<zod.ZodString>;
|
|
3542
|
-
provider: zod.ZodEnum<["github", ...("
|
|
3501
|
+
provider: zod.ZodEnum<["github", ...("apple" | "discord" | "facebook" | "github" | "google" | "spotify" | "twitch" | "twitter")[]]>;
|
|
3543
3502
|
dontRememberMe: zod.ZodOptional<zod.ZodDefault<zod.ZodBoolean>>;
|
|
3544
3503
|
}, "strip", zod.ZodTypeAny, {
|
|
3545
|
-
provider: "
|
|
3504
|
+
provider: "apple" | "discord" | "facebook" | "github" | "google" | "spotify" | "twitch" | "twitter";
|
|
3546
3505
|
callbackURL?: string | undefined;
|
|
3547
3506
|
dontRememberMe?: boolean | undefined;
|
|
3548
3507
|
}, {
|
|
3549
|
-
provider: "
|
|
3508
|
+
provider: "apple" | "discord" | "facebook" | "github" | "google" | "spotify" | "twitch" | "twitter";
|
|
3550
3509
|
callbackURL?: string | undefined;
|
|
3551
3510
|
dontRememberMe?: boolean | undefined;
|
|
3552
3511
|
}>;
|
|
@@ -4508,14 +4467,14 @@ declare const betterAuth: <O extends BetterAuthOptions>(options: O) => {
|
|
|
4508
4467
|
}>>;
|
|
4509
4468
|
body: zod.ZodObject<{
|
|
4510
4469
|
callbackURL: zod.ZodOptional<zod.ZodString>;
|
|
4511
|
-
provider: zod.ZodEnum<["github", ...("
|
|
4470
|
+
provider: zod.ZodEnum<["github", ...("apple" | "discord" | "facebook" | "github" | "google" | "spotify" | "twitch" | "twitter")[]]>;
|
|
4512
4471
|
dontRememberMe: zod.ZodOptional<zod.ZodDefault<zod.ZodBoolean>>;
|
|
4513
4472
|
}, "strip", zod.ZodTypeAny, {
|
|
4514
|
-
provider: "
|
|
4473
|
+
provider: "apple" | "discord" | "facebook" | "github" | "google" | "spotify" | "twitch" | "twitter";
|
|
4515
4474
|
callbackURL?: string | undefined;
|
|
4516
4475
|
dontRememberMe?: boolean | undefined;
|
|
4517
4476
|
}, {
|
|
4518
|
-
provider: "
|
|
4477
|
+
provider: "apple" | "discord" | "facebook" | "github" | "google" | "spotify" | "twitch" | "twitter";
|
|
4519
4478
|
callbackURL?: string | undefined;
|
|
4520
4479
|
dontRememberMe?: boolean | undefined;
|
|
4521
4480
|
}>;
|
|
@@ -4538,14 +4497,14 @@ declare const betterAuth: <O extends BetterAuthOptions>(options: O) => {
|
|
|
4538
4497
|
}>>;
|
|
4539
4498
|
body: zod.ZodObject<{
|
|
4540
4499
|
callbackURL: zod.ZodOptional<zod.ZodString>;
|
|
4541
|
-
provider: zod.ZodEnum<["github", ...("
|
|
4500
|
+
provider: zod.ZodEnum<["github", ...("apple" | "discord" | "facebook" | "github" | "google" | "spotify" | "twitch" | "twitter")[]]>;
|
|
4542
4501
|
dontRememberMe: zod.ZodOptional<zod.ZodDefault<zod.ZodBoolean>>;
|
|
4543
4502
|
}, "strip", zod.ZodTypeAny, {
|
|
4544
|
-
provider: "
|
|
4503
|
+
provider: "apple" | "discord" | "facebook" | "github" | "google" | "spotify" | "twitch" | "twitter";
|
|
4545
4504
|
callbackURL?: string | undefined;
|
|
4546
4505
|
dontRememberMe?: boolean | undefined;
|
|
4547
4506
|
}, {
|
|
4548
|
-
provider: "
|
|
4507
|
+
provider: "apple" | "discord" | "facebook" | "github" | "google" | "spotify" | "twitch" | "twitter";
|
|
4549
4508
|
callbackURL?: string | undefined;
|
|
4550
4509
|
dontRememberMe?: boolean | undefined;
|
|
4551
4510
|
}>;
|
|
@@ -5462,4 +5421,4 @@ type Auth = {
|
|
|
5462
5421
|
options: BetterAuthOptions;
|
|
5463
5422
|
};
|
|
5464
5423
|
|
|
5465
|
-
export {
|
|
5424
|
+
export { betterAuth as $, type AuthEndpoint as A, type BetterAuthPlugin as B, sessionMiddleware as C, listSessions as D, revokeSession as E, type FieldAttribute as F, type GenericEndpointContext as G, type HookEndpointContext as H, type InferFieldOutput as I, revokeSessions as J, signOut as K, forgetPassword as L, forgetPasswordCallback as M, resetPassword as N, createEmailVerificationToken as O, type PluginSchema as P, sendVerificationEmail as Q, type RateLimit as R, verifyEmail as S, updateUser as T, changePassword as U, setPassword as V, getCSRFToken as W, error as X, ok as Y, signUpEmail as Z, csrfMiddleware as _, createAuthEndpoint as a, type AuthMiddleware as b, createAuthMiddleware as c, type Auth as d, type BetterAuthOptions as e, type AuthContext as f, getCookies as g, createCookieGetter as h, type BetterAuthCookies as i, deleteSessionCookie as j, createLogger as k, logger as l, type InferSession as m, type InferUser as n, optionsMiddleware as o, parseSetCookieHeader as p, type InferPluginTypes as q, init as r, setSessionCookie as s, getEndpoints as t, router as u, signInOAuth as v, signInEmail as w, callbackOAuth as x, getSession as y, getSessionFromCtx as z };
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { U as User, S as Session } from './
|
|
1
|
+
import { U as User, S as Session } from './schema-D9o3OF80.js';
|
|
2
2
|
import * as better_call from 'better-call';
|
|
3
3
|
import { z, ZodObject, ZodOptional, ZodArray, ZodLiteral } from 'zod';
|
|
4
4
|
import { P as Prettify } from './helper-C1ihmerM.js';
|
|
5
5
|
import { A as AccessControl, R as Role, S as StatementsPrimitive, g as defaultRoles } from './statement-CU-fdHXK.js';
|
|
6
6
|
import * as _better_fetch_fetch from '@better-fetch/fetch';
|
|
7
7
|
import { BetterFetch, BetterFetchOption } from '@better-fetch/fetch';
|
|
8
|
-
import { H as HookEndpointContext } from './index-
|
|
8
|
+
import { H as HookEndpointContext } from './index-D_ohe9r9.js';
|
|
9
9
|
import * as nanostores from 'nanostores';
|
|
10
10
|
import { atom } from 'nanostores';
|
|
11
11
|
import * as _simplewebauthn_types from '@simplewebauthn/types';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
export { d as Auth,
|
|
1
|
+
export { d as Auth, $ as betterAuth } from './index-D_ohe9r9.js';
|
|
2
2
|
import 'kysely';
|
|
3
|
-
import './
|
|
4
|
-
import 'arctic';
|
|
3
|
+
import './schema-D9o3OF80.js';
|
|
5
4
|
import 'zod';
|
|
6
|
-
import './helper-C1ihmerM.js';
|
|
7
5
|
import 'better-call';
|
|
6
|
+
import './helper-C1ihmerM.js';
|
|
7
|
+
import './social.js';
|
|
8
|
+
import 'arctic';
|
|
9
|
+
import './adapter-D-m9-hQp.js';
|
package/dist/next-js.d.ts
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
import { d as Auth } from './index-
|
|
2
|
-
import { U as User, S as Session } from './
|
|
1
|
+
import { d as Auth } from './index-D_ohe9r9.js';
|
|
2
|
+
import { U as User, S as Session } from './schema-D9o3OF80.js';
|
|
3
3
|
import { NextRequest } from 'next/server';
|
|
4
4
|
import 'kysely';
|
|
5
5
|
import 'better-call';
|
|
6
6
|
import 'zod';
|
|
7
7
|
import './helper-C1ihmerM.js';
|
|
8
|
+
import './social.js';
|
|
8
9
|
import 'arctic';
|
|
10
|
+
import './adapter-D-m9-hQp.js';
|
|
9
11
|
|
|
10
12
|
declare function toNextJsHandler(auth: Auth | Auth["handler"]): {
|
|
11
13
|
GET: (request: Request) => Promise<Response>;
|
package/dist/node.d.ts
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import * as http from 'http';
|
|
2
|
-
import { d as Auth } from './index-
|
|
2
|
+
import { d as Auth } from './index-D_ohe9r9.js';
|
|
3
3
|
import 'kysely';
|
|
4
|
-
import './
|
|
5
|
-
import 'arctic';
|
|
4
|
+
import './schema-D9o3OF80.js';
|
|
6
5
|
import 'zod';
|
|
7
|
-
import './helper-C1ihmerM.js';
|
|
8
6
|
import 'better-call';
|
|
7
|
+
import './helper-C1ihmerM.js';
|
|
8
|
+
import './social.js';
|
|
9
|
+
import 'arctic';
|
|
10
|
+
import './adapter-D-m9-hQp.js';
|
|
9
11
|
|
|
10
12
|
declare const toNodeHandler: (auth: Auth | Auth["handler"]) => (req: http.IncomingMessage, res: http.ServerResponse) => Promise<void>;
|
|
11
13
|
|
package/dist/plugins.d.ts
CHANGED
|
@@ -1,18 +1,20 @@
|
|
|
1
|
-
export { O as OrganizationOptions, b as Passkey, P as PasskeyOptions, W as WebAuthnCookieType, g as getPasskeyActions, m as magicLink, o as organization, p as passkey, c as passkeyClient, t as twoFactor, a as twoFactorClient, u as username } from './index-
|
|
1
|
+
export { O as OrganizationOptions, b as Passkey, P as PasskeyOptions, W as WebAuthnCookieType, g as getPasskeyActions, m as magicLink, o as organization, p as passkey, c as passkeyClient, t as twoFactor, a as twoFactorClient, u as username } from './index-DsEvbKjm.js';
|
|
2
2
|
export { i as ac } from './index-D6NOkCRo.js';
|
|
3
|
-
import { H as HookEndpointContext } from './index-
|
|
4
|
-
export { A as AuthEndpoint, b as AuthMiddleware, B as BetterAuthPlugin, P as PluginSchema, a as createAuthEndpoint, c as createAuthMiddleware, o as optionsMiddleware } from './index-
|
|
3
|
+
import { H as HookEndpointContext } from './index-D_ohe9r9.js';
|
|
4
|
+
export { A as AuthEndpoint, b as AuthMiddleware, B as BetterAuthPlugin, P as PluginSchema, a as createAuthEndpoint, c as createAuthMiddleware, o as optionsMiddleware } from './index-D_ohe9r9.js';
|
|
5
5
|
export { H as HIDE_METADATA } from './hide-metadata-DEHJp1rk.js';
|
|
6
|
-
import './
|
|
7
|
-
import 'arctic';
|
|
6
|
+
import './schema-D9o3OF80.js';
|
|
8
7
|
import 'zod';
|
|
9
|
-
import './helper-C1ihmerM.js';
|
|
10
8
|
import 'better-call';
|
|
9
|
+
import './helper-C1ihmerM.js';
|
|
11
10
|
import './statement-CU-fdHXK.js';
|
|
12
11
|
import '@better-fetch/fetch';
|
|
13
12
|
import 'nanostores';
|
|
14
13
|
import '@simplewebauthn/types';
|
|
15
14
|
import 'kysely';
|
|
15
|
+
import './social.js';
|
|
16
|
+
import 'arctic';
|
|
17
|
+
import './adapter-D-m9-hQp.js';
|
|
16
18
|
|
|
17
19
|
/**
|
|
18
20
|
* Converts bearer token to session cookie
|
package/dist/react.d.ts
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import * as _better_fetch_fetch from '@better-fetch/fetch';
|
|
2
|
-
import { B as BetterAuthPlugin, F as FieldAttribute, I as InferFieldOutput } from './index-
|
|
2
|
+
import { B as BetterAuthPlugin, F as FieldAttribute, I as InferFieldOutput } from './index-D_ohe9r9.js';
|
|
3
3
|
import { U as UnionToIntersection, P as Prettify } from './helper-C1ihmerM.js';
|
|
4
4
|
import { ClientOptions, InferClientAPI, InferActions, BetterAuthClientPlugin, IsSignal } from './types.js';
|
|
5
5
|
import { useStore } from '@nanostores/react';
|
|
6
6
|
import 'kysely';
|
|
7
|
-
import './
|
|
8
|
-
import 'arctic';
|
|
7
|
+
import './schema-D9o3OF80.js';
|
|
9
8
|
import 'zod';
|
|
10
9
|
import 'better-call';
|
|
10
|
+
import './social.js';
|
|
11
|
+
import 'arctic';
|
|
12
|
+
import './adapter-D-m9-hQp.js';
|
|
11
13
|
import 'nanostores';
|
|
12
14
|
|
|
13
15
|
type InferResolvedHooks<O extends ClientOptions> = O["plugins"] extends Array<infer Plugin> ? Plugin extends BetterAuthClientPlugin ? Plugin["getAtoms"] extends (fetch: any) => infer Atoms ? Atoms extends Record<string, any> ? {
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
declare const accountSchema: z.ZodObject<{
|
|
4
|
+
id: z.ZodString;
|
|
5
|
+
providerId: z.ZodString;
|
|
6
|
+
accountId: z.ZodString;
|
|
7
|
+
userId: z.ZodString;
|
|
8
|
+
accessToken: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
9
|
+
refreshToken: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
10
|
+
idToken: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
11
|
+
/**
|
|
12
|
+
* Access token expires at
|
|
13
|
+
*/
|
|
14
|
+
expiresAt: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
|
|
15
|
+
/**
|
|
16
|
+
* Password is only stored in the credential provider
|
|
17
|
+
*/
|
|
18
|
+
password: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
19
|
+
}, "strip", z.ZodTypeAny, {
|
|
20
|
+
id: string;
|
|
21
|
+
providerId: string;
|
|
22
|
+
accountId: string;
|
|
23
|
+
userId: string;
|
|
24
|
+
accessToken?: string | null | undefined;
|
|
25
|
+
refreshToken?: string | null | undefined;
|
|
26
|
+
idToken?: string | null | undefined;
|
|
27
|
+
expiresAt?: Date | null | undefined;
|
|
28
|
+
password?: string | null | undefined;
|
|
29
|
+
}, {
|
|
30
|
+
id: string;
|
|
31
|
+
providerId: string;
|
|
32
|
+
accountId: string;
|
|
33
|
+
userId: string;
|
|
34
|
+
accessToken?: string | null | undefined;
|
|
35
|
+
refreshToken?: string | null | undefined;
|
|
36
|
+
idToken?: string | null | undefined;
|
|
37
|
+
expiresAt?: Date | null | undefined;
|
|
38
|
+
password?: string | null | undefined;
|
|
39
|
+
}>;
|
|
40
|
+
declare const userSchema: z.ZodObject<{
|
|
41
|
+
id: z.ZodString;
|
|
42
|
+
email: z.ZodEffects<z.ZodString, string, string>;
|
|
43
|
+
emailVerified: z.ZodDefault<z.ZodBoolean>;
|
|
44
|
+
name: z.ZodString;
|
|
45
|
+
image: z.ZodOptional<z.ZodString>;
|
|
46
|
+
createdAt: z.ZodDefault<z.ZodDate>;
|
|
47
|
+
updatedAt: z.ZodDefault<z.ZodDate>;
|
|
48
|
+
}, "strip", z.ZodTypeAny, {
|
|
49
|
+
id: string;
|
|
50
|
+
email: string;
|
|
51
|
+
emailVerified: boolean;
|
|
52
|
+
name: string;
|
|
53
|
+
createdAt: Date;
|
|
54
|
+
updatedAt: Date;
|
|
55
|
+
image?: string | undefined;
|
|
56
|
+
}, {
|
|
57
|
+
id: string;
|
|
58
|
+
email: string;
|
|
59
|
+
name: string;
|
|
60
|
+
emailVerified?: boolean | undefined;
|
|
61
|
+
image?: string | undefined;
|
|
62
|
+
createdAt?: Date | undefined;
|
|
63
|
+
updatedAt?: Date | undefined;
|
|
64
|
+
}>;
|
|
65
|
+
declare const sessionSchema: z.ZodObject<{
|
|
66
|
+
id: z.ZodString;
|
|
67
|
+
userId: z.ZodString;
|
|
68
|
+
expiresAt: z.ZodDate;
|
|
69
|
+
ipAddress: z.ZodOptional<z.ZodString>;
|
|
70
|
+
userAgent: z.ZodOptional<z.ZodString>;
|
|
71
|
+
}, "strip", z.ZodTypeAny, {
|
|
72
|
+
id: string;
|
|
73
|
+
userId: string;
|
|
74
|
+
expiresAt: Date;
|
|
75
|
+
ipAddress?: string | undefined;
|
|
76
|
+
userAgent?: string | undefined;
|
|
77
|
+
}, {
|
|
78
|
+
id: string;
|
|
79
|
+
userId: string;
|
|
80
|
+
expiresAt: Date;
|
|
81
|
+
ipAddress?: string | undefined;
|
|
82
|
+
userAgent?: string | undefined;
|
|
83
|
+
}>;
|
|
84
|
+
type User = z.infer<typeof userSchema>;
|
|
85
|
+
type Account = z.infer<typeof accountSchema>;
|
|
86
|
+
type Session = z.infer<typeof sessionSchema>;
|
|
87
|
+
|
|
88
|
+
export type { Account as A, Session as S, User as U };
|