@meshagent/meshagent-ts-auth 0.46.4 → 0.47.1

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.
@@ -14693,10 +14693,10 @@ ${err.toString()}`);
14693
14693
  return false;
14694
14694
  }
14695
14695
  }
14696
- async _sendToolCallResponseChunk(messageId, toolCallId, chunk) {
14696
+ _sendToolCallResponseChunk(messageId, toolCallId, chunk) {
14697
14697
  const [header, payload] = (0, utils_js_1.unpackMessage)(chunk.pack());
14698
14698
  try {
14699
- await this.client.protocol.send("room.tool_call_response_chunk", (0, utils_js_1.packMessage)({ tool_call_id: toolCallId, chunk: header }, payload.length > 0 ? payload : void 0), { id: messageId });
14699
+ this.client.protocol.sendNowait("room.tool_call_response_chunk", (0, utils_js_1.packMessage)({ tool_call_id: toolCallId, chunk: header }, payload.length > 0 ? payload : void 0), { id: messageId });
14700
14700
  return true;
14701
14701
  } catch (error) {
14702
14702
  console.debug("unable to send tool call response chunk", error);
@@ -14792,10 +14792,10 @@ ${err.toString()}`);
14792
14792
  return;
14793
14793
  for await (const chunk of output.stream) {
14794
14794
  this.toolkit.validateOutputContent(tool, chunk);
14795
- if (!await this._sendToolCallResponseChunk(messageId, toolCallId, chunk))
14795
+ if (!this._sendToolCallResponseChunk(messageId, toolCallId, chunk))
14796
14796
  return;
14797
14797
  }
14798
- await this._sendToolCallResponseChunk(messageId, toolCallId, new response_js_1.ControlContent({ method: "close" }));
14798
+ this._sendToolCallResponseChunk(messageId, toolCallId, new response_js_1.ControlContent({ method: "close" }));
14799
14799
  return;
14800
14800
  }
14801
14801
  throw new Error(`tool ${toolName} returned unsupported output`);
@@ -14805,9 +14805,9 @@ ${err.toString()}`);
14805
14805
  return;
14806
14806
  }
14807
14807
  if (!(error instanceof InvalidToolDataException)) {
14808
- await this._sendToolCallResponseChunk(messageId, toolCallId, new response_js_1.ErrorContent({ text: String(error) }));
14808
+ this._sendToolCallResponseChunk(messageId, toolCallId, new response_js_1.ErrorContent({ text: String(error) }));
14809
14809
  }
14810
- await this._sendToolCallResponseChunk(messageId, toolCallId, new response_js_1.ControlContent({
14810
+ this._sendToolCallResponseChunk(messageId, toolCallId, new response_js_1.ControlContent({
14811
14811
  method: "close",
14812
14812
  statusCode: error instanceof InvalidToolDataException ? response_js_1.ControlCloseStatus.INVALID_DATA : void 0,
14813
14813
  message: error instanceof InvalidToolDataException ? error.message : void 0
@@ -17279,8 +17279,9 @@ ${err.toString()}`);
17279
17279
  function rebaseValueOffsets(offset, length, valueOffsets) {
17280
17280
  if (offset !== 0) {
17281
17281
  valueOffsets = valueOffsets.slice(0, length);
17282
+ const delta = typeof valueOffsets[0] === "bigint" ? BigInt(offset) : offset;
17282
17283
  for (let i = -1, n = valueOffsets.length; ++i < n; ) {
17283
- valueOffsets[i] += offset;
17284
+ valueOffsets[i] += delta;
17284
17285
  }
17285
17286
  }
17286
17287
  return valueOffsets.subarray(0, length);
@@ -18718,8 +18719,32 @@ ${err.toString()}`);
18718
18719
  const offset = this.bb.__offset(this.bb_pos, 10);
18719
18720
  return offset ? (obj || new body_compression_js_1.BodyCompression()).__init(this.bb.__indirect(this.bb_pos + offset), this.bb) : null;
18720
18721
  }
18722
+ /**
18723
+ * Some types such as Utf8View are represented using a variable number of buffers.
18724
+ * For each such Field in the pre-ordered flattened logical schema, there will be
18725
+ * an entry in variadicBufferCounts to indicate the number of number of variadic
18726
+ * buffers which belong to that Field in the current RecordBatch.
18727
+ *
18728
+ * For example, the schema
18729
+ * col1: Struct<alpha: Int32, beta: BinaryView, gamma: Float64>
18730
+ * col2: Utf8View
18731
+ * contains two Fields with variadic buffers so variadicBufferCounts will have
18732
+ * two entries, the first counting the variadic buffers of `col1.beta` and the
18733
+ * second counting `col2`'s.
18734
+ *
18735
+ * This field may be omitted if and only if the schema contains no Fields with
18736
+ * a variable number of buffers, such as BinaryView and Utf8View.
18737
+ */
18738
+ variadicBufferCounts(index) {
18739
+ const offset = this.bb.__offset(this.bb_pos, 12);
18740
+ return offset ? this.bb.readInt64(this.bb.__vector(this.bb_pos + offset) + index * 8) : BigInt(0);
18741
+ }
18742
+ variadicBufferCountsLength() {
18743
+ const offset = this.bb.__offset(this.bb_pos, 12);
18744
+ return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
18745
+ }
18721
18746
  static startRecordBatch(builder) {
18722
- builder.startObject(4);
18747
+ builder.startObject(5);
18723
18748
  }
18724
18749
  static addLength(builder, length) {
18725
18750
  builder.addFieldInt64(0, length, BigInt("0"));
@@ -18739,6 +18764,19 @@ ${err.toString()}`);
18739
18764
  static addCompression(builder, compressionOffset) {
18740
18765
  builder.addFieldOffset(3, compressionOffset, 0);
18741
18766
  }
18767
+ static addVariadicBufferCounts(builder, variadicBufferCountsOffset) {
18768
+ builder.addFieldOffset(4, variadicBufferCountsOffset, 0);
18769
+ }
18770
+ static createVariadicBufferCountsVector(builder, data) {
18771
+ builder.startVector(8, data.length, 8);
18772
+ for (let i = data.length - 1; i >= 0; i--) {
18773
+ builder.addInt64(data[i]);
18774
+ }
18775
+ return builder.endVector();
18776
+ }
18777
+ static startVariadicBufferCountsVector(builder, numElems) {
18778
+ builder.startVector(8, numElems, 8);
18779
+ }
18742
18780
  static endRecordBatch(builder) {
18743
18781
  const offset = builder.endObject();
18744
18782
  return offset;
@@ -19074,6 +19112,46 @@ ${err.toString()}`);
19074
19112
  }
19075
19113
  });
19076
19114
 
19115
+ // ../node_modules/apache-arrow/fb/binary-view.js
19116
+ var require_binary_view = __commonJS({
19117
+ "../node_modules/apache-arrow/fb/binary-view.js"(exports) {
19118
+ "use strict";
19119
+ Object.defineProperty(exports, "__esModule", { value: true });
19120
+ exports.BinaryView = void 0;
19121
+ var flatbuffers = (init_flatbuffers(), __toCommonJS(flatbuffers_exports));
19122
+ var BinaryView = class _BinaryView {
19123
+ constructor() {
19124
+ this.bb = null;
19125
+ this.bb_pos = 0;
19126
+ }
19127
+ __init(i, bb) {
19128
+ this.bb_pos = i;
19129
+ this.bb = bb;
19130
+ return this;
19131
+ }
19132
+ static getRootAsBinaryView(bb, obj) {
19133
+ return (obj || new _BinaryView()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
19134
+ }
19135
+ static getSizePrefixedRootAsBinaryView(bb, obj) {
19136
+ bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
19137
+ return (obj || new _BinaryView()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
19138
+ }
19139
+ static startBinaryView(builder) {
19140
+ builder.startObject(0);
19141
+ }
19142
+ static endBinaryView(builder) {
19143
+ const offset = builder.endObject();
19144
+ return offset;
19145
+ }
19146
+ static createBinaryView(builder) {
19147
+ _BinaryView.startBinaryView(builder);
19148
+ return _BinaryView.endBinaryView(builder);
19149
+ }
19150
+ };
19151
+ exports.BinaryView = BinaryView;
19152
+ }
19153
+ });
19154
+
19077
19155
  // ../node_modules/apache-arrow/fb/bool.js
19078
19156
  var require_bool = __commonJS({
19079
19157
  "../node_modules/apache-arrow/fb/bool.js"(exports) {
@@ -19566,6 +19644,46 @@ ${err.toString()}`);
19566
19644
  }
19567
19645
  });
19568
19646
 
19647
+ // ../node_modules/apache-arrow/fb/large-list-view.js
19648
+ var require_large_list_view = __commonJS({
19649
+ "../node_modules/apache-arrow/fb/large-list-view.js"(exports) {
19650
+ "use strict";
19651
+ Object.defineProperty(exports, "__esModule", { value: true });
19652
+ exports.LargeListView = void 0;
19653
+ var flatbuffers = (init_flatbuffers(), __toCommonJS(flatbuffers_exports));
19654
+ var LargeListView = class _LargeListView {
19655
+ constructor() {
19656
+ this.bb = null;
19657
+ this.bb_pos = 0;
19658
+ }
19659
+ __init(i, bb) {
19660
+ this.bb_pos = i;
19661
+ this.bb = bb;
19662
+ return this;
19663
+ }
19664
+ static getRootAsLargeListView(bb, obj) {
19665
+ return (obj || new _LargeListView()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
19666
+ }
19667
+ static getSizePrefixedRootAsLargeListView(bb, obj) {
19668
+ bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
19669
+ return (obj || new _LargeListView()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
19670
+ }
19671
+ static startLargeListView(builder) {
19672
+ builder.startObject(0);
19673
+ }
19674
+ static endLargeListView(builder) {
19675
+ const offset = builder.endObject();
19676
+ return offset;
19677
+ }
19678
+ static createLargeListView(builder) {
19679
+ _LargeListView.startLargeListView(builder);
19680
+ return _LargeListView.endLargeListView(builder);
19681
+ }
19682
+ };
19683
+ exports.LargeListView = LargeListView;
19684
+ }
19685
+ });
19686
+
19569
19687
  // ../node_modules/apache-arrow/fb/large-utf8.js
19570
19688
  var require_large_utf8 = __commonJS({
19571
19689
  "../node_modules/apache-arrow/fb/large-utf8.js"(exports) {
@@ -19646,6 +19764,46 @@ ${err.toString()}`);
19646
19764
  }
19647
19765
  });
19648
19766
 
19767
+ // ../node_modules/apache-arrow/fb/list-view.js
19768
+ var require_list_view = __commonJS({
19769
+ "../node_modules/apache-arrow/fb/list-view.js"(exports) {
19770
+ "use strict";
19771
+ Object.defineProperty(exports, "__esModule", { value: true });
19772
+ exports.ListView = void 0;
19773
+ var flatbuffers = (init_flatbuffers(), __toCommonJS(flatbuffers_exports));
19774
+ var ListView = class _ListView {
19775
+ constructor() {
19776
+ this.bb = null;
19777
+ this.bb_pos = 0;
19778
+ }
19779
+ __init(i, bb) {
19780
+ this.bb_pos = i;
19781
+ this.bb = bb;
19782
+ return this;
19783
+ }
19784
+ static getRootAsListView(bb, obj) {
19785
+ return (obj || new _ListView()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
19786
+ }
19787
+ static getSizePrefixedRootAsListView(bb, obj) {
19788
+ bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
19789
+ return (obj || new _ListView()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
19790
+ }
19791
+ static startListView(builder) {
19792
+ builder.startObject(0);
19793
+ }
19794
+ static endListView(builder) {
19795
+ const offset = builder.endObject();
19796
+ return offset;
19797
+ }
19798
+ static createListView(builder) {
19799
+ _ListView.startListView(builder);
19800
+ return _ListView.endListView(builder);
19801
+ }
19802
+ };
19803
+ exports.ListView = ListView;
19804
+ }
19805
+ });
19806
+
19649
19807
  // ../node_modules/apache-arrow/fb/map.js
19650
19808
  var require_map = __commonJS({
19651
19809
  "../node_modules/apache-arrow/fb/map.js"(exports) {
@@ -20046,6 +20204,46 @@ ${err.toString()}`);
20046
20204
  }
20047
20205
  });
20048
20206
 
20207
+ // ../node_modules/apache-arrow/fb/utf8-view.js
20208
+ var require_utf8_view = __commonJS({
20209
+ "../node_modules/apache-arrow/fb/utf8-view.js"(exports) {
20210
+ "use strict";
20211
+ Object.defineProperty(exports, "__esModule", { value: true });
20212
+ exports.Utf8View = void 0;
20213
+ var flatbuffers = (init_flatbuffers(), __toCommonJS(flatbuffers_exports));
20214
+ var Utf8View = class _Utf8View {
20215
+ constructor() {
20216
+ this.bb = null;
20217
+ this.bb_pos = 0;
20218
+ }
20219
+ __init(i, bb) {
20220
+ this.bb_pos = i;
20221
+ this.bb = bb;
20222
+ return this;
20223
+ }
20224
+ static getRootAsUtf8View(bb, obj) {
20225
+ return (obj || new _Utf8View()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
20226
+ }
20227
+ static getSizePrefixedRootAsUtf8View(bb, obj) {
20228
+ bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
20229
+ return (obj || new _Utf8View()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
20230
+ }
20231
+ static startUtf8View(builder) {
20232
+ builder.startObject(0);
20233
+ }
20234
+ static endUtf8View(builder) {
20235
+ const offset = builder.endObject();
20236
+ return offset;
20237
+ }
20238
+ static createUtf8View(builder) {
20239
+ _Utf8View.startUtf8View(builder);
20240
+ return _Utf8View.endUtf8View(builder);
20241
+ }
20242
+ };
20243
+ exports.Utf8View = Utf8View;
20244
+ }
20245
+ });
20246
+
20049
20247
  // ../node_modules/apache-arrow/fb/type.js
20050
20248
  var require_type = __commonJS({
20051
20249
  "../node_modules/apache-arrow/fb/type.js"(exports) {
@@ -20053,6 +20251,7 @@ ${err.toString()}`);
20053
20251
  Object.defineProperty(exports, "__esModule", { value: true });
20054
20252
  exports.unionListToType = exports.unionToType = exports.Type = void 0;
20055
20253
  var binary_js_1 = require_binary();
20254
+ var binary_view_js_1 = require_binary_view();
20056
20255
  var bool_js_1 = require_bool();
20057
20256
  var date_js_1 = require_date();
20058
20257
  var decimal_js_1 = require_decimal();
@@ -20064,8 +20263,10 @@ ${err.toString()}`);
20064
20263
  var interval_js_1 = require_interval();
20065
20264
  var large_binary_js_1 = require_large_binary();
20066
20265
  var large_list_js_1 = require_large_list();
20266
+ var large_list_view_js_1 = require_large_list_view();
20067
20267
  var large_utf8_js_1 = require_large_utf8();
20068
20268
  var list_js_1 = require_list();
20269
+ var list_view_js_1 = require_list_view();
20069
20270
  var map_js_1 = require_map();
20070
20271
  var null_js_1 = require_null();
20071
20272
  var run_end_encoded_js_1 = require_run_end_encoded();
@@ -20074,6 +20275,7 @@ ${err.toString()}`);
20074
20275
  var timestamp_js_1 = require_timestamp();
20075
20276
  var union_js_1 = require_union();
20076
20277
  var utf8_js_1 = require_utf82();
20278
+ var utf8_view_js_1 = require_utf8_view();
20077
20279
  var Type;
20078
20280
  (function(Type2) {
20079
20281
  Type2[Type2["NONE"] = 0] = "NONE";
@@ -20099,6 +20301,10 @@ ${err.toString()}`);
20099
20301
  Type2[Type2["LargeUtf8"] = 20] = "LargeUtf8";
20100
20302
  Type2[Type2["LargeList"] = 21] = "LargeList";
20101
20303
  Type2[Type2["RunEndEncoded"] = 22] = "RunEndEncoded";
20304
+ Type2[Type2["BinaryView"] = 23] = "BinaryView";
20305
+ Type2[Type2["Utf8View"] = 24] = "Utf8View";
20306
+ Type2[Type2["ListView"] = 25] = "ListView";
20307
+ Type2[Type2["LargeListView"] = 26] = "LargeListView";
20102
20308
  })(Type || (exports.Type = Type = {}));
20103
20309
  function unionToType(type, accessor) {
20104
20310
  switch (Type[type]) {
@@ -20148,6 +20354,14 @@ ${err.toString()}`);
20148
20354
  return accessor(new large_list_js_1.LargeList());
20149
20355
  case "RunEndEncoded":
20150
20356
  return accessor(new run_end_encoded_js_1.RunEndEncoded());
20357
+ case "BinaryView":
20358
+ return accessor(new binary_view_js_1.BinaryView());
20359
+ case "Utf8View":
20360
+ return accessor(new utf8_view_js_1.Utf8View());
20361
+ case "ListView":
20362
+ return accessor(new list_view_js_1.ListView());
20363
+ case "LargeListView":
20364
+ return accessor(new large_list_view_js_1.LargeListView());
20151
20365
  default:
20152
20366
  return null;
20153
20367
  }
@@ -20201,6 +20415,14 @@ ${err.toString()}`);
20201
20415
  return accessor(index, new large_list_js_1.LargeList());
20202
20416
  case "RunEndEncoded":
20203
20417
  return accessor(index, new run_end_encoded_js_1.RunEndEncoded());
20418
+ case "BinaryView":
20419
+ return accessor(index, new binary_view_js_1.BinaryView());
20420
+ case "Utf8View":
20421
+ return accessor(index, new utf8_view_js_1.Utf8View());
20422
+ case "ListView":
20423
+ return accessor(index, new list_view_js_1.ListView());
20424
+ case "LargeListView":
20425
+ return accessor(index, new large_list_view_js_1.LargeListView());
20204
20426
  default:
20205
20427
  return null;
20206
20428
  }
@@ -20453,12 +20675,6 @@ ${err.toString()}`);
20453
20675
  const offset = builder.endObject();
20454
20676
  return offset;
20455
20677
  }
20456
- static finishSchemaBuffer(builder, offset) {
20457
- builder.finish(offset);
20458
- }
20459
- static finishSizePrefixedSchemaBuffer(builder, offset) {
20460
- builder.finish(offset, void 0, true);
20461
- }
20462
20678
  static createSchema(builder, endianness, fieldsOffset, customMetadataOffset, featuresOffset) {
20463
20679
  _Schema.startSchema(builder);
20464
20680
  _Schema.addEndianness(builder, endianness);
@@ -21372,6 +21588,9 @@ ${err.toString()}`);
21372
21588
  Type2[Type2["Duration"] = 18] = "Duration";
21373
21589
  Type2[Type2["LargeBinary"] = 19] = "LargeBinary";
21374
21590
  Type2[Type2["LargeUtf8"] = 20] = "LargeUtf8";
21591
+ Type2[Type2["LargeList"] = 21] = "LargeList";
21592
+ Type2[Type2["BinaryView"] = 23] = "BinaryView";
21593
+ Type2[Type2["Utf8View"] = 24] = "Utf8View";
21375
21594
  Type2[Type2["Dictionary"] = -1] = "Dictionary";
21376
21595
  Type2[Type2["Int8"] = -2] = "Int8";
21377
21596
  Type2[Type2["Int16"] = -3] = "Int16";
@@ -21672,12 +21891,28 @@ ${err.toString()}`);
21672
21891
  var _v;
21673
21892
  var _w;
21674
21893
  var _x;
21894
+ var _y;
21895
+ var _z;
21896
+ var _0;
21675
21897
  Object.defineProperty(exports, "__esModule", { value: true });
21676
- exports.FixedSizeList = exports.FixedSizeBinary = exports.SparseUnion = exports.DenseUnion = exports.Union = exports.Struct = exports.List = exports.DurationNanosecond = exports.DurationMicrosecond = exports.DurationMillisecond = exports.DurationSecond = exports.Duration = exports.IntervalMonthDayNano = exports.IntervalYearMonth = exports.IntervalDayTime = exports.Interval = exports.TimestampNanosecond = exports.TimestampMicrosecond = exports.TimestampMillisecond = exports.TimestampSecond = exports.Timestamp = exports.TimeNanosecond = exports.TimeMicrosecond = exports.TimeMillisecond = exports.TimeSecond = exports.Time = exports.DateMillisecond = exports.DateDay = exports.Date_ = exports.Decimal = exports.Bool = exports.LargeUtf8 = exports.Utf8 = exports.LargeBinary = exports.Binary = exports.Float64 = exports.Float32 = exports.Float16 = exports.Float = exports.Uint64 = exports.Uint32 = exports.Uint16 = exports.Uint8 = exports.Int64 = exports.Int32 = exports.Int16 = exports.Int8 = exports.Int = exports.Null = exports.DataType = void 0;
21677
- exports.strideForType = exports.Dictionary = exports.Map_ = void 0;
21898
+ exports.DenseUnion = exports.Union = exports.Struct = exports.LargeList = exports.List = exports.DurationNanosecond = exports.DurationMicrosecond = exports.DurationMillisecond = exports.DurationSecond = exports.Duration = exports.IntervalMonthDayNano = exports.IntervalYearMonth = exports.IntervalDayTime = exports.Interval = exports.TimestampNanosecond = exports.TimestampMicrosecond = exports.TimestampMillisecond = exports.TimestampSecond = exports.Timestamp = exports.TimeNanosecond = exports.TimeMicrosecond = exports.TimeMillisecond = exports.TimeSecond = exports.Time = exports.DateMillisecond = exports.DateDay = exports.Date_ = exports.Decimal = exports.Bool = exports.LargeUtf8 = exports.Utf8View = exports.Utf8 = exports.LargeBinary = exports.BinaryView = exports.Binary = exports.Float64 = exports.Float32 = exports.Float16 = exports.Float = exports.Uint64 = exports.Uint32 = exports.Uint16 = exports.Uint8 = exports.Int64 = exports.Int32 = exports.Int16 = exports.Int8 = exports.Int = exports.Null = exports.DataType = void 0;
21899
+ exports.strideForType = exports.Dictionary = exports.Map_ = exports.FixedSizeList = exports.FixedSizeBinary = exports.SparseUnion = void 0;
21678
21900
  var bigint_js_1 = require_bigint();
21679
21901
  var enum_js_1 = require_enum();
21902
+ var kDataTypeSymbol = /* @__PURE__ */ Symbol.for("apache-arrow/DataType");
21680
21903
  var DataType = class _DataType {
21904
+ /**
21905
+ * Check if an object is an instance of DataType.
21906
+ * This works across different instances of the Arrow library.
21907
+ *
21908
+ * Note: We intentionally do NOT implement Symbol.hasInstance here because
21909
+ * it would break instanceof checks for subclasses like Struct, Dictionary, etc.
21910
+ * Use DataType.isDataType() for cross-library type checking instead.
21911
+ * @nocollapse
21912
+ */
21913
+ static isDataType(x) {
21914
+ return (x === null || x === void 0 ? void 0 : x[kDataTypeSymbol]) === true;
21915
+ }
21681
21916
  /** @nocollapse */
21682
21917
  static isNull(x) {
21683
21918
  return (x === null || x === void 0 ? void 0 : x.typeId) === enum_js_1.Type.Null;
@@ -21695,6 +21930,10 @@ ${err.toString()}`);
21695
21930
  return (x === null || x === void 0 ? void 0 : x.typeId) === enum_js_1.Type.Binary;
21696
21931
  }
21697
21932
  /** @nocollapse */
21933
+ static isBinaryView(x) {
21934
+ return (x === null || x === void 0 ? void 0 : x.typeId) === enum_js_1.Type.BinaryView;
21935
+ }
21936
+ /** @nocollapse */
21698
21937
  static isLargeBinary(x) {
21699
21938
  return (x === null || x === void 0 ? void 0 : x.typeId) === enum_js_1.Type.LargeBinary;
21700
21939
  }
@@ -21703,6 +21942,10 @@ ${err.toString()}`);
21703
21942
  return (x === null || x === void 0 ? void 0 : x.typeId) === enum_js_1.Type.Utf8;
21704
21943
  }
21705
21944
  /** @nocollapse */
21945
+ static isUtf8View(x) {
21946
+ return (x === null || x === void 0 ? void 0 : x.typeId) === enum_js_1.Type.Utf8View;
21947
+ }
21948
+ /** @nocollapse */
21706
21949
  static isLargeUtf8(x) {
21707
21950
  return (x === null || x === void 0 ? void 0 : x.typeId) === enum_js_1.Type.LargeUtf8;
21708
21951
  }
@@ -21739,6 +21982,12 @@ ${err.toString()}`);
21739
21982
  return (x === null || x === void 0 ? void 0 : x.typeId) === enum_js_1.Type.List;
21740
21983
  }
21741
21984
  /** @nocollapse */
21985
+ static isLargeList(x) {
21986
+ return (x === null || x === void 0 ? void 0 : x.typeId) === enum_js_1.Type.LargeList;
21987
+ }
21988
+ // TODO: Implement ListView type
21989
+ // /** @nocollapse */ static isListView(x: any): x is ListView { return x?.typeId === Type.ListView; }
21990
+ /** @nocollapse */
21742
21991
  static isStruct(x) {
21743
21992
  return (x === null || x === void 0 ? void 0 : x.typeId) === enum_js_1.Type.Struct;
21744
21993
  }
@@ -21780,6 +22029,7 @@ ${err.toString()}`);
21780
22029
  proto.children = null;
21781
22030
  proto.ArrayType = Array;
21782
22031
  proto.OffsetArrayType = Int32Array;
22032
+ proto[kDataTypeSymbol] = true;
21783
22033
  return proto[Symbol.toStringTag] = "DataType";
21784
22034
  })(DataType.prototype);
21785
22035
  var Null = class extends DataType {
@@ -21964,6 +22214,26 @@ ${err.toString()}`);
21964
22214
  proto.ArrayType = Uint8Array;
21965
22215
  return proto[Symbol.toStringTag] = "Binary";
21966
22216
  })(Binary.prototype);
22217
+ var BinaryView = class extends DataType {
22218
+ constructor() {
22219
+ super(enum_js_1.Type.BinaryView);
22220
+ }
22221
+ toString() {
22222
+ return `BinaryView`;
22223
+ }
22224
+ };
22225
+ exports.BinaryView = BinaryView;
22226
+ _f = Symbol.toStringTag;
22227
+ BinaryView.ELEMENT_WIDTH = 16;
22228
+ BinaryView.INLINE_CAPACITY = 12;
22229
+ BinaryView.LENGTH_OFFSET = 0;
22230
+ BinaryView.INLINE_OFFSET = 4;
22231
+ BinaryView.BUFFER_INDEX_OFFSET = 8;
22232
+ BinaryView.BUFFER_OFFSET_OFFSET = 12;
22233
+ BinaryView[_f] = ((proto) => {
22234
+ proto.ArrayType = Uint8Array;
22235
+ return proto[Symbol.toStringTag] = "BinaryView";
22236
+ })(BinaryView.prototype);
21967
22237
  var LargeBinary = class extends DataType {
21968
22238
  constructor() {
21969
22239
  super(enum_js_1.Type.LargeBinary);
@@ -21973,8 +22243,8 @@ ${err.toString()}`);
21973
22243
  }
21974
22244
  };
21975
22245
  exports.LargeBinary = LargeBinary;
21976
- _f = Symbol.toStringTag;
21977
- LargeBinary[_f] = ((proto) => {
22246
+ _g = Symbol.toStringTag;
22247
+ LargeBinary[_g] = ((proto) => {
21978
22248
  proto.ArrayType = Uint8Array;
21979
22249
  proto.OffsetArrayType = BigInt64Array;
21980
22250
  return proto[Symbol.toStringTag] = "LargeBinary";
@@ -21988,11 +22258,27 @@ ${err.toString()}`);
21988
22258
  }
