import { InviteOptions, InviteType, InviteTypeWithId } from "./types.mjs"; import { InviteClientPlugin, inviteClient } from "./client.mjs"; import * as _$better_auth0 from "better-auth"; import * as _$zod from "zod"; import * as _$zod_v4_core0 from "zod/v4/core"; //#region src/index.d.ts declare const invite: (opts: O) => { id: "invite"; endpoints: { createInvite: _$better_auth0.StrictEndpoint<"/invite/create", { method: "POST"; body: _$zod.ZodObject<{ role: _$zod.ZodString; email: _$zod.ZodOptional<_$zod.ZodUnion]>>; tokenType: _$zod.ZodOptional<_$zod.ZodEnum<{ custom: "custom"; token: "token"; code: "code"; }>>; redirectToSignUp: _$zod.ZodOptional<_$zod.ZodString>; redirectToSignIn: _$zod.ZodOptional<_$zod.ZodString>; maxUses: _$zod.ZodOptional<_$zod.ZodNumber>; expiresIn: _$zod.ZodOptional<_$zod.ZodNumber>; redirectToAfterUpgrade: _$zod.ZodOptional<_$zod.ZodString>; shareInviterName: _$zod.ZodOptional<_$zod.ZodBoolean>; senderResponse: _$zod.ZodOptional<_$zod.ZodEnum<{ token: "token"; url: "url"; }>>; senderResponseRedirect: _$zod.ZodOptional<_$zod.ZodEnum<{ signUp: "signUp"; signIn: "signIn"; }>>; customInviteUrl: _$zod.ZodOptional<_$zod.ZodString>; }, _$zod_v4_core0.$strip>; use: ((inputContext: _$better_auth0.MiddlewareInputContext<_$better_auth0.MiddlewareOptions>) => 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; }; }; }>)[]; metadata: { openapi: { operationId: string; description: string; responses: { "200": { description: string; content: { "application/json": { schema: { type: "object"; properties: { status: { type: string; }; message: { type: string; }; }; }; }; }; }; }; }; }; }, { status: boolean; message: string; }>; activateInvite: _$better_auth0.StrictEndpoint<"/invite/activate", { method: "POST"; use: ((inputContext: _$better_auth0.MiddlewareInputContext<_$better_auth0.MiddlewareOptions>) => Promise)[]; body: _$zod.ZodObject<{ callbackURL: _$zod.ZodOptional<_$zod.ZodString>; token: _$zod.ZodString; }, _$zod_v4_core0.$strip>; metadata: { openapi: { operationId: string; description: string; responses: { "200": { description: string; content: { "application/json": { schema: { type: "object"; properties: { status: { type: string; example: boolean; }; message: { type: string; example: string; }; action: { type: string; example: string; }; redirectTo: { type: string; example: string; }; }; required: string[]; }; }; }; }; "400": { description: string; content: { "application/json": { schema: { type: "object"; properties: { errorCode: { type: string; example: string; }; message: { type: string; }; }; }; }; }; }; "500": { description: string; }; }; }; }; }, { status: boolean; message: string; action: string; redirectTo: string | undefined; }>; activateInviteCallback: _$better_auth0.StrictEndpoint<"/invite/:token", { method: "GET"; use: ((inputContext: _$better_auth0.MiddlewareInputContext<_$better_auth0.MiddlewareOptions>) => Promise)[]; query: _$zod.ZodObject<{ callbackURL: _$zod.ZodOptional<_$zod.ZodString>; }, _$zod_v4_core0.$strip>; metadata: { openapi: { operationId: string; description: string; parameters: ({ name: string; in: "path"; required: true; description: string; schema: { type: "string"; }; } | { name: string; in: "query"; required: true; description: string; schema: { type: "string"; }; })[]; responses: { "302": { description: string; headers: { Location: { description: string; schema: { type: string; }; }; }; }; }; }; }; }, { status: ("OK" | "CREATED" | "ACCEPTED" | "NO_CONTENT" | "MULTIPLE_CHOICES" | "MOVED_PERMANENTLY" | "FOUND" | "SEE_OTHER" | "NOT_MODIFIED" | "TEMPORARY_REDIRECT" | "BAD_REQUEST" | "UNAUTHORIZED" | "PAYMENT_REQUIRED" | "FORBIDDEN" | "NOT_FOUND" | "METHOD_NOT_ALLOWED" | "NOT_ACCEPTABLE" | "PROXY_AUTHENTICATION_REQUIRED" | "REQUEST_TIMEOUT" | "CONFLICT" | "GONE" | "LENGTH_REQUIRED" | "PRECONDITION_FAILED" | "PAYLOAD_TOO_LARGE" | "URI_TOO_LONG" | "UNSUPPORTED_MEDIA_TYPE" | "RANGE_NOT_SATISFIABLE" | "EXPECTATION_FAILED" | "I'M_A_TEAPOT" | "MISDIRECTED_REQUEST" | "UNPROCESSABLE_ENTITY" | "LOCKED" | "FAILED_DEPENDENCY" | "TOO_EARLY" | "UPGRADE_REQUIRED" | "PRECONDITION_REQUIRED" | "TOO_MANY_REQUESTS" | "REQUEST_HEADER_FIELDS_TOO_LARGE" | "UNAVAILABLE_FOR_LEGAL_REASONS" | "INTERNAL_SERVER_ERROR" | "NOT_IMPLEMENTED" | "BAD_GATEWAY" | "SERVICE_UNAVAILABLE" | "GATEWAY_TIMEOUT" | "HTTP_VERSION_NOT_SUPPORTED" | "VARIANT_ALSO_NEGOTIATES" | "INSUFFICIENT_STORAGE" | "LOOP_DETECTED" | "NOT_EXTENDED" | "NETWORK_AUTHENTICATION_REQUIRED") | _$better_auth0.Status; body: ({ message?: string; code?: string; cause?: unknown; } & Record) | undefined; headers: HeadersInit; statusCode: number; name: string; message: string; stack?: string; cause?: unknown; } | undefined>; cancelInvite: _$better_auth0.StrictEndpoint<"/invite/cancel", { method: "POST"; use: ((inputContext: _$better_auth0.MiddlewareInputContext<_$better_auth0.MiddlewareOptions>) => 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; }; }; }>)[]; body: _$zod.ZodObject<{ token: _$zod.ZodString; }, _$zod_v4_core0.$strip>; metadata: { openapi: { operationId: string; description: string; responses: { "200": { description: string; content: { "application/json": { schema: { type: "object"; properties: { status: { type: string; example: boolean; }; message: { type: string; example: string; }; }; required: string[]; }; }; }; }; "400": { description: string; content: { "application/json": { schema: { type: "object"; properties: { message: { type: string; }; errorCode: { type: string; }; }; }; }; }; }; }; }; }; }, { status: boolean; message: string; }>; getInvite: _$better_auth0.StrictEndpoint<"/invite/get", { method: "GET"; query: _$zod.ZodObject<{ token: _$zod.ZodString; }, _$zod_v4_core0.$strip>; metadata: { openapi: { operationId: string; description: string; responses: { "200": { description: string; content: { "application/json": { schema: { type: "object"; properties: { status: { type: string; example: boolean; }; inviter: { type: string; properties: { email: { type: string; }; name: { type: string; nullable: boolean; }; image: { type: string; nullable: boolean; }; }; }; invitation: { type: string; properties: { email: { type: string; nullable: boolean; }; emails: { type: string; }; createdAt: { type: string; format: string; }; role: { type: string; }; newAccount: { type: string; }; }; }; }; required: string[]; }; }; }; }; "400": { description: string; content: { "application/json": { schema: { type: "object"; properties: { message: { type: string; }; errorCode: { type: string; }; }; }; }; }; }; }; }; }; }, { status: boolean; inviter: { email: string; name: string; image: string | null | undefined; }; invitation: { email: string | undefined; emails: string[]; createdAt: Date; role: string; newAccount: boolean | undefined; }; }>; rejectInvite: _$better_auth0.StrictEndpoint<"/invite/reject", { method: "POST"; use: ((inputContext: _$better_auth0.MiddlewareInputContext<_$better_auth0.MiddlewareOptions>) => 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; }; }; }>)[]; body: _$zod.ZodObject<{ token: _$zod.ZodString; }, _$zod_v4_core0.$strip>; metadata: { openapi: { operationId: string; description: string; responses: { "200": { description: string; content: { "application/json": { schema: { type: "object"; properties: { status: { type: string; example: boolean; }; message: { type: string; example: string; }; }; required: string[]; }; }; }; }; "400": { description: string; content: { "application/json": { schema: { type: "object"; properties: { message: { type: string; }; errorCode: { type: string; }; }; }; }; }; }; }; }; }; }, { status: boolean; message: string; }>; listInvites: _$better_auth0.StrictEndpoint<"/invite/list", { method: "GET"; use: ((inputContext: _$better_auth0.MiddlewareInputContext<_$better_auth0.MiddlewareOptions>) => 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; }; }; }>)[]; query: _$zod.ZodObject<{ searchValue: _$zod.ZodOptional<_$zod.ZodString>; searchField: _$zod.ZodOptional<_$zod.ZodEnum<{ email: "email"; name: "name"; domainWhitelist: "domainWhitelist"; }>>; searchOperator: _$zod.ZodOptional<_$zod.ZodEnum<{ contains: "contains"; starts_with: "starts_with"; ends_with: "ends_with"; }>>; limit: _$zod.ZodOptional<_$zod.ZodCoercedNumber>; offset: _$zod.ZodOptional<_$zod.ZodCoercedNumber>; sortBy: _$zod.ZodOptional<_$zod.ZodString>; sortDirection: _$zod.ZodOptional<_$zod.ZodEnum<{ asc: "asc"; desc: "desc"; }>>; filterField: _$zod.ZodOptional<_$zod.ZodString>; filterValue: _$zod.ZodOptional<_$zod.ZodUnion<[_$zod.ZodUnion<[_$zod.ZodString, _$zod.ZodNumber]>, _$zod.ZodBoolean]>>; filterOperator: _$zod.ZodOptional<_$zod.ZodEnum<{ eq: "eq"; ne: "ne"; lt: "lt"; lte: "lte"; gt: "gt"; gte: "gte"; }>>; }, _$zod_v4_core0.$strip>; metadata: { openapi: { operationId: string; description: string; responses: { 200: { description: string; content: { "application/json": { schema: { type: "object"; properties: { invitations: { type: string; items: { $ref: string; }; }; total: { type: string; }; limit: { type: string[]; }; offset: { type: string[]; }; }; }; }; }; }; }; }; }; }, { total: number; invitations: InviteTypeWithId[]; limit: number | undefined; offset: number | undefined; } | { total: number; invitations: never[]; }>; }; hooks: { after: { matcher: (context: _$better_auth0.HookEndpointContext) => boolean; handler: (inputContext: _$better_auth0.MiddlewareInputContext<_$better_auth0.MiddlewareOptions>) => Promise<{ status: ("OK" | "CREATED" | "ACCEPTED" | "NO_CONTENT" | "MULTIPLE_CHOICES" | "MOVED_PERMANENTLY" | "FOUND" | "SEE_OTHER" | "NOT_MODIFIED" | "TEMPORARY_REDIRECT" | "BAD_REQUEST" | "UNAUTHORIZED" | "PAYMENT_REQUIRED" | "FORBIDDEN" | "NOT_FOUND" | "METHOD_NOT_ALLOWED" | "NOT_ACCEPTABLE" | "PROXY_AUTHENTICATION_REQUIRED" | "REQUEST_TIMEOUT" | "CONFLICT" | "GONE" | "LENGTH_REQUIRED" | "PRECONDITION_FAILED" | "PAYLOAD_TOO_LARGE" | "URI_TOO_LONG" | "UNSUPPORTED_MEDIA_TYPE" | "RANGE_NOT_SATISFIABLE" | "EXPECTATION_FAILED" | "I'M_A_TEAPOT" | "MISDIRECTED_REQUEST" | "UNPROCESSABLE_ENTITY" | "LOCKED" | "FAILED_DEPENDENCY" | "TOO_EARLY" | "UPGRADE_REQUIRED" | "PRECONDITION_REQUIRED" | "TOO_MANY_REQUESTS" | "REQUEST_HEADER_FIELDS_TOO_LARGE" | "UNAVAILABLE_FOR_LEGAL_REASONS" | "INTERNAL_SERVER_ERROR" | "NOT_IMPLEMENTED" | "BAD_GATEWAY" | "SERVICE_UNAVAILABLE" | "GATEWAY_TIMEOUT" | "HTTP_VERSION_NOT_SUPPORTED" | "VARIANT_ALSO_NEGOTIATES" | "INSUFFICIENT_STORAGE" | "LOOP_DETECTED" | "NOT_EXTENDED" | "NETWORK_AUTHENTICATION_REQUIRED") | _$better_auth0.Status; body: ({ message?: string; code?: string; cause?: unknown; } & Record) | undefined; headers: HeadersInit; statusCode: number; name: string; message: string; stack?: string; cause?: unknown; } | undefined>; }[]; }; $ERROR_CODES: { INVALID_TOKEN: _$better_auth0.RawError<"INVALID_TOKEN">; USER_NOT_LOGGED_IN: _$better_auth0.RawError<"USER_NOT_LOGGED_IN">; INSUFFICIENT_PERMISSIONS: _$better_auth0.RawError<"INSUFFICIENT_PERMISSIONS">; NO_SUCH_USER: _$better_auth0.RawError<"NO_SUCH_USER">; NO_USES_LEFT_FOR_INVITE: _$better_auth0.RawError<"NO_USES_LEFT_FOR_INVITE">; INVALID_OR_EXPIRED_INVITE: _$better_auth0.RawError<"INVALID_OR_EXPIRED_INVITE">; INVALID_EMAIL: _$better_auth0.RawError<"INVALID_EMAIL">; CANT_ACCEPT_INVITE: _$better_auth0.RawError<"CANT_ACCEPT_INVITE">; CANT_REJECT_INVITE: _$better_auth0.RawError<"CANT_REJECT_INVITE">; INVITER_NOT_FOUND: _$better_auth0.RawError<"INVITER_NOT_FOUND">; ERROR_SENDING_THE_INVITATION_EMAIL: _$better_auth0.RawError<"ERROR_SENDING_THE_INVITATION_EMAIL">; ADMIN_PLUGIN_IS_NOT_SET_UP: _$better_auth0.RawError<"ADMIN_PLUGIN_IS_NOT_SET_UP">; INVITATION_EMAIL_NOT_ENABLED: _$better_auth0.RawError<"INVITATION_EMAIL_NOT_ENABLED">; INVITE_TOKEN_HAS_ALREADY_BEEN_USED: _$better_auth0.RawError<"INVITE_TOKEN_HAS_ALREADY_BEEN_USED">; INVITATION_NOT_CREATED: _$better_auth0.RawError<"INVITATION_NOT_CREATED">; }; schema: { invite: { fields: { token: { type: "string"; unique: true; }; createdAt: { type: "date"; }; expiresAt: { type: "date"; required: true; }; maxUses: { type: "number"; required: true; }; infinityMaxUses: { type: "boolean"; required: true; defaultValue: false; }; createdByUserId: { type: "string"; references: { model: string; field: string; onDelete: "set null"; }; }; redirectToAfterUpgrade: { type: "string"; required: false; }; shareInviterName: { type: "boolean"; required: true; }; email: { type: "string"; required: false; }; emails: { type: "string[]"; required: false; }; role: { type: "string"; required: true; }; newAccount: { type: "boolean"; required: false; }; status: { type: ["pending", "rejected", "canceled", "used"]; required: true; }; }; }; inviteUse: { fields: { inviteId: { type: "string"; required: true; references: { model: string; field: string; onDelete: "set null"; }; }; usedAt: { type: "date"; required: true; }; usedByUserId: { type: "string"; required: false; references: { model: string; field: string; onDelete: "set null"; }; }; }; }; }; $Infer: { InviteType: InviteType; }; }; //#endregion export { InviteClientPlugin, invite, inviteClient };