import { ExtractPluginField, InferPluginFieldFromTuple, UnionToIntersection } from "./helper.mjs"; import { AuthContext, BetterAuthOptions, BetterAuthPlugin } from "@better-auth/core"; import { BetterAuthPluginDBSchema } from "@better-auth/core/db"; //#region src/types/plugins.d.ts type InferOptionSchema = S extends Record ? { [K in keyof S]?: { modelName?: string | undefined; fields?: { [P in keyof Fields]?: string } | undefined; } } : never; type InferPluginErrorCodes = O["plugins"] extends readonly [unknown, ...unknown[]] ? InferPluginFieldFromTuple : O["plugins"] extends Array ? UnionToIntersection> : {}; type InferPluginIDs = O["plugins"] extends Array ? UnionToIntersection

: never; type ExtractInitContext

= P["init"] extends ((...args: any[]) => infer R) ? Awaited extends { context?: infer C; } ? C extends Record ? Omit : {} : {} : {}; type InferPluginContext = O["plugins"] extends Array ? UnionToIntersection

: {}> : {}; //#endregion export { InferOptionSchema, InferPluginContext, InferPluginErrorCodes, InferPluginIDs };