mirror of
https://github.com/LukeHagar/better-auth.git
synced 2025-12-10 12:27:44 +00:00
refactor: Adapter createSchema return type (#1145)
This commit is contained in:
@@ -65,20 +65,35 @@ export type Adapter = {
|
||||
*
|
||||
* @param options
|
||||
* @param file - file path if provided by the user
|
||||
* @returns
|
||||
*/
|
||||
createSchema?: (
|
||||
options: BetterAuthOptions,
|
||||
file?: string,
|
||||
) => Promise<{
|
||||
code: string;
|
||||
fileName: string;
|
||||
append?: boolean;
|
||||
overwrite?: boolean;
|
||||
}>;
|
||||
) => Promise<AdapterSchemaCreation>;
|
||||
options?: Record<string, any>;
|
||||
};
|
||||
|
||||
export type AdapterSchemaCreation = {
|
||||
/**
|
||||
* Code to be inserted into the file
|
||||
*/
|
||||
code: string;
|
||||
/**
|
||||
* Path to the file, including the file name and extension.
|
||||
* Relative paths are supported, with the current working directory devs as the base.
|
||||
*/
|
||||
path: string;
|
||||
/**
|
||||
* Append the file if it already exists.
|
||||
* Note: This will not apply if `overwrite` is set to true.
|
||||
*/
|
||||
append?: boolean;
|
||||
/**
|
||||
* Overwrite the file if it already exists
|
||||
*/
|
||||
overwrite?: boolean;
|
||||
};
|
||||
|
||||
export interface AdapterInstance {
|
||||
(options: BetterAuthOptions): Adapter;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user