@qualithm/arrow-flight-client 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/LICENSE +190 -0
  2. package/README.md +258 -0
  3. package/dist/client/create-flight-client.d.ts +28 -0
  4. package/dist/client/create-flight-client.d.ts.map +1 -0
  5. package/dist/client/create-flight-client.js +29 -0
  6. package/dist/client/create-flight-client.js.map +1 -0
  7. package/dist/client/create-flight-sql-client.d.ts +28 -0
  8. package/dist/client/create-flight-sql-client.d.ts.map +1 -0
  9. package/dist/client/create-flight-sql-client.js +29 -0
  10. package/dist/client/create-flight-sql-client.js.map +1 -0
  11. package/dist/client/errors.d.ts +81 -0
  12. package/dist/client/errors.d.ts.map +1 -0
  13. package/dist/client/errors.js +106 -0
  14. package/dist/client/errors.js.map +1 -0
  15. package/dist/client/flight-client.d.ts +161 -0
  16. package/dist/client/flight-client.d.ts.map +1 -0
  17. package/dist/client/flight-client.js +403 -0
  18. package/dist/client/flight-client.js.map +1 -0
  19. package/dist/client/flight-sql-client.d.ts +348 -0
  20. package/dist/client/flight-sql-client.d.ts.map +1 -0
  21. package/dist/client/flight-sql-client.js +689 -0
  22. package/dist/client/flight-sql-client.js.map +1 -0
  23. package/dist/client/index.d.ts +11 -0
  24. package/dist/client/index.d.ts.map +1 -0
  25. package/dist/client/index.js +10 -0
  26. package/dist/client/index.js.map +1 -0
  27. package/dist/client/ipc.d.ts +131 -0
  28. package/dist/client/ipc.d.ts.map +1 -0
  29. package/dist/client/ipc.js +246 -0
  30. package/dist/client/ipc.js.map +1 -0
  31. package/dist/client/types.d.ts +153 -0
  32. package/dist/client/types.d.ts.map +1 -0
  33. package/dist/client/types.js +26 -0
  34. package/dist/client/types.js.map +1 -0
  35. package/dist/gen/arrow/flight/FlightSql_pb.d.ts +3173 -0
  36. package/dist/gen/arrow/flight/FlightSql_pb.d.ts.map +1 -0
  37. package/dist/gen/arrow/flight/FlightSql_pb.js +2258 -0
  38. package/dist/gen/arrow/flight/FlightSql_pb.js.map +1 -0
  39. package/dist/gen/arrow/flight/Flight_pb.d.ts +1159 -0
  40. package/dist/gen/arrow/flight/Flight_pb.d.ts.map +1 -0
  41. package/dist/gen/arrow/flight/Flight_pb.js +397 -0
  42. package/dist/gen/arrow/flight/Flight_pb.js.map +1 -0
  43. package/dist/index.d.ts +12 -0
  44. package/dist/index.d.ts.map +1 -0
  45. package/dist/index.js +14 -0
  46. package/dist/index.js.map +1 -0
  47. package/package.json +96 -0
