diff --git a/index.d.ts b/index.d.ts index 39f64f7..2871023 100644 --- a/index.d.ts +++ b/index.d.ts @@ -24,6 +24,22 @@ export interface Pool extends mysql.Connection { on(event: 'enqueue', listener: () => any): this; } +type authPlugins = + (pluginMetadata: { connection: Connection; command: string }) => + (pluginData: Buffer) => Promise; + +export interface ConnectionOptions extends mysql.ConnectionOptions { + authPlugins?: { + [key: string]: authPlugins; + }; +} + +export interface PoolOptions extends mysql.PoolOptions { + authPlugins?: { + [key: string]: authPlugins; + }; +} + export function createConnection(connectionUri: string): Connection; -export function createConnection(config: mysql.ConnectionOptions): Connection; -export function createPool(config: mysql.PoolOptions): Pool; +export function createConnection(config: ConnectionOptions): Connection; +export function createPool(config: PoolOptions): Pool;