import type { NextAuthConfig } from "next-auth"; import type { Adapter } from "next-auth/adapters"; import type { Payload } from "payload"; import type { AuthCollectionSlug } from "../payload/plugin.js"; /** * An enriched version of the NextAuthConfig that includes the payload instance and database adapter in event callbacks */ export type EnrichedAuthConfig = { events?: EnrichedEvents; } & Omit; type EnrichedEvents = { [EventName in keyof NonNullable]?: (message: { /** * The Auth.js database adapter */ adapter?: Adapter; /** * The payload instance */ payload?: Payload; } & Parameters[EventName]>>[0]) => void | PromiseLike; }; /** * Setup Auth.js configuration * * - Register the Payload adapter for Auth.js * - Set default session strategy to "jwt" if not already set * - Enrich the Auth.js configuration by wrapping event callbacks to include the payload instance and database adapter */ export declare const withPayloadAuthjs: ({ payload, config, collectionSlug, }: { payload: Payload; config: EnrichedAuthConfig; collectionSlug: AuthCollectionSlug; }) => NextAuthConfig; export {};