better-auth 0.3.3 → 0.3.4-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/drizzle.d.ts +1 -1
- package/dist/adapters/mongodb.d.ts +1 -1
- package/dist/adapters/prisma.d.ts +1 -1
- package/dist/api.d.ts +1 -1
- package/dist/cli.js +9 -0
- package/dist/client/plugins.d.ts +3 -3
- package/dist/client.d.ts +1 -1
- package/dist/{index-hpMBIT7Z.d.ts → index-C-bU-Qee.d.ts} +3 -3
- package/dist/{index-DAuvs7am.d.ts → index-C_kXwBoC.d.ts} +3 -3
- package/dist/index.d.ts +1 -1
- package/dist/index.js +9 -0
- package/dist/next-js.d.ts +1 -1
- package/dist/node.d.ts +1 -1
- package/dist/plugins.d.ts +3 -3
- package/dist/react.d.ts +1 -1
- package/dist/solid-start.d.ts +1 -1
- package/dist/solid.d.ts +1 -1
- package/dist/svelte-kit.d.ts +1 -1
- package/dist/svelte.d.ts +1 -1
- package/dist/types.d.ts +2 -2
- package/dist/vue.d.ts +1 -1
- package/package.json +1 -1
package/dist/api.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { f as AuthEndpoint, g as AuthMiddleware, n as callbackOAuth, L as changePassword, e as createAuthEndpoint, d as createAuthMiddleware, D as createEmailVerificationToken, V as csrfMiddleware, N as deleteUser, Q as error, y as forgetPassword, z as forgetPasswordCallback, O as getCSRFToken, l as getEndpoints, p as getSession, q as getSessionFromCtx, u as listSessions, T as ok, o as optionsMiddleware, C as resetPassword, v as revokeSession, w as revokeSessions, r as router, E as sendVerificationEmail, t as sessionMiddleware, M as setPassword, m as signInEmail, s as signInOAuth, x as signOut, U as signUpEmail, K as updateUser, J as verifyEmail } from './index-
|
|
1
|
+
export { f as AuthEndpoint, g as AuthMiddleware, n as callbackOAuth, L as changePassword, e as createAuthEndpoint, d as createAuthMiddleware, D as createEmailVerificationToken, V as csrfMiddleware, N as deleteUser, Q as error, y as forgetPassword, z as forgetPasswordCallback, O as getCSRFToken, l as getEndpoints, p as getSession, q as getSessionFromCtx, u as listSessions, T as ok, o as optionsMiddleware, C as resetPassword, v as revokeSession, w as revokeSessions, r as router, E as sendVerificationEmail, t as sessionMiddleware, M as setPassword, m as signInEmail, s as signInOAuth, x as signOut, U as signUpEmail, K as updateUser, J as verifyEmail } from './index-C-bU-Qee.js';
|
|
2
2
|
import 'zod';
|
|
3
3
|
import './helper-DPDj8Nix.js';
|
|
4
4
|
export { APIError } from 'better-call';
|
package/dist/cli.js
CHANGED
|
@@ -513,6 +513,9 @@ var map = {
|
|
|
513
513
|
mssql: mssqlMap
|
|
514
514
|
};
|
|
515
515
|
function matchType(columnDataType, fieldType, dbType) {
|
|
516
|
+
if (fieldType === "string[]" || fieldType === "number[]") {
|
|
517
|
+
return columnDataType.toLowerCase().includes("json");
|
|
518
|
+
}
|
|
516
519
|
const types = map[dbType];
|
|
517
520
|
const type = types[fieldType].map((t) => t.toLowerCase());
|
|
518
521
|
const matches = type.includes(columnDataType.toLowerCase());
|
|
@@ -596,6 +599,12 @@ async function getMigrations(config) {
|
|
|
596
599
|
if (dbType === "mysql" && type === "string") {
|
|
597
600
|
return "varchar(255)";
|
|
598
601
|
}
|
|
602
|
+
if (dbType === "sqlite" && (type === "string[]" || type === "number[]")) {
|
|
603
|
+
return "text";
|
|
604
|
+
}
|
|
605
|
+
if (type === "string[]" || type === "number[]") {
|
|
606
|
+
return "jsonb";
|
|
607
|
+
}
|
|
599
608
|
return typeMap[type];
|
|
600
609
|
}
|
|
601
610
|
if (toBeAdded.length) {
|
package/dist/client/plugins.d.ts
CHANGED
|
@@ -2,14 +2,14 @@ import * as nanostores from 'nanostores';
|
|
|
2
2
|
import { A as AccessControl, S as StatementsPrimitive, R as Role } from '../statement-CfnyN34h.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, f as Organization, M as Member, I as Invitation, u as username, m as magicLink, d as phoneNumber, e as anonymous } from '../index-
|
|
6
|
-
export { g as getPasskeyActions, c as passkeyClient, a as twoFactorClient } from '../index-
|
|
5
|
+
import { o as organization, f as Organization, M as Member, I as Invitation, u as username, m as magicLink, d as phoneNumber, e as anonymous } from '../index-C_kXwBoC.js';
|
|
6
|
+
export { g as getPasskeyActions, c as passkeyClient, a as twoFactorClient } from '../index-C_kXwBoC.js';
|
|
7
7
|
import { P as Prettify } from '../helper-DPDj8Nix.js';
|
|
8
8
|
import '../index-CT4RHCuS.js';
|
|
9
9
|
import 'arctic';
|
|
10
10
|
import 'zod';
|
|
11
11
|
import 'better-call';
|
|
12
|
-
import '../index-
|
|
12
|
+
import '../index-C-bU-Qee.js';
|
|
13
13
|
import 'kysely';
|
|
14
14
|
import 'better-sqlite3';
|
|
15
15
|
import 'mysql2';
|
package/dist/client.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ import { BetterFetch, BetterFetchError, BetterFetchOption } from '@better-fetch/
|
|
|
6
6
|
import { U as UnionToIntersection, P as Prettify, S as StripEmptyObjects } from './helper-DPDj8Nix.js';
|
|
7
7
|
import { ClientOptions, InferClientAPI, InferActions, InferAdditionalFromClient, InferSessionFromClient, InferUserFromClient, BetterAuthClientPlugin, IsSignal } from './types.js';
|
|
8
8
|
export { AtomListener, InferPluginsFromClient } from './types.js';
|
|
9
|
-
import './index-
|
|
9
|
+
import './index-C-bU-Qee.js';
|
|
10
10
|
import 'kysely';
|
|
11
11
|
import './index-CT4RHCuS.js';
|
|
12
12
|
import 'arctic';
|
|
@@ -261,8 +261,8 @@ declare const createInternalAdapter: (adapter: Adapter, ctx: {
|
|
|
261
261
|
type FieldAttribute<T extends FieldType = FieldType> = {
|
|
262
262
|
type: T;
|
|
263
263
|
} & FieldAttributeConfig<T>;
|
|
264
|
-
type FieldType = "string" | "number" | "boolean" | "date"
|
|
265
|
-
type InferValueType<T extends FieldType> = T extends "string" ? string : T extends "number" ? number : T extends "boolean" ? boolean : T extends "
|
|
264
|
+
type FieldType = "string" | "number" | "boolean" | "date" | `${"string" | "number"}[]`;
|
|
265
|
+
type InferValueType<T extends FieldType> = T extends "string" ? string : T extends "number" ? number : T extends "boolean" ? boolean : T extends `${infer T}[]` ? T extends "string" ? string[] : number[] : never;
|
|
266
266
|
type InferFieldOutput<T extends FieldAttribute> = T["returned"] extends false ? never : T["required"] extends false ? InferValueType<T["type"]> | undefined : InferValueType<T["type"]>;
|
|
267
267
|
type FieldAttributeConfig<T extends FieldType = FieldType> = {
|
|
268
268
|
/**
|
|
@@ -286,7 +286,7 @@ type FieldAttributeConfig<T extends FieldType = FieldType> = {
|
|
|
286
286
|
* Note: This will not create a default value on the database level. It will only
|
|
287
287
|
* be used when creating a new record.
|
|
288
288
|
*/
|
|
289
|
-
defaultValue?:
|
|
289
|
+
defaultValue?: any;
|
|
290
290
|
/**
|
|
291
291
|
* transform the value before storing it.
|
|
292
292
|
*/
|
|
@@ -5,7 +5,7 @@ import { P as Prettify } from './helper-DPDj8Nix.js';
|
|
|
5
5
|
import { A as AccessControl, R as Role, S as StatementsPrimitive, g as defaultRoles } from './statement-CfnyN34h.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-C-bU-Qee.js';
|
|
9
9
|
import * as nanostores from 'nanostores';
|
|
10
10
|
import { atom } from 'nanostores';
|
|
11
11
|
import * as _simplewebauthn_types from '@simplewebauthn/types';
|
|
@@ -3472,7 +3472,7 @@ declare const twoFactor: (options?: TwoFactorOptions) => {
|
|
|
3472
3472
|
twoFactorEnabled: {
|
|
3473
3473
|
type: "boolean";
|
|
3474
3474
|
required: false;
|
|
3475
|
-
defaultValue:
|
|
3475
|
+
defaultValue: boolean;
|
|
3476
3476
|
};
|
|
3477
3477
|
twoFactorSecret: {
|
|
3478
3478
|
type: "string";
|
|
@@ -4751,7 +4751,7 @@ declare const anonymous: (options?: AnonymousOptions) => {
|
|
|
4751
4751
|
fields: {
|
|
4752
4752
|
isAnonymous: {
|
|
4753
4753
|
type: "boolean";
|
|
4754
|
-
defaultValue:
|
|
4754
|
+
defaultValue: boolean;
|
|
4755
4755
|
required: false;
|
|
4756
4756
|
};
|
|
4757
4757
|
};
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -3039,6 +3039,9 @@ var map = {
|
|
|
3039
3039
|
mssql: mssqlMap
|
|
3040
3040
|
};
|
|
3041
3041
|
function matchType(columnDataType, fieldType, dbType) {
|
|
3042
|
+
if (fieldType === "string[]" || fieldType === "number[]") {
|
|
3043
|
+
return columnDataType.toLowerCase().includes("json");
|
|
3044
|
+
}
|
|
3042
3045
|
const types = map[dbType];
|
|
3043
3046
|
const type = types[fieldType].map((t) => t.toLowerCase());
|
|
3044
3047
|
const matches = type.includes(columnDataType.toLowerCase());
|
|
@@ -3122,6 +3125,12 @@ async function getMigrations(config2) {
|
|
|
3122
3125
|
if (dbType === "mysql" && type === "string") {
|
|
3123
3126
|
return "varchar(255)";
|
|
3124
3127
|
}
|
|
3128
|
+
if (dbType === "sqlite" && (type === "string[]" || type === "number[]")) {
|
|
3129
|
+
return "text";
|
|
3130
|
+
}
|
|
3131
|
+
if (type === "string[]" || type === "number[]") {
|
|
3132
|
+
return "jsonb";
|
|
3133
|
+
}
|
|
3125
3134
|
return typeMap[type];
|
|
3126
3135
|
}
|
|
3127
3136
|
if (toBeAdded.length) {
|
package/dist/next-js.d.ts
CHANGED
package/dist/node.d.ts
CHANGED
package/dist/plugins.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export { A as AnonymousOptions, O as OrganizationOptions, b as Passkey, P as PasskeyOptions, U as UserWithPhoneNumber, e as anonymous, g as getPasskeyActions, m as magicLink, o as organization, p as passkey, c as passkeyClient, d as phoneNumber, t as twoFactor, a as twoFactorClient, u as username } from './index-
|
|
1
|
+
export { A as AnonymousOptions, O as OrganizationOptions, b as Passkey, P as PasskeyOptions, U as UserWithPhoneNumber, e as anonymous, g as getPasskeyActions, m as magicLink, o as organization, p as passkey, c as passkeyClient, d as phoneNumber, t as twoFactor, a as twoFactorClient, u as username } from './index-C_kXwBoC.js';
|
|
2
2
|
export { i as ac } from './index-DfAHOgpj.js';
|
|
3
|
-
import { b as AuthContext } from './index-
|
|
4
|
-
export { f as AuthEndpoint, g as AuthMiddleware, c as BetterAuthPlugin, P as PluginSchema, e as createAuthEndpoint, d as createAuthMiddleware, o as optionsMiddleware } from './index-
|
|
3
|
+
import { b as AuthContext } from './index-C-bU-Qee.js';
|
|
4
|
+
export { f as AuthEndpoint, g as AuthMiddleware, c as BetterAuthPlugin, P as PluginSchema, e as createAuthEndpoint, d as createAuthMiddleware, o as optionsMiddleware } from './index-C-bU-Qee.js';
|
|
5
5
|
import './index-CT4RHCuS.js';
|
|
6
6
|
import 'arctic';
|
|
7
7
|
import 'zod';
|
package/dist/react.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import * as _better_fetch_fetch from '@better-fetch/fetch';
|
|
|
3
3
|
import { U as UnionToIntersection, P as Prettify, S as StripEmptyObjects } from './helper-DPDj8Nix.js';
|
|
4
4
|
import { ClientOptions, InferClientAPI, InferActions, InferAdditionalFromClient, BetterAuthClientPlugin, IsSignal } from './types.js';
|
|
5
5
|
import { useStore } from '@nanostores/react';
|
|
6
|
-
import './index-
|
|
6
|
+
import './index-C-bU-Qee.js';
|
|
7
7
|
import 'kysely';
|
|
8
8
|
import './index-CT4RHCuS.js';
|
|
9
9
|
import 'arctic';
|
package/dist/solid-start.d.ts
CHANGED
package/dist/solid.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import * as _better_fetch_fetch from '@better-fetch/fetch';
|
|
|
3
3
|
import { U as UnionToIntersection, P as Prettify, S as StripEmptyObjects } from './helper-DPDj8Nix.js';
|
|
4
4
|
import { ClientOptions, InferClientAPI, InferActions, InferAdditionalFromClient, BetterAuthClientPlugin, IsSignal } from './types.js';
|
|
5
5
|
import { Accessor } from 'solid-js';
|
|
6
|
-
import './index-
|
|
6
|
+
import './index-C-bU-Qee.js';
|
|
7
7
|
import 'kysely';
|
|
8
8
|
import './index-CT4RHCuS.js';
|
|
9
9
|
import 'arctic';
|
package/dist/svelte-kit.d.ts
CHANGED
package/dist/svelte.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import * as nanostores from 'nanostores';
|
|
|
3
3
|
import * as _better_fetch_fetch from '@better-fetch/fetch';
|
|
4
4
|
import { U as UnionToIntersection, P as Prettify, S as StripEmptyObjects } from './helper-DPDj8Nix.js';
|
|
5
5
|
import { ClientOptions, InferClientAPI, InferActions, InferAdditionalFromClient, BetterAuthClientPlugin, IsSignal } from './types.js';
|
|
6
|
-
import './index-
|
|
6
|
+
import './index-C-bU-Qee.js';
|
|
7
7
|
import 'kysely';
|
|
8
8
|
import './index-CT4RHCuS.js';
|
|
9
9
|
import 'arctic';
|
package/dist/types.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { c as BetterAuthPlugin, a as Auth, F as FieldAttribute, I as InferFieldOutput } from './index-
|
|
2
|
-
export { A as Adapter, b as AuthContext, B as BetterAuthOptions, G as GenericEndpointContext, H as HookEndpointContext, j as InferPluginTypes, i as InferSession, h as InferUser, P as PluginSchema, R as RateLimit, S as SessionAdapter, W as Where, k as init } from './index-
|
|
1
|
+
import { c as BetterAuthPlugin, a as Auth, F as FieldAttribute, I as InferFieldOutput } from './index-C-bU-Qee.js';
|
|
2
|
+
export { A as Adapter, b as AuthContext, B as BetterAuthOptions, G as GenericEndpointContext, H as HookEndpointContext, j as InferPluginTypes, i as InferSession, h as InferUser, P as PluginSchema, R as RateLimit, S as SessionAdapter, W as Where, k as init } from './index-C-bU-Qee.js';
|
|
3
3
|
import { U as UnionToIntersection, H as HasRequiredKeys, P as Prettify, S as StripEmptyObjects, L as LiteralString } from './helper-DPDj8Nix.js';
|
|
4
4
|
export { D as DeepPartial, a as LiteralUnion, R as RequiredKeysOf, W as WithoutEmpty } from './helper-DPDj8Nix.js';
|
|
5
5
|
import { S as Session, U as User } from './index-CT4RHCuS.js';
|
package/dist/vue.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import * as _better_fetch_fetch from '@better-fetch/fetch';
|
|
|
3
3
|
import { U as UnionToIntersection, P as Prettify, S as StripEmptyObjects } from './helper-DPDj8Nix.js';
|
|
4
4
|
import { ClientOptions, InferClientAPI, InferActions, InferAdditionalFromClient, BetterAuthClientPlugin, IsSignal } from './types.js';
|
|
5
5
|
import { Ref, DeepReadonly } from 'vue';
|
|
6
|
-
import './index-
|
|
6
|
+
import './index-C-bU-Qee.js';
|
|
7
7
|
import 'kysely';
|
|
8
8
|
import './index-CT4RHCuS.js';
|
|
9
9
|
import 'arctic';
|