better-auth 1.6.23 → 1.6.25
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 +1 -6
- package/dist/api/dispatch.d.mts +0 -1
- package/dist/api/index.d.mts +476 -478
- package/dist/api/middlewares/authorization.d.mts +12 -8
- package/dist/api/middlewares/authorization.mjs +2 -1
- package/dist/api/middlewares/index.d.mts +2 -1
- package/dist/api/middlewares/origin-check.d.mts +3 -5
- package/dist/api/routes/account.d.mts +10 -13
- package/dist/api/routes/account.mjs +35 -7
- package/dist/api/routes/callback.d.mts +1 -3
- package/dist/api/routes/callback.mjs +4 -0
- package/dist/api/routes/email-verification.d.mts +4 -8
- package/dist/api/routes/email-verification.mjs +15 -2
- package/dist/api/routes/error.d.mts +1 -3
- package/dist/api/routes/index.d.mts +2 -1
- package/dist/api/routes/ok.d.mts +1 -3
- package/dist/api/routes/password.d.mts +7 -9
- package/dist/api/routes/password.mjs +14 -1
- package/dist/api/routes/session.d.mts +22 -24
- package/dist/api/routes/session.mjs +5 -1
- package/dist/api/routes/sign-in.d.mts +3 -5
- package/dist/api/routes/sign-in.mjs +84 -2
- package/dist/api/routes/sign-out.d.mts +1 -3
- package/dist/api/routes/sign-up.d.mts +3 -4
- package/dist/api/routes/sign-up.mjs +3 -2
- package/dist/api/routes/update-session.d.mts +3 -4
- package/dist/api/routes/update-user.d.mts +13 -14
- package/dist/api/routes/update-user.mjs +26 -1
- package/dist/auth/full.d.mts +1 -1
- package/dist/auth/minimal.d.mts +1 -1
- package/dist/client/config.d.mts +12 -14
- package/dist/client/config.mjs +2 -2
- package/dist/client/equality.d.mts +0 -1
- package/dist/client/index.d.mts +6 -5
- package/dist/client/lynx/index.d.mts +4 -5
- package/dist/client/lynx/lynx-store.d.mts +1 -2
- package/dist/client/parser.d.mts +7 -3
- package/dist/client/path-to-object.d.mts +3 -4
- package/dist/client/plugins/index.d.mts +1 -1
- package/dist/client/plugins/infer-plugin.d.mts +0 -1
- package/dist/client/query.d.mts +0 -1
- package/dist/client/query.mjs +38 -20
- package/dist/client/react/index.d.mts +4 -5
- package/dist/client/react/react-store.d.mts +1 -2
- package/dist/client/session-refresh.d.mts +0 -1
- package/dist/client/solid/index.d.mts +6 -6
- package/dist/client/solid/index.mjs +4 -2
- package/dist/client/svelte/index.d.mts +5 -6
- package/dist/client/types.d.mts +2 -2
- package/dist/client/vanilla.d.mts +2 -3
- package/dist/client/vue/index.d.mts +5 -6
- package/dist/context/create-context.mjs +3 -3
- package/dist/context/helpers.mjs +2 -2
- package/dist/cookies/cookie-utils.d.mts +1 -1
- package/dist/cookies/index.d.mts +6 -7
- package/dist/cookies/index.mjs +4 -0
- package/dist/cookies/session-store.d.mts +1 -0
- package/dist/cookies/session-store.mjs +6 -1
- package/dist/crypto/index.d.mts +2 -9
- package/dist/crypto/jwt.d.mts +0 -1
- package/dist/crypto/password.d.mts +1 -5
- package/dist/db/adapter-base.d.mts +0 -1
- package/dist/db/adapter-kysely.d.mts +0 -1
- package/dist/db/field-converter.d.mts +0 -1
- package/dist/db/field.d.mts +9 -10
- package/dist/db/get-migration.d.mts +0 -1
- package/dist/db/get-migration.mjs +8 -4
- package/dist/db/get-schema.d.mts +0 -1
- package/dist/db/internal-adapter.d.mts +0 -1
- package/dist/db/internal-adapter.mjs +61 -1
- package/dist/db/revoke-unproven-account-access.d.mts +0 -1
- package/dist/db/schema.d.mts +2 -2
- package/dist/db/to-zod.d.mts +3 -7
- package/dist/db/with-hooks.d.mts +0 -1
- package/dist/index.d.mts +4 -3
- package/dist/integrations/next-js.d.mts +4 -7
- package/dist/integrations/node.d.mts +2 -3
- package/dist/integrations/svelte-kit.d.mts +2 -9
- package/dist/integrations/tanstack-start-solid.d.mts +2 -5
- package/dist/integrations/tanstack-start.d.mts +2 -5
- package/dist/oauth2/link-account.d.mts +1 -1
- package/dist/oauth2/state.d.mts +0 -1
- package/dist/oauth2/utils.d.mts +0 -1
- package/dist/package.mjs +1 -1
- package/dist/plugins/access/access.d.mts +0 -1
- package/dist/plugins/access/types.d.mts +4 -5
- package/dist/plugins/additional-fields/client.d.mts +0 -1
- package/dist/plugins/admin/access/statement.d.mts +1 -0
- package/dist/plugins/admin/admin.d.mts +120 -125
- 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 +23 -25
- package/dist/plugins/admin/index.d.mts +1 -1
- package/dist/plugins/admin/routes.mjs +9 -0
- package/dist/plugins/admin/schema.d.mts +1 -1
- package/dist/plugins/admin/types.d.mts +3 -2
- package/dist/plugins/anonymous/client.d.mts +9 -11
- package/dist/plugins/anonymous/client.mjs +1 -1
- package/dist/plugins/anonymous/error-codes.d.mts +8 -10
- package/dist/plugins/anonymous/index.d.mts +14 -18
- package/dist/plugins/anonymous/types.d.mts +1 -1
- package/dist/plugins/bearer/index.d.mts +4 -7
- package/dist/plugins/captcha/index.d.mts +5 -8
- package/dist/plugins/captcha/types.d.mts +0 -1
- package/dist/plugins/custom-session/client.d.mts +0 -1
- package/dist/plugins/custom-session/index.d.mts +7 -12
- package/dist/plugins/device-authorization/client.d.mts +0 -1
- package/dist/plugins/device-authorization/index.d.mts +19 -22
- package/dist/plugins/email-otp/client.d.mts +4 -6
- package/dist/plugins/email-otp/client.mjs +1 -1
- package/dist/plugins/email-otp/error-codes.d.mts +3 -5
- package/dist/plugins/email-otp/index.d.mts +67 -73
- package/dist/plugins/email-otp/routes.mjs +2 -0
- package/dist/plugins/email-otp/types.d.mts +0 -1
- package/dist/plugins/generic-oauth/client.d.mts +10 -11
- package/dist/plugins/generic-oauth/client.mjs +1 -1
- package/dist/plugins/generic-oauth/error-codes.d.mts +8 -10
- package/dist/plugins/generic-oauth/index.d.mts +40 -44
- package/dist/plugins/generic-oauth/providers/auth0.d.mts +0 -1
- package/dist/plugins/generic-oauth/providers/gumroad.d.mts +0 -1
- package/dist/plugins/generic-oauth/providers/hubspot.d.mts +0 -1
- package/dist/plugins/generic-oauth/providers/index.d.mts +2 -1
- package/dist/plugins/generic-oauth/providers/keycloak.d.mts +0 -1
- package/dist/plugins/generic-oauth/providers/line.d.mts +0 -1
- package/dist/plugins/generic-oauth/providers/microsoft-entra-id.d.mts +0 -1
- package/dist/plugins/generic-oauth/providers/okta.d.mts +0 -1
- package/dist/plugins/generic-oauth/providers/patreon.d.mts +0 -1
- package/dist/plugins/generic-oauth/providers/slack.d.mts +0 -1
- package/dist/plugins/generic-oauth/providers/yandex.d.mts +0 -1
- package/dist/plugins/generic-oauth/routes.mjs +14 -0
- package/dist/plugins/generic-oauth/types.d.mts +1 -2
- package/dist/plugins/haveibeenpwned/index.d.mts +3 -6
- package/dist/plugins/index.d.mts +4 -1
- package/dist/plugins/jwt/client.d.mts +2 -4
- package/dist/plugins/jwt/index.d.mts +8 -11
- 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 +2 -4
- package/dist/plugins/jwt/verify.d.mts +0 -1
- package/dist/plugins/last-login-method/client.mjs +13 -0
- package/dist/plugins/last-login-method/index.d.mts +11 -5
- package/dist/plugins/last-login-method/index.mjs +8 -0
- package/dist/plugins/magic-link/client.d.mts +0 -1
- package/dist/plugins/magic-link/index.d.mts +4 -5
- package/dist/plugins/magic-link/index.mjs +32 -1
- package/dist/plugins/mcp/authorize.mjs +12 -0
- package/dist/plugins/mcp/client/adapters.d.mts +0 -1
- package/dist/plugins/mcp/client/index.d.mts +2 -0
- package/dist/plugins/mcp/client/index.mjs +36 -11
- package/dist/plugins/mcp/index.d.mts +10 -11
- package/dist/plugins/multi-session/client.d.mts +2 -4
- package/dist/plugins/multi-session/client.mjs +1 -1
- package/dist/plugins/multi-session/error-codes.d.mts +1 -3
- package/dist/plugins/multi-session/index.d.mts +7 -11
- package/dist/plugins/multi-session/index.mjs +45 -0
- package/dist/plugins/oauth-popup/client.d.mts +6 -12
- package/dist/plugins/oauth-popup/client.mjs +5 -3
- package/dist/plugins/oauth-popup/error-codes.d.mts +4 -6
- package/dist/plugins/oauth-popup/index.d.mts +8 -12
- package/dist/plugins/oauth-popup/index.mjs +1 -1
- package/dist/plugins/oauth-popup/types.d.mts +1 -2
- package/dist/plugins/oauth-proxy/index.d.mts +6 -9
- package/dist/plugins/oauth-proxy/index.mjs +2 -2
- package/dist/plugins/oidc-provider/authorize.mjs +9 -0
- package/dist/plugins/oidc-provider/client.d.mts +1 -2
- package/dist/plugins/oidc-provider/index.d.mts +15 -17
- package/dist/plugins/oidc-provider/index.mjs +26 -2
- package/dist/plugins/oidc-provider/schema.d.mts +0 -1
- package/dist/plugins/oidc-provider/schema.mjs +37 -0
- package/dist/plugins/oidc-provider/types.d.mts +1 -1
- package/dist/plugins/one-tap/client.d.mts +3 -6
- package/dist/plugins/one-tap/client.mjs +3 -0
- package/dist/plugins/one-tap/index.d.mts +1 -3
- package/dist/plugins/one-tap/index.mjs +6 -1
- package/dist/plugins/one-time-token/client.d.mts +1 -2
- package/dist/plugins/one-time-token/index.d.mts +5 -6
- package/dist/plugins/one-time-token/index.mjs +30 -0
- package/dist/plugins/open-api/generator.d.mts +0 -1
- package/dist/plugins/open-api/generator.mjs +81 -5
- package/dist/plugins/open-api/index.d.mts +3 -5
- package/dist/plugins/organization/access/statement.d.mts +1 -0
- package/dist/plugins/organization/adapter.d.mts +56 -82
- package/dist/plugins/organization/adapter.mjs +17 -3
- package/dist/plugins/organization/client.d.mts +106 -105
- package/dist/plugins/organization/client.mjs +7 -4
- package/dist/plugins/organization/error-codes.d.mts +59 -61
- package/dist/plugins/organization/has-permission.d.mts +0 -1
- 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 +7 -7
- package/dist/plugins/organization/organization.mjs +434 -1
- package/dist/plugins/organization/permission.d.mts +2 -2
- package/dist/plugins/organization/routes/crud-access-control.d.mts +17 -17
- package/dist/plugins/organization/routes/crud-invites.d.mts +53 -54
- package/dist/plugins/organization/routes/crud-invites.mjs +1 -1
- package/dist/plugins/organization/routes/crud-members.d.mts +44 -46
- package/dist/plugins/organization/routes/crud-members.mjs +4 -1
- package/dist/plugins/organization/routes/crud-org.d.mts +47 -48
- package/dist/plugins/organization/routes/crud-org.mjs +2 -2
- package/dist/plugins/organization/routes/crud-team.d.mts +50 -51
- package/dist/plugins/organization/schema.d.mts +4 -4
- package/dist/plugins/organization/schema.mjs +1 -1
- package/dist/plugins/organization/types.d.mts +16 -16
- package/dist/plugins/phone-number/client.d.mts +13 -15
- package/dist/plugins/phone-number/client.mjs +1 -1
- package/dist/plugins/phone-number/error-codes.d.mts +12 -14
- package/dist/plugins/phone-number/index.d.mts +41 -47
- package/dist/plugins/phone-number/routes.mjs +15 -0
- package/dist/plugins/phone-number/types.d.mts +1 -1
- package/dist/plugins/siwe/client.d.mts +0 -1
- package/dist/plugins/siwe/index.d.mts +4 -5
- package/dist/plugins/test-utils/index.d.mts +2 -4
- package/dist/plugins/test-utils/types.d.mts +1 -0
- package/dist/plugins/two-factor/backup-codes/index.d.mts +4 -6
- package/dist/plugins/two-factor/backup-codes/index.mjs +52 -1
- package/dist/plugins/two-factor/client.d.mts +12 -15
- package/dist/plugins/two-factor/client.mjs +1 -1
- package/dist/plugins/two-factor/error-code.d.mts +10 -12
- package/dist/plugins/two-factor/index.d.mts +27 -31
- package/dist/plugins/two-factor/index.mjs +30 -0
- package/dist/plugins/two-factor/otp/index.d.mts +2 -4
- package/dist/plugins/two-factor/otp/index.mjs +42 -1
- package/dist/plugins/two-factor/totp/index.d.mts +4 -6
- package/dist/plugins/two-factor/totp/index.mjs +47 -0
- package/dist/plugins/two-factor/types.d.mts +1 -1
- package/dist/plugins/username/client.d.mts +9 -11
- package/dist/plugins/username/client.mjs +1 -1
- package/dist/plugins/username/error-codes.d.mts +8 -10
- package/dist/plugins/username/index.d.mts +17 -22
- package/dist/plugins/username/schema.d.mts +3 -5
- package/dist/state.d.mts +0 -1
- package/dist/state.mjs +4 -0
- package/dist/test-utils/test-instance.d.mts +5 -3
- package/dist/test-utils/test-instance.mjs +4 -1
- package/dist/types/adapter.d.mts +1 -1
- package/dist/types/api.d.mts +1 -2
- package/dist/types/auth.d.mts +0 -1
- package/dist/types/helper.d.mts +5 -5
- package/dist/types/index.d.mts +2 -2
- package/dist/types/models.d.mts +0 -1
- package/dist/types/plugins.d.mts +2 -3
- package/dist/utils/index.d.mts +2 -1
- package/dist/utils/request.mjs +23 -0
- package/dist/utils/url.d.mts +0 -1
- package/package.json +11 -11
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import { FieldAttributeToObject, InferAdditionalFieldsFromPluginOptions, RemoveFieldsWithReturnedFalse } from "../../../db/field.mjs";
|
|
2
2
|
import { Role } from "../../access/types.mjs";
|
|
3
|
+
import "../../../db/index.mjs";
|
|
3
4
|
import { OrganizationOptions } from "../types.mjs";
|
|
4
5
|
import { InferOrganizationRolesFromOption, InvitationStatus } from "../schema.mjs";
|
|
6
|
+
import "../../index.mjs";
|
|
5
7
|
import { defaultRoles } from "../access/statement.mjs";
|
|
6
|
-
import
|
|
8
|
+
import "../index.mjs";
|
|
7
9
|
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";
|
|
10
10
|
import * as z from "zod";
|
|
11
|
-
|
|
12
11
|
//#region src/plugins/organization/routes/crud-invites.d.ts
|
|
13
12
|
type DynamicOrganizationRole<O extends OrganizationOptions> = O extends {
|
|
14
13
|
dynamicAccessControl: {
|
|
@@ -16,15 +15,15 @@ type DynamicOrganizationRole<O extends OrganizationOptions> = O extends {
|
|
|
16
15
|
};
|
|
17
16
|
} ? LiteralString : never;
|
|
18
17
|
type OrganizationInvitationRole<O extends OrganizationOptions> = InferOrganizationRolesFromOption<O> | DynamicOrganizationRole<O>;
|
|
19
|
-
declare const createInvitation: <O extends OrganizationOptions>(option: O) =>
|
|
18
|
+
declare const createInvitation: <O extends OrganizationOptions>(option: O) => import("better-call").StrictEndpoint<"/organization/invite-member", {
|
|
20
19
|
method: "POST";
|
|
21
20
|
requireHeaders: true;
|
|
22
|
-
use: (((inputContext:
|
|
21
|
+
use: (((inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<{
|
|
23
22
|
orgOptions: OrganizationOptions;
|
|
24
23
|
roles: typeof defaultRoles & {
|
|
25
24
|
[key: string]: Role<{}>;
|
|
26
25
|
};
|
|
27
|
-
getSession: (context:
|
|
26
|
+
getSession: (context: import("@better-auth/core").GenericEndpointContext) => Promise<{
|
|
28
27
|
session: {
|
|
29
28
|
id: string;
|
|
30
29
|
createdAt: Date;
|
|
@@ -48,8 +47,8 @@ declare const createInvitation: <O extends OrganizationOptions>(option: O) => be
|
|
|
48
47
|
image?: string | null | undefined;
|
|
49
48
|
};
|
|
50
49
|
}>;
|
|
51
|
-
}>) | ((inputContext:
|
|
52
|
-
use: ((inputContext:
|
|
50
|
+
}>) | ((inputContext: import("better-call").MiddlewareInputContext<{
|
|
51
|
+
use: ((inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<{
|
|
53
52
|
session: {
|
|
54
53
|
session: Record<string, any> & {
|
|
55
54
|
id: string;
|
|
@@ -206,9 +205,9 @@ declare const createInvitation: <O extends OrganizationOptions>(option: O) => be
|
|
|
206
205
|
createdAt: Date;
|
|
207
206
|
}) & (O["schema"] extends {
|
|
208
207
|
invitation?: {
|
|
209
|
-
additionalFields: infer Field extends Record<string,
|
|
208
|
+
additionalFields: infer Field extends Record<string, import("@better-auth/core/db").DBFieldAttribute>;
|
|
210
209
|
} | undefined;
|
|
211
|
-
} ? FieldAttributeToObject<Field> : {}) extends infer T ? { [K in keyof T]: T[K] } : never) | ((O["teams"] extends {
|
|
210
|
+
} ? FieldAttributeToObject<Field> : {}) extends (infer T) ? { [K in keyof T]: T[K]; } : never) | ((O["teams"] extends {
|
|
212
211
|
enabled: true;
|
|
213
212
|
} ? {
|
|
214
213
|
id: string;
|
|
@@ -231,21 +230,21 @@ declare const createInvitation: <O extends OrganizationOptions>(option: O) => be
|
|
|
231
230
|
createdAt: Date;
|
|
232
231
|
}) & (O["schema"] extends {
|
|
233
232
|
invitation?: {
|
|
234
|
-
additionalFields: infer Field extends Record<string,
|
|
233
|
+
additionalFields: infer Field extends Record<string, import("@better-auth/core/db").DBFieldAttribute>;
|
|
235
234
|
} | undefined;
|
|
236
|
-
} ? FieldAttributeToObject<RemoveFieldsWithReturnedFalse<Field>> : {}) extends infer T_1 ? { [K_1 in keyof T_1]: T_1[K_1] } : never)>;
|
|
237
|
-
declare const acceptInvitation: <O extends OrganizationOptions>(options: O) =>
|
|
235
|
+
} ? FieldAttributeToObject<RemoveFieldsWithReturnedFalse<Field>> : {}) extends (infer T_1) ? { [K_1 in keyof T_1]: T_1[K_1]; } : never)>;
|
|
236
|
+
declare const acceptInvitation: <O extends OrganizationOptions>(options: O) => import("better-call").StrictEndpoint<"/organization/accept-invitation", {
|
|
238
237
|
method: "POST";
|
|
239
238
|
body: z.ZodObject<{
|
|
240
239
|
invitationId: z.ZodString;
|
|
241
240
|
}, z.core.$strip>;
|
|
242
241
|
requireHeaders: true;
|
|
243
|
-
use: (((inputContext:
|
|
242
|
+
use: (((inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<{
|
|
244
243
|
orgOptions: OrganizationOptions;
|
|
245
244
|
roles: typeof defaultRoles & {
|
|
246
245
|
[key: string]: Role<{}>;
|
|
247
246
|
};
|
|
248
|
-
getSession: (context:
|
|
247
|
+
getSession: (context: import("@better-auth/core").GenericEndpointContext) => Promise<{
|
|
249
248
|
session: {
|
|
250
249
|
id: string;
|
|
251
250
|
createdAt: Date;
|
|
@@ -269,8 +268,8 @@ declare const acceptInvitation: <O extends OrganizationOptions>(options: O) => b
|
|
|
269
268
|
image?: string | null | undefined;
|
|
270
269
|
};
|
|
271
270
|
}>;
|
|
272
|
-
}>) | ((inputContext:
|
|
273
|
-
use: ((inputContext:
|
|
271
|
+
}>) | ((inputContext: import("better-call").MiddlewareInputContext<{
|
|
272
|
+
use: ((inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<{
|
|
274
273
|
session: {
|
|
275
274
|
session: Record<string, any> & {
|
|
276
275
|
id: string;
|
|
@@ -368,9 +367,9 @@ declare const acceptInvitation: <O extends OrganizationOptions>(options: O) => b
|
|
|
368
367
|
createdAt: Date;
|
|
369
368
|
}) & (O["schema"] extends {
|
|
370
369
|
invitation?: {
|
|
371
|
-
additionalFields: infer Field extends Record<string,
|
|
370
|
+
additionalFields: infer Field extends Record<string, import("@better-auth/core/db").DBFieldAttribute>;
|
|
372
371
|
} | undefined;
|
|
373
|
-
} ? FieldAttributeToObject<Field> : {}) extends infer T ? { [K in keyof T]: T[K] } : never;
|
|
372
|
+
} ? FieldAttributeToObject<Field> : {}) extends (infer T) ? { [K in keyof T]: T[K]; } : never;
|
|
374
373
|
member: {
|
|
375
374
|
id: string;
|
|
376
375
|
organizationId: string;
|
|
@@ -379,18 +378,18 @@ declare const acceptInvitation: <O extends OrganizationOptions>(options: O) => b
|
|
|
379
378
|
createdAt: Date;
|
|
380
379
|
} & InferAdditionalFieldsFromPluginOptions<"member", O, false>;
|
|
381
380
|
}>;
|
|
382
|
-
declare const rejectInvitation: <O extends OrganizationOptions>(options: O) =>
|
|
381
|
+
declare const rejectInvitation: <O extends OrganizationOptions>(options: O) => import("better-call").StrictEndpoint<"/organization/reject-invitation", {
|
|
383
382
|
method: "POST";
|
|
384
383
|
body: z.ZodObject<{
|
|
385
384
|
invitationId: z.ZodString;
|
|
386
385
|
}, z.core.$strip>;
|
|
387
386
|
requireHeaders: true;
|
|
388
|
-
use: (((inputContext:
|
|
387
|
+
use: (((inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<{
|
|
389
388
|
orgOptions: OrganizationOptions;
|
|
390
389
|
roles: typeof defaultRoles & {
|
|
391
390
|
[key: string]: Role<{}>;
|
|
392
391
|
};
|
|
393
|
-
getSession: (context:
|
|
392
|
+
getSession: (context: import("@better-auth/core").GenericEndpointContext) => Promise<{
|
|
394
393
|
session: {
|
|
395
394
|
id: string;
|
|
396
395
|
createdAt: Date;
|
|
@@ -414,8 +413,8 @@ declare const rejectInvitation: <O extends OrganizationOptions>(options: O) => b
|
|
|
414
413
|
image?: string | null | undefined;
|
|
415
414
|
};
|
|
416
415
|
}>;
|
|
417
|
-
}>) | ((inputContext:
|
|
418
|
-
use: ((inputContext:
|
|
416
|
+
}>) | ((inputContext: import("better-call").MiddlewareInputContext<{
|
|
417
|
+
use: ((inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<{
|
|
419
418
|
session: {
|
|
420
419
|
session: Record<string, any> & {
|
|
421
420
|
id: string;
|
|
@@ -503,18 +502,18 @@ declare const rejectInvitation: <O extends OrganizationOptions>(options: O) => b
|
|
|
503
502
|
} | null;
|
|
504
503
|
member: null;
|
|
505
504
|
}>;
|
|
506
|
-
declare const cancelInvitation: <O extends OrganizationOptions>(options: O) =>
|
|
505
|
+
declare const cancelInvitation: <O extends OrganizationOptions>(options: O) => import("better-call").StrictEndpoint<"/organization/cancel-invitation", {
|
|
507
506
|
method: "POST";
|
|
508
507
|
body: z.ZodObject<{
|
|
509
508
|
invitationId: z.ZodString;
|
|
510
509
|
}, z.core.$strip>;
|
|
511
510
|
requireHeaders: true;
|
|
512
|
-
use: (((inputContext:
|
|
511
|
+
use: (((inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<{
|
|
513
512
|
orgOptions: OrganizationOptions;
|
|
514
513
|
roles: typeof defaultRoles & {
|
|
515
514
|
[key: string]: Role<{}>;
|
|
516
515
|
};
|
|
517
|
-
getSession: (context:
|
|
516
|
+
getSession: (context: import("@better-auth/core").GenericEndpointContext) => Promise<{
|
|
518
517
|
session: {
|
|
519
518
|
id: string;
|
|
520
519
|
createdAt: Date;
|
|
@@ -538,8 +537,8 @@ declare const cancelInvitation: <O extends OrganizationOptions>(options: O) => b
|
|
|
538
537
|
image?: string | null | undefined;
|
|
539
538
|
};
|
|
540
539
|
}>;
|
|
541
|
-
}>) | ((inputContext:
|
|
542
|
-
use: ((inputContext:
|
|
540
|
+
}>) | ((inputContext: import("better-call").MiddlewareInputContext<{
|
|
541
|
+
use: ((inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<{
|
|
543
542
|
session: {
|
|
544
543
|
session: Record<string, any> & {
|
|
545
544
|
id: string;
|
|
@@ -632,17 +631,17 @@ declare const cancelInvitation: <O extends OrganizationOptions>(options: O) => b
|
|
|
632
631
|
createdAt: Date;
|
|
633
632
|
}) & (O["schema"] extends {
|
|
634
633
|
invitation?: {
|
|
635
|
-
additionalFields: infer Field extends Record<string,
|
|
634
|
+
additionalFields: infer Field extends Record<string, import("@better-auth/core/db").DBFieldAttribute>;
|
|
636
635
|
} | undefined;
|
|
637
|
-
} ? FieldAttributeToObject<Field> : {}) extends infer T ? { [K in keyof T]: T[K] } : never) | null>;
|
|
638
|
-
declare const getInvitation: <O extends OrganizationOptions>(options: O) =>
|
|
636
|
+
} ? FieldAttributeToObject<Field> : {}) extends (infer T) ? { [K in keyof T]: T[K]; } : never) | null>;
|
|
637
|
+
declare const getInvitation: <O extends OrganizationOptions>(options: O) => import("better-call").StrictEndpoint<"/organization/get-invitation", {
|
|
639
638
|
method: "GET";
|
|
640
|
-
use: ((inputContext:
|
|
639
|
+
use: ((inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<{
|
|
641
640
|
orgOptions: OrganizationOptions;
|
|
642
641
|
roles: typeof defaultRoles & {
|
|
643
642
|
[key: string]: Role<{}>;
|
|
644
643
|
};
|
|
645
|
-
getSession: (context:
|
|
644
|
+
getSession: (context: import("@better-auth/core").GenericEndpointContext) => Promise<{
|
|
646
645
|
session: {
|
|
647
646
|
id: string;
|
|
648
647
|
createdAt: Date;
|
|
@@ -744,9 +743,9 @@ declare const getInvitation: <O extends OrganizationOptions>(options: O) => bett
|
|
|
744
743
|
createdAt: Date;
|
|
745
744
|
}) & (O["schema"] extends {
|
|
746
745
|
invitation?: {
|
|
747
|
-
additionalFields: infer Field extends Record<string,
|
|
746
|
+
additionalFields: infer Field extends Record<string, import("@better-auth/core/db").DBFieldAttribute>;
|
|
748
747
|
} | undefined;
|
|
749
|
-
} ? FieldAttributeToObject<Field> : {}) extends infer T ? { [K in keyof T]: T[K] } : never) & {
|
|
748
|
+
} ? FieldAttributeToObject<Field> : {}) extends (infer T) ? { [K in keyof T]: T[K]; } : never) & {
|
|
750
749
|
organizationName: ({
|
|
751
750
|
id: string;
|
|
752
751
|
name: string;
|
|
@@ -756,7 +755,7 @@ declare const getInvitation: <O extends OrganizationOptions>(options: O) => bett
|
|
|
756
755
|
metadata?: any;
|
|
757
756
|
} & (O["schema"] extends {
|
|
758
757
|
organization?: {
|
|
759
|
-
additionalFields: infer Field extends Record<string,
|
|
758
|
+
additionalFields: infer Field extends Record<string, import("@better-auth/core/db").DBFieldAttribute>;
|
|
760
759
|
} | undefined;
|
|
761
760
|
} ? FieldAttributeToObject<RemoveFieldsWithReturnedFalse<Field>> : {}))["name"];
|
|
762
761
|
organizationSlug: ({
|
|
@@ -768,20 +767,20 @@ declare const getInvitation: <O extends OrganizationOptions>(options: O) => bett
|
|
|
768
767
|
metadata?: any;
|
|
769
768
|
} & (O["schema"] extends {
|
|
770
769
|
organization?: {
|
|
771
|
-
additionalFields: infer Field extends Record<string,
|
|
770
|
+
additionalFields: infer Field extends Record<string, import("@better-auth/core/db").DBFieldAttribute>;
|
|
772
771
|
} | undefined;
|
|
773
772
|
} ? FieldAttributeToObject<RemoveFieldsWithReturnedFalse<Field>> : {}))["slug"];
|
|
774
773
|
inviterEmail: string;
|
|
775
774
|
}>;
|
|
776
|
-
declare const listInvitations: <O extends OrganizationOptions>(options: O) =>
|
|
775
|
+
declare const listInvitations: <O extends OrganizationOptions>(options: O) => import("better-call").StrictEndpoint<"/organization/list-invitations", {
|
|
777
776
|
method: "GET";
|
|
778
777
|
requireHeaders: true;
|
|
779
|
-
use: (((inputContext:
|
|
778
|
+
use: (((inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<{
|
|
780
779
|
orgOptions: OrganizationOptions;
|
|
781
780
|
roles: typeof defaultRoles & {
|
|
782
781
|
[key: string]: Role<{}>;
|
|
783
782
|
};
|
|
784
|
-
getSession: (context:
|
|
783
|
+
getSession: (context: import("@better-auth/core").GenericEndpointContext) => Promise<{
|
|
785
784
|
session: {
|
|
786
785
|
id: string;
|
|
787
786
|
createdAt: Date;
|
|
@@ -805,8 +804,8 @@ declare const listInvitations: <O extends OrganizationOptions>(options: O) => be
|
|
|
805
804
|
image?: string | null | undefined;
|
|
806
805
|
};
|
|
807
806
|
}>;
|
|
808
|
-
}>) | ((inputContext:
|
|
809
|
-
use: ((inputContext:
|
|
807
|
+
}>) | ((inputContext: import("better-call").MiddlewareInputContext<{
|
|
808
|
+
use: ((inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<{
|
|
810
809
|
session: {
|
|
811
810
|
session: Record<string, any> & {
|
|
812
811
|
id: string;
|
|
@@ -881,20 +880,20 @@ declare const listInvitations: <O extends OrganizationOptions>(options: O) => be
|
|
|
881
880
|
createdAt: Date;
|
|
882
881
|
}) & (O["schema"] extends {
|
|
883
882
|
invitation?: {
|
|
884
|
-
additionalFields: infer Field extends Record<string,
|
|
883
|
+
additionalFields: infer Field extends Record<string, import("@better-auth/core/db").DBFieldAttribute>;
|
|
885
884
|
} | undefined;
|
|
886
|
-
} ? FieldAttributeToObject<Field> : {}) extends infer T ? { [K in keyof T]: T[K] } : never)[]>;
|
|
885
|
+
} ? FieldAttributeToObject<Field> : {}) extends (infer T) ? { [K in keyof T]: T[K]; } : never)[]>;
|
|
887
886
|
/**
|
|
888
887
|
* List all invitations a user has received
|
|
889
888
|
*/
|
|
890
|
-
declare const listUserInvitations: <O extends OrganizationOptions>(options: O) =>
|
|
889
|
+
declare const listUserInvitations: <O extends OrganizationOptions>(options: O) => import("better-call").StrictEndpoint<"/organization/list-user-invitations", {
|
|
891
890
|
method: "GET";
|
|
892
|
-
use: ((inputContext:
|
|
891
|
+
use: ((inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<{
|
|
893
892
|
orgOptions: OrganizationOptions;
|
|
894
893
|
roles: typeof defaultRoles & {
|
|
895
894
|
[key: string]: Role<{}>;
|
|
896
895
|
};
|
|
897
|
-
getSession: (context:
|
|
896
|
+
getSession: (context: import("@better-auth/core").GenericEndpointContext) => Promise<{
|
|
898
897
|
session: {
|
|
899
898
|
id: string;
|
|
900
899
|
createdAt: Date;
|
|
@@ -1001,9 +1000,9 @@ declare const listUserInvitations: <O extends OrganizationOptions>(options: O) =
|
|
|
1001
1000
|
createdAt: Date;
|
|
1002
1001
|
}) & (O["schema"] extends {
|
|
1003
1002
|
invitation?: {
|
|
1004
|
-
additionalFields: infer Field extends Record<string,
|
|
1003
|
+
additionalFields: infer Field extends Record<string, import("@better-auth/core/db").DBFieldAttribute>;
|
|
1005
1004
|
} | undefined;
|
|
1006
|
-
} ? FieldAttributeToObject<Field> : {}) extends infer T ? { [K in keyof T]: T[K] } : never) & {
|
|
1005
|
+
} ? FieldAttributeToObject<Field> : {}) extends (infer T) ? { [K in keyof T]: T[K]; } : never) & {
|
|
1007
1006
|
organization: {
|
|
1008
1007
|
id: string;
|
|
1009
1008
|
name: string;
|
|
@@ -1013,9 +1012,9 @@ declare const listUserInvitations: <O extends OrganizationOptions>(options: O) =
|
|
|
1013
1012
|
metadata?: any;
|
|
1014
1013
|
} & (O["schema"] extends {
|
|
1015
1014
|
organization?: {
|
|
1016
|
-
additionalFields: infer Field extends Record<string,
|
|
1015
|
+
additionalFields: infer Field extends Record<string, import("@better-auth/core/db").DBFieldAttribute>;
|
|
1017
1016
|
} | undefined;
|
|
1018
|
-
} ? FieldAttributeToObject<Field> : {}) extends infer T_1 ? { [K_1 in keyof T_1]: T_1[K_1] } : never;
|
|
1017
|
+
} ? FieldAttributeToObject<Field> : {}) extends (infer T_1) ? { [K_1 in keyof T_1]: T_1[K_1]; } : never;
|
|
1019
1018
|
}, "organization"> & {
|
|
1020
1019
|
organizationName: ({
|
|
1021
1020
|
id: string;
|
|
@@ -1026,7 +1025,7 @@ declare const listUserInvitations: <O extends OrganizationOptions>(options: O) =
|
|
|
1026
1025
|
metadata?: any;
|
|
1027
1026
|
} & (O["schema"] extends {
|
|
1028
1027
|
organization?: {
|
|
1029
|
-
additionalFields: infer Field extends Record<string,
|
|
1028
|
+
additionalFields: infer Field extends Record<string, import("@better-auth/core/db").DBFieldAttribute>;
|
|
1030
1029
|
} | undefined;
|
|
1031
1030
|
} ? FieldAttributeToObject<Field> : {}))["name"];
|
|
1032
1031
|
})[]>;
|
|
@@ -103,7 +103,7 @@ const createInvitation = (option) => {
|
|
|
103
103
|
const rolesArray = roles.split(",").map((r) => r.trim()).filter(Boolean);
|
|
104
104
|
const defaults = Object.keys(defaultRoles);
|
|
105
105
|
const customRoles = Object.keys(ctx.context.orgOptions.roles || {});
|
|
106
|
-
const validStaticRoles = new Set([...defaults, ...customRoles]);
|
|
106
|
+
const validStaticRoles = /* @__PURE__ */ new Set([...defaults, ...customRoles]);
|
|
107
107
|
const unknownRoles = rolesArray.filter((role) => !validStaticRoles.has(role));
|
|
108
108
|
if (unknownRoles.length > 0) if (ctx.context.orgOptions.dynamicAccessControl?.enabled) {
|
|
109
109
|
const foundRoleNames = (await ctx.context.adapter.findMany({
|
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
import { FieldAttributeToObject, InferAdditionalFieldsFromPluginOptions, RemoveFieldsWithReturnedFalse } from "../../../db/field.mjs";
|
|
2
2
|
import { Role } from "../../access/types.mjs";
|
|
3
|
+
import "../../../db/index.mjs";
|
|
3
4
|
import { OrganizationOptions } from "../types.mjs";
|
|
4
5
|
import { InferOrganizationRolesFromOption } from "../schema.mjs";
|
|
6
|
+
import "../../index.mjs";
|
|
5
7
|
import { defaultRoles } from "../access/statement.mjs";
|
|
6
|
-
import * as _better_auth_core0 from "@better-auth/core";
|
|
7
8
|
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";
|
|
10
9
|
import * as z from "zod";
|
|
11
|
-
|
|
12
10
|
//#region src/plugins/organization/routes/crud-members.d.ts
|
|
13
|
-
declare const addMember: <O extends OrganizationOptions>(option: O) =>
|
|
11
|
+
declare const addMember: <O extends OrganizationOptions>(option: O) => import("better-call").StrictEndpoint<string, {
|
|
14
12
|
method: "POST";
|
|
15
13
|
body: z.ZodObject<{
|
|
16
14
|
userId: z.ZodCoercedString<unknown>;
|
|
@@ -18,12 +16,12 @@ declare const addMember: <O extends OrganizationOptions>(option: O) => better_ca
|
|
|
18
16
|
organizationId: z.ZodOptional<z.ZodString>;
|
|
19
17
|
teamId: z.ZodOptional<z.ZodString>;
|
|
20
18
|
}, z.core.$strip>;
|
|
21
|
-
use: ((inputContext:
|
|
19
|
+
use: ((inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<{
|
|
22
20
|
orgOptions: OrganizationOptions;
|
|
23
21
|
roles: typeof defaultRoles & {
|
|
24
22
|
[key: string]: Role<{}>;
|
|
25
23
|
};
|
|
26
|
-
getSession: (context:
|
|
24
|
+
getSession: (context: import("@better-auth/core").GenericEndpointContext) => Promise<{
|
|
27
25
|
session: {
|
|
28
26
|
id: string;
|
|
29
27
|
createdAt: Date;
|
|
@@ -74,19 +72,19 @@ declare const addMember: <O extends OrganizationOptions>(option: O) => better_ca
|
|
|
74
72
|
role: string;
|
|
75
73
|
createdAt: Date;
|
|
76
74
|
} & InferAdditionalFieldsFromPluginOptions<"member", O, false>>;
|
|
77
|
-
declare const removeMember: <O extends OrganizationOptions>(options: O) =>
|
|
75
|
+
declare const removeMember: <O extends OrganizationOptions>(options: O) => import("better-call").StrictEndpoint<"/organization/remove-member", {
|
|
78
76
|
method: "POST";
|
|
79
77
|
body: z.ZodObject<{
|
|
80
78
|
memberIdOrEmail: z.ZodString;
|
|
81
79
|
organizationId: z.ZodOptional<z.ZodString>;
|
|
82
80
|
}, z.core.$strip>;
|
|
83
81
|
requireHeaders: true;
|
|
84
|
-
use: (((inputContext:
|
|
82
|
+
use: (((inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<{
|
|
85
83
|
orgOptions: OrganizationOptions;
|
|
86
84
|
roles: typeof defaultRoles & {
|
|
87
85
|
[key: string]: Role<{}>;
|
|
88
86
|
};
|
|
89
|
-
getSession: (context:
|
|
87
|
+
getSession: (context: import("@better-auth/core").GenericEndpointContext) => Promise<{
|
|
90
88
|
session: {
|
|
91
89
|
id: string;
|
|
92
90
|
createdAt: Date;
|
|
@@ -110,8 +108,8 @@ declare const removeMember: <O extends OrganizationOptions>(options: O) => bette
|
|
|
110
108
|
image?: string | null | undefined;
|
|
111
109
|
};
|
|
112
110
|
}>;
|
|
113
|
-
}>) | ((inputContext:
|
|
114
|
-
use: ((inputContext:
|
|
111
|
+
}>) | ((inputContext: import("better-call").MiddlewareInputContext<{
|
|
112
|
+
use: ((inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<{
|
|
115
113
|
session: {
|
|
116
114
|
session: Record<string, any> & {
|
|
117
115
|
id: string;
|
|
@@ -228,23 +226,23 @@ declare const removeMember: <O extends OrganizationOptions>(options: O) => bette
|
|
|
228
226
|
};
|
|
229
227
|
}) & (O["schema"] extends {
|
|
230
228
|
member?: {
|
|
231
|
-
additionalFields: infer Field extends Record<string,
|
|
229
|
+
additionalFields: infer Field extends Record<string, import("@better-auth/core/db").DBFieldAttribute>;
|
|
232
230
|
} | undefined;
|
|
233
|
-
} ? FieldAttributeToObject<RemoveFieldsWithReturnedFalse<Field>> : {}) extends infer T ? { [K in keyof T]: T[K] } : never;
|
|
231
|
+
} ? FieldAttributeToObject<RemoveFieldsWithReturnedFalse<Field>> : {}) extends (infer T) ? { [K in keyof T]: T[K]; } : never;
|
|
234
232
|
}>;
|
|
235
|
-
declare const updateMemberRole: <O extends OrganizationOptions>(option: O) =>
|
|
233
|
+
declare const updateMemberRole: <O extends OrganizationOptions>(option: O) => import("better-call").StrictEndpoint<"/organization/update-member-role", {
|
|
236
234
|
method: "POST";
|
|
237
235
|
body: z.ZodObject<{
|
|
238
236
|
role: z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>;
|
|
239
237
|
memberId: z.ZodString;
|
|
240
238
|
organizationId: z.ZodOptional<z.ZodString>;
|
|
241
239
|
}, z.core.$strip>;
|
|
242
|
-
use: (((inputContext:
|
|
240
|
+
use: (((inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<{
|
|
243
241
|
orgOptions: OrganizationOptions;
|
|
244
242
|
roles: typeof defaultRoles & {
|
|
245
243
|
[key: string]: Role<{}>;
|
|
246
244
|
};
|
|
247
|
-
getSession: (context:
|
|
245
|
+
getSession: (context: import("@better-auth/core").GenericEndpointContext) => Promise<{
|
|
248
246
|
session: {
|
|
249
247
|
id: string;
|
|
250
248
|
createdAt: Date;
|
|
@@ -268,8 +266,8 @@ declare const updateMemberRole: <O extends OrganizationOptions>(option: O) => be
|
|
|
268
266
|
image?: string | null | undefined;
|
|
269
267
|
};
|
|
270
268
|
}>;
|
|
271
|
-
}>) | ((inputContext:
|
|
272
|
-
use: ((inputContext:
|
|
269
|
+
}>) | ((inputContext: import("better-call").MiddlewareInputContext<{
|
|
270
|
+
use: ((inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<{
|
|
273
271
|
session: {
|
|
274
272
|
session: Record<string, any> & {
|
|
275
273
|
id: string;
|
|
@@ -381,14 +379,14 @@ declare const updateMemberRole: <O extends OrganizationOptions>(option: O) => be
|
|
|
381
379
|
image?: string | undefined;
|
|
382
380
|
};
|
|
383
381
|
}>;
|
|
384
|
-
declare const getActiveMember: <O extends OrganizationOptions>(options: O) =>
|
|
382
|
+
declare const getActiveMember: <O extends OrganizationOptions>(options: O) => import("better-call").StrictEndpoint<"/organization/get-active-member", {
|
|
385
383
|
method: "GET";
|
|
386
|
-
use: (((inputContext:
|
|
384
|
+
use: (((inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<{
|
|
387
385
|
orgOptions: OrganizationOptions;
|
|
388
386
|
roles: typeof defaultRoles & {
|
|
389
387
|
[key: string]: Role<{}>;
|
|
390
388
|
};
|
|
391
|
-
getSession: (context:
|
|
389
|
+
getSession: (context: import("@better-auth/core").GenericEndpointContext) => Promise<{
|
|
392
390
|
session: {
|
|
393
391
|
id: string;
|
|
394
392
|
createdAt: Date;
|
|
@@ -412,8 +410,8 @@ declare const getActiveMember: <O extends OrganizationOptions>(options: O) => be
|
|
|
412
410
|
image?: string | null | undefined;
|
|
413
411
|
};
|
|
414
412
|
}>;
|
|
415
|
-
}>) | ((inputContext:
|
|
416
|
-
use: ((inputContext:
|
|
413
|
+
}>) | ((inputContext: import("better-call").MiddlewareInputContext<{
|
|
414
|
+
use: ((inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<{
|
|
417
415
|
session: {
|
|
418
416
|
session: Record<string, any> & {
|
|
419
417
|
id: string;
|
|
@@ -524,9 +522,9 @@ declare const getActiveMember: <O extends OrganizationOptions>(options: O) => be
|
|
|
524
522
|
};
|
|
525
523
|
}) & (O["schema"] extends {
|
|
526
524
|
member?: {
|
|
527
|
-
additionalFields: infer Field extends Record<string,
|
|
525
|
+
additionalFields: infer Field extends Record<string, import("@better-auth/core/db").DBFieldAttribute>;
|
|
528
526
|
} | undefined;
|
|
529
|
-
} ? FieldAttributeToObject<Field> : {}) extends infer T ? { [K in keyof T]: T[K] } : never) & {
|
|
527
|
+
} ? FieldAttributeToObject<Field> : {}) extends (infer T) ? { [K in keyof T]: T[K]; } : never) & {
|
|
530
528
|
user: {
|
|
531
529
|
id: string;
|
|
532
530
|
createdAt: Date;
|
|
@@ -544,13 +542,13 @@ declare const getActiveMember: <O extends OrganizationOptions>(options: O) => be
|
|
|
544
542
|
image: string | undefined;
|
|
545
543
|
};
|
|
546
544
|
}>;
|
|
547
|
-
declare const leaveOrganization: <O extends OrganizationOptions>(options: O) =>
|
|
545
|
+
declare const leaveOrganization: <O extends OrganizationOptions>(options: O) => import("better-call").StrictEndpoint<"/organization/leave", {
|
|
548
546
|
method: "POST";
|
|
549
547
|
body: z.ZodObject<{
|
|
550
548
|
organizationId: z.ZodString;
|
|
551
549
|
}, z.core.$strip>;
|
|
552
550
|
requireHeaders: true;
|
|
553
|
-
use: (((inputContext:
|
|
551
|
+
use: (((inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<{
|
|
554
552
|
session: {
|
|
555
553
|
session: Record<string, any> & {
|
|
556
554
|
id: string;
|
|
@@ -572,12 +570,12 @@ declare const leaveOrganization: <O extends OrganizationOptions>(options: O) =>
|
|
|
572
570
|
image?: string | null | undefined;
|
|
573
571
|
};
|
|
574
572
|
};
|
|
575
|
-
}>) | ((inputContext:
|
|
573
|
+
}>) | ((inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<{
|
|
576
574
|
orgOptions: OrganizationOptions;
|
|
577
575
|
roles: typeof defaultRoles & {
|
|
578
576
|
[key: string]: Role<{}>;
|
|
579
577
|
};
|
|
580
|
-
getSession: (context:
|
|
578
|
+
getSession: (context: import("@better-auth/core").GenericEndpointContext) => Promise<{
|
|
581
579
|
session: {
|
|
582
580
|
id: string;
|
|
583
581
|
createdAt: Date;
|
|
@@ -631,9 +629,9 @@ declare const leaveOrganization: <O extends OrganizationOptions>(options: O) =>
|
|
|
631
629
|
};
|
|
632
630
|
}) & (O["schema"] extends {
|
|
633
631
|
member?: {
|
|
634
|
-
additionalFields: infer Field extends Record<string,
|
|
632
|
+
additionalFields: infer Field extends Record<string, import("@better-auth/core/db").DBFieldAttribute>;
|
|
635
633
|
} | undefined;
|
|
636
|
-
} ? FieldAttributeToObject<Field> : {}) extends infer T ? { [K in keyof T]: T[K] } : never) & {
|
|
634
|
+
} ? FieldAttributeToObject<Field> : {}) extends (infer T) ? { [K in keyof T]: T[K]; } : never) & {
|
|
637
635
|
user: {
|
|
638
636
|
id: string;
|
|
639
637
|
createdAt: Date;
|
|
@@ -651,7 +649,7 @@ declare const leaveOrganization: <O extends OrganizationOptions>(options: O) =>
|
|
|
651
649
|
image: string | undefined;
|
|
652
650
|
};
|
|
653
651
|
}>;
|
|
654
|
-
declare const listMembers: <O extends OrganizationOptions>(options: O) =>
|
|
652
|
+
declare const listMembers: <O extends OrganizationOptions>(options: O) => import("better-call").StrictEndpoint<"/organization/list-members", {
|
|
655
653
|
method: "GET";
|
|
656
654
|
query: z.ZodOptional<z.ZodObject<{
|
|
657
655
|
limit: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNumber]>>;
|
|
@@ -680,12 +678,12 @@ declare const listMembers: <O extends OrganizationOptions>(options: O) => better
|
|
|
680
678
|
organizationSlug: z.ZodOptional<z.ZodString>;
|
|
681
679
|
}, z.core.$strip>>;
|
|
682
680
|
requireHeaders: true;
|
|
683
|
-
use: (((inputContext:
|
|
681
|
+
use: (((inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<{
|
|
684
682
|
orgOptions: OrganizationOptions;
|
|
685
683
|
roles: typeof defaultRoles & {
|
|
686
684
|
[key: string]: Role<{}>;
|
|
687
685
|
};
|
|
688
|
-
getSession: (context:
|
|
686
|
+
getSession: (context: import("@better-auth/core").GenericEndpointContext) => Promise<{
|
|
689
687
|
session: {
|
|
690
688
|
id: string;
|
|
691
689
|
createdAt: Date;
|
|
@@ -709,8 +707,8 @@ declare const listMembers: <O extends OrganizationOptions>(options: O) => better
|
|
|
709
707
|
image?: string | null | undefined;
|
|
710
708
|
};
|
|
711
709
|
}>;
|
|
712
|
-
}>) | ((inputContext:
|
|
713
|
-
use: ((inputContext:
|
|
710
|
+
}>) | ((inputContext: import("better-call").MiddlewareInputContext<{
|
|
711
|
+
use: ((inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<{
|
|
714
712
|
session: {
|
|
715
713
|
session: Record<string, any> & {
|
|
716
714
|
id: string;
|
|
@@ -789,9 +787,9 @@ declare const listMembers: <O extends OrganizationOptions>(options: O) => better
|
|
|
789
787
|
};
|
|
790
788
|
}) & (O["schema"] extends {
|
|
791
789
|
member?: {
|
|
792
|
-
additionalFields: infer Field extends Record<string,
|
|
790
|
+
additionalFields: infer Field extends Record<string, import("@better-auth/core/db").DBFieldAttribute>;
|
|
793
791
|
} | undefined;
|
|
794
|
-
} ? FieldAttributeToObject<Field> : {}) extends infer T ? { [K in keyof T]: T[K] } : never) & {
|
|
792
|
+
} ? FieldAttributeToObject<Field> : {}) extends (infer T) ? { [K in keyof T]: T[K]; } : never) & {
|
|
795
793
|
user: {
|
|
796
794
|
id: string;
|
|
797
795
|
name: string;
|
|
@@ -801,7 +799,7 @@ declare const listMembers: <O extends OrganizationOptions>(options: O) => better
|
|
|
801
799
|
})[];
|
|
802
800
|
total: number;
|
|
803
801
|
}>;
|
|
804
|
-
declare const getActiveMemberRole: <O extends OrganizationOptions>(options: O) =>
|
|
802
|
+
declare const getActiveMemberRole: <O extends OrganizationOptions>(options: O) => import("better-call").StrictEndpoint<"/organization/get-active-member-role", {
|
|
805
803
|
method: "GET";
|
|
806
804
|
query: z.ZodOptional<z.ZodObject<{
|
|
807
805
|
userId: z.ZodOptional<z.ZodString>;
|
|
@@ -809,12 +807,12 @@ declare const getActiveMemberRole: <O extends OrganizationOptions>(options: O) =
|
|
|
809
807
|
organizationSlug: z.ZodOptional<z.ZodString>;
|
|
810
808
|
}, z.core.$strip>>;
|
|
811
809
|
requireHeaders: true;
|
|
812
|
-
use: (((inputContext:
|
|
810
|
+
use: (((inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<{
|
|
813
811
|
orgOptions: OrganizationOptions;
|
|
814
812
|
roles: typeof defaultRoles & {
|
|
815
813
|
[key: string]: Role<{}>;
|
|
816
814
|
};
|
|
817
|
-
getSession: (context:
|
|
815
|
+
getSession: (context: import("@better-auth/core").GenericEndpointContext) => Promise<{
|
|
818
816
|
session: {
|
|
819
817
|
id: string;
|
|
820
818
|
createdAt: Date;
|
|
@@ -838,8 +836,8 @@ declare const getActiveMemberRole: <O extends OrganizationOptions>(options: O) =
|
|
|
838
836
|
image?: string | null | undefined;
|
|
839
837
|
};
|
|
840
838
|
}>;
|
|
841
|
-
}>) | ((inputContext:
|
|
842
|
-
use: ((inputContext:
|
|
839
|
+
}>) | ((inputContext: import("better-call").MiddlewareInputContext<{
|
|
840
|
+
use: ((inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<{
|
|
843
841
|
session: {
|
|
844
842
|
session: Record<string, any> & {
|
|
845
843
|
id: string;
|
|
@@ -918,9 +916,9 @@ declare const getActiveMemberRole: <O extends OrganizationOptions>(options: O) =
|
|
|
918
916
|
};
|
|
919
917
|
}) & (O["schema"] extends {
|
|
920
918
|
member?: {
|
|
921
|
-
additionalFields: infer Field extends Record<string,
|
|
919
|
+
additionalFields: infer Field extends Record<string, import("@better-auth/core/db").DBFieldAttribute>;
|
|
922
920
|
} | undefined;
|
|
923
|
-
} ? FieldAttributeToObject<Field> : {}) extends infer T ? { [K in keyof T]: T[K] } : never) & {
|
|
921
|
+
} ? FieldAttributeToObject<Field> : {}) extends (infer T) ? { [K in keyof T]: T[K]; } : never) & {
|
|
924
922
|
user: {
|
|
925
923
|
id: string;
|
|
926
924
|
createdAt: Date;
|
|
@@ -114,6 +114,9 @@ const addMember = (option) => {
|
|
|
114
114
|
};
|
|
115
115
|
const removeMemberBodySchema = z.object({
|
|
116
116
|
memberIdOrEmail: z.string().meta({ description: "The ID or email of the member to remove" }),
|
|
117
|
+
/**
|
|
118
|
+
* If not provided, the active organization will be used
|
|
119
|
+
*/
|
|
117
120
|
organizationId: z.string().meta({ description: "The ID of the organization to remove the member from. If not provided, the active organization will be used. Eg: \"org-id\"" }).optional()
|
|
118
121
|
});
|
|
119
122
|
const removeMember = (options) => createAuthEndpoint("/organization/remove-member", {
|
|
@@ -255,7 +258,7 @@ const updateMemberRole = (option) => createAuthEndpoint("/organization/update-me
|
|
|
255
258
|
const adapter = getOrgAdapter(ctx.context, ctx.context.orgOptions);
|
|
256
259
|
const roleToSet = (Array.isArray(ctx.body.role) ? ctx.body.role : [ctx.body.role]).flatMap((role) => role.split(",")).map((role) => role.trim()).filter(Boolean);
|
|
257
260
|
if (roleToSet.length === 0) throw APIError.fromStatus("BAD_REQUEST");
|
|
258
|
-
const validStaticRoles = new Set([...Object.keys(defaultRoles), ...Object.keys(ctx.context.orgOptions.roles || {})]);
|
|
261
|
+
const validStaticRoles = /* @__PURE__ */ new Set([...Object.keys(defaultRoles), ...Object.keys(ctx.context.orgOptions.roles || {})]);
|
|
259
262
|
const unknownRoles = roleToSet.filter((role) => !validStaticRoles.has(role));
|
|
260
263
|
if (unknownRoles.length > 0) if (ctx.context.orgOptions.dynamicAccessControl?.enabled) {
|
|
261
264
|
const foundRoleNames = (await ctx.context.adapter.findMany({
|