diff --git a/promise.d.ts b/promise.d.ts index e9f3e08a1d..b700520548 100644 --- a/promise.d.ts +++ b/promise.d.ts @@ -7,9 +7,11 @@ import { FieldPacket, QueryOptions, ConnectionOptions, + Connection as CoreConnection, PoolOptions, PoolClusterOptions, Pool as CorePool, + PoolConnection as CorePoolConnection, } from './index.js'; import { ExecutableBase as ExecutableBaseClass } from './typings/mysql/lib/protocol/sequences/promise/ExecutableBase.js'; import { QueryableBase as QueryableBaseClass } from './typings/mysql/lib/protocol/sequences/promise/QueryableBase.js'; @@ -42,6 +44,8 @@ export interface PreparedStatementInfo { export interface Connection extends QueryableAndExecutableBase { config: ConnectionOptions; + connection: CoreConnection; + threadId: number; connect(): Promise; @@ -78,17 +82,16 @@ export interface Connection extends QueryableAndExecutableBase { export interface PoolConnection extends Connection { release(): void; - connection: Connection; } -export interface Pool extends Connection { +export interface Pool extends Pick { getConnection(): Promise; releaseConnection(connection: PoolConnection): void; - on(event: 'connection', listener: (connection: PoolConnection) => any): this; - on(event: 'acquire', listener: (connection: PoolConnection) => any): this; - on(event: 'release', listener: (connection: PoolConnection) => any): this; + on(event: 'connection', listener: (connection: CorePoolConnection) => any): this; + on(event: 'acquire', listener: (connection: CorePoolConnection) => any): this; + on(event: 'release', listener: (connection: CorePoolConnection) => any): this; on(event: 'enqueue', listener: () => any): this; end(): Promise; diff --git a/typings/mysql/lib/Connection.d.ts b/typings/mysql/lib/Connection.d.ts index 6af95e1f7d..61c4584196 100644 --- a/typings/mysql/lib/Connection.d.ts +++ b/typings/mysql/lib/Connection.d.ts @@ -335,7 +335,7 @@ export interface ConnectionOptions { jsonStrings?: boolean; } -declare class Connection extends QueryableBase(ExecutableBase(EventEmitter)) { +declare class BaseConnection extends QueryableBase(ExecutableBase(EventEmitter)) { config: ConnectionOptions; threadId: number; @@ -414,8 +414,6 @@ declare class Connection extends QueryableBase(ExecutableBase(EventEmitter)) { serverHandshake(args: any): any; - promise(promiseImpl?: PromiseConstructor): PromiseConnection; - ping(callback?: (err: QueryError | null) => any): void; writeOk(args?: OkPacketParams): void; @@ -431,4 +429,7 @@ declare class Connection extends QueryableBase(ExecutableBase(EventEmitter)) { sequenceId: number; } -export { Connection }; +declare class Connection extends BaseConnection { + promise(promiseImpl?: PromiseConstructor): PromiseConnection; +} +export { Connection, BaseConnection }; diff --git a/typings/mysql/lib/Pool.d.ts b/typings/mysql/lib/Pool.d.ts index 042495e71f..1941830fb3 100644 --- a/typings/mysql/lib/Pool.d.ts +++ b/typings/mysql/lib/Pool.d.ts @@ -63,6 +63,13 @@ declare class Pool extends QueryableBase(ExecutableBase(EventEmitter)) { promise(promiseImpl?: PromiseConstructor): PromisePool; + format(sql: string, values?: any | any[] | { [param: string]: any }): string; + + escape(value: any): string; + + escapeId(value: string | string[]): string; + escapeId(values: string[]): string; + config: PoolOptions; } diff --git a/typings/mysql/lib/PoolConnection.d.ts b/typings/mysql/lib/PoolConnection.d.ts index cce4ef726e..26fd81bb0d 100644 --- a/typings/mysql/lib/PoolConnection.d.ts +++ b/typings/mysql/lib/PoolConnection.d.ts @@ -1,7 +1,7 @@ -import { Connection } from './Connection.js'; +import { Connection, BaseConnection } from './Connection.js'; import { Pool as PromisePool } from '../../../promise.js'; -declare class PoolConnection extends Connection { +declare class PoolConnection extends BaseConnection { connection: Connection; release(): void; promise(promiseImpl?: PromiseConstructor): PromisePool;