21989
22259
  };
21990
22260
  exports.Utf8 = Utf8;
21991
- _g = Symbol.toStringTag;
21992
- Utf8[_g] = ((proto) => {
22261
+ _h = Symbol.toStringTag;
22262
+ Utf8[_h] = ((proto) => {
21993
22263
  proto.ArrayType = Uint8Array;
21994
22264
  return proto[Symbol.toStringTag] = "Utf8";
21995
22265
  })(Utf8.prototype);
22266
+ var Utf8View = class extends DataType {
22267
+ constructor() {
22268
+ super(enum_js_1.Type.Utf8View);
22269
+ }
22270
+ toString() {
22271
+ return `Utf8View`;
22272
+ }
22273
+ };
22274
+ exports.Utf8View = Utf8View;
22275
+ _j = Symbol.toStringTag;
22276
+ Utf8View.ELEMENT_WIDTH = BinaryView.ELEMENT_WIDTH;
22277
+ Utf8View.INLINE_CAPACITY = BinaryView.INLINE_CAPACITY;
22278
+ Utf8View[_j] = ((proto) => {
22279
+ proto.ArrayType = Uint8Array;
22280
+ return proto[Symbol.toStringTag] = "Utf8View";
22281
+ })(Utf8View.prototype);
21996
22282
  var LargeUtf8 = class extends DataType {
21997
22283
  constructor() {
21998
22284
  super(enum_js_1.Type.LargeUtf8);
@@ -22002,8 +22288,8 @@ ${err.toString()}`);
22002
22288
  }
22003
22289
  };
22004
22290
  exports.LargeUtf8 = LargeUtf8;
22005
- _h = Symbol.toStringTag;
22006
- LargeUtf8[_h] = ((proto) => {
22291
+ _k = Symbol.toStringTag;
22292
+ LargeUtf8[_k] = ((proto) => {
22007
22293
  proto.ArrayType = Uint8Array;
22008
22294
  proto.OffsetArrayType = BigInt64Array;
22009
22295
  return proto[Symbol.toStringTag] = "LargeUtf8";
@@ -22017,8 +22303,8 @@ ${err.toString()}`);
22017
22303
  }
22018
22304
  };
22019
22305
  exports.Bool = Bool;
22020
- _j = Symbol.toStringTag;
22021
- Bool[_j] = ((proto) => {
22306
+ _l = Symbol.toStringTag;
22307
+ Bool[_l] = ((proto) => {
22022
22308
  proto.ArrayType = Uint8Array;
22023
22309
  return proto[Symbol.toStringTag] = "Bool";
22024
22310
  })(Bool.prototype);
@@ -22034,8 +22320,8 @@ ${err.toString()}`);
22034
22320
  }
22035
22321
  };
22036
22322
  exports.Decimal = Decimal;
22037
- _k = Symbol.toStringTag;
22038
- Decimal[_k] = ((proto) => {
22323
+ _m = Symbol.toStringTag;
22324
+ Decimal[_m] = ((proto) => {
22039
22325
  proto.scale = null;
22040
22326
  proto.precision = null;
22041
22327
  proto.ArrayType = Uint32Array;
@@ -22054,8 +22340,8 @@ ${err.toString()}`);
22054
22340
  }
22055
22341
  };
22056
22342
  exports.Date_ = Date_;
22057
- _l = Symbol.toStringTag;
22058
- Date_[_l] = ((proto) => {
22343
+ _o = Symbol.toStringTag;
22344
+ Date_[_o] = ((proto) => {
22059
22345
  proto.unit = null;
22060
22346
  return proto[Symbol.toStringTag] = "Date";
22061
22347
  })(Date_.prototype);
@@ -22091,8 +22377,8 @@ ${err.toString()}`);
22091
22377
  }
22092
22378
  };
22093
22379
  exports.Time = Time_;
22094
- _m = Symbol.toStringTag;
22095
- Time_[_m] = ((proto) => {
22380
+ _p = Symbol.toStringTag;
22381
+ Time_[_p] = ((proto) => {
22096
22382
  proto.unit = null;
22097
22383
  proto.bitWidth = null;
22098
22384
  return proto[Symbol.toStringTag] = "Time";
@@ -22132,8 +22418,8 @@ ${err.toString()}`);
22132
22418
  }
22133
22419
  };
22134
22420
  exports.Timestamp = Timestamp_;
22135
- _o = Symbol.toStringTag;
22136
- Timestamp_[_o] = ((proto) => {
22421
+ _q = Symbol.toStringTag;
22422
+ Timestamp_[_q] = ((proto) => {
22137
22423
  proto.unit = null;
22138
22424
  proto.timezone = null;
22139
22425
  proto.ArrayType = BigInt64Array;
@@ -22173,8 +22459,8 @@ ${err.toString()}`);
22173
22459
  }
22174
22460
  };
22175
22461
  exports.Interval = Interval_;
22176
- _p = Symbol.toStringTag;
22177
- Interval_[_p] = ((proto) => {
22462
+ _r = Symbol.toStringTag;
22463
+ Interval_[_r] = ((proto) => {
22178
22464
  proto.unit = null;
22179
22465
  proto.ArrayType = Int32Array;
22180
22466
  return proto[Symbol.toStringTag] = "Interval";
@@ -22207,8 +22493,8 @@ ${err.toString()}`);
22207
22493
  }
22208
22494
  };
22209
22495
  exports.Duration = Duration;
22210
- _q = Symbol.toStringTag;
22211
- Duration[_q] = ((proto) => {
22496
+ _s = Symbol.toStringTag;
22497
+ Duration[_s] = ((proto) => {
22212
22498
  proto.unit = null;
22213
22499
  proto.ArrayType = BigInt64Array;
22214
22500
  return proto[Symbol.toStringTag] = "Duration";
@@ -22256,11 +22542,36 @@ ${err.toString()}`);
22256
22542
  }
22257
22543
  };
22258
22544
  exports.List = List;
22259
- _r = Symbol.toStringTag;
22260
- List[_r] = ((proto) => {
22545
+ _t = Symbol.toStringTag;
22546
+ List[_t] = ((proto) => {
22261
22547
  proto.children = null;
22262
22548
  return proto[Symbol.toStringTag] = "List";
22263
22549
  })(List.prototype);
22550
+ var LargeList = class extends DataType {
22551
+ constructor(child) {
22552
+ super(enum_js_1.Type.LargeList);
22553
+ this.children = [child];
22554
+ }
22555
+ toString() {
22556
+ return `LargeList<${this.valueType}>`;
22557
+ }
22558
+ get valueType() {
22559
+ return this.children[0].type;
22560
+ }
22561
+ get valueField() {
22562
+ return this.children[0];
22563
+ }
22564
+ get ArrayType() {
22565
+ return this.valueType.ArrayType;
22566
+ }
22567
+ };
22568
+ exports.LargeList = LargeList;
22569
+ _u = Symbol.toStringTag;
22570
+ LargeList[_u] = ((proto) => {
22571
+ proto.children = null;
22572
+ proto.OffsetArrayType = BigInt64Array;
22573
+ return proto[Symbol.toStringTag] = "LargeList";
22574
+ })(LargeList.prototype);
22264
22575
  var Struct = class extends DataType {
22265
22576
  constructor(children) {
22266
22577
  super(enum_js_1.Type.Struct);
@@ -22271,8 +22582,8 @@ ${err.toString()}`);
22271
22582
  }
22272
22583
  };
22273
22584
  exports.Struct = Struct;
22274
- _s = Symbol.toStringTag;
22275
- Struct[_s] = ((proto) => {
22585
+ _v = Symbol.toStringTag;
22586
+ Struct[_v] = ((proto) => {
22276
22587
  proto.children = null;
22277
22588
  return proto[Symbol.toStringTag] = "Struct";
22278
22589
  })(Struct.prototype);
@@ -22289,8 +22600,8 @@ ${err.toString()}`);
22289
22600
  }
22290
22601
  };
22291
22602
  exports.Union = Union_;
22292
- _t = Symbol.toStringTag;
22293
- Union_[_t] = ((proto) => {
22603
+ _w = Symbol.toStringTag;
22604
+ Union_[_w] = ((proto) => {
22294
22605
  proto.mode = null;
22295
22606
  proto.typeIds = null;
22296
22607
  proto.children = null;
@@ -22320,8 +22631,8 @@ ${err.toString()}`);
22320
22631
  }
22321
22632
  };
22322
22633
  exports.FixedSizeBinary = FixedSizeBinary;
22323
- _u = Symbol.toStringTag;
22324
- FixedSizeBinary[_u] = ((proto) => {
22634
+ _x = Symbol.toStringTag;
22635
+ FixedSizeBinary[_x] = ((proto) => {
22325
22636
  proto.byteWidth = null;
22326
22637
  proto.ArrayType = Uint8Array;
22327
22638
  return proto[Symbol.toStringTag] = "FixedSizeBinary";
@@ -22346,26 +22657,26 @@ ${err.toString()}`);
22346
22657
  }
22347
22658
  };
22348
22659
  exports.FixedSizeList = FixedSizeList;
22349
- _v = Symbol.toStringTag;
22350
- FixedSizeList[_v] = ((proto) => {
22660
+ _y = Symbol.toStringTag;
22661
+ FixedSizeList[_y] = ((proto) => {
22351
22662
  proto.children = null;
22352
22663
  proto.listSize = null;
22353
22664
  return proto[Symbol.toStringTag] = "FixedSizeList";
22354
22665
  })(FixedSizeList.prototype);
22355
22666
  var Map_ = class extends DataType {
22356
22667
  constructor(entries, keysSorted = false) {
22357
- var _y, _z, _0;
22668
+ var _1, _2, _3;
22358
22669
  super(enum_js_1.Type.Map);
22359
22670
  this.children = [entries];
22360
22671
  this.keysSorted = keysSorted;
22361
22672
  if (entries) {
22362
22673
  entries["name"] = "entries";
22363
- if ((_y = entries === null || entries === void 0 ? void 0 : entries.type) === null || _y === void 0 ? void 0 : _y.children) {
22364
- const key = (_z = entries === null || entries === void 0 ? void 0 : entries.type) === null || _z === void 0 ? void 0 : _z.children[0];
22674
+ if ((_1 = entries === null || entries === void 0 ? void 0 : entries.type) === null || _1 === void 0 ? void 0 : _1.children) {
22675
+ const key = (_2 = entries === null || entries === void 0 ? void 0 : entries.type) === null || _2 === void 0 ? void 0 : _2.children[0];
22365
22676
  if (key) {
22366
22677
  key["name"] = "key";
22367
22678
  }
22368
- const val = (_0 = entries === null || entries === void 0 ? void 0 : entries.type) === null || _0 === void 0 ? void 0 : _0.children[1];
22679
+ const val = (_3 = entries === null || entries === void 0 ? void 0 : entries.type) === null || _3 === void 0 ? void 0 : _3.children[1];
22369
22680
  if (val) {
22370
22681
  val["name"] = "value";
22371
22682
  }
@@ -22386,8 +22697,8 @@ ${err.toString()}`);
22386
22697
  }
22387
22698
  };
22388
22699
  exports.Map_ = Map_;
22389
- _w = Symbol.toStringTag;
22390
- Map_[_w] = ((proto) => {
22700
+ _z = Symbol.toStringTag;
22701
+ Map_[_z] = ((proto) => {
22391
22702
  proto.children = null;
22392
22703
  proto.keysSorted = null;
22393
22704
  return proto[Symbol.toStringTag] = "Map_";
@@ -22415,8 +22726,8 @@ ${err.toString()}`);
22415
22726
  }
22416
22727
  };
22417
22728
  exports.Dictionary = Dictionary;
22418
- _x = Symbol.toStringTag;
22419
- Dictionary[_x] = ((proto) => {
22729
+ _0 = Symbol.toStringTag;
22730
+ Dictionary[_0] = ((proto) => {
22420
22731
  proto.id = null;
22421
22732
  proto.indices = null;
22422
22733
  proto.isOrdered = null;
@@ -22436,6 +22747,9 @@ ${err.toString()}`);
22436
22747
  }
22437
22748
  // case Type.Int: return 1 + +((t as Int_).bitWidth > 32);
22438
22749
  // case Type.Time: return 1 + +((t as Time_).bitWidth > 32);
22750
+ case enum_js_1.Type.BinaryView:
22751
+ case enum_js_1.Type.Utf8View:
22752
+ return 16;
22439
22753
  case enum_js_1.Type.FixedSizeList:
22440
22754
  return t.listSize;
22441
22755
  case enum_js_1.Type.FixedSizeBinary:
@@ -22487,12 +22801,18 @@ ${err.toString()}`);
22487
22801
  visitLargeUtf8(_node, ..._args) {
22488
22802
  return null;
22489
22803
  }
22804
+ visitUtf8View(_node, ..._args) {
22805
+ return null;
22806
+ }
22490
22807
  visitBinary(_node, ..._args) {
22491
22808
  return null;
22492
22809
  }
22493
22810
  visitLargeBinary(_node, ..._args) {
22494
22811
  return null;
22495
22812
  }
22813
+ visitBinaryView(_node, ..._args) {
22814
+ return null;
22815
+ }
22496
22816
  visitFixedSizeBinary(_node, ..._args) {
22497
22817
  return null;
22498
22818
  }
@@ -22511,6 +22831,9 @@ ${err.toString()}`);
22511
22831
  visitList(_node, ..._args) {
22512
22832
  return null;
22513
22833
  }
22834
+ visitLargeList(_node, ..._args) {
22835
+ return null;
22836
+ }
22514
22837
  visitStruct(_node, ..._args) {
22515
22838
  return null;
22516
22839
  }
@@ -22603,12 +22926,18 @@ ${err.toString()}`);
22603
22926
  case enum_js_1.Type.LargeUtf8:
22604
22927
  fn = visitor.visitLargeUtf8;
22605
22928
  break;
22929
+ case enum_js_1.Type.Utf8View:
22930
+ fn = visitor.visitUtf8View || visitor.visitUtf8;
22931
+ break;
22606
22932
  case enum_js_1.Type.Binary:
22607
22933
  fn = visitor.visitBinary;
22608
22934
  break;
22609
22935
  case enum_js_1.Type.LargeBinary:
22610
22936
  fn = visitor.visitLargeBinary;
22611
22937
  break;
22938
+ case enum_js_1.Type.BinaryView:
22939
+ fn = visitor.visitBinaryView || visitor.visitBinary;
22940
+ break;
22612
22941
  case enum_js_1.Type.FixedSizeBinary:
22613
22942
  fn = visitor.visitFixedSizeBinary;
22614
22943
  break;
@@ -22657,6 +22986,9 @@ ${err.toString()}`);
22657
22986
  case enum_js_1.Type.List:
22658
22987
  fn = visitor.visitList;
22659
22988
  break;
22989
+ case enum_js_1.Type.LargeList:
22990
+ fn = visitor.visitLargeList;
22991
+ break;
22660
22992
  case enum_js_1.Type.Struct:
22661
22993
  fn = visitor.visitStruct;
22662
22994
  break;
@@ -22744,10 +23076,14 @@ ${err.toString()}`);
22744
23076
  return enum_js_1.Type.Binary;
22745
23077
  case enum_js_1.Type.LargeBinary:
22746
23078
  return enum_js_1.Type.LargeBinary;
23079
+ case enum_js_1.Type.BinaryView:
23080
+ return enum_js_1.Type.BinaryView;
22747
23081
  case enum_js_1.Type.Utf8:
22748
23082
  return enum_js_1.Type.Utf8;
22749
23083
  case enum_js_1.Type.LargeUtf8:
22750
23084
  return enum_js_1.Type.LargeUtf8;
23085
+ case enum_js_1.Type.Utf8View:
23086
+ return enum_js_1.Type.Utf8View;
22751
23087
  case enum_js_1.Type.Bool:
22752
23088
  return enum_js_1.Type.Bool;
22753
23089
  case enum_js_1.Type.Decimal:
@@ -22810,6 +23146,8 @@ ${err.toString()}`);
22810
23146
  return enum_js_1.Type.Map;
22811
23147
  case enum_js_1.Type.List:
22812
23148
  return enum_js_1.Type.List;
23149
+ case enum_js_1.Type.LargeList:
23150
+ return enum_js_1.Type.LargeList;
22813
23151
  case enum_js_1.Type.Struct:
22814
23152
  return enum_js_1.Type.Struct;
22815
23153
  case enum_js_1.Type.Union:
@@ -22924,6 +23262,7 @@ ${err.toString()}`);
22924
23262
  var utf8_js_1 = require_utf8();
22925
23263
  var math_js_1 = require_math();
22926
23264
  var enum_js_1 = require_enum();
23265
+ var type_js_1 = require_type2();
22927
23266
  var SetVisitor = class extends visitor_js_1.Visitor {
22928
23267
  };
22929
23268
  exports.SetVisitor = SetVisitor;
@@ -22985,7 +23324,51 @@ ${err.toString()}`);
22985
23324
  };
22986
23325
  exports.setFixedSizeBinary = setFixedSizeBinary;
22987
23326
  var setBinary = ({ values, valueOffsets }, index, value) => (0, exports.setVariableWidthBytes)(values, valueOffsets, index, value);
23327
+ var ensureWritableVariadicBuffers = (data) => {
23328
+ let buffers = data.variadicBuffers;
23329
+ if (!Array.isArray(buffers) || Object.isFrozen(buffers)) {
23330
+ buffers = Array.from(buffers);
23331
+ data.variadicBuffers = buffers;
23332
+ }
23333
+ return buffers;
23334
+ };
23335
+ var setBinaryViewBytes = (data, index, bytes) => {
23336
+ var _a2, _b2, _c, _d;
23337
+ const views = data.values;
23338
+ if (!views) {
23339
+ throw new Error("BinaryView data is missing view buffer");
23340
+ }
23341
+ const elementWidth = type_js_1.BinaryView.ELEMENT_WIDTH;
23342
+ const viewOffset = index * elementWidth;
23343
+ const end = viewOffset + elementWidth;
23344
+ if (viewOffset < 0 || end > views.length) {
23345
+ throw new RangeError(`BinaryView index ${index} out of bounds`);
23346
+ }
23347
+ views.fill(0, viewOffset, end);
23348
+ const view = new DataView(views.buffer, views.byteOffset + viewOffset, elementWidth);
23349
+ const length = bytes.length;
23350
+ view.setInt32(type_js_1.BinaryView.LENGTH_OFFSET, length, true);
23351
+ if (length <= type_js_1.BinaryView.INLINE_CAPACITY) {
23352
+ views.set(bytes, viewOffset + type_js_1.BinaryView.INLINE_OFFSET);
23353
+ return;
23354
+ }
23355
+ const prefix = ((_a2 = bytes[0]) !== null && _a2 !== void 0 ? _a2 : 0) | ((_b2 = bytes[1]) !== null && _b2 !== void 0 ? _b2 : 0) << 8 | ((_c = bytes[2]) !== null && _c !== void 0 ? _c : 0) << 16 | ((_d = bytes[3]) !== null && _d !== void 0 ? _d : 0) << 24;
23356
+ view.setUint32(type_js_1.BinaryView.INLINE_OFFSET, prefix >>> 0, true);
23357
+ const buffers = ensureWritableVariadicBuffers(data);
23358
+ const copy = bytes.slice();
23359
+ const bufferIndex = buffers.push(copy) - 1;
23360
+ view.setInt32(type_js_1.BinaryView.BUFFER_INDEX_OFFSET, bufferIndex, true);
23361
+ view.setInt32(type_js_1.BinaryView.BUFFER_OFFSET_OFFSET, 0, true);
23362
+ };
23363
+ var setBinaryView = (data, index, value) => {
23364
+ const bytes = value instanceof Uint8Array ? value : new Uint8Array(value);
23365
+ setBinaryViewBytes(data, index, bytes);
23366
+ };
22988
23367
  var setUtf8 = ({ values, valueOffsets }, index, value) => (0, exports.setVariableWidthBytes)(values, valueOffsets, index, (0, utf8_js_1.encodeUtf8)(value));
23368
+ var setUtf8View = (data, index, value) => {
23369
+ const bytes = (0, utf8_js_1.encodeUtf8)(value);
23370
+ setBinaryViewBytes(data, index, bytes);
23371
+ };
22989
23372
  var setDate = (data, index, value) => {
22990
23373
  data.type.unit === enum_js_1.DateUnit.DAY ? (0, exports.setDateDay)(data, index, value) : (0, exports.setDateMillisecond)(data, index, value);
22991
23374
  };
@@ -23056,12 +23439,14 @@ ${err.toString()}`);
23056
23439
  const values = data.children[0];
23057
23440
  const valueOffsets = data.valueOffsets;
23058
23441
  const set = exports.instance.getVisitFn(values);
23442
+ const begin = (0, bigint_js_1.bigIntToNumber)(valueOffsets[index]);
23443
+ const end = (0, bigint_js_1.bigIntToNumber)(valueOffsets[index + 1]);
23059
23444
  if (Array.isArray(value)) {
23060
- for (let idx = -1, itr = valueOffsets[index], end = valueOffsets[index + 1]; itr < end; ) {
23445
+ for (let idx = -1, itr = begin; itr < end; ) {
23061
23446
  set(values, itr++, value[++idx]);
23062
23447
  }
23063
23448
  } else {
23064
- for (let idx = -1, itr = valueOffsets[index], end = valueOffsets[index + 1]; itr < end; ) {
23449
+ for (let idx = -1, itr = begin; itr < end; ) {
23065
23450
  set(values, itr++, value.get(++idx));
23066
23451
  }
23067
23452
  }
@@ -23186,8 +23571,10 @@ ${err.toString()}`);
23186
23571
  SetVisitor.prototype.visitFloat64 = wrapSet(exports.setFloat);
23187
23572
  SetVisitor.prototype.visitUtf8 = wrapSet(setUtf8);
23188
23573
  SetVisitor.prototype.visitLargeUtf8 = wrapSet(setUtf8);
23574
+ SetVisitor.prototype.visitUtf8View = wrapSet(setUtf8View);
23189
23575
  SetVisitor.prototype.visitBinary = wrapSet(setBinary);
23190
23576
  SetVisitor.prototype.visitLargeBinary = wrapSet(setBinary);
23577
+ SetVisitor.prototype.visitBinaryView = wrapSet(setBinaryView);
23191
23578
  SetVisitor.prototype.visitFixedSizeBinary = wrapSet(exports.setFixedSizeBinary);
23192
23579
  SetVisitor.prototype.visitDate = wrapSet(exports.setDate);
23193
23580
  SetVisitor.prototype.visitDateDay = wrapSet(exports.setDateDay);
@@ -23204,6 +23591,7 @@ ${err.toString()}`);
23204
23591
  SetVisitor.prototype.visitTimeNanosecond = wrapSet(exports.setTimeNanosecond);
23205
23592
  SetVisitor.prototype.visitDecimal = wrapSet(exports.setDecimal);
23206
23593
  SetVisitor.prototype.visitList = wrapSet(setList);
23594
+ SetVisitor.prototype.visitLargeList = wrapSet(setList);
23207
23595
  SetVisitor.prototype.visitStruct = wrapSet(setStruct);
23208
23596
  SetVisitor.prototype.visitUnion = wrapSet(setUnion);
23209
23597
  SetVisitor.prototype.visitDenseUnion = wrapSet(setDenseUnion);
@@ -23366,6 +23754,8 @@ ${err.toString()}`);
23366
23754
  return (data, _1) => data.getValid(_1) ? fn(data, _1) : null;
23367
23755
  }
23368
23756
  var epochDaysToMs = (data, index) => 864e5 * data[index];
23757
+ var BINARY_VIEW_SIZE = 16;
23758
+ var BINARY_VIEW_INLINE_CAPACITY = 12;
23369
23759
  var getNull = (_data, _index) => null;
