@qualithm/arrow-flight-sql-js 1.0.0 → 1.2.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.
package/LICENSE CHANGED
@@ -1,18 +1,150 @@
1
- MIT License
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
2
4
 
3
- Copyright (c) 2026 Qualithm
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
4
6
 
5
- Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
6
- associated documentation files (the "Software"), to deal in the Software without restriction,
7
- including without limitation the rights to use, copy, modify, merge, publish, distribute,
8
- sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
9
- furnished to do so, subject to the following conditions:
7
+ 1. Definitions.
10
8
 
11
- The above copyright notice and this permission notice shall be included in all copies or substantial
12
- portions of the Software.
9
+ "License" shall mean the terms and conditions for use, reproduction, and distribution as defined
10
+ by Sections 1 through 9 of this document.
13
11
 
14
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
15
- NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
16
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES
17
- OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
18
- CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
12
+ "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is
13
+ granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all other entities that control,
16
+ are controlled by, or are under common control with that entity. For the purposes of this
17
+ definition, "control" means (i) the power, direct or indirect, to cause the direction or
18
+ management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent
19
+ (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
20
+
21
+ "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by
22
+ this License.
23
+
24
+ "Source" form shall mean the preferred form for making modifications, including but not limited
25
+ to software source code, documentation source, and configuration files.
26
+
27
+ "Object" form shall mean any form resulting from mechanical transformation or translation of a
28
+ Source form, including but not limited to compiled object code, generated documentation, and
29
+ conversions to other media types.
30
+
31
+ "Work" shall mean the work of authorship, whether in Source or Object form, made available under
32
+ the License, as indicated by a copyright notice that is included in or attached to the work (an
33
+ example is provided in the Appendix below).
34
+
35
+ "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or
36
+ derived from) the Work and for which the editorial revisions, annotations, elaborations, or
37
+ other modifications represent, as a whole, an original work of authorship. For the purposes of
38
+ this License, Derivative Works shall not include works that remain separable from, or merely
39
+ link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
40
+
41
+ "Contribution" shall mean any work of authorship, including the original version of the Work and
42
+ any modifications or additions to that Work or Derivative Works thereof, that is intentionally
43
+ submitted to the Licensor for inclusion in the Work by the copyright owner or by an individual
44
+ or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this
45
+ definition, "submitted" means any form of electronic, verbal, or written communication sent to
46
+ the Licensor or its representatives, including but not limited to communication on electronic
47
+ mailing lists, source code control systems, and issue tracking systems that are managed by, or
48
+ on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding
49
+ communication that is conspicuously marked or otherwise designated in writing by the copyright
50
+ owner as "Not a Contribution."
51
+
52
+ "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a
53
+ Contribution has been received by Licensor and subsequently incorporated within the Work.
54
+
55
+ 2. Grant of Copyright License. Subject to the terms and conditions of this License, each
56
+ Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free,
57
+ irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display,
58
+ publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or
59
+ Object form.
60
+
61
+ 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor
62
+ hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable
63
+ (except as stated in this section) patent license to make, have made, use, offer to sell, sell,
64
+ import, and otherwise transfer the Work, where such license applies only to those patent claims
65
+ licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or
66
+ by combination of their Contribution(s) with the Work to which such Contribution(s) was
67
+ submitted. If You institute patent litigation against any entity (including a cross-claim or
68
+ counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work
69
+ constitutes direct or contributory patent infringement, then any patent licenses granted to You
70
+ under this License for that Work shall terminate as of the date such litigation is filed.
71
+
72
+ 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof
73
+ in any medium, with or without modifications, and in Source or Object form, provided that You
74
+ meet the following conditions:
75
+
76
+ (a) You must give any other recipients of the Work or Derivative Works a copy of this License;
77
+ and
78
+
79
+ (b) You must cause any modified files to carry prominent notices stating that You changed the
80
+ files; and
81
+
82
+ (c) You must retain, in the Source form of any Derivative Works that You distribute, all
83
+ copyright, patent, trademark, and attribution notices from the Source form of the Work,
84
+ excluding those notices that do not pertain to any part of the Derivative Works; and
85
+
86
+ (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative
87
+ Works that You distribute must include a readable copy of the attribution notices contained
88
+ within such NOTICE file, excluding those notices that do not pertain to any part of the
89
+ Derivative Works, in at least one of the following places: within a NOTICE text file distributed
90
+ as part of the Derivative Works; within the Source form or documentation, if provided along with
91
+ the Derivative Works; or, within a display generated by the Derivative Works, if and wherever
92
+ such third-party notices normally appear. The contents of the NOTICE file are for informational
93
+ purposes only and do not modify the License. You may add Your own attribution notices within
94
+ Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the
95
+ Work, provided that such additional attribution notices cannot be construed as modifying the
96
+ License.
97
+
98
+ You may add Your own copyright statement to Your modifications and may provide additional or
99
+ different license terms and conditions for use, reproduction, or distribution of Your
100
+ modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and
101
+ distribution of the Work otherwise complies with the conditions stated in this License.
102
+
103
+ 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution
104
+ intentionally submitted for inclusion in the Work by You to the Licensor shall be under the
105
+ terms and conditions of this License, without any additional terms or conditions.
106
+ Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate
107
+ license agreement you may have executed with Licensor regarding such Contributions.
108
+
109
+ 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service
110
+ marks, or product names of the Licensor, except as required for reasonable and customary use in
111
+ describing the origin of the Work and reproducing the content of the NOTICE file.
112
+
113
+ 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor
114
+ provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT
115
+ WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation,
116
+ any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
117
+ PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or
118
+ redistributing the Work and assume any risks associated with Your exercise of permissions under
119
+ this License.
120
+
121
+ 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including
122
+ negligence), contract, or otherwise, unless required by applicable law (such as deliberate and
123
+ grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for
124
+ damages, including any direct, indirect, special, incidental, or consequential damages of any
125
+ character arising as a result of this License or out of the use or inability to use the Work
126
+ (including but not limited to damages for loss of goodwill, work stoppage, computer failure or
127
+ malfunction, or any and all other commercial damages or losses), even if such Contributor has
128
+ been advised of the possibility of such damages.
129
+
130
+ 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works
131
+ thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty,
132
+ indemnity, or other liability obligations and/or rights consistent with this License. However,
133
+ in accepting such obligations, You may act only on Your own behalf and on Your sole
134
+ responsibility, not on behalf of any other Contributor, and only if You agree to indemnify,
135
+ defend, and hold each Contributor harmless for any liability incurred by, or claims asserted
136
+ against, such Contributor by reason of your accepting any such warranty or additional liability.
137
+
138
+ END OF TERMS AND CONDITIONS
139
+
140
+ Copyright 2026 Qualithm
141
+
142
+ Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in
143
+ compliance with the License. You may obtain a copy of the License at
144
+
145
+ http://www.apache.org/licenses/LICENSE-2.0
146
+
147
+ Unless required by applicable law or agreed to in writing, software distributed under the License is
148
+ distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
149
+ implied. See the License for the specific language governing permissions and limitations under the
150
+ License.
@@ -0,0 +1,120 @@
1
+ /**
2
+ * Flight SQL client implementation.
3
+ *
4
+ * @packageDocumentation
5
+ */
6
+ import { type CallOptions, FlightClient, type FlightClientOptions, type FlightInfo } from "@qualithm/arrow-flight-js";
7
+ /**
8
+ * Options for creating a FlightSqlClient.
9
+ */
10
+ export type FlightSqlClientOptions = FlightClientOptions;
11
+ /**
12
+ * Options for executing a query.
13
+ */
14
+ export type QueryOptions = CallOptions & {
15
+ /**
16
+ * Transaction ID for executing the query as part of a transaction.
17
+ * If not provided, the query is auto-committed.
18
+ */
19
+ transactionId?: Buffer;
20
+ };
21
+ /**
22
+ * Result of a statement update operation.
23
+ */
24
+ export type UpdateResult = {
25
+ /**
26
+ * The number of records affected by the update.
27
+ * A value of -1 indicates an unknown count.
28
+ */
29
+ recordCount: number;
30
+ };
31
+ /**
32
+ * Arrow Flight SQL client for executing SQL queries and commands.
33
+ *
34
+ * Extends the base FlightClient with SQL-specific functionality including
35
+ * query execution, updates, and metadata queries.
36
+ *
37
+ * @example
38
+ * ```ts
39
+ * const client = new FlightSqlClient({
40
+ * host: "localhost",
41
+ * port: 8815,
42
+ * tls: false
43
+ * })
44
+ *
45
+ * await client.connect()
46
+ *
47
+ * // Execute a query
48
+ * const info = await client.query("SELECT * FROM users")
49
+ *
50
+ * // Execute an update
51
+ * const result = await client.executeUpdate("INSERT INTO users (name) VALUES ('Alice')")
52
+ * console.log("Rows affected:", result.recordCount)
53
+ *
54
+ * client.close()
55
+ * ```
56
+ */
57
+ export declare class FlightSqlClient extends FlightClient {
58
+ /**
59
+ * Executes a SQL query and returns flight information for retrieving results.
60
+ *
61
+ * This method sends a CommandStatementQuery to the server and returns
62
+ * FlightInfo containing endpoints for data retrieval. Use the returned
63
+ * FlightInfo with `doGet()` to retrieve the actual data.
64
+ *
65
+ * @param query - The SQL query to execute
66
+ * @param options - Optional query options
67
+ * @returns Flight information for retrieving query results
68
+ * @throws {FlightError} If the query fails
69
+ *
70
+ * @example
71
+ * ```ts
72
+ * const info = await client.query("SELECT * FROM users WHERE active = true")
73
+ *
74
+ * // Retrieve data from each endpoint
75
+ * for (const endpoint of info.endpoint) {
76
+ * for await (const data of client.doGet(endpoint.ticket!)) {
77
+ * // Process data
78
+ * }
79
+ * }
80
+ * ```
81
+ */
82
+ query(query: string, options?: QueryOptions): Promise<FlightInfo>;
83
+ /**
84
+ * Executes a SQL update statement (INSERT, UPDATE, DELETE).
85
+ *
86
+ * @param query - The SQL update statement to execute
87
+ * @param options - Optional query options
88
+ * @returns The update result containing the number of affected records
89
+ * @throws {FlightError} If the update fails
90
+ *
91
+ * @example
92
+ * ```ts
93
+ * const result = await client.executeUpdate(
94
+ * "UPDATE users SET active = false WHERE last_login < '2024-01-01'"
95
+ * )
96
+ * console.log("Rows updated:", result.recordCount)
97
+ * ```
98
+ */
99
+ executeUpdate(query: string, options?: QueryOptions): Promise<UpdateResult>;
100
+ }
101
+ /**
102
+ * Creates a new FlightSqlClient and connects to the server.
103
+ *
104
+ * This is a convenience function that combines creating a client
105
+ * and calling connect() in one step.
106
+ *
107
+ * @param options - Connection options
108
+ * @returns A connected FlightSqlClient
109
+ *
110
+ * @example
111
+ * ```ts
112
+ * const client = await createFlightSqlClient({
113
+ * host: "localhost",
114
+ * port: 8815,
115
+ * tls: false
116
+ * })
117
+ * ```
118
+ */
119
+ export declare function createFlightSqlClient(options: FlightSqlClientOptions): Promise<FlightSqlClient>;
120
+ //# sourceMappingURL=client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EACL,KAAK,WAAW,EAGhB,YAAY,EACZ,KAAK,mBAAmB,EAExB,KAAK,UAAU,EAChB,MAAM,2BAA2B,CAAA;AAalC;;GAEG;AACH,MAAM,MAAM,sBAAsB,GAAG,mBAAmB,CAAA;AAExD;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG,WAAW,GAAG;IACvC;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,CAAA;CACvB,CAAA;AAED;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG;IACzB;;;OAGG;IACH,WAAW,EAAE,MAAM,CAAA;CACpB,CAAA;AAiFD;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,qBAAa,eAAgB,SAAQ,YAAY;IAC/C;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACG,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,YAAY,GAAG,OAAO,CAAC,UAAU,CAAC;IAYvE;;;;;;;;;;;;;;;OAeG;IACG,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,YAAY,GAAG,OAAO,CAAC,YAAY,CAAC;CA6ClF;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAsB,qBAAqB,CACzC,OAAO,EAAE,sBAAsB,GAC9B,OAAO,CAAC,eAAe,CAAC,CAI1B"}
package/dist/client.js ADDED
@@ -0,0 +1,217 @@
1
+ /**
2
+ * Flight SQL client implementation.
3
+ *
4
+ * @packageDocumentation
5
+ */
6
+ import { cmdDescriptor, FlightClient, FlightError } from "@qualithm/arrow-flight-js";
7
+ import { CommandStatementQuery, CommandStatementUpdate, DoPutUpdateResult } from "./generated/arrow/flight/protocol/sql/FlightSql.js";
8
+ /**
9
+ * Flight SQL type URL prefix for encoding commands in Any messages.
10
+ */
11
+ const TYPE_URL_PREFIX = "type.googleapis.com/arrow.flight.protocol.sql";
12
+ /**
13
+ * Encodes a Flight SQL command as a descriptor command buffer.
14
+ *
15
+ * Flight SQL commands are encoded as protobuf Any messages with a type URL
16
+ * and the serialised command bytes.
17
+ *
18
+ * @param typeUrl - The type URL for the command
19
+ * @param data - The serialised command bytes
20
+ * @returns The encoded Any message buffer
21
+ */
22
+ function packAny(typeUrl, data) {
23
+ // Any message format:
24
+ // field 1 (type_url): string - wire type 2 (length-delimited)
25
+ // field 2 (value): bytes - wire type 2 (length-delimited)
26
+ const typeUrlBytes = Buffer.from(typeUrl, "utf8");
27
+ const typeUrlLen = typeUrlBytes.length;
28
+ const dataLen = data.length;
29
+ // Calculate varint sizes
30
+ const typeUrlVarIntSize = varIntSize(typeUrlLen);
31
+ const dataVarIntSize = varIntSize(dataLen);
32
+ // Total size: 1 (tag) + varint + typeUrl + 1 (tag) + varint + data
33
+ const totalSize = 1 + typeUrlVarIntSize + typeUrlLen + 1 + dataVarIntSize + dataLen;
34
+ const buffer = Buffer.alloc(totalSize);
35
+ let offset = 0;
36
+ // Field 1: type_url (tag = 0x0a = field 1, wire type 2)
37
+ buffer[offset++] = 0x0a;
38
+ offset = writeVarInt(buffer, offset, typeUrlLen);
39
+ typeUrlBytes.copy(buffer, offset);
40
+ offset += typeUrlLen;
41
+ // Field 2: value (tag = 0x12 = field 2, wire type 2)
42
+ buffer[offset++] = 0x12;
43
+ offset = writeVarInt(buffer, offset, dataLen);
44
+ Buffer.from(data).copy(buffer, offset);
45
+ return buffer;
46
+ }
47
+ /**
48
+ * Calculates the size of a varint encoding.
49
+ */
50
+ function varIntSize(value) {
51
+ let size = 1;
52
+ while (value >= 0x80) {
53
+ value >>>= 7;
54
+ size++;
55
+ }
56
+ return size;
57
+ }
58
+ /**
59
+ * Writes a varint to a buffer.
60
+ */
61
+ function writeVarInt(buffer, offset, value) {
62
+ while (value >= 0x80) {
63
+ buffer[offset++] = (value & 0x7f) | 0x80;
64
+ value >>>= 7;
65
+ }
66
+ buffer[offset++] = value;
67
+ return offset;
68
+ }
69
+ /**
70
+ * Creates a command descriptor for a Flight SQL command.
71
+ *
72
+ * @param typeName - The protobuf type name (without the prefix)
73
+ * @param encodedCommand - The encoded command bytes
74
+ * @returns A Flight descriptor
75
+ */
76
+ function createCommandDescriptor(typeName, encodedCommand) {
77
+ const typeUrl = `${TYPE_URL_PREFIX}.${typeName}`;
78
+ const anyBytes = packAny(typeUrl, encodedCommand);
79
+ return cmdDescriptor(anyBytes);
80
+ }
81
+ /**
82
+ * Arrow Flight SQL client for executing SQL queries and commands.
83
+ *
84
+ * Extends the base FlightClient with SQL-specific functionality including
85
+ * query execution, updates, and metadata queries.
86
+ *
87
+ * @example
88
+ * ```ts
89
+ * const client = new FlightSqlClient({
90
+ * host: "localhost",
91
+ * port: 8815,
92
+ * tls: false
93
+ * })
94
+ *
95
+ * await client.connect()
96
+ *
97
+ * // Execute a query
98
+ * const info = await client.query("SELECT * FROM users")
99
+ *
100
+ * // Execute an update
101
+ * const result = await client.executeUpdate("INSERT INTO users (name) VALUES ('Alice')")
102
+ * console.log("Rows affected:", result.recordCount)
103
+ *
104
+ * client.close()
105
+ * ```
106
+ */
107
+ export class FlightSqlClient extends FlightClient {
108
+ /**
109
+ * Executes a SQL query and returns flight information for retrieving results.
110
+ *
111
+ * This method sends a CommandStatementQuery to the server and returns
112
+ * FlightInfo containing endpoints for data retrieval. Use the returned
113
+ * FlightInfo with `doGet()` to retrieve the actual data.
114
+ *
115
+ * @param query - The SQL query to execute
116
+ * @param options - Optional query options
117
+ * @returns Flight information for retrieving query results
118
+ * @throws {FlightError} If the query fails
119
+ *
120
+ * @example
121
+ * ```ts
122
+ * const info = await client.query("SELECT * FROM users WHERE active = true")
123
+ *
124
+ * // Retrieve data from each endpoint
125
+ * for (const endpoint of info.endpoint) {
126
+ * for await (const data of client.doGet(endpoint.ticket!)) {
127
+ * // Process data
128
+ * }
129
+ * }
130
+ * ```
131
+ */
132
+ async query(query, options) {
133
+ const command = {
134
+ query,
135
+ transactionId: options?.transactionId
136
+ };
137
+ const encoded = CommandStatementQuery.encode(command).finish();
138
+ const descriptor = createCommandDescriptor("CommandStatementQuery", encoded);
139
+ return this.getFlightInfo(descriptor, options);
140
+ }
141
+ /**
142
+ * Executes a SQL update statement (INSERT, UPDATE, DELETE).
143
+ *
144
+ * @param query - The SQL update statement to execute
145
+ * @param options - Optional query options
146
+ * @returns The update result containing the number of affected records
147
+ * @throws {FlightError} If the update fails
148
+ *
149
+ * @example
150
+ * ```ts
151
+ * const result = await client.executeUpdate(
152
+ * "UPDATE users SET active = false WHERE last_login < '2024-01-01'"
153
+ * )
154
+ * console.log("Rows updated:", result.recordCount)
155
+ * ```
156
+ */
157
+ async executeUpdate(query, options) {
158
+ const command = {
159
+ query,
160
+ transactionId: options?.transactionId
161
+ };
162
+ const encoded = CommandStatementUpdate.encode(command).finish();
163
+ const descriptor = createCommandDescriptor("CommandStatementUpdate", encoded);
164
+ const stream = this.doPut(options);
165
+ // Send the command as the first message with descriptor
166
+ stream.write({
167
+ flightDescriptor: {
168
+ type: 2, // CMD
169
+ path: [],
170
+ cmd: descriptor.cmd
171
+ },
172
+ dataHeader: Buffer.alloc(0),
173
+ appMetadata: Buffer.alloc(0),
174
+ dataBody: Buffer.alloc(0)
175
+ });
176
+ stream.end();
177
+ // Collect results
178
+ const results = await stream.collectResults();
179
+ const firstResult = results.at(0);
180
+ if (!firstResult) {
181
+ throw new FlightError("no result returned from update", "INTERNAL");
182
+ }
183
+ // Decode the DoPutUpdateResult from appMetadata
184
+ const { appMetadata } = firstResult;
185
+ if (appMetadata.length === 0) {
186
+ throw new FlightError("update result missing app metadata", "INTERNAL");
187
+ }
188
+ const updateResult = DoPutUpdateResult.decode(appMetadata);
189
+ return {
190
+ recordCount: updateResult.recordCount
191
+ };
192
+ }
193
+ }
194
+ /**
195
+ * Creates a new FlightSqlClient and connects to the server.
196
+ *
197
+ * This is a convenience function that combines creating a client
198
+ * and calling connect() in one step.
199
+ *
200
+ * @param options - Connection options
201
+ * @returns A connected FlightSqlClient
202
+ *
203
+ * @example
204
+ * ```ts
205
+ * const client = await createFlightSqlClient({
206
+ * host: "localhost",
207
+ * port: 8815,
208
+ * tls: false
209
+ * })
210
+ * ```
211
+ */
212
+ export async function createFlightSqlClient(options) {
213
+ const client = new FlightSqlClient(options);
214
+ await client.connect();
215
+ return client;
216
+ }
217
+ //# sourceMappingURL=client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAGL,aAAa,EACb,YAAY,EAEZ,WAAW,EAEZ,MAAM,2BAA2B,CAAA;AAElC,OAAO,EACL,qBAAqB,EACrB,sBAAsB,EACtB,iBAAiB,EAClB,MAAM,oDAAoD,CAAA;AAE3D;;GAEG;AACH,MAAM,eAAe,GAAG,+CAA+C,CAAA;AA6BvE;;;;;;;;;GASG;AACH,SAAS,OAAO,CAAC,OAAe,EAAE,IAAgB;IAChD,sBAAsB;IACtB,8DAA8D;IAC9D,0DAA0D;IAC1D,MAAM,YAAY,GAAG,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC,CAAA;IACjD,MAAM,UAAU,GAAG,YAAY,CAAC,MAAM,CAAA;IACtC,MAAM,OAAO,GAAG,IAAI,CAAC,MAAM,CAAA;IAE3B,yBAAyB;IACzB,MAAM,iBAAiB,GAAG,UAAU,CAAC,UAAU,CAAC,CAAA;IAChD,MAAM,cAAc,GAAG,UAAU,CAAC,OAAO,CAAC,CAAA;IAE1C,mEAAmE;IACnE,MAAM,SAAS,GAAG,CAAC,GAAG,iBAAiB,GAAG,UAAU,GAAG,CAAC,GAAG,cAAc,GAAG,OAAO,CAAA;IACnF,MAAM,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,C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