@useairfoil/flight 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.
@@ -0,0 +1,749 @@
1
+ import { CallOptions, Channel, ChannelCredentials, ChannelOptions, CompatServiceDefinition, DefaultCallOptions, Metadata, NormalizedServiceDefinition } from "nice-grpc";
2
+ import * as apache_arrow0 from "apache-arrow";
3
+ import { RecordBatch, Schema } from "apache-arrow";
4
+ import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
5
+
6
+ //#region src/proto/Flight.d.ts
7
+
8
+ /** The request that a client provides to a server on handshake. */
9
+ interface HandshakeRequest {
10
+ $type: "arrow.flight.protocol.HandshakeRequest";
11
+ /** A defined protocol version */
12
+ readonly protocolVersion: bigint;
13
+ /** Arbitrary auth/handshake info. */
14
+ readonly payload: Uint8Array;
15
+ }
16
+ interface HandshakeResponse {
17
+ $type: "arrow.flight.protocol.HandshakeResponse";
18
+ /** A defined protocol version */
19
+ readonly protocolVersion: bigint;
20
+ /** Arbitrary auth/handshake info. */
21
+ readonly payload: Uint8Array;
22
+ }
23
+ interface Empty {
24
+ $type: "arrow.flight.protocol.Empty";
25
+ }
26
+ /**
27
+ * Describes an available action, including both the name used for execution
28
+ * along with a short description of the purpose of the action.
29
+ */
30
+ interface ActionType {
31
+ $type: "arrow.flight.protocol.ActionType";
32
+ readonly type: string;
33
+ readonly description: string;
34
+ }
35
+ /**
36
+ * A service specific expression that can be used to return a limited set
37
+ * of available Arrow Flight streams.
38
+ */
39
+ interface Criteria {
40
+ $type: "arrow.flight.protocol.Criteria";
41
+ readonly expression: Uint8Array;
42
+ }
43
+ /** An opaque action specific for the service. */
44
+ interface Action {
45
+ $type: "arrow.flight.protocol.Action";
46
+ readonly type: string;
47
+ readonly body: Uint8Array;
48
+ }
49
+ /** An opaque result returned after executing an action. */
50
+ interface Result {
51
+ $type: "arrow.flight.protocol.Result";
52
+ readonly body: Uint8Array;
53
+ }
54
+ /** Wrap the result of a getSchema call */
55
+ interface SchemaResult {
56
+ $type: "arrow.flight.protocol.SchemaResult";
57
+ /**
58
+ * The schema of the dataset in its IPC form:
59
+ * 4 bytes - an optional IPC_CONTINUATION_TOKEN prefix
60
+ * 4 bytes - the byte length of the payload
61
+ * a flatbuffer Message whose header is the Schema
62
+ */
63
+ readonly schema: Uint8Array;
64
+ }
65
+ /**
66
+ * The name or tag for a Flight. May be used as a way to retrieve or generate
67
+ * a flight or be used to expose a set of previously defined flights.
68
+ */
69
+ interface FlightDescriptor {
70
+ $type: "arrow.flight.protocol.FlightDescriptor";
71
+ readonly type: FlightDescriptor_DescriptorType;
72
+ /**
73
+ * Opaque value used to express a command. Should only be defined when
74
+ * type = CMD.
75
+ */
76
+ readonly cmd: Uint8Array;
77
+ /**
78
+ * List of strings identifying a particular dataset. Should only be defined
79
+ * when type = PATH.
80
+ */
81
+ readonly path: readonly string[];
82
+ }
83
+ /** Describes what type of descriptor is defined. */
84
+ declare enum FlightDescriptor_DescriptorType {
85
+ /** UNKNOWN - Protobuf pattern, not used. */
86
+ UNKNOWN = 0,
87
+ /**
88
+ * PATH - A named path that identifies a dataset. A path is composed of a string
89
+ * or list of strings describing a particular dataset. This is conceptually
90
+ * similar to a path inside a filesystem.
91
+ */
92
+ PATH = 1,
93
+ /** CMD - An opaque command to generate a dataset. */
94
+ CMD = 2,
95
+ UNRECOGNIZED = -1,
96
+ }
97
+ /**
98
+ * The access coordinates for retrieval of a dataset. With a FlightInfo, a
99
+ * consumer is able to determine how to retrieve a dataset.
100
+ */
101
+ interface FlightInfo {
102
+ $type: "arrow.flight.protocol.FlightInfo";
103
+ /**
104
+ * The schema of the dataset in its IPC form:
105
+ * 4 bytes - an optional IPC_CONTINUATION_TOKEN prefix
106
+ * 4 bytes - the byte length of the payload
107
+ * a flatbuffer Message whose header is the Schema
108
+ */
109
+ readonly schema: Uint8Array;
110
+ /** The descriptor associated with this info. */
111
+ readonly flightDescriptor: FlightDescriptor | undefined;
112
+ /**
113
+ * A list of endpoints associated with the flight. To consume the
114
+ * whole flight, all endpoints (and hence all Tickets) must be
115
+ * consumed. Endpoints can be consumed in any order.
116
+ *
117
+ * In other words, an application can use multiple endpoints to
118
+ * represent partitioned data.
119
+ *
120
+ * If the returned data has an ordering, an application can use
121
+ * "FlightInfo.ordered = true" or should return the all data in a
122
+ * single endpoint. Otherwise, there is no ordering defined on
123
+ * endpoints or the data within.
124
+ *
125
+ * A client can read ordered data by reading data from returned
126
+ * endpoints, in order, from front to back.
127
+ *
128
+ * Note that a client may ignore "FlightInfo.ordered = true". If an
129
+ * ordering is important for an application, an application must
130
+ * choose one of them:
131
+ *
132
+ * * An application requires that all clients must read data in
133
+ * returned endpoints order.
134
+ * * An application must return the all data in a single endpoint.
135
+ */
136
+ readonly endpoint: readonly FlightEndpoint[];
137
+ /** Set these to -1 if unknown. */
138
+ readonly totalRecords: bigint;
139
+ readonly totalBytes: bigint;
140
+ /** FlightEndpoints are in the same order as the data. */
141
+ readonly ordered: boolean;
142
+ /**
143
+ * Application-defined metadata.
144
+ *
145
+ * There is no inherent or required relationship between this
146
+ * and the app_metadata fields in the FlightEndpoints or resulting
147
+ * FlightData messages. Since this metadata is application-defined,
148
+ * a given application could define there to be a relationship,
149
+ * but there is none required by the spec.
150
+ */
151
+ readonly appMetadata: Uint8Array;
152
+ }
153
+ /** The information to process a long-running query. */
154
+ interface PollInfo {
155
+ $type: "arrow.flight.protocol.PollInfo";
156
+ /**
157
+ * The currently available results.
158
+ *
159
+ * If "flight_descriptor" is not specified, the query is complete
160
+ * and "info" specifies all results. Otherwise, "info" contains
161
+ * partial query results.
162
+ *
163
+ * Note that each PollInfo response contains a complete
164
+ * FlightInfo (not just the delta between the previous and current
165
+ * FlightInfo).
166
+ *
167
+ * Subsequent PollInfo responses may only append new endpoints to
168
+ * info.
169
+ *
170
+ * Clients can begin fetching results via DoGet(Ticket) with the
171
+ * ticket in the info before the query is
172
+ * completed. FlightInfo.ordered is also valid.
173
+ */
174
+ readonly info: FlightInfo | undefined;
175
+ /**
176
+ * The descriptor the client should use on the next try.
177
+ * If unset, the query is complete.
178
+ */
179
+ readonly flightDescriptor: FlightDescriptor | undefined;
180
+ /**
181
+ * Query progress. If known, must be in [0.0, 1.0] but need not be
182
+ * monotonic or nondecreasing. If unknown, do not set.
183
+ */
184
+ readonly progress?: number | undefined;
185
+ /**
186
+ * Expiration time for this request. After this passes, the server
187
+ * might not accept the retry descriptor anymore (and the query may
188
+ * be cancelled). This may be updated on a call to PollFlightInfo.
189
+ */
190
+ readonly expirationTime: Date | undefined;
191
+ }
192
+ /** A particular stream or split associated with a flight. */
193
+ interface FlightEndpoint {
194
+ $type: "arrow.flight.protocol.FlightEndpoint";
195
+ /** Token used to retrieve this stream. */
196
+ readonly ticket: Ticket | undefined;
197
+ /**
198
+ * A list of URIs where this ticket can be redeemed via DoGet().
199
+ *
200
+ * If the list is empty, the expectation is that the ticket can only
201
+ * be redeemed on the current service where the ticket was
202
+ * generated.
203
+ *
204
+ * If the list is not empty, the expectation is that the ticket can
205
+ * be redeemed at any of the locations, and that the data returned
206
+ * will be equivalent. In this case, the ticket may only be redeemed
207
+ * at one of the given locations, and not (necessarily) on the
208
+ * current service.
209
+ *
210
+ * In other words, an application can use multiple locations to
211
+ * represent redundant and/or load balanced services.
212
+ */
213
+ readonly location: readonly Location[];
214
+ /**
215
+ * Expiration time of this stream. If present, clients may assume
216
+ * they can retry DoGet requests. Otherwise, it is
217
+ * application-defined whether DoGet requests may be retried.
218
+ */
219
+ readonly expirationTime: Date | undefined;
220
+ /**
221
+ * Application-defined metadata.
222
+ *
223
+ * There is no inherent or required relationship between this
224
+ * and the app_metadata fields in the FlightInfo or resulting
225
+ * FlightData messages. Since this metadata is application-defined,
226
+ * a given application could define there to be a relationship,
227
+ * but there is none required by the spec.
228
+ */
229
+ readonly appMetadata: Uint8Array;
230
+ }
231
+ /**
232
+ * A location where a Flight service will accept retrieval of a particular
233
+ * stream given a ticket.
234
+ */
235
+ interface Location {
236
+ $type: "arrow.flight.protocol.Location";
237
+ readonly uri: string;
238
+ }
239
+ /**
240
+ * An opaque identifier that the service can use to retrieve a particular
241
+ * portion of a stream.
242
+ *
243
+ * Tickets are meant to be single use. It is an error/application-defined
244
+ * behavior to reuse a ticket.
245
+ */
246
+ interface Ticket {
247
+ $type: "arrow.flight.protocol.Ticket";
248
+ readonly ticket: Uint8Array;
249
+ }
250
+ /** A batch of Arrow data as part of a stream of batches. */
251
+ interface FlightData {
252
+ $type: "arrow.flight.protocol.FlightData";
253
+ /**
254
+ * The descriptor of the data. This is only relevant when a client is
255
+ * starting a new DoPut stream.
256
+ */
257
+ readonly flightDescriptor: FlightDescriptor | undefined;
258
+ /** Header for message data as described in Message.fbs::Message. */
259
+ readonly dataHeader: Uint8Array;
260
+ /** Application-defined metadata. */
261
+ readonly appMetadata: Uint8Array;
262
+ /**
263
+ * The actual batch of Arrow data. Preferably handled with minimal-copies
264
+ * coming last in the definition to help with sidecar patterns (it is
265
+ * expected that some implementations will fetch this field off the wire
266
+ * with specialized code to avoid extra memory copies).
267
+ */
268
+ readonly dataBody: Uint8Array;
269
+ }
270
+ /** The response message associated with the submission of a DoPut. */
271
+ interface PutResult {
272
+ $type: "arrow.flight.protocol.PutResult";
273
+ readonly appMetadata: Uint8Array;
274
+ }
275
+ declare const HandshakeRequest: MessageFns$1<HandshakeRequest, "arrow.flight.protocol.HandshakeRequest">;
276
+ declare const HandshakeResponse: MessageFns$1<HandshakeResponse, "arrow.flight.protocol.HandshakeResponse">;
277
+ declare const Empty: MessageFns$1<Empty, "arrow.flight.protocol.Empty">;
278
+ declare const ActionType: MessageFns$1<ActionType, "arrow.flight.protocol.ActionType">;
279
+ declare const Criteria: MessageFns$1<Criteria, "arrow.flight.protocol.Criteria">;
280
+ declare const Action: MessageFns$1<Action, "arrow.flight.protocol.Action">;
281
+ declare const Result: MessageFns$1<Result, "arrow.flight.protocol.Result">;
282
+ declare const SchemaResult: MessageFns$1<SchemaResult, "arrow.flight.protocol.SchemaResult">;
283
+ declare const FlightDescriptor: MessageFns$1<FlightDescriptor, "arrow.flight.protocol.FlightDescriptor">;
284
+ declare const FlightInfo: MessageFns$1<FlightInfo, "arrow.flight.protocol.FlightInfo">;
285
+ declare const PollInfo: MessageFns$1<PollInfo, "arrow.flight.protocol.PollInfo">;
286
+ declare const FlightEndpoint: MessageFns$1<FlightEndpoint, "arrow.flight.protocol.FlightEndpoint">;
287
+ declare const Location: MessageFns$1<Location, "arrow.flight.protocol.Location">;
288
+ declare const Ticket: MessageFns$1<Ticket, "arrow.flight.protocol.Ticket">;
289
+ declare const FlightData: MessageFns$1<FlightData, "arrow.flight.protocol.FlightData">;
290
+ declare const PutResult: MessageFns$1<PutResult, "arrow.flight.protocol.PutResult">;
291
+ /**
292
+ * A flight service is an endpoint for retrieving or storing Arrow data. A
293
+ * flight service can expose one or more predefined endpoints that can be
294
+ * accessed using the Arrow Flight Protocol. Additionally, a flight service
295
+ * can expose a set of actions that are available.
296
+ */
297
+ type FlightServiceDefinition = typeof FlightServiceDefinition;
298
+ declare const FlightServiceDefinition: {
299
+ readonly name: "FlightService";
300
+ readonly fullName: "arrow.flight.protocol.FlightService";
301
+ readonly methods: {
302
+ /**
303
+ * Handshake between client and server. Depending on the server, the
304
+ * handshake may be required to determine the token that should be used for
305
+ * future operations. Both request and response are streams to allow multiple
306
+ * round-trips depending on auth mechanism.
307
+ */
308
+ readonly handshake: {
309
+ readonly name: "Handshake";
310
+ readonly requestType: MessageFns$1<HandshakeRequest, "arrow.flight.protocol.HandshakeRequest">;
311
+ readonly requestStream: true;
312
+ readonly responseType: MessageFns$1<HandshakeResponse, "arrow.flight.protocol.HandshakeResponse">;
313
+ readonly responseStream: true;
314
+ readonly options: {};
315
+ };
316
+ /**
317
+ * Get a list of available streams given a particular criteria. Most flight
318
+ * services will expose one or more streams that are readily available for
319
+ * retrieval. This api allows listing the streams available for
320
+ * consumption. A user can also provide a criteria. The criteria can limit
321
+ * the subset of streams that can be listed via this interface. Each flight
322
+ * service allows its own definition of how to consume criteria.
323
+ */
324
+ readonly listFlights: {
325
+ readonly name: "ListFlights";
326
+ readonly requestType: MessageFns$1<Criteria, "arrow.flight.protocol.Criteria">;
327
+ readonly requestStream: false;
328
+ readonly responseType: MessageFns$1<FlightInfo, "arrow.flight.protocol.FlightInfo">;
329
+ readonly responseStream: true;
330
+ readonly options: {};
331
+ };
332
+ /**
333
+ * For a given FlightDescriptor, get information about how the flight can be
334
+ * consumed. This is a useful interface if the consumer of the interface
335
+ * already can identify the specific flight to consume. This interface can
336
+ * also allow a consumer to generate a flight stream through a specified
337
+ * descriptor. For example, a flight descriptor might be something that
338
+ * includes a SQL statement or a Pickled Python operation that will be
339
+ * executed. In those cases, the descriptor will not be previously available
340
+ * within the list of available streams provided by ListFlights but will be
341
+ * available for consumption for the duration defined by the specific flight
342
+ * service.
343
+ */
344
+ readonly getFlightInfo: {
345
+ readonly name: "GetFlightInfo";
346
+ readonly requestType: MessageFns$1<FlightDescriptor, "arrow.flight.protocol.FlightDescriptor">;
347
+ readonly requestStream: false;
348
+ readonly responseType: MessageFns$1<FlightInfo, "arrow.flight.protocol.FlightInfo">;
349
+ readonly responseStream: false;
350
+ readonly options: {};
351
+ };
352
+ /**
353
+ * For a given FlightDescriptor, start a query and get information
354
+ * to poll its execution status. This is a useful interface if the
355
+ * query may be a long-running query. The first PollFlightInfo call
356
+ * should return as quickly as possible. (GetFlightInfo doesn't
357
+ * return until the query is complete.)
358
+ *
359
+ * A client can consume any available results before
360
+ * the query is completed. See PollInfo.info for details.
361
+ *
362
+ * A client can poll the updated query status by calling
363
+ * PollFlightInfo() with PollInfo.flight_descriptor. A server
364
+ * should not respond until the result would be different from last
365
+ * time. That way, the client can "long poll" for updates
366
+ * without constantly making requests. Clients can set a short timeout
367
+ * to avoid blocking calls if desired.
368
+ *
369
+ * A client can't use PollInfo.flight_descriptor after
370
+ * PollInfo.expiration_time passes. A server might not accept the
371
+ * retry descriptor anymore and the query may be cancelled.
372
+ *
373
+ * A client may use the CancelFlightInfo action with
374
+ * PollInfo.info to cancel the running query.
375
+ */
376
+ readonly pollFlightInfo: {
377
+ readonly name: "PollFlightInfo";
378
+ readonly requestType: MessageFns$1<FlightDescriptor, "arrow.flight.protocol.FlightDescriptor">;
379
+ readonly requestStream: false;
380
+ readonly responseType: MessageFns$1<PollInfo, "arrow.flight.protocol.PollInfo">;
381
+ readonly responseStream: false;
382
+ readonly options: {};
383
+ };
384
+ /**
385
+ * For a given FlightDescriptor, get the Schema as described in Schema.fbs::Schema
386
+ * This is used when a consumer needs the Schema of flight stream. Similar to
387
+ * GetFlightInfo this interface may generate a new flight that was not previously
388
+ * available in ListFlights.
389
+ */
390
+ readonly getSchema: {
391
+ readonly name: "GetSchema";
392
+ readonly requestType: MessageFns$1<FlightDescriptor, "arrow.flight.protocol.FlightDescriptor">;
393
+ readonly requestStream: false;
394
+ readonly responseType: MessageFns$1<SchemaResult, "arrow.flight.protocol.SchemaResult">;
395
+ readonly responseStream: false;
396
+ readonly options: {};
397
+ };
398
+ /**
399
+ * Retrieve a single stream associated with a particular descriptor
400
+ * associated with the referenced ticket. A Flight can be composed of one or
401
+ * more streams where each stream can be retrieved using a separate opaque
402
+ * ticket that the flight service uses for managing a collection of streams.
403
+ */
404
+ readonly doGet: {
405
+ readonly name: "DoGet";
406
+ readonly requestType: MessageFns$1<Ticket, "arrow.flight.protocol.Ticket">;
407
+ readonly requestStream: false;
408
+ readonly responseType: MessageFns$1<FlightData, "arrow.flight.protocol.FlightData">;
409
+ readonly responseStream: true;
410
+ readonly options: {};
411
+ };
412
+ /**
413
+ * Push a stream to the flight service associated with a particular
414
+ * flight stream. This allows a client of a flight service to upload a stream
415
+ * of data. Depending on the particular flight service, a client consumer
416
+ * could be allowed to upload a single stream per descriptor or an unlimited
417
+ * number. In the latter, the service might implement a 'seal' action that
418
+ * can be applied to a descriptor once all streams are uploaded.
419
+ */
420
+ readonly doPut: {
421
+ readonly name: "DoPut";
422
+ readonly requestType: MessageFns$1<FlightData, "arrow.flight.protocol.FlightData">;
423
+ readonly requestStream: true;
424
+ readonly responseType: MessageFns$1<PutResult, "arrow.flight.protocol.PutResult">;
425
+ readonly responseStream: true;
426
+ readonly options: {};
427
+ };
428
+ /**
429
+ * Open a bidirectional data channel for a given descriptor. This
430
+ * allows clients to send and receive arbitrary Arrow data and
431
+ * application-specific metadata in a single logical stream. In
432
+ * contrast to DoGet/DoPut, this is more suited for clients
433
+ * offloading computation (rather than storage) to a Flight service.
434
+ */
435
+ readonly doExchange: {
436
+ readonly name: "DoExchange";
437
+ readonly requestType: MessageFns$1<FlightData, "arrow.flight.protocol.FlightData">;
438
+ readonly requestStream: true;
439
+ readonly responseType: MessageFns$1<FlightData, "arrow.flight.protocol.FlightData">;
440
+ readonly responseStream: true;
441
+ readonly options: {};
442
+ };
443
+ /**
444
+ * Flight services can support an arbitrary number of simple actions in
445
+ * addition to the possible ListFlights, GetFlightInfo, DoGet, DoPut
446
+ * operations that are potentially available. DoAction allows a flight client
447
+ * to do a specific action against a flight service. An action includes
448
+ * opaque request and response objects that are specific to the type action
449
+ * being undertaken.
450
+ */
451
+ readonly doAction: {
452
+ readonly name: "DoAction";
453
+ readonly requestType: MessageFns$1<Action, "arrow.flight.protocol.Action">;
454
+ readonly requestStream: false;
455
+ readonly responseType: MessageFns$1<Result, "arrow.flight.protocol.Result">;
456
+ readonly responseStream: true;
457
+ readonly options: {};
458
+ };
459
+ /**
460
+ * A flight service exposes all of the available action types that it has
461
+ * along with descriptions. This allows different flight consumers to
462
+ * understand the capabilities of the flight service.
463
+ */
464
+ readonly listActions: {
465
+ readonly name: "ListActions";
466
+ readonly requestType: MessageFns$1<Empty, "arrow.flight.protocol.Empty">;
467
+ readonly requestStream: false;
468
+ readonly responseType: MessageFns$1<ActionType, "arrow.flight.protocol.ActionType">;
469
+ readonly responseStream: true;
470
+ readonly options: {};
471
+ };
472
+ };
473
+ };
474
+ type Builtin$1 = Date | Function | Uint8Array | string | number | boolean | bigint | undefined;
475
+ type DeepPartial$1<T> = T extends Builtin$1 ? T : T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial$1<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial$1<U>> : T extends {
476
+ readonly $case: string;
477
+ } ? { [K in keyof Omit<T, "$case">]?: DeepPartial$1<T[K]> } & {
478
+ readonly $case: T["$case"];
479
+ } : T extends {} ? { [K in Exclude<keyof T, "$type">]?: DeepPartial$1<T[K]> } : Partial<T>;
480
+ type KeysOfUnion$1<T> = T extends T ? keyof T : never;
481
+ type Exact$1<P, I extends P> = P extends Builtin$1 ? P : P & { [K in keyof P]: Exact$1<P[K], I[K]> } & { [K in Exclude<keyof I, KeysOfUnion$1<P> | "$type">]: never };
482
+ interface MessageFns$1<T, V extends string> {
483
+ readonly $type: V;
484
+ encode(message: T, writer?: BinaryWriter): BinaryWriter;
485
+ decode(input: BinaryReader | Uint8Array, length?: number): T;
486
+ fromJSON(object: any): T;
487
+ toJSON(message: T): unknown;
488
+ create<I extends Exact$1<DeepPartial$1<T>, I>>(base?: I): T;
489
+ fromPartial<I extends Exact$1<DeepPartial$1<T>, I>>(object: I): T;
490
+ }
491
+ //#endregion
492
+ //#region src/proto-utils.d.ts
493
+ type RemoveTypeUrl<T> = Omit<T, "$type">;
494
+ type ClientOptions<S extends CompatServiceDefinition> = {
495
+ defaultCallOptions?: DefaultCallOptions<NormalizedServiceDefinition<S>>;
496
+ };
497
+ type HostOrChannel = {
498
+ host: string;
499
+ credentials?: ChannelCredentials;
500
+ channelOptions?: ChannelOptions;
501
+ channel?: never;
502
+ } | {
503
+ host?: never;
504
+ channel: Channel;
505
+ };
506
+ declare function createChannelFromConfig(config: HostOrChannel): Channel;
507
+ //#endregion
508
+ //#region src/arrow-flight.d.ts
509
+ declare class ArrowFlightClient {
510
+ private client;
511
+ constructor(config: HostOrChannel, options?: ClientOptions<FlightServiceDefinition>);
512
+ executeFlightInfo(info: FlightInfo, options?: CallOptions): AsyncGenerator<RecordBatch>;
513
+ /**
514
+ * Handshake between client and server.
515
+ *
516
+ * Depending on the server, the handshake may be required to determine the
517
+ * token that should be used for future operations. Both request and response
518
+ * are streams to allow multiple round-trips depending on auth mechanism.
519
+ */
520
+ handshake(request: AsyncIterable<HandshakeRequest>, options?: CallOptions): AsyncIterable<HandshakeResponse>;
521
+ /** Get a list of available streams given a particular criteria. */
522
+ getFlightInfo(request: FlightDescriptor, options?: CallOptions): Promise<FlightInfo>;
523
+ /**
524
+ * Retrieve a single stream associated with a particular descriptor
525
+ * associated with the referenced ticket. A Flight can be composed of one or
526
+ * more streams where each stream can be retrieved using a separate opaque
527
+ * ticket that the flight service uses for managing a collection of streams.
528
+ */
529
+ doGet(request: Ticket, options: {
530
+ schema: Schema;
531
+ } & CallOptions): AsyncIterable<RecordBatch>;
532
+ /**
533
+ * Push a stream to the flight service associated with a particular
534
+ * flight stream. This allows a client of a flight service to upload a stream
535
+ * of data. Depending on the particular flight service, a client consumer
536
+ * could be allowed to upload a single stream per descriptor or an unlimited
537
+ * number. In the latter, the service might implement a 'seal' action that
538
+ * can be applied to a descriptor once all streams are uploaded.
539
+ */
540
+ doPut(request: AsyncIterable<FlightData>, options?: CallOptions): AsyncIterable<PutResult>;
541
+ }
542
+ //#endregion
543
+ //#region src/proto/FlightSql.d.ts
544
+
545
+ /**
546
+ * Represents a request to retrieve the list of catalogs on a Flight SQL enabled backend.
547
+ * The definition of a catalog depends on vendor/implementation. It is usually the database itself
548
+ * Used in the command member of FlightDescriptor for the following RPC calls:
549
+ * - GetSchema: return the Arrow schema of the query.
550
+ * - GetFlightInfo: execute the catalog metadata request.
551
+ *
552
+ * The returned Arrow schema will be:
553
+ * <
554
+ * catalog_name: utf8 not null
555
+ * >
556
+ * The returned data should be ordered by catalog_name.
557
+ */
558
+ interface CommandGetCatalogs {
559
+ $type: "arrow.flight.protocol.sql.CommandGetCatalogs";
560
+ }
561
+ /**
562
+ * Represents a request to retrieve the list of database schemas on a Flight SQL enabled backend.
563
+ * The definition of a database schema depends on vendor/implementation. It is usually a collection of tables.
564
+ * Used in the command member of FlightDescriptor for the following RPC calls:
565
+ * - GetSchema: return the Arrow schema of the query.
566
+ * - GetFlightInfo: execute the catalog metadata request.
567
+ *
568
+ * The returned Arrow schema will be:
569
+ * <
570
+ * catalog_name: utf8,
571
+ * db_schema_name: utf8 not null
572
+ * >
573
+ * The returned data should be ordered by catalog_name, then db_schema_name.
574
+ */
575
+ interface CommandGetDbSchemas {
576
+ $type: "arrow.flight.protocol.sql.CommandGetDbSchemas";
577
+ /**
578
+ * Specifies the Catalog to search for the tables.
579
+ * An empty string retrieves those without a catalog.
580
+ * If omitted the catalog name should not be used to narrow the search.
581
+ */
582
+ readonly catalog?: string | undefined;
583
+ /**
584
+ * Specifies a filter pattern for schemas to search for.
585
+ * When no db_schema_filter_pattern is provided, the pattern will not be used to narrow the search.
586
+ * In the pattern string, two special characters can be used to denote matching rules:
587
+ * - "%" means to match any substring with 0 or more characters.
588
+ * - "_" means to match any one character.
589
+ */
590
+ readonly dbSchemaFilterPattern?: string | undefined;
591
+ }
592
+ /**
593
+ * Represents a request to retrieve the list of tables, and optionally their schemas, on a Flight SQL enabled backend.
594
+ * Used in the command member of FlightDescriptor for the following RPC calls:
595
+ * - GetSchema: return the Arrow schema of the query.
596
+ * - GetFlightInfo: execute the catalog metadata request.
597
+ *
598
+ * The returned Arrow schema will be:
599
+ * <
600
+ * catalog_name: utf8,
601
+ * db_schema_name: utf8,
602
+ * table_name: utf8 not null,
603
+ * table_type: utf8 not null,
604
+ * [optional] table_schema: bytes not null (schema of the table as described in Schema.fbs::Schema,
605
+ * it is serialized as an IPC message.)
606
+ * >
607
+ * Fields on table_schema may contain the following metadata:
608
+ * - ARROW:FLIGHT:SQL:CATALOG_NAME - Table's catalog name
609
+ * - ARROW:FLIGHT:SQL:DB_SCHEMA_NAME - Database schema name
610
+ * - ARROW:FLIGHT:SQL:TABLE_NAME - Table name
611
+ * - ARROW:FLIGHT:SQL:TYPE_NAME - The data source-specific name for the data type of the column.
612
+ * - ARROW:FLIGHT:SQL:PRECISION - Column precision/size
613
+ * - ARROW:FLIGHT:SQL:SCALE - Column scale/decimal digits if applicable
614
+ * - ARROW:FLIGHT:SQL:IS_AUTO_INCREMENT - "1" indicates if the column is auto incremented, "0" otherwise.
615
+ * - ARROW:FLIGHT:SQL:IS_CASE_SENSITIVE - "1" indicates if the column is case-sensitive, "0" otherwise.
616
+ * - ARROW:FLIGHT:SQL:IS_READ_ONLY - "1" indicates if the column is read only, "0" otherwise.
617
+ * - ARROW:FLIGHT:SQL:IS_SEARCHABLE - "1" indicates if the column is searchable via WHERE clause, "0" otherwise.
618
+ * The returned data should be ordered by catalog_name, db_schema_name, table_name, then table_type, followed by table_schema if requested.
619
+ */
620
+ interface CommandGetTables {
621
+ $type: "arrow.flight.protocol.sql.CommandGetTables";
622
+ /**
623
+ * Specifies the Catalog to search for the tables.
624
+ * An empty string retrieves those without a catalog.
625
+ * If omitted the catalog name should not be used to narrow the search.
626
+ */
627
+ readonly catalog?: string | undefined;
628
+ /**
629
+ * Specifies a filter pattern for schemas to search for.
630
+ * When no db_schema_filter_pattern is provided, all schemas matching other filters are searched.
631
+ * In the pattern string, two special characters can be used to denote matching rules:
632
+ * - "%" means to match any substring with 0 or more characters.
633
+ * - "_" means to match any one character.
634
+ */
635
+ readonly dbSchemaFilterPattern?: string | undefined;
636
+ /**
637
+ * Specifies a filter pattern for tables to search for.
638
+ * When no table_name_filter_pattern is provided, all tables matching other filters are searched.
639
+ * In the pattern string, two special characters can be used to denote matching rules:
640
+ * - "%" means to match any substring with 0 or more characters.
641
+ * - "_" means to match any one character.
642
+ */
643
+ readonly tableNameFilterPattern?: string | undefined;
644
+ /**
645
+ * Specifies a filter of table types which must match.
646
+ * The table types depend on vendor/implementation. It is usually used to separate tables from views or system tables.
647
+ * TABLE, VIEW, and SYSTEM TABLE are commonly supported.
648
+ */
649
+ readonly tableTypes: readonly string[];
650
+ /** Specifies if the Arrow schema should be returned for found tables. */
651
+ readonly includeSchema: boolean;
652
+ }
653
+ /**
654
+ * Represents a request to retrieve the list of table types on a Flight SQL enabled backend.
655
+ * The table types depend on vendor/implementation. It is usually used to separate tables from views or system tables.
656
+ * TABLE, VIEW, and SYSTEM TABLE are commonly supported.
657
+ * Used in the command member of FlightDescriptor for the following RPC calls:
658
+ * - GetSchema: return the Arrow schema of the query.
659
+ * - GetFlightInfo: execute the catalog metadata request.
660
+ *
661
+ * The returned Arrow schema will be:
662
+ * <
663
+ * table_type: utf8 not null
664
+ * >
665
+ * The returned data should be ordered by table_type.
666
+ */
667
+ interface CommandGetTableTypes {
668
+ $type: "arrow.flight.protocol.sql.CommandGetTableTypes";
669
+ }
670
+ /**
671
+ * Represents a SQL query. Used in the command member of FlightDescriptor
672
+ * for the following RPC calls:
673
+ * - GetSchema: return the Arrow schema of the query.
674
+ * Fields on this schema may contain the following metadata:
675
+ * - ARROW:FLIGHT:SQL:CATALOG_NAME - Table's catalog name
676
+ * - ARROW:FLIGHT:SQL:DB_SCHEMA_NAME - Database schema name
677
+ * - ARROW:FLIGHT:SQL:TABLE_NAME - Table name
678
+ * - ARROW:FLIGHT:SQL:TYPE_NAME - The data source-specific name for the data type of the column.
679
+ * - ARROW:FLIGHT:SQL:PRECISION - Column precision/size
680
+ * - ARROW:FLIGHT:SQL:SCALE - Column scale/decimal digits if applicable
681
+ * - ARROW:FLIGHT:SQL:IS_AUTO_INCREMENT - "1" indicates if the column is auto incremented, "0" otherwise.
682
+ * - ARROW:FLIGHT:SQL:IS_CASE_SENSITIVE - "1" indicates if the column is case-sensitive, "0" otherwise.
683
+ * - ARROW:FLIGHT:SQL:IS_READ_ONLY - "1" indicates if the column is read only, "0" otherwise.
684
+ * - ARROW:FLIGHT:SQL:IS_SEARCHABLE - "1" indicates if the column is searchable via WHERE clause, "0" otherwise.
685
+ * - GetFlightInfo: execute the query.
686
+ */
687
+ interface CommandStatementQuery {
688
+ $type: "arrow.flight.protocol.sql.CommandStatementQuery";
689
+ /** The SQL syntax. */
690
+ readonly query: string;
691
+ /** Include the query as part of this transaction (if unset, the query is auto-committed). */
692
+ readonly transactionId?: Uint8Array | undefined;
693
+ }
694
+ declare const CommandGetCatalogs: MessageFns<CommandGetCatalogs, "arrow.flight.protocol.sql.CommandGetCatalogs">;
695
+ declare const CommandGetDbSchemas: MessageFns<CommandGetDbSchemas, "arrow.flight.protocol.sql.CommandGetDbSchemas">;
696
+ declare const CommandGetTables: MessageFns<CommandGetTables, "arrow.flight.protocol.sql.CommandGetTables">;
697
+ declare const CommandGetTableTypes: MessageFns<CommandGetTableTypes, "arrow.flight.protocol.sql.CommandGetTableTypes">;
698
+ declare const CommandStatementQuery: MessageFns<CommandStatementQuery, "arrow.flight.protocol.sql.CommandStatementQuery">;
699
+ type Builtin = Date | Function | Uint8Array | string | number | boolean | bigint | undefined;
700
+ type DeepPartial<T> = T extends Builtin ? T : T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>> : T extends {
701
+ readonly $case: string;
702
+ } ? { [K in keyof Omit<T, "$case">]?: DeepPartial<T[K]> } & {
703
+ readonly $case: T["$case"];
704
+ } : T extends {} ? { [K in Exclude<keyof T, "$type">]?: DeepPartial<T[K]> } : Partial<T>;
705
+ type KeysOfUnion<T> = T extends T ? keyof T : never;
706
+ type Exact<P, I extends P> = P extends Builtin ? P : P & { [K in keyof P]: Exact<P[K], I[K]> } & { [K in Exclude<keyof I, KeysOfUnion<P> | "$type">]: never };
707
+ interface MessageFns<T, V extends string> {
708
+ readonly $type: V;
709
+ encode(message: T, writer?: BinaryWriter): BinaryWriter;
710
+ decode(input: BinaryReader | Uint8Array, length?: number): T;
711
+ fromJSON(object: any): T;
712
+ toJSON(message: T): unknown;
713
+ create<I extends Exact<DeepPartial<T>, I>>(base?: I): T;
714
+ fromPartial<I extends Exact<DeepPartial<T>, I>>(object: I): T;
715
+ }
716
+ //#endregion
717
+ //#region src/arrow-flight-sql.d.ts
718
+ declare class ArrowFlightSqlClient {
719
+ private inner;
720
+ constructor(config: HostOrChannel, options?: ClientOptions<FlightServiceDefinition>);
721
+ executeFlightInfo(request: FlightInfo, options?: CallOptions): AsyncGenerator<apache_arrow0.RecordBatch<any>, any, any>;
722
+ getCatalogs(request: RemoveTypeUrl<CommandGetCatalogs>, options?: CallOptions): Promise<FlightInfo>;
723
+ getDbSchemas(request: RemoveTypeUrl<CommandGetDbSchemas>, options?: CallOptions): Promise<FlightInfo>;
724
+ getTables(request: RemoveTypeUrl<CommandGetTables>, options?: CallOptions): Promise<FlightInfo>;
725
+ getTableTypes(request: RemoveTypeUrl<CommandGetTableTypes>, options?: CallOptions): Promise<FlightInfo>;
726
+ executeQuery(request: RemoveTypeUrl<CommandStatementQuery>, options?: CallOptions): Promise<FlightInfo>;
727
+ }
728
+ //#endregion
729
+ //#region src/flight-data-encoder.d.ts
730
+ declare const FlightDataEncoder: {
731
+ encodeSchema(schema: Schema, {
732
+ flightDescriptor,
733
+ appMetadata
734
+ }: {
735
+ flightDescriptor: FlightDescriptor;
736
+ appMetadata?: Uint8Array;
737
+ }): FlightData;
738
+ encodeBatch(batch: RecordBatch, {
739
+ appMetadata
740
+ }?: {
741
+ appMetadata?: (args: {
742
+ index: number;
743
+ length: number;
744
+ }) => Uint8Array | undefined;
745
+ }): ReadonlyArray<FlightData>;
746
+ };
747
+ //#endregion
748
+ export { ArrowFlightClient, ArrowFlightSqlClient, type ClientOptions, FlightData, FlightDataEncoder, FlightDescriptor, FlightDescriptor_DescriptorType, type HostOrChannel, Metadata, PutResult, Ticket, createChannelFromConfig };
749
+ //# sourceMappingURL=index.d.ts.map