23370
23760
  var getVariableWidthBytes = (values, valueOffsets, index) => {
23371
23761
  if (index + 1 >= valueOffsets.length) {
@@ -23387,10 +23777,48 @@ ${err.toString()}`);
23387
23777
  var getBigInts = ({ values }, index) => values[index];
23388
23778
  var getFixedSizeBinary = ({ stride, values }, index) => values.subarray(stride * index, stride * (index + 1));
23389
23779
  var getBinary = ({ values, valueOffsets }, index) => getVariableWidthBytes(values, valueOffsets, index);
23780
+ var getBinaryViewBytes = (data, index) => {
23781
+ var _a2;
23782
+ const values = data.values;
23783
+ if (!values) {
23784
+ throw new Error("BinaryView data is missing view buffer");
23785
+ }
23786
+ const viewOffset = index * BINARY_VIEW_SIZE;
23787
+ const end = viewOffset + BINARY_VIEW_SIZE;
23788
+ if (viewOffset < 0 || end > values.length) {
23789
+ throw new Error(`BinaryView data buffer is too short: expected ${BINARY_VIEW_SIZE} bytes, got ${Math.max(0, values.length - viewOffset)}`);
23790
+ }
23791
+ const viewStruct = values.subarray(viewOffset, end);
23792
+ if (viewStruct.length < BINARY_VIEW_SIZE) {
23793
+ throw new Error(`BinaryView data buffer is too short: expected ${BINARY_VIEW_SIZE} bytes, got ${viewStruct.length}`);
23794
+ }
23795
+ const view = new DataView(values.buffer, viewStruct.byteOffset, BINARY_VIEW_SIZE);
23796
+ const size = view.getInt32(0, true);
23797
+ if (size <= 0) {
23798
+ return new Uint8Array(0);
23799
+ }
23800
+ if (size <= BINARY_VIEW_INLINE_CAPACITY) {
23801
+ return viewStruct.subarray(4, 4 + size);
23802
+ }
23803
+ const bufferIndex = view.getInt32(8, true);
23804
+ const offset = view.getInt32(12, true);
23805
+ const variadicBuffer = (_a2 = data.variadicBuffers) === null || _a2 === void 0 ? void 0 : _a2[bufferIndex];
23806
+ if (!variadicBuffer) {
23807
+ throw new Error(`BinaryView variadic buffer ${bufferIndex} is missing`);
23808
+ }
23809
+ return variadicBuffer.subarray(offset, offset + size);
23810
+ };
23811
+ var getBinaryViewValue = (data, index) => {
23812
+ return getBinaryViewBytes(data, index);
23813
+ };
23390
23814
  var getUtf8 = ({ values, valueOffsets }, index) => {
23391
23815
  const bytes = getVariableWidthBytes(values, valueOffsets, index);
23392
23816
  return bytes !== null ? (0, utf8_js_1.decodeUtf8)(bytes) : null;
23393
23817
  };
23818
+ var getUtf8ViewValue = (data, index) => {
23819
+ const bytes = getBinaryViewBytes(data, index);
23820
+ return (0, utf8_js_1.decodeUtf8)(bytes);
23821
+ };
23394
23822
  var getInt = ({ values }, index) => values[index];
23395
23823
  var getFloat = ({ type, values }, index) => type.precision !== enum_js_1.Precision.HALF ? values[index] : (0, math_js_1.uint16ToFloat64)(values[index]);
23396
23824
  var getDate = (data, index) => data.type.unit === enum_js_1.DateUnit.DAY ? getDateDay(data, index) : getDateMillisecond(data, index);
@@ -23429,7 +23857,8 @@ ${err.toString()}`);
23429
23857
  var getDecimal = ({ values, stride }, index) => bn_js_1.BN.decimal(values.subarray(stride * index, stride * (index + 1)));
23430
23858
  var getList = (data, index) => {
23431
23859
  const { valueOffsets, stride, children } = data;
23432
- const { [index * stride]: begin, [index * stride + 1]: end } = valueOffsets;
23860
+ const begin = (0, bigint_js_1.bigIntToNumber)(valueOffsets[index * stride]);
23861
+ const end = (0, bigint_js_1.bigIntToNumber)(valueOffsets[index * stride + 1]);
23433
23862
  const child = children[0];
23434
23863
  const slice = child.slice(begin, end - begin);
23435
23864
  return new vector_js_1.Vector([slice]);
@@ -23509,8 +23938,10 @@ ${err.toString()}`);
23509
23938
  GetVisitor.prototype.visitFloat64 = wrapGet(getNumeric);
23510
23939
  GetVisitor.prototype.visitUtf8 = wrapGet(getUtf8);
23511
23940
  GetVisitor.prototype.visitLargeUtf8 = wrapGet(getUtf8);
23941
+ GetVisitor.prototype.visitUtf8View = wrapGet(getUtf8ViewValue);
23512
23942
  GetVisitor.prototype.visitBinary = wrapGet(getBinary);
23513
23943
  GetVisitor.prototype.visitLargeBinary = wrapGet(getBinary);
23944
+ GetVisitor.prototype.visitBinaryView = wrapGet(getBinaryViewValue);
23514
23945
  GetVisitor.prototype.visitFixedSizeBinary = wrapGet(getFixedSizeBinary);
23515
23946
  GetVisitor.prototype.visitDate = wrapGet(getDate);
23516
23947
  GetVisitor.prototype.visitDateDay = wrapGet(getDateDay);
@@ -23527,6 +23958,7 @@ ${err.toString()}`);
23527
23958
  GetVisitor.prototype.visitTimeNanosecond = wrapGet(getTimeNanosecond);
23528
23959
  GetVisitor.prototype.visitDecimal = wrapGet(getDecimal);
23529
23960
  GetVisitor.prototype.visitList = wrapGet(getList);
23961
+ GetVisitor.prototype.visitLargeList = wrapGet(getList);
23530
23962
  GetVisitor.prototype.visitStruct = wrapGet(getStruct);
23531
23963
  GetVisitor.prototype.visitUnion = wrapGet(getUnion);
23532
23964
  GetVisitor.prototype.visitDenseUnion = wrapGet(getDenseUnion);
@@ -23966,7 +24398,16 @@ ${err.toString()}`);
23966
24398
  var type_js_1 = require_type2();
23967
24399
  var bit_js_1 = require_bit();
23968
24400
  exports.kUnknownNullCount = -1;
24401
+ var kDataSymbol = /* @__PURE__ */ Symbol.for("apache-arrow/Data");
23969
24402
  var Data = class _Data {
24403
+ /**
24404
+ * Check if an object is an instance of Data.
24405
+ * This works across different instances of the Arrow library.
24406
+ */
24407
+ /** @nocollapse */
24408
+ static isData(x) {
24409
+ return (x === null || x === void 0 ? void 0 : x[kDataSymbol]) === true;
24410
+ }
23970
24411
  get typeId() {
23971
24412
  return this.type.typeId;
23972
24413
  }
@@ -23995,6 +24436,10 @@ ${err.toString()}`);
23995
24436
  values && (byteLength += values.byteLength);
23996
24437
  nullBitmap && (byteLength += nullBitmap.byteLength);
23997
24438
  typeIds && (byteLength += typeIds.byteLength);
24439
+ byteLength += this.variadicBuffers.reduce((size, data) => {
24440
+ var _a2;
24441
+ return size + ((_a2 = data === null || data === void 0 ? void 0 : data.byteLength) !== null && _a2 !== void 0 ? _a2 : 0);
24442
+ }, 0);
23998
24443
  return this.children.reduce((byteLength2, child) => byteLength2 + child.byteLength, byteLength);
23999
24444
  }
24000
24445
  get nullCount() {
@@ -24011,7 +24456,8 @@ ${err.toString()}`);
24011
24456
  }
24012
24457
  return nullCount;
24013
24458
  }
24014
- constructor(type, offset, length, nullCount, buffers, children = [], dictionary) {
24459
+ constructor(type, offset, length, nullCount, buffers, children = [], dictionary, variadicBuffers = []) {
24460
+ var _a2;
24015
24461
  this.type = type;
24016
24462
  this.children = children;
24017
24463
  this.dictionary = dictionary;
@@ -24025,6 +24471,7 @@ ${err.toString()}`);
24025
24471
  this.typeIds = buffers.typeIds;
24026
24472
  this.nullBitmap = buffers.nullBitmap;
24027
24473
  this.valueOffsets = buffers.valueOffsets;
24474
+ this.variadicBuffers = buffers.variadicBuffers;
24028
24475
  } else {
24029
24476
  this.stride = (0, type_js_1.strideForType)(type);
24030
24477
  if (buffers) {
@@ -24033,14 +24480,19 @@ ${err.toString()}`);
24033
24480
  (buffer = buffers[2]) && (this.nullBitmap = buffer);
24034
24481
  (buffer = buffers[3]) && (this.typeIds = buffer);
24035
24482
  }
24483
+ this.variadicBuffers = variadicBuffers;
24036
24484
  }
24485
+ (_a2 = this.variadicBuffers) !== null && _a2 !== void 0 ? _a2 : this.variadicBuffers = [];
24037
24486
  }
24038
24487
  getValid(index) {
24039
24488
  const { type } = this;
24040
24489
  if (type_js_1.DataType.isUnion(type)) {
24041
24490
  const union = type;
24042
- const child = this.children[union.typeIdToChildIndex[this.typeIds[index]]];
24043
- const indexInChild = union.mode === enum_js_1.UnionMode.Dense ? this.valueOffsets[index] : index;
24491
+ const typeId = this.typeIds[index];
24492
+ const childIndex = union.typeIdToChildIndex[typeId];
24493
+ const child = this.children[childIndex];
24494
+ const valueOffsets = this.valueOffsets;
24495
+ const indexInChild = union.mode === enum_js_1.UnionMode.Dense && valueOffsets ? Number(valueOffsets[index]) : index;
24044
24496
  return child.getValid(indexInChild);
24045
24497
  }
24046
24498
  if (this.nullable && this.nullCount > 0) {
@@ -24055,8 +24507,11 @@ ${err.toString()}`);
24055
24507
  const { type } = this;
24056
24508
  if (type_js_1.DataType.isUnion(type)) {
24057
24509
  const union = type;
24058
- const child = this.children[union.typeIdToChildIndex[this.typeIds[index]]];
24059
- const indexInChild = union.mode === enum_js_1.UnionMode.Dense ? this.valueOffsets[index] : index;
24510
+ const typeId = this.typeIds[index];
24511
+ const childIndex = union.typeIdToChildIndex[typeId];
24512
+ const child = this.children[childIndex];
24513
+ const valueOffsets = this.valueOffsets;
24514
+ const indexInChild = union.mode === enum_js_1.UnionMode.Dense && valueOffsets ? Number(valueOffsets[index]) : index;
24060
24515
  prev = child.getValid(indexInChild);
24061
24516
  child.setValid(indexInChild, value);
24062
24517
  } else {
@@ -24083,8 +24538,8 @@ ${err.toString()}`);
24083
24538
  }
24084
24539
  return value;
24085
24540
  }
24086
- clone(type = this.type, offset = this.offset, length = this.length, nullCount = this._nullCount, buffers = this, children = this.children) {
24087
- return new _Data(type, offset, length, nullCount, buffers, children, this.dictionary);
24541
+ clone(type = this.type, offset = this.offset, length = this.length, nullCount = this._nullCount, buffers = this, children = this.children, variadicBuffers = this.variadicBuffers) {
24542
+ return new _Data(type, offset, length, nullCount, buffers, children, this.dictionary, variadicBuffers);
24088
24543
  }
24089
24544
  slice(offset, length) {
24090
24545
  const { stride, typeId, children } = this;
@@ -24098,12 +24553,13 @@ ${err.toString()}`);
24098
24553
  nullCount,
24099
24554
  buffers,
24100
24555
  // Don't slice children if we have value offsets (the variable-width types)
24101
- children.length === 0 || this.valueOffsets ? children : this._sliceChildren(children, childStride * offset, childStride * length)
24556
+ children.length === 0 || this.valueOffsets ? children : this._sliceChildren(children, childStride * offset, childStride * length),
24557
+ this.variadicBuffers
24102
24558
  );
24103
24559
  }
24104
24560
  _changeLengthAndBackfillNullBitmap(newLength) {
24105
24561
  if (this.typeId === enum_js_1.Type.Null) {
24106
- return this.clone(this.type, 0, newLength, 0);
24562
+ return this.clone(this.type, 0, newLength, 0, this.buffers, this.children, this.variadicBuffers);
24107
24563
  }
24108
24564
  const { length, nullCount } = this;
24109
24565
  const bitmap = new Uint8Array((newLength + 63 & ~63) >> 3).fill(255, 0, length >> 3);
@@ -24113,14 +24569,19 @@ ${err.toString()}`);
24113
24569
  }
24114
24570
  const buffers = this.buffers;
24115
24571
  buffers[enum_js_1.BufferType.VALIDITY] = bitmap;
24116
- return this.clone(this.type, 0, newLength, nullCount + (newLength - length), buffers);
24572
+ return this.clone(this.type, 0, newLength, nullCount + (newLength - length), buffers, this.children, this.variadicBuffers);
24117
24573
  }
24118
24574
  _sliceBuffers(offset, length, stride, typeId) {
24119
24575
  let arr;
24120
24576
  const { buffers } = this;
24121
24577
  (arr = buffers[enum_js_1.BufferType.TYPE]) && (buffers[enum_js_1.BufferType.TYPE] = arr.subarray(offset, offset + length));
24122
- (arr = buffers[enum_js_1.BufferType.OFFSET]) && (buffers[enum_js_1.BufferType.OFFSET] = arr.subarray(offset, offset + length + 1)) || // Otherwise if no offsets, slice the data buffer. Don't slice the data vector for Booleans, since the offset goes by bits not bytes
24123
- (arr = buffers[enum_js_1.BufferType.DATA]) && (buffers[enum_js_1.BufferType.DATA] = typeId === 6 ? arr : arr.subarray(stride * offset, stride * (offset + length)));
24578
+ if (type_js_1.DataType.isBinaryView(this.type) || type_js_1.DataType.isUtf8View(this.type)) {
24579
+ const width = type_js_2.BinaryView.ELEMENT_WIDTH;
24580
+ (arr = buffers[enum_js_1.BufferType.DATA]) && (buffers[enum_js_1.BufferType.DATA] = arr.subarray(offset * width, (offset + length) * width));
24581
+ } else {
24582
+ (arr = buffers[enum_js_1.BufferType.OFFSET]) && (buffers[enum_js_1.BufferType.OFFSET] = arr.subarray(offset, offset + length + 1)) || // Otherwise if no offsets, slice the data buffer. Don't slice the data vector for Booleans, since the offset goes by bits not bytes
24583
+ (arr = buffers[enum_js_1.BufferType.DATA]) && (buffers[enum_js_1.BufferType.DATA] = typeId === 6 ? arr : arr.subarray(stride * offset, stride * (offset + length)));
24584
+ }
24124
24585
  return buffers;
24125
24586
  }
24126
24587
  _sliceChildren(children, offset, length) {
@@ -24129,6 +24590,13 @@ ${err.toString()}`);
24129
24590
  };
24130
24591
  exports.Data = Data;
24131
24592
  Data.prototype.children = Object.freeze([]);
24593
+ Data.prototype[kDataSymbol] = true;
24594
+ Object.defineProperty(Data, Symbol.hasInstance, {
24595
+ value: function isDataInstance(instance) {
24596
+ return Function.prototype[Symbol.hasInstance].call(this, instance) || this === Data && Data.isData(instance);
24597
+ }
24598
+ });
24599
+ var type_js_2 = require_type2();
24132
24600
  var visitor_js_1 = require_visitor();
24133
24601
  var buffer_js_1 = require_buffer();
24134
24602
  var MakeDataVisitor = class _MakeDataVisitor extends visitor_js_1.Visitor {
@@ -24168,6 +24636,16 @@ ${err.toString()}`);
24168
24636
  const { ["length"]: length = valueOffsets.length - 1, ["nullCount"]: nullCount = props["nullBitmap"] ? -1 : 0 } = props;
24169
24637
  return new Data(type, offset, length, nullCount, [valueOffsets, data, nullBitmap]);
24170
24638
  }
24639
+ visitUtf8View(props) {
24640
+ var _a2;
24641
+ const { ["type"]: type, ["offset"]: offset = 0 } = props;
24642
+ const views = (0, buffer_js_1.toArrayBufferView)(type.ArrayType, props["views"]);
24643
+ const nullBitmap = (0, buffer_js_1.toUint8Array)(props["nullBitmap"]);
24644
+ const variadicBuffers = (props["variadicBuffers"] || []).map((buffer) => (0, buffer_js_1.toUint8Array)(buffer));
24645
+ const length = (_a2 = props["length"]) !== null && _a2 !== void 0 ? _a2 : Math.trunc(views.length / type_js_2.Utf8View.ELEMENT_WIDTH);
24646
+ const nullCount = props["nullBitmap"] ? -1 : 0;
24647
+ return new Data(type, offset, length, nullCount, [void 0, views, nullBitmap], [], void 0, variadicBuffers);
24648
+ }
24171
24649
  visitLargeUtf8(props) {
24172
24650
  const { ["type"]: type, ["offset"]: offset = 0 } = props;
24173
24651
  const data = (0, buffer_js_1.toUint8Array)(props["data"]);
@@ -24184,6 +24662,16 @@ ${err.toString()}`);
24184
24662
  const { ["length"]: length = valueOffsets.length - 1, ["nullCount"]: nullCount = props["nullBitmap"] ? -1 : 0 } = props;
24185
24663
  return new Data(type, offset, length, nullCount, [valueOffsets, data, nullBitmap]);
24186
24664
  }
24665
+ visitBinaryView(props) {
24666
+ var _a2;
24667
+ const { ["type"]: type, ["offset"]: offset = 0 } = props;
24668
+ const views = (0, buffer_js_1.toArrayBufferView)(type.ArrayType, props["views"]);
24669
+ const nullBitmap = (0, buffer_js_1.toUint8Array)(props["nullBitmap"]);
24670
+ const variadicBuffers = (props["variadicBuffers"] || []).map((buffer) => (0, buffer_js_1.toUint8Array)(buffer));
24671
+ const length = (_a2 = props["length"]) !== null && _a2 !== void 0 ? _a2 : Math.trunc(views.length / type_js_2.BinaryView.ELEMENT_WIDTH);
24672
+ const nullCount = props["nullBitmap"] ? -1 : 0;
24673
+ return new Data(type, offset, length, nullCount, [void 0, views, nullBitmap], [], void 0, variadicBuffers);
24674
+ }
24187
24675
  visitLargeBinary(props) {
24188
24676
  const { ["type"]: type, ["offset"]: offset = 0 } = props;
24189
24677
  const data = (0, buffer_js_1.toUint8Array)(props["data"]);
@@ -24234,6 +24722,13 @@ ${err.toString()}`);
24234
24722
  const { ["length"]: length = valueOffsets.length - 1, ["nullCount"]: nullCount = props["nullBitmap"] ? -1 : 0 } = props;
24235
24723
  return new Data(type, offset, length, nullCount, [valueOffsets, void 0, nullBitmap], [child]);
24236
24724
  }
24725
+ visitLargeList(props) {
24726
+ const { ["type"]: type, ["offset"]: offset = 0, ["child"]: child } = props;
24727
+ const nullBitmap = (0, buffer_js_1.toUint8Array)(props["nullBitmap"]);
24728
+ const valueOffsets = (0, buffer_js_1.toBigInt64Array)(props["valueOffsets"]);
24729
+ const { ["length"]: length = valueOffsets.length - 1, ["nullCount"]: nullCount = props["nullBitmap"] ? -1 : 0 } = props;
24730
+ return new Data(type, offset, length, nullCount, [valueOffsets, void 0, nullBitmap], [child]);
24731
+ }
24237
24732
  visitStruct(props) {
24238
24733
  const { ["type"]: type, ["offset"]: offset = 0, ["children"]: children = [] } = props;
24239
24734
  const nullBitmap = (0, buffer_js_1.toUint8Array)(props["nullBitmap"]);
@@ -24514,8 +25009,10 @@ ${err.toString()}`);
24514
25009
  IndexOfVisitor.prototype.visitFloat64 = indexOfValue;
24515
25010
  IndexOfVisitor.prototype.visitUtf8 = indexOfValue;
24516
25011
  IndexOfVisitor.prototype.visitLargeUtf8 = indexOfValue;
25012
+ IndexOfVisitor.prototype.visitUtf8View = indexOfValue;
24517
25013
  IndexOfVisitor.prototype.visitBinary = indexOfValue;
24518
25014
  IndexOfVisitor.prototype.visitLargeBinary = indexOfValue;
25015
+ IndexOfVisitor.prototype.visitBinaryView = indexOfValue;
24519
25016
  IndexOfVisitor.prototype.visitFixedSizeBinary = indexOfValue;
24520
25017
  IndexOfVisitor.prototype.visitDate = indexOfValue;
24521
25018
  IndexOfVisitor.prototype.visitDateDay = indexOfValue;
@@ -24532,6 +25029,7 @@ ${err.toString()}`);
24532
25029
  IndexOfVisitor.prototype.visitTimeNanosecond = indexOfValue;
24533
25030
  IndexOfVisitor.prototype.visitDecimal = indexOfValue;
24534
25031
  IndexOfVisitor.prototype.visitList = indexOfValue;
25032
+ IndexOfVisitor.prototype.visitLargeList = indexOfValue;
24535
25033
  IndexOfVisitor.prototype.visitStruct = indexOfValue;
24536
25034
  IndexOfVisitor.prototype.visitUnion = indexOfValue;
24537
25035
  IndexOfVisitor.prototype.visitDenseUnion = indexOfUnion;
@@ -24618,8 +25116,10 @@ ${err.toString()}`);
24618
25116
  IteratorVisitor.prototype.visitFloat64 = vectorIterator;
24619
25117
  IteratorVisitor.prototype.visitUtf8 = vectorIterator;
24620
25118
  IteratorVisitor.prototype.visitLargeUtf8 = vectorIterator;
25119
+ IteratorVisitor.prototype.visitUtf8View = vectorIterator;
24621
25120
  IteratorVisitor.prototype.visitBinary = vectorIterator;
24622
25121
  IteratorVisitor.prototype.visitLargeBinary = vectorIterator;
25122
+ IteratorVisitor.prototype.visitBinaryView = vectorIterator;
24623
25123
  IteratorVisitor.prototype.visitFixedSizeBinary = vectorIterator;
24624
25124
  IteratorVisitor.prototype.visitDate = vectorIterator;
24625
25125
  IteratorVisitor.prototype.visitDateDay = vectorIterator;
@@ -24636,6 +25136,7 @@ ${err.toString()}`);
24636
25136
  IteratorVisitor.prototype.visitTimeNanosecond = vectorIterator;
24637
25137
  IteratorVisitor.prototype.visitDecimal = vectorIterator;
24638
25138
  IteratorVisitor.prototype.visitList = vectorIterator;
25139
+ IteratorVisitor.prototype.visitLargeList = vectorIterator;
24639
25140
  IteratorVisitor.prototype.visitStruct = vectorIterator;
24640
25141
  IteratorVisitor.prototype.visitUnion = vectorIterator;
24641
25142
  IteratorVisitor.prototype.visitDenseUnion = vectorIterator;
@@ -24672,9 +25173,18 @@ ${err.toString()}`);
24672
25173
  var set_js_1 = require_set();
24673
25174
  var indexof_js_1 = require_indexof();
24674
25175
  var iterator_js_1 = require_iterator();
25176
+ var kVectorSymbol = /* @__PURE__ */ Symbol.for("apache-arrow/Vector");
24675
25177
  var visitorsByTypeId = {};
24676
25178
  var vectorPrototypesByTypeId = {};
24677
25179
  var Vector = class _Vector {
25180
+ /**
25181
+ * Check if an object is an instance of Vector.
25182
+ * This works across different instances of the Arrow library.
25183
+ */
25184
+ /** @nocollapse */
25185
+ static isVector(x) {
25186
+ return (x === null || x === void 0 ? void 0 : x[kVectorSymbol]) === true;
25187
+ }
24678
25188
  constructor(input) {
24679
25189
  var _b2, _c, _d;
24680
25190
  const data = input[0] instanceof _Vector ? input.flatMap((x) => x.data) : input;
@@ -24930,6 +25440,7 @@ ${err.toString()}`);
24930
25440
  proto.numChildren = 0;
24931
25441
  proto._offsets = new Uint32Array([0]);
24932
25442
  proto[Symbol.isConcatSpreadable] = true;
25443
+ proto[kVectorSymbol] = true;
24933
25444
  const typeIds = Object.keys(enum_js_1.Type).map((T) => enum_js_1.Type[T]).filter((T) => typeof T === "number" && T !== enum_js_1.Type.NONE);
24934
25445
  for (const typeId of typeIds) {
24935
25446
  const get = get_js_1.instance.getVisitFnByTypeId(typeId);
@@ -24945,6 +25456,11 @@ ${err.toString()}`);
24945
25456
  }
24946
25457
  return "Vector";
24947
25458
  })(Vector.prototype);
25459
+ Object.defineProperty(Vector, Symbol.hasInstance, {
25460
+ value: function isVectorInstance(instance) {
25461
+ return Function.prototype[Symbol.hasInstance].call(this, instance) || this === Vector && Vector.isVector(instance);
25462
+ }
25463
+ });
24948
25464
  var MemoizedVector = class _MemoizedVector extends Vector {
24949
25465
  constructor(vector) {
24950
25466
  super(vector.data);
@@ -25666,7 +26182,17 @@ return true;`);
25666
26182
  exports.Field = exports.Schema = void 0;
25667
26183
  var enum_js_1 = require_enum();
25668
26184
  var type_js_1 = require_type2();
26185
+ var kSchemaSymbol = /* @__PURE__ */ Symbol.for("apache-arrow/Schema");
26186
+ var kFieldSymbol = /* @__PURE__ */ Symbol.for("apache-arrow/Field");
25669
26187
  var Schema = class _Schema {
26188
+ /**
26189
+ * Check if an object is an instance of Schema.
26190
+ * This works across different instances of the Arrow library.
26191
+ */
26192
+ /** @nocollapse */
26193
+ static isSchema(x) {
26194
+ return (x === null || x === void 0 ? void 0 : x[kSchemaSymbol]) === true;
26195
+ }
25670
26196
  constructor(fields = [], metadata, dictionaries, metadataVersion = enum_js_1.MetadataVersion.V5) {
25671
26197
  this.fields = fields || [];
25672
26198
  this.metadata = metadata || /* @__PURE__ */ new Map();
@@ -25724,7 +26250,21 @@ return true;`);
25724
26250
  Schema.prototype.fields = null;
25725
26251
  Schema.prototype.metadata = null;
25726
26252
  Schema.prototype.dictionaries = null;
26253
+ Schema.prototype[kSchemaSymbol] = true;
26254
+ Object.defineProperty(Schema, Symbol.hasInstance, {
26255
+ value: function isSchemaInstance(instance) {
26256
+ return Function.prototype[Symbol.hasInstance].call(this, instance) || this === Schema && Schema.isSchema(instance);
26257
+ }
26258
+ });
25727
26259
  var Field = class _Field {
26260
+ /**
26261
+ * Check if an object is an instance of Field.
26262
+ * This works across different instances of the Arrow library.
26263
+ */
26264
+ /** @nocollapse */
26265
+ static isField(x) {
26266
+ return (x === null || x === void 0 ? void 0 : x[kFieldSymbol]) === true;
26267
+ }
25728
26268
  /** @nocollapse */
25729
26269
  static new(...args) {
25730
26270
  let [name, type, nullable, metadata] = args;
@@ -25762,6 +26302,12 @@ return true;`);
25762
26302
  Field.prototype.name = null;
25763
26303
  Field.prototype.nullable = null;
25764
26304
  Field.prototype.metadata = null;
26305
+ Field.prototype[kFieldSymbol] = true;
26306
+ Object.defineProperty(Field, Symbol.hasInstance, {
26307
+ value: function isFieldInstance(instance) {
26308
+ return Function.prototype[Symbol.hasInstance].call(this, instance) || this === Field && Field.isField(instance);
26309
+ }
26310
+ });
25765
26311
  function mergeMaps(m1, m2) {
25766
26312
  return new Map([...m1 || /* @__PURE__ */ new Map(), ...m2 || /* @__PURE__ */ new Map()]);
25767
26313
  }
@@ -26030,9 +26576,11 @@ return true;`);
26030
26576
  var int_js_1 = require_int();
26031
26577
  var floating_point_js_1 = require_floating_point();
26032
26578
  var binary_js_1 = require_binary();
26579
+ var binary_view_js_1 = require_binary_view();
26033
26580
  var large_binary_js_1 = require_large_binary();
26034
26581
  var bool_js_1 = require_bool();
26035
26582
  var utf8_js_1 = require_utf82();
26583
+ var utf8_view_js_1 = require_utf8_view();
26036
26584
  var large_utf8_js_1 = require_large_utf8();
26037
26585
  var decimal_js_1 = require_decimal();
26038
26586
  var date_js_1 = require_date();
@@ -26041,6 +26589,7 @@ return true;`);
26041
26589
  var interval_js_1 = require_interval();
26042
26590
  var duration_js_1 = require_duration();
26043
26591
  var list_js_1 = require_list();
26592
+ var large_list_js_1 = require_large_list();
26044
26593
  var struct__js_1 = require_struct();
26045
26594
  var union_js_1 = require_union();
26046
26595
  var dictionary_encoding_js_1 = require_dictionary_encoding();
@@ -26070,6 +26619,10 @@ return true;`);
26070
26619
  binary_js_1.Binary.startBinary(b);
26071
26620
  return binary_js_1.Binary.endBinary(b);
26072
26621
  }
