/** @format */ import { type BetterAuthPlugin, type GenericEndpointContext, type User } from "better-auth"; import type { InferAdditionalFieldsFromPluginOptions } from "better-auth/db"; import { InferInvitation, type InferMember, type InferOrganization, type OrganizationOptions, type Role } from "better-auth/plugins"; import { defaultRoles } from "better-auth/plugins/organization/access"; export interface OrganizationMemberOptions { schema?: OrganizationOptions["schema"]; /** * Hooks for the organization member plugin */ organizationMemberHooks?: { /** * A callback that runs before a member's info is updated * * You can return a `data` object to override the default data. */ beforeUpdateMember?: (data: { member: InferMember; updates: { role?: string | string[]; } & InferAdditionalFieldsFromPluginOptions<"member", OrganizationOptions>; user: User; organization: InferOrganization; }) => Promise; }>; /** * A callback that runs after a member's info is updated */ afterUpdateMember?: (data: { member: InferMember; user: User; organization: InferOrganization; }) => Promise; /** * A callback that runs before an invitation is updated * * You can return a `data` object to override the default data. */ beforeUpdateInvitation?: (data: { invitation: InferInvitation; updates: { role?: string | string[]; } & InferAdditionalFieldsFromPluginOptions<"invitation", OrganizationOptions>; inviter: User; organization: InferOrganization; }) => Promise; }>; /** * A callback that runs after an invitation is updated */ afterUpdateInvitation?: (data: { invitation: InferInvitation; inviter: User; organization: InferOrganization; }) => Promise; }; } export declare const orgMiddleware: (inputContext: import("better-auth").MiddlewareInputContext) => Promise<{ orgOptions: OrganizationOptions; roles: typeof defaultRoles & { [key: string]: Role<{}>; }; getSession: (context: GenericEndpointContext) => Promise<{ session: { id: string; createdAt: Date; updatedAt: Date; userId: string; expiresAt: Date; token: string; ipAddress?: string | null | undefined; userAgent?: string | null | undefined; } & { activeTeamId?: string | undefined; activeOrganizationId?: string | undefined; }; user: { id: string; createdAt: Date; updatedAt: Date; email: string; emailVerified: boolean; name: string; image?: string | null | undefined; }; }>; }>; /** * The middleware forces the endpoint to require a valid session by utilizing the `sessionMiddleware`. * It also appends additional types to the session type regarding organizations. */ export declare const orgSessionMiddleware: (inputContext: import("better-auth").MiddlewareInputContext<{ use: ((inputContext: import("better-auth").MiddlewareInputContext) => Promise<{ session: { session: Record & { id: string; createdAt: Date; updatedAt: Date; userId: string; expiresAt: Date; token: string; ipAddress?: string | null | undefined; userAgent?: string | null | undefined; }; user: Record & { id: string; createdAt: Date; updatedAt: Date; email: string; emailVerified: boolean; name: string; image?: string | null | undefined; }; }; }>)[]; }>) => Promise<{ session: { session: { id: string; createdAt: Date; updatedAt: Date; userId: string; expiresAt: Date; token: string; ipAddress?: string | null | undefined; userAgent?: string | null | undefined; } & { activeTeamId?: string | undefined; activeOrganizationId?: string | undefined; }; user: { id: string; createdAt: Date; updatedAt: Date; email: string; emailVerified: boolean; name: string; image?: string | null | undefined; }; }; }>; export declare const organizationMember: (userConfig?: OrganizationMemberOptions) => BetterAuthPlugin; //# sourceMappingURL=server.d.ts.map