diff --git a/packages/flight-sql-client/package.json b/packages/flight-sql-client/package.json index df9a216..0ce073a 100644 --- a/packages/flight-sql-client/package.json +++ b/packages/flight-sql-client/package.json @@ -41,9 +41,6 @@ }, "scripts": { "bench": "node --import @swc-node/register/esm-register benchmark/bench.ts", - "build:cleanjs": "del dist", - "build:js": "swc src -d ./dist --config-file ../../.swcrc --strip-leading-paths", - "build:types": "pnpm build && pnpm:cleanjs && pnpm build:js", "build:debug": "napi build --platform", "build": "napi build --platform --release", "test": "node --experimental-vm-modules ../../node_modules/jest/bin/jest.js", diff --git a/packages/flight-sql-client/ts/client.ts b/packages/flight-sql-client/ts/client.ts deleted file mode 100644 index 08a5f0d..0000000 --- a/packages/flight-sql-client/ts/client.ts +++ /dev/null @@ -1,96 +0,0 @@ -import { - type Binary, - type Table, - type TypeMap, - type Utf8, - tableFromIPC, -} from 'apache-arrow' - -import { - type ClientOptions, - type FlightSqlClient, - type GetDbSchemasOptions, - type GetTablesOptions, - createFlightSqlClient, -} from '../index' - -type catalogsSchema = { - catalog_name: Utf8 -} - -type dbSchemasSchema = { - catalog_name: Utf8 - db_schema_name: Utf8 -} - -type tablesSchema = { - catalog_name: Utf8 - db_schema_name: Utf8 - table_name: Utf8 - table_type: Utf8 - table_schema?: Binary -} - -export class ArrowFlightClient { - static async fromOptions(options: ClientOptions): Promise { - const client = await createFlightSqlClient(options) - return new ArrowFlightClient(client) - } - - constructor(private readonly client: FlightSqlClient) {} - - // biome-ignore lint/suspicious/noExplicitAny: matching arrow table definition - async query(query: string): Promise> { - const result = await this.client.query(query) - return tableFromIPC(result) - } - - // biome-ignore lint/suspicious/noExplicitAny: matching arrow table definition - async preparedStatement( - query: string, - parameters: Array<[string, string]>, - ): Promise> { - const result = await this.client.preparedStatement(query, parameters) - return tableFromIPC(result) - } - - /** - * Retrieve the list of catalogs on a Flight SQL enabled backend. - * - * The definition of a catalog depends on vendor/implementation. - * It is usually the database itself - * - * @returns Arrow Table with catalog information - */ - async getCatalogs(): Promise> { - const result = await this.client.getCatalogs() - return tableFromIPC(result) - } - - /** - * Retrieve the list of database schemas on a Flight SQL enabled backend. - * - * The definition of a database schema depends on vendor/implementation. - * It is usually a collection of tables. - * - * @param options filters to limit returned schemas - * @returns Arrow Table with schema information - */ - async getDbSchemas( - options: GetDbSchemasOptions, - ): Promise> { - const result = await this.client.getDbSchemas(options) - return tableFromIPC(result) - } - - /** - * Retrieve the list of tables, and optionally their schemas, on a Flight SQL enabled backend. - * - * @param options filters to limit returned tables - * @returns Arrow Table with table information - */ - async getTables(options: GetTablesOptions): Promise> { - const result = await this.client.getTables(options) - return tableFromIPC(result) - } -} diff --git a/packages/flight-sql-client/ts/index.ts b/packages/flight-sql-client/ts/index.ts deleted file mode 100644 index 83dae76..0000000 --- a/packages/flight-sql-client/ts/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './client' diff --git a/packages/flight-sql-client/tsconfig.json b/packages/flight-sql-client/tsconfig.json index b4c366e..bc3ef51 100644 --- a/packages/flight-sql-client/tsconfig.json +++ b/packages/flight-sql-client/tsconfig.json @@ -11,5 +11,5 @@ "allowSyntheticDefaultImports": true }, "include": ["."], - "exclude": ["node_modules", "bench", "__test__"] + "exclude": ["node_modules", "bench", "test"] }