import * as better_auth0 from "better-auth"; import { BetterAuthPlugin, GenericEndpointContext, User } from "better-auth"; import { InferAdditionalFieldsFromPluginOptions } from "better-auth/db"; import { InferInvitation, InferMember, InferOrganization, OrganizationOptions, Role } from "better-auth/plugins"; import { defaultRoles } from "better-auth/plugins/organization/access"; //#region src/server.d.ts 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; }; } declare const orgMiddleware: (inputContext: better_auth0.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. */ declare const orgSessionMiddleware: (inputContext: better_auth0.MiddlewareInputContext<{ use: ((inputContext: better_auth0.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; }; }; }>; declare const organizationMember: (userConfig?: OrganizationMemberOptions) => BetterAuthPlugin; //#endregion export { organizationMember as i, orgMiddleware as n, orgSessionMiddleware as r, OrganizationMemberOptions as t }; //# sourceMappingURL=server-CRN13tVT.d.mts.map