26622
+ visitBinaryView(_node, b) {
26623
+ binary_view_js_1.BinaryView.startBinaryView(b);
26624
+ return binary_view_js_1.BinaryView.endBinaryView(b);
26625
+ }
26073
26626
  visitLargeBinary(_node, b) {
26074
26627
  large_binary_js_1.LargeBinary.startLargeBinary(b);
26075
26628
  return large_binary_js_1.LargeBinary.endLargeBinary(b);
@@ -26082,6 +26635,10 @@ return true;`);
26082
26635
  utf8_js_1.Utf8.startUtf8(b);
26083
26636
  return utf8_js_1.Utf8.endUtf8(b);
26084
26637
  }
26638
+ visitUtf8View(_node, b) {
26639
+ utf8_view_js_1.Utf8View.startUtf8View(b);
26640
+ return utf8_view_js_1.Utf8View.endUtf8View(b);
26641
+ }
26085
26642
  visitLargeUtf8(_node, b) {
26086
26643
  large_utf8_js_1.LargeUtf8.startLargeUtf8(b);
26087
26644
  return large_utf8_js_1.LargeUtf8.endLargeUtf8(b);
@@ -26127,6 +26684,10 @@ return true;`);
26127
26684
  list_js_1.List.startList(b);
26128
26685
  return list_js_1.List.endList(b);
26129
26686
  }
26687
+ visitLargeList(_node, b) {
26688
+ large_list_js_1.LargeList.startLargeList(b);
26689
+ return large_list_js_1.LargeList.endLargeList(b);
26690
+ }
26130
26691
  visitStruct(_node, b) {
26131
26692
  struct__js_1.Struct_.startStruct_(b);
26132
26693
  return struct__js_1.Struct_.endStruct_(b);
@@ -26185,7 +26746,7 @@ return true;`);
26185
26746
  }
26186
26747
  exports.schemaFromJSON = schemaFromJSON;
26187
26748
  function recordBatchFromJSON(b) {
26188
- return new message_js_1.RecordBatch(b["count"], fieldNodesFromJSON(b["columns"]), buffersFromJSON(b["columns"]), null);
26749
+ return new message_js_1.RecordBatch(b["count"], fieldNodesFromJSON(b["columns"]), buffersFromJSON(b["columns"]), null, variadicBufferCountsFromJSON(b["columns"]));
26189
26750
  }
26190
26751
  exports.recordBatchFromJSON = recordBatchFromJSON;
26191
26752
  function dictionaryBatchFromJSON(b) {
@@ -26212,6 +26773,12 @@ return true;`);
26212
26773
  column["TYPE_ID"] && buffers.push(new message_js_1.BufferRegion(buffers.length, column["TYPE_ID"].length));
26213
26774
  column["OFFSET"] && buffers.push(new message_js_1.BufferRegion(buffers.length, column["OFFSET"].length));
26214
26775
  column["DATA"] && buffers.push(new message_js_1.BufferRegion(buffers.length, column["DATA"].length));
26776
+ column["VIEWS"] && buffers.push(new message_js_1.BufferRegion(buffers.length, column["VIEWS"].length));
26777
+ if (column["VARIADIC_DATA_BUFFERS"]) {
26778
+ for (const buf of column["VARIADIC_DATA_BUFFERS"]) {
26779
+ buffers.push(new message_js_1.BufferRegion(buffers.length, buf.length));
26780
+ }
26781
+ }
26215
26782
  buffers = buffersFromJSON(column["children"], buffers);
26216
26783
  }
26217
26784
  return buffers;
@@ -26219,6 +26786,13 @@ return true;`);
26219
26786
  function nullCountFromJSON(validity) {
26220
26787
  return (validity || []).reduce((sum, val) => sum + +(val === 0), 0);
26221
26788
  }
26789
+ function variadicBufferCountsFromJSON(xs) {
26790
+ return (xs || []).reduce((counts, column) => [
26791
+ ...counts,
26792
+ ...column["VARIADIC_DATA_BUFFERS"] ? [column["VARIADIC_DATA_BUFFERS"].length] : [],
26793
+ ...variadicBufferCountsFromJSON(column["children"])
26794
+ ], []);
26795
+ }
26222
26796
  function fieldFromJSON(_field, dictionaries) {
26223
26797
  let id;
26224
26798
  let keys;
@@ -26259,14 +26833,20 @@ return true;`);
26259
26833
  return new type_js_1.Binary();
26260
26834
  case "largebinary":
26261
26835
  return new type_js_1.LargeBinary();
26836
+ case "binaryview":
26837
+ return new type_js_1.BinaryView();
26262
26838
  case "utf8":
26263
26839
  return new type_js_1.Utf8();
26264
26840
  case "largeutf8":
26265
26841
  return new type_js_1.LargeUtf8();
26842
+ case "utf8view":
26843
+ return new type_js_1.Utf8View();
26266
26844
  case "bool":
26267
26845
  return new type_js_1.Bool();
26268
26846
  case "list":
26269
26847
  return new type_js_1.List((children || [])[0]);
26848
+ case "largelist":
26849
+ return new type_js_1.LargeList((children || [])[0]);
26270
26850
  case "struct":
26271
26851
  return new type_js_1.Struct(children || []);
26272
26852
  case "struct_":
@@ -26383,7 +26963,8 @@ return true;`);
26383
26963
  const bodyLength = _message.bodyLength();
26384
26964
  const version2 = _message.version();
26385
26965
  const headerType = _message.headerType();
26386
- const message2 = new _Message(bodyLength, version2, headerType);
26966
+ const metadata = decodeMessageCustomMetadata(_message);
26967
+ const message2 = new _Message(bodyLength, version2, headerType, void 0, metadata);
26387
26968
  message2._createHeader = decodeMessageHeader(_message, headerType);
26388
26969
  return message2;
26389
26970
  }
@@ -26398,11 +26979,22 @@ return true;`);
26398
26979
  } else if (message2.isDictionaryBatch()) {
26399
26980
  headerOffset = DictionaryBatch.encode(b, message2.header());
26400
26981
  }
26982
+ const customMetadataOffset = !(message2.metadata && message2.metadata.size > 0) ? -1 : message_js_1.Message.createCustomMetadataVector(b, [...message2.metadata].map(([k, v]) => {
26983
+ const key = b.createString(`${k}`);
26984
+ const val = b.createString(`${v}`);
26985
+ key_value_js_1.KeyValue.startKeyValue(b);
26986
+ key_value_js_1.KeyValue.addKey(b, key);
26987
+ key_value_js_1.KeyValue.addValue(b, val);
26988
+ return key_value_js_1.KeyValue.endKeyValue(b);
26989
+ }));
26401
26990
  message_js_1.Message.startMessage(b);
26402
26991
  message_js_1.Message.addVersion(b, enum_js_1.MetadataVersion.V5);
26403
26992
  message_js_1.Message.addHeader(b, headerOffset);
26404
26993
  message_js_1.Message.addHeaderType(b, message2.headerType);
26405
26994
  message_js_1.Message.addBodyLength(b, BigInt(message2.bodyLength));
26995
+ if (customMetadataOffset !== -1) {
26996
+ message_js_1.Message.addCustomMetadata(b, customMetadataOffset);
26997
+ }
26406
26998
  message_js_1.Message.finishMessageBuffer(b, message_js_1.Message.endMessage(b));
26407
26999
  return b.asUint8Array();
26408
27000
  }
@@ -26412,7 +27004,7 @@ return true;`);
26412
27004
  return new _Message(0, enum_js_1.MetadataVersion.V5, enum_js_1.MessageHeader.Schema, header);
26413
27005
  }
26414
27006
  if (header instanceof RecordBatch) {
26415
- return new _Message(bodyLength, enum_js_1.MetadataVersion.V5, enum_js_1.MessageHeader.RecordBatch, header);
27007
+ return new _Message(bodyLength, enum_js_1.MetadataVersion.V5, enum_js_1.MessageHeader.RecordBatch, header, header.metadata);
26416
27008
  }
26417
27009
  if (header instanceof DictionaryBatch) {
26418
27010
  return new _Message(bodyLength, enum_js_1.MetadataVersion.V5, enum_js_1.MessageHeader.DictionaryBatch, header);
@@ -26434,6 +27026,9 @@ return true;`);
26434
27026
  get bodyLength() {
26435
27027
  return this._bodyLength;
26436
27028
  }
27029
+ get metadata() {
27030
+ return this._metadata;
27031
+ }
26437
27032
  header() {
26438
27033
  return this._createHeader();
26439
27034
  }
@@ -26446,13 +27041,14 @@ return true;`);
26446
27041
  isDictionaryBatch() {
26447
27042
  return this.headerType === enum_js_1.MessageHeader.DictionaryBatch;
26448
27043
  }
26449
- constructor(bodyLength, version2, headerType, header) {
27044
+ constructor(bodyLength, version2, headerType, header, metadata) {
26450
27045
  this._version = version2;
26451
27046
  this._headerType = headerType;
26452
27047
  this.body = new Uint8Array(0);
26453
27048
  this._compression = header === null || header === void 0 ? void 0 : header.compression;
26454
27049
  header && (this._createHeader = () => header);
26455
27050
  this._bodyLength = (0, bigint_js_1.bigIntToNumber)(bodyLength);
27051
+ this._metadata = metadata || /* @__PURE__ */ new Map();
26456
27052
  }
26457
27053
  };
26458
27054
  exports.Message = Message;
@@ -26469,11 +27065,19 @@ return true;`);
26469
27065
  get compression() {
26470
27066
  return this._compression;
26471
27067
  }
26472
- constructor(length, nodes, buffers, compression) {
27068
+ get variadicBufferCounts() {
27069
+ return this._variadicBufferCounts;
27070
+ }
27071
+ get metadata() {
27072
+ return this._metadata;
27073
+ }
27074
+ constructor(length, nodes, buffers, compression, variadicBufferCounts = [], metadata) {
26473
27075
  this._nodes = nodes;
26474
27076
  this._buffers = buffers;
26475
27077
  this._length = (0, bigint_js_1.bigIntToNumber)(length);
26476
27078
  this._compression = compression;
27079
+ this._variadicBufferCounts = variadicBufferCounts;
27080
+ this._metadata = metadata || /* @__PURE__ */ new Map();
26477
27081
  }
26478
27082
  };
26479
27083
  exports.RecordBatch = RecordBatch;
@@ -26573,7 +27177,7 @@ return true;`);
26573
27177
  return new schema_js_2.Schema(fields, decodeCustomMetadata(_schema), dictionaries, version2);
26574
27178
  }
26575
27179
  function decodeRecordBatch(batch, version2 = enum_js_1.MetadataVersion.V5) {
26576
- const recordBatch = new RecordBatch(batch.length(), decodeFieldNodes(batch), decodeBuffers(batch, version2), decodeBodyCompression(batch.compression()));
27180
+ const recordBatch = new RecordBatch(batch.length(), decodeFieldNodes(batch), decodeBuffers(batch, version2), decodeBodyCompression(batch.compression()), decodeVariadicBufferCounts(batch));
26577
27181
  return recordBatch;
26578
27182
  }
26579
27183
  function decodeDictionaryBatch(batch, version2 = enum_js_1.MetadataVersion.V5) {
@@ -26606,6 +27210,14 @@ return true;`);
26606
27210
  }
26607
27211
  return bufferRegions;
26608
27212
  }
27213
+ function decodeVariadicBufferCounts(batch) {
27214
+ const counts = [];
27215
+ const length = Math.trunc(batch.variadicBufferCountsLength());
27216
+ for (let i = 0; i < length; ++i) {
27217
+ counts.push((0, bigint_js_1.bigIntToNumber)(batch.variadicBufferCounts(i)));
27218
+ }
27219
+ return counts;
27220
+ }
26609
27221
  function decodeSchemaFields(schema, dictionaries) {
26610
27222
  const fields = [];
26611
27223
  for (let f2, i = -1, j = -1, n = schema.fieldsLength(); ++i < n; ) {
@@ -26657,6 +27269,15 @@ return true;`);
26657
27269
  }
26658
27270
  return data;
26659
27271
  }
27272
+ function decodeMessageCustomMetadata(message2) {
27273
+ const data = /* @__PURE__ */ new Map();
27274
+ for (let entry, key, i = -1, n = Math.trunc(message2.customMetadataLength()); ++i < n; ) {
27275
+ if ((entry = message2.customMetadata(i)) && (key = entry.key()) != null) {
27276
+ data.set(key, entry.value());
27277
+ }
27278
+ }
27279
+ return data;
27280
+ }
26660
27281
  function decodeIndexType(_type) {
26661
27282
  return new type_js_2.Int(_type.isSigned(), _type.bitWidth());
26662
27283
  }
@@ -26671,14 +27292,20 @@ return true;`);
26671
27292
  return new type_js_2.Binary();
26672
27293
  case type_js_1.Type["LargeBinary"]:
26673
27294
  return new type_js_2.LargeBinary();
27295
+ case type_js_1.Type["BinaryView"]:
27296
+ return new type_js_2.BinaryView();
26674
27297
  case type_js_1.Type["Utf8"]:
26675
27298
  return new type_js_2.Utf8();
26676
27299
  case type_js_1.Type["LargeUtf8"]:
26677
27300
  return new type_js_2.LargeUtf8();
27301
+ case type_js_1.Type["Utf8View"]:
27302
+ return new type_js_2.Utf8View();
26678
27303
  case type_js_1.Type["Bool"]:
26679
27304
  return new type_js_2.Bool();
26680
27305
  case type_js_1.Type["List"]:
26681
27306
  return new type_js_2.List((children || [])[0]);
27307
+ case type_js_1.Type["LargeList"]:
27308
+ return new type_js_2.LargeList((children || [])[0]);
26682
27309
  case type_js_1.Type["Struct_"]:
26683
27310
  return new type_js_2.Struct(children || []);
26684
27311
  }
@@ -26802,6 +27429,7 @@ return true;`);
26802
27429
  function encodeRecordBatch(b, recordBatch) {
26803
27430
  const nodes = recordBatch.nodes || [];
26804
27431
  const buffers = recordBatch.buffers || [];
27432
+ const variadicBufferCounts = recordBatch.variadicBufferCounts || [];
26805
27433
  record_batch_js_1.RecordBatch.startNodesVector(b, nodes.length);
26806
27434
  for (const n of nodes.slice().reverse())
26807
27435
  FieldNode.encode(b, n);
@@ -26814,6 +27442,10 @@ return true;`);
26814
27442
  if (recordBatch.compression !== null) {
26815
27443
  bodyCompressionOffset = encodeBodyCompression(b, recordBatch.compression);
26816
27444
  }
27445
+ let variadicBufferCountsOffset = -1;
27446
+ if (variadicBufferCounts.length > 0) {
27447
+ variadicBufferCountsOffset = record_batch_js_1.RecordBatch.createVariadicBufferCountsVector(b, variadicBufferCounts.map(BigInt));
27448
+ }
26817
27449
  record_batch_js_1.RecordBatch.startRecordBatch(b);
26818
27450
  record_batch_js_1.RecordBatch.addLength(b, BigInt(recordBatch.length));
26819
27451
  record_batch_js_1.RecordBatch.addNodes(b, nodesVectorOffset);
@@ -26821,6 +27453,9 @@ return true;`);
26821
27453
  if (recordBatch.compression !== null && bodyCompressionOffset) {
26822
27454
  record_batch_js_1.RecordBatch.addCompression(b, bodyCompressionOffset);
26823
27455
  }
27456
+ if (variadicBufferCountsOffset !== -1) {
27457
+ record_batch_js_1.RecordBatch.addVariadicBufferCounts(b, variadicBufferCountsOffset);
27458
+ }
26824
27459
  return record_batch_js_1.RecordBatch.endRecordBatch(b);
26825
27460
  }
26826
27461
  function encodeBodyCompression(b, node) {
@@ -27665,8 +28300,9 @@ return true;`);
27665
28300
  data[ai++] = (_b2 = interval["days"]) !== null && _b2 !== void 0 ? _b2 : 0;
27666
28301
  const nanoseconds = interval["nanoseconds"];
27667
28302
  if (nanoseconds) {
27668
- data[ai++] = Number(BigInt(nanoseconds) & BigInt(4294967295));
27669
- data[ai++] = Number(BigInt(nanoseconds) >> BigInt(32));
28303
+ const ns = BigInt(nanoseconds);
28304
+ data[ai++] = Number(ns & BigInt(4294967295)) >>> 0;
28305
+ data[ai++] = Number(ns >> BigInt(32)) >>> 0;
27670
28306
  } else {
27671
28307
  ai += 2;
27672
28308
  }
@@ -27720,15 +28356,17 @@ return true;`);
27720
28356
  var buffer_js_1 = require_buffer();
27721
28357
  var interval_js_1 = require_interval2();
27722
28358
  var VectorLoader = class extends visitor_js_1.Visitor {
27723
- constructor(bytes, nodes, buffers, dictionaries, metadataVersion = enum_js_1.MetadataVersion.V5) {
28359
+ constructor(bytes, nodes, buffers, dictionaries, metadataVersion = enum_js_1.MetadataVersion.V5, variadicBufferCounts = []) {
27724
28360
  super();
27725
28361
  this.nodesIndex = -1;
27726
28362
  this.buffersIndex = -1;
28363
+ this.variadicBufferIndex = -1;
27727
28364
  this.bytes = bytes;
27728
28365
  this.nodes = nodes;
27729
28366
  this.buffers = buffers;
27730
28367
  this.dictionaries = dictionaries;
27731
28368
  this.metadataVersion = metadataVersion;
28369
+ this.variadicBufferCounts = variadicBufferCounts;
27732
28370
  }
27733
28371
  visit(node) {
27734
28372
  return super.visit(node instanceof schema_js_1.Field ? node.type : node);
@@ -27751,12 +28389,38 @@ return true;`);
27751
28389
  visitLargeUtf8(type, { length, nullCount } = this.nextFieldNode()) {
27752
28390
  return (0, data_js_1.makeData)({ type, length, nullCount, nullBitmap: this.readNullBitmap(type, nullCount), valueOffsets: this.readOffsets(type), data: this.readData(type) });
27753
28391
  }
28392
+ visitUtf8View(type, { length, nullCount } = this.nextFieldNode()) {
28393
+ const nullBitmap = this.readNullBitmap(type, nullCount);
28394
+ const views = this.readData(type);
28395
+ const variadicBuffers = this.readVariadicBuffers(this.nextVariadicBufferCount());
28396
+ return (0, data_js_1.makeData)({
28397
+ type,
28398
+ length,
28399
+ nullCount,
28400
+ nullBitmap,
28401
+ ["views"]: views,
28402
+ ["variadicBuffers"]: variadicBuffers
28403
+ });
28404
+ }
27754
28405
  visitBinary(type, { length, nullCount } = this.nextFieldNode()) {
27755
28406
  return (0, data_js_1.makeData)({ type, length, nullCount, nullBitmap: this.readNullBitmap(type, nullCount), valueOffsets: this.readOffsets(type), data: this.readData(type) });
27756
28407
  }
27757
28408
  visitLargeBinary(type, { length, nullCount } = this.nextFieldNode()) {
27758
28409
  return (0, data_js_1.makeData)({ type, length, nullCount, nullBitmap: this.readNullBitmap(type, nullCount), valueOffsets: this.readOffsets(type), data: this.readData(type) });
27759
28410
  }
28411
+ visitBinaryView(type, { length, nullCount } = this.nextFieldNode()) {
28412
+ const nullBitmap = this.readNullBitmap(type, nullCount);
28413
+ const views = this.readData(type);
28414
+ const variadicBuffers = this.readVariadicBuffers(this.nextVariadicBufferCount());
28415
+ return (0, data_js_1.makeData)({
28416
+ type,
28417
+ length,
28418
+ nullCount,
28419
+ nullBitmap,
28420
+ ["views"]: views,
28421
+ ["variadicBuffers"]: variadicBuffers
28422
+ });
28423
+ }
27760
28424
  visitFixedSizeBinary(type, { length, nullCount } = this.nextFieldNode()) {
27761
28425
  return (0, data_js_1.makeData)({ type, length, nullCount, nullBitmap: this.readNullBitmap(type, nullCount), data: this.readData(type) });
27762
28426
  }
@@ -27775,6 +28439,9 @@ return true;`);
27775
28439
  visitList(type, { length, nullCount } = this.nextFieldNode()) {
27776
28440
  return (0, data_js_1.makeData)({ type, length, nullCount, nullBitmap: this.readNullBitmap(type, nullCount), valueOffsets: this.readOffsets(type), "child": this.visit(type.children[0]) });
27777
28441
  }
28442
+ visitLargeList(type, { length, nullCount } = this.nextFieldNode()) {
28443
+ return (0, data_js_1.makeData)({ type, length, nullCount, nullBitmap: this.readNullBitmap(type, nullCount), valueOffsets: this.readOffsets(type), "child": this.visit(type.children[0]) });
28444
+ }
27778
28445
  visitStruct(type, { length, nullCount } = this.nextFieldNode()) {
27779
28446
  return (0, data_js_1.makeData)({ type, length, nullCount, nullBitmap: this.readNullBitmap(type, nullCount), children: this.visitMany(type.children) });
27780
28447
  }
@@ -27823,14 +28490,21 @@ return true;`);
27823
28490
  readData(_type, { length, offset } = this.nextBufferRange()) {
27824
28491
  return this.bytes.subarray(offset, offset + length);
27825
28492
  }
28493
+ readVariadicBuffers(length) {
28494
+ return Array.from({ length }, () => this.readData(null));
28495
+ }
28496
+ nextVariadicBufferCount() {
28497
+ var _a2;
28498
+ return (_a2 = this.variadicBufferCounts[++this.variadicBufferIndex]) !== null && _a2 !== void 0 ? _a2 : 0;
28499
+ }
27826
28500
  readDictionary(type) {
27827
28501
  return this.dictionaries.get(type.id);
27828
28502
  }
27829
28503
  };
27830
28504
  exports.VectorLoader = VectorLoader;
27831
28505
  var JSONVectorLoader = class extends VectorLoader {
27832
- constructor(sources, nodes, buffers, dictionaries, metadataVersion) {
27833
- super(new Uint8Array(0), nodes, buffers, dictionaries, metadataVersion);
28506
+ constructor(sources, nodes, buffers, dictionaries, metadataVersion, variadicBufferCounts = []) {
28507
+ super(new Uint8Array(0), nodes, buffers, dictionaries, metadataVersion, variadicBufferCounts);
27834
28508
  this.sources = sources;
27835
28509
  }
27836
28510
  readNullBitmap(_type, nullCount, { offset } = this.nextBufferRange()) {
@@ -27854,6 +28528,10 @@ return true;`);
27854
28528
  return (0, buffer_js_1.toArrayBufferView)(Uint8Array, int_js_1.Int128.convertArray(sources[offset]));
27855
28529
  } else if (type_js_1.DataType.isBinary(type) || type_js_1.DataType.isLargeBinary(type) || type_js_1.DataType.isFixedSizeBinary(type)) {
27856
28530
  return binaryDataFromJSON(sources[offset]);
28531
+ } else if (type_js_1.DataType.isBinaryView(type)) {
28532
+ return binaryViewDataFromJSON(sources[offset]);
28533
+ } else if (type_js_1.DataType.isUtf8View(type)) {
28534
+ return utf8ViewDataFromJSON(sources[offset]);
27857
28535
  } else if (type_js_1.DataType.isBool(type)) {
27858
28536
  return (0, bit_js_1.packBools)(sources[offset]);
27859
28537
  } else if (type_js_1.DataType.isUtf8(type) || type_js_1.DataType.isLargeUtf8(type)) {
@@ -27870,19 +28548,68 @@ return true;`);
27870
28548
  }
27871
28549
  return (0, buffer_js_1.toArrayBufferView)(Uint8Array, (0, buffer_js_1.toArrayBufferView)(type.ArrayType, sources[offset].map((x) => +x)));
27872
28550
  }
28551
+ readVariadicBuffers(length) {
28552
+ const buffers = [];
28553
+ for (let i = 0; i < length; i++) {
28554
+ const { offset } = this.nextBufferRange();
28555
+ const hexString = this.sources[offset];
28556
+ buffers.push(hexStringToBytes(hexString));
28557
+ }
28558
+ return buffers;
28559
+ }
27873
28560
  };
27874
28561
  exports.JSONVectorLoader = JSONVectorLoader;
