better-auth 0.2.2 → 0.2.3-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/adapters.d.ts +32 -6
- package/dist/adapters.js +22 -1
- package/dist/api.d.ts +2 -4
- package/dist/cli.js +4 -2
- package/dist/client/plugins.d.ts +5 -7
- package/dist/client.d.ts +3 -5
- package/dist/{index-DsEvbKjm.d.ts → index-3B6zGicM.d.ts} +10 -2
- package/dist/{index-D_ohe9r9.d.ts → index-BMYcrOqA.d.ts} +72 -113
- package/dist/index-CE92ti2Z.d.ts +827 -0
- package/dist/index.d.ts +4 -6
- package/dist/index.js +5 -3
- package/dist/next-js.d.ts +2 -4
- package/dist/node.d.ts +4 -6
- package/dist/plugins.d.ts +6 -8
- package/dist/plugins.js +1 -1
- package/dist/react.d.ts +3 -5
- package/dist/social.d.ts +3 -742
- package/dist/solid-start.d.ts +4 -6
- package/dist/solid.d.ts +3 -5
- package/dist/svelte-kit.d.ts +4 -6
- package/dist/svelte.d.ts +3 -5
- package/dist/types.d.ts +3 -5
- package/dist/utils.d.ts +5 -7
- package/dist/vue.d.ts +3 -5
- package/package.json +7 -5
- package/dist/.DS_Store +0 -0
- package/dist/adapter-D-m9-hQp.d.ts +0 -54
- package/dist/schema-D9o3OF80.d.ts +0 -88
package/dist/solid-start.d.ts
CHANGED
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
import { d as Auth } from './index-
|
|
1
|
+
import { d as Auth } from './index-BMYcrOqA.js';
|
|
2
2
|
import 'kysely';
|
|
3
|
-
import './
|
|
3
|
+
import './index-CE92ti2Z.js';
|
|
4
|
+
import 'arctic';
|
|
4
5
|
import 'zod';
|
|
5
|
-
import 'better-call';
|
|
6
6
|
import './helper-C1ihmerM.js';
|
|
7
|
-
import '
|
|
8
|
-
import 'arctic';
|
|
9
|
-
import './adapter-D-m9-hQp.js';
|
|
7
|
+
import 'better-call';
|
|
10
8
|
|
|
11
9
|
declare function toSolidStartHandler(auth: Auth | Auth["handler"]): {
|
|
12
10
|
GET: (event: {
|
package/dist/solid.d.ts
CHANGED
|
@@ -1,15 +1,13 @@
|
|
|
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-BMYcrOqA.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 { Accessor } from 'solid-js';
|
|
6
6
|
import 'kysely';
|
|
7
|
-
import './
|
|
7
|
+
import './index-CE92ti2Z.js';
|
|
8
|
+
import 'arctic';
|
|
8
9
|
import 'zod';
|
|
9
10
|
import 'better-call';
|
|
10
|
-
import './social.js';
|
|
11
|
-
import 'arctic';
|
|
12
|
-
import './adapter-D-m9-hQp.js';
|
|
13
11
|
import 'nanostores';
|
|
14
12
|
|
|
15
13
|
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> ? {
|
package/dist/svelte-kit.d.ts
CHANGED
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
import { d as Auth, e as BetterAuthOptions } from './index-
|
|
1
|
+
import { d as Auth, e as BetterAuthOptions } from './index-BMYcrOqA.js';
|
|
2
2
|
import 'kysely';
|
|
3
|
-
import './
|
|
3
|
+
import './index-CE92ti2Z.js';
|
|
4
|
+
import 'arctic';
|
|
4
5
|
import 'zod';
|
|
5
|
-
import 'better-call';
|
|
6
6
|
import './helper-C1ihmerM.js';
|
|
7
|
-
import '
|
|
8
|
-
import 'arctic';
|
|
9
|
-
import './adapter-D-m9-hQp.js';
|
|
7
|
+
import 'better-call';
|
|
10
8
|
|
|
11
9
|
declare const toSvelteKitHandler: (auth: Auth) => (event: {
|
|
12
10
|
request: Request;
|
package/dist/svelte.d.ts
CHANGED
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
import * as nanostores from 'nanostores';
|
|
2
2
|
import * as _better_fetch_fetch from '@better-fetch/fetch';
|
|
3
|
-
import { B as BetterAuthPlugin, F as FieldAttribute, I as InferFieldOutput } from './index-
|
|
3
|
+
import { B as BetterAuthPlugin, F as FieldAttribute, I as InferFieldOutput } from './index-BMYcrOqA.js';
|
|
4
4
|
import { U as UnionToIntersection, P as Prettify } from './helper-C1ihmerM.js';
|
|
5
5
|
import { ClientOptions, InferClientAPI, InferActions, BetterAuthClientPlugin, IsSignal } from './types.js';
|
|
6
6
|
import 'kysely';
|
|
7
|
-
import './
|
|
7
|
+
import './index-CE92ti2Z.js';
|
|
8
|
+
import 'arctic';
|
|
8
9
|
import 'zod';
|
|
9
10
|
import 'better-call';
|
|
10
|
-
import './social.js';
|
|
11
|
-
import 'arctic';
|
|
12
|
-
import './adapter-D-m9-hQp.js';
|
|
13
11
|
|
|
14
12
|
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> ? {
|
|
15
13
|
[key in keyof Atoms as IsSignal<key> extends true ? never : key extends string ? `use${Capitalize<key>}` : never]: () => Atoms[key];
|
package/dist/types.d.ts
CHANGED
|
@@ -1,13 +1,11 @@
|
|
|
1
|
-
import { B as BetterAuthPlugin, d as Auth,
|
|
2
|
-
export { f as AuthContext, e as BetterAuthOptions, G as GenericEndpointContext, H as HookEndpointContext,
|
|
1
|
+
import { B as BetterAuthPlugin, d as Auth, n as InferSession, q as InferUser } from './index-BMYcrOqA.js';
|
|
2
|
+
export { f as Adapter, g as AuthContext, e as BetterAuthOptions, G as GenericEndpointContext, H as HookEndpointContext, r as InferPluginTypes, P as PluginSchema, R as RateLimit, S as SessionAdapter, W as Where, t as init } from './index-BMYcrOqA.js';
|
|
3
3
|
import { U as UnionToIntersection, H as HasRequiredKeys, P as Prettify, L as LiteralString } from './helper-C1ihmerM.js';
|
|
4
4
|
export { a as LiteralUnion, R as RequiredKeysOf, W as WithoutEmpty } from './helper-C1ihmerM.js';
|
|
5
|
-
export { OAuthProvider, OAuthProviderList, ProviderOptions } from './
|
|
6
|
-
export { A as Adapter, S as SessionAdapter, W as Where } from './adapter-D-m9-hQp.js';
|
|
5
|
+
export { O as OAuthProvider, f as OAuthProviderList, P as ProviderOptions, S as Session, U as User } from './index-CE92ti2Z.js';
|
|
7
6
|
import { BetterFetchOption, BetterFetchResponse, BetterFetch, BetterFetchPlugin } from '@better-fetch/fetch';
|
|
8
7
|
import { Atom } from 'nanostores';
|
|
9
8
|
import { Endpoint, Context } from 'better-call';
|
|
10
|
-
export { S as Session, U as User } from './schema-D9o3OF80.js';
|
|
11
9
|
import 'kysely';
|
|
12
10
|
import 'zod';
|
|
13
11
|
import 'arctic';
|
package/dist/utils.d.ts
CHANGED
|
@@ -1,14 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
1
|
+
import { g as AuthContext, G as GenericEndpointContext } from './index-BMYcrOqA.js';
|
|
2
|
+
export { j as BetterAuthCookies, i as createCookieGetter, l as createLogger, k as deleteSessionCookie, h as getCookies, m as logger, p as parseSetCookieHeader, s as setSessionCookie } from './index-BMYcrOqA.js';
|
|
3
3
|
export { H as HIDE_METADATA } from './hide-metadata-DEHJp1rk.js';
|
|
4
4
|
import { z } from 'zod';
|
|
5
5
|
import 'kysely';
|
|
6
|
-
import './
|
|
7
|
-
import 'better-call';
|
|
8
|
-
import './helper-C1ihmerM.js';
|
|
9
|
-
import './social.js';
|
|
6
|
+
import './index-CE92ti2Z.js';
|
|
10
7
|
import 'arctic';
|
|
11
|
-
import './
|
|
8
|
+
import './helper-C1ihmerM.js';
|
|
9
|
+
import 'better-call';
|
|
12
10
|
|
|
13
11
|
declare const shimContext: <T extends Record<string, any>>(originalObject: T, newContext: Record<string, any>) => T;
|
|
14
12
|
declare const shimEndpoint: (ctx: AuthContext, value: any) => (context: any) => Promise<any>;
|
package/dist/vue.d.ts
CHANGED
|
@@ -1,15 +1,13 @@
|
|
|
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-BMYcrOqA.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 { Ref, DeepReadonly } from 'vue';
|
|
6
6
|
import 'kysely';
|
|
7
|
-
import './
|
|
7
|
+
import './index-CE92ti2Z.js';
|
|
8
|
+
import 'arctic';
|
|
8
9
|
import 'zod';
|
|
9
10
|
import 'better-call';
|
|
10
|
-
import './social.js';
|
|
11
|
-
import 'arctic';
|
|
12
|
-
import './adapter-D-m9-hQp.js';
|
|
13
11
|
import 'nanostores';
|
|
14
12
|
|
|
15
13
|
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> ? {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "better-auth",
|
|
3
|
-
"version": "0.2.2",
|
|
3
|
+
"version": "0.2.3-beta.2",
|
|
4
4
|
"description": "The most comprehensive authentication library for TypeScript.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
},
|
|
14
14
|
"exports": {
|
|
15
15
|
".": "./dist/index.js",
|
|
16
|
+
"./adapters": "./dist/adapters.js",
|
|
16
17
|
"./social-providers": "./dist/social.js",
|
|
17
18
|
"./client": {
|
|
18
19
|
"import": "./dist/client.js",
|
|
@@ -37,7 +38,6 @@
|
|
|
37
38
|
"./next-js": "./dist/next-js.js",
|
|
38
39
|
"./package.json": "./package.json",
|
|
39
40
|
"./node": "./dist/node.js",
|
|
40
|
-
"./adapters": "./dist/adapters.js",
|
|
41
41
|
"./utils": "./dist/utils.js"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
@@ -47,19 +47,20 @@
|
|
|
47
47
|
"@types/pg": "^8.11.6",
|
|
48
48
|
"@types/prompts": "^2.4.9",
|
|
49
49
|
"@types/react": "^18.3.3",
|
|
50
|
+
"better-sqlite3": "^11.3.0",
|
|
50
51
|
"drizzle-orm": "^0.33.0",
|
|
51
52
|
"happy-dom": "^15.7.3",
|
|
52
53
|
"hono": "^4.5.4",
|
|
53
54
|
"listhen": "^1.7.2",
|
|
54
55
|
"mongodb": "^6.9.0",
|
|
56
|
+
"mysql2": "^3.11.0",
|
|
55
57
|
"next": "^14.2.8",
|
|
56
58
|
"pg": "^8.12.0",
|
|
57
|
-
"
|
|
59
|
+
"prettier": "^3.3.3",
|
|
58
60
|
"prisma": "^5.19.1",
|
|
59
61
|
"react": "^18.3.1",
|
|
60
62
|
"solid-js": "^1.8.18",
|
|
61
63
|
"tsup": "^8.2.4",
|
|
62
|
-
"mysql2": "^3.11.0",
|
|
63
64
|
"typescript": "5.6.1-rc",
|
|
64
65
|
"vitest": "^1.6.0",
|
|
65
66
|
"vue": "^3.5.0"
|
|
@@ -69,6 +70,7 @@
|
|
|
69
70
|
"@babel/preset-typescript": "^7.24.7",
|
|
70
71
|
"@better-fetch/fetch": "^1.1.9",
|
|
71
72
|
"@better-fetch/logger": "^1.1.3",
|
|
73
|
+
"@mrleebo/prisma-ast": "^0.12.0",
|
|
72
74
|
"@nanostores/query": "^0.3.4",
|
|
73
75
|
"@nanostores/react": "^0.7.3",
|
|
74
76
|
"@nanostores/solid": "^0.4.2",
|
|
@@ -105,7 +107,7 @@
|
|
|
105
107
|
"build": "NODE_OPTIONS='--max-old-space-size=16384' tsup --clean --minify",
|
|
106
108
|
"dev": "NODE_OPTIONS='--max-old-space-size=16384' tsup --watch --sourcemap",
|
|
107
109
|
"test": "pnpm prisma:push && pnpm typecheck && vitest",
|
|
108
|
-
"prisma:push": "prisma db push --schema src/adapters/prisma-adapter/schema.prisma",
|
|
110
|
+
"prisma:push": "prisma db push --schema src/adapters/prisma-adapter/test/schema.prisma",
|
|
109
111
|
"test:adapters": "pnpm prisma:push && vitest adapters",
|
|
110
112
|
"bump": "bumpp",
|
|
111
113
|
"typecheck": "tsc --noEmit"
|
package/dist/.DS_Store
DELETED
|
Binary file
|
|
@@ -1,54 +0,0 @@
|
|
|
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 };
|
|
@@ -1,88 +0,0 @@
|
|
|
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 };
|