better-auth 1.6.26 → 1.6.28
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/index.d.mts +6 -1
- package/dist/api/dispatch.d.mts +1 -0
- package/dist/api/index.d.mts +508 -505
- package/dist/api/middlewares/authorization.d.mts +10 -14
- package/dist/api/middlewares/authorization.mjs +1 -2
- package/dist/api/middlewares/index.d.mts +1 -2
- package/dist/api/middlewares/origin-check.d.mts +5 -3
- package/dist/api/routes/account.d.mts +16 -13
- package/dist/api/routes/callback.d.mts +3 -1
- package/dist/api/routes/email-verification.d.mts +8 -4
- package/dist/api/routes/error.d.mts +3 -1
- package/dist/api/routes/index.d.mts +1 -2
- package/dist/api/routes/ok.d.mts +3 -1
- package/dist/api/routes/password.d.mts +10 -8
- package/dist/api/routes/session.d.mts +32 -30
- package/dist/api/routes/session.mjs +2 -3
- package/dist/api/routes/sign-in.d.mts +5 -3
- package/dist/api/routes/sign-out.d.mts +3 -1
- package/dist/api/routes/sign-up.d.mts +4 -3
- package/dist/api/routes/update-session.d.mts +5 -4
- package/dist/api/routes/update-user.d.mts +19 -18
- package/dist/auth/full.d.mts +1 -1
- package/dist/auth/minimal.d.mts +1 -1
- package/dist/client/config.d.mts +14 -12
- package/dist/client/config.mjs +2 -2
- package/dist/client/equality.d.mts +1 -0
- package/dist/client/index.d.mts +5 -6
- package/dist/client/lynx/index.d.mts +5 -4
- package/dist/client/lynx/lynx-store.d.mts +2 -1
- package/dist/client/parser.d.mts +3 -7
- package/dist/client/path-to-object.d.mts +4 -3
- package/dist/client/plugins/index.d.mts +1 -1
- package/dist/client/plugins/infer-plugin.d.mts +1 -0
- package/dist/client/query.d.mts +1 -0
- package/dist/client/react/index.d.mts +5 -4
- package/dist/client/react/react-store.d.mts +2 -1
- package/dist/client/session-atom.mjs +59 -46
- package/dist/client/session-refresh.d.mts +1 -0
- package/dist/client/solid/index.d.mts +5 -4
- package/dist/client/svelte/index.d.mts +5 -4
- package/dist/client/types.d.mts +2 -2
- package/dist/client/vanilla.d.mts +2 -1
- package/dist/client/vue/index.d.mts +5 -4
- package/dist/context/create-context.mjs +3 -3
- package/dist/context/helpers.mjs +2 -2
- package/dist/cookies/index.d.mts +7 -6
- package/dist/cookies/session-store.d.mts +0 -1
- package/dist/cookies/session-store.mjs +1 -2
- package/dist/crypto/index.d.mts +9 -2
- package/dist/crypto/jwt.d.mts +1 -0
- package/dist/crypto/password.d.mts +5 -1
- package/dist/db/adapter-base.d.mts +1 -0
- package/dist/db/adapter-kysely.d.mts +1 -0
- package/dist/db/field-converter.d.mts +1 -0
- package/dist/db/field.d.mts +10 -9
- package/dist/db/get-migration.d.mts +1 -0
- package/dist/db/get-schema.d.mts +1 -0
- package/dist/db/internal-adapter.d.mts +1 -0
- package/dist/db/internal-adapter.mjs +1 -2
- package/dist/db/revoke-unproven-account-access.d.mts +1 -0
- package/dist/db/schema.d.mts +2 -2
- package/dist/db/to-zod.d.mts +7 -3
- package/dist/db/with-hooks.d.mts +1 -0
- package/dist/index.d.mts +3 -4
- package/dist/integrations/next-js.d.mts +7 -4
- package/dist/integrations/node.d.mts +3 -2
- package/dist/integrations/svelte-kit.d.mts +9 -2
- package/dist/integrations/tanstack-start-solid.d.mts +5 -2
- package/dist/integrations/tanstack-start.d.mts +5 -2
- package/dist/oauth2/link-account.d.mts +1 -1
- package/dist/oauth2/state.d.mts +1 -0
- package/dist/oauth2/utils.d.mts +1 -0
- package/dist/package.mjs +1 -1
- package/dist/plugins/access/access.d.mts +1 -0
- package/dist/plugins/access/types.d.mts +5 -4
- package/dist/plugins/additional-fields/client.d.mts +1 -0
- package/dist/plugins/admin/access/statement.d.mts +0 -1
- package/dist/plugins/admin/admin.d.mts +137 -132
- package/dist/plugins/admin/client.d.mts +30 -30
- package/dist/plugins/admin/client.mjs +1 -1
- package/dist/plugins/admin/error-codes.d.mts +25 -23
- package/dist/plugins/admin/index.d.mts +1 -1
- package/dist/plugins/admin/schema.d.mts +1 -1
- package/dist/plugins/admin/types.d.mts +2 -3
- package/dist/plugins/anonymous/client.d.mts +11 -9
- package/dist/plugins/anonymous/client.mjs +1 -1
- package/dist/plugins/anonymous/error-codes.d.mts +10 -8
- package/dist/plugins/anonymous/index.d.mts +19 -15
- package/dist/plugins/anonymous/types.d.mts +1 -1
- package/dist/plugins/bearer/index.d.mts +8 -5
- package/dist/plugins/captcha/index.d.mts +8 -5
- package/dist/plugins/captcha/types.d.mts +1 -0
- package/dist/plugins/custom-session/client.d.mts +1 -0
- package/dist/plugins/custom-session/index.d.mts +12 -7
- package/dist/plugins/device-authorization/client.d.mts +1 -0
- package/dist/plugins/device-authorization/index.d.mts +22 -19
- package/dist/plugins/email-otp/client.d.mts +6 -4
- package/dist/plugins/email-otp/client.mjs +1 -1
- package/dist/plugins/email-otp/error-codes.d.mts +5 -3
- package/dist/plugins/email-otp/index.d.mts +76 -69
- package/dist/plugins/email-otp/types.d.mts +1 -0
- package/dist/plugins/generic-oauth/client.d.mts +11 -10
- package/dist/plugins/generic-oauth/client.mjs +1 -1
- package/dist/plugins/generic-oauth/error-codes.d.mts +10 -8
- package/dist/plugins/generic-oauth/index.d.mts +45 -41
- package/dist/plugins/generic-oauth/providers/auth0.d.mts +1 -0
- package/dist/plugins/generic-oauth/providers/gumroad.d.mts +1 -0
- package/dist/plugins/generic-oauth/providers/hubspot.d.mts +1 -0
- package/dist/plugins/generic-oauth/providers/index.d.mts +1 -2
- package/dist/plugins/generic-oauth/providers/keycloak.d.mts +1 -0
- package/dist/plugins/generic-oauth/providers/line.d.mts +1 -0
- package/dist/plugins/generic-oauth/providers/microsoft-entra-id.d.mts +1 -0
- package/dist/plugins/generic-oauth/providers/okta.d.mts +1 -0
- package/dist/plugins/generic-oauth/providers/patreon.d.mts +1 -0
- package/dist/plugins/generic-oauth/providers/slack.d.mts +1 -0
- package/dist/plugins/generic-oauth/providers/yandex.d.mts +1 -0
- package/dist/plugins/generic-oauth/types.d.mts +2 -1
- package/dist/plugins/haveibeenpwned/index.d.mts +6 -3
- package/dist/plugins/index.d.mts +1 -4
- package/dist/plugins/jwt/client.d.mts +2 -1
- package/dist/plugins/jwt/index.d.mts +12 -9
- package/dist/plugins/jwt/sign.d.mts +2 -2
- package/dist/plugins/jwt/types.d.mts +1 -1
- package/dist/plugins/jwt/utils.d.mts +4 -2
- package/dist/plugins/jwt/verify.d.mts +1 -0
- package/dist/plugins/last-login-method/index.d.mts +6 -3
- package/dist/plugins/magic-link/client.d.mts +1 -0
- package/dist/plugins/magic-link/index.d.mts +6 -4
- package/dist/plugins/mcp/client/adapters.d.mts +1 -0
- package/dist/plugins/mcp/client/index.mjs +2 -4
- package/dist/plugins/mcp/index.d.mts +12 -11
- package/dist/plugins/multi-session/client.d.mts +4 -2
- package/dist/plugins/multi-session/client.mjs +1 -1
- package/dist/plugins/multi-session/error-codes.d.mts +3 -1
- package/dist/plugins/multi-session/index.d.mts +12 -8
- package/dist/plugins/oauth-popup/client.d.mts +12 -6
- package/dist/plugins/oauth-popup/client.mjs +3 -5
- package/dist/plugins/oauth-popup/error-codes.d.mts +6 -4
- package/dist/plugins/oauth-popup/index.d.mts +12 -8
- package/dist/plugins/oauth-popup/index.mjs +1 -1
- package/dist/plugins/oauth-popup/types.d.mts +2 -1
- package/dist/plugins/oauth-proxy/index.d.mts +9 -6
- package/dist/plugins/oauth-proxy/index.mjs +2 -2
- package/dist/plugins/oidc-provider/client.d.mts +2 -1
- package/dist/plugins/oidc-provider/index.d.mts +20 -18
- package/dist/plugins/oidc-provider/schema.d.mts +1 -0
- package/dist/plugins/oidc-provider/types.d.mts +1 -1
- package/dist/plugins/one-tap/client.d.mts +3 -1
- package/dist/plugins/one-tap/index.d.mts +3 -1
- package/dist/plugins/one-time-token/client.d.mts +2 -1
- package/dist/plugins/one-time-token/index.d.mts +7 -6
- package/dist/plugins/open-api/generator.d.mts +1 -0
- package/dist/plugins/open-api/generator.mjs +5 -5
- package/dist/plugins/open-api/index.d.mts +5 -3
- package/dist/plugins/organization/access/statement.d.mts +0 -1
- package/dist/plugins/organization/adapter.d.mts +82 -56
- package/dist/plugins/organization/client.d.mts +103 -104
- package/dist/plugins/organization/client.mjs +4 -7
- package/dist/plugins/organization/error-codes.d.mts +61 -59
- package/dist/plugins/organization/has-permission.d.mts +1 -0
- package/dist/plugins/organization/has-permission.mjs +1 -1
- package/dist/plugins/organization/index.d.mts +1 -1
- package/dist/plugins/organization/organization.d.mts +33 -9
- package/dist/plugins/organization/organization.mjs +1 -1
- package/dist/plugins/organization/permission.d.mts +2 -2
- package/dist/plugins/organization/routes/crud-access-control.d.mts +147 -27
- package/dist/plugins/organization/routes/crud-invites.d.mts +186 -65
- package/dist/plugins/organization/routes/crud-invites.mjs +1 -1
- package/dist/plugins/organization/routes/crud-members.d.mts +178 -56
- package/dist/plugins/organization/routes/crud-members.mjs +1 -1
- package/dist/plugins/organization/routes/crud-org.d.mts +130 -57
- package/dist/plugins/organization/routes/crud-team.d.mts +235 -66
- package/dist/plugins/organization/schema.d.mts +4 -4
- package/dist/plugins/organization/schema.mjs +1 -1
- package/dist/plugins/organization/types.d.mts +14 -14
- package/dist/plugins/phone-number/client.d.mts +15 -13
- package/dist/plugins/phone-number/client.mjs +1 -1
- package/dist/plugins/phone-number/error-codes.d.mts +14 -12
- package/dist/plugins/phone-number/index.d.mts +47 -41
- package/dist/plugins/phone-number/types.d.mts +1 -1
- package/dist/plugins/siwe/client.d.mts +1 -0
- package/dist/plugins/siwe/index.d.mts +5 -4
- package/dist/plugins/test-utils/index.d.mts +4 -2
- package/dist/plugins/test-utils/types.d.mts +0 -1
- package/dist/plugins/two-factor/backup-codes/index.d.mts +7 -5
- package/dist/plugins/two-factor/backup-codes/index.mjs +1 -1
- package/dist/plugins/two-factor/client.d.mts +15 -12
- package/dist/plugins/two-factor/client.mjs +1 -1
- package/dist/plugins/two-factor/error-code.d.mts +12 -10
- package/dist/plugins/two-factor/index.d.mts +36 -32
- package/dist/plugins/two-factor/otp/index.d.mts +4 -2
- package/dist/plugins/two-factor/totp/index.d.mts +7 -5
- package/dist/plugins/two-factor/types.d.mts +1 -1
- package/dist/plugins/username/client.d.mts +11 -9
- package/dist/plugins/username/client.mjs +1 -1
- package/dist/plugins/username/error-codes.d.mts +10 -8
- package/dist/plugins/username/index.d.mts +22 -17
- package/dist/plugins/username/schema.d.mts +5 -3
- package/dist/state.d.mts +1 -0
- package/dist/test-utils/test-instance.d.mts +3 -5
- package/dist/types/adapter.d.mts +1 -1
- package/dist/types/api.d.mts +2 -1
- package/dist/types/auth.d.mts +1 -0
- package/dist/types/helper.d.mts +5 -5
- package/dist/types/index.d.mts +2 -2
- package/dist/types/models.d.mts +1 -0
- package/dist/types/plugins.d.mts +3 -2
- package/dist/utils/index.d.mts +1 -2
- package/dist/utils/url.d.mts +1 -0
- package/package.json +12 -11
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
import { FieldAttributeToObject, InferAdditionalFieldsFromPluginOptions, RemoveFieldsWithReturnedFalse } from "../../../db/field.mjs";
|
|
2
2
|
import { Role } from "../../access/types.mjs";
|
|
3
|
-
import "../../../db/index.mjs";
|
|
4
3
|
import { OrganizationOptions } from "../types.mjs";
|
|
5
4
|
import { InferOrganizationRolesFromOption } from "../schema.mjs";
|
|
6
|
-
import "../../index.mjs";
|
|
7
5
|
import { defaultRoles } from "../access/statement.mjs";
|
|
6
|
+
import * as _$_better_auth_core0 from "@better-auth/core";
|
|
8
7
|
import { LiteralString } from "@better-auth/core";
|
|
8
|
+
import * as _$_better_auth_core_db0 from "@better-auth/core/db";
|
|
9
|
+
import * as _$better_call0 from "better-call";
|
|
9
10
|
import * as z from "zod";
|
|
11
|
+
|
|
10
12
|
//#region src/plugins/organization/routes/crud-members.d.ts
|
|
11
|
-
declare const addMember: <O extends OrganizationOptions>(option: O) =>
|
|
13
|
+
declare const addMember: <O extends OrganizationOptions>(option: O) => _$better_call0.StrictEndpoint<string, {
|
|
12
14
|
method: "POST";
|
|
13
15
|
body: z.ZodObject<{
|
|
14
16
|
userId: z.ZodCoercedString<unknown>;
|
|
@@ -16,12 +18,12 @@ declare const addMember: <O extends OrganizationOptions>(option: O) => import("b
|
|
|
16
18
|
organizationId: z.ZodOptional<z.ZodString>;
|
|
17
19
|
teamId: z.ZodOptional<z.ZodString>;
|
|
18
20
|
}, z.core.$strip>;
|
|
19
|
-
use: (
|
|
21
|
+
use: _$better_call0.Middleware<_$better_call0.MiddlewareOptions, (inputContext: _$better_call0.MiddlewareInputContext<_$better_call0.MiddlewareOptions>) => Promise<{
|
|
20
22
|
orgOptions: OrganizationOptions;
|
|
21
23
|
roles: typeof defaultRoles & {
|
|
22
24
|
[key: string]: Role<{}>;
|
|
23
25
|
};
|
|
24
|
-
getSession: (context:
|
|
26
|
+
getSession: (context: _$_better_auth_core0.GenericEndpointContext) => Promise<{
|
|
25
27
|
session: {
|
|
26
28
|
id: string;
|
|
27
29
|
createdAt: Date;
|
|
@@ -45,7 +47,7 @@ declare const addMember: <O extends OrganizationOptions>(option: O) => import("b
|
|
|
45
47
|
image?: string | null | undefined;
|
|
46
48
|
};
|
|
47
49
|
}>;
|
|
48
|
-
}
|
|
50
|
+
}>>[];
|
|
49
51
|
metadata: {
|
|
50
52
|
$Infer: {
|
|
51
53
|
body: {
|
|
@@ -72,19 +74,19 @@ declare const addMember: <O extends OrganizationOptions>(option: O) => import("b
|
|
|
72
74
|
role: string;
|
|
73
75
|
createdAt: Date;
|
|
74
76
|
} & InferAdditionalFieldsFromPluginOptions<"member", O, false>>;
|
|
75
|
-
declare const removeMember: <O extends OrganizationOptions>(options: O) =>
|
|
77
|
+
declare const removeMember: <O extends OrganizationOptions>(options: O) => _$better_call0.StrictEndpoint<"/organization/remove-member", {
|
|
76
78
|
method: "POST";
|
|
77
79
|
body: z.ZodObject<{
|
|
78
80
|
memberIdOrEmail: z.ZodString;
|
|
79
81
|
organizationId: z.ZodOptional<z.ZodString>;
|
|
80
82
|
}, z.core.$strip>;
|
|
81
83
|
requireHeaders: true;
|
|
82
|
-
use: ((
|
|
84
|
+
use: (_$better_call0.Middleware<_$better_call0.MiddlewareOptions, (inputContext: _$better_call0.MiddlewareInputContext<_$better_call0.MiddlewareOptions>) => Promise<{
|
|
83
85
|
orgOptions: OrganizationOptions;
|
|
84
86
|
roles: typeof defaultRoles & {
|
|
85
87
|
[key: string]: Role<{}>;
|
|
86
88
|
};
|
|
87
|
-
getSession: (context:
|
|
89
|
+
getSession: (context: _$_better_auth_core0.GenericEndpointContext) => Promise<{
|
|
88
90
|
session: {
|
|
89
91
|
id: string;
|
|
90
92
|
createdAt: Date;
|
|
@@ -108,8 +110,8 @@ declare const removeMember: <O extends OrganizationOptions>(options: O) => impor
|
|
|
108
110
|
image?: string | null | undefined;
|
|
109
111
|
};
|
|
110
112
|
}>;
|
|
111
|
-
}
|
|
112
|
-
use: (
|
|
113
|
+
}>> | _$better_call0.Middleware<{
|
|
114
|
+
use: _$better_call0.Middleware<_$better_call0.MiddlewareOptions, (inputContext: _$better_call0.MiddlewareInputContext<_$better_call0.MiddlewareOptions>) => Promise<{
|
|
113
115
|
session: {
|
|
114
116
|
session: Record<string, any> & {
|
|
115
117
|
id: string;
|
|
@@ -131,7 +133,31 @@ declare const removeMember: <O extends OrganizationOptions>(options: O) => impor
|
|
|
131
133
|
image?: string | null | undefined;
|
|
132
134
|
};
|
|
133
135
|
};
|
|
134
|
-
}
|
|
136
|
+
}>>[];
|
|
137
|
+
}, (inputContext: _$better_call0.MiddlewareInputContext<{
|
|
138
|
+
use: _$better_call0.Middleware<_$better_call0.MiddlewareOptions, (inputContext: _$better_call0.MiddlewareInputContext<_$better_call0.MiddlewareOptions>) => Promise<{
|
|
139
|
+
session: {
|
|
140
|
+
session: Record<string, any> & {
|
|
141
|
+
id: string;
|
|
142
|
+
createdAt: Date;
|
|
143
|
+
updatedAt: Date;
|
|
144
|
+
userId: string;
|
|
145
|
+
expiresAt: Date;
|
|
146
|
+
token: string;
|
|
147
|
+
ipAddress?: string | null | undefined;
|
|
148
|
+
userAgent?: string | null | undefined;
|
|
149
|
+
};
|
|
150
|
+
user: Record<string, any> & {
|
|
151
|
+
id: string;
|
|
152
|
+
createdAt: Date;
|
|
153
|
+
updatedAt: Date;
|
|
154
|
+
email: string;
|
|
155
|
+
emailVerified: boolean;
|
|
156
|
+
name: string;
|
|
157
|
+
image?: string | null | undefined;
|
|
158
|
+
};
|
|
159
|
+
};
|
|
160
|
+
}>>[];
|
|
135
161
|
}>) => Promise<{
|
|
136
162
|
session: {
|
|
137
163
|
session: {
|
|
@@ -157,7 +183,7 @@ declare const removeMember: <O extends OrganizationOptions>(options: O) => impor
|
|
|
157
183
|
image?: string | null | undefined;
|
|
158
184
|
};
|
|
159
185
|
};
|
|
160
|
-
}
|
|
186
|
+
}>>)[];
|
|
161
187
|
metadata: {
|
|
162
188
|
openapi: {
|
|
163
189
|
description: string;
|
|
@@ -226,23 +252,23 @@ declare const removeMember: <O extends OrganizationOptions>(options: O) => impor
|
|
|
226
252
|
};
|
|
227
253
|
}) & (O["schema"] extends {
|
|
228
254
|
member?: {
|
|
229
|
-
additionalFields: infer Field extends Record<string,
|
|
255
|
+
additionalFields: infer Field extends Record<string, _$_better_auth_core_db0.DBFieldAttribute>;
|
|
230
256
|
} | undefined;
|
|
231
|
-
} ? FieldAttributeToObject<RemoveFieldsWithReturnedFalse<Field>> : {}) extends
|
|
257
|
+
} ? FieldAttributeToObject<RemoveFieldsWithReturnedFalse<Field>> : {}) extends infer T ? { [K in keyof T]: T[K] } : never;
|
|
232
258
|
}>;
|
|
233
|
-
declare const updateMemberRole: <O extends OrganizationOptions>(option: O) =>
|
|
259
|
+
declare const updateMemberRole: <O extends OrganizationOptions>(option: O) => _$better_call0.StrictEndpoint<"/organization/update-member-role", {
|
|
234
260
|
method: "POST";
|
|
235
261
|
body: z.ZodObject<{
|
|
236
262
|
role: z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>;
|
|
237
263
|
memberId: z.ZodString;
|
|
238
264
|
organizationId: z.ZodOptional<z.ZodString>;
|
|
239
265
|
}, z.core.$strip>;
|
|
240
|
-
use: ((
|
|
266
|
+
use: (_$better_call0.Middleware<_$better_call0.MiddlewareOptions, (inputContext: _$better_call0.MiddlewareInputContext<_$better_call0.MiddlewareOptions>) => Promise<{
|
|
241
267
|
orgOptions: OrganizationOptions;
|
|
242
268
|
roles: typeof defaultRoles & {
|
|
243
269
|
[key: string]: Role<{}>;
|
|
244
270
|
};
|
|
245
|
-
getSession: (context:
|
|
271
|
+
getSession: (context: _$_better_auth_core0.GenericEndpointContext) => Promise<{
|
|
246
272
|
session: {
|
|
247
273
|
id: string;
|
|
248
274
|
createdAt: Date;
|
|
@@ -266,8 +292,8 @@ declare const updateMemberRole: <O extends OrganizationOptions>(option: O) => im
|
|
|
266
292
|
image?: string | null | undefined;
|
|
267
293
|
};
|
|
268
294
|
}>;
|
|
269
|
-
}
|
|
270
|
-
use: (
|
|
295
|
+
}>> | _$better_call0.Middleware<{
|
|
296
|
+
use: _$better_call0.Middleware<_$better_call0.MiddlewareOptions, (inputContext: _$better_call0.MiddlewareInputContext<_$better_call0.MiddlewareOptions>) => Promise<{
|
|
271
297
|
session: {
|
|
272
298
|
session: Record<string, any> & {
|
|
273
299
|
id: string;
|
|
@@ -289,7 +315,31 @@ declare const updateMemberRole: <O extends OrganizationOptions>(option: O) => im
|
|
|
289
315
|
image?: string | null | undefined;
|
|
290
316
|
};
|
|
291
317
|
};
|
|
292
|
-
}
|
|
318
|
+
}>>[];
|
|
319
|
+
}, (inputContext: _$better_call0.MiddlewareInputContext<{
|
|
320
|
+
use: _$better_call0.Middleware<_$better_call0.MiddlewareOptions, (inputContext: _$better_call0.MiddlewareInputContext<_$better_call0.MiddlewareOptions>) => Promise<{
|
|
321
|
+
session: {
|
|
322
|
+
session: Record<string, any> & {
|
|
323
|
+
id: string;
|
|
324
|
+
createdAt: Date;
|
|
325
|
+
updatedAt: Date;
|
|
326
|
+
userId: string;
|
|
327
|
+
expiresAt: Date;
|
|
328
|
+
token: string;
|
|
329
|
+
ipAddress?: string | null | undefined;
|
|
330
|
+
userAgent?: string | null | undefined;
|
|
331
|
+
};
|
|
332
|
+
user: Record<string, any> & {
|
|
333
|
+
id: string;
|
|
334
|
+
createdAt: Date;
|
|
335
|
+
updatedAt: Date;
|
|
336
|
+
email: string;
|
|
337
|
+
emailVerified: boolean;
|
|
338
|
+
name: string;
|
|
339
|
+
image?: string | null | undefined;
|
|
340
|
+
};
|
|
341
|
+
};
|
|
342
|
+
}>>[];
|
|
293
343
|
}>) => Promise<{
|
|
294
344
|
session: {
|
|
295
345
|
session: {
|
|
@@ -315,7 +365,7 @@ declare const updateMemberRole: <O extends OrganizationOptions>(option: O) => im
|
|
|
315
365
|
image?: string | null | undefined;
|
|
316
366
|
};
|
|
317
367
|
};
|
|
318
|
-
}
|
|
368
|
+
}>>)[];
|
|
319
369
|
requireHeaders: true;
|
|
320
370
|
metadata: {
|
|
321
371
|
$Infer: {
|
|
@@ -379,14 +429,14 @@ declare const updateMemberRole: <O extends OrganizationOptions>(option: O) => im
|
|
|
379
429
|
image?: string | undefined;
|
|
380
430
|
};
|
|
381
431
|
}>;
|
|
382
|
-
declare const getActiveMember: <O extends OrganizationOptions>(options: O) =>
|
|
432
|
+
declare const getActiveMember: <O extends OrganizationOptions>(options: O) => _$better_call0.StrictEndpoint<"/organization/get-active-member", {
|
|
383
433
|
method: "GET";
|
|
384
|
-
use: ((
|
|
434
|
+
use: (_$better_call0.Middleware<_$better_call0.MiddlewareOptions, (inputContext: _$better_call0.MiddlewareInputContext<_$better_call0.MiddlewareOptions>) => Promise<{
|
|
385
435
|
orgOptions: OrganizationOptions;
|
|
386
436
|
roles: typeof defaultRoles & {
|
|
387
437
|
[key: string]: Role<{}>;
|
|
388
438
|
};
|
|
389
|
-
getSession: (context:
|
|
439
|
+
getSession: (context: _$_better_auth_core0.GenericEndpointContext) => Promise<{
|
|
390
440
|
session: {
|
|
391
441
|
id: string;
|
|
392
442
|
createdAt: Date;
|
|
@@ -410,8 +460,8 @@ declare const getActiveMember: <O extends OrganizationOptions>(options: O) => im
|
|
|
410
460
|
image?: string | null | undefined;
|
|
411
461
|
};
|
|
412
462
|
}>;
|
|
413
|
-
}
|
|
414
|
-
use: (
|
|
463
|
+
}>> | _$better_call0.Middleware<{
|
|
464
|
+
use: _$better_call0.Middleware<_$better_call0.MiddlewareOptions, (inputContext: _$better_call0.MiddlewareInputContext<_$better_call0.MiddlewareOptions>) => Promise<{
|
|
415
465
|
session: {
|
|
416
466
|
session: Record<string, any> & {
|
|
417
467
|
id: string;
|
|
@@ -433,7 +483,31 @@ declare const getActiveMember: <O extends OrganizationOptions>(options: O) => im
|
|
|
433
483
|
image?: string | null | undefined;
|
|
434
484
|
};
|
|
435
485
|
};
|
|
436
|
-
}
|
|
486
|
+
}>>[];
|
|
487
|
+
}, (inputContext: _$better_call0.MiddlewareInputContext<{
|
|
488
|
+
use: _$better_call0.Middleware<_$better_call0.MiddlewareOptions, (inputContext: _$better_call0.MiddlewareInputContext<_$better_call0.MiddlewareOptions>) => Promise<{
|
|
489
|
+
session: {
|
|
490
|
+
session: Record<string, any> & {
|
|
491
|
+
id: string;
|
|
492
|
+
createdAt: Date;
|
|
493
|
+
updatedAt: Date;
|
|
494
|
+
userId: string;
|
|
495
|
+
expiresAt: Date;
|
|
496
|
+
token: string;
|
|
497
|
+
ipAddress?: string | null | undefined;
|
|
498
|
+
userAgent?: string | null | undefined;
|
|
499
|
+
};
|
|
500
|
+
user: Record<string, any> & {
|
|
501
|
+
id: string;
|
|
502
|
+
createdAt: Date;
|
|
503
|
+
updatedAt: Date;
|
|
504
|
+
email: string;
|
|
505
|
+
emailVerified: boolean;
|
|
506
|
+
name: string;
|
|
507
|
+
image?: string | null | undefined;
|
|
508
|
+
};
|
|
509
|
+
};
|
|
510
|
+
}>>[];
|
|
437
511
|
}>) => Promise<{
|
|
438
512
|
session: {
|
|
439
513
|
session: {
|
|
@@ -459,7 +533,7 @@ declare const getActiveMember: <O extends OrganizationOptions>(options: O) => im
|
|
|
459
533
|
image?: string | null | undefined;
|
|
460
534
|
};
|
|
461
535
|
};
|
|
462
|
-
}
|
|
536
|
+
}>>)[];
|
|
463
537
|
requireHeaders: true;
|
|
464
538
|
metadata: {
|
|
465
539
|
openapi: {
|
|
@@ -522,9 +596,9 @@ declare const getActiveMember: <O extends OrganizationOptions>(options: O) => im
|
|
|
522
596
|
};
|
|
523
597
|
}) & (O["schema"] extends {
|
|
524
598
|
member?: {
|
|
525
|
-
additionalFields: infer Field extends Record<string,
|
|
599
|
+
additionalFields: infer Field extends Record<string, _$_better_auth_core_db0.DBFieldAttribute>;
|
|
526
600
|
} | undefined;
|
|
527
|
-
} ? FieldAttributeToObject<Field> : {}) extends
|
|
601
|
+
} ? FieldAttributeToObject<Field> : {}) extends infer T ? { [K in keyof T]: T[K] } : never) & {
|
|
528
602
|
user: {
|
|
529
603
|
id: string;
|
|
530
604
|
createdAt: Date;
|
|
@@ -542,13 +616,13 @@ declare const getActiveMember: <O extends OrganizationOptions>(options: O) => im
|
|
|
542
616
|
image: string | undefined;
|
|
543
617
|
};
|
|
544
618
|
}>;
|
|
545
|
-
declare const leaveOrganization: <O extends OrganizationOptions>(options: O) =>
|
|
619
|
+
declare const leaveOrganization: <O extends OrganizationOptions>(options: O) => _$better_call0.StrictEndpoint<"/organization/leave", {
|
|
546
620
|
method: "POST";
|
|
547
621
|
body: z.ZodObject<{
|
|
548
622
|
organizationId: z.ZodString;
|
|
549
623
|
}, z.core.$strip>;
|
|
550
624
|
requireHeaders: true;
|
|
551
|
-
use: ((
|
|
625
|
+
use: (_$better_call0.Middleware<_$better_call0.MiddlewareOptions, (inputContext: _$better_call0.MiddlewareInputContext<_$better_call0.MiddlewareOptions>) => Promise<{
|
|
552
626
|
session: {
|
|
553
627
|
session: Record<string, any> & {
|
|
554
628
|
id: string;
|
|
@@ -570,12 +644,12 @@ declare const leaveOrganization: <O extends OrganizationOptions>(options: O) =>
|
|
|
570
644
|
image?: string | null | undefined;
|
|
571
645
|
};
|
|
572
646
|
};
|
|
573
|
-
}
|
|
647
|
+
}>> | _$better_call0.Middleware<_$better_call0.MiddlewareOptions, (inputContext: _$better_call0.MiddlewareInputContext<_$better_call0.MiddlewareOptions>) => Promise<{
|
|
574
648
|
orgOptions: OrganizationOptions;
|
|
575
649
|
roles: typeof defaultRoles & {
|
|
576
650
|
[key: string]: Role<{}>;
|
|
577
651
|
};
|
|
578
|
-
getSession: (context:
|
|
652
|
+
getSession: (context: _$_better_auth_core0.GenericEndpointContext) => Promise<{
|
|
579
653
|
session: {
|
|
580
654
|
id: string;
|
|
581
655
|
createdAt: Date;
|
|
@@ -599,7 +673,7 @@ declare const leaveOrganization: <O extends OrganizationOptions>(options: O) =>
|
|
|
599
673
|
image?: string | null | undefined;
|
|
600
674
|
};
|
|
601
675
|
}>;
|
|
602
|
-
}
|
|
676
|
+
}>>)[];
|
|
603
677
|
}, Omit<((O["teams"] extends {
|
|
604
678
|
enabled: true;
|
|
605
679
|
} ? {
|
|
@@ -629,9 +703,9 @@ declare const leaveOrganization: <O extends OrganizationOptions>(options: O) =>
|
|
|
629
703
|
};
|
|
630
704
|
}) & (O["schema"] extends {
|
|
631
705
|
member?: {
|
|
632
|
-
additionalFields: infer Field extends Record<string,
|
|
706
|
+
additionalFields: infer Field extends Record<string, _$_better_auth_core_db0.DBFieldAttribute>;
|
|
633
707
|
} | undefined;
|
|
634
|
-
} ? FieldAttributeToObject<Field> : {}) extends
|
|
708
|
+
} ? FieldAttributeToObject<Field> : {}) extends infer T ? { [K in keyof T]: T[K] } : never) & {
|
|
635
709
|
user: {
|
|
636
710
|
id: string;
|
|
637
711
|
createdAt: Date;
|
|
@@ -649,7 +723,7 @@ declare const leaveOrganization: <O extends OrganizationOptions>(options: O) =>
|
|
|
649
723
|
image: string | undefined;
|
|
650
724
|
};
|
|
651
725
|
}>;
|
|
652
|
-
declare const listMembers: <O extends OrganizationOptions>(options: O) =>
|
|
726
|
+
declare const listMembers: <O extends OrganizationOptions>(options: O) => _$better_call0.StrictEndpoint<"/organization/list-members", {
|
|
653
727
|
method: "GET";
|
|
654
728
|
query: z.ZodOptional<z.ZodObject<{
|
|
655
729
|
limit: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNumber]>>;
|
|
@@ -678,12 +752,12 @@ declare const listMembers: <O extends OrganizationOptions>(options: O) => import
|
|
|
678
752
|
organizationSlug: z.ZodOptional<z.ZodString>;
|
|
679
753
|
}, z.core.$strip>>;
|
|
680
754
|
requireHeaders: true;
|
|
681
|
-
use: ((
|
|
755
|
+
use: (_$better_call0.Middleware<_$better_call0.MiddlewareOptions, (inputContext: _$better_call0.MiddlewareInputContext<_$better_call0.MiddlewareOptions>) => Promise<{
|
|
682
756
|
orgOptions: OrganizationOptions;
|
|
683
757
|
roles: typeof defaultRoles & {
|
|
684
758
|
[key: string]: Role<{}>;
|
|
685
759
|
};
|
|
686
|
-
getSession: (context:
|
|
760
|
+
getSession: (context: _$_better_auth_core0.GenericEndpointContext) => Promise<{
|
|
687
761
|
session: {
|
|
688
762
|
id: string;
|
|
689
763
|
createdAt: Date;
|
|
@@ -707,8 +781,32 @@ declare const listMembers: <O extends OrganizationOptions>(options: O) => import
|
|
|
707
781
|
image?: string | null | undefined;
|
|
708
782
|
};
|
|
709
783
|
}>;
|
|
710
|
-
}
|
|
711
|
-
use: (
|
|
784
|
+
}>> | _$better_call0.Middleware<{
|
|
785
|
+
use: _$better_call0.Middleware<_$better_call0.MiddlewareOptions, (inputContext: _$better_call0.MiddlewareInputContext<_$better_call0.MiddlewareOptions>) => Promise<{
|
|
786
|
+
session: {
|
|
787
|
+
session: Record<string, any> & {
|
|
788
|
+
id: string;
|
|
789
|
+
createdAt: Date;
|
|
790
|
+
updatedAt: Date;
|
|
791
|
+
userId: string;
|
|
792
|
+
expiresAt: Date;
|
|
793
|
+
token: string;
|
|
794
|
+
ipAddress?: string | null | undefined;
|
|
795
|
+
userAgent?: string | null | undefined;
|
|
796
|
+
};
|
|
797
|
+
user: Record<string, any> & {
|
|
798
|
+
id: string;
|
|
799
|
+
createdAt: Date;
|
|
800
|
+
updatedAt: Date;
|
|
801
|
+
email: string;
|
|
802
|
+
emailVerified: boolean;
|
|
803
|
+
name: string;
|
|
804
|
+
image?: string | null | undefined;
|
|
805
|
+
};
|
|
806
|
+
};
|
|
807
|
+
}>>[];
|
|
808
|
+
}, (inputContext: _$better_call0.MiddlewareInputContext<{
|
|
809
|
+
use: _$better_call0.Middleware<_$better_call0.MiddlewareOptions, (inputContext: _$better_call0.MiddlewareInputContext<_$better_call0.MiddlewareOptions>) => Promise<{
|
|
712
810
|
session: {
|
|
713
811
|
session: Record<string, any> & {
|
|
714
812
|
id: string;
|
|
@@ -730,7 +828,7 @@ declare const listMembers: <O extends OrganizationOptions>(options: O) => import
|
|
|
730
828
|
image?: string | null | undefined;
|
|
731
829
|
};
|
|
732
830
|
};
|
|
733
|
-
}
|
|
831
|
+
}>>[];
|
|
734
832
|
}>) => Promise<{
|
|
735
833
|
session: {
|
|
736
834
|
session: {
|
|
@@ -756,7 +854,7 @@ declare const listMembers: <O extends OrganizationOptions>(options: O) => import
|
|
|
756
854
|
image?: string | null | undefined;
|
|
757
855
|
};
|
|
758
856
|
};
|
|
759
|
-
}
|
|
857
|
+
}>>)[];
|
|
760
858
|
}, {
|
|
761
859
|
members: (((O["teams"] extends {
|
|
762
860
|
enabled: true;
|
|
@@ -787,9 +885,9 @@ declare const listMembers: <O extends OrganizationOptions>(options: O) => import
|
|
|
787
885
|
};
|
|
788
886
|
}) & (O["schema"] extends {
|
|
789
887
|
member?: {
|
|
790
|
-
additionalFields: infer Field extends Record<string,
|
|
888
|
+
additionalFields: infer Field extends Record<string, _$_better_auth_core_db0.DBFieldAttribute>;
|
|
791
889
|
} | undefined;
|
|
792
|
-
} ? FieldAttributeToObject<Field> : {}) extends
|
|
890
|
+
} ? FieldAttributeToObject<Field> : {}) extends infer T ? { [K in keyof T]: T[K] } : never) & {
|
|
793
891
|
user: {
|
|
794
892
|
id: string;
|
|
795
893
|
name: string;
|
|
@@ -799,7 +897,7 @@ declare const listMembers: <O extends OrganizationOptions>(options: O) => import
|
|
|
799
897
|
})[];
|
|
800
898
|
total: number;
|
|
801
899
|
}>;
|
|
802
|
-
declare const getActiveMemberRole: <O extends OrganizationOptions>(options: O) =>
|
|
900
|
+
declare const getActiveMemberRole: <O extends OrganizationOptions>(options: O) => _$better_call0.StrictEndpoint<"/organization/get-active-member-role", {
|
|
803
901
|
method: "GET";
|
|
804
902
|
query: z.ZodOptional<z.ZodObject<{
|
|
805
903
|
userId: z.ZodOptional<z.ZodString>;
|
|
@@ -807,12 +905,12 @@ declare const getActiveMemberRole: <O extends OrganizationOptions>(options: O) =
|
|
|
807
905
|
organizationSlug: z.ZodOptional<z.ZodString>;
|
|
808
906
|
}, z.core.$strip>>;
|
|
809
907
|
requireHeaders: true;
|
|
810
|
-
use: ((
|
|
908
|
+
use: (_$better_call0.Middleware<_$better_call0.MiddlewareOptions, (inputContext: _$better_call0.MiddlewareInputContext<_$better_call0.MiddlewareOptions>) => Promise<{
|
|
811
909
|
orgOptions: OrganizationOptions;
|
|
812
910
|
roles: typeof defaultRoles & {
|
|
813
911
|
[key: string]: Role<{}>;
|
|
814
912
|
};
|
|
815
|
-
getSession: (context:
|
|
913
|
+
getSession: (context: _$_better_auth_core0.GenericEndpointContext) => Promise<{
|
|
816
914
|
session: {
|
|
817
915
|
id: string;
|
|
818
916
|
createdAt: Date;
|
|
@@ -836,8 +934,32 @@ declare const getActiveMemberRole: <O extends OrganizationOptions>(options: O) =
|
|
|
836
934
|
image?: string | null | undefined;
|
|
837
935
|
};
|
|
838
936
|
}>;
|
|
839
|
-
}
|
|
840
|
-
use: (
|
|
937
|
+
}>> | _$better_call0.Middleware<{
|
|
938
|
+
use: _$better_call0.Middleware<_$better_call0.MiddlewareOptions, (inputContext: _$better_call0.MiddlewareInputContext<_$better_call0.MiddlewareOptions>) => Promise<{
|
|
939
|
+
session: {
|
|
940
|
+
session: Record<string, any> & {
|
|
941
|
+
id: string;
|
|
942
|
+
createdAt: Date;
|
|
943
|
+
updatedAt: Date;
|
|
944
|
+
userId: string;
|
|
945
|
+
expiresAt: Date;
|
|
946
|
+
token: string;
|
|
947
|
+
ipAddress?: string | null | undefined;
|
|
948
|
+
userAgent?: string | null | undefined;
|
|
949
|
+
};
|
|
950
|
+
user: Record<string, any> & {
|
|
951
|
+
id: string;
|
|
952
|
+
createdAt: Date;
|
|
953
|
+
updatedAt: Date;
|
|
954
|
+
email: string;
|
|
955
|
+
emailVerified: boolean;
|
|
956
|
+
name: string;
|
|
957
|
+
image?: string | null | undefined;
|
|
958
|
+
};
|
|
959
|
+
};
|
|
960
|
+
}>>[];
|
|
961
|
+
}, (inputContext: _$better_call0.MiddlewareInputContext<{
|
|
962
|
+
use: _$better_call0.Middleware<_$better_call0.MiddlewareOptions, (inputContext: _$better_call0.MiddlewareInputContext<_$better_call0.MiddlewareOptions>) => Promise<{
|
|
841
963
|
session: {
|
|
842
964
|
session: Record<string, any> & {
|
|
843
965
|
id: string;
|
|
@@ -859,7 +981,7 @@ declare const getActiveMemberRole: <O extends OrganizationOptions>(options: O) =
|
|
|
859
981
|
image?: string | null | undefined;
|
|
860
982
|
};
|
|
861
983
|
};
|
|
862
|
-
}
|
|
984
|
+
}>>[];
|
|
863
985
|
}>) => Promise<{
|
|
864
986
|
session: {
|
|
865
987
|
session: {
|
|
@@ -885,7 +1007,7 @@ declare const getActiveMemberRole: <O extends OrganizationOptions>(options: O) =
|
|
|
885
1007
|
image?: string | null | undefined;
|
|
886
1008
|
};
|
|
887
1009
|
};
|
|
888
|
-
}
|
|
1010
|
+
}>>)[];
|
|
889
1011
|
}, {
|
|
890
1012
|
role: (((O["teams"] extends {
|
|
891
1013
|
enabled: true;
|
|
@@ -916,9 +1038,9 @@ declare const getActiveMemberRole: <O extends OrganizationOptions>(options: O) =
|
|
|
916
1038
|
};
|
|
917
1039
|
}) & (O["schema"] extends {
|
|
918
1040
|
member?: {
|
|
919
|
-
additionalFields: infer Field extends Record<string,
|
|
1041
|
+
additionalFields: infer Field extends Record<string, _$_better_auth_core_db0.DBFieldAttribute>;
|
|
920
1042
|
} | undefined;
|
|
921
|
-
} ? FieldAttributeToObject<Field> : {}) extends
|
|
1043
|
+
} ? FieldAttributeToObject<Field> : {}) extends infer T ? { [K in keyof T]: T[K] } : never) & {
|
|
922
1044
|
user: {
|
|
923
1045
|
id: string;
|
|
924
1046
|
createdAt: Date;
|
|
@@ -258,7 +258,7 @@ const updateMemberRole = (option) => createAuthEndpoint("/organization/update-me
|
|
|
258
258
|
const adapter = getOrgAdapter(ctx.context, ctx.context.orgOptions);
|
|
259
259
|
const roleToSet = (Array.isArray(ctx.body.role) ? ctx.body.role : [ctx.body.role]).flatMap((role) => role.split(",")).map((role) => role.trim()).filter(Boolean);
|
|
260
260
|
if (roleToSet.length === 0) throw APIError.fromStatus("BAD_REQUEST");
|
|
261
|
-
const validStaticRoles =
|
|
261
|
+
const validStaticRoles = new Set([...Object.keys(defaultRoles), ...Object.keys(ctx.context.orgOptions.roles || {})]);
|
|
262
262
|
const unknownRoles = roleToSet.filter((role) => !validStaticRoles.has(role));
|
|
263
263
|
if (unknownRoles.length > 0) if (ctx.context.orgOptions.dynamicAccessControl?.enabled) {
|
|
264
264
|
const foundRoleNames = (await ctx.context.adapter.findMany({
|