28562
+ function hexStringToBytes(hexString) {
28563
+ const data = new Uint8Array(hexString.length / 2);
28564
+ for (let i = 0; i < hexString.length; i += 2) {
28565
+ data[i >> 1] = Number.parseInt(hexString.slice(i, i + 2), 16);
28566
+ }
28567
+ return data;
28568
+ }
27875
28569
  function binaryDataFromJSON(values) {
27876
- const joined = values.join("");
27877
- const data = new Uint8Array(joined.length / 2);
27878
- for (let i = 0; i < joined.length; i += 2) {
27879
- data[i >> 1] = Number.parseInt(joined.slice(i, i + 2), 16);
28570
+ return hexStringToBytes(values.join(""));
28571
+ }
28572
+ function parseViewDataFromJSON(views, parseInlined) {
28573
+ const data = new Uint8Array(views.length * 16);
28574
+ const dataView = new DataView(data.buffer);
28575
+ for (const [i, view] of views.entries()) {
28576
+ const offset = i * 16;
28577
+ const size = view["SIZE"];
28578
+ dataView.setInt32(offset, size, true);
28579
+ if (view["INLINED"] !== void 0) {
28580
+ const bytes = parseInlined(view["INLINED"]);
28581
+ for (let j = 0; j < bytes.length && j < 12; j++) {
28582
+ data[offset + 4 + j] = bytes[j];
28583
+ }
28584
+ } else {
28585
+ const prefix = view["PREFIX_HEX"];
28586
+ for (let j = 0; j < 8 && j < prefix.length; j += 2) {
28587
+ data[offset + 4 + (j >> 1)] = Number.parseInt(prefix.slice(j, j + 2), 16);
28588
+ }
28589
+ dataView.setInt32(offset + 8, view["BUFFER_INDEX"], true);
28590
+ dataView.setInt32(offset + 12, view["OFFSET"], true);
28591
+ }
27880
28592
  }
27881
28593
  return data;
27882
28594
  }
28595
+ function binaryViewDataFromJSON(views) {
28596
+ return parseViewDataFromJSON(views, (inlined) => {
28597
+ const bytes = new Uint8Array(inlined.length / 2);
28598
+ for (let i = 0; i < inlined.length; i += 2) {
28599
+ bytes[i >> 1] = Number.parseInt(inlined.slice(i, i + 2), 16);
28600
+ }
28601
+ return bytes;
28602
+ });
28603
+ }
28604
+ function utf8ViewDataFromJSON(views) {
28605
+ return parseViewDataFromJSON(views, (inlined) => {
28606
+ const encoder2 = new TextEncoder();
28607
+ return encoder2.encode(inlined);
28608
+ });
28609
+ }
27883
28610
  var CompressedVectorLoader = class extends VectorLoader {
27884
- constructor(bodyChunks, nodes, buffers, dictionaries, metadataVersion) {
27885
- super(new Uint8Array(0), nodes, buffers, dictionaries, metadataVersion);
28611
+ constructor(bodyChunks, nodes, buffers, dictionaries, metadataVersion, variadicBufferCounts = []) {
28612
+ super(new Uint8Array(0), nodes, buffers, dictionaries, metadataVersion, variadicBufferCounts);
27886
28613
  this.bodyChunks = bodyChunks;
27887
28614
  }
27888
28615
  readData(_type, _buffer = this.nextBufferRange()) {
@@ -28350,6 +29077,51 @@ return true;`);
28350
29077
  }
28351
29078
  });
28352
29079
 
29080
+ // ../node_modules/apache-arrow/builder/largelist.js
29081
+ var require_largelist = __commonJS({
29082
+ "../node_modules/apache-arrow/builder/largelist.js"(exports) {
29083
+ "use strict";
29084
+ Object.defineProperty(exports, "__esModule", { value: true });
29085
+ exports.LargeListBuilder = void 0;
29086
+ var schema_js_1 = require_schema2();
29087
+ var type_js_1 = require_type2();
29088
+ var buffer_js_1 = require_buffer3();
29089
+ var bigint_js_1 = require_bigint();
29090
+ var builder_js_1 = require_builder();
29091
+ var LargeListBuilder = class extends builder_js_1.VariableWidthBuilder {
29092
+ constructor(opts) {
29093
+ super(opts);
29094
+ this._offsets = new buffer_js_1.OffsetsBufferBuilder(opts.type);
29095
+ }
29096
+ addChild(child, name = "0") {
29097
+ if (this.numChildren > 0) {
29098
+ throw new Error("LargeListBuilder can only have one child.");
29099
+ }
29100
+ this.children[this.numChildren] = child;
29101
+ this.type = new type_js_1.LargeList(new schema_js_1.Field(name, child.type, true));
29102
+ return this.numChildren - 1;
29103
+ }
29104
+ _flushPending(pending) {
29105
+ const offsets = this._offsets;
29106
+ const [child] = this.children;
29107
+ for (const [index, value] of pending) {
29108
+ if (typeof value === "undefined") {
29109
+ offsets.set(index, BigInt(0));
29110
+ } else {
29111
+ const v = value;
29112
+ const n = v.length;
29113
+ const start = (0, bigint_js_1.bigIntToNumber)(offsets.set(index, BigInt(n)).buffer[index]);
29114
+ for (let i = -1; ++i < n; ) {
29115
+ child.set(start + i, v[i]);
29116
+ }
29117
+ }
29118
+ }
29119
+ }
29120
+ };
29121
+ exports.LargeListBuilder = LargeListBuilder;
29122
+ }
29123
+ });
29124
+
28353
29125
  // ../node_modules/apache-arrow/builder/map.js
28354
29126
  var require_map3 = __commonJS({
28355
29127
  "../node_modules/apache-arrow/builder/map.js"(exports) {
@@ -28661,6 +29433,154 @@ return true;`);
28661
29433
  }
28662
29434
  });
28663
29435
 
29436
+ // ../node_modules/apache-arrow/builder/binaryview.js
29437
+ var require_binaryview = __commonJS({
29438
+ "../node_modules/apache-arrow/builder/binaryview.js"(exports) {
29439
+ "use strict";
29440
+ Object.defineProperty(exports, "__esModule", { value: true });
29441
+ exports.BinaryViewBuilder = void 0;
29442
+ var type_js_1 = require_type2();
29443
+ var builder_js_1 = require_builder();
29444
+ var buffer_js_1 = require_buffer3();
29445
+ var buffer_js_2 = require_buffer();
29446
+ var data_js_1 = require_data();
29447
+ var BinaryViewBuilder = class extends builder_js_1.Builder {
29448
+ constructor(opts) {
29449
+ super(opts);
29450
+ this._variadicBuffers = [];
29451
+ this._currentBuffer = null;
29452
+ this._currentBufferIndex = 0;
29453
+ this._currentBufferOffset = 0;
29454
+ this._bufferSize = 32 * 1024 * 1024;
29455
+ this._views = new buffer_js_1.BufferBuilder(Uint8Array);
29456
+ }
29457
+ get byteLength() {
29458
+ let size = 0;
29459
+ this._views && (size += this._views.byteLength);
29460
+ this._nulls && (size += this._nulls.byteLength);
29461
+ for (const buffer of this._variadicBuffers) {
29462
+ size += buffer.byteLength;
29463
+ }
29464
+ this._currentBuffer && (size += this._currentBuffer.byteLength);
29465
+ return size;
29466
+ }
29467
+ setValue(index, value) {
29468
+ return this.writeBinaryValue(index, this.encodeValue(value));
29469
+ }
29470
+ writeBinaryValue(index, data) {
29471
+ const length = data.length;
29472
+ const bytesNeeded = (index + 1) * type_js_1.BinaryView.ELEMENT_WIDTH;
29473
+ const currentBytes = this._views.length;
29474
+ if (bytesNeeded > currentBytes) {
29475
+ this._views.reserve(bytesNeeded - currentBytes);
29476
+ }
29477
+ const viewBuffer = this._views.buffer;
29478
+ const viewOffset = index * type_js_1.BinaryView.ELEMENT_WIDTH;
29479
+ const view = new DataView(viewBuffer.buffer, viewBuffer.byteOffset + viewOffset, type_js_1.BinaryView.ELEMENT_WIDTH);
29480
+ view.setInt32(type_js_1.BinaryView.LENGTH_OFFSET, length, true);
29481
+ if (length <= type_js_1.BinaryView.INLINE_CAPACITY) {
29482
+ viewBuffer.set(data, viewOffset + type_js_1.BinaryView.INLINE_OFFSET);
29483
+ for (let i = length; i < type_js_1.BinaryView.INLINE_CAPACITY; i++) {
29484
+ viewBuffer[viewOffset + type_js_1.BinaryView.INLINE_OFFSET + i] = 0;
29485
+ }
29486
+ } else {
29487
+ const prefix = new DataView(data.buffer, data.byteOffset, Math.min(4, length));
29488
+ view.setUint32(type_js_1.BinaryView.INLINE_OFFSET, prefix.getUint32(0, true), true);
29489
+ if (!this._currentBuffer || this._currentBufferOffset + length > this._bufferSize) {
29490
+ if (this._currentBuffer) {
29491
+ this._variadicBuffers.push(this._currentBuffer.buffer.slice(0, this._currentBufferOffset));
29492
+ }
29493
+ this._currentBuffer = new buffer_js_1.BufferBuilder(Uint8Array);
29494
+ this._currentBufferIndex = this._variadicBuffers.length;
29495
+ this._currentBufferOffset = 0;
29496
+ }
29497
+ const bufferData = this._currentBuffer.reserve(length).buffer;
29498
+ bufferData.set(data, this._currentBufferOffset);
29499
+ view.setInt32(type_js_1.BinaryView.BUFFER_INDEX_OFFSET, this._currentBufferIndex, true);
29500
+ view.setInt32(type_js_1.BinaryView.BUFFER_OFFSET_OFFSET, this._currentBufferOffset, true);
29501
+ this._currentBufferOffset += length;
29502
+ }
29503
+ return this;
29504
+ }
29505
+ encodeValue(value) {
29506
+ return (0, buffer_js_2.toUint8Array)(value);
29507
+ }
29508
+ setValid(index, isValid) {
29509
+ const bytesNeeded = (index + 1) * type_js_1.BinaryView.ELEMENT_WIDTH;
29510
+ const currentBytes = this._views.length;
29511
+ if (bytesNeeded > currentBytes) {
29512
+ this._views.reserve(bytesNeeded - currentBytes);
29513
+ }
29514
+ const result = super.setValid(index, isValid);
29515
+ if (!result) {
29516
+ const viewBuffer = this._views.buffer;
29517
+ const viewOffset = index * type_js_1.BinaryView.ELEMENT_WIDTH;
29518
+ for (let i = 0; i < type_js_1.BinaryView.ELEMENT_WIDTH; i++) {
29519
+ viewBuffer[viewOffset + i] = 0;
29520
+ }
29521
+ }
29522
+ return result;
29523
+ }
29524
+ clear() {
29525
+ this._variadicBuffers = [];
29526
+ this._currentBuffer = null;
29527
+ this._currentBufferIndex = 0;
29528
+ this._currentBufferOffset = 0;
29529
+ this._views.clear();
29530
+ return super.clear();
29531
+ }
29532
+ flush() {
29533
+ const { type, length, nullCount, _views, _nulls } = this;
29534
+ if (this._currentBuffer && this._currentBufferOffset > 0) {
29535
+ this._variadicBuffers.push(this._currentBuffer.buffer.slice(0, this._currentBufferOffset));
29536
+ this._currentBuffer = null;
29537
+ this._currentBufferOffset = 0;
29538
+ }
29539
+ const views = _views.flush(length * type_js_1.BinaryView.ELEMENT_WIDTH);
29540
+ const nullBitmap = nullCount > 0 ? _nulls.flush(length) : void 0;
29541
+ const variadicBuffers = this._variadicBuffers.slice();
29542
+ this._variadicBuffers = [];
29543
+ this._currentBufferIndex = 0;
29544
+ this.clear();
29545
+ const props = {
29546
+ type,
29547
+ length,
29548
+ nullCount,
29549
+ nullBitmap,
29550
+ ["views"]: views,
29551
+ ["variadicBuffers"]: variadicBuffers
29552
+ };
29553
+ return (0, data_js_1.makeData)(props);
29554
+ }
29555
+ finish() {
29556
+ this.finished = true;
29557
+ return this;
29558
+ }
29559
+ };
29560
+ exports.BinaryViewBuilder = BinaryViewBuilder;
29561
+ }
29562
+ });
29563
+
29564
+ // ../node_modules/apache-arrow/builder/utf8view.js
29565
+ var require_utf8view = __commonJS({
29566
+ "../node_modules/apache-arrow/builder/utf8view.js"(exports) {
29567
+ "use strict";
29568
+ Object.defineProperty(exports, "__esModule", { value: true });
29569
+ exports.Utf8ViewBuilder = void 0;
29570
+ var binaryview_js_1 = require_binaryview();
29571
+ var utf8_js_1 = require_utf8();
29572
+ var Utf8ViewBuilder = class extends binaryview_js_1.BinaryViewBuilder {
29573
+ constructor(opts) {
29574
+ super(opts);
29575
+ }
29576
+ setValue(index, value) {
29577
+ return this.writeBinaryValue(index, (0, utf8_js_1.encodeUtf8)(value));
29578
+ }
29579
+ };
29580
+ exports.Utf8ViewBuilder = Utf8ViewBuilder;
29581
+ }
29582
+ });
29583
+
28664
29584
  // ../node_modules/apache-arrow/visitor/builderctor.js
28665
29585
  var require_builderctor = __commonJS({
28666
29586
  "../node_modules/apache-arrow/visitor/builderctor.js"(exports) {
@@ -28681,6 +29601,7 @@ return true;`);
28681
29601
  var duration_js_1 = require_duration2();
28682
29602
  var int_js_1 = require_int3();
28683
29603
  var list_js_1 = require_list2();
29604
+ var largelist_js_1 = require_largelist();
28684
29605
  var map_js_1 = require_map3();
28685
29606
  var null_js_1 = require_null2();
28686
29607
  var struct_js_1 = require_struct3();
@@ -28689,6 +29610,8 @@ return true;`);
28689
29610
  var union_js_1 = require_union2();
28690
29611
  var utf8_js_1 = require_utf83();
28691
29612
  var largeutf8_js_1 = require_largeutf8();
29613
+ var binaryview_js_1 = require_binaryview();
29614
+ var utf8view_js_1 = require_utf8view();
28692
29615
  var GetBuilderCtor = class extends visitor_js_1.Visitor {
28693
29616
  visitNull() {
28694
29617
  return null_js_1.NullBuilder;
@@ -28795,6 +29718,9 @@ return true;`);
28795
29718
  visitList() {
28796
29719
  return list_js_1.ListBuilder;
28797
29720
  }
29721
+ visitLargeList() {
29722
+ return largelist_js_1.LargeListBuilder;
29723
+ }
28798
29724
  visitStruct() {
28799
29725
  return struct_js_1.StructBuilder;
28800
29726
  }
@@ -28843,6 +29769,12 @@ return true;`);
28843
29769
  visitMap() {
28844
29770
  return map_js_1.MapBuilder;
28845
29771
  }
29772
+ visitBinaryView() {
29773
+ return binaryview_js_1.BinaryViewBuilder;
29774
+ }
29775
+ visitUtf8View() {
29776
+ return utf8view_js_1.Utf8ViewBuilder;
29777
+ }
28846
29778
  };
28847
29779
  exports.GetBuilderCtor = GetBuilderCtor;
28848
29780
  exports.instance = new GetBuilderCtor();
@@ -28933,8 +29865,10 @@ return true;`);
28933
29865
  TypeComparator.prototype.visitFloat64 = compareFloat;
28934
29866
  TypeComparator.prototype.visitUtf8 = compareAny;
28935
29867
  TypeComparator.prototype.visitLargeUtf8 = compareAny;
29868
+ TypeComparator.prototype.visitUtf8View = compareAny;
28936
29869
  TypeComparator.prototype.visitBinary = compareAny;
28937
29870
  TypeComparator.prototype.visitLargeBinary = compareAny;
29871
+ TypeComparator.prototype.visitBinaryView = compareAny;
28938
29872
  TypeComparator.prototype.visitFixedSizeBinary = compareFixedSizeBinary;
28939
29873
  TypeComparator.prototype.visitDate = compareDate;
28940
29874
  TypeComparator.prototype.visitDateDay = compareDate;
@@ -28951,6 +29885,7 @@ return true;`);
28951
29885
  TypeComparator.prototype.visitTimeNanosecond = compareTime;
28952
29886
  TypeComparator.prototype.visitDecimal = compareAny;
28953
29887
  TypeComparator.prototype.visitList = compareList;
29888
+ TypeComparator.prototype.visitLargeList = compareList;
28954
29889
  TypeComparator.prototype.visitStruct = compareStruct;
28955
29890
  TypeComparator.prototype.visitUnion = compareUnion;
28956
29891
  TypeComparator.prototype.visitDenseUnion = compareUnion;
@@ -29253,7 +30188,16 @@ return true;`);
29253
30188
  var iterator_js_1 = require_iterator();
29254
30189
  var vector_js_2 = require_vector();
29255
30190
  var recordbatch_js_2 = require_recordbatch2();
30191
+ var kTableSymbol = /* @__PURE__ */ Symbol.for("apache-arrow/Table");
29256
30192
  var Table = class _Table {
30193
+ /**
30194
+ * Check if an object is an instance of Table.
30195
+ * This works across different instances of the Arrow library.
30196
+ */
30197
+ /** @nocollapse */
30198
+ static isTable(x) {
30199
+ return (x === null || x === void 0 ? void 0 : x[kTableSymbol]) === true;
30200
+ }
29257
30201
  constructor(...args) {
29258
30202
  var _b2, _c;
29259
30203
  if (args.length === 0) {
@@ -29528,12 +30472,18 @@ return true;`);
29528
30472
  proto._offsets = new Uint32Array([0]);
29529
30473
  proto._nullCount = -1;
29530
30474
  proto[Symbol.isConcatSpreadable] = true;
30475
+ proto[kTableSymbol] = true;
29531
30476
  proto["isValid"] = (0, chunk_js_1.wrapChunkedCall1)(chunk_js_1.isChunkedValid);
29532
30477
  proto["get"] = (0, chunk_js_1.wrapChunkedCall1)(get_js_1.instance.getVisitFn(enum_js_1.Type.Struct));
29533
30478
  proto["set"] = (0, chunk_js_1.wrapChunkedCall2)(set_js_1.instance.getVisitFn(enum_js_1.Type.Struct));
29534
30479
  proto["indexOf"] = (0, chunk_js_1.wrapChunkedIndexOf)(indexof_js_1.instance.getVisitFn(enum_js_1.Type.Struct));
29535
30480
  return "Table";
29536
30481
  })(Table.prototype);
30482
+ Object.defineProperty(Table, Symbol.hasInstance, {
30483
+ value: function isTableInstance(instance) {
30484
+ return Function.prototype[Symbol.hasInstance].call(this, instance) || this === Table && Table.isTable(instance);
30485
+ }
30486
+ });
29537
30487
  function makeTable(input) {
29538
30488
  const vecs = {};
29539
30489
  const inputs = Object.entries(input);
@@ -29572,9 +30522,19 @@ return true;`);
29572
30522
  var set_js_1 = require_set();
29573
30523
  var indexof_js_1 = require_indexof();
29574
30524
  var iterator_js_1 = require_iterator();
30525
+ var kRecordBatchSymbol = /* @__PURE__ */ Symbol.for("apache-arrow/RecordBatch");
29575
30526
  var RecordBatch = class _RecordBatch {
30527
+ /**
30528
+ * Check if an object is an instance of RecordBatch.
30529
+ * This works across different instances of the Arrow library.
30530
+ */
30531
+ /** @nocollapse */
30532
+ static isRecordBatch(x) {
30533
+ return (x === null || x === void 0 ? void 0 : x[kRecordBatchSymbol]) === true;
30534
+ }
29576
30535
  constructor(...args) {
29577
30536
  switch (args.length) {
30537
+ case 3:
29578
30538
  case 2: {
29579
30539
  [this.schema] = args;
29580
30540
  if (!(this.schema instanceof schema_js_1.Schema)) {
@@ -29586,12 +30546,13 @@ return true;`);
29586
30546
  nullCount: 0,
29587
30547
  type: new type_js_1.Struct(this.schema.fields),
29588
30548
  children: this.schema.fields.map((f2) => (0, data_js_1.makeData)({ type: f2.type, nullCount: 0 }))
29589
- })
30549
+ }),
30550
+ this._metadata = /* @__PURE__ */ new Map()
29590
30551
  ] = args;
29591
30552
  if (!(this.data instanceof data_js_1.Data)) {
29592
30553
  throw new TypeError("RecordBatch constructor expects a [Schema, Data] pair.");
29593
30554
  }
29594
- [this.schema, this.data] = ensureSameLengthData(this.schema, this.data.children);
30555
+ [this.schema, this.data] = ensureSameLengthData(this.schema, this.data.children, this.data.length);
29595
30556
  break;
29596
30557
  }
29597
30558
  case 1: {
@@ -29609,12 +30570,19 @@ return true;`);
29609
30570
  const schema = new schema_js_1.Schema(fields);
29610
30571
  const data = (0, data_js_1.makeData)({ type: new type_js_1.Struct(fields), length, children, nullCount: 0 });
29611
30572
  [this.schema, this.data] = ensureSameLengthData(schema, data.children, length);
30573
+ this._metadata = /* @__PURE__ */ new Map();
29612
30574
  break;
29613
30575
  }
29614
30576
  default:
29615
30577
  throw new TypeError("RecordBatch constructor expects an Object mapping names to child Data, or a [Schema, Data] pair.");
29616
30578
  }
29617
30579
  }
30580
+ /**
30581
+ * Custom metadata for this RecordBatch.
30582
+ */
30583
+ get metadata() {
30584
+ return this._metadata;
30585
+ }
29618
30586
  get dictionaries() {
29619
30587
  return this._dictionaries || (this._dictionaries = collectDictionaries(this.schema.fields, this.data.children));
29620
30588
  }
@@ -29700,7 +30668,7 @@ return true;`);
29700
30668
  */
29701
30669
  slice(begin, end) {
29702
30670
  const [slice] = new vector_js_1.Vector([this.data]).slice(begin, end).data;
29703
- return new _RecordBatch(this.schema, slice);
30671
+ return new _RecordBatch(this.schema, slice, this._metadata);
29704
30672
  }
29705
30673
  /**
29706
30674
  * Returns a child Vector by name, or null if this Vector has no child with the given name.
@@ -29741,9 +30709,9 @@ return true;`);
29741
30709
  const field = fields[index].clone({ type: child.type });
29742
30710
  [fields[index], children[index]] = [field, child.data[0]];
29743
30711
  schema = new schema_js_1.Schema(fields, new Map(this.schema.metadata));
29744
- data = (0, data_js_1.makeData)({ type: new type_js_1.Struct(fields), children });
30712
+ data = (0, data_js_1.makeData)({ type: new type_js_1.Struct(fields), length: data.length, children });
29745
30713
  }
29746
- return new _RecordBatch(schema, data);
30714
+ return new _RecordBatch(schema, data, this._metadata);
29747
30715
  }
29748
30716
  /**
29749
30717
  * Construct a new RecordBatch containing only specified columns.
@@ -29761,7 +30729,7 @@ return true;`);
29761
30729
  children[index] = this.data.children[index];
29762
30730
  }
29763
30731
  }
29764
- return new _RecordBatch(schema, (0, data_js_1.makeData)({ type, length: this.numRows, children }));
30732
+ return new _RecordBatch(schema, (0, data_js_1.makeData)({ type, length: this.numRows, children }), this._metadata);
29765
30733
  }
29766
30734
  /**
29767
30735
  * Construct a new RecordBatch containing only columns at the specified indices.
@@ -29773,7 +30741,7 @@ return true;`);
29773
30741
  const schema = this.schema.selectAt(columnIndices);
29774
30742
  const children = columnIndices.map((i) => this.data.children[i]).filter(Boolean);
29775
30743
  const subset = (0, data_js_1.makeData)({ type: new type_js_1.Struct(schema.fields), length: this.numRows, children });
29776
- return new _RecordBatch(schema, subset);
30744
+ return new _RecordBatch(schema, subset, this._metadata);
29777
30745
  }
29778
30746
  };
29779
30747
  exports.RecordBatch = RecordBatch;
@@ -29781,8 +30749,14 @@ return true;`);
29781
30749
  RecordBatch[_a2] = ((proto) => {
29782
30750
  proto._nullCount = -1;
29783
30751
  proto[Symbol.isConcatSpreadable] = true;
30752
+ proto[kRecordBatchSymbol] = true;
29784
30753
  return "RecordBatch";
29785
30754
  })(RecordBatch.prototype);
30755
+ Object.defineProperty(RecordBatch, Symbol.hasInstance, {
30756
+ value: function isRecordBatchInstance(instance) {
30757
+ return Function.prototype[Symbol.hasInstance].call(this, instance) || this === RecordBatch && RecordBatch.isRecordBatch(instance);
30758
+ }
30759
+ });
29786
30760
  function ensureSameLengthData(schema, chunks, maxLength = chunks.reduce((max, col) => Math.max(max, col.length), 0)) {
29787
30761
  var _b2;
29788
30762
  const fields = [...schema.fields];
@@ -29829,10 +30803,10 @@ return true;`);
29829
30803
  return dictionaries;
29830
30804
  }
29831
30805
  var _InternalEmptyPlaceholderRecordBatch = class extends RecordBatch {
29832
- constructor(schema) {
30806
+ constructor(schema, metadata) {
29833
30807
  const children = schema.fields.map((f2) => (0, data_js_1.makeData)({ type: f2.type }));
29834
- const data = (0, data_js_1.makeData)({ type: new type_js_1.Struct(schema.fields), nullCount: 0, children });
29835
- super(schema, data);
30808
+ const data = (0, data_js_1.makeData)({ type: new type_js_1.Struct(schema.fields), length: 0, nullCount: 0, children });
30809
+ super(schema, data, metadata || /* @__PURE__ */ new Map());
29836
30810
  }
29837
30811
  };
29838
30812
  exports._InternalEmptyPlaceholderRecordBatch = _InternalEmptyPlaceholderRecordBatch;
@@ -30068,6 +31042,8 @@ return true;`);
30068
31042
  ...column["TYPE_ID"] && [column["TYPE_ID"]] || [],
30069
31043
  ...column["OFFSET"] && [column["OFFSET"]] || [],
30070
31044
  ...column["DATA"] && [column["DATA"]] || [],
31045
+ ...column["VIEWS"] && [column["VIEWS"]] || [],
31046
+ ...column["VARIADIC_DATA_BUFFERS"] || [],
30071
31047
  ...flattenDataSources(column["children"])
30072
31048
  ], []);
30073
31049
  }
@@ -30449,7 +31425,7 @@ return true;`);
30449
31425
  this.dictionaries = /* @__PURE__ */ new Map();
30450
31426
  return this;
30451
31427
  }
30452
- _loadRecordBatch(header, body) {
31428
+ _loadRecordBatch(header, body, messageMetadata) {
30453
31429
  let children;
30454
31430
  if (header.compression != null) {
30455
31431
  const codec = registry_js_1.compressionRegistry.get(header.compression.type);
@@ -30464,7 +31440,7 @@ return true;`);
30464
31440
  children = this._loadVectors(header, body, this.schema.fields);
30465
31441
  }
30466
31442
  const data = (0, data_js_1.makeData)({ type: new type_js_1.Struct(this.schema.fields), length: header.length, children });
30467
- return new recordbatch_js_1.RecordBatch(this.schema, data);
31443
+ return new recordbatch_js_1.RecordBatch(this.schema, data, messageMetadata);
30468
31444
  }
30469
31445
  _loadDictionaryBatch(header, body) {
30470
31446
  const { id, isDelta } = header;
@@ -30477,7 +31453,7 @@ return true;`);
30477
31453
  if ((codec === null || codec === void 0 ? void 0 : codec.decode) && typeof codec.decode === "function") {
30478
31454
  const { decommpressedBody, buffers } = this._decompressBuffers(header.data, body, codec);
30479
31455
  data = this._loadCompressedVectors(header.data, decommpressedBody, [type]);
30480
- header = new metadata.DictionaryBatch(new metadata.RecordBatch(header.data.length, header.data.nodes, buffers, null), id, isDelta);
31456
+ header = new metadata.DictionaryBatch(new metadata.RecordBatch(header.data.length, header.data.nodes, buffers, null, header.data.variadicBufferCounts), id, isDelta);
30481
31457
  } else {
30482
31458
  throw new Error("Dictionary batch is compressed but codec not found");
30483
31459
  }
@@ -30487,10 +31463,10 @@ return true;`);
30487
31463
  return (dictionary && isDelta ? dictionary.concat(new vector_js_1.Vector(data)) : new vector_js_1.Vector(data)).memoize();
30488
31464
  }
30489
31465
  _loadVectors(header, body, types) {
30490
- return new vectorloader_js_1.VectorLoader(body, header.nodes, header.buffers, this.dictionaries, this.schema.metadataVersion).visitMany(types);
31466
+ return new vectorloader_js_1.VectorLoader(body, header.nodes, header.buffers, this.dictionaries, this.schema.metadataVersion, header.variadicBufferCounts).visitMany(types);
30491
31467
  }
30492
31468
  _loadCompressedVectors(header, body, types) {
30493
- return new vectorloader_js_1.CompressedVectorLoader(body, header.nodes, header.buffers, this.dictionaries, this.schema.metadataVersion).visitMany(types);
31469
+ return new vectorloader_js_1.CompressedVectorLoader(body, header.nodes, header.buffers, this.dictionaries, this.schema.metadataVersion, header.variadicBufferCounts).visitMany(types);
30494
31470
  }
30495
31471
  _decompressBuffers(header, body, codec) {
30496
31472
  const decompressedBuffers = [];
@@ -30573,7 +31549,7 @@ return true;`);
30573
31549
  this._recordBatchIndex++;
30574
31550
  const header = message2.header();
30575
31551
  const buffer = reader.readMessageBody(message2.bodyLength);
30576
- const recordBatch = this._loadRecordBatch(header, buffer);
31552
+ const recordBatch = this._loadRecordBatch(header, buffer, message2.metadata);
30577
31553
  return { done: false, value: recordBatch };
30578
31554
  } else if (message2.isDictionaryBatch()) {
30579
31555
  this._dictionaryIndex++;
@@ -30657,7 +31633,7 @@ return true;`);
30657
31633
  this._recordBatchIndex++;
30658
31634
  const header = message2.header();
30659
31635
  const buffer = yield reader.readMessageBody(message2.bodyLength);
30660
- const recordBatch = this._loadRecordBatch(header, buffer);
31636
+ const recordBatch = this._loadRecordBatch(header, buffer, message2.metadata);
30661
31637
  return { done: false, value: recordBatch };
30662
31638
  } else if (message2.isDictionaryBatch()) {
30663
31639
  this._dictionaryIndex++;
@@ -30722,7 +31698,7 @@ return true;`);
30722
31698
  if (message2 === null || message2 === void 0 ? void 0 : message2.isRecordBatch()) {
30723
31699
  const header = message2.header();
30724
31700
  const buffer = this._reader.readMessageBody(message2.bodyLength);
30725
- const recordBatch = this._loadRecordBatch(header, buffer);
31701
+ const recordBatch = this._loadRecordBatch(header, buffer, message2.metadata);
30726
31702
  return recordBatch;
30727
31703
  }
