better-auth 0.4.9-beta.8 → 0.4.9-beta.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/adapters/drizzle.d.ts +1 -1
- package/dist/adapters/mongodb.d.ts +1 -1
- package/dist/adapters/mongodb.js +14 -4
- package/dist/adapters/prisma.d.ts +1 -1
- package/dist/adapters/prisma.js +7 -1
- package/dist/api.d.ts +1 -1
- package/dist/api.js +2 -2
- package/dist/client/plugins.d.ts +3 -3
- package/dist/client.d.ts +1 -1
- package/dist/{index-D9nYnMiJ.d.ts → index-7R4SuAdU.d.ts} +1 -1
- package/dist/{index-DyhG32S0.d.ts → index-BQ_rbsXC.d.ts} +14 -4
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -2
- 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/adapters/mongodb.js
CHANGED
|
@@ -80,15 +80,25 @@ var mongodbAdapter = (mongo) => {
|
|
|
80
80
|
async update(data) {
|
|
81
81
|
const { model, where, update } = data;
|
|
82
82
|
const wheres = whereConvertor(where);
|
|
83
|
-
|
|
83
|
+
if (where.length === 1) {
|
|
84
|
+
const res2 = await db.collection(model).findOneAndUpdate(
|
|
85
|
+
//@ts-expect-error
|
|
86
|
+
wheres,
|
|
87
|
+
{
|
|
88
|
+
$set: update
|
|
89
|
+
},
|
|
90
|
+
{ returnDocument: "after" }
|
|
91
|
+
);
|
|
92
|
+
return removeMongoId(res2);
|
|
93
|
+
}
|
|
94
|
+
const res = await db.collection(model).updateMany(
|
|
84
95
|
//@ts-expect-error
|
|
85
96
|
wheres,
|
|
86
97
|
{
|
|
87
98
|
$set: update
|
|
88
|
-
}
|
|
89
|
-
{ returnDocument: "after" }
|
|
99
|
+
}
|
|
90
100
|
);
|
|
91
|
-
return
|
|
101
|
+
return {};
|
|
92
102
|
},
|
|
93
103
|
async delete(data) {
|
|
94
104
|
const { model, where } = data;
|
package/dist/adapters/prisma.js
CHANGED
|
@@ -81,7 +81,13 @@ var prismaAdapter = (prisma, {
|
|
|
81
81
|
async update(data) {
|
|
82
82
|
const { model, where, update } = data;
|
|
83
83
|
const whereClause = whereConvertor(where);
|
|
84
|
-
|
|
84
|
+
if (where.length === 1) {
|
|
85
|
+
return await db[model].update({
|
|
86
|
+
where: whereClause,
|
|
87
|
+
data: update
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
return await db[model].updateMany({
|
|
85
91
|
where: whereClause,
|
|
86
92
|
data: update
|
|
87
93
|
});
|
package/dist/api.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { e as AuthEndpoint, f as AuthMiddleware, v as callbackOAuth, T as changePassword, d as createAuthEndpoint, c as createAuthMiddleware, M as createEmailVerificationToken, $ as csrfMiddleware, V as deleteUser, Y as error, J as forgetPassword, K as forgetPasswordCallback, X as getCSRFToken, r as getEndpoints, w as getSession, x as getSessionFromCtx, z as listSessions, Z as ok, o as optionsMiddleware, L as resetPassword, C as revokeSession, D as revokeSessions, s as router, N as sendVerificationEmail, y as sessionMiddleware, U as setPassword, u as signInEmail, t as signInOAuth, E as signOut, _ as signUpEmail, Q as updateUser, O as verifyEmail } from './index-
|
|
1
|
+
export { e as AuthEndpoint, f as AuthMiddleware, v as callbackOAuth, T as changePassword, d as createAuthEndpoint, c as createAuthMiddleware, M as createEmailVerificationToken, $ as csrfMiddleware, V as deleteUser, Y as error, J as forgetPassword, K as forgetPasswordCallback, X as getCSRFToken, r as getEndpoints, w as getSession, x as getSessionFromCtx, z as listSessions, Z as ok, o as optionsMiddleware, L as resetPassword, C as revokeSession, D as revokeSessions, s as router, N as sendVerificationEmail, y as sessionMiddleware, U as setPassword, u as signInEmail, t as signInOAuth, E as signOut, _ as signUpEmail, Q as updateUser, O as verifyEmail } from './index-BQ_rbsXC.js';
|
|
2
2
|
import './helper-DPDj8Nix.js';
|
|
3
3
|
import 'zod';
|
|
4
4
|
export { APIError } from 'better-call';
|
package/dist/api.js
CHANGED
|
@@ -2599,7 +2599,7 @@ function getEndpoints(ctx, options) {
|
|
|
2599
2599
|
};
|
|
2600
2600
|
let api = {};
|
|
2601
2601
|
for (const [key, value] of Object.entries(endpoints)) {
|
|
2602
|
-
api[key] = async (context) => {
|
|
2602
|
+
api[key] = async (context = {}) => {
|
|
2603
2603
|
let c = await ctx;
|
|
2604
2604
|
for (const plugin of options.plugins || []) {
|
|
2605
2605
|
if (plugin.hooks?.before) {
|
|
@@ -2614,7 +2614,7 @@ function getEndpoints(ctx, options) {
|
|
|
2614
2614
|
...context,
|
|
2615
2615
|
context: {
|
|
2616
2616
|
...c,
|
|
2617
|
-
...context
|
|
2617
|
+
...context?.context
|
|
2618
2618
|
}
|
|
2619
2619
|
});
|
|
2620
2620
|
if (hookRes && "context" in hookRes) {
|
package/dist/client/plugins.d.ts
CHANGED
|
@@ -2,10 +2,10 @@ 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, k as Organization, M as Member, I as Invitation, u as username, m as magicLink, d as phoneNumber, e as anonymous, i as admin, j as genericOAuth } from '../index-
|
|
6
|
-
export { g as getPasskeyActions, c as passkeyClient, a as twoFactorClient } from '../index-
|
|
5
|
+
import { o as organization, k as Organization, M as Member, I as Invitation, u as username, m as magicLink, d as phoneNumber, e as anonymous, i as admin, j as genericOAuth } from '../index-7R4SuAdU.js';
|
|
6
|
+
export { g as getPasskeyActions, c as passkeyClient, a as twoFactorClient } from '../index-7R4SuAdU.js';
|
|
7
7
|
import { P as Prettify } from '../helper-DPDj8Nix.js';
|
|
8
|
-
import { F as FieldAttribute, B as BetterAuthOptions, b as BetterAuthPlugin } from '../index-
|
|
8
|
+
import { F as FieldAttribute, B as BetterAuthOptions, b as BetterAuthPlugin } from '../index-BQ_rbsXC.js';
|
|
9
9
|
import '../types-IzAbV4nB.js';
|
|
10
10
|
import 'zod';
|
|
11
11
|
import 'better-call';
|
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-BQ_rbsXC.js';
|
|
10
10
|
import 'kysely';
|
|
11
11
|
import './types-IzAbV4nB.js';
|
|
12
12
|
import 'better-call';
|
|
@@ -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, g as AuthContext } from './index-
|
|
8
|
+
import { H as HookEndpointContext, g as AuthContext } from './index-BQ_rbsXC.js';
|
|
9
9
|
import * as nanostores from 'nanostores';
|
|
10
10
|
import { atom } from 'nanostores';
|
|
11
11
|
import * as _simplewebauthn_types from '@simplewebauthn/types';
|
|
@@ -488,7 +488,7 @@ type BetterAuthPlugin = {
|
|
|
488
488
|
*/
|
|
489
489
|
type Where = {
|
|
490
490
|
operator?: "eq" | "ne" | "lt" | "lte" | "gt" | "gte";
|
|
491
|
-
value: string;
|
|
491
|
+
value: string | number | boolean;
|
|
492
492
|
field: string;
|
|
493
493
|
connector?: "AND" | "OR";
|
|
494
494
|
};
|
|
@@ -517,6 +517,10 @@ interface Adapter {
|
|
|
517
517
|
};
|
|
518
518
|
offset?: number;
|
|
519
519
|
}) => Promise<T[]>;
|
|
520
|
+
/**
|
|
521
|
+
* ⚠︎ Update may not return the updated data
|
|
522
|
+
* if multiple where clauses are provided
|
|
523
|
+
*/
|
|
520
524
|
update: <T>(data: {
|
|
521
525
|
model: string;
|
|
522
526
|
where: Where[];
|
|
@@ -3388,7 +3392,9 @@ declare function getEndpoints<C extends AuthContext, Option extends BetterAuthOp
|
|
|
3388
3392
|
method: better_call.Method | better_call.Method[];
|
|
3389
3393
|
headers: Headers;
|
|
3390
3394
|
};
|
|
3391
|
-
} & UnionToIntersection<Option["plugins"] extends (infer T)[] ? T extends BetterAuthPlugin ? T
|
|
3395
|
+
} & UnionToIntersection<Option["plugins"] extends (infer T)[] ? T extends BetterAuthPlugin ? T extends {
|
|
3396
|
+
endpoints: infer E;
|
|
3397
|
+
} ? E : {} : {} : {}>;
|
|
3392
3398
|
middlewares: {
|
|
3393
3399
|
path: string;
|
|
3394
3400
|
middleware: Endpoint;
|
|
@@ -4477,7 +4483,9 @@ declare const router: <C extends AuthContext, Option extends BetterAuthOptions>(
|
|
|
4477
4483
|
method: better_call.Method | better_call.Method[];
|
|
4478
4484
|
headers: Headers;
|
|
4479
4485
|
};
|
|
4480
|
-
} & UnionToIntersection<Option["plugins"] extends (infer T)[] ? T extends BetterAuthPlugin ? T
|
|
4486
|
+
} & UnionToIntersection<Option["plugins"] extends (infer T)[] ? T extends BetterAuthPlugin ? T extends {
|
|
4487
|
+
endpoints: infer E;
|
|
4488
|
+
} ? E : {} : {} : {}>;
|
|
4481
4489
|
};
|
|
4482
4490
|
|
|
4483
4491
|
type InferAPI<API> = Omit<API, API extends {
|
|
@@ -5568,7 +5576,9 @@ declare const betterAuth: <O extends BetterAuthOptions>(options: O) => {
|
|
|
5568
5576
|
method: better_call.Method | better_call.Method[];
|
|
5569
5577
|
headers: Headers;
|
|
5570
5578
|
};
|
|
5571
|
-
} & UnionToIntersection<O["plugins"] extends (infer T)[] ? T extends BetterAuthPlugin ? T
|
|
5579
|
+
} & UnionToIntersection<O["plugins"] extends (infer T)[] ? T extends BetterAuthPlugin ? T extends {
|
|
5580
|
+
endpoints: infer E;
|
|
5581
|
+
} ? E : {} : {} : {}>>;
|
|
5572
5582
|
options: O;
|
|
5573
5583
|
$Infer: {
|
|
5574
5584
|
Session: {
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -2705,7 +2705,7 @@ function getEndpoints(ctx, options) {
|
|
|
2705
2705
|
};
|
|
2706
2706
|
let api = {};
|
|
2707
2707
|
for (const [key, value] of Object.entries(endpoints)) {
|
|
2708
|
-
api[key] = async (context) => {
|
|
2708
|
+
api[key] = async (context = {}) => {
|
|
2709
2709
|
let c = await ctx;
|
|
2710
2710
|
for (const plugin of options.plugins || []) {
|
|
2711
2711
|
if (plugin.hooks?.before) {
|
|
@@ -2720,7 +2720,7 @@ function getEndpoints(ctx, options) {
|
|
|
2720
2720
|
...context,
|
|
2721
2721
|
context: {
|
|
2722
2722
|
...c,
|
|
2723
|
-
...context
|
|
2723
|
+
...context?.context
|
|
2724
2724
|
}
|
|
2725
2725
|
});
|
|
2726
2726
|
if (hookRes && "context" in hookRes) {
|
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, f as UserWithRole, i as admin, h as adminMiddleware, e as anonymous, j as genericOAuth, 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, f as UserWithRole, i as admin, h as adminMiddleware, e as anonymous, j as genericOAuth, 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-7R4SuAdU.js';
|
|
2
2
|
export { i as ac } from './index-DfAHOgpj.js';
|
|
3
|
-
import { H as HookEndpointContext } from './index-
|
|
4
|
-
export { e as AuthEndpoint, f as AuthMiddleware, b as BetterAuthPlugin, P as PluginSchema, d as createAuthEndpoint, c as createAuthMiddleware, o as optionsMiddleware } from './index-
|
|
3
|
+
import { H as HookEndpointContext } from './index-BQ_rbsXC.js';
|
|
4
|
+
export { e as AuthEndpoint, f as AuthMiddleware, b as BetterAuthPlugin, P as PluginSchema, d as createAuthEndpoint, c as createAuthMiddleware, o as optionsMiddleware } from './index-BQ_rbsXC.js';
|
|
5
5
|
import './types-IzAbV4nB.js';
|
|
6
6
|
import 'zod';
|
|
7
7
|
import './helper-DPDj8Nix.js';
|
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-BQ_rbsXC.js';
|
|
7
7
|
import 'kysely';
|
|
8
8
|
import './types-IzAbV4nB.js';
|
|
9
9
|
import 'better-call';
|
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-BQ_rbsXC.js';
|
|
7
7
|
import 'kysely';
|
|
8
8
|
import './types-IzAbV4nB.js';
|
|
9
9
|
import 'better-call';
|
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-BQ_rbsXC.js';
|
|
7
7
|
import 'kysely';
|
|
8
8
|
import './types-IzAbV4nB.js';
|
|
9
9
|
import 'better-call';
|
package/dist/types.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { b as BetterAuthPlugin, a as Auth, I as InferFieldsInputClient, h as InferFieldsOutput } from './index-
|
|
2
|
-
export { A as Adapter, k as AdditionalSessionFieldsInput, l as AdditionalSessionFieldsOutput, i as AdditionalUserFieldsInput, j as AdditionalUserFieldsOutput, g as AuthContext, B as BetterAuthOptions, G as GenericEndpointContext, H as HookEndpointContext, p as InferPluginTypes, n as InferSession, m as InferUser, P as PluginSchema, R as RateLimit, S as SecondaryStorage, W as Where, q as init } from './index-
|
|
1
|
+
import { b as BetterAuthPlugin, a as Auth, I as InferFieldsInputClient, h as InferFieldsOutput } from './index-BQ_rbsXC.js';
|
|
2
|
+
export { A as Adapter, k as AdditionalSessionFieldsInput, l as AdditionalSessionFieldsOutput, i as AdditionalUserFieldsInput, j as AdditionalUserFieldsOutput, g as AuthContext, B as BetterAuthOptions, G as GenericEndpointContext, H as HookEndpointContext, p as InferPluginTypes, n as InferSession, m as InferUser, P as PluginSchema, R as RateLimit, S as SecondaryStorage, W as Where, q as init } from './index-BQ_rbsXC.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 './types-IzAbV4nB.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-BQ_rbsXC.js';
|
|
7
7
|
import 'kysely';
|
|
8
8
|
import './types-IzAbV4nB.js';
|
|
9
9
|
import 'better-call';
|