import { Namespace } from './api/namespace' import { Driver, type ClientOptions } from './driver' export * from './api/builder' export * from './api/lease' export * from './api/lock' export * from './api/namespace' export * from './api/range' export * from './api/rpc' export * from './api/stm' export { WatchBuilder, Watcher } from './api/watch' export { type ClientOptions, DB_TYPE, type ETCDClientOptions, type SQLiteClientOptions } from './driver' export type * from './base/options' export * from './base/errors' export class DBClient extends Namespace { private readonly clientOptions: ClientOptions private readonly dbDriver: Driver constructor(options: ClientOptions) { const dbDriver = new Driver(options) super(Buffer.from([]), dbDriver, {}) this.clientOptions = options this.dbDriver = dbDriver } async init() { try { await this.dbDriver.init(this.clientOptions) await this.get('dummy-key').string() } catch (error) { throw new Error('Failed to connect db server.') } } public close() { this.dbDriver.close() } }