refactor: Adapter createSchema return type (#1145)

This commit is contained in:
Multinite
2025-01-05 23:44:46 +10:00
committed by GitHub
parent 3457750da9
commit 753f930e88

View File

@@ -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;
}