30728
31704
  }
@@ -30812,7 +31788,7 @@ return true;`);
30812
31788
  if (message2 === null || message2 === void 0 ? void 0 : message2.isRecordBatch()) {
30813
31789
  const header = message2.header();
30814
31790
  const buffer = yield this._reader.readMessageBody(message2.bodyLength);
30815
- const recordBatch = this._loadRecordBatch(header, buffer);
31791
+ const recordBatch = this._loadRecordBatch(header, buffer, message2.metadata);
30816
31792
  return recordBatch;
30817
31793
  }
30818
31794
  }
@@ -30864,7 +31840,7 @@ return true;`);
30864
31840
  super(source, dictionaries);
30865
31841
  }
30866
31842
  _loadVectors(header, body, types) {
30867
- return new vectorloader_js_1.JSONVectorLoader(body, header.nodes, header.buffers, this.dictionaries, this.schema.metadataVersion).visitMany(types);
31843
+ return new vectorloader_js_1.JSONVectorLoader(body, header.nodes, header.buffers, this.dictionaries, this.schema.metadataVersion, header.variadicBufferCounts).visitMany(types);
30868
31844
  }
30869
31845
  };
30870
31846
  function shouldAutoDestroy(self2, options) {
@@ -30955,6 +31931,7 @@ return true;`);
30955
31931
  this._nodes = [];
30956
31932
  this._buffers = [];
30957
31933
  this._bufferRegions = [];
31934
+ this._variadicBufferCounts = [];
30958
31935
  }
30959
31936
  visit(data) {
30960
31937
  if (data instanceof vector_js_1.Vector) {
@@ -30997,6 +31974,9 @@ return true;`);
30997
31974
  get bufferRegions() {
30998
31975
  return this._bufferRegions;
30999
31976
  }
31977
+ get variadicBufferCounts() {
31978
+ return this._variadicBufferCounts;
31979
+ }
31000
31980
  };
31001
31981
  exports.VectorAssembler = VectorAssembler;
31002
31982
  function addBuffer(values) {
@@ -31044,7 +32024,7 @@ return true;`);
31044
32024
  function assembleBoolVector(data) {
31045
32025
  let values;
31046
32026
  if (data.nullCount >= data.length) {
31047
- return addBuffer.call(this, new Uint8Array(0));
32027
+ return addBuffer.call(this, new Uint8Array(data.length + 7 >> 3));
31048
32028
  } else if ((values = data.values) instanceof Uint8Array) {
31049
32029
  return addBuffer.call(this, (0, bit_js_1.truncateBitmap)(data.offset, data.length, values));
31050
32030
  }
@@ -31062,10 +32042,25 @@ return true;`);
31062
32042
  addBuffer.call(this, values.subarray(begin, begin + byteLength));
31063
32043
  return this;
31064
32044
  }
32045
+ function assembleBinaryViewVector(data) {
32046
+ const { offset, length, stride, values, variadicBuffers = [] } = data;
32047
+ if (!values) {
32048
+ throw new Error("BinaryView data is missing view buffer");
32049
+ }
32050
+ const start = offset * stride;
32051
+ const end = start + length * stride;
32052
+ addBuffer.call(this, values.subarray(start, end));
32053
+ for (const buffer of variadicBuffers) {
32054
+ addBuffer.call(this, buffer);
32055
+ }
32056
+ this._variadicBufferCounts.push(variadicBuffers.length);
32057
+ return this;
32058
+ }
31065
32059
  function assembleListVector(data) {
31066
32060
  const { length, valueOffsets } = data;
31067
32061
  if (valueOffsets) {
31068
- const { [0]: begin, [length]: end } = valueOffsets;
32062
+ const begin = (0, bigint_js_1.bigIntToNumber)(valueOffsets[0]);
32063
+ const end = (0, bigint_js_1.bigIntToNumber)(valueOffsets[length]);
31069
32064
  addBuffer.call(this, (0, buffer_js_1.rebaseValueOffsets)(-begin, length + 1, valueOffsets));
31070
32065
  return this.visit(data.children[0].slice(begin, end - begin));
31071
32066
  }
@@ -31079,14 +32074,17 @@ return true;`);
31079
32074
  VectorAssembler.prototype.visitFloat = assembleFlatVector;
31080
32075
  VectorAssembler.prototype.visitUtf8 = assembleFlatListVector;
31081
32076
  VectorAssembler.prototype.visitLargeUtf8 = assembleFlatListVector;
32077
+ VectorAssembler.prototype.visitUtf8View = assembleBinaryViewVector;
31082
32078
  VectorAssembler.prototype.visitBinary = assembleFlatListVector;
31083
32079
  VectorAssembler.prototype.visitLargeBinary = assembleFlatListVector;
32080
+ VectorAssembler.prototype.visitBinaryView = assembleBinaryViewVector;
31084
32081
  VectorAssembler.prototype.visitFixedSizeBinary = assembleFlatVector;
31085
32082
  VectorAssembler.prototype.visitDate = assembleFlatVector;
31086
32083
  VectorAssembler.prototype.visitTimestamp = assembleFlatVector;
31087
32084
  VectorAssembler.prototype.visitTime = assembleFlatVector;
31088
32085
  VectorAssembler.prototype.visitDecimal = assembleFlatVector;
31089
32086
  VectorAssembler.prototype.visitList = assembleListVector;
32087
+ VectorAssembler.prototype.visitLargeList = assembleListVector;
31090
32088
  VectorAssembler.prototype.visitStruct = assembleNestedVector;
31091
32089
  VectorAssembler.prototype.visitUnion = assembleUnion;
31092
32090
  VectorAssembler.prototype.visitInterval = assembleFlatVector;
@@ -31124,6 +32122,9 @@ return true;`);
31124
32122
  visitLargeBinary({ typeId }) {
31125
32123
  return { "name": type_js_1.Type[typeId].toLowerCase() };
31126
32124
  }
32125
+ visitBinaryView({ typeId }) {
32126
+ return { "name": type_js_1.Type[typeId].toLowerCase() };
32127
+ }
31127
32128
  visitBool({ typeId }) {
31128
32129
  return { "name": type_js_1.Type[typeId].toLowerCase() };
31129
32130
  }
@@ -31133,6 +32134,9 @@ return true;`);
31133
32134
  visitLargeUtf8({ typeId }) {
31134
32135
  return { "name": type_js_1.Type[typeId].toLowerCase() };
31135
32136
  }
32137
+ visitUtf8View({ typeId }) {
32138
+ return { "name": type_js_1.Type[typeId].toLowerCase() };
32139
+ }
31136
32140
  visitDecimal({ typeId, scale, precision, bitWidth }) {
31137
32141
  return { "name": type_js_1.Type[typeId].toLowerCase(), "scale": scale, "precision": precision, "bitWidth": bitWidth };
31138
32142
  }
@@ -31154,6 +32158,9 @@ return true;`);
31154
32158
  visitList({ typeId }) {
31155
32159
  return { "name": type_js_1.Type[typeId].toLowerCase() };
31156
32160
  }
32161
+ visitLargeList({ typeId }) {
32162
+ return { "name": type_js_1.Type[typeId].toLowerCase() };
32163
+ }
31157
32164
  visitStruct({ typeId }) {
31158
32165
  return { "name": type_js_1.Type[typeId].toLowerCase() };
31159
32166
  }
@@ -31186,7 +32193,7 @@ return true;`);
31186
32193
  "../node_modules/apache-arrow/visitor/jsonvectorassembler.js"(exports) {
31187
32194
  "use strict";
31188
32195
  Object.defineProperty(exports, "__esModule", { value: true });
31189
- exports.JSONVectorAssembler = void 0;
32196
+ exports.bigNumsToStrings = exports.JSONVectorAssembler = void 0;
31190
32197
  var bn_js_1 = require_bn();
31191
32198
  var vector_js_1 = require_vector2();
31192
32199
  var visitor_js_1 = require_visitor();
@@ -31236,6 +32243,12 @@ return true;`);
31236
32243
  visitLargeBinary(data) {
31237
32244
  return { "DATA": [...binaryToString(new vector_js_1.Vector([data]))], "OFFSET": [...bigNumsToStrings(data.valueOffsets, 2)] };
31238
32245
  }
32246
+ visitBinaryView(data) {
32247
+ return binaryViewDataToJSON(data, (bytes) => Array.from(bytes).map((b) => ("0" + (b & 255).toString(16)).slice(-2)).join("").toUpperCase());
32248
+ }
32249
+ visitUtf8View(data) {
32250
+ return binaryViewDataToJSON(data, (bytes) => Array.from(bytes).map((b) => String.fromCodePoint(b)).join(""));
32251
+ }
31239
32252
  visitFixedSizeBinary(data) {
31240
32253
  return { "DATA": [...binaryToString(new vector_js_1.Vector([data]))] };
31241
32254
  }
@@ -31261,6 +32274,12 @@ return true;`);
31261
32274
  "children": this.visitMany(data.type.children, data.children)
31262
32275
  };
31263
32276
  }
32277
+ visitLargeList(data) {
32278
+ return {
32279
+ "OFFSET": [...bigNumsToStrings(data.valueOffsets, 2)],
32280
+ "children": this.visitMany(data.type.children, data.children)
32281
+ };
32282
+ }
31264
32283
  visitStruct(data) {
31265
32284
  return {
31266
32285
  "children": this.visitMany(data.type.children, data.children)
@@ -31307,11 +32326,37 @@ return true;`);
31307
32326
  }
31308
32327
  }
31309
32328
  function* bigNumsToStrings(values, stride) {
31310
- const u32s = new Uint32Array(values.buffer);
32329
+ const u32s = new Uint32Array(values.buffer, values.byteOffset, values.byteLength / Uint32Array.BYTES_PER_ELEMENT);
31311
32330
  for (let i = -1, n = u32s.length / stride; ++i < n; ) {
31312
32331
  yield `${bn_js_1.BN.new(u32s.subarray((i + 0) * stride, (i + 1) * stride), false)}`;
31313
32332
  }
31314
32333
  }
32334
+ exports.bigNumsToStrings = bigNumsToStrings;
32335
+ function binaryViewDataToJSON(data, formatInlined) {
32336
+ const INLINE_SIZE = 12;
32337
+ const viewsData = data.values;
32338
+ const dataView = new DataView(viewsData.buffer, viewsData.byteOffset, viewsData.byteLength);
32339
+ const numViews = viewsData.byteLength / 16;
32340
+ const bytesToHex = (bytes) => Array.from(bytes).map((b) => ("0" + (b & 255).toString(16)).slice(-2)).join("").toUpperCase();
32341
+ const parsedViews = Array.from({ length: numViews }, (_, i) => {
32342
+ const offset = i * 16;
32343
+ const size = dataView.getInt32(offset, true);
32344
+ return [offset, size];
32345
+ }).map(([offset, size]) => size > INLINE_SIZE ? {
32346
+ "SIZE": size,
32347
+ "PREFIX_HEX": bytesToHex(viewsData.subarray(offset + 4, offset + 8)),
32348
+ "BUFFER_INDEX": dataView.getInt32(offset + 8, true),
32349
+ "OFFSET": dataView.getInt32(offset + 12, true)
32350
+ } : {
32351
+ "SIZE": size,
32352
+ "INLINED": formatInlined(viewsData.subarray(offset + 4, offset + 4 + size))
32353
+ });
32354
+ const uniqueBufferIndices = [...new Set(parsedViews.map((v) => v["BUFFER_INDEX"]).filter((idx) => idx !== void 0))];
32355
+ const variadicBuffers = uniqueBufferIndices.map((bufferIndex) => bytesToHex(data.variadicBuffers[bufferIndex]));
32356
+ const bufferIndexMap = new Map(uniqueBufferIndices.map((bufferIndex, outputIndex) => [bufferIndex, outputIndex]));
32357
+ const views = parsedViews.map((v) => v["BUFFER_INDEX"] !== void 0 ? Object.assign(Object.assign({}, v), { "BUFFER_INDEX": bufferIndexMap.get(v["BUFFER_INDEX"]) }) : v);
32358
+ return { "VIEWS": views, "VARIADIC_DATA_BUFFERS": variadicBuffers };
32359
+ }
31315
32360
  }
31316
32361
  });
31317
32362
 
@@ -31520,17 +32565,17 @@ return true;`);
31520
32565
  return nBytes > 0 ? this._write(new Uint8Array(nBytes)) : this;
31521
32566
  }
31522
32567
  _writeRecordBatch(batch) {
31523
- const { byteLength, nodes, bufferRegions, buffers } = this._assembleRecordBatch(batch);
31524
- const recordBatch = new metadata.RecordBatch(batch.numRows, nodes, bufferRegions, this._compression);
32568
+ const { byteLength, nodes, bufferRegions, buffers, variadicBufferCounts } = this._assembleRecordBatch(batch);
32569
+ const recordBatch = new metadata.RecordBatch(batch.numRows, nodes, bufferRegions, this._compression, variadicBufferCounts, batch.metadata);
31525
32570
  const message2 = message_js_2.Message.from(recordBatch, byteLength);
31526
32571
  return this._writeDictionaries(batch)._writeMessage(message2)._writeBodyBuffers(buffers);
31527
32572
  }
31528
32573
  _assembleRecordBatch(batch) {
31529
- let { byteLength, nodes, bufferRegions, buffers } = vectorassembler_js_1.VectorAssembler.assemble(batch);
32574
+ let { byteLength, nodes, bufferRegions, buffers, variadicBufferCounts } = vectorassembler_js_1.VectorAssembler.assemble(batch);
31530
32575
  if (this._compression != null) {
31531
32576
  ({ byteLength, bufferRegions, buffers } = this._compressBodyBuffers(buffers));
31532
32577
  }
31533
- return { byteLength, nodes, bufferRegions, buffers };
32578
+ return { byteLength, nodes, bufferRegions, buffers, variadicBufferCounts };
31534
32579
  }
31535
32580
  _compressBodyBuffers(buffers) {
31536
32581
  const codec = registry_js_1.compressionRegistry.get(this._compression.type);
@@ -31565,8 +32610,8 @@ return true;`);
31565
32610
  return { byteLength: currentOffset, bufferRegions, buffers: compressedBuffers };
31566
32611
  }
31567
32612
  _writeDictionaryBatch(dictionary, id, isDelta = false) {
31568
- const { byteLength, nodes, bufferRegions, buffers } = this._assembleRecordBatch(new vector_js_1.Vector([dictionary]));
31569
- const recordBatch = new metadata.RecordBatch(dictionary.length, nodes, bufferRegions, this._compression);
32613
+ const { byteLength, nodes, bufferRegions, buffers, variadicBufferCounts } = this._assembleRecordBatch(new vector_js_1.Vector([dictionary]));
32614
+ const recordBatch = new metadata.RecordBatch(dictionary.length, nodes, bufferRegions, this._compression, variadicBufferCounts);
31570
32615
  const dictionaryBatch = new metadata.DictionaryBatch(recordBatch, id, isDelta);
31571
32616
  const message2 = message_js_2.Message.from(dictionaryBatch, byteLength);
31572
32617
  return this._writeMessage(message2)._writeBodyBuffers(buffers);
@@ -32116,15 +33161,58 @@ return true;`);
32116
33161
  }
32117
33162
  });
32118
33163
 
33164
+ // ../node_modules/apache-arrow/util/typecheck.js
33165
+ var require_typecheck = __commonJS({
33166
+ "../node_modules/apache-arrow/util/typecheck.js"(exports) {
33167
+ "use strict";
33168
+ Object.defineProperty(exports, "__esModule", { value: true });
33169
+ exports.isArrowTable = exports.isArrowRecordBatch = exports.isArrowVector = exports.isArrowData = exports.isArrowDataType = exports.isArrowField = exports.isArrowSchema = void 0;
33170
+ var schema_js_1 = require_schema2();
33171
+ var type_js_1 = require_type2();
33172
+ var data_js_1 = require_data();
33173
+ var vector_js_1 = require_vector2();
33174
+ var recordbatch_js_1 = require_recordbatch2();
33175
+ var table_js_1 = require_table();
33176
+ function isArrowSchema(x) {
33177
+ return schema_js_1.Schema.isSchema(x);
33178
+ }
33179
+ exports.isArrowSchema = isArrowSchema;
33180
+ function isArrowField(x) {
33181
+ return schema_js_1.Field.isField(x);
33182
+ }
33183
+ exports.isArrowField = isArrowField;
33184
+ function isArrowDataType(x) {
33185
+ return type_js_1.DataType.isDataType(x);
33186
+ }
33187
+ exports.isArrowDataType = isArrowDataType;
33188
+ function isArrowData(x) {
33189
+ return data_js_1.Data.isData(x);
33190
+ }
33191
+ exports.isArrowData = isArrowData;
33192
+ function isArrowVector(x) {
33193
+ return vector_js_1.Vector.isVector(x);
33194
+ }
33195
+ exports.isArrowVector = isArrowVector;
33196
+ function isArrowRecordBatch(x) {
33197
+ return recordbatch_js_1.RecordBatch.isRecordBatch(x);
33198
+ }
33199
+ exports.isArrowRecordBatch = isArrowRecordBatch;
33200
+ function isArrowTable(x) {
33201
+ return table_js_1.Table.isTable(x);
33202
+ }
33203
+ exports.isArrowTable = isArrowTable;
33204
+ }
33205
+ });
33206
+
32119
33207
  // ../node_modules/apache-arrow/Arrow.js
32120
33208
  var require_Arrow = __commonJS({
32121
33209
  "../node_modules/apache-arrow/Arrow.js"(exports) {
32122
33210
  "use strict";
32123
33211
  Object.defineProperty(exports, "__esModule", { value: true });
32124
- exports.Union = exports.Struct = exports.List = exports.Decimal = exports.TimeNanosecond = exports.TimeMicrosecond = exports.TimeMillisecond = exports.TimeSecond = exports.Time = exports.TimestampNanosecond = exports.TimestampMicrosecond = exports.TimestampMillisecond = exports.TimestampSecond = exports.Timestamp = exports.DateMillisecond = exports.DateDay = exports.Date_ = exports.FixedSizeBinary = exports.LargeBinary = exports.Binary = exports.LargeUtf8 = exports.Utf8 = exports.Float64 = exports.Float32 = exports.Float16 = exports.Float = exports.Uint64 = exports.Uint32 = exports.Uint16 = exports.Uint8 = exports.Int64 = exports.Int32 = exports.Int16 = exports.Int8 = exports.Int = exports.Bool = exports.Null = exports.DataType = exports.makeData = exports.Data = exports.MetadataVersion = exports.IntervalUnit = exports.UnionMode = exports.Precision = exports.TimeUnit = exports.DateUnit = exports.BufferType = exports.Type = exports.CompressionType = exports.MessageHeader = void 0;
32125
- exports.Uint32Builder = exports.Uint16Builder = exports.Uint8Builder = exports.Int64Builder = exports.Int32Builder = exports.Int16Builder = exports.Int8Builder = exports.IntBuilder = exports.Float64Builder = exports.Float32Builder = exports.Float16Builder = exports.FloatBuilder = exports.FixedSizeBinaryBuilder = exports.DictionaryBuilder = exports.DecimalBuilder = exports.DateMillisecondBuilder = exports.DateDayBuilder = exports.DateBuilder = exports.NullBuilder = exports.BoolBuilder = exports.builderThroughAsyncIterable = exports.builderThroughIterable = exports.tableFromJSON = exports.vectorFromArray = exports.makeBuilder = exports.Builder = exports.StructRow = exports.MapRow = exports.Field = exports.Schema = exports.Visitor = exports.makeVector = exports.Vector = exports.tableFromArrays = exports.makeTable = exports.Table = exports.Map_ = exports.FixedSizeList = exports.DurationNanosecond = exports.DurationMicrosecond = exports.DurationMillisecond = exports.DurationSecond = exports.Duration = exports.IntervalMonthDayNano = exports.IntervalYearMonth = exports.IntervalDayTime = exports.Interval = exports.Dictionary = exports.SparseUnion = exports.DenseUnion = void 0;
32126
- exports.Message = exports.JSONMessageReader = exports.AsyncMessageReader = exports.MessageReader = exports.compressionRegistry = exports.tableFromIPC = exports.tableToIPC = exports.RecordBatchJSONWriter = exports.RecordBatchStreamWriter = exports.RecordBatchFileWriter = exports.RecordBatchWriter = exports.AsyncRecordBatchStreamReader = exports.AsyncRecordBatchFileReader = exports.RecordBatchStreamReader = exports.RecordBatchFileReader = exports.RecordBatchReader = exports.AsyncByteQueue = exports.AsyncByteStream = exports.ByteStream = exports.DenseUnionBuilder = exports.SparseUnionBuilder = exports.UnionBuilder = exports.StructBuilder = exports.MapBuilder = exports.FixedSizeListBuilder = exports.ListBuilder = exports.LargeBinaryBuilder = exports.BinaryBuilder = exports.LargeUtf8Builder = exports.Utf8Builder = exports.DurationNanosecondBuilder = exports.DurationMicrosecondBuilder = exports.DurationMillisecondBuilder = exports.DurationSecondBuilder = exports.DurationBuilder = exports.IntervalMonthDayNanoBuilder = exports.IntervalYearMonthBuilder = exports.IntervalDayTimeBuilder = exports.IntervalBuilder = exports.TimestampNanosecondBuilder = exports.TimestampMicrosecondBuilder = exports.TimestampMillisecondBuilder = exports.TimestampSecondBuilder = exports.TimestampBuilder = exports.TimeNanosecondBuilder = exports.TimeMicrosecondBuilder = exports.TimeMillisecondBuilder = exports.TimeSecondBuilder = exports.TimeBuilder = exports.Uint64Builder = void 0;
32127
- exports.util = exports.RecordBatch = void 0;
33212
+ exports.List = exports.Decimal = exports.TimeNanosecond = exports.TimeMicrosecond = exports.TimeMillisecond = exports.TimeSecond = exports.Time = exports.TimestampNanosecond = exports.TimestampMicrosecond = exports.TimestampMillisecond = exports.TimestampSecond = exports.Timestamp = exports.DateMillisecond = exports.DateDay = exports.Date_ = exports.FixedSizeBinary = exports.BinaryView = exports.LargeBinary = exports.Binary = exports.Utf8View = exports.LargeUtf8 = exports.Utf8 = exports.Float64 = exports.Float32 = exports.Float16 = exports.Float = exports.Uint64 = exports.Uint32 = exports.Uint16 = exports.Uint8 = exports.Int64 = exports.Int32 = exports.Int16 = exports.Int8 = exports.Int = exports.Bool = exports.Null = exports.DataType = exports.makeData = exports.Data = exports.MetadataVersion = exports.IntervalUnit = exports.UnionMode = exports.Precision = exports.TimeUnit = exports.DateUnit = exports.BufferType = exports.Type = exports.CompressionType = exports.MessageHeader = void 0;
33213
+ exports.Int64Builder = exports.Int32Builder = exports.Int16Builder = exports.Int8Builder = exports.IntBuilder = exports.Float64Builder = exports.Float32Builder = exports.Float16Builder = exports.FloatBuilder = exports.FixedSizeBinaryBuilder = exports.DictionaryBuilder = exports.DecimalBuilder = exports.DateMillisecondBuilder = exports.DateDayBuilder = exports.DateBuilder = exports.NullBuilder = exports.BoolBuilder = exports.builderThroughAsyncIterable = exports.builderThroughIterable = exports.tableFromJSON = exports.vectorFromArray = exports.makeBuilder = exports.Builder = exports.StructRow = exports.MapRow = exports.Field = exports.Schema = exports.Visitor = exports.makeVector = exports.Vector = exports.tableFromArrays = exports.makeTable = exports.Table = exports.Map_ = exports.FixedSizeList = exports.DurationNanosecond = exports.DurationMicrosecond = exports.DurationMillisecond = exports.DurationSecond = exports.Duration = exports.IntervalMonthDayNano = exports.IntervalYearMonth = exports.IntervalDayTime = exports.Interval = exports.Dictionary = exports.SparseUnion = exports.DenseUnion = exports.Union = exports.Struct = exports.LargeList = void 0;
33214
+ exports.tableToIPC = exports.RecordBatchJSONWriter = exports.RecordBatchStreamWriter = exports.RecordBatchFileWriter = exports.RecordBatchWriter = exports.AsyncRecordBatchStreamReader = exports.AsyncRecordBatchFileReader = exports.RecordBatchStreamReader = exports.RecordBatchFileReader = exports.RecordBatchReader = exports.AsyncByteQueue = exports.AsyncByteStream = exports.ByteStream = exports.DenseUnionBuilder = exports.SparseUnionBuilder = exports.UnionBuilder = exports.StructBuilder = exports.MapBuilder = exports.FixedSizeListBuilder = exports.LargeListBuilder = exports.ListBuilder = exports.LargeBinaryBuilder = exports.BinaryViewBuilder = exports.BinaryBuilder = exports.LargeUtf8Builder = exports.Utf8ViewBuilder = exports.Utf8Builder = exports.DurationNanosecondBuilder = exports.DurationMicrosecondBuilder = exports.DurationMillisecondBuilder = exports.DurationSecondBuilder = exports.DurationBuilder = exports.IntervalMonthDayNanoBuilder = exports.IntervalYearMonthBuilder = exports.IntervalDayTimeBuilder = exports.IntervalBuilder = exports.TimestampNanosecondBuilder = exports.TimestampMicrosecondBuilder = exports.TimestampMillisecondBuilder = exports.TimestampSecondBuilder = exports.TimestampBuilder = exports.TimeNanosecondBuilder = exports.TimeMicrosecondBuilder = exports.TimeMillisecondBuilder = exports.TimeSecondBuilder = exports.TimeBuilder = exports.Uint64Builder = exports.Uint32Builder = exports.Uint16Builder = exports.Uint8Builder = void 0;
33215
+ exports.util = exports.isArrowTable = exports.isArrowRecordBatch = exports.isArrowVector = exports.isArrowData = exports.isArrowDataType = exports.isArrowField = exports.isArrowSchema = exports.RecordBatch = exports.Message = exports.JSONMessageReader = exports.AsyncMessageReader = exports.MessageReader = exports.compressionRegistry = exports.tableFromIPC = void 0;
32128
33216
  var message_header_js_1 = require_message_header();
32129
33217
  Object.defineProperty(exports, "MessageHeader", { enumerable: true, get: function() {
32130
33218
  return message_header_js_1.MessageHeader;
@@ -32220,12 +33308,18 @@ return true;`);
32220
33308
  Object.defineProperty(exports, "LargeUtf8", { enumerable: true, get: function() {
32221
33309
  return type_js_1.LargeUtf8;
32222
33310
  } });
