better-auth 0.3.5-beta.2 → 0.3.5-beta.4
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/client/plugins.d.ts
CHANGED
|
@@ -2,8 +2,8 @@ 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-DrWKVr9E.js';
|
|
6
|
+
export { g as getPasskeyActions, c as passkeyClient, a as twoFactorClient } from '../index-DrWKVr9E.js';
|
|
7
7
|
import { P as Prettify } from '../helper-DPDj8Nix.js';
|
|
8
8
|
import { F as FieldAttribute, B as BetterAuthOptions, b as BetterAuthPlugin } from '../index-DUQYmBZY.js';
|
|
9
9
|
import '../index-QaO4zgiz.js';
|
|
@@ -843,10 +843,10 @@ declare const organization: <O extends OrganizationOptions>(options?: O) => {
|
|
|
843
843
|
organizationId: string;
|
|
844
844
|
role: "member" | "admin" | "owner";
|
|
845
845
|
}[];
|
|
846
|
-
id
|
|
847
|
-
name
|
|
848
|
-
createdAt
|
|
849
|
-
slug
|
|
846
|
+
id: string;
|
|
847
|
+
name: string;
|
|
848
|
+
createdAt: Date;
|
|
849
|
+
slug: string;
|
|
850
850
|
metadata?: any;
|
|
851
851
|
logo?: string | undefined;
|
|
852
852
|
} | null>;
|
|
@@ -1031,10 +1031,10 @@ declare const organization: <O extends OrganizationOptions>(options?: O) => {
|
|
|
1031
1031
|
organizationId: string;
|
|
1032
1032
|
role: "member" | "admin" | "owner";
|
|
1033
1033
|
}[];
|
|
1034
|
-
id
|
|
1035
|
-
name
|
|
1036
|
-
createdAt
|
|
1037
|
-
slug
|
|
1034
|
+
id: string;
|
|
1035
|
+
name: string;
|
|
1036
|
+
createdAt: Date;
|
|
1037
|
+
slug: string;
|
|
1038
1038
|
metadata?: any;
|
|
1039
1039
|
logo?: string | undefined;
|
|
1040
1040
|
} | null>;
|
package/dist/plugins.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
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-DrWKVr9E.js';
|
|
2
2
|
export { i as ac } from './index-DfAHOgpj.js';
|
|
3
3
|
import { H as HookEndpointContext } from './index-DUQYmBZY.js';
|
|
4
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-DUQYmBZY.js';
|
package/dist/plugins.js
CHANGED
|
@@ -2654,69 +2654,69 @@ var getOrgAdapter = (adapter, options) => {
|
|
|
2654
2654
|
* @requires db
|
|
2655
2655
|
*/
|
|
2656
2656
|
findFullOrganization: async (orgId, db) => {
|
|
2657
|
-
|
|
2658
|
-
|
|
2659
|
-
|
|
2660
|
-
|
|
2661
|
-
|
|
2662
|
-
|
|
2663
|
-
|
|
2664
|
-
|
|
2665
|
-
|
|
2666
|
-
|
|
2667
|
-
|
|
2668
|
-
model: "invitation",
|
|
2669
|
-
where: [
|
|
2670
|
-
{
|
|
2671
|
-
field: "organizationId",
|
|
2672
|
-
value: orgId
|
|
2673
|
-
}
|
|
2674
|
-
]
|
|
2675
|
-
});
|
|
2676
|
-
const members = await adapter.findMany({
|
|
2677
|
-
model: "member",
|
|
2678
|
-
where: [
|
|
2679
|
-
{
|
|
2680
|
-
field: "organizationId",
|
|
2681
|
-
value: orgId
|
|
2682
|
-
}
|
|
2683
|
-
]
|
|
2684
|
-
});
|
|
2685
|
-
const membersWithUsers = await Promise.all(
|
|
2686
|
-
members.map(async (member) => {
|
|
2687
|
-
const user = await adapter.findOne({
|
|
2688
|
-
model: "user",
|
|
2689
|
-
where: [
|
|
2690
|
-
{
|
|
2691
|
-
field: "id",
|
|
2692
|
-
value: member.userId
|
|
2693
|
-
}
|
|
2694
|
-
]
|
|
2695
|
-
});
|
|
2696
|
-
if (!user) {
|
|
2697
|
-
throw new BetterAuthError(
|
|
2698
|
-
"Unexpected error: User not found for member"
|
|
2699
|
-
);
|
|
2700
|
-
}
|
|
2701
|
-
return {
|
|
2702
|
-
...member,
|
|
2703
|
-
user: {
|
|
2704
|
-
id: user.id,
|
|
2705
|
-
name: user.name,
|
|
2706
|
-
email: user.email,
|
|
2707
|
-
image: user.image
|
|
2708
|
-
}
|
|
2709
|
-
};
|
|
2710
|
-
})
|
|
2711
|
-
);
|
|
2712
|
-
const fullOrg = {
|
|
2713
|
-
...org,
|
|
2714
|
-
invitations,
|
|
2715
|
-
members: membersWithUsers
|
|
2716
|
-
};
|
|
2717
|
-
return fullOrg;
|
|
2657
|
+
const org = await adapter.findOne({
|
|
2658
|
+
model: "organization",
|
|
2659
|
+
where: [
|
|
2660
|
+
{
|
|
2661
|
+
field: "id",
|
|
2662
|
+
value: orgId
|
|
2663
|
+
}
|
|
2664
|
+
]
|
|
2665
|
+
});
|
|
2666
|
+
if (!org) {
|
|
2667
|
+
return null;
|
|
2718
2668
|
}
|
|
2719
|
-
|
|
2669
|
+
const invitations = await adapter.findMany({
|
|
2670
|
+
model: "invitation",
|
|
2671
|
+
where: [
|
|
2672
|
+
{
|
|
2673
|
+
field: "organizationId",
|
|
2674
|
+
value: orgId
|
|
2675
|
+
}
|
|
2676
|
+
]
|
|
2677
|
+
});
|
|
2678
|
+
const members = await adapter.findMany({
|
|
2679
|
+
model: "member",
|
|
2680
|
+
where: [
|
|
2681
|
+
{
|
|
2682
|
+
field: "organizationId",
|
|
2683
|
+
value: orgId
|
|
2684
|
+
}
|
|
2685
|
+
]
|
|
2686
|
+
});
|
|
2687
|
+
const membersWithUsers = await Promise.all(
|
|
2688
|
+
members.map(async (member) => {
|
|
2689
|
+
const user = await adapter.findOne({
|
|
2690
|
+
model: "user",
|
|
2691
|
+
where: [
|
|
2692
|
+
{
|
|
2693
|
+
field: "id",
|
|
2694
|
+
value: member.userId
|
|
2695
|
+
}
|
|
2696
|
+
]
|
|
2697
|
+
});
|
|
2698
|
+
if (!user) {
|
|
2699
|
+
throw new BetterAuthError(
|
|
2700
|
+
"Unexpected error: User not found for member"
|
|
2701
|
+
);
|
|
2702
|
+
}
|
|
2703
|
+
return {
|
|
2704
|
+
...member,
|
|
2705
|
+
user: {
|
|
2706
|
+
id: user.id,
|
|
2707
|
+
name: user.name,
|
|
2708
|
+
email: user.email,
|
|
2709
|
+
image: user.image
|
|
2710
|
+
}
|
|
2711
|
+
};
|
|
2712
|
+
})
|
|
2713
|
+
);
|
|
2714
|
+
const fullOrg = {
|
|
2715
|
+
...org,
|
|
2716
|
+
invitations,
|
|
2717
|
+
members: membersWithUsers
|
|
2718
|
+
};
|
|
2719
|
+
return fullOrg;
|
|
2720
2720
|
},
|
|
2721
2721
|
listOrganizations: async (userId) => {
|
|
2722
2722
|
const members = await adapter.findMany({
|
|
@@ -5278,7 +5278,7 @@ var username = () => {
|
|
|
5278
5278
|
await ctx.context.password.hash(ctx.body.password);
|
|
5279
5279
|
ctx.context.logger.error("User not found", { username });
|
|
5280
5280
|
throw new APIError23("UNAUTHORIZED", {
|
|
5281
|
-
message: "Invalid
|
|
5281
|
+
message: "Invalid username or password"
|
|
5282
5282
|
});
|
|
5283
5283
|
}
|
|
5284
5284
|
const account = await ctx.context.adapter.findOne({
|
|
@@ -5296,7 +5296,7 @@ var username = () => {
|
|
|
5296
5296
|
});
|
|
5297
5297
|
if (!account) {
|
|
5298
5298
|
throw new APIError23("UNAUTHORIZED", {
|
|
5299
|
-
message: "Invalid
|
|
5299
|
+
message: "Invalid username or password"
|
|
5300
5300
|
});
|
|
5301
5301
|
}
|
|
5302
5302
|
const currentPassword = account?.password;
|
|
@@ -5313,7 +5313,7 @@ var username = () => {
|
|
|
5313
5313
|
if (!validPassword) {
|
|
5314
5314
|
ctx.context.logger.error("Invalid password");
|
|
5315
5315
|
throw new APIError23("UNAUTHORIZED", {
|
|
5316
|
-
message: "Invalid
|
|
5316
|
+
message: "Invalid username or password"
|
|
5317
5317
|
});
|
|
5318
5318
|
}
|
|
5319
5319
|
const session = await ctx.context.internalAdapter.createSession(
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "better-auth",
|
|
3
|
-
"version": "0.3.5-beta.
|
|
3
|
+
"version": "0.3.5-beta.4",
|
|
4
4
|
"description": "The most comprehensive authentication library for TypeScript.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -83,7 +83,7 @@
|
|
|
83
83
|
"@simplewebauthn/browser": "^10.0.0",
|
|
84
84
|
"@simplewebauthn/server": "^10.0.1",
|
|
85
85
|
"arctic": "2.0.0-next.9",
|
|
86
|
-
"better-call": "0.2.5-beta.
|
|
86
|
+
"better-call": "0.2.5-beta.5",
|
|
87
87
|
"c12": "^1.11.2",
|
|
88
88
|
"chalk": "^5.3.0",
|
|
89
89
|
"commander": "^12.1.0",
|