package/LICENSE ADDED
@@ -0,0 +1,190 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to the Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ Copyright 2026 Qualithm
179
+
180
+ Licensed under the Apache License, Version 2.0 (the "License");
181
+ you may not use this file except in compliance with the License.
182
+ You may obtain a copy of the License at
183
+
184
+ http://www.apache.org/licenses/LICENSE-2.0
185
+
186
+ Unless required by applicable law or agreed to in writing, software
187
+ distributed under the License is distributed on an "AS IS" BASIS,
188
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
189
+ See the License for the specific language governing permissions and
190
+ limitations under the License.
package/README.md ADDED
@@ -0,0 +1,258 @@
1
+ # Arrow Flight Client
2
+
3
+ [![CI](https://github.com/qualithm/arrow-flight-client-js/actions/workflows/ci.yaml/badge.svg)](https://github.com/qualithm/arrow-flight-client-js/actions/workflows/ci.yaml)
4
+ [![codecov](https://codecov.io/gh/qualithm/arrow-flight-client-js/graph/badge.svg)](https://codecov.io/gh/qualithm/arrow-flight-client-js)
5
+ [![npm](https://img.shields.io/npm/v/@qualithm/arrow-flight-client)](https://www.npmjs.com/package/@qualithm/arrow-flight-client)
6
+
7
+ Unified Arrow Flight and Flight SQL client for JavaScript and TypeScript runtimes. Provides complete
8
+ gRPC client support for Apache Arrow Flight and Flight SQL protocols.
9
+
10
+ ## Features
11
+
12
+ - **Flight RPC** — All core methods: listFlights, getFlightInfo, doGet, doPut, doAction, etc.
13
+ - **Flight SQL** — SQL queries, prepared statements, transactions, and database metadata
14
+ - **Authentication** — Bearer tokens, mTLS, and Flight Handshake (BasicAuth)
15
+ - **Arrow IPC** — Encode/decode Apache Arrow data for streaming transfers
16
+ - **Multi-runtime** — Works with Bun, Node.js 20+, and Deno
17
+
18
+ ## Installation
19
+
20
+ ```bash
21
+ bun add @qualithm/arrow-flight-client
22
+ # or
23
+ npm install @qualithm/arrow-flight-client
24
+ ```
25
+
26
+ ## Quick Start
27
+
28
+ ### FlightClient (Core Flight RPC)
29
+
30
+ ```ts
31
+ import { createFlightClient, decodeFlightDataToTable } from "@qualithm/arrow-flight-client"
32
+
33
+ // Create a client
34
+ const client = createFlightClient({
35
+ url: "http://localhost:50051",
36
+ auth: { type: "bearer", token: "your-token" }
37
+ })
38
+
39
+ // List available flights
40
+ for await (const info of client.listFlights()) {
41
+ console.log(info.flightDescriptor?.path)
42
+ }
43
+
44
+ // Fetch data
45
+ const flightInfo = await client.getFlightInfo({ type: "path", path: ["my", "dataset"] })
46
+ const ticket = flightInfo.endpoint[0].ticket
47
+ const table = await decodeFlightDataToTable(client.doGet(ticket))
48
+
49
+ console.log(`Received ${table.numRows} rows`)
50
+
51
+ // Clean up
52
+ client.close()
53
+ ```
54
+
55
+ ### FlightSqlClient (SQL Operations)
56
+
57
+ ```ts
58
+ import { createFlightSqlClient } from "@qualithm/arrow-flight-client"
59
+
60
+ const client = createFlightSqlClient({
61
+ url: "http://localhost:50051",
62
+ auth: { type: "bearer", token: "your-token" }
63
+ })
64
+
65
+ // Execute a query
66
+ const table = await client.query("SELECT * FROM users LIMIT 10")
67
+ console.log(`Got ${table.numRows} rows`)
68
+
69
+ // Stream large results
70
+ for await (const batch of client.queryBatches("SELECT * FROM large_table")) {
71
+ console.log(`Batch: ${batch.numRows} rows`)
72
+ }
73
+
74
+ // Prepared statements
75
+ const stmt = await client.prepare("SELECT * FROM users WHERE id = ?")
76
+ const result = await client.executePrepared(stmt)
77
+ await client.closePreparedStatement(stmt)
78
+
79
+ // Transactions
80
+ const txn = await client.beginTransaction()
81
+ try {
82
+ await client.executeUpdate("INSERT INTO users (name) VALUES ('Alice')", {
83
+ transactionId: txn.id
84
+ })
85
+ await client.commit(txn)
86
+ } catch {
87
+ await client.rollback(txn)
88
+ }
89
+
90
+ // Database metadata
91
+ const catalogs = await client.getCatalogs()
92
+ const schemas = await client.getDbSchemas({})
93
+ const tables = await client.getTables({})
94
+
95
+ client.close()
96
+ ```
97
+
98
+ ## Authentication
99
+
100
+ ### Bearer Token
101
+
102
+ ```ts
103
+ const client = createFlightClient({
104
+ url: "https://flight-server:50051",
105
+ auth: { type: "bearer", token: "your-api-token" }
106
+ })
107
+ ```
108
+
109
+ ### Basic Auth (Flight Handshake)
110
+
111
+ ```ts
112
+ const client = createFlightClient({
113
+ url: "https://flight-server:50051",
114
+ auth: {
115
+ type: "basic",
116
+ credentials: { username: "user", password: "pass" }
117
+ }
118
+ })
119
+
120
+ // Authenticate (performs Flight Handshake RPC)
121
+ await client.authenticate()
122
+ ```
123
+
124
+ ### mTLS
125
+
126
+ ```ts
127
+ import { readFileSync } from "node:fs"
128
+
129
+ const client = createFlightClient({
130
+ url: "https://flight-server:50051",
131
+ tls: {
132
+ ca: readFileSync("ca.pem"),
133
+ cert: readFileSync("client.pem"),
134
+ key: readFileSync("client-key.pem")
135
+ }
136
+ })
137
+ ```
138
+
139
+ ## Arrow IPC Utilities
140
+
141
+ ```ts
142
+ import {
143
+ encodeTableToFlightData,
144
+ decodeFlightDataToTable,
145
+ decodeFlightDataStream
146
+ } from "@qualithm/arrow-flight-client"
147
+ import { tableFromArrays } from "apache-arrow"
148
+
149
+ // Create Arrow data
150
+ const table = tableFromArrays({
151
+ id: Int32Array.from([1, 2, 3]),
152
+ name: ["Alice", "Bob", "Charlie"]
153
+ })
154
+
155
+ // Encode for upload
156
+ const flightData = encodeTableToFlightData(table)
157
+
158
+ // Decode a stream
159
+ const receivedTable = await decodeFlightDataToTable(flightDataStream)
160
+
161
+ // Stream batches
162
+ for await (const batch of decodeFlightDataStream(flightDataStream)) {
163
+ console.log(`Batch: ${batch.numRows} rows`)
164
+ }
165
+ ```
166
+
167
+ ## Error Handling
168
+
169
+ ```ts
170
+ import {
171
+ FlightError,
172
+ FlightConnectionError,
173
+ FlightAuthError,
174
+ FlightServerError,
175
+ FlightTimeoutError
176
+ } from "@qualithm/arrow-flight-client"
177
+
178
+ try {
179
+ await client.query("SELECT * FROM users")
180
+ } catch (error) {
181
+ if (FlightConnectionError.isError(error)) {
182
+ console.error("connection failed:", error.message)
183
+ } else if (FlightAuthError.isError(error)) {
184
+ console.error("authentication failed:", error.message)
185
+ } else if (FlightServerError.isError(error)) {
186
+ console.error("server error:", error.message)
187
+ } else if (FlightTimeoutError.isError(error)) {
188
+ console.error("request timed out:", error.message)
189
+ } else if (FlightError.isError(error)) {
190
+ console.error("flight error:", error.message)
191
+ }
192
+ }
193
+ ```
194
+
195
+ ## API Documentation
196
+
197
+ Full API documentation is available in the [docs](docs/) directory. Generate locally with:
198
+
199
+ ```bash
200
+ bun run docs
201
+ ```
202
+
203
+ ## Examples
204
+
205
+ See the [examples](examples/) directory for runnable examples:
206
+
207
+ - [flight-client.ts](examples/flight-client.ts) — FlightClient operations
208
+ - [flight-sql-client.ts](examples/flight-sql-client.ts) — FlightSqlClient SQL operations
209
+
210
+ ## Development
211
+
212
+ ### Prerequisites
213
+
214
+ - [Bun](https://bun.sh/) (recommended), Node.js 20+, or [Deno](https://deno.land/)
215
+
216
+ ### Setup
217
+
218
+ ```bash
219
+ bun install
220
+ ```
221
+
222
+ ### Building
223
+
224
+ ```bash
225
+ bun run build
226
+ ```
227
+
228
+ ### Testing
229
+
230
+ ```bash
231
+ bun test # Unit tests
232
+ bun test:integration # Integration tests (requires Flight server)
233
+ bun test:coverage # Coverage report
234
+ ```
235
+
236
+ ### Linting & Formatting
237
+
238
+ ```bash
239
+ bun run lint
240
+ bun run format
241
+ bun run typecheck
242
+ ```
243
+
244
+ ### Benchmarks
245
+
246
+ ```bash
247
+ bun run bench # Server benchmarks (requires Flight server)
248
+ bun run bench:ipc # Arrow IPC benchmarks
249
+ ```
250
+
251
+ ## Publishing
252
+
253
+ The package is automatically published to NPM when CI passes on main. Update the version in
254
+ `package.json` before merging to trigger a new release.
255
+
256
+ ## Licence
257
+
258
+ Apache-2.0
@@ -0,0 +1,28 @@
1
+ import { FlightClient } from "./flight-client.js";
2
+ import type { FlightClientOptions } from "./types.js";
3
+ /**
4
+ * Factory function to create a FlightClient.
5
+ *
6
+ * This is the recommended way to create a Flight client as it provides
7
+ * a cleaner API and better tree-shaking support.
8
+ *
9
+ * @example
10
+ * ```ts
11
+ * const client = createFlightClient({
12
+ * url: "https://flight.example.com:8815",
13
+ * headers: { "Authorization": "Bearer token" }
14
+ * })
15
+ *
16
+ * try {
17
+ * const info = await client.getFlightInfo({ type: "path", path: ["my-dataset"] })
18
+ * console.log(info)
19
+ * } finally {
20
+ * client.close()
21
+ * }
22
+ * ```
23
+ *
24
+ * @param options - Configuration options for the client
25
+ * @returns A new FlightClient instance
26
+ */
27
+ export declare function createFlightClient(options: FlightClientOptions): FlightClient;
28
+ //# sourceMappingURL=create-flight-client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-flight-client.d.ts","sourceRoot":"","sources":["../../src/client/create-flight-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AACjD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAA;AAErD;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,mBAAmB,GAAG,YAAY,CAE7E"}
@@ -0,0 +1,29 @@
1
+ import { FlightClient } from "./flight-client.js";
2
+ /**
3
+ * Factory function to create a FlightClient.
4
+ *
5
+ * This is the recommended way to create a Flight client as it provides
6
+ * a cleaner API and better tree-shaking support.
7
+ *
8
+ * @example
9
+ * ```ts
10
+ * const client = createFlightClient({
11
+ * url: "https://flight.example.com:8815",
12
+ * headers: { "Authorization": "Bearer token" }
13
+ * })
14
+ *
15
+ * try {
16
+ * const info = await client.getFlightInfo({ type: "path", path: ["my-dataset"] })
17
+ * console.log(info)
18
+ * } finally {
19
+ * client.close()
20
+ * }
21
+ * ```
22
+ *
23
+ * @param options - Configuration options for the client
24
+ * @returns A new FlightClient instance
25
+ */
26
+ export function createFlightClient(options) {
27
+ return new FlightClient(options);
28
+ }
29
+ //# sourceMappingURL=create-flight-client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-flight-client.js","sourceRoot":"","sources":["../../src/client/create-flight-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAGjD;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,UAAU,kBAAkB,CAAC,OAA4B;IAC7D,OAAO,IAAI,YAAY,CAAC,OAAO,CAAC,CAAA;AAClC,CAAC"}
@@ -0,0 +1,28 @@
1
+ import { FlightSqlClient } from "./flight-sql-client.js";
2
+ import type { FlightClientOptions } from "./types.js";
3
+ /**
4
+ * Factory function to create a FlightSqlClient.
5
+ *
6
+ * This is the recommended way to create a Flight SQL client as it provides
7
+ * a cleaner API and better tree-shaking support.
8
+ *
9
+ * @example
10
+ * ```ts
11
+ * const client = createFlightSqlClient({
12
+ * url: "https://flight.example.com:8815",
13
+ * auth: { type: "bearer", token: "my-token" }
14
+ * })
15
+ *
16
+ * try {
17
+ * const table = await client.query("SELECT * FROM users")
18
+ * console.log(`Found ${table.numRows} users`)
19
+ * } finally {
20
+ * client.close()
21
+ * }
22
+ * ```
23
+ *
24
+ * @param options - Configuration options for the client
25
+ * @returns A new FlightSqlClient instance
26
+ */
27
+ export declare function createFlightSqlClient(options: FlightClientOptions): FlightSqlClient;
28
+ //# sourceMappingURL=create-flight-sql-client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-flight-sql-client.d.ts","sourceRoot":"","sources":["../../src/client/create-flight-sql-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAA;AACxD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAA;AAErD;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,mBAAmB,GAAG,eAAe,CAEnF"}
@@ -0,0 +1,29 @@
1
+ import { FlightSqlClient } from "./flight-sql-client.js";
2
+ /**
3
+ * Factory function to create a FlightSqlClient.
4
+ *
5
+ * This is the recommended way to create a Flight SQL client as it provides
6
+ * a cleaner API and better tree-shaking support.
7
+ *
8
+ * @example
9
+ * ```ts
10
+ * const client = createFlightSqlClient({
11
+ * url: "https://flight.example.com:8815",
12
+ * auth: { type: "bearer", token: "my-token" }
13
+ * })
14
+ *
15
+ * try {
16
+ * const table = await client.query("SELECT * FROM users")
17
+ * console.log(`Found ${table.numRows} users`)
18
+ * } finally {
19
+ * client.close()
20
+ * }
21
+ * ```
22
+ *
23
+ * @param options - Configuration options for the client
24
+ * @returns A new FlightSqlClient instance
25
+ */
26
+ export function createFlightSqlClient(options) {
27
+ return new FlightSqlClient(options);
28
+ }
29
+ //# sourceMappingURL=create-flight-sql-client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-flight-sql-client.js","sourceRoot":"","sources":["../../src/client/create-flight-sql-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAA;AAGxD;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,UAAU,qBAAqB,CAAC,OAA4B;IAChE,OAAO,IAAI,eAAe,CAAC,OAAO,CAAC,CAAA;AACrC,CAAC"}
@@ -0,0 +1,81 @@
1
+ /**
2
+ * Base error class for all Flight client errors.
3
+ */
4
+ export declare class FlightError extends Error {
5
+ /** Error name for identification. */
6
+ readonly name: string;
7
+ /** Original error that caused this error, if any. */
8
+ readonly cause: unknown;
9
+ constructor(message: string, cause?: unknown);
10
+ /**
11
+ * Type guard to check if an error is a FlightError.
12
+ */
13
+ static isError(error: unknown): error is FlightError;
14
+ }
15
+ /**
16
+ * Error thrown when a connection to the Flight server fails.
17
+ */
18
+ export declare class FlightConnectionError extends FlightError {
19
+ /** Error name for identification. */
20
+ readonly name: string;
21
+ /** URL that failed to connect. */
22
+ readonly url: string;
23
+ constructor(message: string, url: string, cause?: unknown);
24
+ /**
25
+ * Type guard to check if an error is a FlightConnectionError.
26
+ */
27
+ static isError(error: unknown): error is FlightConnectionError;
28
+ }
29
+ /**
30
+ * Error thrown when authentication fails.
31
+ */
32
+ export declare class FlightAuthError extends FlightError {
33
+ /** Error name for identification. */
34
+ readonly name: string;
35
+ /**
36
+ * Type guard to check if an error is a FlightAuthError.
37
+ */
38
+ static isError(error: unknown): error is FlightAuthError;
39
+ }
40
+ /**
41
+ * Error thrown when a request times out.
42
+ */
43
+ export declare class FlightTimeoutError extends FlightError {
44
+ /** Error name for identification. */
45
+ readonly name: string;
46
+ /** Timeout duration in milliseconds that was exceeded. */
47
+ readonly timeoutMs: number;
48
+ constructor(message: string, timeoutMs: number, cause?: unknown);
49
+ /**
50
+ * Type guard to check if an error is a FlightTimeoutError.
51
+ */
52
+ static isError(error: unknown): error is FlightTimeoutError;
53
+ }
54
+ /**
55
+ * Error thrown when the server returns an error response.
56
+ */
57
+ export declare class FlightServerError extends FlightError {
58
+ /** Error name for identification. */
59
+ readonly name: string;
60
+ /** gRPC status code from the server. */
61
+ readonly code: string;
62
+ /** Additional error details from the server, if provided. */
63
+ readonly details: string | undefined;
64
+ constructor(message: string, code: string, details?: string, cause?: unknown);
65
+ /**
66
+ * Type guard to check if an error is a FlightServerError.
67
+ */
68
+ static isError(error: unknown): error is FlightServerError;
69
+ }
70
+ /**
71
+ * Error thrown when an operation is cancelled.
72
+ */
73
+ export declare class FlightCancelledError extends FlightError {
74
+ /** Error name for identification. */
75
+ readonly name: string;
76
+ /**
77
+ * Type guard to check if an error is a FlightCancelledError.
78
+ */
79
+ static isError(error: unknown): error is FlightCancelledError;
80
+ }
81
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/client/errors.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,qBAAa,WAAY,SAAQ,KAAK;IACpC,qCAAqC;IACrC,SAAkB,IAAI,EAAE,MAAM,CAAgB;IAC9C,qDAAqD;IACrD,SAAkB,KAAK,EAAE,OAAO,CAAA;gBAEpB,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,OAAO;IAK5C;;OAEG;IACH,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,WAAW;CAGrD;AAED;;GAEG;AACH,qBAAa,qBAAsB,SAAQ,WAAW;IACpD,qCAAqC;IACrC,SAAkB,IAAI,EAAE,MAAM,CAA0B;IACxD,kCAAkC;IAClC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;gBAER,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,OAAO;IAKzD;;OAEG;WACa,OAAO,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,qBAAqB;CAGxE;AAED;;GAEG;AACH,qBAAa,eAAgB,SAAQ,WAAW;IAC9C,qCAAqC;IACrC,SAAkB,IAAI,EAAE,MAAM,CAAoB;IAElD;;OAEG;WACa,OAAO,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,eAAe;CAGlE;AAED;;GAEG;AACH,qBAAa,kBAAmB,SAAQ,WAAW;IACjD,qCAAqC;IACrC,SAAkB,IAAI,EAAE,MAAM,CAAuB;IACrD,0DAA0D;IAC1D,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;gBAEd,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,OAAO;IAK/D;;OAEG;WACa,OAAO,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,kBAAkB;CAGrE;AAED;;GAEG;AACH,qBAAa,iBAAkB,SAAQ,WAAW;IAChD,qCAAqC;IACrC,SAAkB,IAAI,EAAE,MAAM,CAAsB;IACpD,wCAAwC;IACxC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,6DAA6D;IAC7D,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,CAAA;gBAExB,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,OAAO;IAM5E;;OAEG;WACa,OAAO,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,iBAAiB;CAGpE;AAED;;GAEG;AACH,qBAAa,oBAAqB,SAAQ,WAAW;IACnD,qCAAqC;IACrC,SAAkB,IAAI,EAAE,MAAM,CAAyB;IAEvD;;OAEG;WACa,OAAO,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,oBAAoB;CAGvE"}