33311
+ Object.defineProperty(exports, "Utf8View", { enumerable: true, get: function() {
33312
+ return type_js_1.Utf8View;
33313
+ } });
32223
33314
  Object.defineProperty(exports, "Binary", { enumerable: true, get: function() {
32224
33315
  return type_js_1.Binary;
32225
33316
  } });
32226
33317
  Object.defineProperty(exports, "LargeBinary", { enumerable: true, get: function() {
32227
33318
  return type_js_1.LargeBinary;
32228
33319
  } });
33320
+ Object.defineProperty(exports, "BinaryView", { enumerable: true, get: function() {
33321
+ return type_js_1.BinaryView;
33322
+ } });
32229
33323
  Object.defineProperty(exports, "FixedSizeBinary", { enumerable: true, get: function() {
32230
33324
  return type_js_1.FixedSizeBinary;
32231
33325
  } });
@@ -32274,6 +33368,9 @@ return true;`);
32274
33368
  Object.defineProperty(exports, "List", { enumerable: true, get: function() {
32275
33369
  return type_js_1.List;
32276
33370
  } });
33371
+ Object.defineProperty(exports, "LargeList", { enumerable: true, get: function() {
33372
+ return type_js_1.LargeList;
33373
+ } });
32277
33374
  Object.defineProperty(exports, "Struct", { enumerable: true, get: function() {
32278
33375
  return type_js_1.Struct;
32279
33376
  } });
@@ -32514,6 +33611,10 @@ return true;`);
32514
33611
  Object.defineProperty(exports, "Utf8Builder", { enumerable: true, get: function() {
32515
33612
  return utf8_js_1.Utf8Builder;
32516
33613
  } });
33614
+ var utf8view_js_1 = require_utf8view();
33615
+ Object.defineProperty(exports, "Utf8ViewBuilder", { enumerable: true, get: function() {
33616
+ return utf8view_js_1.Utf8ViewBuilder;
33617
+ } });
32517
33618
  var largeutf8_js_1 = require_largeutf8();
32518
33619
  Object.defineProperty(exports, "LargeUtf8Builder", { enumerable: true, get: function() {
32519
33620
  return largeutf8_js_1.LargeUtf8Builder;
@@ -32522,6 +33623,10 @@ return true;`);
32522
33623
  Object.defineProperty(exports, "BinaryBuilder", { enumerable: true, get: function() {
32523
33624
  return binary_js_1.BinaryBuilder;
32524
33625
  } });
33626
+ var binaryview_js_1 = require_binaryview();
33627
+ Object.defineProperty(exports, "BinaryViewBuilder", { enumerable: true, get: function() {
33628
+ return binaryview_js_1.BinaryViewBuilder;
33629
+ } });
32525
33630
  var largebinary_js_1 = require_largebinary();
32526
33631
  Object.defineProperty(exports, "LargeBinaryBuilder", { enumerable: true, get: function() {
32527
33632
  return largebinary_js_1.LargeBinaryBuilder;
@@ -32530,6 +33635,10 @@ return true;`);
32530
33635
  Object.defineProperty(exports, "ListBuilder", { enumerable: true, get: function() {
32531
33636
  return list_js_1.ListBuilder;
32532
33637
  } });
33638
+ var largelist_js_1 = require_largelist();
33639
+ Object.defineProperty(exports, "LargeListBuilder", { enumerable: true, get: function() {
33640
+ return largelist_js_1.LargeListBuilder;
33641
+ } });
32533
33642
  var fixedsizelist_js_1 = require_fixedsizelist();
32534
33643
  Object.defineProperty(exports, "FixedSizeListBuilder", { enumerable: true, get: function() {
32535
33644
  return fixedsizelist_js_1.FixedSizeListBuilder;
@@ -32620,6 +33729,28 @@ return true;`);
32620
33729
  Object.defineProperty(exports, "RecordBatch", { enumerable: true, get: function() {
32621
33730
  return recordbatch_js_1.RecordBatch;
32622
33731
  } });
33732
+ var typecheck_js_1 = require_typecheck();
33733
+ Object.defineProperty(exports, "isArrowSchema", { enumerable: true, get: function() {
33734
+ return typecheck_js_1.isArrowSchema;
33735
+ } });
33736
+ Object.defineProperty(exports, "isArrowField", { enumerable: true, get: function() {
33737
+ return typecheck_js_1.isArrowField;
33738
+ } });
33739
+ Object.defineProperty(exports, "isArrowDataType", { enumerable: true, get: function() {
33740
+ return typecheck_js_1.isArrowDataType;
33741
+ } });
33742
+ Object.defineProperty(exports, "isArrowData", { enumerable: true, get: function() {
33743
+ return typecheck_js_1.isArrowData;
33744
+ } });
33745
+ Object.defineProperty(exports, "isArrowVector", { enumerable: true, get: function() {
33746
+ return typecheck_js_1.isArrowVector;
33747
+ } });
33748
+ Object.defineProperty(exports, "isArrowRecordBatch", { enumerable: true, get: function() {
33749
+ return typecheck_js_1.isArrowRecordBatch;
33750
+ } });
33751
+ Object.defineProperty(exports, "isArrowTable", { enumerable: true, get: function() {
33752
+ return typecheck_js_1.isArrowTable;
33753
+ } });
32623
33754
  var util_bn_ = require_bn();
32624
33755
  var util_int_ = require_int2();
32625
33756
  var util_bit_ = require_bit();
@@ -32628,8 +33759,9 @@ return true;`);
32628
33759
  var util_vector_ = require_vector();
32629
33760
  var util_pretty_ = require_pretty();
32630
33761
  var util_interval_ = require_interval2();
33762
+ var util_typecheck_ = require_typecheck();
32631
33763
  var typecomparator_js_1 = require_typecomparator();
32632
- exports.util = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, util_bn_), util_int_), util_bit_), util_math_), util_buffer_), util_vector_), util_pretty_), util_interval_), {
33764
+ exports.util = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, util_bn_), util_int_), util_bit_), util_math_), util_buffer_), util_vector_), util_pretty_), util_interval_), util_typecheck_), {
32633
33765
  compareSchemas: typecomparator_js_1.compareSchemas,
32634
33766
  compareFields: typecomparator_js_1.compareFields,
32635
33767
  compareTypes: typecomparator_js_1.compareTypes
@@ -32642,10 +33774,10 @@ return true;`);
32642
33774
  "../node_modules/apache-arrow/Arrow.dom.js"(exports) {
32643
33775
  "use strict";
32644
33776
  Object.defineProperty(exports, "__esModule", { value: true });
32645
- exports.Union = exports.StructRow = exports.Struct = exports.List = exports.Decimal = exports.TimeNanosecond = exports.TimeMicrosecond = exports.TimeMillisecond = exports.TimeSecond = exports.Time = exports.TimestampNanosecond = exports.TimestampMicrosecond = exports.TimestampMillisecond = exports.TimestampSecond = exports.Timestamp = exports.DateMillisecond = exports.DateDay = exports.Date_ = exports.FixedSizeBinary = exports.LargeBinary = exports.Binary = exports.LargeUtf8 = exports.Utf8 = exports.Float64 = exports.Float32 = exports.Float16 = exports.Float = exports.Uint64 = exports.Uint32 = exports.Uint16 = exports.Uint8 = exports.Int64 = exports.Int32 = exports.Int16 = exports.Int8 = exports.Int = exports.Bool = exports.Null = exports.DataType = exports.makeData = exports.Data = exports.BufferType = exports.UnionMode = exports.Type = exports.TimeUnit = exports.Precision = exports.MetadataVersion = exports.MessageHeader = exports.IntervalUnit = exports.DateUnit = void 0;
32646
- exports.compressionRegistry = exports.builderThroughAsyncIterable = exports.builderThroughIterable = exports.makeBuilder = exports.Builder = exports.util = exports.RecordBatch = exports.Message = exports.JSONMessageReader = exports.AsyncMessageReader = exports.MessageReader = exports.tableToIPC = exports.tableFromIPC = exports.RecordBatchJSONWriter = exports.RecordBatchStreamWriter = exports.RecordBatchFileWriter = exports.RecordBatchWriter = exports.AsyncRecordBatchStreamReader = exports.AsyncRecordBatchFileReader = exports.RecordBatchStreamReader = exports.RecordBatchFileReader = exports.RecordBatchReader = exports.AsyncByteQueue = exports.AsyncByteStream = exports.ByteStream = exports.tableFromJSON = exports.vectorFromArray = exports.makeVector = exports.Vector = exports.Visitor = exports.Field = exports.Schema = exports.tableFromArrays = exports.makeTable = exports.Table = exports.MapRow = exports.Map_ = exports.FixedSizeList = exports.DurationNanosecond = exports.DurationMicrosecond = exports.DurationMillisecond = exports.DurationSecond = exports.Duration = exports.IntervalMonthDayNano = exports.IntervalYearMonth = exports.IntervalDayTime = exports.Interval = exports.Dictionary = exports.SparseUnion = exports.DenseUnion = void 0;
32647
- exports.SparseUnionBuilder = exports.DenseUnionBuilder = exports.UnionBuilder = exports.TimeNanosecondBuilder = exports.TimeMicrosecondBuilder = exports.TimeMillisecondBuilder = exports.TimeSecondBuilder = exports.TimeBuilder = exports.TimestampNanosecondBuilder = exports.TimestampMicrosecondBuilder = exports.TimestampMillisecondBuilder = exports.TimestampSecondBuilder = exports.TimestampBuilder = exports.StructBuilder = exports.NullBuilder = exports.MapBuilder = exports.ListBuilder = exports.Uint64Builder = exports.Uint32Builder = exports.Uint16Builder = exports.Uint8Builder = exports.Int64Builder = exports.Int32Builder = exports.Int16Builder = exports.Int8Builder = exports.IntBuilder = exports.DurationNanosecondBuilder = exports.DurationMicrosecondBuilder = exports.DurationMillisecondBuilder = exports.DurationSecondBuilder = exports.DurationBuilder = exports.IntervalMonthDayNanoBuilder = exports.IntervalYearMonthBuilder = exports.IntervalDayTimeBuilder = exports.IntervalBuilder = exports.Float64Builder = exports.Float32Builder = exports.Float16Builder = exports.FloatBuilder = exports.FixedSizeListBuilder = exports.FixedSizeBinaryBuilder = exports.DictionaryBuilder = exports.DecimalBuilder = exports.DateMillisecondBuilder = exports.DateDayBuilder = exports.DateBuilder = exports.BoolBuilder = exports.LargeBinaryBuilder = exports.BinaryBuilder = exports.CompressionType = void 0;
32648
- exports.LargeUtf8Builder = exports.Utf8Builder = void 0;
33777
+ exports.LargeList = exports.List = exports.Decimal = exports.TimeNanosecond = exports.TimeMicrosecond = exports.TimeMillisecond = exports.TimeSecond = exports.Time = exports.TimestampNanosecond = exports.TimestampMicrosecond = exports.TimestampMillisecond = exports.TimestampSecond = exports.Timestamp = exports.DateMillisecond = exports.DateDay = exports.Date_ = exports.FixedSizeBinary = exports.BinaryView = exports.LargeBinary = exports.Binary = exports.Utf8View = exports.LargeUtf8 = exports.Utf8 = exports.Float64 = exports.Float32 = exports.Float16 = exports.Float = exports.Uint64 = exports.Uint32 = exports.Uint16 = exports.Uint8 = exports.Int64 = exports.Int32 = exports.Int16 = exports.Int8 = exports.Int = exports.Bool = exports.Null = exports.DataType = exports.makeData = exports.Data = exports.BufferType = exports.UnionMode = exports.Type = exports.TimeUnit = exports.Precision = exports.MetadataVersion = exports.MessageHeader = exports.IntervalUnit = exports.DateUnit = void 0;
33778
+ exports.makeBuilder = exports.Builder = exports.util = exports.RecordBatch = exports.Message = exports.JSONMessageReader = exports.AsyncMessageReader = exports.MessageReader = exports.tableToIPC = exports.tableFromIPC = exports.RecordBatchJSONWriter = exports.RecordBatchStreamWriter = exports.RecordBatchFileWriter = exports.RecordBatchWriter = exports.AsyncRecordBatchStreamReader = exports.AsyncRecordBatchFileReader = exports.RecordBatchStreamReader = exports.RecordBatchFileReader = exports.RecordBatchReader = exports.AsyncByteQueue = exports.AsyncByteStream = exports.ByteStream = exports.tableFromJSON = exports.vectorFromArray = exports.makeVector = exports.Vector = exports.Visitor = exports.Field = exports.Schema = exports.tableFromArrays = exports.makeTable = exports.Table = exports.MapRow = exports.Map_ = exports.FixedSizeList = exports.DurationNanosecond = exports.DurationMicrosecond = exports.DurationMillisecond = exports.DurationSecond = exports.Duration = exports.IntervalMonthDayNano = exports.IntervalYearMonth = exports.IntervalDayTime = exports.Interval = exports.Dictionary = exports.SparseUnion = exports.DenseUnion = exports.Union = exports.StructRow = exports.Struct = void 0;
33779
+ exports.TimestampBuilder = exports.StructBuilder = exports.NullBuilder = exports.MapBuilder = exports.LargeListBuilder = exports.ListBuilder = exports.Uint64Builder = exports.Uint32Builder = exports.Uint16Builder = exports.Uint8Builder = exports.Int64Builder = exports.Int32Builder = exports.Int16Builder = exports.Int8Builder = exports.IntBuilder = exports.DurationNanosecondBuilder = exports.DurationMicrosecondBuilder = exports.DurationMillisecondBuilder = exports.DurationSecondBuilder = exports.DurationBuilder = exports.IntervalMonthDayNanoBuilder = exports.IntervalYearMonthBuilder = exports.IntervalDayTimeBuilder = exports.IntervalBuilder = exports.Float64Builder = exports.Float32Builder = exports.Float16Builder = exports.FloatBuilder = exports.FixedSizeListBuilder = exports.FixedSizeBinaryBuilder = exports.DictionaryBuilder = exports.DecimalBuilder = exports.DateMillisecondBuilder = exports.DateDayBuilder = exports.DateBuilder = exports.BoolBuilder = exports.LargeBinaryBuilder = exports.BinaryViewBuilder = exports.BinaryBuilder = exports.isArrowTable = exports.isArrowRecordBatch = exports.isArrowVector = exports.isArrowData = exports.isArrowDataType = exports.isArrowField = exports.isArrowSchema = exports.CompressionType = exports.compressionRegistry = exports.builderThroughAsyncIterable = exports.builderThroughIterable = void 0;
33780
+ exports.LargeUtf8Builder = exports.Utf8ViewBuilder = exports.Utf8Builder = exports.SparseUnionBuilder = exports.DenseUnionBuilder = exports.UnionBuilder = exports.TimeNanosecondBuilder = exports.TimeMicrosecondBuilder = exports.TimeMillisecondBuilder = exports.TimeSecondBuilder = exports.TimeBuilder = exports.TimestampNanosecondBuilder = exports.TimestampMicrosecondBuilder = exports.TimestampMillisecondBuilder = exports.TimestampSecondBuilder = void 0;
32649
33781
  var adapters_js_1 = require_adapters();
32650
33782
  var builder_js_1 = require_builder();
32651
33783
  var reader_js_1 = require_reader();
@@ -32750,12 +33882,18 @@ return true;`);
32750
33882
  Object.defineProperty(exports, "LargeUtf8", { enumerable: true, get: function() {
32751
33883
  return Arrow_js_1.LargeUtf8;
32752
33884
  } });
33885
+ Object.defineProperty(exports, "Utf8View", { enumerable: true, get: function() {
33886
+ return Arrow_js_1.Utf8View;
33887
+ } });
32753
33888
  Object.defineProperty(exports, "Binary", { enumerable: true, get: function() {
32754
33889
  return Arrow_js_1.Binary;
32755
33890
  } });
32756
33891
  Object.defineProperty(exports, "LargeBinary", { enumerable: true, get: function() {
32757
33892
  return Arrow_js_1.LargeBinary;
32758
33893
  } });
33894
+ Object.defineProperty(exports, "BinaryView", { enumerable: true, get: function() {
33895
+ return Arrow_js_1.BinaryView;
33896
+ } });
32759
33897
  Object.defineProperty(exports, "FixedSizeBinary", { enumerable: true, get: function() {
32760
33898
  return Arrow_js_1.FixedSizeBinary;
32761
33899
  } });
@@ -32804,6 +33942,9 @@ return true;`);
32804
33942
  Object.defineProperty(exports, "List", { enumerable: true, get: function() {
32805
33943
  return Arrow_js_1.List;
32806
33944
  } });
33945
+ Object.defineProperty(exports, "LargeList", { enumerable: true, get: function() {
33946
+ return Arrow_js_1.LargeList;
33947
+ } });
32807
33948
  Object.defineProperty(exports, "Struct", { enumerable: true, get: function() {
32808
33949
  return Arrow_js_1.Struct;
32809
33950
  } });
@@ -32966,10 +34107,34 @@ return true;`);
32966
34107
  Object.defineProperty(exports, "CompressionType", { enumerable: true, get: function() {
32967
34108
  return Arrow_js_1.CompressionType;
32968
34109
  } });
34110
+ Object.defineProperty(exports, "isArrowSchema", { enumerable: true, get: function() {
34111
+ return Arrow_js_1.isArrowSchema;
34112
+ } });
34113
+ Object.defineProperty(exports, "isArrowField", { enumerable: true, get: function() {
34114
+ return Arrow_js_1.isArrowField;
34115
+ } });
34116
+ Object.defineProperty(exports, "isArrowDataType", { enumerable: true, get: function() {
34117
+ return Arrow_js_1.isArrowDataType;
34118
+ } });
34119
+ Object.defineProperty(exports, "isArrowData", { enumerable: true, get: function() {
34120
+ return Arrow_js_1.isArrowData;
34121
+ } });
34122
+ Object.defineProperty(exports, "isArrowVector", { enumerable: true, get: function() {
34123
+ return Arrow_js_1.isArrowVector;
34124
+ } });
34125
+ Object.defineProperty(exports, "isArrowRecordBatch", { enumerable: true, get: function() {
34126
+ return Arrow_js_1.isArrowRecordBatch;
34127
+ } });
34128
+ Object.defineProperty(exports, "isArrowTable", { enumerable: true, get: function() {
34129
+ return Arrow_js_1.isArrowTable;
34130
+ } });
32969
34131
  var Arrow_js_2 = require_Arrow();
32970
34132
  Object.defineProperty(exports, "BinaryBuilder", { enumerable: true, get: function() {
32971
34133
  return Arrow_js_2.BinaryBuilder;
32972
34134
  } });
34135
+ Object.defineProperty(exports, "BinaryViewBuilder", { enumerable: true, get: function() {
34136
+ return Arrow_js_2.BinaryViewBuilder;
34137
+ } });
32973
34138
  Object.defineProperty(exports, "LargeBinaryBuilder", { enumerable: true, get: function() {
32974
34139
  return Arrow_js_2.LargeBinaryBuilder;
32975
34140
  } });
@@ -33066,6 +34231,9 @@ return true;`);
33066
34231
  Object.defineProperty(exports, "ListBuilder", { enumerable: true, get: function() {
33067
34232
  return Arrow_js_2.ListBuilder;
33068
34233
  } });
34234
+ Object.defineProperty(exports, "LargeListBuilder", { enumerable: true, get: function() {
34235
+ return Arrow_js_2.LargeListBuilder;
34236
+ } });
33069
34237
  Object.defineProperty(exports, "MapBuilder", { enumerable: true, get: function() {
33070
34238
  return Arrow_js_2.MapBuilder;
33071
34239
  } });
@@ -33117,6 +34285,9 @@ return true;`);
33117
34285
  Object.defineProperty(exports, "Utf8Builder", { enumerable: true, get: function() {
33118
34286
  return Arrow_js_2.Utf8Builder;
33119
34287
  } });
34288
+ Object.defineProperty(exports, "Utf8ViewBuilder", { enumerable: true, get: function() {
34289
+ return Arrow_js_2.Utf8ViewBuilder;
34290
+ } });
33120
34291
  Object.defineProperty(exports, "LargeUtf8Builder", { enumerable: true, get: function() {
33121
34292
  return Arrow_js_2.LargeUtf8Builder;
33122
34293
  } });
@@ -36523,6 +37694,9 @@ ${newlined}
36523
37694
  });
36524
37695
 
36525
37696
  // ../node_modules/jose/dist/webapi/lib/key_to_jwk.js
