@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,4133 @@
1
+ import { Metadata, createChannel, createClient } from "nice-grpc";
2
+ import { Message, MessageHeader, RecordBatch, Struct, Vector, compressionRegistry, makeData } from "apache-arrow";
3
+ import { ITERATOR_DONE } from "apache-arrow/io/interfaces";
4
+ import { COMPRESS_LENGTH_PREFIX, LENGTH_NO_COMPRESSED_DATA } from "apache-arrow/ipc/compression/constants";
5
+ import * as metadata from "apache-arrow/ipc/metadata/message";
6
+ import { _InternalEmptyPlaceholderRecordBatch } from "apache-arrow/recordbatch";
7
+ import { bigIntToNumber } from "apache-arrow/util/bigint";
8
+ import { CompressedVectorLoader, VectorLoader } from "apache-arrow/visitor/vectorloader";
9
+ import * as flatbuffers from "flatbuffers";
10
+ import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
11
+ import { VectorAssembler } from "apache-arrow/visitor/vectorassembler";
12
+
13
+ //#region src/record-batch-decoder.ts
14
+ const invalidMessageType = (type) => `Expected ${MessageHeader[type]} Message in stream, but was null or length 0.`;
15
+ var RecordBatchReaderImpl = class {
16
+ closed = false;
17
+ autoDestroy = true;
18
+ dictionaries;
19
+ _dictionaryIndex = 0;
20
+ _recordBatchIndex = 0;
21
+ get numDictionaries() {
22
+ return this._dictionaryIndex;
23
+ }
24
+ get numRecordBatches() {
25
+ return this._recordBatchIndex;
26
+ }
27
+ constructor(dictionaries = /* @__PURE__ */ new Map()) {
28
+ this.dictionaries = dictionaries;
29
+ }
30
+ reset(schema) {
31
+ this._dictionaryIndex = 0;
32
+ this._recordBatchIndex = 0;
33
+ this.schema = schema;
34
+ this.dictionaries = /* @__PURE__ */ new Map();
35
+ return this;
36
+ }
37
+ _loadRecordBatch(header, body) {
38
+ const alignedBody = this._ensureAlignedBuffer(body);
39
+ let children;
40
+ if (header.compression != null) {
41
+ const codec = compressionRegistry.get(header.compression.type);
42
+ if (codec?.decode && typeof codec.decode === "function") {
43
+ const { decommpressedBody, buffers } = this._decompressBuffers(header, alignedBody, codec);
44
+ children = this._loadCompressedVectors(header, decommpressedBody, this.schema.fields);
45
+ header = new metadata.RecordBatch(header.length, header.nodes, buffers, null);
46
+ } else throw new Error("Record batch is compressed but codec not found");
47
+ } else children = this._loadVectors(header, alignedBody, this.schema.fields);
48
+ const data = makeData({
49
+ type: new Struct(this.schema.fields),
50
+ length: header.length,
51
+ children
52
+ });
53
+ return new RecordBatch(this.schema, data);
54
+ }
55
+ /**
56
+ * Ensures that a buffer is properly aligned for Apache Arrow's requirements.
57
+ * Apache Arrow needs 8-byte aligned buffers for typed array views.
58
+ */
59
+ _ensureAlignedBuffer(buffer) {
60
+ if (buffer.byteOffset % 8 === 0) return buffer;
61
+ const alignedBuffer = new Uint8Array(buffer.length);
62
+ alignedBuffer.set(buffer);
63
+ return alignedBuffer;
64
+ }
65
+ _loadDictionaryBatch(header, body) {
66
+ const { id, isDelta } = header;
67
+ const { dictionaries, schema } = this;
68
+ const dictionary = dictionaries.get(id);
69
+ const type = schema.dictionaries.get(id);
70
+ let data;
71
+ if (header.data.compression != null) {
72
+ const codec = compressionRegistry.get(header.data.compression.type);
73
+ if (codec?.decode && typeof codec.decode === "function") {
74
+ const { decommpressedBody, buffers } = this._decompressBuffers(header.data, body, codec);
75
+ data = this._loadCompressedVectors(header.data, decommpressedBody, [type]);
76
+ header = new metadata.DictionaryBatch(new metadata.RecordBatch(header.data.length, header.data.nodes, buffers, null), id, isDelta);
77
+ } else throw new Error("Dictionary batch is compressed but codec not found");
78
+ } else data = this._loadVectors(header.data, body, [type]);
79
+ return (dictionary && isDelta ? dictionary.concat(new Vector(data)) : new Vector(data)).memoize();
80
+ }
81
+ _loadVectors(header, body, types) {
82
+ return new VectorLoader(body, header.nodes, header.buffers, this.dictionaries, this.schema.metadataVersion).visitMany(types);
83
+ }
84
+ _loadCompressedVectors(header, body, types) {
85
+ return new CompressedVectorLoader(body, header.nodes, header.buffers, this.dictionaries, this.schema.metadataVersion).visitMany(types);
86
+ }
87
+ _decompressBuffers(header, body, codec) {
88
+ const decompressedBuffers = [];
89
+ const newBufferRegions = [];
90
+ let currentOffset = 0;
91
+ for (const { offset, length } of header.buffers) {
92
+ if (length === 0) {
93
+ decompressedBuffers.push(new Uint8Array(0));
94
+ newBufferRegions.push(new metadata.BufferRegion(currentOffset, 0));
95
+ continue;
96
+ }
97
+ const byteBuf = new flatbuffers.ByteBuffer(body.subarray(offset, offset + length));
98
+ const uncompressedLenth = bigIntToNumber(byteBuf.readInt64(0));
99
+ const bytes = byteBuf.bytes().subarray(COMPRESS_LENGTH_PREFIX);
100
+ const decompressed = uncompressedLenth === LENGTH_NO_COMPRESSED_DATA ? bytes : codec.decode(bytes);
101
+ decompressedBuffers.push(decompressed);
102
+ const padding = (currentOffset + 7 & -8) - currentOffset;
103
+ currentOffset += padding;
104
+ newBufferRegions.push(new metadata.BufferRegion(currentOffset, decompressed.length));
105
+ currentOffset += decompressed.length;
106
+ }
107
+ return {
108
+ decommpressedBody: decompressedBuffers,
109
+ buffers: newBufferRegions
110
+ };
111
+ }
112
+ };
113
+ var RecordBatchStreamReaderFromFlightData = class extends RecordBatchReaderImpl {
114
+ _reader;
115
+ constructor(_source, dictionaries) {
116
+ super(dictionaries);
117
+ this._source = _source;
118
+ this._reader = this._source[Symbol.asyncIterator]();
119
+ }
120
+ [Symbol.asyncIterator]() {
121
+ return this;
122
+ }
123
+ async next() {
124
+ if (this.closed) return ITERATOR_DONE;
125
+ while (true) {
126
+ const maybeMessage = await this._readNextMessageAndValidate();
127
+ if (!maybeMessage) break;
128
+ const { message, flight } = maybeMessage;
129
+ if (message.isSchema()) this.reset(message.header());
130
+ else if (message.isRecordBatch()) {
131
+ this._recordBatchIndex++;
132
+ const header = message.header();
133
+ return {
134
+ done: false,
135
+ value: this._loadRecordBatch(header, flight.dataBody)
136
+ };
137
+ } else if (message.isDictionaryBatch()) {
138
+ this._dictionaryIndex++;
139
+ const header = message.header();
140
+ const vector = this._loadDictionaryBatch(header, flight.dataBody);
141
+ this.dictionaries.set(header.id, vector);
142
+ }
143
+ }
144
+ if (this.schema && this._recordBatchIndex === 0) {
145
+ this._recordBatchIndex++;
146
+ return {
147
+ done: false,
148
+ value: new _InternalEmptyPlaceholderRecordBatch(this.schema)
149
+ };
150
+ }
151
+ return ITERATOR_DONE;
152
+ }
153
+ async _readNextMessageAndValidate(type) {
154
+ const { done, value } = await this._reader.next();
155
+ if (done) return null;
156
+ const message = Message.decode(value.dataHeader);
157
+ if (type != null && message.headerType !== type) throw new Error(invalidMessageType(type));
158
+ return {
159
+ message,
160
+ flight: value
161
+ };
162
+ }
163
+ };
164
+
165
+ //#endregion
166
+ //#region src/arrow-utils.ts
167
+ function decodeSchemaFromFlightInfo(info) {
168
+ return getMessageSchema(Message.decode(info.schema.slice(8)));
169
+ }
170
+ function getMessageSchema(message) {
171
+ if (message.isSchema()) return message.header();
172
+ }
173
+ function decodeFlightDataStream(stream, { expectedSchema: _expectedSchema }) {
174
+ return new RecordBatchStreamReaderFromFlightData(stream);
175
+ }
176
+
177
+ //#endregion
178
+ //#region src/proto/typeRegistry.ts
179
+ const messageTypeRegistry = /* @__PURE__ */ new Map();
180
+
181
+ //#endregion
182
+ //#region src/proto/google/protobuf/timestamp.ts
183
+ function createBaseTimestamp() {
184
+ return {
185
+ $type: "google.protobuf.Timestamp",
186
+ seconds: 0n,
187
+ nanos: 0
188
+ };
189
+ }
190
+ const Timestamp = {
191
+ $type: "google.protobuf.Timestamp",
192
+ encode(message, writer = new BinaryWriter()) {
193
+ if (message.seconds !== 0n) {
194
+ if (BigInt.asIntN(64, message.seconds) !== message.seconds) throw new globalThis.Error("value provided for field message.seconds of type int64 too large");
195
+ writer.uint32(8).int64(message.seconds);
196
+ }
197
+ if (message.nanos !== 0) writer.uint32(16).int32(message.nanos);
198
+ return writer;
199
+ },
200
+ decode(input, length) {
201
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
202
+ let end = length === void 0 ? reader.len : reader.pos + length;
203
+ const message = createBaseTimestamp();
204
+ while (reader.pos < end) {
205
+ const tag = reader.uint32();
206
+ switch (tag >>> 3) {
207
+ case 1:
208
+ if (tag !== 8) break;
209
+ message.seconds = reader.int64();
210
+ continue;
211
+ case 2:
212
+ if (tag !== 16) break;
213
+ message.nanos = reader.int32();
214
+ continue;
215
+ }
216
+ if ((tag & 7) === 4 || tag === 0) break;
217
+ reader.skip(tag & 7);
218
+ }
219
+ return message;
220
+ },
221
+ fromJSON(object) {
222
+ return {
223
+ $type: Timestamp.$type,
224
+ seconds: isSet$3(object.seconds) ? BigInt(object.seconds) : 0n,
225
+ nanos: isSet$3(object.nanos) ? globalThis.Number(object.nanos) : 0
226
+ };
227
+ },
228
+ toJSON(message) {
229
+ const obj = {};
230
+ if (message.seconds !== 0n) obj.seconds = message.seconds.toString();
231
+ if (message.nanos !== 0) obj.nanos = Math.round(message.nanos);
232
+ return obj;
233
+ },
234
+ create(base) {
235
+ return Timestamp.fromPartial(base ?? {});
236
+ },
237
+ fromPartial(object) {
238
+ const message = createBaseTimestamp();
239
+ message.seconds = object.seconds ?? 0n;
240
+ message.nanos = object.nanos ?? 0;
241
+ return message;
242
+ }
243
+ };
244
+ messageTypeRegistry.set(Timestamp.$type, Timestamp);
245
+ function isSet$3(value) {
246
+ return value !== null && value !== void 0;
247
+ }
248
+
249
+ //#endregion
250
+ //#region src/proto/Flight.ts
251
+ /**
252
+ * The result of a cancel operation.
253
+ *
254
+ * This is used by CancelFlightInfoResult.status.
255
+ */
256
+ let CancelStatus = /* @__PURE__ */ function(CancelStatus$1) {
257
+ /**
258
+ * UNSPECIFIED - The cancellation status is unknown. Servers should avoid using
259
+ * this value (send a NOT_FOUND error if the requested query is
260
+ * not known). Clients can retry the request.
261
+ */
262
+ CancelStatus$1[CancelStatus$1["UNSPECIFIED"] = 0] = "UNSPECIFIED";
263
+ /**
264
+ * CANCELLED - The cancellation request is complete. Subsequent requests with
265
+ * the same payload may return CANCELLED or a NOT_FOUND error.
266
+ */
267
+ CancelStatus$1[CancelStatus$1["CANCELLED"] = 1] = "CANCELLED";
268
+ /**
269
+ * CANCELLING - The cancellation request is in progress. The client may retry
270
+ * the cancellation request.
271
+ */
272
+ CancelStatus$1[CancelStatus$1["CANCELLING"] = 2] = "CANCELLING";
273
+ /**
274
+ * NOT_CANCELLABLE - The query is not cancellable. The client should not retry the
275
+ * cancellation request.
276
+ */
277
+ CancelStatus$1[CancelStatus$1["NOT_CANCELLABLE"] = 3] = "NOT_CANCELLABLE";
278
+ CancelStatus$1[CancelStatus$1["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
279
+ return CancelStatus$1;
280
+ }({});
281
+ function cancelStatusFromJSON(object) {
282
+ switch (object) {
283
+ case 0:
284
+ case "CANCEL_STATUS_UNSPECIFIED": return CancelStatus.UNSPECIFIED;
285
+ case 1:
286
+ case "CANCEL_STATUS_CANCELLED": return CancelStatus.CANCELLED;
287
+ case 2:
288
+ case "CANCEL_STATUS_CANCELLING": return CancelStatus.CANCELLING;
289
+ case 3:
290
+ case "CANCEL_STATUS_NOT_CANCELLABLE": return CancelStatus.NOT_CANCELLABLE;
291
+ case -1:
292
+ case "UNRECOGNIZED":
293
+ default: return CancelStatus.UNRECOGNIZED;
294
+ }
295
+ }
296
+ function cancelStatusToJSON(object) {
297
+ switch (object) {
298
+ case CancelStatus.UNSPECIFIED: return "CANCEL_STATUS_UNSPECIFIED";
299
+ case CancelStatus.CANCELLED: return "CANCEL_STATUS_CANCELLED";
300
+ case CancelStatus.CANCELLING: return "CANCEL_STATUS_CANCELLING";
301
+ case CancelStatus.NOT_CANCELLABLE: return "CANCEL_STATUS_NOT_CANCELLABLE";
302
+ case CancelStatus.UNRECOGNIZED:
303
+ default: return "UNRECOGNIZED";
304
+ }
305
+ }
306
+ /** Describes what type of descriptor is defined. */
307
+ let FlightDescriptor_DescriptorType = /* @__PURE__ */ function(FlightDescriptor_DescriptorType$1) {
308
+ /** UNKNOWN - Protobuf pattern, not used. */
309
+ FlightDescriptor_DescriptorType$1[FlightDescriptor_DescriptorType$1["UNKNOWN"] = 0] = "UNKNOWN";
310
+ /**
311
+ * PATH - A named path that identifies a dataset. A path is composed of a string
312
+ * or list of strings describing a particular dataset. This is conceptually
313
+ * similar to a path inside a filesystem.
314
+ */
315
+ FlightDescriptor_DescriptorType$1[FlightDescriptor_DescriptorType$1["PATH"] = 1] = "PATH";
316
+ /** CMD - An opaque command to generate a dataset. */
317
+ FlightDescriptor_DescriptorType$1[FlightDescriptor_DescriptorType$1["CMD"] = 2] = "CMD";
318
+ FlightDescriptor_DescriptorType$1[FlightDescriptor_DescriptorType$1["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
319
+ return FlightDescriptor_DescriptorType$1;
320
+ }({});
321
+ function flightDescriptor_DescriptorTypeFromJSON(object) {
322
+ switch (object) {
323
+ case 0:
324
+ case "UNKNOWN": return FlightDescriptor_DescriptorType.UNKNOWN;
325
+ case 1:
326
+ case "PATH": return FlightDescriptor_DescriptorType.PATH;
327
+ case 2:
328
+ case "CMD": return FlightDescriptor_DescriptorType.CMD;
329
+ case -1:
330
+ case "UNRECOGNIZED":
331
+ default: return FlightDescriptor_DescriptorType.UNRECOGNIZED;
332
+ }
333
+ }
334
+ function flightDescriptor_DescriptorTypeToJSON(object) {
335
+ switch (object) {
336
+ case FlightDescriptor_DescriptorType.UNKNOWN: return "UNKNOWN";
337
+ case FlightDescriptor_DescriptorType.PATH: return "PATH";
338
+ case FlightDescriptor_DescriptorType.CMD: return "CMD";
339
+ case FlightDescriptor_DescriptorType.UNRECOGNIZED:
340
+ default: return "UNRECOGNIZED";
341
+ }
342
+ }
343
+ function createBaseHandshakeRequest() {
344
+ return {
345
+ $type: "arrow.flight.protocol.HandshakeRequest",
346
+ protocolVersion: 0n,
347
+ payload: new Uint8Array(0)
348
+ };
349
+ }
350
+ const HandshakeRequest = {
351
+ $type: "arrow.flight.protocol.HandshakeRequest",
352
+ encode(message, writer = new BinaryWriter()) {
353
+ if (message.protocolVersion !== 0n) {
354
+ if (BigInt.asUintN(64, message.protocolVersion) !== message.protocolVersion) throw new globalThis.Error("value provided for field message.protocolVersion of type uint64 too large");
355
+ writer.uint32(8).uint64(message.protocolVersion);
356
+ }
357
+ if (message.payload.length !== 0) writer.uint32(18).bytes(message.payload);
358
+ return writer;
359
+ },
360
+ decode(input, length) {
361
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
362
+ let end = length === void 0 ? reader.len : reader.pos + length;
363
+ const message = createBaseHandshakeRequest();
364
+ while (reader.pos < end) {
365
+ const tag = reader.uint32();
366
+ switch (tag >>> 3) {
367
+ case 1:
368
+ if (tag !== 8) break;
369
+ message.protocolVersion = reader.uint64();
370
+ continue;
371
+ case 2:
372
+ if (tag !== 18) break;
373
+ message.payload = reader.bytes();
374
+ continue;
375
+ }
376
+ if ((tag & 7) === 4 || tag === 0) break;
377
+ reader.skip(tag & 7);
378
+ }
379
+ return message;
380
+ },
381
+ fromJSON(object) {
382
+ return {
383
+ $type: HandshakeRequest.$type,
384
+ protocolVersion: isSet$2(object.protocolVersion) ? BigInt(object.protocolVersion) : 0n,
385
+ payload: isSet$2(object.payload) ? bytesFromBase64$2(object.payload) : new Uint8Array(0)
386
+ };
387
+ },
388
+ toJSON(message) {
389
+ const obj = {};
390
+ if (message.protocolVersion !== 0n) obj.protocolVersion = message.protocolVersion.toString();
391
+ if (message.payload.length !== 0) obj.payload = base64FromBytes$2(message.payload);
392
+ return obj;
393
+ },
394
+ create(base) {
395
+ return HandshakeRequest.fromPartial(base ?? {});
396
+ },
397
+ fromPartial(object) {
398
+ const message = createBaseHandshakeRequest();
399
+ message.protocolVersion = object.protocolVersion ?? 0n;
400
+ message.payload = object.payload ?? new Uint8Array(0);
401
+ return message;
402
+ }
403
+ };
404
+ messageTypeRegistry.set(HandshakeRequest.$type, HandshakeRequest);
405
+ function createBaseHandshakeResponse() {
406
+ return {
407
+ $type: "arrow.flight.protocol.HandshakeResponse",
408
+ protocolVersion: 0n,
409
+ payload: new Uint8Array(0)
410
+ };
411
+ }
412
+ const HandshakeResponse = {
413
+ $type: "arrow.flight.protocol.HandshakeResponse",
414
+ encode(message, writer = new BinaryWriter()) {
415
+ if (message.protocolVersion !== 0n) {
416
+ if (BigInt.asUintN(64, message.protocolVersion) !== message.protocolVersion) throw new globalThis.Error("value provided for field message.protocolVersion of type uint64 too large");
417
+ writer.uint32(8).uint64(message.protocolVersion);
418
+ }
419
+ if (message.payload.length !== 0) writer.uint32(18).bytes(message.payload);
420
+ return writer;
421
+ },
422
+ decode(input, length) {
423
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
424
+ let end = length === void 0 ? reader.len : reader.pos + length;
425
+ const message = createBaseHandshakeResponse();
426
+ while (reader.pos < end) {
427
+ const tag = reader.uint32();
428
+ switch (tag >>> 3) {
429
+ case 1:
430
+ if (tag !== 8) break;
431
+ message.protocolVersion = reader.uint64();
432
+ continue;
433
+ case 2:
434
+ if (tag !== 18) break;
435
+ message.payload = reader.bytes();
436
+ continue;
437
+ }
438
+ if ((tag & 7) === 4 || tag === 0) break;
439
+ reader.skip(tag & 7);
440
+ }
441
+ return message;
442
+ },
443
+ fromJSON(object) {
444
+ return {
445
+ $type: HandshakeResponse.$type,
446
+ protocolVersion: isSet$2(object.protocolVersion) ? BigInt(object.protocolVersion) : 0n,
447
+ payload: isSet$2(object.payload) ? bytesFromBase64$2(object.payload) : new Uint8Array(0)
448
+ };
449
+ },
450
+ toJSON(message) {
451
+ const obj = {};
452
+ if (message.protocolVersion !== 0n) obj.protocolVersion = message.protocolVersion.toString();
453
+ if (message.payload.length !== 0) obj.payload = base64FromBytes$2(message.payload);
454
+ return obj;
455
+ },
456
+ create(base) {
457
+ return HandshakeResponse.fromPartial(base ?? {});
458
+ },
459
+ fromPartial(object) {
460
+ const message = createBaseHandshakeResponse();
461
+ message.protocolVersion = object.protocolVersion ?? 0n;
462
+ message.payload = object.payload ?? new Uint8Array(0);
463
+ return message;
464
+ }
465
+ };
466
+ messageTypeRegistry.set(HandshakeResponse.$type, HandshakeResponse);
467
+ function createBaseBasicAuth() {
468
+ return {
469
+ $type: "arrow.flight.protocol.BasicAuth",
470
+ username: "",
471
+ password: ""
472
+ };
473
+ }
474
+ const BasicAuth = {
475
+ $type: "arrow.flight.protocol.BasicAuth",
476
+ encode(message, writer = new BinaryWriter()) {
477
+ if (message.username !== "") writer.uint32(18).string(message.username);
478
+ if (message.password !== "") writer.uint32(26).string(message.password);
479
+ return writer;
480
+ },
481
+ decode(input, length) {
482
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
483
+ let end = length === void 0 ? reader.len : reader.pos + length;
484
+ const message = createBaseBasicAuth();
485
+ while (reader.pos < end) {
486
+ const tag = reader.uint32();
487
+ switch (tag >>> 3) {
488
+ case 2:
489
+ if (tag !== 18) break;
490
+ message.username = reader.string();
491
+ continue;
492
+ case 3:
493
+ if (tag !== 26) break;
494
+ message.password = reader.string();
495
+ continue;
496
+ }
497
+ if ((tag & 7) === 4 || tag === 0) break;
498
+ reader.skip(tag & 7);
499
+ }
500
+ return message;
501
+ },
502
+ fromJSON(object) {
503
+ return {
504
+ $type: BasicAuth.$type,
505
+ username: isSet$2(object.username) ? globalThis.String(object.username) : "",
506
+ password: isSet$2(object.password) ? globalThis.String(object.password) : ""
507
+ };
508
+ },
509
+ toJSON(message) {
510
+ const obj = {};
511
+ if (message.username !== "") obj.username = message.username;
512
+ if (message.password !== "") obj.password = message.password;
513
+ return obj;
514
+ },
515
+ create(base) {
516
+ return BasicAuth.fromPartial(base ?? {});
517
+ },
518
+ fromPartial(object) {
519
+ const message = createBaseBasicAuth();
520
+ message.username = object.username ?? "";
521
+ message.password = object.password ?? "";
522
+ return message;
523
+ }
524
+ };
525
+ messageTypeRegistry.set(BasicAuth.$type, BasicAuth);
526
+ function createBaseEmpty() {
527
+ return { $type: "arrow.flight.protocol.Empty" };
528
+ }
529
+ const Empty = {
530
+ $type: "arrow.flight.protocol.Empty",
531
+ encode(_, writer = new BinaryWriter()) {
532
+ return writer;
533
+ },
534
+ decode(input, length) {
535
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
536
+ let end = length === void 0 ? reader.len : reader.pos + length;
537
+ const message = createBaseEmpty();
538
+ while (reader.pos < end) {
539
+ const tag = reader.uint32();
540
+ switch (tag >>> 3) {}
541
+ if ((tag & 7) === 4 || tag === 0) break;
542
+ reader.skip(tag & 7);
543
+ }
544
+ return message;
545
+ },
546
+ fromJSON(_) {
547
+ return { $type: Empty.$type };
548
+ },
549
+ toJSON(_) {
550
+ return {};
551
+ },
552
+ create(base) {
553
+ return Empty.fromPartial(base ?? {});
554
+ },
555
+ fromPartial(_) {
556
+ return createBaseEmpty();
557
+ }
558
+ };
559
+ messageTypeRegistry.set(Empty.$type, Empty);
560
+ function createBaseActionType() {
561
+ return {
562
+ $type: "arrow.flight.protocol.ActionType",
563
+ type: "",
564
+ description: ""
565
+ };
566
+ }
567
+ const ActionType = {
568
+ $type: "arrow.flight.protocol.ActionType",
569
+ encode(message, writer = new BinaryWriter()) {
570
+ if (message.type !== "") writer.uint32(10).string(message.type);
571
+ if (message.description !== "") writer.uint32(18).string(message.description);
572
+ return writer;
573
+ },
574
+ decode(input, length) {
575
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
576
+ let end = length === void 0 ? reader.len : reader.pos + length;
577
+ const message = createBaseActionType();
578
+ while (reader.pos < end) {
579
+ const tag = reader.uint32();
580
+ switch (tag >>> 3) {
581
+ case 1:
582
+ if (tag !== 10) break;
583
+ message.type = reader.string();
584
+ continue;
585
+ case 2:
586
+ if (tag !== 18) break;
587
+ message.description = reader.string();
588
+ continue;
589
+ }
590
+ if ((tag & 7) === 4 || tag === 0) break;
591
+ reader.skip(tag & 7);
592
+ }
593
+ return message;
594
+ },
595
+ fromJSON(object) {
596
+ return {
597
+ $type: ActionType.$type,
598
+ type: isSet$2(object.type) ? globalThis.String(object.type) : "",
599
+ description: isSet$2(object.description) ? globalThis.String(object.description) : ""
600
+ };
601
+ },
602
+ toJSON(message) {
603
+ const obj = {};
604
+ if (message.type !== "") obj.type = message.type;
605
+ if (message.description !== "") obj.description = message.description;
606
+ return obj;
607
+ },
608
+ create(base) {
609
+ return ActionType.fromPartial(base ?? {});
610
+ },
611
+ fromPartial(object) {
612
+ const message = createBaseActionType();
613
+ message.type = object.type ?? "";
614
+ message.description = object.description ?? "";
615
+ return message;
616
+ }
617
+ };
618
+ messageTypeRegistry.set(ActionType.$type, ActionType);
619
+ function createBaseCriteria() {
620
+ return {
621
+ $type: "arrow.flight.protocol.Criteria",
622
+ expression: new Uint8Array(0)
623
+ };
624
+ }
625
+ const Criteria = {
626
+ $type: "arrow.flight.protocol.Criteria",
627
+ encode(message, writer = new BinaryWriter()) {
628
+ if (message.expression.length !== 0) writer.uint32(10).bytes(message.expression);
629
+ return writer;
630
+ },
631
+ decode(input, length) {
632
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
633
+ let end = length === void 0 ? reader.len : reader.pos + length;
634
+ const message = createBaseCriteria();
635
+ while (reader.pos < end) {
636
+ const tag = reader.uint32();
637
+ switch (tag >>> 3) {
638
+ case 1:
639
+ if (tag !== 10) break;
640
+ message.expression = reader.bytes();
641
+ continue;
642
+ }
643
+ if ((tag & 7) === 4 || tag === 0) break;
644
+ reader.skip(tag & 7);
645
+ }
646
+ return message;
647
+ },
648
+ fromJSON(object) {
649
+ return {
650
+ $type: Criteria.$type,
651
+ expression: isSet$2(object.expression) ? bytesFromBase64$2(object.expression) : new Uint8Array(0)
652
+ };
653
+ },
654
+ toJSON(message) {
655
+ const obj = {};
656
+ if (message.expression.length !== 0) obj.expression = base64FromBytes$2(message.expression);
657
+ return obj;
658
+ },
659
+ create(base) {
660
+ return Criteria.fromPartial(base ?? {});
661
+ },
662
+ fromPartial(object) {
663
+ const message = createBaseCriteria();
664
+ message.expression = object.expression ?? new Uint8Array(0);
665
+ return message;
666
+ }
667
+ };
668
+ messageTypeRegistry.set(Criteria.$type, Criteria);
669
+ function createBaseAction() {
670
+ return {
671
+ $type: "arrow.flight.protocol.Action",
672
+ type: "",
673
+ body: new Uint8Array(0)
674
+ };
675
+ }
676
+ const Action = {
677
+ $type: "arrow.flight.protocol.Action",
678
+ encode(message, writer = new BinaryWriter()) {
679
+ if (message.type !== "") writer.uint32(10).string(message.type);
680
+ if (message.body.length !== 0) writer.uint32(18).bytes(message.body);
681
+ return writer;
682
+ },
683
+ decode(input, length) {
684
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
685
+ let end = length === void 0 ? reader.len : reader.pos + length;
686
+ const message = createBaseAction();
687
+ while (reader.pos < end) {
688
+ const tag = reader.uint32();
689
+ switch (tag >>> 3) {
690
+ case 1:
691
+ if (tag !== 10) break;
692
+ message.type = reader.string();
693
+ continue;
694
+ case 2:
695
+ if (tag !== 18) break;
696
+ message.body = reader.bytes();
697
+ continue;
698
+ }
699
+ if ((tag & 7) === 4 || tag === 0) break;
700
+ reader.skip(tag & 7);
701
+ }
702
+ return message;
703
+ },
704
+ fromJSON(object) {
705
+ return {
706
+ $type: Action.$type,
707
+ type: isSet$2(object.type) ? globalThis.String(object.type) : "",
708
+ body: isSet$2(object.body) ? bytesFromBase64$2(object.body) : new Uint8Array(0)
709
+ };
710
+ },
711
+ toJSON(message) {
712
+ const obj = {};
713
+ if (message.type !== "") obj.type = message.type;
714
+ if (message.body.length !== 0) obj.body = base64FromBytes$2(message.body);
715
+ return obj;
716
+ },
717
+ create(base) {
718
+ return Action.fromPartial(base ?? {});
719
+ },
720
+ fromPartial(object) {
721
+ const message = createBaseAction();
722
+ message.type = object.type ?? "";
723
+ message.body = object.body ?? new Uint8Array(0);
724
+ return message;
725
+ }
726
+ };
727
+ messageTypeRegistry.set(Action.$type, Action);
728
+ function createBaseCancelFlightInfoRequest() {
729
+ return {
730
+ $type: "arrow.flight.protocol.CancelFlightInfoRequest",
731
+ info: void 0
732
+ };
733
+ }
734
+ const CancelFlightInfoRequest = {
735
+ $type: "arrow.flight.protocol.CancelFlightInfoRequest",
736
+ encode(message, writer = new BinaryWriter()) {
737
+ if (message.info !== void 0) FlightInfo.encode(message.info, writer.uint32(10).fork()).join();
738
+ return writer;
739
+ },
740
+ decode(input, length) {
741
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
742
+ let end = length === void 0 ? reader.len : reader.pos + length;
743
+ const message = createBaseCancelFlightInfoRequest();
744
+ while (reader.pos < end) {
745
+ const tag = reader.uint32();
746
+ switch (tag >>> 3) {
747
+ case 1:
748
+ if (tag !== 10) break;
749
+ message.info = FlightInfo.decode(reader, reader.uint32());
750
+ continue;
751
+ }
752
+ if ((tag & 7) === 4 || tag === 0) break;
753
+ reader.skip(tag & 7);
754
+ }
755
+ return message;
756
+ },
757
+ fromJSON(object) {
758
+ return {
759
+ $type: CancelFlightInfoRequest.$type,
760
+ info: isSet$2(object.info) ? FlightInfo.fromJSON(object.info) : void 0
761
+ };
762
+ },
763
+ toJSON(message) {
764
+ const obj = {};
765
+ if (message.info !== void 0) obj.info = FlightInfo.toJSON(message.info);
766
+ return obj;
767
+ },
768
+ create(base) {
769
+ return CancelFlightInfoRequest.fromPartial(base ?? {});
770
+ },
771
+ fromPartial(object) {
772
+ const message = createBaseCancelFlightInfoRequest();
773
+ message.info = object.info !== void 0 && object.info !== null ? FlightInfo.fromPartial(object.info) : void 0;
774
+ return message;
775
+ }
776
+ };
777
+ messageTypeRegistry.set(CancelFlightInfoRequest.$type, CancelFlightInfoRequest);
778
+ function createBaseRenewFlightEndpointRequest() {
779
+ return {
780
+ $type: "arrow.flight.protocol.RenewFlightEndpointRequest",
781
+ endpoint: void 0
782
+ };
783
+ }
784
+ const RenewFlightEndpointRequest = {
785
+ $type: "arrow.flight.protocol.RenewFlightEndpointRequest",
786
+ encode(message, writer = new BinaryWriter()) {
787
+ if (message.endpoint !== void 0) FlightEndpoint.encode(message.endpoint, writer.uint32(10).fork()).join();
788
+ return writer;
789
+ },
790
+ decode(input, length) {
791
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
792
+ let end = length === void 0 ? reader.len : reader.pos + length;
793
+ const message = createBaseRenewFlightEndpointRequest();
794
+ while (reader.pos < end) {
795
+ const tag = reader.uint32();
796
+ switch (tag >>> 3) {
797
+ case 1:
798
+ if (tag !== 10) break;
799
+ message.endpoint = FlightEndpoint.decode(reader, reader.uint32());
800
+ continue;
801
+ }
802
+ if ((tag & 7) === 4 || tag === 0) break;
803
+ reader.skip(tag & 7);
804
+ }
805
+ return message;
806
+ },
807
+ fromJSON(object) {
808
+ return {
809
+ $type: RenewFlightEndpointRequest.$type,
810
+ endpoint: isSet$2(object.endpoint) ? FlightEndpoint.fromJSON(object.endpoint) : void 0
811
+ };
812
+ },
813
+ toJSON(message) {
814
+ const obj = {};
815
+ if (message.endpoint !== void 0) obj.endpoint = FlightEndpoint.toJSON(message.endpoint);
816
+ return obj;
817
+ },
818
+ create(base) {
819
+ return RenewFlightEndpointRequest.fromPartial(base ?? {});
820
+ },
821
+ fromPartial(object) {
822
+ const message = createBaseRenewFlightEndpointRequest();
823
+ message.endpoint = object.endpoint !== void 0 && object.endpoint !== null ? FlightEndpoint.fromPartial(object.endpoint) : void 0;
824
+ return message;
825
+ }
826
+ };
827
+ messageTypeRegistry.set(RenewFlightEndpointRequest.$type, RenewFlightEndpointRequest);
828
+ function createBaseResult() {
829
+ return {
830
+ $type: "arrow.flight.protocol.Result",
831
+ body: new Uint8Array(0)
832
+ };
833
+ }
834
+ const Result = {
835
+ $type: "arrow.flight.protocol.Result",
836
+ encode(message, writer = new BinaryWriter()) {
837
+ if (message.body.length !== 0) writer.uint32(10).bytes(message.body);
838
+ return writer;
839
+ },
840
+ decode(input, length) {
841
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
842
+ let end = length === void 0 ? reader.len : reader.pos + length;
843
+ const message = createBaseResult();
844
+ while (reader.pos < end) {
845
+ const tag = reader.uint32();
846
+ switch (tag >>> 3) {
847
+ case 1:
848
+ if (tag !== 10) break;
849
+ message.body = reader.bytes();
850
+ continue;
851
+ }
852
+ if ((tag & 7) === 4 || tag === 0) break;
853
+ reader.skip(tag & 7);
854
+ }
855
+ return message;
856
+ },
857
+ fromJSON(object) {
858
+ return {
859
+ $type: Result.$type,
860
+ body: isSet$2(object.body) ? bytesFromBase64$2(object.body) : new Uint8Array(0)
861
+ };
862
+ },
863
+ toJSON(message) {
864
+ const obj = {};
865
+ if (message.body.length !== 0) obj.body = base64FromBytes$2(message.body);
866
+ return obj;
867
+ },
868
+ create(base) {
869
+ return Result.fromPartial(base ?? {});
870
+ },
871
+ fromPartial(object) {
872
+ const message = createBaseResult();
873
+ message.body = object.body ?? new Uint8Array(0);
874
+ return message;
875
+ }
876
+ };
877
+ messageTypeRegistry.set(Result.$type, Result);
878
+ function createBaseCancelFlightInfoResult() {
879
+ return {
880
+ $type: "arrow.flight.protocol.CancelFlightInfoResult",
881
+ status: 0
882
+ };
883
+ }
884
+ const CancelFlightInfoResult = {
885
+ $type: "arrow.flight.protocol.CancelFlightInfoResult",
886
+ encode(message, writer = new BinaryWriter()) {
887
+ if (message.status !== 0) writer.uint32(8).int32(message.status);
888
+ return writer;
889
+ },
890
+ decode(input, length) {
891
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
892
+ let end = length === void 0 ? reader.len : reader.pos + length;
893
+ const message = createBaseCancelFlightInfoResult();
894
+ while (reader.pos < end) {
895
+ const tag = reader.uint32();
896
+ switch (tag >>> 3) {
897
+ case 1:
898
+ if (tag !== 8) break;
899
+ message.status = reader.int32();
900
+ continue;
901
+ }
902
+ if ((tag & 7) === 4 || tag === 0) break;
903
+ reader.skip(tag & 7);
904
+ }
905
+ return message;
906
+ },
907
+ fromJSON(object) {
908
+ return {
909
+ $type: CancelFlightInfoResult.$type,
910
+ status: isSet$2(object.status) ? cancelStatusFromJSON(object.status) : 0
911
+ };
912
+ },
913
+ toJSON(message) {
914
+ const obj = {};
915
+ if (message.status !== 0) obj.status = cancelStatusToJSON(message.status);
916
+ return obj;
917
+ },
918
+ create(base) {
919
+ return CancelFlightInfoResult.fromPartial(base ?? {});
920
+ },
921
+ fromPartial(object) {
922
+ const message = createBaseCancelFlightInfoResult();
923
+ message.status = object.status ?? 0;
924
+ return message;
925
+ }
926
+ };
927
+ messageTypeRegistry.set(CancelFlightInfoResult.$type, CancelFlightInfoResult);
928
+ function createBaseSchemaResult() {
929
+ return {
930
+ $type: "arrow.flight.protocol.SchemaResult",
931
+ schema: new Uint8Array(0)
932
+ };
933
+ }
934
+ const SchemaResult = {
935
+ $type: "arrow.flight.protocol.SchemaResult",
936
+ encode(message, writer = new BinaryWriter()) {
937
+ if (message.schema.length !== 0) writer.uint32(10).bytes(message.schema);
938
+ return writer;
939
+ },
940
+ decode(input, length) {
941
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
942
+ let end = length === void 0 ? reader.len : reader.pos + length;
943
+ const message = createBaseSchemaResult();
944
+ while (reader.pos < end) {
945
+ const tag = reader.uint32();
946
+ switch (tag >>> 3) {
947
+ case 1:
948
+ if (tag !== 10) break;
949
+ message.schema = reader.bytes();
950
+ continue;
951
+ }
952
+ if ((tag & 7) === 4 || tag === 0) break;
953
+ reader.skip(tag & 7);
954
+ }
955
+ return message;
956
+ },
957
+ fromJSON(object) {
958
+ return {
959
+ $type: SchemaResult.$type,
960
+ schema: isSet$2(object.schema) ? bytesFromBase64$2(object.schema) : new Uint8Array(0)
961
+ };
962
+ },
963
+ toJSON(message) {
964
+ const obj = {};
965
+ if (message.schema.length !== 0) obj.schema = base64FromBytes$2(message.schema);
966
+ return obj;
967
+ },
968
+ create(base) {
969
+ return SchemaResult.fromPartial(base ?? {});
970
+ },
971
+ fromPartial(object) {
972
+ const message = createBaseSchemaResult();
973
+ message.schema = object.schema ?? new Uint8Array(0);
974
+ return message;
975
+ }
976
+ };
977
+ messageTypeRegistry.set(SchemaResult.$type, SchemaResult);
978
+ function createBaseFlightDescriptor() {
979
+ return {
980
+ $type: "arrow.flight.protocol.FlightDescriptor",
981
+ type: 0,
982
+ cmd: new Uint8Array(0),
983
+ path: []
984
+ };
985
+ }
986
+ const FlightDescriptor = {
987
+ $type: "arrow.flight.protocol.FlightDescriptor",
988
+ encode(message, writer = new BinaryWriter()) {
989
+ if (message.type !== 0) writer.uint32(8).int32(message.type);
990
+ if (message.cmd.length !== 0) writer.uint32(18).bytes(message.cmd);
991
+ for (const v of message.path) writer.uint32(26).string(v);
992
+ return writer;
993
+ },
994
+ decode(input, length) {
995
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
996
+ let end = length === void 0 ? reader.len : reader.pos + length;
997
+ const message = createBaseFlightDescriptor();
998
+ while (reader.pos < end) {
999
+ const tag = reader.uint32();
1000
+ switch (tag >>> 3) {
1001
+ case 1:
1002
+ if (tag !== 8) break;
1003
+ message.type = reader.int32();
1004
+ continue;
1005
+ case 2:
1006
+ if (tag !== 18) break;
1007
+ message.cmd = reader.bytes();
1008
+ continue;
1009
+ case 3:
1010
+ if (tag !== 26) break;
1011
+ message.path.push(reader.string());
1012
+ continue;
1013
+ }
1014
+ if ((tag & 7) === 4 || tag === 0) break;
1015
+ reader.skip(tag & 7);
1016
+ }
1017
+ return message;
1018
+ },
1019
+ fromJSON(object) {
1020
+ return {
1021
+ $type: FlightDescriptor.$type,
1022
+ type: isSet$2(object.type) ? flightDescriptor_DescriptorTypeFromJSON(object.type) : 0,
1023
+ cmd: isSet$2(object.cmd) ? bytesFromBase64$2(object.cmd) : new Uint8Array(0),
1024
+ path: globalThis.Array.isArray(object?.path) ? object.path.map((e) => globalThis.String(e)) : []
1025
+ };
1026
+ },
1027
+ toJSON(message) {
1028
+ const obj = {};
1029
+ if (message.type !== 0) obj.type = flightDescriptor_DescriptorTypeToJSON(message.type);
1030
+ if (message.cmd.length !== 0) obj.cmd = base64FromBytes$2(message.cmd);
1031
+ if (message.path?.length) obj.path = message.path;
1032
+ return obj;
1033
+ },
1034
+ create(base) {
1035
+ return FlightDescriptor.fromPartial(base ?? {});
1036
+ },
1037
+ fromPartial(object) {
1038
+ const message = createBaseFlightDescriptor();
1039
+ message.type = object.type ?? 0;
1040
+ message.cmd = object.cmd ?? new Uint8Array(0);
1041
+ message.path = object.path?.map((e) => e) || [];
1042
+ return message;
1043
+ }
1044
+ };
1045
+ messageTypeRegistry.set(FlightDescriptor.$type, FlightDescriptor);
1046
+ function createBaseFlightInfo() {
1047
+ return {
1048
+ $type: "arrow.flight.protocol.FlightInfo",
1049
+ schema: new Uint8Array(0),
1050
+ flightDescriptor: void 0,
1051
+ endpoint: [],
1052
+ totalRecords: 0n,
1053
+ totalBytes: 0n,
1054
+ ordered: false,
1055
+ appMetadata: new Uint8Array(0)
1056
+ };
1057
+ }
1058
+ const FlightInfo = {
1059
+ $type: "arrow.flight.protocol.FlightInfo",
1060
+ encode(message, writer = new BinaryWriter()) {
1061
+ if (message.schema.length !== 0) writer.uint32(10).bytes(message.schema);
1062
+ if (message.flightDescriptor !== void 0) FlightDescriptor.encode(message.flightDescriptor, writer.uint32(18).fork()).join();
1063
+ for (const v of message.endpoint) FlightEndpoint.encode(v, writer.uint32(26).fork()).join();
1064
+ if (message.totalRecords !== 0n) {
1065
+ if (BigInt.asIntN(64, message.totalRecords) !== message.totalRecords) throw new globalThis.Error("value provided for field message.totalRecords of type int64 too large");
1066
+ writer.uint32(32).int64(message.totalRecords);
1067
+ }
1068
+ if (message.totalBytes !== 0n) {
1069
+ if (BigInt.asIntN(64, message.totalBytes) !== message.totalBytes) throw new globalThis.Error("value provided for field message.totalBytes of type int64 too large");
1070
+ writer.uint32(40).int64(message.totalBytes);
1071
+ }
1072
+ if (message.ordered !== false) writer.uint32(48).bool(message.ordered);
1073
+ if (message.appMetadata.length !== 0) writer.uint32(58).bytes(message.appMetadata);
1074
+ return writer;
1075
+ },
1076
+ decode(input, length) {
1077
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
1078
+ let end = length === void 0 ? reader.len : reader.pos + length;
1079
+ const message = createBaseFlightInfo();
1080
+ while (reader.pos < end) {
1081
+ const tag = reader.uint32();
1082
+ switch (tag >>> 3) {
1083
+ case 1:
1084
+ if (tag !== 10) break;
1085
+ message.schema = reader.bytes();
1086
+ continue;
1087
+ case 2:
1088
+ if (tag !== 18) break;
1089
+ message.flightDescriptor = FlightDescriptor.decode(reader, reader.uint32());
1090
+ continue;
1091
+ case 3:
1092
+ if (tag !== 26) break;
1093
+ message.endpoint.push(FlightEndpoint.decode(reader, reader.uint32()));
1094
+ continue;
1095
+ case 4:
1096
+ if (tag !== 32) break;
1097
+ message.totalRecords = reader.int64();
1098
+ continue;
1099
+ case 5:
1100
+ if (tag !== 40) break;
1101
+ message.totalBytes = reader.int64();
1102
+ continue;
1103
+ case 6:
1104
+ if (tag !== 48) break;
1105
+ message.ordered = reader.bool();
1106
+ continue;
1107
+ case 7:
1108
+ if (tag !== 58) break;
1109
+ message.appMetadata = reader.bytes();
1110
+ continue;
1111
+ }
1112
+ if ((tag & 7) === 4 || tag === 0) break;
1113
+ reader.skip(tag & 7);
1114
+ }
1115
+ return message;
1116
+ },
1117
+ fromJSON(object) {
1118
+ return {
1119
+ $type: FlightInfo.$type,
1120
+ schema: isSet$2(object.schema) ? bytesFromBase64$2(object.schema) : new Uint8Array(0),
1121
+ flightDescriptor: isSet$2(object.flightDescriptor) ? FlightDescriptor.fromJSON(object.flightDescriptor) : void 0,
1122
+ endpoint: globalThis.Array.isArray(object?.endpoint) ? object.endpoint.map((e) => FlightEndpoint.fromJSON(e)) : [],
1123
+ totalRecords: isSet$2(object.totalRecords) ? BigInt(object.totalRecords) : 0n,
1124
+ totalBytes: isSet$2(object.totalBytes) ? BigInt(object.totalBytes) : 0n,
1125
+ ordered: isSet$2(object.ordered) ? globalThis.Boolean(object.ordered) : false,
1126
+ appMetadata: isSet$2(object.appMetadata) ? bytesFromBase64$2(object.appMetadata) : new Uint8Array(0)
1127
+ };
1128
+ },
1129
+ toJSON(message) {
1130
+ const obj = {};
1131
+ if (message.schema.length !== 0) obj.schema = base64FromBytes$2(message.schema);
1132
+ if (message.flightDescriptor !== void 0) obj.flightDescriptor = FlightDescriptor.toJSON(message.flightDescriptor);
1133
+ if (message.endpoint?.length) obj.endpoint = message.endpoint.map((e) => FlightEndpoint.toJSON(e));
1134
+ if (message.totalRecords !== 0n) obj.totalRecords = message.totalRecords.toString();
1135
+ if (message.totalBytes !== 0n) obj.totalBytes = message.totalBytes.toString();
1136
+ if (message.ordered !== false) obj.ordered = message.ordered;
1137
+ if (message.appMetadata.length !== 0) obj.appMetadata = base64FromBytes$2(message.appMetadata);
1138
+ return obj;
1139
+ },
1140
+ create(base) {
1141
+ return FlightInfo.fromPartial(base ?? {});
1142
+ },
1143
+ fromPartial(object) {
1144
+ const message = createBaseFlightInfo();
1145
+ message.schema = object.schema ?? new Uint8Array(0);
1146
+ message.flightDescriptor = object.flightDescriptor !== void 0 && object.flightDescriptor !== null ? FlightDescriptor.fromPartial(object.flightDescriptor) : void 0;
1147
+ message.endpoint = object.endpoint?.map((e) => FlightEndpoint.fromPartial(e)) || [];
1148
+ message.totalRecords = object.totalRecords ?? 0n;
1149
+ message.totalBytes = object.totalBytes ?? 0n;
1150
+ message.ordered = object.ordered ?? false;
1151
+ message.appMetadata = object.appMetadata ?? new Uint8Array(0);
1152
+ return message;
1153
+ }
1154
+ };
1155
+ messageTypeRegistry.set(FlightInfo.$type, FlightInfo);
1156
+ function createBasePollInfo() {
1157
+ return {
1158
+ $type: "arrow.flight.protocol.PollInfo",
1159
+ info: void 0,
1160
+ flightDescriptor: void 0,
1161
+ progress: void 0,
1162
+ expirationTime: void 0
1163
+ };
1164
+ }
1165
+ const PollInfo = {
1166
+ $type: "arrow.flight.protocol.PollInfo",
1167
+ encode(message, writer = new BinaryWriter()) {
1168
+ if (message.info !== void 0) FlightInfo.encode(message.info, writer.uint32(10).fork()).join();
1169
+ if (message.flightDescriptor !== void 0) FlightDescriptor.encode(message.flightDescriptor, writer.uint32(18).fork()).join();
1170
+ if (message.progress !== void 0) writer.uint32(25).double(message.progress);
1171
+ if (message.expirationTime !== void 0) Timestamp.encode(toTimestamp(message.expirationTime), writer.uint32(34).fork()).join();
1172
+ return writer;
1173
+ },
1174
+ decode(input, length) {
1175
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
1176
+ let end = length === void 0 ? reader.len : reader.pos + length;
1177
+ const message = createBasePollInfo();
1178
+ while (reader.pos < end) {
1179
+ const tag = reader.uint32();
1180
+ switch (tag >>> 3) {
1181
+ case 1:
1182
+ if (tag !== 10) break;
1183
+ message.info = FlightInfo.decode(reader, reader.uint32());
1184
+ continue;
1185
+ case 2:
1186
+ if (tag !== 18) break;
1187
+ message.flightDescriptor = FlightDescriptor.decode(reader, reader.uint32());
1188
+ continue;
1189
+ case 3:
1190
+ if (tag !== 25) break;
1191
+ message.progress = reader.double();
1192
+ continue;
1193
+ case 4:
1194
+ if (tag !== 34) break;
1195
+ message.expirationTime = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
1196
+ continue;
1197
+ }
1198
+ if ((tag & 7) === 4 || tag === 0) break;
1199
+ reader.skip(tag & 7);
1200
+ }
1201
+ return message;
1202
+ },
1203
+ fromJSON(object) {
1204
+ return {
1205
+ $type: PollInfo.$type,
1206
+ info: isSet$2(object.info) ? FlightInfo.fromJSON(object.info) : void 0,
1207
+ flightDescriptor: isSet$2(object.flightDescriptor) ? FlightDescriptor.fromJSON(object.flightDescriptor) : void 0,
1208
+ progress: isSet$2(object.progress) ? globalThis.Number(object.progress) : void 0,
1209
+ expirationTime: isSet$2(object.expirationTime) ? fromJsonTimestamp(object.expirationTime) : void 0
1210
+ };
1211
+ },
1212
+ toJSON(message) {
1213
+ const obj = {};
1214
+ if (message.info !== void 0) obj.info = FlightInfo.toJSON(message.info);
1215
+ if (message.flightDescriptor !== void 0) obj.flightDescriptor = FlightDescriptor.toJSON(message.flightDescriptor);
1216
+ if (message.progress !== void 0) obj.progress = message.progress;
1217
+ if (message.expirationTime !== void 0) obj.expirationTime = message.expirationTime.toISOString();
1218
+ return obj;
1219
+ },
1220
+ create(base) {
1221
+ return PollInfo.fromPartial(base ?? {});
1222
+ },
1223
+ fromPartial(object) {
1224
+ const message = createBasePollInfo();
1225
+ message.info = object.info !== void 0 && object.info !== null ? FlightInfo.fromPartial(object.info) : void 0;
1226
+ message.flightDescriptor = object.flightDescriptor !== void 0 && object.flightDescriptor !== null ? FlightDescriptor.fromPartial(object.flightDescriptor) : void 0;
1227
+ message.progress = object.progress ?? void 0;
1228
+ message.expirationTime = object.expirationTime ?? void 0;
1229
+ return message;
1230
+ }
1231
+ };
1232
+ messageTypeRegistry.set(PollInfo.$type, PollInfo);
1233
+ function createBaseFlightEndpoint() {
1234
+ return {
1235
+ $type: "arrow.flight.protocol.FlightEndpoint",
1236
+ ticket: void 0,
1237
+ location: [],
1238
+ expirationTime: void 0,
1239
+ appMetadata: new Uint8Array(0)
1240
+ };
1241
+ }
1242
+ const FlightEndpoint = {
1243
+ $type: "arrow.flight.protocol.FlightEndpoint",
1244
+ encode(message, writer = new BinaryWriter()) {
1245
+ if (message.ticket !== void 0) Ticket.encode(message.ticket, writer.uint32(10).fork()).join();
1246
+ for (const v of message.location) Location.encode(v, writer.uint32(18).fork()).join();
1247
+ if (message.expirationTime !== void 0) Timestamp.encode(toTimestamp(message.expirationTime), writer.uint32(26).fork()).join();
1248
+ if (message.appMetadata.length !== 0) writer.uint32(34).bytes(message.appMetadata);
1249
+ return writer;
1250
+ },
1251
+ decode(input, length) {
1252
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
1253
+ let end = length === void 0 ? reader.len : reader.pos + length;
1254
+ const message = createBaseFlightEndpoint();
1255
+ while (reader.pos < end) {
1256
+ const tag = reader.uint32();
1257
+ switch (tag >>> 3) {
1258
+ case 1:
1259
+ if (tag !== 10) break;
1260
+ message.ticket = Ticket.decode(reader, reader.uint32());
1261
+ continue;
1262
+ case 2:
1263
+ if (tag !== 18) break;
1264
+ message.location.push(Location.decode(reader, reader.uint32()));
1265
+ continue;
1266
+ case 3:
1267
+ if (tag !== 26) break;
1268
+ message.expirationTime = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
1269
+ continue;
1270
+ case 4:
1271
+ if (tag !== 34) break;
1272
+ message.appMetadata = reader.bytes();
1273
+ continue;
1274
+ }
1275
+ if ((tag & 7) === 4 || tag === 0) break;
1276
+ reader.skip(tag & 7);
1277
+ }
1278
+ return message;
1279
+ },
1280
+ fromJSON(object) {
1281
+ return {
1282
+ $type: FlightEndpoint.$type,
1283
+ ticket: isSet$2(object.ticket) ? Ticket.fromJSON(object.ticket) : void 0,
1284
+ location: globalThis.Array.isArray(object?.location) ? object.location.map((e) => Location.fromJSON(e)) : [],
1285
+ expirationTime: isSet$2(object.expirationTime) ? fromJsonTimestamp(object.expirationTime) : void 0,
1286
+ appMetadata: isSet$2(object.appMetadata) ? bytesFromBase64$2(object.appMetadata) : new Uint8Array(0)
1287
+ };
1288
+ },
1289
+ toJSON(message) {
1290
+ const obj = {};
1291
+ if (message.ticket !== void 0) obj.ticket = Ticket.toJSON(message.ticket);
1292
+ if (message.location?.length) obj.location = message.location.map((e) => Location.toJSON(e));
1293
+ if (message.expirationTime !== void 0) obj.expirationTime = message.expirationTime.toISOString();
1294
+ if (message.appMetadata.length !== 0) obj.appMetadata = base64FromBytes$2(message.appMetadata);
1295
+ return obj;
1296
+ },
1297
+ create(base) {
1298
+ return FlightEndpoint.fromPartial(base ?? {});
1299
+ },
1300
+ fromPartial(object) {
1301
+ const message = createBaseFlightEndpoint();
1302
+ message.ticket = object.ticket !== void 0 && object.ticket !== null ? Ticket.fromPartial(object.ticket) : void 0;
1303
+ message.location = object.location?.map((e) => Location.fromPartial(e)) || [];
1304
+ message.expirationTime = object.expirationTime ?? void 0;
1305
+ message.appMetadata = object.appMetadata ?? new Uint8Array(0);
1306
+ return message;
1307
+ }
1308
+ };
1309
+ messageTypeRegistry.set(FlightEndpoint.$type, FlightEndpoint);
1310
+ function createBaseLocation() {
1311
+ return {
1312
+ $type: "arrow.flight.protocol.Location",
1313
+ uri: ""
1314
+ };
1315
+ }
1316
+ const Location = {
1317
+ $type: "arrow.flight.protocol.Location",
1318
+ encode(message, writer = new BinaryWriter()) {
1319
+ if (message.uri !== "") writer.uint32(10).string(message.uri);
1320
+ return writer;
1321
+ },
1322
+ decode(input, length) {
1323
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
1324
+ let end = length === void 0 ? reader.len : reader.pos + length;
1325
+ const message = createBaseLocation();
1326
+ while (reader.pos < end) {
1327
+ const tag = reader.uint32();
1328
+ switch (tag >>> 3) {
1329
+ case 1:
1330
+ if (tag !== 10) break;
1331
+ message.uri = reader.string();
1332
+ continue;
1333
+ }
1334
+ if ((tag & 7) === 4 || tag === 0) break;
1335
+ reader.skip(tag & 7);
1336
+ }
1337
+ return message;
1338
+ },
1339
+ fromJSON(object) {
1340
+ return {
1341
+ $type: Location.$type,
1342
+ uri: isSet$2(object.uri) ? globalThis.String(object.uri) : ""
1343
+ };
1344
+ },
1345
+ toJSON(message) {
1346
+ const obj = {};
1347
+ if (message.uri !== "") obj.uri = message.uri;
1348
+ return obj;
1349
+ },
1350
+ create(base) {
1351
+ return Location.fromPartial(base ?? {});
1352
+ },
1353
+ fromPartial(object) {
1354
+ const message = createBaseLocation();
1355
+ message.uri = object.uri ?? "";
1356
+ return message;
1357
+ }
1358
+ };
1359
+ messageTypeRegistry.set(Location.$type, Location);
1360
+ function createBaseTicket() {
1361
+ return {
1362
+ $type: "arrow.flight.protocol.Ticket",
1363
+ ticket: new Uint8Array(0)
1364
+ };
1365
+ }
1366
+ const Ticket = {
1367
+ $type: "arrow.flight.protocol.Ticket",
1368
+ encode(message, writer = new BinaryWriter()) {
1369
+ if (message.ticket.length !== 0) writer.uint32(10).bytes(message.ticket);
1370
+ return writer;
1371
+ },
1372
+ decode(input, length) {
1373
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
1374
+ let end = length === void 0 ? reader.len : reader.pos + length;
1375
+ const message = createBaseTicket();
1376
+ while (reader.pos < end) {
1377
+ const tag = reader.uint32();
1378
+ switch (tag >>> 3) {
1379
+ case 1:
1380
+ if (tag !== 10) break;
1381
+ message.ticket = reader.bytes();
1382
+ continue;
1383
+ }
1384
+ if ((tag & 7) === 4 || tag === 0) break;
1385
+ reader.skip(tag & 7);
1386
+ }
1387
+ return message;
1388
+ },
1389
+ fromJSON(object) {
1390
+ return {
1391
+ $type: Ticket.$type,
1392
+ ticket: isSet$2(object.ticket) ? bytesFromBase64$2(object.ticket) : new Uint8Array(0)
1393
+ };
1394
+ },
1395
+ toJSON(message) {
1396
+ const obj = {};
1397
+ if (message.ticket.length !== 0) obj.ticket = base64FromBytes$2(message.ticket);
1398
+ return obj;
1399
+ },
1400
+ create(base) {
1401
+ return Ticket.fromPartial(base ?? {});
1402
+ },
1403
+ fromPartial(object) {
1404
+ const message = createBaseTicket();
1405
+ message.ticket = object.ticket ?? new Uint8Array(0);
1406
+ return message;
1407
+ }
1408
+ };
1409
+ messageTypeRegistry.set(Ticket.$type, Ticket);
1410
+ function createBaseFlightData() {
1411
+ return {
1412
+ $type: "arrow.flight.protocol.FlightData",
1413
+ flightDescriptor: void 0,
1414
+ dataHeader: new Uint8Array(0),
1415
+ appMetadata: new Uint8Array(0),
1416
+ dataBody: new Uint8Array(0)
1417
+ };
1418
+ }
1419
+ const FlightData = {
1420
+ $type: "arrow.flight.protocol.FlightData",
1421
+ encode(message, writer = new BinaryWriter()) {
1422
+ if (message.flightDescriptor !== void 0) FlightDescriptor.encode(message.flightDescriptor, writer.uint32(10).fork()).join();
1423
+ if (message.dataHeader.length !== 0) writer.uint32(18).bytes(message.dataHeader);
1424
+ if (message.appMetadata.length !== 0) writer.uint32(26).bytes(message.appMetadata);
1425
+ if (message.dataBody.length !== 0) writer.uint32(8002).bytes(message.dataBody);
1426
+ return writer;
1427
+ },
1428
+ decode(input, length) {
1429
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
1430
+ let end = length === void 0 ? reader.len : reader.pos + length;
1431
+ const message = createBaseFlightData();
1432
+ while (reader.pos < end) {
1433
+ const tag = reader.uint32();
1434
+ switch (tag >>> 3) {
1435
+ case 1:
1436
+ if (tag !== 10) break;
1437
+ message.flightDescriptor = FlightDescriptor.decode(reader, reader.uint32());
1438
+ continue;
1439
+ case 2:
1440
+ if (tag !== 18) break;
1441
+ message.dataHeader = reader.bytes();
1442
+ continue;
1443
+ case 3:
1444
+ if (tag !== 26) break;
1445
+ message.appMetadata = reader.bytes();
1446
+ continue;
1447
+ case 1e3:
1448
+ if (tag !== 8002) break;
1449
+ message.dataBody = reader.bytes();
1450
+ continue;
1451
+ }
1452
+ if ((tag & 7) === 4 || tag === 0) break;
1453
+ reader.skip(tag & 7);
1454
+ }
1455
+ return message;
1456
+ },
1457
+ fromJSON(object) {
1458
+ return {
1459
+ $type: FlightData.$type,
1460
+ flightDescriptor: isSet$2(object.flightDescriptor) ? FlightDescriptor.fromJSON(object.flightDescriptor) : void 0,
1461
+ dataHeader: isSet$2(object.dataHeader) ? bytesFromBase64$2(object.dataHeader) : new Uint8Array(0),
1462
+ appMetadata: isSet$2(object.appMetadata) ? bytesFromBase64$2(object.appMetadata) : new Uint8Array(0),
1463
+ dataBody: isSet$2(object.dataBody) ? bytesFromBase64$2(object.dataBody) : new Uint8Array(0)
1464
+ };
1465
+ },
1466
+ toJSON(message) {
1467
+ const obj = {};
1468
+ if (message.flightDescriptor !== void 0) obj.flightDescriptor = FlightDescriptor.toJSON(message.flightDescriptor);
1469
+ if (message.dataHeader.length !== 0) obj.dataHeader = base64FromBytes$2(message.dataHeader);
1470
+ if (message.appMetadata.length !== 0) obj.appMetadata = base64FromBytes$2(message.appMetadata);
1471
+ if (message.dataBody.length !== 0) obj.dataBody = base64FromBytes$2(message.dataBody);
1472
+ return obj;
1473
+ },
1474
+ create(base) {
1475
+ return FlightData.fromPartial(base ?? {});
1476
+ },
1477
+ fromPartial(object) {
1478
+ const message = createBaseFlightData();
1479
+ message.flightDescriptor = object.flightDescriptor !== void 0 && object.flightDescriptor !== null ? FlightDescriptor.fromPartial(object.flightDescriptor) : void 0;
1480
+ message.dataHeader = object.dataHeader ?? new Uint8Array(0);
1481
+ message.appMetadata = object.appMetadata ?? new Uint8Array(0);
1482
+ message.dataBody = object.dataBody ?? new Uint8Array(0);
1483
+ return message;
1484
+ }
1485
+ };
1486
+ messageTypeRegistry.set(FlightData.$type, FlightData);
1487
+ function createBasePutResult() {
1488
+ return {
1489
+ $type: "arrow.flight.protocol.PutResult",
1490
+ appMetadata: new Uint8Array(0)
1491
+ };
1492
+ }
1493
+ const PutResult = {
1494
+ $type: "arrow.flight.protocol.PutResult",
1495
+ encode(message, writer = new BinaryWriter()) {
1496
+ if (message.appMetadata.length !== 0) writer.uint32(10).bytes(message.appMetadata);
1497
+ return writer;
1498
+ },
1499
+ decode(input, length) {
1500
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
1501
+ let end = length === void 0 ? reader.len : reader.pos + length;
1502
+ const message = createBasePutResult();
1503
+ while (reader.pos < end) {
1504
+ const tag = reader.uint32();
1505
+ switch (tag >>> 3) {
1506
+ case 1:
1507
+ if (tag !== 10) break;
1508
+ message.appMetadata = reader.bytes();
1509
+ continue;
1510
+ }
1511
+ if ((tag & 7) === 4 || tag === 0) break;
1512
+ reader.skip(tag & 7);
1513
+ }
1514
+ return message;
1515
+ },
1516
+ fromJSON(object) {
1517
+ return {
1518
+ $type: PutResult.$type,
1519
+ appMetadata: isSet$2(object.appMetadata) ? bytesFromBase64$2(object.appMetadata) : new Uint8Array(0)
1520
+ };
1521
+ },
1522
+ toJSON(message) {
1523
+ const obj = {};
1524
+ if (message.appMetadata.length !== 0) obj.appMetadata = base64FromBytes$2(message.appMetadata);
1525
+ return obj;
1526
+ },
1527
+ create(base) {
1528
+ return PutResult.fromPartial(base ?? {});
1529
+ },
1530
+ fromPartial(object) {
1531
+ const message = createBasePutResult();
1532
+ message.appMetadata = object.appMetadata ?? new Uint8Array(0);
1533
+ return message;
1534
+ }
1535
+ };
1536
+ messageTypeRegistry.set(PutResult.$type, PutResult);
1537
+ const FlightServiceDefinition = {
1538
+ name: "FlightService",
1539
+ fullName: "arrow.flight.protocol.FlightService",
1540
+ methods: {
1541
+ handshake: {
1542
+ name: "Handshake",
1543
+ requestType: HandshakeRequest,
1544
+ requestStream: true,
1545
+ responseType: HandshakeResponse,
1546
+ responseStream: true,
1547
+ options: {}
1548
+ },
1549
+ listFlights: {
1550
+ name: "ListFlights",
1551
+ requestType: Criteria,
1552
+ requestStream: false,
1553
+ responseType: FlightInfo,
1554
+ responseStream: true,
1555
+ options: {}
1556
+ },
1557
+ getFlightInfo: {
1558
+ name: "GetFlightInfo",
1559
+ requestType: FlightDescriptor,
1560
+ requestStream: false,
1561
+ responseType: FlightInfo,
1562
+ responseStream: false,
1563
+ options: {}
1564
+ },
1565
+ pollFlightInfo: {
1566
+ name: "PollFlightInfo",
1567
+ requestType: FlightDescriptor,
1568
+ requestStream: false,
1569
+ responseType: PollInfo,
1570
+ responseStream: false,
1571
+ options: {}
1572
+ },
1573
+ getSchema: {
1574
+ name: "GetSchema",
1575
+ requestType: FlightDescriptor,
1576
+ requestStream: false,
1577
+ responseType: SchemaResult,
1578
+ responseStream: false,
1579
+ options: {}
1580
+ },
1581
+ doGet: {
1582
+ name: "DoGet",
1583
+ requestType: Ticket,
1584
+ requestStream: false,
1585
+ responseType: FlightData,
1586
+ responseStream: true,
1587
+ options: {}
1588
+ },
1589
+ doPut: {
1590
+ name: "DoPut",
1591
+ requestType: FlightData,
1592
+ requestStream: true,
1593
+ responseType: PutResult,
1594
+ responseStream: true,
1595
+ options: {}
1596
+ },
1597
+ doExchange: {
1598
+ name: "DoExchange",
1599
+ requestType: FlightData,
1600
+ requestStream: true,
1601
+ responseType: FlightData,
1602
+ responseStream: true,
1603
+ options: {}
1604
+ },
1605
+ doAction: {
1606
+ name: "DoAction",
1607
+ requestType: Action,
1608
+ requestStream: false,
1609
+ responseType: Result,
1610
+ responseStream: true,
1611
+ options: {}
1612
+ },
1613
+ listActions: {
1614
+ name: "ListActions",
1615
+ requestType: Empty,
1616
+ requestStream: false,
1617
+ responseType: ActionType,
1618
+ responseStream: true,
1619
+ options: {}
1620
+ }
1621
+ }
1622
+ };
1623
+ function bytesFromBase64$2(b64) {
1624
+ if (globalThis.Buffer) return Uint8Array.from(globalThis.Buffer.from(b64, "base64"));
1625
+ else {
1626
+ const bin = globalThis.atob(b64);
1627
+ const arr = new Uint8Array(bin.length);
1628
+ for (let i = 0; i < bin.length; ++i) arr[i] = bin.charCodeAt(i);
1629
+ return arr;
1630
+ }
1631
+ }
1632
+ function base64FromBytes$2(arr) {
1633
+ if (globalThis.Buffer) return globalThis.Buffer.from(arr).toString("base64");
1634
+ else {
1635
+ const bin = [];
1636
+ arr.forEach((byte) => {
1637
+ bin.push(globalThis.String.fromCharCode(byte));
1638
+ });
1639
+ return globalThis.btoa(bin.join(""));
1640
+ }
1641
+ }
1642
+ function toTimestamp(date) {
1643
+ return {
1644
+ $type: "google.protobuf.Timestamp",
1645
+ seconds: BigInt(Math.trunc(date.getTime() / 1e3)),
1646
+ nanos: date.getTime() % 1e3 * 1e6
1647
+ };
1648
+ }
1649
+ function fromTimestamp(t) {
1650
+ let millis = (globalThis.Number(t.seconds.toString()) || 0) * 1e3;
1651
+ millis += (t.nanos || 0) / 1e6;
1652
+ return new globalThis.Date(millis);
1653
+ }
1654
+ function fromJsonTimestamp(o) {
1655
+ if (o instanceof globalThis.Date) return o;
1656
+ else if (typeof o === "string") return new globalThis.Date(o);
1657
+ else return fromTimestamp(Timestamp.fromJSON(o));
1658
+ }
1659
+ function isSet$2(value) {
1660
+ return value !== null && value !== void 0;
1661
+ }
1662
+
1663
+ //#endregion
1664
+ //#region src/proto-utils.ts
1665
+ function createChannelFromConfig(config) {
1666
+ if (config.host !== void 0) return createChannel(config.host, config.credentials, config.channelOptions);
1667
+ return config.channel;
1668
+ }
1669
+
1670
+ //#endregion
1671
+ //#region src/arrow-flight.ts
1672
+ var ArrowFlightClient = class {
1673
+ client;
1674
+ constructor(config, options = {}) {
1675
+ this.client = createClient(FlightServiceDefinition, createChannelFromConfig(config), options.defaultCallOptions);
1676
+ }
1677
+ executeFlightInfo(info, options) {
1678
+ const schema = decodeSchemaFromFlightInfo(info);
1679
+ if (!schema) throw new Error("FlightInfo must have a schema");
1680
+ const client = this;
1681
+ return (async function* () {
1682
+ for (const endpoint of info.endpoint) {
1683
+ if (endpoint.ticket === void 0) continue;
1684
+ yield* client.doGet(endpoint.ticket, {
1685
+ schema,
1686
+ ...options
1687
+ });
1688
+ }
1689
+ })();
1690
+ }
1691
+ /**
1692
+ * Handshake between client and server.
1693
+ *
1694
+ * Depending on the server, the handshake may be required to determine the
1695
+ * token that should be used for future operations. Both request and response
1696
+ * are streams to allow multiple round-trips depending on auth mechanism.
1697
+ */
1698
+ handshake(request, options) {
1699
+ return this.client.handshake(request, options);
1700
+ }
1701
+ /** Get a list of available streams given a particular criteria. */
1702
+ getFlightInfo(request, options) {
1703
+ return this.client.getFlightInfo(request, options);
1704
+ }
1705
+ /**
1706
+ * Retrieve a single stream associated with a particular descriptor
1707
+ * associated with the referenced ticket. A Flight can be composed of one or
1708
+ * more streams where each stream can be retrieved using a separate opaque
1709
+ * ticket that the flight service uses for managing a collection of streams.
1710
+ */
1711
+ doGet(request, options) {
1712
+ const { schema: expectedSchema } = options;
1713
+ return decodeFlightDataStream(this.client.doGet(request, options), { expectedSchema });
1714
+ }
1715
+ /**
1716
+ * Push a stream to the flight service associated with a particular
1717
+ * flight stream. This allows a client of a flight service to upload a stream
1718
+ * of data. Depending on the particular flight service, a client consumer
1719
+ * could be allowed to upload a single stream per descriptor or an unlimited
1720
+ * number. In the latter, the service might implement a 'seal' action that
1721
+ * can be applied to a descriptor once all streams are uploaded.
1722
+ */
1723
+ doPut(request, options) {
1724
+ return this.client.doPut(request, options);
1725
+ }
1726
+ };
1727
+
1728
+ //#endregion
1729
+ //#region src/proto/any.ts
1730
+ function createBaseAny() {
1731
+ return {
1732
+ $type: "google.protobuf.Any",
1733
+ typeUrl: "",
1734
+ value: new Uint8Array(0)
1735
+ };
1736
+ }
1737
+ const Any = {
1738
+ $type: "google.protobuf.Any",
1739
+ encode(message, writer = new BinaryWriter()) {
1740
+ if (message.typeUrl !== "") writer.uint32(10).string(message.typeUrl);
1741
+ if (message.value.length !== 0) writer.uint32(18).bytes(message.value);
1742
+ return writer;
1743
+ },
1744
+ decode(input, length) {
1745
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
1746
+ let end = length === void 0 ? reader.len : reader.pos + length;
1747
+ const message = createBaseAny();
1748
+ while (reader.pos < end) {
1749
+ const tag = reader.uint32();
1750
+ switch (tag >>> 3) {
1751
+ case 1:
1752
+ if (tag !== 10) break;
1753
+ message.typeUrl = reader.string();
1754
+ continue;
1755
+ case 2:
1756
+ if (tag !== 18) break;
1757
+ message.value = reader.bytes();
1758
+ continue;
1759
+ }
1760
+ if ((tag & 7) === 4 || tag === 0) break;
1761
+ reader.skip(tag & 7);
1762
+ }
1763
+ return message;
1764
+ },
1765
+ fromJSON(object) {
1766
+ return {
1767
+ $type: Any.$type,
1768
+ typeUrl: isSet$1(object.typeUrl) ? globalThis.String(object.typeUrl) : "",
1769
+ value: isSet$1(object.value) ? bytesFromBase64$1(object.value) : new Uint8Array(0)
1770
+ };
1771
+ },
1772
+ toJSON(message) {
1773
+ const obj = {};
1774
+ if (message.typeUrl !== "") obj.typeUrl = message.typeUrl;
1775
+ if (message.value.length !== 0) obj.value = base64FromBytes$1(message.value);
1776
+ return obj;
1777
+ },
1778
+ create(base) {
1779
+ return Any.fromPartial(base ?? {});
1780
+ },
1781
+ fromPartial(object) {
1782
+ const message = createBaseAny();
1783
+ message.typeUrl = object.typeUrl ?? "";
1784
+ message.value = object.value ?? new Uint8Array(0);
1785
+ return message;
1786
+ }
1787
+ };
1788
+ messageTypeRegistry.set(Any.$type, Any);
1789
+ function bytesFromBase64$1(b64) {
1790
+ if (globalThis.Buffer) return Uint8Array.from(globalThis.Buffer.from(b64, "base64"));
1791
+ else {
1792
+ const bin = globalThis.atob(b64);
1793
+ const arr = new Uint8Array(bin.length);
1794
+ for (let i = 0; i < bin.length; ++i) arr[i] = bin.charCodeAt(i);
1795
+ return arr;
1796
+ }
1797
+ }
1798
+ function base64FromBytes$1(arr) {
1799
+ if (globalThis.Buffer) return globalThis.Buffer.from(arr).toString("base64");
1800
+ else {
1801
+ const bin = [];
1802
+ arr.forEach((byte) => {
1803
+ bin.push(globalThis.String.fromCharCode(byte));
1804
+ });
1805
+ return globalThis.btoa(bin.join(""));
1806
+ }
1807
+ }
1808
+ function isSet$1(value) {
1809
+ return value !== null && value !== void 0;
1810
+ }
1811
+
1812
+ //#endregion
1813
+ //#region src/proto/FlightSql.ts
1814
+ let ActionEndTransactionRequest_EndTransaction = /* @__PURE__ */ function(ActionEndTransactionRequest_EndTransaction$1) {
1815
+ ActionEndTransactionRequest_EndTransaction$1[ActionEndTransactionRequest_EndTransaction$1["UNSPECIFIED"] = 0] = "UNSPECIFIED";
1816
+ /** COMMIT - Commit the transaction. */
1817
+ ActionEndTransactionRequest_EndTransaction$1[ActionEndTransactionRequest_EndTransaction$1["COMMIT"] = 1] = "COMMIT";
1818
+ /** ROLLBACK - Roll back the transaction. */
1819
+ ActionEndTransactionRequest_EndTransaction$1[ActionEndTransactionRequest_EndTransaction$1["ROLLBACK"] = 2] = "ROLLBACK";
1820
+ ActionEndTransactionRequest_EndTransaction$1[ActionEndTransactionRequest_EndTransaction$1["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
1821
+ return ActionEndTransactionRequest_EndTransaction$1;
1822
+ }({});
1823
+ function actionEndTransactionRequest_EndTransactionFromJSON(object) {
1824
+ switch (object) {
1825
+ case 0:
1826
+ case "END_TRANSACTION_UNSPECIFIED": return ActionEndTransactionRequest_EndTransaction.UNSPECIFIED;
1827
+ case 1:
1828
+ case "END_TRANSACTION_COMMIT": return ActionEndTransactionRequest_EndTransaction.COMMIT;
1829
+ case 2:
1830
+ case "END_TRANSACTION_ROLLBACK": return ActionEndTransactionRequest_EndTransaction.ROLLBACK;
1831
+ case -1:
1832
+ case "UNRECOGNIZED":
1833
+ default: return ActionEndTransactionRequest_EndTransaction.UNRECOGNIZED;
1834
+ }
1835
+ }
1836
+ function actionEndTransactionRequest_EndTransactionToJSON(object) {
1837
+ switch (object) {
1838
+ case ActionEndTransactionRequest_EndTransaction.UNSPECIFIED: return "END_TRANSACTION_UNSPECIFIED";
1839
+ case ActionEndTransactionRequest_EndTransaction.COMMIT: return "END_TRANSACTION_COMMIT";
1840
+ case ActionEndTransactionRequest_EndTransaction.ROLLBACK: return "END_TRANSACTION_ROLLBACK";
1841
+ case ActionEndTransactionRequest_EndTransaction.UNRECOGNIZED:
1842
+ default: return "UNRECOGNIZED";
1843
+ }
1844
+ }
1845
+ let ActionEndSavepointRequest_EndSavepoint = /* @__PURE__ */ function(ActionEndSavepointRequest_EndSavepoint$1) {
1846
+ ActionEndSavepointRequest_EndSavepoint$1[ActionEndSavepointRequest_EndSavepoint$1["UNSPECIFIED"] = 0] = "UNSPECIFIED";
1847
+ /** RELEASE - Release the savepoint. */
1848
+ ActionEndSavepointRequest_EndSavepoint$1[ActionEndSavepointRequest_EndSavepoint$1["RELEASE"] = 1] = "RELEASE";
1849
+ /** ROLLBACK - Roll back to a savepoint. */
1850
+ ActionEndSavepointRequest_EndSavepoint$1[ActionEndSavepointRequest_EndSavepoint$1["ROLLBACK"] = 2] = "ROLLBACK";
1851
+ ActionEndSavepointRequest_EndSavepoint$1[ActionEndSavepointRequest_EndSavepoint$1["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
1852
+ return ActionEndSavepointRequest_EndSavepoint$1;
1853
+ }({});
1854
+ function actionEndSavepointRequest_EndSavepointFromJSON(object) {
1855
+ switch (object) {
1856
+ case 0:
1857
+ case "END_SAVEPOINT_UNSPECIFIED": return ActionEndSavepointRequest_EndSavepoint.UNSPECIFIED;
1858
+ case 1:
1859
+ case "END_SAVEPOINT_RELEASE": return ActionEndSavepointRequest_EndSavepoint.RELEASE;
1860
+ case 2:
1861
+ case "END_SAVEPOINT_ROLLBACK": return ActionEndSavepointRequest_EndSavepoint.ROLLBACK;
1862
+ case -1:
1863
+ case "UNRECOGNIZED":
1864
+ default: return ActionEndSavepointRequest_EndSavepoint.UNRECOGNIZED;
1865
+ }
1866
+ }
1867
+ function actionEndSavepointRequest_EndSavepointToJSON(object) {
1868
+ switch (object) {
1869
+ case ActionEndSavepointRequest_EndSavepoint.UNSPECIFIED: return "END_SAVEPOINT_UNSPECIFIED";
1870
+ case ActionEndSavepointRequest_EndSavepoint.RELEASE: return "END_SAVEPOINT_RELEASE";
1871
+ case ActionEndSavepointRequest_EndSavepoint.ROLLBACK: return "END_SAVEPOINT_ROLLBACK";
1872
+ case ActionEndSavepointRequest_EndSavepoint.UNRECOGNIZED:
1873
+ default: return "UNRECOGNIZED";
1874
+ }
1875
+ }
1876
+ /** The action to take if the target table does not exist */
1877
+ let CommandStatementIngest_TableDefinitionOptions_TableNotExistOption = /* @__PURE__ */ function(CommandStatementIngest_TableDefinitionOptions_TableNotExistOption$1) {
1878
+ /** UNSPECIFIED - Do not use. Servers should error if this is specified by a client. */
1879
+ CommandStatementIngest_TableDefinitionOptions_TableNotExistOption$1[CommandStatementIngest_TableDefinitionOptions_TableNotExistOption$1["UNSPECIFIED"] = 0] = "UNSPECIFIED";
1880
+ /** CREATE - Create the table if it does not exist */
1881
+ CommandStatementIngest_TableDefinitionOptions_TableNotExistOption$1[CommandStatementIngest_TableDefinitionOptions_TableNotExistOption$1["CREATE"] = 1] = "CREATE";
1882
+ /** FAIL - Fail if the table does not exist */
1883
+ CommandStatementIngest_TableDefinitionOptions_TableNotExistOption$1[CommandStatementIngest_TableDefinitionOptions_TableNotExistOption$1["FAIL"] = 2] = "FAIL";
1884
+ CommandStatementIngest_TableDefinitionOptions_TableNotExistOption$1[CommandStatementIngest_TableDefinitionOptions_TableNotExistOption$1["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
1885
+ return CommandStatementIngest_TableDefinitionOptions_TableNotExistOption$1;
1886
+ }({});
1887
+ function commandStatementIngest_TableDefinitionOptions_TableNotExistOptionFromJSON(object) {
1888
+ switch (object) {
1889
+ case 0:
1890
+ case "TABLE_NOT_EXIST_OPTION_UNSPECIFIED": return CommandStatementIngest_TableDefinitionOptions_TableNotExistOption.UNSPECIFIED;
1891
+ case 1:
1892
+ case "TABLE_NOT_EXIST_OPTION_CREATE": return CommandStatementIngest_TableDefinitionOptions_TableNotExistOption.CREATE;
1893
+ case 2:
1894
+ case "TABLE_NOT_EXIST_OPTION_FAIL": return CommandStatementIngest_TableDefinitionOptions_TableNotExistOption.FAIL;
1895
+ case -1:
1896
+ case "UNRECOGNIZED":
1897
+ default: return CommandStatementIngest_TableDefinitionOptions_TableNotExistOption.UNRECOGNIZED;
1898
+ }
1899
+ }
1900
+ function commandStatementIngest_TableDefinitionOptions_TableNotExistOptionToJSON(object) {
1901
+ switch (object) {
1902
+ case CommandStatementIngest_TableDefinitionOptions_TableNotExistOption.UNSPECIFIED: return "TABLE_NOT_EXIST_OPTION_UNSPECIFIED";
1903
+ case CommandStatementIngest_TableDefinitionOptions_TableNotExistOption.CREATE: return "TABLE_NOT_EXIST_OPTION_CREATE";
1904
+ case CommandStatementIngest_TableDefinitionOptions_TableNotExistOption.FAIL: return "TABLE_NOT_EXIST_OPTION_FAIL";
1905
+ case CommandStatementIngest_TableDefinitionOptions_TableNotExistOption.UNRECOGNIZED:
1906
+ default: return "UNRECOGNIZED";
1907
+ }
1908
+ }
1909
+ /** The action to take if the target table already exists */
1910
+ let CommandStatementIngest_TableDefinitionOptions_TableExistsOption = /* @__PURE__ */ function(CommandStatementIngest_TableDefinitionOptions_TableExistsOption$1) {
1911
+ /** UNSPECIFIED - Do not use. Servers should error if this is specified by a client. */
1912
+ CommandStatementIngest_TableDefinitionOptions_TableExistsOption$1[CommandStatementIngest_TableDefinitionOptions_TableExistsOption$1["UNSPECIFIED"] = 0] = "UNSPECIFIED";
1913
+ /** FAIL - Fail if the table already exists */
1914
+ CommandStatementIngest_TableDefinitionOptions_TableExistsOption$1[CommandStatementIngest_TableDefinitionOptions_TableExistsOption$1["FAIL"] = 1] = "FAIL";
1915
+ /** APPEND - Append to the table if it already exists */
1916
+ CommandStatementIngest_TableDefinitionOptions_TableExistsOption$1[CommandStatementIngest_TableDefinitionOptions_TableExistsOption$1["APPEND"] = 2] = "APPEND";
1917
+ /** REPLACE - Drop and recreate the table if it already exists */
1918
+ CommandStatementIngest_TableDefinitionOptions_TableExistsOption$1[CommandStatementIngest_TableDefinitionOptions_TableExistsOption$1["REPLACE"] = 3] = "REPLACE";
1919
+ CommandStatementIngest_TableDefinitionOptions_TableExistsOption$1[CommandStatementIngest_TableDefinitionOptions_TableExistsOption$1["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
1920
+ return CommandStatementIngest_TableDefinitionOptions_TableExistsOption$1;
1921
+ }({});
1922
+ function commandStatementIngest_TableDefinitionOptions_TableExistsOptionFromJSON(object) {
1923
+ switch (object) {
1924
+ case 0:
1925
+ case "TABLE_EXISTS_OPTION_UNSPECIFIED": return CommandStatementIngest_TableDefinitionOptions_TableExistsOption.UNSPECIFIED;
1926
+ case 1:
1927
+ case "TABLE_EXISTS_OPTION_FAIL": return CommandStatementIngest_TableDefinitionOptions_TableExistsOption.FAIL;
1928
+ case 2:
1929
+ case "TABLE_EXISTS_OPTION_APPEND": return CommandStatementIngest_TableDefinitionOptions_TableExistsOption.APPEND;
1930
+ case 3:
1931
+ case "TABLE_EXISTS_OPTION_REPLACE": return CommandStatementIngest_TableDefinitionOptions_TableExistsOption.REPLACE;
1932
+ case -1:
1933
+ case "UNRECOGNIZED":
1934
+ default: return CommandStatementIngest_TableDefinitionOptions_TableExistsOption.UNRECOGNIZED;
1935
+ }
1936
+ }
1937
+ function commandStatementIngest_TableDefinitionOptions_TableExistsOptionToJSON(object) {
1938
+ switch (object) {
1939
+ case CommandStatementIngest_TableDefinitionOptions_TableExistsOption.UNSPECIFIED: return "TABLE_EXISTS_OPTION_UNSPECIFIED";
1940
+ case CommandStatementIngest_TableDefinitionOptions_TableExistsOption.FAIL: return "TABLE_EXISTS_OPTION_FAIL";
1941
+ case CommandStatementIngest_TableDefinitionOptions_TableExistsOption.APPEND: return "TABLE_EXISTS_OPTION_APPEND";
1942
+ case CommandStatementIngest_TableDefinitionOptions_TableExistsOption.REPLACE: return "TABLE_EXISTS_OPTION_REPLACE";
1943
+ case CommandStatementIngest_TableDefinitionOptions_TableExistsOption.UNRECOGNIZED:
1944
+ default: return "UNRECOGNIZED";
1945
+ }
1946
+ }
1947
+ let ActionCancelQueryResult_CancelResult = /* @__PURE__ */ function(ActionCancelQueryResult_CancelResult$1) {
1948
+ /**
1949
+ * UNSPECIFIED - The cancellation status is unknown. Servers should avoid using
1950
+ * this value (send a NOT_FOUND error if the requested query is
1951
+ * not known). Clients can retry the request.
1952
+ */
1953
+ ActionCancelQueryResult_CancelResult$1[ActionCancelQueryResult_CancelResult$1["UNSPECIFIED"] = 0] = "UNSPECIFIED";
1954
+ /**
1955
+ * CANCELLED - The cancellation request is complete. Subsequent requests with
1956
+ * the same payload may return CANCELLED or a NOT_FOUND error.
1957
+ */
1958
+ ActionCancelQueryResult_CancelResult$1[ActionCancelQueryResult_CancelResult$1["CANCELLED"] = 1] = "CANCELLED";
1959
+ /**
1960
+ * CANCELLING - The cancellation request is in progress. The client may retry
1961
+ * the cancellation request.
1962
+ */
1963
+ ActionCancelQueryResult_CancelResult$1[ActionCancelQueryResult_CancelResult$1["CANCELLING"] = 2] = "CANCELLING";
1964
+ /**
1965
+ * NOT_CANCELLABLE - The query is not cancellable. The client should not retry the
1966
+ * cancellation request.
1967
+ */
1968
+ ActionCancelQueryResult_CancelResult$1[ActionCancelQueryResult_CancelResult$1["NOT_CANCELLABLE"] = 3] = "NOT_CANCELLABLE";
1969
+ ActionCancelQueryResult_CancelResult$1[ActionCancelQueryResult_CancelResult$1["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
1970
+ return ActionCancelQueryResult_CancelResult$1;
1971
+ }({});
1972
+ function actionCancelQueryResult_CancelResultFromJSON(object) {
1973
+ switch (object) {
1974
+ case 0:
1975
+ case "CANCEL_RESULT_UNSPECIFIED": return ActionCancelQueryResult_CancelResult.UNSPECIFIED;
1976
+ case 1:
1977
+ case "CANCEL_RESULT_CANCELLED": return ActionCancelQueryResult_CancelResult.CANCELLED;
1978
+ case 2:
1979
+ case "CANCEL_RESULT_CANCELLING": return ActionCancelQueryResult_CancelResult.CANCELLING;
1980
+ case 3:
1981
+ case "CANCEL_RESULT_NOT_CANCELLABLE": return ActionCancelQueryResult_CancelResult.NOT_CANCELLABLE;
1982
+ case -1:
1983
+ case "UNRECOGNIZED":
1984
+ default: return ActionCancelQueryResult_CancelResult.UNRECOGNIZED;
1985
+ }
1986
+ }
1987
+ function actionCancelQueryResult_CancelResultToJSON(object) {
1988
+ switch (object) {
1989
+ case ActionCancelQueryResult_CancelResult.UNSPECIFIED: return "CANCEL_RESULT_UNSPECIFIED";
1990
+ case ActionCancelQueryResult_CancelResult.CANCELLED: return "CANCEL_RESULT_CANCELLED";
1991
+ case ActionCancelQueryResult_CancelResult.CANCELLING: return "CANCEL_RESULT_CANCELLING";
1992
+ case ActionCancelQueryResult_CancelResult.NOT_CANCELLABLE: return "CANCEL_RESULT_NOT_CANCELLABLE";
1993
+ case ActionCancelQueryResult_CancelResult.UNRECOGNIZED:
1994
+ default: return "UNRECOGNIZED";
1995
+ }
1996
+ }
1997
+ function createBaseCommandGetSqlInfo() {
1998
+ return {
1999
+ $type: "arrow.flight.protocol.sql.CommandGetSqlInfo",
2000
+ info: []
2001
+ };
2002
+ }
2003
+ const CommandGetSqlInfo = {
2004
+ $type: "arrow.flight.protocol.sql.CommandGetSqlInfo",
2005
+ encode(message, writer = new BinaryWriter()) {
2006
+ writer.uint32(10).fork();
2007
+ for (const v of message.info) writer.uint32(v);
2008
+ writer.join();
2009
+ return writer;
2010
+ },
2011
+ decode(input, length) {
2012
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
2013
+ let end = length === void 0 ? reader.len : reader.pos + length;
2014
+ const message = createBaseCommandGetSqlInfo();
2015
+ while (reader.pos < end) {
2016
+ const tag = reader.uint32();
2017
+ switch (tag >>> 3) {
2018
+ case 1:
2019
+ if (tag === 8) {
2020
+ message.info.push(reader.uint32());
2021
+ continue;
2022
+ }
2023
+ if (tag === 10) {
2024
+ const end2 = reader.uint32() + reader.pos;
2025
+ while (reader.pos < end2) message.info.push(reader.uint32());
2026
+ continue;
2027
+ }
2028
+ break;
2029
+ }
2030
+ if ((tag & 7) === 4 || tag === 0) break;
2031
+ reader.skip(tag & 7);
2032
+ }
2033
+ return message;
2034
+ },
2035
+ fromJSON(object) {
2036
+ return {
2037
+ $type: CommandGetSqlInfo.$type,
2038
+ info: globalThis.Array.isArray(object?.info) ? object.info.map((e) => globalThis.Number(e)) : []
2039
+ };
2040
+ },
2041
+ toJSON(message) {
2042
+ const obj = {};
2043
+ if (message.info?.length) obj.info = message.info.map((e) => Math.round(e));
2044
+ return obj;
2045
+ },
2046
+ create(base) {
2047
+ return CommandGetSqlInfo.fromPartial(base ?? {});
2048
+ },
2049
+ fromPartial(object) {
2050
+ const message = createBaseCommandGetSqlInfo();
2051
+ message.info = object.info?.map((e) => e) || [];
2052
+ return message;
2053
+ }
2054
+ };
2055
+ messageTypeRegistry.set(CommandGetSqlInfo.$type, CommandGetSqlInfo);
2056
+ function createBaseCommandGetXdbcTypeInfo() {
2057
+ return {
2058
+ $type: "arrow.flight.protocol.sql.CommandGetXdbcTypeInfo",
2059
+ dataType: void 0
2060
+ };
2061
+ }
2062
+ const CommandGetXdbcTypeInfo = {
2063
+ $type: "arrow.flight.protocol.sql.CommandGetXdbcTypeInfo",
2064
+ encode(message, writer = new BinaryWriter()) {
2065
+ if (message.dataType !== void 0) writer.uint32(8).int32(message.dataType);
2066
+ return writer;
2067
+ },
2068
+ decode(input, length) {
2069
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
2070
+ let end = length === void 0 ? reader.len : reader.pos + length;
2071
+ const message = createBaseCommandGetXdbcTypeInfo();
2072
+ while (reader.pos < end) {
2073
+ const tag = reader.uint32();
2074
+ switch (tag >>> 3) {
2075
+ case 1:
2076
+ if (tag !== 8) break;
2077
+ message.dataType = reader.int32();
2078
+ continue;
2079
+ }
2080
+ if ((tag & 7) === 4 || tag === 0) break;
2081
+ reader.skip(tag & 7);
2082
+ }
2083
+ return message;
2084
+ },
2085
+ fromJSON(object) {
2086
+ return {
2087
+ $type: CommandGetXdbcTypeInfo.$type,
2088
+ dataType: isSet(object.dataType) ? globalThis.Number(object.dataType) : void 0
2089
+ };
2090
+ },
2091
+ toJSON(message) {
2092
+ const obj = {};
2093
+ if (message.dataType !== void 0) obj.dataType = Math.round(message.dataType);
2094
+ return obj;
2095
+ },
2096
+ create(base) {
2097
+ return CommandGetXdbcTypeInfo.fromPartial(base ?? {});
2098
+ },
2099
+ fromPartial(object) {
2100
+ const message = createBaseCommandGetXdbcTypeInfo();
2101
+ message.dataType = object.dataType ?? void 0;
2102
+ return message;
2103
+ }
2104
+ };
2105
+ messageTypeRegistry.set(CommandGetXdbcTypeInfo.$type, CommandGetXdbcTypeInfo);
2106
+ function createBaseCommandGetCatalogs() {
2107
+ return { $type: "arrow.flight.protocol.sql.CommandGetCatalogs" };
2108
+ }
2109
+ const CommandGetCatalogs = {
2110
+ $type: "arrow.flight.protocol.sql.CommandGetCatalogs",
2111
+ encode(_, writer = new BinaryWriter()) {
2112
+ return writer;
2113
+ },
2114
+ decode(input, length) {
2115
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
2116
+ let end = length === void 0 ? reader.len : reader.pos + length;
2117
+ const message = createBaseCommandGetCatalogs();
2118
+ while (reader.pos < end) {
2119
+ const tag = reader.uint32();
2120
+ switch (tag >>> 3) {}
2121
+ if ((tag & 7) === 4 || tag === 0) break;
2122
+ reader.skip(tag & 7);
2123
+ }
2124
+ return message;
2125
+ },
2126
+ fromJSON(_) {
2127
+ return { $type: CommandGetCatalogs.$type };
2128
+ },
2129
+ toJSON(_) {
2130
+ return {};
2131
+ },
2132
+ create(base) {
2133
+ return CommandGetCatalogs.fromPartial(base ?? {});
2134
+ },
2135
+ fromPartial(_) {
2136
+ return createBaseCommandGetCatalogs();
2137
+ }
2138
+ };
2139
+ messageTypeRegistry.set(CommandGetCatalogs.$type, CommandGetCatalogs);
2140
+ function createBaseCommandGetDbSchemas() {
2141
+ return {
2142
+ $type: "arrow.flight.protocol.sql.CommandGetDbSchemas",
2143
+ catalog: void 0,
2144
+ dbSchemaFilterPattern: void 0
2145
+ };
2146
+ }
2147
+ const CommandGetDbSchemas = {
2148
+ $type: "arrow.flight.protocol.sql.CommandGetDbSchemas",
2149
+ encode(message, writer = new BinaryWriter()) {
2150
+ if (message.catalog !== void 0) writer.uint32(10).string(message.catalog);
2151
+ if (message.dbSchemaFilterPattern !== void 0) writer.uint32(18).string(message.dbSchemaFilterPattern);
2152
+ return writer;
2153
+ },
2154
+ decode(input, length) {
2155
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
2156
+ let end = length === void 0 ? reader.len : reader.pos + length;
2157
+ const message = createBaseCommandGetDbSchemas();
2158
+ while (reader.pos < end) {
2159
+ const tag = reader.uint32();
2160
+ switch (tag >>> 3) {
2161
+ case 1:
2162
+ if (tag !== 10) break;
2163
+ message.catalog = reader.string();
2164
+ continue;
2165
+ case 2:
2166
+ if (tag !== 18) break;
2167
+ message.dbSchemaFilterPattern = reader.string();
2168
+ continue;
2169
+ }
2170
+ if ((tag & 7) === 4 || tag === 0) break;
2171
+ reader.skip(tag & 7);
2172
+ }
2173
+ return message;
2174
+ },
2175
+ fromJSON(object) {
2176
+ return {
2177
+ $type: CommandGetDbSchemas.$type,
2178
+ catalog: isSet(object.catalog) ? globalThis.String(object.catalog) : void 0,
2179
+ dbSchemaFilterPattern: isSet(object.dbSchemaFilterPattern) ? globalThis.String(object.dbSchemaFilterPattern) : void 0
2180
+ };
2181
+ },
2182
+ toJSON(message) {
2183
+ const obj = {};
2184
+ if (message.catalog !== void 0) obj.catalog = message.catalog;
2185
+ if (message.dbSchemaFilterPattern !== void 0) obj.dbSchemaFilterPattern = message.dbSchemaFilterPattern;
2186
+ return obj;
2187
+ },
2188
+ create(base) {
2189
+ return CommandGetDbSchemas.fromPartial(base ?? {});
2190
+ },
2191
+ fromPartial(object) {
2192
+ const message = createBaseCommandGetDbSchemas();
2193
+ message.catalog = object.catalog ?? void 0;
2194
+ message.dbSchemaFilterPattern = object.dbSchemaFilterPattern ?? void 0;
2195
+ return message;
2196
+ }
2197
+ };
2198
+ messageTypeRegistry.set(CommandGetDbSchemas.$type, CommandGetDbSchemas);
2199
+ function createBaseCommandGetTables() {
2200
+ return {
2201
+ $type: "arrow.flight.protocol.sql.CommandGetTables",
2202
+ catalog: void 0,
2203
+ dbSchemaFilterPattern: void 0,
2204
+ tableNameFilterPattern: void 0,
2205
+ tableTypes: [],
2206
+ includeSchema: false
2207
+ };
2208
+ }
2209
+ const CommandGetTables = {
2210
+ $type: "arrow.flight.protocol.sql.CommandGetTables",
2211
+ encode(message, writer = new BinaryWriter()) {
2212
+ if (message.catalog !== void 0) writer.uint32(10).string(message.catalog);
2213
+ if (message.dbSchemaFilterPattern !== void 0) writer.uint32(18).string(message.dbSchemaFilterPattern);
2214
+ if (message.tableNameFilterPattern !== void 0) writer.uint32(26).string(message.tableNameFilterPattern);
2215
+ for (const v of message.tableTypes) writer.uint32(34).string(v);
2216
+ if (message.includeSchema !== false) writer.uint32(40).bool(message.includeSchema);
2217
+ return writer;
2218
+ },
2219
+ decode(input, length) {
2220
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
2221
+ let end = length === void 0 ? reader.len : reader.pos + length;
2222
+ const message = createBaseCommandGetTables();
2223
+ while (reader.pos < end) {
2224
+ const tag = reader.uint32();
2225
+ switch (tag >>> 3) {
2226
+ case 1:
2227
+ if (tag !== 10) break;
2228
+ message.catalog = reader.string();
2229
+ continue;
2230
+ case 2:
2231
+ if (tag !== 18) break;
2232
+ message.dbSchemaFilterPattern = reader.string();
2233
+ continue;
2234
+ case 3:
2235
+ if (tag !== 26) break;
2236
+ message.tableNameFilterPattern = reader.string();
2237
+ continue;
2238
+ case 4:
2239
+ if (tag !== 34) break;
2240
+ message.tableTypes.push(reader.string());
2241
+ continue;
2242
+ case 5:
2243
+ if (tag !== 40) break;
2244
+ message.includeSchema = reader.bool();
2245
+ continue;
2246
+ }
2247
+ if ((tag & 7) === 4 || tag === 0) break;
2248
+ reader.skip(tag & 7);
2249
+ }
2250
+ return message;
2251
+ },
2252
+ fromJSON(object) {
2253
+ return {
2254
+ $type: CommandGetTables.$type,
2255
+ catalog: isSet(object.catalog) ? globalThis.String(object.catalog) : void 0,
2256
+ dbSchemaFilterPattern: isSet(object.dbSchemaFilterPattern) ? globalThis.String(object.dbSchemaFilterPattern) : void 0,
2257
+ tableNameFilterPattern: isSet(object.tableNameFilterPattern) ? globalThis.String(object.tableNameFilterPattern) : void 0,
2258
+ tableTypes: globalThis.Array.isArray(object?.tableTypes) ? object.tableTypes.map((e) => globalThis.String(e)) : [],
2259
+ includeSchema: isSet(object.includeSchema) ? globalThis.Boolean(object.includeSchema) : false
2260
+ };
2261
+ },
2262
+ toJSON(message) {
2263
+ const obj = {};
2264
+ if (message.catalog !== void 0) obj.catalog = message.catalog;
2265
+ if (message.dbSchemaFilterPattern !== void 0) obj.dbSchemaFilterPattern = message.dbSchemaFilterPattern;
2266
+ if (message.tableNameFilterPattern !== void 0) obj.tableNameFilterPattern = message.tableNameFilterPattern;
2267
+ if (message.tableTypes?.length) obj.tableTypes = message.tableTypes;
2268
+ if (message.includeSchema !== false) obj.includeSchema = message.includeSchema;
2269
+ return obj;
2270
+ },
2271
+ create(base) {
2272
+ return CommandGetTables.fromPartial(base ?? {});
2273
+ },
2274
+ fromPartial(object) {
2275
+ const message = createBaseCommandGetTables();
2276
+ message.catalog = object.catalog ?? void 0;
2277
+ message.dbSchemaFilterPattern = object.dbSchemaFilterPattern ?? void 0;
2278
+ message.tableNameFilterPattern = object.tableNameFilterPattern ?? void 0;
2279
+ message.tableTypes = object.tableTypes?.map((e) => e) || [];
2280
+ message.includeSchema = object.includeSchema ?? false;
2281
+ return message;
2282
+ }
2283
+ };
2284
+ messageTypeRegistry.set(CommandGetTables.$type, CommandGetTables);
2285
+ function createBaseCommandGetTableTypes() {
2286
+ return { $type: "arrow.flight.protocol.sql.CommandGetTableTypes" };
2287
+ }
2288
+ const CommandGetTableTypes = {
2289
+ $type: "arrow.flight.protocol.sql.CommandGetTableTypes",
2290
+ encode(_, writer = new BinaryWriter()) {
2291
+ return writer;
2292
+ },
2293
+ decode(input, length) {
2294
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
2295
+ let end = length === void 0 ? reader.len : reader.pos + length;
2296
+ const message = createBaseCommandGetTableTypes();
2297
+ while (reader.pos < end) {
2298
+ const tag = reader.uint32();
2299
+ switch (tag >>> 3) {}
2300
+ if ((tag & 7) === 4 || tag === 0) break;
2301
+ reader.skip(tag & 7);
2302
+ }
2303
+ return message;
2304
+ },
2305
+ fromJSON(_) {
2306
+ return { $type: CommandGetTableTypes.$type };
2307
+ },
2308
+ toJSON(_) {
2309
+ return {};
2310
+ },
2311
+ create(base) {
2312
+ return CommandGetTableTypes.fromPartial(base ?? {});
2313
+ },
2314
+ fromPartial(_) {
2315
+ return createBaseCommandGetTableTypes();
2316
+ }
2317
+ };
2318
+ messageTypeRegistry.set(CommandGetTableTypes.$type, CommandGetTableTypes);
2319
+ function createBaseCommandGetPrimaryKeys() {
2320
+ return {
2321
+ $type: "arrow.flight.protocol.sql.CommandGetPrimaryKeys",
2322
+ catalog: void 0,
2323
+ dbSchema: void 0,
2324
+ table: ""
2325
+ };
2326
+ }
2327
+ const CommandGetPrimaryKeys = {
2328
+ $type: "arrow.flight.protocol.sql.CommandGetPrimaryKeys",
2329
+ encode(message, writer = new BinaryWriter()) {
2330
+ if (message.catalog !== void 0) writer.uint32(10).string(message.catalog);
2331
+ if (message.dbSchema !== void 0) writer.uint32(18).string(message.dbSchema);
2332
+ if (message.table !== "") writer.uint32(26).string(message.table);
2333
+ return writer;
2334
+ },
2335
+ decode(input, length) {
2336
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
2337
+ let end = length === void 0 ? reader.len : reader.pos + length;
2338
+ const message = createBaseCommandGetPrimaryKeys();
2339
+ while (reader.pos < end) {
2340
+ const tag = reader.uint32();
2341
+ switch (tag >>> 3) {
2342
+ case 1:
2343
+ if (tag !== 10) break;
2344
+ message.catalog = reader.string();
2345
+ continue;
2346
+ case 2:
2347
+ if (tag !== 18) break;
2348
+ message.dbSchema = reader.string();
2349
+ continue;
2350
+ case 3:
2351
+ if (tag !== 26) break;
2352
+ message.table = reader.string();
2353
+ continue;
2354
+ }
2355
+ if ((tag & 7) === 4 || tag === 0) break;
2356
+ reader.skip(tag & 7);
2357
+ }
2358
+ return message;
2359
+ },
2360
+ fromJSON(object) {
2361
+ return {
2362
+ $type: CommandGetPrimaryKeys.$type,
2363
+ catalog: isSet(object.catalog) ? globalThis.String(object.catalog) : void 0,
2364
+ dbSchema: isSet(object.dbSchema) ? globalThis.String(object.dbSchema) : void 0,
2365
+ table: isSet(object.table) ? globalThis.String(object.table) : ""
2366
+ };
2367
+ },
2368
+ toJSON(message) {
2369
+ const obj = {};
2370
+ if (message.catalog !== void 0) obj.catalog = message.catalog;
2371
+ if (message.dbSchema !== void 0) obj.dbSchema = message.dbSchema;
2372
+ if (message.table !== "") obj.table = message.table;
2373
+ return obj;
2374
+ },
2375
+ create(base) {
2376
+ return CommandGetPrimaryKeys.fromPartial(base ?? {});
2377
+ },
2378
+ fromPartial(object) {
2379
+ const message = createBaseCommandGetPrimaryKeys();
2380
+ message.catalog = object.catalog ?? void 0;
2381
+ message.dbSchema = object.dbSchema ?? void 0;
2382
+ message.table = object.table ?? "";
2383
+ return message;
2384
+ }
2385
+ };
2386
+ messageTypeRegistry.set(CommandGetPrimaryKeys.$type, CommandGetPrimaryKeys);
2387
+ function createBaseCommandGetExportedKeys() {
2388
+ return {
2389
+ $type: "arrow.flight.protocol.sql.CommandGetExportedKeys",
2390
+ catalog: void 0,
2391
+ dbSchema: void 0,
2392
+ table: ""
2393
+ };
2394
+ }
2395
+ const CommandGetExportedKeys = {
2396
+ $type: "arrow.flight.protocol.sql.CommandGetExportedKeys",
2397
+ encode(message, writer = new BinaryWriter()) {
2398
+ if (message.catalog !== void 0) writer.uint32(10).string(message.catalog);
2399
+ if (message.dbSchema !== void 0) writer.uint32(18).string(message.dbSchema);
2400
+ if (message.table !== "") writer.uint32(26).string(message.table);
2401
+ return writer;
2402
+ },
2403
+ decode(input, length) {
2404
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
2405
+ let end = length === void 0 ? reader.len : reader.pos + length;
2406
+ const message = createBaseCommandGetExportedKeys();
2407
+ while (reader.pos < end) {
2408
+ const tag = reader.uint32();
2409
+ switch (tag >>> 3) {
2410
+ case 1:
2411
+ if (tag !== 10) break;
2412
+ message.catalog = reader.string();
2413
+ continue;
2414
+ case 2:
2415
+ if (tag !== 18) break;
2416
+ message.dbSchema = reader.string();
2417
+ continue;
2418
+ case 3:
2419
+ if (tag !== 26) break;
2420
+ message.table = reader.string();
2421
+ continue;
2422
+ }
2423
+ if ((tag & 7) === 4 || tag === 0) break;
2424
+ reader.skip(tag & 7);
2425
+ }
2426
+ return message;
2427
+ },
2428
+ fromJSON(object) {
2429
+ return {
2430
+ $type: CommandGetExportedKeys.$type,
2431
+ catalog: isSet(object.catalog) ? globalThis.String(object.catalog) : void 0,
2432
+ dbSchema: isSet(object.dbSchema) ? globalThis.String(object.dbSchema) : void 0,
2433
+ table: isSet(object.table) ? globalThis.String(object.table) : ""
2434
+ };
2435
+ },
2436
+ toJSON(message) {
2437
+ const obj = {};
2438
+ if (message.catalog !== void 0) obj.catalog = message.catalog;
2439
+ if (message.dbSchema !== void 0) obj.dbSchema = message.dbSchema;
2440
+ if (message.table !== "") obj.table = message.table;
2441
+ return obj;
2442
+ },
2443
+ create(base) {
2444
+ return CommandGetExportedKeys.fromPartial(base ?? {});
2445
+ },
2446
+ fromPartial(object) {
2447
+ const message = createBaseCommandGetExportedKeys();
2448
+ message.catalog = object.catalog ?? void 0;
2449
+ message.dbSchema = object.dbSchema ?? void 0;
2450
+ message.table = object.table ?? "";
2451
+ return message;
2452
+ }
2453
+ };
2454
+ messageTypeRegistry.set(CommandGetExportedKeys.$type, CommandGetExportedKeys);
2455
+ function createBaseCommandGetImportedKeys() {
2456
+ return {
2457
+ $type: "arrow.flight.protocol.sql.CommandGetImportedKeys",
2458
+ catalog: void 0,
2459
+ dbSchema: void 0,
2460
+ table: ""
2461
+ };
2462
+ }
2463
+ const CommandGetImportedKeys = {
2464
+ $type: "arrow.flight.protocol.sql.CommandGetImportedKeys",
2465
+ encode(message, writer = new BinaryWriter()) {
2466
+ if (message.catalog !== void 0) writer.uint32(10).string(message.catalog);
2467
+ if (message.dbSchema !== void 0) writer.uint32(18).string(message.dbSchema);
2468
+ if (message.table !== "") writer.uint32(26).string(message.table);
2469
+ return writer;
2470
+ },
2471
+ decode(input, length) {
2472
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
2473
+ let end = length === void 0 ? reader.len : reader.pos + length;
2474
+ const message = createBaseCommandGetImportedKeys();
2475
+ while (reader.pos < end) {
2476
+ const tag = reader.uint32();
2477
+ switch (tag >>> 3) {
2478
+ case 1:
2479
+ if (tag !== 10) break;
2480
+ message.catalog = reader.string();
2481
+ continue;
2482
+ case 2:
2483
+ if (tag !== 18) break;
2484
+ message.dbSchema = reader.string();
2485
+ continue;
2486
+ case 3:
2487
+ if (tag !== 26) break;
2488
+ message.table = reader.string();
2489
+ continue;
2490
+ }
2491
+ if ((tag & 7) === 4 || tag === 0) break;
2492
+ reader.skip(tag & 7);
2493
+ }
2494
+ return message;
2495
+ },
2496
+ fromJSON(object) {
2497
+ return {
2498
+ $type: CommandGetImportedKeys.$type,
2499
+ catalog: isSet(object.catalog) ? globalThis.String(object.catalog) : void 0,
2500
+ dbSchema: isSet(object.dbSchema) ? globalThis.String(object.dbSchema) : void 0,
2501
+ table: isSet(object.table) ? globalThis.String(object.table) : ""
2502
+ };
2503
+ },
2504
+ toJSON(message) {
2505
+ const obj = {};
2506
+ if (message.catalog !== void 0) obj.catalog = message.catalog;
2507
+ if (message.dbSchema !== void 0) obj.dbSchema = message.dbSchema;
2508
+ if (message.table !== "") obj.table = message.table;
2509
+ return obj;
2510
+ },
2511
+ create(base) {
2512
+ return CommandGetImportedKeys.fromPartial(base ?? {});
2513
+ },
2514
+ fromPartial(object) {
2515
+ const message = createBaseCommandGetImportedKeys();
2516
+ message.catalog = object.catalog ?? void 0;
2517
+ message.dbSchema = object.dbSchema ?? void 0;
2518
+ message.table = object.table ?? "";
2519
+ return message;
2520
+ }
2521
+ };
2522
+ messageTypeRegistry.set(CommandGetImportedKeys.$type, CommandGetImportedKeys);
2523
+ function createBaseCommandGetCrossReference() {
2524
+ return {
2525
+ $type: "arrow.flight.protocol.sql.CommandGetCrossReference",
2526
+ pkCatalog: void 0,
2527
+ pkDbSchema: void 0,
2528
+ pkTable: "",
2529
+ fkCatalog: void 0,
2530
+ fkDbSchema: void 0,
2531
+ fkTable: ""
2532
+ };
2533
+ }
2534
+ const CommandGetCrossReference = {
2535
+ $type: "arrow.flight.protocol.sql.CommandGetCrossReference",
2536
+ encode(message, writer = new BinaryWriter()) {
2537
+ if (message.pkCatalog !== void 0) writer.uint32(10).string(message.pkCatalog);
2538
+ if (message.pkDbSchema !== void 0) writer.uint32(18).string(message.pkDbSchema);
2539
+ if (message.pkTable !== "") writer.uint32(26).string(message.pkTable);
2540
+ if (message.fkCatalog !== void 0) writer.uint32(34).string(message.fkCatalog);
2541
+ if (message.fkDbSchema !== void 0) writer.uint32(42).string(message.fkDbSchema);
2542
+ if (message.fkTable !== "") writer.uint32(50).string(message.fkTable);
2543
+ return writer;
2544
+ },
2545
+ decode(input, length) {
2546
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
2547
+ let end = length === void 0 ? reader.len : reader.pos + length;
2548
+ const message = createBaseCommandGetCrossReference();
2549
+ while (reader.pos < end) {
2550
+ const tag = reader.uint32();
2551
+ switch (tag >>> 3) {
2552
+ case 1:
2553
+ if (tag !== 10) break;
2554
+ message.pkCatalog = reader.string();
2555
+ continue;
2556
+ case 2:
2557
+ if (tag !== 18) break;
2558
+ message.pkDbSchema = reader.string();
2559
+ continue;
2560
+ case 3:
2561
+ if (tag !== 26) break;
2562
+ message.pkTable = reader.string();
2563
+ continue;
2564
+ case 4:
2565
+ if (tag !== 34) break;
2566
+ message.fkCatalog = reader.string();
2567
+ continue;
2568
+ case 5:
2569
+ if (tag !== 42) break;
2570
+ message.fkDbSchema = reader.string();
2571
+ continue;
2572
+ case 6:
2573
+ if (tag !== 50) break;
2574
+ message.fkTable = reader.string();
2575
+ continue;
2576
+ }
2577
+ if ((tag & 7) === 4 || tag === 0) break;
2578
+ reader.skip(tag & 7);
2579
+ }
2580
+ return message;
2581
+ },
2582
+ fromJSON(object) {
2583
+ return {
2584
+ $type: CommandGetCrossReference.$type,
2585
+ pkCatalog: isSet(object.pkCatalog) ? globalThis.String(object.pkCatalog) : void 0,
2586
+ pkDbSchema: isSet(object.pkDbSchema) ? globalThis.String(object.pkDbSchema) : void 0,
2587
+ pkTable: isSet(object.pkTable) ? globalThis.String(object.pkTable) : "",
2588
+ fkCatalog: isSet(object.fkCatalog) ? globalThis.String(object.fkCatalog) : void 0,
2589
+ fkDbSchema: isSet(object.fkDbSchema) ? globalThis.String(object.fkDbSchema) : void 0,
2590
+ fkTable: isSet(object.fkTable) ? globalThis.String(object.fkTable) : ""
2591
+ };
2592
+ },
2593
+ toJSON(message) {
2594
+ const obj = {};
2595
+ if (message.pkCatalog !== void 0) obj.pkCatalog = message.pkCatalog;
2596
+ if (message.pkDbSchema !== void 0) obj.pkDbSchema = message.pkDbSchema;
2597
+ if (message.pkTable !== "") obj.pkTable = message.pkTable;
2598
+ if (message.fkCatalog !== void 0) obj.fkCatalog = message.fkCatalog;
2599
+ if (message.fkDbSchema !== void 0) obj.fkDbSchema = message.fkDbSchema;
2600
+ if (message.fkTable !== "") obj.fkTable = message.fkTable;
2601
+ return obj;
2602
+ },
2603
+ create(base) {
2604
+ return CommandGetCrossReference.fromPartial(base ?? {});
2605
+ },
2606
+ fromPartial(object) {
2607
+ const message = createBaseCommandGetCrossReference();
2608
+ message.pkCatalog = object.pkCatalog ?? void 0;
2609
+ message.pkDbSchema = object.pkDbSchema ?? void 0;
2610
+ message.pkTable = object.pkTable ?? "";
2611
+ message.fkCatalog = object.fkCatalog ?? void 0;
2612
+ message.fkDbSchema = object.fkDbSchema ?? void 0;
2613
+ message.fkTable = object.fkTable ?? "";
2614
+ return message;
2615
+ }
2616
+ };
2617
+ messageTypeRegistry.set(CommandGetCrossReference.$type, CommandGetCrossReference);
2618
+ function createBaseActionCreatePreparedStatementRequest() {
2619
+ return {
2620
+ $type: "arrow.flight.protocol.sql.ActionCreatePreparedStatementRequest",
2621
+ query: "",
2622
+ transactionId: void 0
2623
+ };
2624
+ }
2625
+ const ActionCreatePreparedStatementRequest = {
2626
+ $type: "arrow.flight.protocol.sql.ActionCreatePreparedStatementRequest",
2627
+ encode(message, writer = new BinaryWriter()) {
2628
+ if (message.query !== "") writer.uint32(10).string(message.query);
2629
+ if (message.transactionId !== void 0) writer.uint32(18).bytes(message.transactionId);
2630
+ return writer;
2631
+ },
2632
+ decode(input, length) {
2633
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
2634
+ let end = length === void 0 ? reader.len : reader.pos + length;
2635
+ const message = createBaseActionCreatePreparedStatementRequest();
2636
+ while (reader.pos < end) {
2637
+ const tag = reader.uint32();
2638
+ switch (tag >>> 3) {
2639
+ case 1:
2640
+ if (tag !== 10) break;
2641
+ message.query = reader.string();
2642
+ continue;
2643
+ case 2:
2644
+ if (tag !== 18) break;
2645
+ message.transactionId = reader.bytes();
2646
+ continue;
2647
+ }
2648
+ if ((tag & 7) === 4 || tag === 0) break;
2649
+ reader.skip(tag & 7);
2650
+ }
2651
+ return message;
2652
+ },
2653
+ fromJSON(object) {
2654
+ return {
2655
+ $type: ActionCreatePreparedStatementRequest.$type,
2656
+ query: isSet(object.query) ? globalThis.String(object.query) : "",
2657
+ transactionId: isSet(object.transactionId) ? bytesFromBase64(object.transactionId) : void 0
2658
+ };
2659
+ },
2660
+ toJSON(message) {
2661
+ const obj = {};
2662
+ if (message.query !== "") obj.query = message.query;
2663
+ if (message.transactionId !== void 0) obj.transactionId = base64FromBytes(message.transactionId);
2664
+ return obj;
2665
+ },
2666
+ create(base) {
2667
+ return ActionCreatePreparedStatementRequest.fromPartial(base ?? {});
2668
+ },
2669
+ fromPartial(object) {
2670
+ const message = createBaseActionCreatePreparedStatementRequest();
2671
+ message.query = object.query ?? "";
2672
+ message.transactionId = object.transactionId ?? void 0;
2673
+ return message;
2674
+ }
2675
+ };
2676
+ messageTypeRegistry.set(ActionCreatePreparedStatementRequest.$type, ActionCreatePreparedStatementRequest);
2677
+ function createBaseSubstraitPlan() {
2678
+ return {
2679
+ $type: "arrow.flight.protocol.sql.SubstraitPlan",
2680
+ plan: new Uint8Array(0),
2681
+ version: ""
2682
+ };
2683
+ }
2684
+ const SubstraitPlan = {
2685
+ $type: "arrow.flight.protocol.sql.SubstraitPlan",
2686
+ encode(message, writer = new BinaryWriter()) {
2687
+ if (message.plan.length !== 0) writer.uint32(10).bytes(message.plan);
2688
+ if (message.version !== "") writer.uint32(18).string(message.version);
2689
+ return writer;
2690
+ },
2691
+ decode(input, length) {
2692
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
2693
+ let end = length === void 0 ? reader.len : reader.pos + length;
2694
+ const message = createBaseSubstraitPlan();
2695
+ while (reader.pos < end) {
2696
+ const tag = reader.uint32();
2697
+ switch (tag >>> 3) {
2698
+ case 1:
2699
+ if (tag !== 10) break;
2700
+ message.plan = reader.bytes();
2701
+ continue;
2702
+ case 2:
2703
+ if (tag !== 18) break;
2704
+ message.version = reader.string();
2705
+ continue;
2706
+ }
2707
+ if ((tag & 7) === 4 || tag === 0) break;
2708
+ reader.skip(tag & 7);
2709
+ }
2710
+ return message;
2711
+ },
2712
+ fromJSON(object) {
2713
+ return {
2714
+ $type: SubstraitPlan.$type,
2715
+ plan: isSet(object.plan) ? bytesFromBase64(object.plan) : new Uint8Array(0),
2716
+ version: isSet(object.version) ? globalThis.String(object.version) : ""
2717
+ };
2718
+ },
2719
+ toJSON(message) {
2720
+ const obj = {};
2721
+ if (message.plan.length !== 0) obj.plan = base64FromBytes(message.plan);
2722
+ if (message.version !== "") obj.version = message.version;
2723
+ return obj;
2724
+ },
2725
+ create(base) {
2726
+ return SubstraitPlan.fromPartial(base ?? {});
2727
+ },
2728
+ fromPartial(object) {
2729
+ const message = createBaseSubstraitPlan();
2730
+ message.plan = object.plan ?? new Uint8Array(0);
2731
+ message.version = object.version ?? "";
2732
+ return message;
2733
+ }
2734
+ };
2735
+ messageTypeRegistry.set(SubstraitPlan.$type, SubstraitPlan);
2736
+ function createBaseActionCreatePreparedSubstraitPlanRequest() {
2737
+ return {
2738
+ $type: "arrow.flight.protocol.sql.ActionCreatePreparedSubstraitPlanRequest",
2739
+ plan: void 0,
2740
+ transactionId: void 0
2741
+ };
2742
+ }
2743
+ const ActionCreatePreparedSubstraitPlanRequest = {
2744
+ $type: "arrow.flight.protocol.sql.ActionCreatePreparedSubstraitPlanRequest",
2745
+ encode(message, writer = new BinaryWriter()) {
2746
+ if (message.plan !== void 0) SubstraitPlan.encode(message.plan, writer.uint32(10).fork()).join();
2747
+ if (message.transactionId !== void 0) writer.uint32(18).bytes(message.transactionId);
2748
+ return writer;
2749
+ },
2750
+ decode(input, length) {
2751
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
2752
+ let end = length === void 0 ? reader.len : reader.pos + length;
2753
+ const message = createBaseActionCreatePreparedSubstraitPlanRequest();
2754
+ while (reader.pos < end) {
2755
+ const tag = reader.uint32();
2756
+ switch (tag >>> 3) {
2757
+ case 1:
2758
+ if (tag !== 10) break;
2759
+ message.plan = SubstraitPlan.decode(reader, reader.uint32());
2760
+ continue;
2761
+ case 2:
2762
+ if (tag !== 18) break;
2763
+ message.transactionId = reader.bytes();
2764
+ continue;
2765
+ }
2766
+ if ((tag & 7) === 4 || tag === 0) break;
2767
+ reader.skip(tag & 7);
2768
+ }
2769
+ return message;
2770
+ },
2771
+ fromJSON(object) {
2772
+ return {
2773
+ $type: ActionCreatePreparedSubstraitPlanRequest.$type,
2774
+ plan: isSet(object.plan) ? SubstraitPlan.fromJSON(object.plan) : void 0,
2775
+ transactionId: isSet(object.transactionId) ? bytesFromBase64(object.transactionId) : void 0
2776
+ };
2777
+ },
2778
+ toJSON(message) {
2779
+ const obj = {};
2780
+ if (message.plan !== void 0) obj.plan = SubstraitPlan.toJSON(message.plan);
2781
+ if (message.transactionId !== void 0) obj.transactionId = base64FromBytes(message.transactionId);
2782
+ return obj;
2783
+ },
2784
+ create(base) {
2785
+ return ActionCreatePreparedSubstraitPlanRequest.fromPartial(base ?? {});
2786
+ },
2787
+ fromPartial(object) {
2788
+ const message = createBaseActionCreatePreparedSubstraitPlanRequest();
2789
+ message.plan = object.plan !== void 0 && object.plan !== null ? SubstraitPlan.fromPartial(object.plan) : void 0;
2790
+ message.transactionId = object.transactionId ?? void 0;
2791
+ return message;
2792
+ }
2793
+ };
2794
+ messageTypeRegistry.set(ActionCreatePreparedSubstraitPlanRequest.$type, ActionCreatePreparedSubstraitPlanRequest);
2795
+ function createBaseActionCreatePreparedStatementResult() {
2796
+ return {
2797
+ $type: "arrow.flight.protocol.sql.ActionCreatePreparedStatementResult",
2798
+ preparedStatementHandle: new Uint8Array(0),
2799
+ datasetSchema: new Uint8Array(0),
2800
+ parameterSchema: new Uint8Array(0)
2801
+ };
2802
+ }
2803
+ const ActionCreatePreparedStatementResult = {
2804
+ $type: "arrow.flight.protocol.sql.ActionCreatePreparedStatementResult",
2805
+ encode(message, writer = new BinaryWriter()) {
2806
+ if (message.preparedStatementHandle.length !== 0) writer.uint32(10).bytes(message.preparedStatementHandle);
2807
+ if (message.datasetSchema.length !== 0) writer.uint32(18).bytes(message.datasetSchema);
2808
+ if (message.parameterSchema.length !== 0) writer.uint32(26).bytes(message.parameterSchema);
2809
+ return writer;
2810
+ },
2811
+ decode(input, length) {
2812
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
2813
+ let end = length === void 0 ? reader.len : reader.pos + length;
2814
+ const message = createBaseActionCreatePreparedStatementResult();
2815
+ while (reader.pos < end) {
2816
+ const tag = reader.uint32();
2817
+ switch (tag >>> 3) {
2818
+ case 1:
2819
+ if (tag !== 10) break;
2820
+ message.preparedStatementHandle = reader.bytes();
2821
+ continue;
2822
+ case 2:
2823
+ if (tag !== 18) break;
2824
+ message.datasetSchema = reader.bytes();
2825
+ continue;
2826
+ case 3:
2827
+ if (tag !== 26) break;
2828
+ message.parameterSchema = reader.bytes();
2829
+ continue;
2830
+ }
2831
+ if ((tag & 7) === 4 || tag === 0) break;
2832
+ reader.skip(tag & 7);
2833
+ }
2834
+ return message;
2835
+ },
2836
+ fromJSON(object) {
2837
+ return {
2838
+ $type: ActionCreatePreparedStatementResult.$type,
2839
+ preparedStatementHandle: isSet(object.preparedStatementHandle) ? bytesFromBase64(object.preparedStatementHandle) : new Uint8Array(0),
2840
+ datasetSchema: isSet(object.datasetSchema) ? bytesFromBase64(object.datasetSchema) : new Uint8Array(0),
2841
+ parameterSchema: isSet(object.parameterSchema) ? bytesFromBase64(object.parameterSchema) : new Uint8Array(0)
2842
+ };
2843
+ },
2844
+ toJSON(message) {
2845
+ const obj = {};
2846
+ if (message.preparedStatementHandle.length !== 0) obj.preparedStatementHandle = base64FromBytes(message.preparedStatementHandle);
2847
+ if (message.datasetSchema.length !== 0) obj.datasetSchema = base64FromBytes(message.datasetSchema);
2848
+ if (message.parameterSchema.length !== 0) obj.parameterSchema = base64FromBytes(message.parameterSchema);
2849
+ return obj;
2850
+ },
2851
+ create(base) {
2852
+ return ActionCreatePreparedStatementResult.fromPartial(base ?? {});
2853
+ },
2854
+ fromPartial(object) {
2855
+ const message = createBaseActionCreatePreparedStatementResult();
2856
+ message.preparedStatementHandle = object.preparedStatementHandle ?? new Uint8Array(0);
2857
+ message.datasetSchema = object.datasetSchema ?? new Uint8Array(0);
2858
+ message.parameterSchema = object.parameterSchema ?? new Uint8Array(0);
2859
+ return message;
2860
+ }
2861
+ };
2862
+ messageTypeRegistry.set(ActionCreatePreparedStatementResult.$type, ActionCreatePreparedStatementResult);
2863
+ function createBaseActionClosePreparedStatementRequest() {
2864
+ return {
2865
+ $type: "arrow.flight.protocol.sql.ActionClosePreparedStatementRequest",
2866
+ preparedStatementHandle: new Uint8Array(0)
2867
+ };
2868
+ }
2869
+ const ActionClosePreparedStatementRequest = {
2870
+ $type: "arrow.flight.protocol.sql.ActionClosePreparedStatementRequest",
2871
+ encode(message, writer = new BinaryWriter()) {
2872
+ if (message.preparedStatementHandle.length !== 0) writer.uint32(10).bytes(message.preparedStatementHandle);
2873
+ return writer;
2874
+ },
2875
+ decode(input, length) {
2876
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
2877
+ let end = length === void 0 ? reader.len : reader.pos + length;
2878
+ const message = createBaseActionClosePreparedStatementRequest();
2879
+ while (reader.pos < end) {
2880
+ const tag = reader.uint32();
2881
+ switch (tag >>> 3) {
2882
+ case 1:
2883
+ if (tag !== 10) break;
2884
+ message.preparedStatementHandle = reader.bytes();
2885
+ continue;
2886
+ }
2887
+ if ((tag & 7) === 4 || tag === 0) break;
2888
+ reader.skip(tag & 7);
2889
+ }
2890
+ return message;
2891
+ },
2892
+ fromJSON(object) {
2893
+ return {
2894
+ $type: ActionClosePreparedStatementRequest.$type,
2895
+ preparedStatementHandle: isSet(object.preparedStatementHandle) ? bytesFromBase64(object.preparedStatementHandle) : new Uint8Array(0)
2896
+ };
2897
+ },
2898
+ toJSON(message) {
2899
+ const obj = {};
2900
+ if (message.preparedStatementHandle.length !== 0) obj.preparedStatementHandle = base64FromBytes(message.preparedStatementHandle);
2901
+ return obj;
2902
+ },
2903
+ create(base) {
2904
+ return ActionClosePreparedStatementRequest.fromPartial(base ?? {});
2905
+ },
2906
+ fromPartial(object) {
2907
+ const message = createBaseActionClosePreparedStatementRequest();
2908
+ message.preparedStatementHandle = object.preparedStatementHandle ?? new Uint8Array(0);
2909
+ return message;
2910
+ }
2911
+ };
2912
+ messageTypeRegistry.set(ActionClosePreparedStatementRequest.$type, ActionClosePreparedStatementRequest);
2913
+ function createBaseActionBeginTransactionRequest() {
2914
+ return { $type: "arrow.flight.protocol.sql.ActionBeginTransactionRequest" };
2915
+ }
2916
+ const ActionBeginTransactionRequest = {
2917
+ $type: "arrow.flight.protocol.sql.ActionBeginTransactionRequest",
2918
+ encode(_, writer = new BinaryWriter()) {
2919
+ return writer;
2920
+ },
2921
+ decode(input, length) {
2922
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
2923
+ let end = length === void 0 ? reader.len : reader.pos + length;
2924
+ const message = createBaseActionBeginTransactionRequest();
2925
+ while (reader.pos < end) {
2926
+ const tag = reader.uint32();
2927
+ switch (tag >>> 3) {}
2928
+ if ((tag & 7) === 4 || tag === 0) break;
2929
+ reader.skip(tag & 7);
2930
+ }
2931
+ return message;
2932
+ },
2933
+ fromJSON(_) {
2934
+ return { $type: ActionBeginTransactionRequest.$type };
2935
+ },
2936
+ toJSON(_) {
2937
+ return {};
2938
+ },
2939
+ create(base) {
2940
+ return ActionBeginTransactionRequest.fromPartial(base ?? {});
2941
+ },
2942
+ fromPartial(_) {
2943
+ return createBaseActionBeginTransactionRequest();
2944
+ }
2945
+ };
2946
+ messageTypeRegistry.set(ActionBeginTransactionRequest.$type, ActionBeginTransactionRequest);
2947
+ function createBaseActionBeginSavepointRequest() {
2948
+ return {
2949
+ $type: "arrow.flight.protocol.sql.ActionBeginSavepointRequest",
2950
+ transactionId: new Uint8Array(0),
2951
+ name: ""
2952
+ };
2953
+ }
2954
+ const ActionBeginSavepointRequest = {
2955
+ $type: "arrow.flight.protocol.sql.ActionBeginSavepointRequest",
2956
+ encode(message, writer = new BinaryWriter()) {
2957
+ if (message.transactionId.length !== 0) writer.uint32(10).bytes(message.transactionId);
2958
+ if (message.name !== "") writer.uint32(18).string(message.name);
2959
+ return writer;
2960
+ },
2961
+ decode(input, length) {
2962
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
2963
+ let end = length === void 0 ? reader.len : reader.pos + length;
2964
+ const message = createBaseActionBeginSavepointRequest();
2965
+ while (reader.pos < end) {
2966
+ const tag = reader.uint32();
2967
+ switch (tag >>> 3) {
2968
+ case 1:
2969
+ if (tag !== 10) break;
2970
+ message.transactionId = reader.bytes();
2971
+ continue;
2972
+ case 2:
2973
+ if (tag !== 18) break;
2974
+ message.name = reader.string();
2975
+ continue;
2976
+ }
2977
+ if ((tag & 7) === 4 || tag === 0) break;
2978
+ reader.skip(tag & 7);
2979
+ }
2980
+ return message;
2981
+ },
2982
+ fromJSON(object) {
2983
+ return {
2984
+ $type: ActionBeginSavepointRequest.$type,
2985
+ transactionId: isSet(object.transactionId) ? bytesFromBase64(object.transactionId) : new Uint8Array(0),
2986
+ name: isSet(object.name) ? globalThis.String(object.name) : ""
2987
+ };
2988
+ },
2989
+ toJSON(message) {
2990
+ const obj = {};
2991
+ if (message.transactionId.length !== 0) obj.transactionId = base64FromBytes(message.transactionId);
2992
+ if (message.name !== "") obj.name = message.name;
2993
+ return obj;
2994
+ },
2995
+ create(base) {
2996
+ return ActionBeginSavepointRequest.fromPartial(base ?? {});
2997
+ },
2998
+ fromPartial(object) {
2999
+ const message = createBaseActionBeginSavepointRequest();
3000
+ message.transactionId = object.transactionId ?? new Uint8Array(0);
3001
+ message.name = object.name ?? "";
3002
+ return message;
3003
+ }
3004
+ };
3005
+ messageTypeRegistry.set(ActionBeginSavepointRequest.$type, ActionBeginSavepointRequest);
3006
+ function createBaseActionBeginTransactionResult() {
3007
+ return {
3008
+ $type: "arrow.flight.protocol.sql.ActionBeginTransactionResult",
3009
+ transactionId: new Uint8Array(0)
3010
+ };
3011
+ }
3012
+ const ActionBeginTransactionResult = {
3013
+ $type: "arrow.flight.protocol.sql.ActionBeginTransactionResult",
3014
+ encode(message, writer = new BinaryWriter()) {
3015
+ if (message.transactionId.length !== 0) writer.uint32(10).bytes(message.transactionId);
3016
+ return writer;
3017
+ },
3018
+ decode(input, length) {
3019
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
3020
+ let end = length === void 0 ? reader.len : reader.pos + length;
3021
+ const message = createBaseActionBeginTransactionResult();
3022
+ while (reader.pos < end) {
3023
+ const tag = reader.uint32();
3024
+ switch (tag >>> 3) {
3025
+ case 1:
3026
+ if (tag !== 10) break;
3027
+ message.transactionId = reader.bytes();
3028
+ continue;
3029
+ }
3030
+ if ((tag & 7) === 4 || tag === 0) break;
3031
+ reader.skip(tag & 7);
3032
+ }
3033
+ return message;
3034
+ },
3035
+ fromJSON(object) {
3036
+ return {
3037
+ $type: ActionBeginTransactionResult.$type,
3038
+ transactionId: isSet(object.transactionId) ? bytesFromBase64(object.transactionId) : new Uint8Array(0)
3039
+ };
3040
+ },
3041
+ toJSON(message) {
3042
+ const obj = {};
3043
+ if (message.transactionId.length !== 0) obj.transactionId = base64FromBytes(message.transactionId);
3044
+ return obj;
3045
+ },
3046
+ create(base) {
3047
+ return ActionBeginTransactionResult.fromPartial(base ?? {});
3048
+ },
3049
+ fromPartial(object) {
3050
+ const message = createBaseActionBeginTransactionResult();
3051
+ message.transactionId = object.transactionId ?? new Uint8Array(0);
3052
+ return message;
3053
+ }
3054
+ };
3055
+ messageTypeRegistry.set(ActionBeginTransactionResult.$type, ActionBeginTransactionResult);
3056
+ function createBaseActionBeginSavepointResult() {
3057
+ return {
3058
+ $type: "arrow.flight.protocol.sql.ActionBeginSavepointResult",
3059
+ savepointId: new Uint8Array(0)
3060
+ };
3061
+ }
3062
+ const ActionBeginSavepointResult = {
3063
+ $type: "arrow.flight.protocol.sql.ActionBeginSavepointResult",
3064
+ encode(message, writer = new BinaryWriter()) {
3065
+ if (message.savepointId.length !== 0) writer.uint32(10).bytes(message.savepointId);
3066
+ return writer;
3067
+ },
3068
+ decode(input, length) {
3069
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
3070
+ let end = length === void 0 ? reader.len : reader.pos + length;
3071
+ const message = createBaseActionBeginSavepointResult();
3072
+ while (reader.pos < end) {
3073
+ const tag = reader.uint32();
3074
+ switch (tag >>> 3) {
3075
+ case 1:
3076
+ if (tag !== 10) break;
3077
+ message.savepointId = reader.bytes();
3078
+ continue;
3079
+ }
3080
+ if ((tag & 7) === 4 || tag === 0) break;
3081
+ reader.skip(tag & 7);
3082
+ }
3083
+ return message;
3084
+ },
3085
+ fromJSON(object) {
3086
+ return {
3087
+ $type: ActionBeginSavepointResult.$type,
3088
+ savepointId: isSet(object.savepointId) ? bytesFromBase64(object.savepointId) : new Uint8Array(0)
3089
+ };
3090
+ },
3091
+ toJSON(message) {
3092
+ const obj = {};
3093
+ if (message.savepointId.length !== 0) obj.savepointId = base64FromBytes(message.savepointId);
3094
+ return obj;
3095
+ },
3096
+ create(base) {
3097
+ return ActionBeginSavepointResult.fromPartial(base ?? {});
3098
+ },
3099
+ fromPartial(object) {
3100
+ const message = createBaseActionBeginSavepointResult();
3101
+ message.savepointId = object.savepointId ?? new Uint8Array(0);
3102
+ return message;
3103
+ }
3104
+ };
3105
+ messageTypeRegistry.set(ActionBeginSavepointResult.$type, ActionBeginSavepointResult);
3106
+ function createBaseActionEndTransactionRequest() {
3107
+ return {
3108
+ $type: "arrow.flight.protocol.sql.ActionEndTransactionRequest",
3109
+ transactionId: new Uint8Array(0),
3110
+ action: 0
3111
+ };
3112
+ }
3113
+ const ActionEndTransactionRequest = {
3114
+ $type: "arrow.flight.protocol.sql.ActionEndTransactionRequest",
3115
+ encode(message, writer = new BinaryWriter()) {
3116
+ if (message.transactionId.length !== 0) writer.uint32(10).bytes(message.transactionId);
3117
+ if (message.action !== 0) writer.uint32(16).int32(message.action);
3118
+ return writer;
3119
+ },
3120
+ decode(input, length) {
3121
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
3122
+ let end = length === void 0 ? reader.len : reader.pos + length;
3123
+ const message = createBaseActionEndTransactionRequest();
3124
+ while (reader.pos < end) {
3125
+ const tag = reader.uint32();
3126
+ switch (tag >>> 3) {
3127
+ case 1:
3128
+ if (tag !== 10) break;
3129
+ message.transactionId = reader.bytes();
3130
+ continue;
3131
+ case 2:
3132
+ if (tag !== 16) break;
3133
+ message.action = reader.int32();
3134
+ continue;
3135
+ }
3136
+ if ((tag & 7) === 4 || tag === 0) break;
3137
+ reader.skip(tag & 7);
3138
+ }
3139
+ return message;
3140
+ },
3141
+ fromJSON(object) {
3142
+ return {
3143
+ $type: ActionEndTransactionRequest.$type,
3144
+ transactionId: isSet(object.transactionId) ? bytesFromBase64(object.transactionId) : new Uint8Array(0),
3145
+ action: isSet(object.action) ? actionEndTransactionRequest_EndTransactionFromJSON(object.action) : 0
3146
+ };
3147
+ },
3148
+ toJSON(message) {
3149
+ const obj = {};
3150
+ if (message.transactionId.length !== 0) obj.transactionId = base64FromBytes(message.transactionId);
3151
+ if (message.action !== 0) obj.action = actionEndTransactionRequest_EndTransactionToJSON(message.action);
3152
+ return obj;
3153
+ },
3154
+ create(base) {
3155
+ return ActionEndTransactionRequest.fromPartial(base ?? {});
3156
+ },
3157
+ fromPartial(object) {
3158
+ const message = createBaseActionEndTransactionRequest();
3159
+ message.transactionId = object.transactionId ?? new Uint8Array(0);
3160
+ message.action = object.action ?? 0;
3161
+ return message;
3162
+ }
3163
+ };
3164
+ messageTypeRegistry.set(ActionEndTransactionRequest.$type, ActionEndTransactionRequest);
3165
+ function createBaseActionEndSavepointRequest() {
3166
+ return {
3167
+ $type: "arrow.flight.protocol.sql.ActionEndSavepointRequest",
3168
+ savepointId: new Uint8Array(0),
3169
+ action: 0
3170
+ };
3171
+ }
3172
+ const ActionEndSavepointRequest = {
3173
+ $type: "arrow.flight.protocol.sql.ActionEndSavepointRequest",
3174
+ encode(message, writer = new BinaryWriter()) {
3175
+ if (message.savepointId.length !== 0) writer.uint32(10).bytes(message.savepointId);
3176
+ if (message.action !== 0) writer.uint32(16).int32(message.action);
3177
+ return writer;
3178
+ },
3179
+ decode(input, length) {
3180
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
3181
+ let end = length === void 0 ? reader.len : reader.pos + length;
3182
+ const message = createBaseActionEndSavepointRequest();
3183
+ while (reader.pos < end) {
3184
+ const tag = reader.uint32();
3185
+ switch (tag >>> 3) {
3186
+ case 1:
3187
+ if (tag !== 10) break;
3188
+ message.savepointId = reader.bytes();
3189
+ continue;
3190
+ case 2:
3191
+ if (tag !== 16) break;
3192
+ message.action = reader.int32();
3193
+ continue;
3194
+ }
3195
+ if ((tag & 7) === 4 || tag === 0) break;
3196
+ reader.skip(tag & 7);
3197
+ }
3198
+ return message;
3199
+ },
3200
+ fromJSON(object) {
3201
+ return {
3202
+ $type: ActionEndSavepointRequest.$type,
3203
+ savepointId: isSet(object.savepointId) ? bytesFromBase64(object.savepointId) : new Uint8Array(0),
3204
+ action: isSet(object.action) ? actionEndSavepointRequest_EndSavepointFromJSON(object.action) : 0
3205
+ };
3206
+ },
3207
+ toJSON(message) {
3208
+ const obj = {};
3209
+ if (message.savepointId.length !== 0) obj.savepointId = base64FromBytes(message.savepointId);
3210
+ if (message.action !== 0) obj.action = actionEndSavepointRequest_EndSavepointToJSON(message.action);
3211
+ return obj;
3212
+ },
3213
+ create(base) {
3214
+ return ActionEndSavepointRequest.fromPartial(base ?? {});
3215
+ },
3216
+ fromPartial(object) {
3217
+ const message = createBaseActionEndSavepointRequest();
3218
+ message.savepointId = object.savepointId ?? new Uint8Array(0);
3219
+ message.action = object.action ?? 0;
3220
+ return message;
3221
+ }
3222
+ };
3223
+ messageTypeRegistry.set(ActionEndSavepointRequest.$type, ActionEndSavepointRequest);
3224
+ function createBaseCommandStatementQuery() {
3225
+ return {
3226
+ $type: "arrow.flight.protocol.sql.CommandStatementQuery",
3227
+ query: "",
3228
+ transactionId: void 0
3229
+ };
3230
+ }
3231
+ const CommandStatementQuery = {
3232
+ $type: "arrow.flight.protocol.sql.CommandStatementQuery",
3233
+ encode(message, writer = new BinaryWriter()) {
3234
+ if (message.query !== "") writer.uint32(10).string(message.query);
3235
+ if (message.transactionId !== void 0) writer.uint32(18).bytes(message.transactionId);
3236
+ return writer;
3237
+ },
3238
+ decode(input, length) {
3239
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
3240
+ let end = length === void 0 ? reader.len : reader.pos + length;
3241
+ const message = createBaseCommandStatementQuery();
3242
+ while (reader.pos < end) {
3243
+ const tag = reader.uint32();
3244
+ switch (tag >>> 3) {
3245
+ case 1:
3246
+ if (tag !== 10) break;
3247
+ message.query = reader.string();
3248
+ continue;
3249
+ case 2:
3250
+ if (tag !== 18) break;
3251
+ message.transactionId = reader.bytes();
3252
+ continue;
3253
+ }
3254
+ if ((tag & 7) === 4 || tag === 0) break;
3255
+ reader.skip(tag & 7);
3256
+ }
3257
+ return message;
3258
+ },
3259
+ fromJSON(object) {
3260
+ return {
3261
+ $type: CommandStatementQuery.$type,
3262
+ query: isSet(object.query) ? globalThis.String(object.query) : "",
3263
+ transactionId: isSet(object.transactionId) ? bytesFromBase64(object.transactionId) : void 0
3264
+ };
3265
+ },
3266
+ toJSON(message) {
3267
+ const obj = {};
3268
+ if (message.query !== "") obj.query = message.query;
3269
+ if (message.transactionId !== void 0) obj.transactionId = base64FromBytes(message.transactionId);
3270
+ return obj;
3271
+ },
3272
+ create(base) {
3273
+ return CommandStatementQuery.fromPartial(base ?? {});
3274
+ },
3275
+ fromPartial(object) {
3276
+ const message = createBaseCommandStatementQuery();
3277
+ message.query = object.query ?? "";
3278
+ message.transactionId = object.transactionId ?? void 0;
3279
+ return message;
3280
+ }
3281
+ };
3282
+ messageTypeRegistry.set(CommandStatementQuery.$type, CommandStatementQuery);
3283
+ function createBaseCommandStatementSubstraitPlan() {
3284
+ return {
3285
+ $type: "arrow.flight.protocol.sql.CommandStatementSubstraitPlan",
3286
+ plan: void 0,
3287
+ transactionId: void 0
3288
+ };
3289
+ }
3290
+ const CommandStatementSubstraitPlan = {
3291
+ $type: "arrow.flight.protocol.sql.CommandStatementSubstraitPlan",
3292
+ encode(message, writer = new BinaryWriter()) {
3293
+ if (message.plan !== void 0) SubstraitPlan.encode(message.plan, writer.uint32(10).fork()).join();
3294
+ if (message.transactionId !== void 0) writer.uint32(18).bytes(message.transactionId);
3295
+ return writer;
3296
+ },
3297
+ decode(input, length) {
3298
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
3299
+ let end = length === void 0 ? reader.len : reader.pos + length;
3300
+ const message = createBaseCommandStatementSubstraitPlan();
3301
+ while (reader.pos < end) {
3302
+ const tag = reader.uint32();
3303
+ switch (tag >>> 3) {
3304
+ case 1:
3305
+ if (tag !== 10) break;
3306
+ message.plan = SubstraitPlan.decode(reader, reader.uint32());
3307
+ continue;
3308
+ case 2:
3309
+ if (tag !== 18) break;
3310
+ message.transactionId = reader.bytes();
3311
+ continue;
3312
+ }
3313
+ if ((tag & 7) === 4 || tag === 0) break;
3314
+ reader.skip(tag & 7);
3315
+ }
3316
+ return message;
3317
+ },
3318
+ fromJSON(object) {
3319
+ return {
3320
+ $type: CommandStatementSubstraitPlan.$type,
3321
+ plan: isSet(object.plan) ? SubstraitPlan.fromJSON(object.plan) : void 0,
3322
+ transactionId: isSet(object.transactionId) ? bytesFromBase64(object.transactionId) : void 0
3323
+ };
3324
+ },
3325
+ toJSON(message) {
3326
+ const obj = {};
3327
+ if (message.plan !== void 0) obj.plan = SubstraitPlan.toJSON(message.plan);
3328
+ if (message.transactionId !== void 0) obj.transactionId = base64FromBytes(message.transactionId);
3329
+ return obj;
3330
+ },
3331
+ create(base) {
3332
+ return CommandStatementSubstraitPlan.fromPartial(base ?? {});
3333
+ },
3334
+ fromPartial(object) {
3335
+ const message = createBaseCommandStatementSubstraitPlan();
3336
+ message.plan = object.plan !== void 0 && object.plan !== null ? SubstraitPlan.fromPartial(object.plan) : void 0;
3337
+ message.transactionId = object.transactionId ?? void 0;
3338
+ return message;
3339
+ }
3340
+ };
3341
+ messageTypeRegistry.set(CommandStatementSubstraitPlan.$type, CommandStatementSubstraitPlan);
3342
+ function createBaseTicketStatementQuery() {
3343
+ return {
3344
+ $type: "arrow.flight.protocol.sql.TicketStatementQuery",
3345
+ statementHandle: new Uint8Array(0)
3346
+ };
3347
+ }
3348
+ const TicketStatementQuery = {
3349
+ $type: "arrow.flight.protocol.sql.TicketStatementQuery",
3350
+ encode(message, writer = new BinaryWriter()) {
3351
+ if (message.statementHandle.length !== 0) writer.uint32(10).bytes(message.statementHandle);
3352
+ return writer;
3353
+ },
3354
+ decode(input, length) {
3355
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
3356
+ let end = length === void 0 ? reader.len : reader.pos + length;
3357
+ const message = createBaseTicketStatementQuery();
3358
+ while (reader.pos < end) {
3359
+ const tag = reader.uint32();
3360
+ switch (tag >>> 3) {
3361
+ case 1:
3362
+ if (tag !== 10) break;
3363
+ message.statementHandle = reader.bytes();
3364
+ continue;
3365
+ }
3366
+ if ((tag & 7) === 4 || tag === 0) break;
3367
+ reader.skip(tag & 7);
3368
+ }
3369
+ return message;
3370
+ },
3371
+ fromJSON(object) {
3372
+ return {
3373
+ $type: TicketStatementQuery.$type,
3374
+ statementHandle: isSet(object.statementHandle) ? bytesFromBase64(object.statementHandle) : new Uint8Array(0)
3375
+ };
3376
+ },
3377
+ toJSON(message) {
3378
+ const obj = {};
3379
+ if (message.statementHandle.length !== 0) obj.statementHandle = base64FromBytes(message.statementHandle);
3380
+ return obj;
3381
+ },
3382
+ create(base) {
3383
+ return TicketStatementQuery.fromPartial(base ?? {});
3384
+ },
3385
+ fromPartial(object) {
3386
+ const message = createBaseTicketStatementQuery();
3387
+ message.statementHandle = object.statementHandle ?? new Uint8Array(0);
3388
+ return message;
3389
+ }
3390
+ };
3391
+ messageTypeRegistry.set(TicketStatementQuery.$type, TicketStatementQuery);
3392
+ function createBaseCommandPreparedStatementQuery() {
3393
+ return {
3394
+ $type: "arrow.flight.protocol.sql.CommandPreparedStatementQuery",
3395
+ preparedStatementHandle: new Uint8Array(0)
3396
+ };
3397
+ }
3398
+ const CommandPreparedStatementQuery = {
3399
+ $type: "arrow.flight.protocol.sql.CommandPreparedStatementQuery",
3400
+ encode(message, writer = new BinaryWriter()) {
3401
+ if (message.preparedStatementHandle.length !== 0) writer.uint32(10).bytes(message.preparedStatementHandle);
3402
+ return writer;
3403
+ },
3404
+ decode(input, length) {
3405
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
3406
+ let end = length === void 0 ? reader.len : reader.pos + length;
3407
+ const message = createBaseCommandPreparedStatementQuery();
3408
+ while (reader.pos < end) {
3409
+ const tag = reader.uint32();
3410
+ switch (tag >>> 3) {
3411
+ case 1:
3412
+ if (tag !== 10) break;
3413
+ message.preparedStatementHandle = reader.bytes();
3414
+ continue;
3415
+ }
3416
+ if ((tag & 7) === 4 || tag === 0) break;
3417
+ reader.skip(tag & 7);
3418
+ }
3419
+ return message;
3420
+ },
3421
+ fromJSON(object) {
3422
+ return {
3423
+ $type: CommandPreparedStatementQuery.$type,
3424
+ preparedStatementHandle: isSet(object.preparedStatementHandle) ? bytesFromBase64(object.preparedStatementHandle) : new Uint8Array(0)
3425
+ };
3426
+ },
3427
+ toJSON(message) {
3428
+ const obj = {};
3429
+ if (message.preparedStatementHandle.length !== 0) obj.preparedStatementHandle = base64FromBytes(message.preparedStatementHandle);
3430
+ return obj;
3431
+ },
3432
+ create(base) {
3433
+ return CommandPreparedStatementQuery.fromPartial(base ?? {});
3434
+ },
3435
+ fromPartial(object) {
3436
+ const message = createBaseCommandPreparedStatementQuery();
3437
+ message.preparedStatementHandle = object.preparedStatementHandle ?? new Uint8Array(0);
3438
+ return message;
3439
+ }
3440
+ };
3441
+ messageTypeRegistry.set(CommandPreparedStatementQuery.$type, CommandPreparedStatementQuery);
3442
+ function createBaseCommandStatementUpdate() {
3443
+ return {
3444
+ $type: "arrow.flight.protocol.sql.CommandStatementUpdate",
3445
+ query: "",
3446
+ transactionId: void 0
3447
+ };
3448
+ }
3449
+ const CommandStatementUpdate = {
3450
+ $type: "arrow.flight.protocol.sql.CommandStatementUpdate",
3451
+ encode(message, writer = new BinaryWriter()) {
3452
+ if (message.query !== "") writer.uint32(10).string(message.query);
3453
+ if (message.transactionId !== void 0) writer.uint32(18).bytes(message.transactionId);
3454
+ return writer;
3455
+ },
3456
+ decode(input, length) {
3457
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
3458
+ let end = length === void 0 ? reader.len : reader.pos + length;
3459
+ const message = createBaseCommandStatementUpdate();
3460
+ while (reader.pos < end) {
3461
+ const tag = reader.uint32();
3462
+ switch (tag >>> 3) {
3463
+ case 1:
3464
+ if (tag !== 10) break;
3465
+ message.query = reader.string();
3466
+ continue;
3467
+ case 2:
3468
+ if (tag !== 18) break;
3469
+ message.transactionId = reader.bytes();
3470
+ continue;
3471
+ }
3472
+ if ((tag & 7) === 4 || tag === 0) break;
3473
+ reader.skip(tag & 7);
3474
+ }
3475
+ return message;
3476
+ },
3477
+ fromJSON(object) {
3478
+ return {
3479
+ $type: CommandStatementUpdate.$type,
3480
+ query: isSet(object.query) ? globalThis.String(object.query) : "",
3481
+ transactionId: isSet(object.transactionId) ? bytesFromBase64(object.transactionId) : void 0
3482
+ };
3483
+ },
3484
+ toJSON(message) {
3485
+ const obj = {};
3486
+ if (message.query !== "") obj.query = message.query;
3487
+ if (message.transactionId !== void 0) obj.transactionId = base64FromBytes(message.transactionId);
3488
+ return obj;
3489
+ },
3490
+ create(base) {
3491
+ return CommandStatementUpdate.fromPartial(base ?? {});
3492
+ },
3493
+ fromPartial(object) {
3494
+ const message = createBaseCommandStatementUpdate();
3495
+ message.query = object.query ?? "";
3496
+ message.transactionId = object.transactionId ?? void 0;
3497
+ return message;
3498
+ }
3499
+ };
3500
+ messageTypeRegistry.set(CommandStatementUpdate.$type, CommandStatementUpdate);
3501
+ function createBaseCommandPreparedStatementUpdate() {
3502
+ return {
3503
+ $type: "arrow.flight.protocol.sql.CommandPreparedStatementUpdate",
3504
+ preparedStatementHandle: new Uint8Array(0)
3505
+ };
3506
+ }
3507
+ const CommandPreparedStatementUpdate = {
3508
+ $type: "arrow.flight.protocol.sql.CommandPreparedStatementUpdate",
3509
+ encode(message, writer = new BinaryWriter()) {
3510
+ if (message.preparedStatementHandle.length !== 0) writer.uint32(10).bytes(message.preparedStatementHandle);
3511
+ return writer;
3512
+ },
3513
+ decode(input, length) {
3514
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
3515
+ let end = length === void 0 ? reader.len : reader.pos + length;
3516
+ const message = createBaseCommandPreparedStatementUpdate();
3517
+ while (reader.pos < end) {
3518
+ const tag = reader.uint32();
3519
+ switch (tag >>> 3) {
3520
+ case 1:
3521
+ if (tag !== 10) break;
3522
+ message.preparedStatementHandle = reader.bytes();
3523
+ continue;
3524
+ }
3525
+ if ((tag & 7) === 4 || tag === 0) break;
3526
+ reader.skip(tag & 7);
3527
+ }
3528
+ return message;
3529
+ },
3530
+ fromJSON(object) {
3531
+ return {
3532
+ $type: CommandPreparedStatementUpdate.$type,
3533
+ preparedStatementHandle: isSet(object.preparedStatementHandle) ? bytesFromBase64(object.preparedStatementHandle) : new Uint8Array(0)
3534
+ };
3535
+ },
3536
+ toJSON(message) {
3537
+ const obj = {};
3538
+ if (message.preparedStatementHandle.length !== 0) obj.preparedStatementHandle = base64FromBytes(message.preparedStatementHandle);
3539
+ return obj;
3540
+ },
3541
+ create(base) {
3542
+ return CommandPreparedStatementUpdate.fromPartial(base ?? {});
3543
+ },
3544
+ fromPartial(object) {
3545
+ const message = createBaseCommandPreparedStatementUpdate();
3546
+ message.preparedStatementHandle = object.preparedStatementHandle ?? new Uint8Array(0);
3547
+ return message;
3548
+ }
3549
+ };
3550
+ messageTypeRegistry.set(CommandPreparedStatementUpdate.$type, CommandPreparedStatementUpdate);
3551
+ function createBaseCommandStatementIngest() {
3552
+ return {
3553
+ $type: "arrow.flight.protocol.sql.CommandStatementIngest",
3554
+ tableDefinitionOptions: void 0,
3555
+ table: "",
3556
+ schema: void 0,
3557
+ catalog: void 0,
3558
+ temporary: false,
3559
+ transactionId: void 0,
3560
+ options: {}
3561
+ };
3562
+ }
3563
+ const CommandStatementIngest = {
3564
+ $type: "arrow.flight.protocol.sql.CommandStatementIngest",
3565
+ encode(message, writer = new BinaryWriter()) {
3566
+ if (message.tableDefinitionOptions !== void 0) CommandStatementIngest_TableDefinitionOptions.encode(message.tableDefinitionOptions, writer.uint32(10).fork()).join();
3567
+ if (message.table !== "") writer.uint32(18).string(message.table);
3568
+ if (message.schema !== void 0) writer.uint32(26).string(message.schema);
3569
+ if (message.catalog !== void 0) writer.uint32(34).string(message.catalog);
3570
+ if (message.temporary !== false) writer.uint32(40).bool(message.temporary);
3571
+ if (message.transactionId !== void 0) writer.uint32(50).bytes(message.transactionId);
3572
+ Object.entries(message.options).forEach(([key, value]) => {
3573
+ CommandStatementIngest_OptionsEntry.encode({
3574
+ $type: "arrow.flight.protocol.sql.CommandStatementIngest.OptionsEntry",
3575
+ key,
3576
+ value
3577
+ }, writer.uint32(8002).fork()).join();
3578
+ });
3579
+ return writer;
3580
+ },
3581
+ decode(input, length) {
3582
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
3583
+ let end = length === void 0 ? reader.len : reader.pos + length;
3584
+ const message = createBaseCommandStatementIngest();
3585
+ while (reader.pos < end) {
3586
+ const tag = reader.uint32();
3587
+ switch (tag >>> 3) {
3588
+ case 1:
3589
+ if (tag !== 10) break;
3590
+ message.tableDefinitionOptions = CommandStatementIngest_TableDefinitionOptions.decode(reader, reader.uint32());
3591
+ continue;
3592
+ case 2:
3593
+ if (tag !== 18) break;
3594
+ message.table = reader.string();
3595
+ continue;
3596
+ case 3:
3597
+ if (tag !== 26) break;
3598
+ message.schema = reader.string();
3599
+ continue;
3600
+ case 4:
3601
+ if (tag !== 34) break;
3602
+ message.catalog = reader.string();
3603
+ continue;
3604
+ case 5:
3605
+ if (tag !== 40) break;
3606
+ message.temporary = reader.bool();
3607
+ continue;
3608
+ case 6:
3609
+ if (tag !== 50) break;
3610
+ message.transactionId = reader.bytes();
3611
+ continue;
3612
+ case 1e3: {
3613
+ if (tag !== 8002) break;
3614
+ const entry1000 = CommandStatementIngest_OptionsEntry.decode(reader, reader.uint32());
3615
+ if (entry1000.value !== void 0) message.options[entry1000.key] = entry1000.value;
3616
+ continue;
3617
+ }
3618
+ }
3619
+ if ((tag & 7) === 4 || tag === 0) break;
3620
+ reader.skip(tag & 7);
3621
+ }
3622
+ return message;
3623
+ },
3624
+ fromJSON(object) {
3625
+ return {
3626
+ $type: CommandStatementIngest.$type,
3627
+ tableDefinitionOptions: isSet(object.tableDefinitionOptions) ? CommandStatementIngest_TableDefinitionOptions.fromJSON(object.tableDefinitionOptions) : void 0,
3628
+ table: isSet(object.table) ? globalThis.String(object.table) : "",
3629
+ schema: isSet(object.schema) ? globalThis.String(object.schema) : void 0,
3630
+ catalog: isSet(object.catalog) ? globalThis.String(object.catalog) : void 0,
3631
+ temporary: isSet(object.temporary) ? globalThis.Boolean(object.temporary) : false,
3632
+ transactionId: isSet(object.transactionId) ? bytesFromBase64(object.transactionId) : void 0,
3633
+ options: isObject(object.options) ? Object.entries(object.options).reduce((acc, [key, value]) => {
3634
+ acc[key] = String(value);
3635
+ return acc;
3636
+ }, {}) : {}
3637
+ };
3638
+ },
3639
+ toJSON(message) {
3640
+ const obj = {};
3641
+ if (message.tableDefinitionOptions !== void 0) obj.tableDefinitionOptions = CommandStatementIngest_TableDefinitionOptions.toJSON(message.tableDefinitionOptions);
3642
+ if (message.table !== "") obj.table = message.table;
3643
+ if (message.schema !== void 0) obj.schema = message.schema;
3644
+ if (message.catalog !== void 0) obj.catalog = message.catalog;
3645
+ if (message.temporary !== false) obj.temporary = message.temporary;
3646
+ if (message.transactionId !== void 0) obj.transactionId = base64FromBytes(message.transactionId);
3647
+ if (message.options) {
3648
+ const entries = Object.entries(message.options);
3649
+ if (entries.length > 0) {
3650
+ obj.options = {};
3651
+ entries.forEach(([k, v]) => {
3652
+ obj.options[k] = v;
3653
+ });
3654
+ }
3655
+ }
3656
+ return obj;
3657
+ },
3658
+ create(base) {
3659
+ return CommandStatementIngest.fromPartial(base ?? {});
3660
+ },
3661
+ fromPartial(object) {
3662
+ const message = createBaseCommandStatementIngest();
3663
+ message.tableDefinitionOptions = object.tableDefinitionOptions !== void 0 && object.tableDefinitionOptions !== null ? CommandStatementIngest_TableDefinitionOptions.fromPartial(object.tableDefinitionOptions) : void 0;
3664
+ message.table = object.table ?? "";
3665
+ message.schema = object.schema ?? void 0;
3666
+ message.catalog = object.catalog ?? void 0;
3667
+ message.temporary = object.temporary ?? false;
3668
+ message.transactionId = object.transactionId ?? void 0;
3669
+ message.options = Object.entries(object.options ?? {}).reduce((acc, [key, value]) => {
3670
+ if (value !== void 0) acc[key] = globalThis.String(value);
3671
+ return acc;
3672
+ }, {});
3673
+ return message;
3674
+ }
3675
+ };
3676
+ messageTypeRegistry.set(CommandStatementIngest.$type, CommandStatementIngest);
3677
+ function createBaseCommandStatementIngest_TableDefinitionOptions() {
3678
+ return {
3679
+ $type: "arrow.flight.protocol.sql.CommandStatementIngest.TableDefinitionOptions",
3680
+ ifNotExist: 0,
3681
+ ifExists: 0
3682
+ };
3683
+ }
3684
+ const CommandStatementIngest_TableDefinitionOptions = {
3685
+ $type: "arrow.flight.protocol.sql.CommandStatementIngest.TableDefinitionOptions",
3686
+ encode(message, writer = new BinaryWriter()) {
3687
+ if (message.ifNotExist !== 0) writer.uint32(8).int32(message.ifNotExist);
3688
+ if (message.ifExists !== 0) writer.uint32(16).int32(message.ifExists);
3689
+ return writer;
3690
+ },
3691
+ decode(input, length) {
3692
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
3693
+ let end = length === void 0 ? reader.len : reader.pos + length;
3694
+ const message = createBaseCommandStatementIngest_TableDefinitionOptions();
3695
+ while (reader.pos < end) {
3696
+ const tag = reader.uint32();
3697
+ switch (tag >>> 3) {
3698
+ case 1:
3699
+ if (tag !== 8) break;
3700
+ message.ifNotExist = reader.int32();
3701
+ continue;
3702
+ case 2:
3703
+ if (tag !== 16) break;
3704
+ message.ifExists = reader.int32();
3705
+ continue;
3706
+ }
3707
+ if ((tag & 7) === 4 || tag === 0) break;
3708
+ reader.skip(tag & 7);
3709
+ }
3710
+ return message;
3711
+ },
3712
+ fromJSON(object) {
3713
+ return {
3714
+ $type: CommandStatementIngest_TableDefinitionOptions.$type,
3715
+ ifNotExist: isSet(object.ifNotExist) ? commandStatementIngest_TableDefinitionOptions_TableNotExistOptionFromJSON(object.ifNotExist) : 0,
3716
+ ifExists: isSet(object.ifExists) ? commandStatementIngest_TableDefinitionOptions_TableExistsOptionFromJSON(object.ifExists) : 0
3717
+ };
3718
+ },
3719
+ toJSON(message) {
3720
+ const obj = {};
3721
+ if (message.ifNotExist !== 0) obj.ifNotExist = commandStatementIngest_TableDefinitionOptions_TableNotExistOptionToJSON(message.ifNotExist);
3722
+ if (message.ifExists !== 0) obj.ifExists = commandStatementIngest_TableDefinitionOptions_TableExistsOptionToJSON(message.ifExists);
3723
+ return obj;
3724
+ },
3725
+ create(base) {
3726
+ return CommandStatementIngest_TableDefinitionOptions.fromPartial(base ?? {});
3727
+ },
3728
+ fromPartial(object) {
3729
+ const message = createBaseCommandStatementIngest_TableDefinitionOptions();
3730
+ message.ifNotExist = object.ifNotExist ?? 0;
3731
+ message.ifExists = object.ifExists ?? 0;
3732
+ return message;
3733
+ }
3734
+ };
3735
+ messageTypeRegistry.set(CommandStatementIngest_TableDefinitionOptions.$type, CommandStatementIngest_TableDefinitionOptions);
3736
+ function createBaseCommandStatementIngest_OptionsEntry() {
3737
+ return {
3738
+ $type: "arrow.flight.protocol.sql.CommandStatementIngest.OptionsEntry",
3739
+ key: "",
3740
+ value: ""
3741
+ };
3742
+ }
3743
+ const CommandStatementIngest_OptionsEntry = {
3744
+ $type: "arrow.flight.protocol.sql.CommandStatementIngest.OptionsEntry",
3745
+ encode(message, writer = new BinaryWriter()) {
3746
+ if (message.key !== "") writer.uint32(10).string(message.key);
3747
+ if (message.value !== "") writer.uint32(18).string(message.value);
3748
+ return writer;
3749
+ },
3750
+ decode(input, length) {
3751
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
3752
+ let end = length === void 0 ? reader.len : reader.pos + length;
3753
+ const message = createBaseCommandStatementIngest_OptionsEntry();
3754
+ while (reader.pos < end) {
3755
+ const tag = reader.uint32();
3756
+ switch (tag >>> 3) {
3757
+ case 1:
3758
+ if (tag !== 10) break;
3759
+ message.key = reader.string();
3760
+ continue;
3761
+ case 2:
3762
+ if (tag !== 18) break;
3763
+ message.value = reader.string();
3764
+ continue;
3765
+ }
3766
+ if ((tag & 7) === 4 || tag === 0) break;
3767
+ reader.skip(tag & 7);
3768
+ }
3769
+ return message;
3770
+ },
3771
+ fromJSON(object) {
3772
+ return {
3773
+ $type: CommandStatementIngest_OptionsEntry.$type,
3774
+ key: isSet(object.key) ? globalThis.String(object.key) : "",
3775
+ value: isSet(object.value) ? globalThis.String(object.value) : ""
3776
+ };
3777
+ },
3778
+ toJSON(message) {
3779
+ const obj = {};
3780
+ if (message.key !== "") obj.key = message.key;
3781
+ if (message.value !== "") obj.value = message.value;
3782
+ return obj;
3783
+ },
3784
+ create(base) {
3785
+ return CommandStatementIngest_OptionsEntry.fromPartial(base ?? {});
3786
+ },
3787
+ fromPartial(object) {
3788
+ const message = createBaseCommandStatementIngest_OptionsEntry();
3789
+ message.key = object.key ?? "";
3790
+ message.value = object.value ?? "";
3791
+ return message;
3792
+ }
3793
+ };
3794
+ messageTypeRegistry.set(CommandStatementIngest_OptionsEntry.$type, CommandStatementIngest_OptionsEntry);
3795
+ function createBaseDoPutUpdateResult() {
3796
+ return {
3797
+ $type: "arrow.flight.protocol.sql.DoPutUpdateResult",
3798
+ recordCount: 0n
3799
+ };
3800
+ }
3801
+ const DoPutUpdateResult = {
3802
+ $type: "arrow.flight.protocol.sql.DoPutUpdateResult",
3803
+ encode(message, writer = new BinaryWriter()) {
3804
+ if (message.recordCount !== 0n) {
3805
+ if (BigInt.asIntN(64, message.recordCount) !== message.recordCount) throw new globalThis.Error("value provided for field message.recordCount of type int64 too large");
3806
+ writer.uint32(8).int64(message.recordCount);
3807
+ }
3808
+ return writer;
3809
+ },
3810
+ decode(input, length) {
3811
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
3812
+ let end = length === void 0 ? reader.len : reader.pos + length;
3813
+ const message = createBaseDoPutUpdateResult();
3814
+ while (reader.pos < end) {
3815
+ const tag = reader.uint32();
3816
+ switch (tag >>> 3) {
3817
+ case 1:
3818
+ if (tag !== 8) break;
3819
+ message.recordCount = reader.int64();
3820
+ continue;
3821
+ }
3822
+ if ((tag & 7) === 4 || tag === 0) break;
3823
+ reader.skip(tag & 7);
3824
+ }
3825
+ return message;
3826
+ },
3827
+ fromJSON(object) {
3828
+ return {
3829
+ $type: DoPutUpdateResult.$type,
3830
+ recordCount: isSet(object.recordCount) ? BigInt(object.recordCount) : 0n
3831
+ };
3832
+ },
3833
+ toJSON(message) {
3834
+ const obj = {};
3835
+ if (message.recordCount !== 0n) obj.recordCount = message.recordCount.toString();
3836
+ return obj;
3837
+ },
3838
+ create(base) {
3839
+ return DoPutUpdateResult.fromPartial(base ?? {});
3840
+ },
3841
+ fromPartial(object) {
3842
+ const message = createBaseDoPutUpdateResult();
3843
+ message.recordCount = object.recordCount ?? 0n;
3844
+ return message;
3845
+ }
3846
+ };
3847
+ messageTypeRegistry.set(DoPutUpdateResult.$type, DoPutUpdateResult);
3848
+ function createBaseDoPutPreparedStatementResult() {
3849
+ return {
3850
+ $type: "arrow.flight.protocol.sql.DoPutPreparedStatementResult",
3851
+ preparedStatementHandle: void 0
3852
+ };
3853
+ }
3854
+ const DoPutPreparedStatementResult = {
3855
+ $type: "arrow.flight.protocol.sql.DoPutPreparedStatementResult",
3856
+ encode(message, writer = new BinaryWriter()) {
3857
+ if (message.preparedStatementHandle !== void 0) writer.uint32(10).bytes(message.preparedStatementHandle);
3858
+ return writer;
3859
+ },
3860
+ decode(input, length) {
3861
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
3862
+ let end = length === void 0 ? reader.len : reader.pos + length;
3863
+ const message = createBaseDoPutPreparedStatementResult();
3864
+ while (reader.pos < end) {
3865
+ const tag = reader.uint32();
3866
+ switch (tag >>> 3) {
3867
+ case 1:
3868
+ if (tag !== 10) break;
3869
+ message.preparedStatementHandle = reader.bytes();
3870
+ continue;
3871
+ }
3872
+ if ((tag & 7) === 4 || tag === 0) break;
3873
+ reader.skip(tag & 7);
3874
+ }
3875
+ return message;
3876
+ },
3877
+ fromJSON(object) {
3878
+ return {
3879
+ $type: DoPutPreparedStatementResult.$type,
3880
+ preparedStatementHandle: isSet(object.preparedStatementHandle) ? bytesFromBase64(object.preparedStatementHandle) : void 0
3881
+ };
3882
+ },
3883
+ toJSON(message) {
3884
+ const obj = {};
3885
+ if (message.preparedStatementHandle !== void 0) obj.preparedStatementHandle = base64FromBytes(message.preparedStatementHandle);
3886
+ return obj;
3887
+ },
3888
+ create(base) {
3889
+ return DoPutPreparedStatementResult.fromPartial(base ?? {});
3890
+ },
3891
+ fromPartial(object) {
3892
+ const message = createBaseDoPutPreparedStatementResult();
3893
+ message.preparedStatementHandle = object.preparedStatementHandle ?? void 0;
3894
+ return message;
3895
+ }
3896
+ };
3897
+ messageTypeRegistry.set(DoPutPreparedStatementResult.$type, DoPutPreparedStatementResult);
3898
+ function createBaseActionCancelQueryRequest() {
3899
+ return {
3900
+ $type: "arrow.flight.protocol.sql.ActionCancelQueryRequest",
3901
+ info: new Uint8Array(0)
3902
+ };
3903
+ }
3904
+ const ActionCancelQueryRequest = {
3905
+ $type: "arrow.flight.protocol.sql.ActionCancelQueryRequest",
3906
+ encode(message, writer = new BinaryWriter()) {
3907
+ if (message.info.length !== 0) writer.uint32(10).bytes(message.info);
3908
+ return writer;
3909
+ },
3910
+ decode(input, length) {
3911
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
3912
+ let end = length === void 0 ? reader.len : reader.pos + length;
3913
+ const message = createBaseActionCancelQueryRequest();
3914
+ while (reader.pos < end) {
3915
+ const tag = reader.uint32();
3916
+ switch (tag >>> 3) {
3917
+ case 1:
3918
+ if (tag !== 10) break;
3919
+ message.info = reader.bytes();
3920
+ continue;
3921
+ }
3922
+ if ((tag & 7) === 4 || tag === 0) break;
3923
+ reader.skip(tag & 7);
3924
+ }
3925
+ return message;
3926
+ },
3927
+ fromJSON(object) {
3928
+ return {
3929
+ $type: ActionCancelQueryRequest.$type,
3930
+ info: isSet(object.info) ? bytesFromBase64(object.info) : new Uint8Array(0)
3931
+ };
3932
+ },
3933
+ toJSON(message) {
3934
+ const obj = {};
3935
+ if (message.info.length !== 0) obj.info = base64FromBytes(message.info);
3936
+ return obj;
3937
+ },
3938
+ create(base) {
3939
+ return ActionCancelQueryRequest.fromPartial(base ?? {});
3940
+ },
3941
+ fromPartial(object) {
3942
+ const message = createBaseActionCancelQueryRequest();
3943
+ message.info = object.info ?? new Uint8Array(0);
3944
+ return message;
3945
+ }
3946
+ };
3947
+ messageTypeRegistry.set(ActionCancelQueryRequest.$type, ActionCancelQueryRequest);
3948
+ function createBaseActionCancelQueryResult() {
3949
+ return {
3950
+ $type: "arrow.flight.protocol.sql.ActionCancelQueryResult",
3951
+ result: 0
3952
+ };
3953
+ }
3954
+ const ActionCancelQueryResult = {
3955
+ $type: "arrow.flight.protocol.sql.ActionCancelQueryResult",
3956
+ encode(message, writer = new BinaryWriter()) {
3957
+ if (message.result !== 0) writer.uint32(8).int32(message.result);
3958
+ return writer;
3959
+ },
3960
+ decode(input, length) {
3961
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
3962
+ let end = length === void 0 ? reader.len : reader.pos + length;
3963
+ const message = createBaseActionCancelQueryResult();
3964
+ while (reader.pos < end) {
3965
+ const tag = reader.uint32();
3966
+ switch (tag >>> 3) {
3967
+ case 1:
3968
+ if (tag !== 8) break;
3969
+ message.result = reader.int32();
3970
+ continue;
3971
+ }
3972
+ if ((tag & 7) === 4 || tag === 0) break;
3973
+ reader.skip(tag & 7);
3974
+ }
3975
+ return message;
3976
+ },
3977
+ fromJSON(object) {
3978
+ return {
3979
+ $type: ActionCancelQueryResult.$type,
3980
+ result: isSet(object.result) ? actionCancelQueryResult_CancelResultFromJSON(object.result) : 0
3981
+ };
3982
+ },
3983
+ toJSON(message) {
3984
+ const obj = {};
3985
+ if (message.result !== 0) obj.result = actionCancelQueryResult_CancelResultToJSON(message.result);
3986
+ return obj;
3987
+ },
3988
+ create(base) {
3989
+ return ActionCancelQueryResult.fromPartial(base ?? {});
3990
+ },
3991
+ fromPartial(object) {
3992
+ const message = createBaseActionCancelQueryResult();
3993
+ message.result = object.result ?? 0;
3994
+ return message;
3995
+ }
3996
+ };
3997
+ messageTypeRegistry.set(ActionCancelQueryResult.$type, ActionCancelQueryResult);
3998
+ function bytesFromBase64(b64) {
3999
+ if (globalThis.Buffer) return Uint8Array.from(globalThis.Buffer.from(b64, "base64"));
4000
+ else {
4001
+ const bin = globalThis.atob(b64);
4002
+ const arr = new Uint8Array(bin.length);
4003
+ for (let i = 0; i < bin.length; ++i) arr[i] = bin.charCodeAt(i);
4004
+ return arr;
4005
+ }
4006
+ }
4007
+ function base64FromBytes(arr) {
4008
+ if (globalThis.Buffer) return globalThis.Buffer.from(arr).toString("base64");
4009
+ else {
4010
+ const bin = [];
4011
+ arr.forEach((byte) => {
4012
+ bin.push(globalThis.String.fromCharCode(byte));
4013
+ });
4014
+ return globalThis.btoa(bin.join(""));
4015
+ }
4016
+ }
4017
+ function isObject(value) {
4018
+ return typeof value === "object" && value !== null;
4019
+ }
4020
+ function isSet(value) {
4021
+ return value !== null && value !== void 0;
4022
+ }
4023
+
4024
+ //#endregion
4025
+ //#region src/arrow-flight-sql.ts
4026
+ var ArrowFlightSqlClient = class {
4027
+ inner;
4028
+ constructor(config, options = {}) {
4029
+ this.inner = new ArrowFlightClient(config, options);
4030
+ }
4031
+ executeFlightInfo(request, options) {
4032
+ return this.inner.executeFlightInfo(request, options);
4033
+ }
4034
+ async getCatalogs(request, options) {
4035
+ const descriptor = createCommandDescriptor(CommandGetCatalogs.$type, CommandGetCatalogs.encode({
4036
+ $type: CommandGetCatalogs.$type,
4037
+ ...request
4038
+ }).finish());
4039
+ return this.inner.getFlightInfo(descriptor, options);
4040
+ }
4041
+ async getDbSchemas(request, options) {
4042
+ const descriptor = createCommandDescriptor(CommandGetDbSchemas.$type, CommandGetDbSchemas.encode({
4043
+ $type: CommandGetDbSchemas.$type,
4044
+ ...request
4045
+ }).finish());
4046
+ return this.inner.getFlightInfo(descriptor, options);
4047
+ }
4048
+ async getTables(request, options) {
4049
+ const descriptor = createCommandDescriptor(CommandGetTables.$type, CommandGetTables.encode({
4050
+ $type: CommandGetTables.$type,
4051
+ ...request
4052
+ }).finish());
4053
+ return this.inner.getFlightInfo(descriptor, options);
4054
+ }
4055
+ async getTableTypes(request, options) {
4056
+ const descriptor = createCommandDescriptor(CommandGetTableTypes.$type, CommandGetTableTypes.encode({
4057
+ $type: CommandGetTableTypes.$type,
4058
+ ...request
4059
+ }).finish());
4060
+ return this.inner.getFlightInfo(descriptor, options);
4061
+ }
4062
+ async executeQuery(request, options) {
4063
+ const descriptor = createCommandDescriptor(CommandStatementQuery.$type, CommandStatementQuery.encode({
4064
+ $type: CommandStatementQuery.$type,
4065
+ ...request
4066
+ }).finish());
4067
+ return this.inner.getFlightInfo(descriptor, options);
4068
+ }
4069
+ };
4070
+ function createCommandDescriptor(typeUrl, value) {
4071
+ const cmd = Any.create({
4072
+ typeUrl: `type.googleapis.com/${typeUrl}`,
4073
+ value
4074
+ });
4075
+ return FlightDescriptor.create({
4076
+ type: FlightDescriptor_DescriptorType.CMD,
4077
+ cmd: Any.encode(cmd).finish()
4078
+ });
4079
+ }
4080
+
4081
+ //#endregion
4082
+ //#region src/flight-data-encoder.ts
4083
+ const FlightDataEncoder = {
4084
+ encodeSchema(schema, { flightDescriptor, appMetadata }) {
4085
+ const message = Message.from(schema);
4086
+ return FlightData.create({
4087
+ dataHeader: Message.encode(message),
4088
+ appMetadata,
4089
+ flightDescriptor
4090
+ });
4091
+ },
4092
+ encodeBatch(batch, { appMetadata } = {}) {
4093
+ const { byteLength, nodes, bufferRegions, buffers } = VectorAssembler.assemble(batch);
4094
+ const metadataRecordBatch = new metadata.RecordBatch(batch.numRows, nodes, bufferRegions, null);
4095
+ const message = Message.from(metadataRecordBatch, byteLength);
4096
+ return [FlightData.create({
4097
+ dataHeader: Message.encode(message),
4098
+ appMetadata: appMetadata?.({
4099
+ index: 0,
4100
+ length: 1
4101
+ }),
4102
+ dataBody: encodeRecordBatchContent(buffers, byteLength, null)
4103
+ })];
4104
+ }
4105
+ };
4106
+ function encodeRecordBatchContent(buffers, byteLength, compression = null) {
4107
+ const out = new Uint8Array(byteLength);
4108
+ const bufGroupSize = compression != null ? 2 : 1;
4109
+ const bufs = new Array(bufGroupSize);
4110
+ let pos = 0;
4111
+ for (let i = 0; i < buffers.length; i += bufGroupSize) {
4112
+ let size = 0;
4113
+ for (let j = -1; ++j < bufGroupSize;) {
4114
+ bufs[j] = buffers[i + j];
4115
+ size += bufs[j].byteLength;
4116
+ }
4117
+ if (size === 0) continue;
4118
+ for (const buf of bufs) {
4119
+ out.set(new Uint8Array(buf.buffer, buf.byteOffset, buf.byteLength), pos);
4120
+ pos += buf.byteLength;
4121
+ }
4122
+ const padding = (size + 7 & -8) - size;
4123
+ if (padding > 0) {
4124
+ out.set(new Uint8Array(padding), pos);
4125
+ pos += padding;
4126
+ }
4127
+ }
4128
+ return out;
4129
+ }
4130
+
4131
+ //#endregion
4132
+ export { ArrowFlightClient, ArrowFlightSqlClient, FlightData, FlightDataEncoder, FlightDescriptor, FlightDescriptor_DescriptorType, Metadata, PutResult, Ticket, createChannelFromConfig };
4133
+ //# sourceMappingURL=index.js.map