37697
+ function omitUndefinedProperties(jwk) {
37698
+ return Object.fromEntries(Object.entries(jwk).filter(([, value]) => value !== void 0));
37699
+ }
36526
37700
  async function keyToJWK(key) {
36527
37701
  if (isKeyObject(key)) {
36528
37702
  if (key.type === "secret") {
@@ -36543,7 +37717,7 @@ ${newlined}
36543
37717
  if (!key.extractable) {
36544
37718
  throw new TypeError("non-extractable CryptoKey cannot be exported as a JWK");
36545
37719
  }
36546
- const { ext, key_ops, alg, use, ...jwk } = await crypto.subtle.exportKey("jwk", key);
37720
+ const { ext, key_ops, alg, use, ...jwk } = omitUndefinedProperties(await crypto.subtle.exportKey("jwk", key));
36547
37721
  if (jwk.kty === "AKP") {
36548
37722
  ;
36549
37723
  jwk.alg = alg;
@@ -38760,7 +39934,7 @@ ${newlined}
38760
39934
  init_type_checks();
38761
39935
  if (typeof navigator === "undefined" || !navigator.userAgent?.startsWith?.("Mozilla/5.0 ")) {
38762
39936
  const NAME = "jose";
38763
- const VERSION = "v6.2.3";
39937
+ const VERSION = "v6.2.4";
38764
39938
  USER_AGENT = `${NAME}/${VERSION}`;
38765
39939
  }
38766
39940
  customFetch = /* @__PURE__ */ Symbol();
@@ -40828,6 +42002,9 @@ ${newlined}
40828
42002
  addRoomGrant(roomName) {
40829
42003
  this.grants.push(new ParticipantGrant({ name: "room", scope: roomName }));
40830
42004
  }
42005
+ addSiteGrant(roomName) {
42006
+ this.grants.push(new ParticipantGrant({ name: "site", scope: roomName }));
42007
+ }
40831
42008
  addApiGrant(grant) {
40832
42009
  for (const existingGrant of this.grants) {
40833
42010
  if (existingGrant.name === "api") {
@@ -42322,7 +43499,7 @@ ${newlined}
42322
43499
  }
42323
43500
  const parsedResource = this.parseAccessResource(data.resource);
42324
43501
  const parsedSubject = this.parseAccessSubject(data.subject);
42325
- const parsedDirectRoles = Array.isArray(data.direct_roles) ? data.direct_roles.filter((item) => item === "member" || item === "viewer" || item === "operator" || item === "developer" || item === "admin" || item === "room_creator" || item === "room_inventory" || item === "room_manager" || item === "session_inventory" || item === "agent_creator" || item === "agent_inventory" || item === "agent_manager" || item === "repository_creator" || item === "repository_inventory" || item === "repository_manager" || item === "feed_creator" || item === "feed_inventory" || item === "feed_manager" || item === "oauth_client_creator" || item === "oauth_client_inventory" || item === "oauth_client_manager" || item === "api_key_creator" || item === "api_key_inventory" || item === "api_key_manager" || item === "service_creator" || item === "service_inventory" || item === "service_manager" || item === "service_account_creator" || item === "service_account_inventory" || item === "service_account_manager" || item === "participant_token_creator" || item === "mailbox_creator" || item === "mailbox_inventory" || item === "mailbox_manager" || item === "route_creator" || item === "route_inventory" || item === "route_manager" || item === "scheduled_task_creator" || item === "scheduled_task_inventory" || item === "scheduled_task_manager" || item === "feed_subscription_creator" || item === "feed_subscription_inventory" || item === "feed_subscription_manager" || item === "llm_logger_creator" || item === "llm_logger_inventory" || item === "llm_logger_manager" || item === "llm_proxy_user" || item === "usage_reporter" || item === "billing_manager" || item === "group_manager" || item === "reader" || item === "subscriber" || item === "publisher" || item === "manager" || item === "list") : [];
43502
+ const parsedDirectRoles = Array.isArray(data.direct_roles) ? data.direct_roles.filter((item) => item === "member" || item === "site_user" || item === "viewer" || item === "operator" || item === "developer" || item === "admin" || item === "room_creator" || item === "room_inventory" || item === "room_manager" || item === "session_inventory" || item === "agent_creator" || item === "agent_inventory" || item === "agent_manager" || item === "repository_creator" || item === "repository_inventory" || item === "repository_manager" || item === "feed_creator" || item === "feed_inventory" || item === "feed_manager" || item === "oauth_client_creator" || item === "oauth_client_inventory" || item === "oauth_client_manager" || item === "api_key_creator" || item === "api_key_inventory" || item === "api_key_manager" || item === "service_creator" || item === "service_inventory" || item === "service_manager" || item === "service_account_creator" || item === "service_account_inventory" || item === "service_account_manager" || item === "participant_token_creator" || item === "mailbox_creator" || item === "mailbox_inventory" || item === "mailbox_manager" || item === "route_creator" || item === "route_inventory" || item === "route_manager" || item === "scheduled_task_creator" || item === "scheduled_task_inventory" || item === "scheduled_task_manager" || item === "feed_subscription_creator" || item === "feed_subscription_inventory" || item === "feed_subscription_manager" || item === "llm_logger_creator" || item === "llm_logger_inventory" || item === "llm_logger_manager" || item === "llm_proxy_user" || item === "usage_reporter" || item === "billing_manager" || item === "group_manager" || item === "reader" || item === "subscriber" || item === "publisher" || item === "manager" || item === "list") : [];
42326
43503
  const room = {
42327
43504
  id: parsedResource.id,
42328
43505
  name: parsedResource.name ?? parsedResource.id,
@@ -42425,6 +43602,25 @@ ${newlined}
42425
43602
  }
42426
43603
  return { jwt, roomName: roomNameValue, projectId: projectIdValue, roomUrl: roomUrlValue };
42427
43604
  }
43605
+ parseAgentConnectionInfo(data) {
43606
+ if (!data || typeof data !== "object") {
43607
+ throw new requirement_js_1.RoomException("Invalid agent connection payload");
43608
+ }
43609
+ const { jwt, agent_name: agentNameRaw, agentName, project_id: projectIdRaw, projectId, agent_url: agentUrlRaw, agentUrl } = data;
43610
+ const agentNameValue = typeof agentName === "string" ? agentName : agentNameRaw;
43611
+ const projectIdValue = typeof projectId === "string" ? projectId : projectIdRaw;
43612
+ const agentUrlValue = typeof agentUrl === "string" ? agentUrl : agentUrlRaw;
43613
+ if (typeof jwt !== "string" || typeof agentNameValue !== "string" || typeof projectIdValue !== "string" || typeof agentUrlValue !== "string") {
43614
+ throw new requirement_js_1.RoomException("Invalid agent connection payload: missing fields");
43615
+ }
43616
+ const parsedUrl = new URL(agentUrlValue);
43617
+ const legacySuffix = `/accounts/projects/${encodeURIComponent(projectIdValue)}/agents/${encodeURIComponent(agentNameValue)}/messages`;
43618
+ if (parsedUrl.pathname.endsWith(legacySuffix)) {
43619
+ const prefix = parsedUrl.pathname.slice(0, -legacySuffix.length);
43620
+ parsedUrl.pathname = `${prefix}/agents/${encodeURIComponent(projectIdValue)}/${encodeURIComponent(agentNameValue)}/messages`;
43621
+ }
43622
+ return { jwt, agentName: agentNameValue, projectId: projectIdValue, agentUrl: parsedUrl.toString() };
43623
+ }
42428
43624
  encodePathComponent(value) {
42429
43625
  return encodeURIComponent(value);
42430
43626
  }
@@ -43448,6 +44644,14 @@ ${newlined}
43448
44644
  });
43449
44645
  return this.parseRoomConnectionInfo(data);
43450
44646
  }
44647
+ async connectAgent(projectId, agentName) {
44648
+ const data = await this.request(`/accounts/projects/${projectId}/agents/${encodeURIComponent(agentName)}/connect`, {
44649
+ method: "POST",
44650
+ json: {},
44651
+ action: "connect agent"
44652
+ });
44653
+ return this.parseAgentConnectionInfo(data);
44654
+ }
43451
44655
  async listRooms(projectId, options = {}) {
43452
44656
  const { pageSize = 50, continuationToken, filter, view } = options;
43453
44657
  const data = await this.request(`/accounts/projects/${projectId}/rooms`, {
@@ -43698,7 +44902,7 @@ ${newlined}
43698
44902
  "../meshagent-ts/dist/browser/messaging-client.js"(exports) {
43699
44903
  "use strict";
43700
44904
  Object.defineProperty(exports, "__esModule", { value: true });
43701
- exports.MessagingClient = void 0;
44905
+ exports.MessagingClient = exports.MessagingStream = void 0;
43702
44906
  var completer_js_1 = require_completer();
43703
44907
  var event_emitter_js_1 = require_event_emitter();
43704
44908
  var participant_js_1 = require_participant();
@@ -43720,6 +44924,247 @@ ${newlined}
43720
44924
  }
43721
44925
  return globalScope.btoa(binary);
43722
44926
  }
44927
+ function base64ToBytes(value) {
44928
+ if (globalScope.Buffer != null) {
44929
+ return new Uint8Array(globalScope.Buffer.from(value, "base64"));
44930
+ }
44931
+ const atob2 = globalThis.atob;
44932
+ if (atob2 == null) {
44933
+ throw new Error("base64 decoding is not available in this runtime");
44934
+ }
44935
+ const binary = atob2(value);
44936
+ return Uint8Array.from(binary, (character) => character.charCodeAt(0));
44937
+ }
44938
+ var MessagingStreamInput = class {
44939
+ constructor() {
44940
+ this.items = [];
44941
+ this.signal = null;
44942
+ this.active = null;
44943
+ this.closed = false;
44944
+ this.error = null;
44945
+ }
44946
+ enqueue(content, { wait = false } = {}) {
44947
+ if (this.closed) {
44948
+ return Promise.reject(this.error ?? new room_server_client_js_1.RoomServerException("the messaging stream is closed"));
44949
+ }
44950
+ const sent = wait ? new completer_js_1.Completer() : void 0;
44951
+ this.items.push({ content, sent });
44952
+ this.signal?.resolve();
44953
+ this.signal = null;
44954
+ return sent?.fut ?? Promise.resolve();
44955
+ }
44956
+ close(error = new room_server_client_js_1.RoomServerException("the messaging stream is closed")) {
44957
+ if (this.closed) {
44958
+ return;
44959
+ }
44960
+ this.closed = true;
44961
+ this.error = error;
44962
+ this.active?.sent?.reject(error);
44963
+ this.active = null;
44964
+ for (const item of this.items.splice(0)) {
44965
+ item.sent?.reject(error);
44966
+ }
44967
+ this.signal?.resolve();
44968
+ this.signal = null;
44969
+ }
44970
+ fail(error) {
44971
+ this.close(error);
44972
+ }
44973
+ async *stream() {
44974
+ try {
44975
+ while (true) {
44976
+ while (this.items.length === 0 && !this.closed) {
44977
+ this.signal ?? (this.signal = new completer_js_1.Completer());
44978
+ await this.signal.fut;
44979
+ }
44980
+ const item = this.items.shift();
44981
+ if (item == null) {
44982
+ return;
44983
+ }
44984
+ this.active = item;
44985
+ yield item.content;
44986
+ item.sent?.resolve();
44987
+ this.active = null;
44988
+ }
44989
+ } finally {
44990
+ if (this.active != null && this.closed) {
44991
+ this.active.sent?.reject(this.error ?? new room_server_client_js_1.RoomServerException("the messaging stream is closed"));
44992
+ this.active = null;
44993
+ }
44994
+ }
44995
+ }
44996
+ };
44997
+ var MessagingStream = class {
44998
+ constructor({ streamId, remoteParticipantId, input, output, inputClosed, onClosed }) {
44999
+ this.events = [];
45000
+ this.eventSignal = null;
45001
+ this.state = "accepted";
45002
+ this.streamId = streamId;
45003
+ this.remoteParticipantId = remoteParticipantId;
45004
+ this.input = input;
45005
+ this.output = output;
45006
+ this.inputDone = Promise.resolve(inputClosed).catch((error) => {
45007
+ this.input.fail(error);
45008
+ this.push({
45009
+ kind: "closed",
45010
+ streamId: this.streamId,
45011
+ reason: "error",
45012
+ message: error instanceof Error ? error.message : String(error)
45013
+ });
45014
+ void this.output.return?.();
45015
+ this.finish();
45016
+ });
45017
+ this.onClosed = onClosed;
45018
+ void this.consumeOutput();
45019
+ }
45020
+ get closed() {
45021
+ return this.state === "terminal";
45022
+ }
45023
+ push(event) {
45024
+ if (this.state !== "accepted") {
45025
+ return;
45026
+ }
45027
+ this.events.push(event);
45028
+ this.eventSignal?.resolve();
45029
+ this.eventSignal = null;
45030
+ }
45031
+ finish() {
45032
+ if (this.state === "terminal") {
45033
+ return;
45034
+ }
45035
+ this.state = "terminal";
45036
+ this.input.close();
45037
+ this.eventSignal?.resolve();
45038
+ this.eventSignal = null;
45039
+ void this.inputDone.finally(this.onClosed);
45040
+ }
45041
+ async consumeOutput() {
45042
+ try {
45043
+ while (true) {
45044
+ const next = await this.output.next();
45045
+ if (next.done) {
45046
+ return;
45047
+ }
45048
+ if (next.value instanceof response_js_1.ControlContent && next.value.method === "close") {
45049
+ this.push({
45050
+ kind: "client_disconnected",
45051
+ streamId: this.streamId,
45052
+ participantId: this.remoteParticipantId
45053
+ });
45054
+ return;
45055
+ }
45056
+ if (!(next.value instanceof response_js_1.JsonContent)) {
45057
+ throw new room_server_client_js_1.RoomServerException("unexpected chunk from messaging.stream");
45058
+ }
45059
+ const value = next.value.json;
45060
+ const kind = value["kind"];
45061
+ if (kind === "message") {
45062
+ const type = value["type"];
45063
+ const message2 = value["message"];
45064
+ if (typeof type !== "string" || typeof message2 !== "object" || message2 == null || Array.isArray(message2)) {
45065
+ throw new room_server_client_js_1.RoomServerException("invalid message chunk from messaging.stream");
45066
+ }
45067
+ const encodedAttachment = value["attachment_base64"];
45068
+ this.push({
45069
+ kind: "message",
45070
+ message: new room_event_js_1.RoomMessage({
45071
+ fromParticipantId: this.remoteParticipantId,
45072
+ type,
45073
+ message: message2,
45074
+ attachment: typeof encodedAttachment === "string" && encodedAttachment !== "" ? base64ToBytes(encodedAttachment) : void 0
45075
+ })
45076
+ });
45077
+ } else if (kind === "client_disconnected" && typeof value["participant_id"] === "string") {
45078
+ this.push({
45079
+ kind,
45080
+ streamId: this.streamId,
45081
+ participantId: value["participant_id"]
45082
+ });
45083
+ return;
45084
+ } else if (kind === "closed") {
45085
+ this.push({
45086
+ kind,
45087
+ streamId: this.streamId,
45088
+ reason: typeof value["reason"] === "string" ? value["reason"] : "closed",
45089
+ message: typeof value["message"] === "string" ? value["message"] : void 0
45090
+ });
45091
+ return;
45092
+ } else {
45093
+ throw new room_server_client_js_1.RoomServerException("unexpected chunk from messaging.stream");
45094
+ }
45095
+ }
45096
+ } catch (error) {
45097
+ this.input.fail(error);
45098
+ this.push({
45099
+ kind: "closed",
45100
+ streamId: this.streamId,
45101
+ reason: "error",
45102
+ message: error instanceof Error ? error.message : String(error)
45103
+ });
45104
+ } finally {
45105
+ this.finish();
45106
+ }
45107
+ }
45108
+ content({ type, message: message2, attachment }) {
45109
+ return new response_js_1.JsonContent({
45110
+ json: {
45111
+ type,
45112
+ message_json: JSON.stringify(message2),
45113
+ ...attachment == null ? {} : { attachment_base64: bytesToBase64(attachment) }
45114
+ }
45115
+ });
45116
+ }
45117
+ sendMessageNowait(params) {
45118
+ if (this.state !== "accepted") {
45119
+ throw new room_server_client_js_1.RoomServerException("the messaging stream is closed");
45120
+ }
45121
+ void this.input.enqueue(this.content(params));
45122
+ }
45123
+ async sendMessage(params) {
45124
+ if (this.state !== "accepted") {
45125
+ throw new room_server_client_js_1.RoomServerException("the messaging stream is closed");
45126
+ }
45127
+ await this.input.enqueue(this.content(params), { wait: true });
45128
+ }
45129
+ async close() {
45130
+ if (this.state === "terminal") {
45131
+ await this.inputDone;
45132
+ return;
45133
+ }
45134
+ this.input.close();
45135
+ try {
45136
+ await this.inputDone;
45137
+ } finally {
45138
+ await this.output.return?.();
45139
+ this.finish();
45140
+ }
45141
+ }
45142
+ clientDisconnected(participantId) {
45143
+ if (this.state === "terminal") {
45144
+ return;
45145
+ }
45146
+ this.push({
45147
+ kind: "client_disconnected",
45148
+ streamId: this.streamId,
45149
+ participantId
45150
+ });
45151
+ this.finish();
45152
+ }
45153
+ async *[Symbol.asyncIterator]() {
45154
+ while (true) {
45155
+ while (this.events.length === 0 && this.state !== "terminal") {
45156
+ this.eventSignal ?? (this.eventSignal = new completer_js_1.Completer());
45157
+ await this.eventSignal.fut;
45158
+ }
45159
+ const event = this.events.shift();
45160
+ if (event == null) {
45161
+ return;
45162
+ }
45163
+ yield event;
45164
+ }
45165
+ }
45166
+ };
45167
+ exports.MessagingStream = MessagingStream;
43723
45168
  var MessagingClient = class extends event_emitter_js_1.EventEmitter {
43724
45169
  constructor({ room }) {
43725
45170
  super();
@@ -43728,6 +45173,8 @@ ${newlined}
43728
45173
  this._messageQueue = [];
43729
45174
  this._messageQueued = null;
43730
45175
  this._sendTask = null;
45176
+ this._sendOperations = /* @__PURE__ */ new Set();
45177
+ this._streams = /* @__PURE__ */ new Set();
43731
45178
  this._messageQueueClosed = false;
43732
45179
  this._desiredEnabled = false;
43733
45180
  this._online = false;
@@ -43757,11 +45204,12 @@ ${newlined}
43757
45204
  }
43758
45205
  return input;
43759
45206
  }
43760
- async _invoke({ operation, input }) {
45207
+ async _invoke({ operation, input, afterSend }) {
43761
45208
  await this.client.invokeContent({
43762
45209
  toolkit: "messaging",
43763
45210
  tool: operation,
43764
- input: new response_js_1.JsonContent({ json: input })
45211
+ input: new response_js_1.JsonContent({ json: input }),
45212
+ afterSend
43765
45213
  });
43766
45214
  }
43767
45215
  _invokeNowait({ operation, input }) {
@@ -43791,6 +45239,8 @@ ${newlined}
43791
45239
  if (sendTask != null) {
43792
45240
  await sendTask;
43793
45241
  }
45242
+ await Promise.all(this._sendOperations);
45243
+ await Promise.all([...this._streams].map(async (stream) => stream.close()));
43794
45244
  this._desiredEnabled = false;
43795
45245
  this._clearCurrentConnectionState();
43796
45246
  }
@@ -43854,6 +45304,9 @@ ${newlined}
43854
45304
  }
43855
45305
  }
43856
45306
  _onRoomDisconnect({ reason: _reason }) {
45307
+ for (const stream of [...this._streams]) {
45308
+ stream.clientDisconnected(this.client.localParticipant?.id ?? stream.remoteParticipantId);
45309
+ }
43857
45310
  this._clearCurrentConnectionState();
43858
45311
  }
43859
45312
  _onRoomReconnect() {
@@ -43934,33 +45387,51 @@ ${newlined}
43934
45387
  });
43935
45388
  continue;
43936
45389
  }
43937
- try {
43938
- await this._invoke({
43939
- operation: "send",
43940
- input: this._messageInput({
43941
- toParticipantId: resolvedTo.id,
43942
- type: message2.type,
43943
- message: message2.message,
43944
- attachment: message2.attachment
43945
- })
43946
- });
43947
- if (message2.completer != null && !message2.completer.completed) {
43948
- message2.completer.complete();
43949
- }
43950
- } catch (error) {
43951
- if (error instanceof room_server_client_js_1.RoomServerException) {
43952
- const wrapped = this.client._coerceMessageSendError(error);
43953
- if (wrapped.message === "the participant was not found") {
43954
- this._markParticipantOffline(message2.to);
43955
- this._dropQueuedMessage({ message: message2, error: wrapped });
43956
- continue;
43957
- }
43958
- this._dropQueuedMessage({ message: message2, error: wrapped });
43959
- continue;
43960
- }
43961
- if (message2.completer != null && !message2.completer.completed) {
43962
- message2.completer.completeError(error);
45390
+ const dispatched = new completer_js_1.Completer();
45391
+ const operation = this._sendQueuedMessage({
45392
+ message: message2,
45393
+ resolvedTo,
45394
+ afterSend: () => dispatched.resolve()
45395
+ });
45396
+ this._sendOperations.add(operation);
45397
+ void operation.then(() => {
45398
+ this._sendOperations.delete(operation);
45399
+ if (!dispatched.completed)
45400
+ dispatched.resolve();
45401
+ }, () => {
45402
+ this._sendOperations.delete(operation);
45403
+ if (!dispatched.completed)
45404
+ dispatched.resolve();
45405
+ });
45406
+ await dispatched.fut;
45407
+ }
45408
+ }
45409
+ async _sendQueuedMessage({ message: message2, resolvedTo, afterSend }) {
45410
+ try {
45411
+ await this._invoke({
45412
+ operation: "send",
45413
+ input: this._messageInput({
45414
+ toParticipantId: resolvedTo.id,
45415
+ type: message2.type,
45416
+ message: message2.message,
45417
+ attachment: message2.attachment
45418
+ }),
45419
+ afterSend
45420
+ });
45421
+ if (message2.completer != null && !message2.completer.completed) {
45422
+ message2.completer.complete();
45423
+ }
45424
+ } catch (error) {
45425
+ if (error instanceof room_server_client_js_1.RoomServerException) {
45426
+ const wrapped = this.client._coerceMessageSendError(error);
45427
+ if (wrapped.message === "the participant was not found") {
45428
+ this._markParticipantOffline(message2.to);
43963
45429
  }
45430
+ this._dropQueuedMessage({ message: message2, error: wrapped });
45431
+ return;
45432
+ }
45433
+ if (message2.completer != null && !message2.completer.completed) {
45434
+ message2.completer.completeError(error);
43964
45435
  }
43965
45436
  }
43966
45437
  }
@@ -44024,6 +45495,46 @@ ${newlined}
44024
45495
  throw error;
44025
45496
  }
44026
45497
  }
45498
+ async stream({ to, type, message: message2, attachment }) {
45499
+ const input = new MessagingStreamInput();
45500
+ void input.enqueue(new response_js_1.JsonContent({
45501
+ json: {
45502
+ to_participant_id: to.id,
45503
+ type,
45504
+ message_json: JSON.stringify(message2),
45505
+ ...attachment == null ? {} : { attachment_base64: bytesToBase64(attachment) }
45506
+ }
45507
+ }));
45508
+ const outputResult = await this.client.invokeToolCall({
45509
+ toolkit: "messaging",
45510
+ tool: "stream",
45511
+ input: input.stream(),
45512
+ streamInput: true
45513
+ });
45514
+ if (outputResult.kind !== "stream") {
45515
+ input.close();
45516
+ throw new room_server_client_js_1.RoomServerException("unexpected return type from messaging.stream");
45517
+ }
45518
+ const outputIterable = outputResult.stream;
45519
+ const output = outputIterable[Symbol.asyncIterator]();
45520
+ const accepted = await output.next();
45521
+ if (accepted.done || !(accepted.value instanceof response_js_1.JsonContent) || accepted.value.json["kind"] !== "accepted" || typeof accepted.value.json["stream_id"] !== "string") {
45522
+ input.close();
45523
+ await output.return?.();
45524
+ throw new room_server_client_js_1.RoomServerException("messaging.stream did not acknowledge acceptance");
45525
+ }
45526
+ let stream;
45527
+ stream = new MessagingStream({
45528
+ streamId: accepted.value.json["stream_id"],
45529
+ remoteParticipantId: to.id,
45530
+ input,
45531
+ output,
45532
+ inputClosed: outputResult.inputClosed,
45533
+ onClosed: () => this._streams.delete(stream)
45534
+ });
45535
+ this._streams.add(stream);
45536
+ return stream;
45537
+ }
44027
45538
  getParticipants() {
44028
45539
  return this.remoteParticipants;
44029
45540
  }
@@ -44117,6 +45628,9 @@ ${newlined}
44117
45628
  this._wakeMessageQueue();
44118
45629
  this._drainQueuedMessages({ error });
44119
45630
  this._desiredEnabled = false;
45631
+ for (const stream of [...this._streams]) {
45632
+ stream.clientDisconnected(this.client.localParticipant?.id ?? stream.remoteParticipantId);
45633
+ }
44120
45634
  this._clearCurrentConnectionState();
44121
45635
  this.client.protocol.removeHandler("messaging.send", this._messageHandler);
44122
45636
  super.dispose();
@@ -47690,7 +49204,12 @@ ${newlined}
47690
49204
  }
47691
49205
  this._sendLocalAttributesNowait(attributes);
47692
49206
  }
47693
- async sendRequest(type, request, data) {
49207
+ async sendRequest(type, request, data, afterSend) {
49208
+ const response = this._dispatchRequest(type, request, data);
49209
+ afterSend?.();
49210
+ return await response;
49211
+ }
49212
+ _dispatchRequest(type, request, data) {
47694
49213
  this._raiseIfTerminal();
47695
49214
  if (this._entered && !this._connected && !this._allowDisconnectedRequests) {
47696
49215
  throw this._disconnectedError({ baseMessage: "room connection is disconnected" });
@@ -47699,8 +49218,8 @@ ${newlined}
47699
49218
  const completer = new completer_js_1.Completer();
47700
49219
  this._pendingRequests.set(requestId, completer);
47701
49220
  try {
47702
- await this._protocolInstance.send(type, (0, utils_js_1.packMessage)(request, data), requestId);
47703
- return await completer.fut;
49221
+ this._protocolInstance.sendNowait(type, (0, utils_js_1.packMessage)(request, data), { id: requestId });
49222
+ return completer.fut;
47704
49223
  } catch (error) {
47705
49224
  this._pendingRequests.delete(requestId);
47706
49225
  throw error;
@@ -47775,7 +49294,8 @@ ${newlined}
47775
49294
  tool: params.tool,
47776
49295
  input: this._normalizeInvokeInput(params.input ?? params.arguments),
47777
49296
  participantId: params.participantId,
47778
- onBehalfOfId: params.onBehalfOfId
49297
+ onBehalfOfId: params.onBehalfOfId,
49298
+ afterSend: params.afterSend
47779
49299
  });
47780
49300
  if (output.kind !== "content") {
47781
49301
  throw new room_server_client_js_1.RoomServerException("unexpected streamed output from " + params.toolkit + "." + params.tool);
@@ -47798,7 +49318,6 @@ ${newlined}
47798
49318
  let requestTask;
47799
49319
  if (params.streamInput === true) {
47800
49320
  request["arguments"] = { type: "control", method: "open" };
47801
- requestTask = this._streamInvokeToolRequestChunks(toolCallId, params.input);
47802
49321
  } else {
47803
49322
  const input = params.input;
47804
49323
  const packed = input.pack();
@@ -47814,9 +49333,14 @@ ${newlined}
47814
49333
  if (params.onBehalfOfId != null) {
47815
49334
  request["on_behalf_of_id"] = params.onBehalfOfId;
47816
49335
  }
49336
+ const responseRequest = this._dispatchRequest("room.invoke_tool", request, requestData);
49337
+ params.afterSend?.();
49338
+ if (params.streamInput === true) {
49339
+ requestTask = this._streamInvokeToolRequestChunks(toolCallId, params.input);
49340
+ }
47817
49341
  try {
47818
49342
  const response = await Promise.race([
47819
- this.sendRequest("room.invoke_tool", request, requestData),
49343
+ responseRequest,
47820
49344
  preOpenError.fut
47821
49345
  ]);
47822
49346
  this._toolCallPreOpenErrors.delete(toolCallId);
@@ -47870,9 +49394,10 @@ ${newlined}
47870
49394
  if (params.onBehalfOfId != null) {
47871
49395
  request["on_behalf_of_id"] = params.onBehalfOfId;
47872
49396
  }
49397
+ const responseRequest = this._dispatchRequest("room.invoke_tool", request);
47873
49398
  const requestTask = this._streamInvokeToolRequestChunks(toolCallId, params.input);
47874
49399
  try {
47875
- const response = await this.sendRequest("room.invoke_tool", request);
49400
+ const response = await responseRequest;
47876
49401
  await requestTask;
47877
49402
  if (response instanceof response_js_1.ControlContent && response.method === "open") {
47878
49403
  throw new room_server_client_js_1.RoomServerException(`unexpected return type from ${params.toolkit}.${params.tool}`);
@@ -47902,6 +49427,7 @@ ${newlined}
47902
49427
  if (params.onBehalfOfId != null) {
47903
49428
  request["on_behalf_of_id"] = params.onBehalfOfId;
47904
49429
  }
49430
+ const responseRequest = this._dispatchRequest("room.invoke_tool", request);
47905
49431
  const requestTask = this._streamInvokeToolRequestChunks(toolCallId, params.input);
47906
49432
  void requestTask.catch((error) => {
47907
49433
  const stream = this._toolCallStreams.get(toolCallId);
@@ -47915,7 +49441,7 @@ ${newlined}
47915
49441
  let response;
47916
49442
  try {
47917
49443
  response = await Promise.race([
47918
- this.sendRequest("room.invoke_tool", request),
49444
+ responseRequest,
47919
49445
  preOpenError.fut
47920
49446
  ]);
47921
49447
  } catch (error) {
@@ -47936,23 +49462,26 @@ ${newlined}
47936
49462
  }
47937
49463
  };
47938
49464
  }
47939
- async _sendToolCallRequestChunk(toolCallId, chunk) {
49465
+ _dispatchToolCallRequestChunk(toolCallId, chunk) {
49466
+ this._raiseIfTerminal();
49467
+ if (this._entered && !this._connected && !this._allowDisconnectedRequests) {
49468
+ throw this._disconnectedError({ baseMessage: "room connection is disconnected" });
49469
+ }
47940
49470
  const packed = chunk.pack();
47941
49471
  const request = {
47942
49472
  tool_call_id: toolCallId,
47943
49473
  chunk: JSON.parse((0, utils_js_1.splitMessageHeader)(packed))
47944
49474
  };
47945
49475
  const payload = (0, utils_js_1.splitMessagePayload)(packed);
47946
- await this.sendRequest("room.tool_call_request_chunk", request, payload.length > 0 ? payload : void 0);
49476
+ this._protocolInstance.sendNowait("room.tool_call_request_chunk", (0, utils_js_1.packMessage)(request, payload.length > 0 ? payload : void 0));
47947
49477
  }
47948
49478
  async _streamInvokeToolRequestChunks(toolCallId, input) {
47949
- await Promise.resolve();
47950
49479
  try {
47951
49480
  for await (const item of input) {
47952
- await this._sendToolCallRequestChunk(toolCallId, item);
49481
+ this._dispatchToolCallRequestChunk(toolCallId, item);
47953
49482
  }
47954
49483
  } finally {
47955
- await this._sendToolCallRequestChunk(toolCallId, new response_js_1.ControlContent({ method: "close" }));
49484
+ this._dispatchToolCallRequestChunk(toolCallId, new response_js_1.ControlContent({ method: "close" }));
47956
49485
  }
47957
49486
  }
47958
49487
  _decodeToolCallContent(params) {