@query-farm/vgi 0.29.0 → 0.30.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (91) hide show
  1. package/README.md +26 -1
  2. package/dist/arguments/argument-spec.d.ts +4 -2
  3. package/dist/catalog/composite.d.ts +13 -13
  4. package/dist/catalog/descriptors.d.ts +7 -3
  5. package/dist/catalog/interface.d.ts +67 -40
  6. package/dist/catalog/read-only.d.ts +32 -15
  7. package/dist/client/client.d.ts +36 -29
  8. package/dist/client/types.d.ts +2 -0
  9. package/dist/client-entry.d.ts +1 -1
  10. package/dist/client-entry.js +442 -283
  11. package/dist/client-entry.js.map +12 -11
  12. package/dist/filter-pushdown/capabilities.d.ts +3 -0
  13. package/dist/filter-pushdown/deserialize.d.ts +14 -15
  14. package/dist/filter-pushdown/evaluate.d.ts +14 -44
  15. package/dist/filter-pushdown/index.d.ts +2 -2
  16. package/dist/filter-pushdown/types.d.ts +120 -68
  17. package/dist/functions/aggregate.d.ts +4 -0
  18. package/dist/functions/registry.d.ts +5 -5
  19. package/dist/functions/scalar.d.ts +6 -1
  20. package/dist/functions/table-buffering.d.ts +9 -0
  21. package/dist/functions/table-in-out.d.ts +13 -0
  22. package/dist/functions/table.d.ts +9 -2
  23. package/dist/functions/types.d.ts +22 -2
  24. package/dist/generated/vgi-client.d.ts +57 -31
  25. package/dist/generated/vgi-protocol-schemas.d.ts +15 -0
  26. package/dist/http/fetch.d.ts +7 -1
  27. package/dist/index.core.d.ts +2 -1
  28. package/dist/index.js +2320 -1363
  29. package/dist/index.js.map +44 -41
  30. package/dist/metadata/types.d.ts +15 -2
  31. package/dist/protocol/handlers/shared.d.ts +3 -1
  32. package/dist/protocol/serializers/splits.d.ts +1 -1
  33. package/dist/protocol/types.d.ts +9 -3
  34. package/dist/schema-path.d.ts +7 -0
  35. package/dist/serve-entry.d.ts +22 -1
  36. package/dist/serve-entry.js +414 -243
  37. package/dist/serve-entry.js.map +28 -27
  38. package/dist/split-token.d.ts +1 -1
  39. package/dist/types.d.ts +8 -0
  40. package/dist/worker-cf-entry.js +2033 -1210
  41. package/dist/worker-cf-entry.js.map +41 -37
  42. package/dist/worker.d.ts +1 -1
  43. package/package.json +3 -3
  44. package/src/arguments/argument-spec.ts +12 -4
  45. package/src/catalog/composite.ts +26 -26
  46. package/src/catalog/descriptors.ts +12 -3
  47. package/src/catalog/interface.ts +98 -48
  48. package/src/catalog/read-only.ts +125 -71
  49. package/src/client/client.ts +92 -72
  50. package/src/client/types.ts +2 -0
  51. package/src/client-entry.ts +2 -1
  52. package/src/filter-pushdown/capabilities.ts +13 -0
  53. package/src/filter-pushdown/collector.ts +22 -35
  54. package/src/filter-pushdown/deserialize.ts +657 -221
  55. package/src/filter-pushdown/evaluate.ts +410 -499
  56. package/src/filter-pushdown/index.ts +16 -2
  57. package/src/filter-pushdown/types.ts +88 -71
  58. package/src/functions/aggregate.ts +9 -1
  59. package/src/functions/registry.ts +24 -22
  60. package/src/functions/scalar.ts +26 -0
  61. package/src/functions/table-buffering.ts +46 -7
  62. package/src/functions/table-in-out.ts +187 -30
  63. package/src/functions/table.ts +58 -20
  64. package/src/functions/types.ts +24 -1
  65. package/src/generated/vgi-client.ts +62 -33
  66. package/src/generated/vgi-protocol-schemas.ts +226 -58
  67. package/src/http/client-bundle.ts +1 -1
  68. package/src/http/fetch.ts +12 -0
  69. package/src/index.core.ts +2 -0
  70. package/src/metadata/resolve.ts +43 -1
  71. package/src/metadata/serialize.ts +43 -5
  72. package/src/metadata/types.ts +17 -1
  73. package/src/protocol/dispatch.ts +1 -1
  74. package/src/protocol/handlers/aggregate.ts +13 -7
  75. package/src/protocol/handlers/catalog/admin.ts +6 -6
  76. package/src/protocol/handlers/catalog/index_methods.ts +2 -2
  77. package/src/protocol/handlers/catalog/macro.ts +4 -4
  78. package/src/protocol/handlers/catalog/shared.ts +2 -0
  79. package/src/protocol/handlers/catalog/table.ts +16 -16
  80. package/src/protocol/handlers/catalog/view.ts +5 -5
  81. package/src/protocol/handlers/function.ts +2 -2
  82. package/src/protocol/handlers/shared.ts +12 -3
  83. package/src/protocol/handlers/table-buffering.ts +4 -4
  84. package/src/protocol/serializers/bind.ts +15 -6
  85. package/src/protocol/serializers/splits.ts +4 -2
  86. package/src/protocol/types.ts +9 -3
  87. package/src/schema-path.ts +25 -0
  88. package/src/serve-entry.ts +65 -3
  89. package/src/split-token.ts +2 -2
  90. package/src/types.ts +9 -0
  91. package/src/worker.ts +49 -4
@@ -333,8 +333,8 @@ import {
333
333
  DataType,
334
334
  makeData
335
335
  } from "@query-farm/apache-arrow";
336
- function emptyData(field2) {
337
- const type = field2.type;
336
+ function emptyData(field) {
337
+ const type = field.type;
338
338
  if (DataType.isList(type)) {
339
339
  const childField = type.children[0];
340
340
  return makeData({
@@ -361,8 +361,8 @@ function emptyData(field2) {
361
361
  }
362
362
  return makeData({ type, length: 0, nullCount: 0 });
363
363
  }
364
- function emptyBatch(schema2) {
365
- const a = schema2;
364
+ function emptyBatch(schema) {
365
+ const a = schema;
366
366
  const children = a.fields.map((f) => emptyData(f));
367
367
  const structType = new Struct(a.fields);
368
368
  const data = makeData({
@@ -1369,8 +1369,8 @@ function readUnion(type, col, data, index) {
1369
1369
  const children = type.children;
1370
1370
  const typeIds = data?.typeIds;
1371
1371
  const tcode = typeIds ? typeIds[index] : children.length > 0 ? 0 : -1;
1372
- const map2 = type.typeIdToChildIndex;
1373
- const childIdx = map2 && map2[tcode] !== undefined ? map2[tcode] : tcode;
1372
+ const map = type.typeIdToChildIndex;
1373
+ const childIdx = map && map[tcode] !== undefined ? map[tcode] : tcode;
1374
1374
  const childField = children[childIdx];
1375
1375
  if (!childField)
1376
1376
  return { tag: null, value: null };
@@ -1432,19 +1432,19 @@ function readDictionary(type, col, data, index) {
1432
1432
  function columnFromArray(values, type) {
1433
1433
  return vectorFromArray2(values, type).data[0];
1434
1434
  }
1435
- function batchFromRows(rows, schema2) {
1436
- const a = schema2;
1435
+ function batchFromRows(rows, schema) {
1436
+ const a = schema;
1437
1437
  if (rows.length === 0) {
1438
1438
  return emptyBatch(a);
1439
1439
  }
1440
1440
  const columns = {};
1441
- for (const field2 of a.fields) {
1442
- columns[field2.name] = rows.map((r) => r[field2.name] ?? null);
1441
+ for (const field of a.fields) {
1442
+ columns[field.name] = rows.map((r) => r[field.name] ?? null);
1443
1443
  }
1444
1444
  return batchFromColumns(columns, a);
1445
1445
  }
1446
- function batchFromColumns(columns, schema2, repr = "rich") {
1447
- const a = schema2;
1446
+ function batchFromColumns(columns, schema, repr = "rich") {
1447
+ const a = schema;
1448
1448
  const numRows = a.fields.length > 0 ? columns[a.fields[0].name]?.length ?? 0 : 0;
1449
1449
  const children = a.fields.map((f) => {
1450
1450
  const values = columns[f.name];
@@ -1472,15 +1472,15 @@ function* iterRows(batch, repr = "rich") {
1472
1472
  for (let i = 0;i < a.numRows; i++) {
1473
1473
  const row = {};
1474
1474
  for (let fi = 0;fi < a.schema.fields.length; fi++) {
1475
- const field2 = a.schema.fields[fi];
1476
- const col = a.getChild(field2.name);
1475
+ const field = a.schema.fields[fi];
1476
+ const col = a.getChild(field.name);
1477
1477
  if (!col) {
1478
- row[field2.name] = null;
1478
+ row[field.name] = null;
1479
1479
  continue;
1480
1480
  }
1481
- const canonical = readCanonicalValue(field2.type, col, i);
1481
+ const canonical = readCanonicalValue(field.type, col, i);
1482
1482
  const codec = codecs[fi];
1483
- row[field2.name] = repr === "raw" ? codec.canonicalToRaw(canonical) : codec.canonicalToRich(canonical);
1483
+ row[field.name] = repr === "raw" ? codec.canonicalToRaw(canonical) : codec.canonicalToRich(canonical);
1484
1484
  }
1485
1485
  yield row;
1486
1486
  }
@@ -1492,12 +1492,12 @@ function batchToScalarDict(batch) {
1492
1492
  if (a.numRows === 0)
1493
1493
  return {};
1494
1494
  const result = {};
1495
- for (const field2 of a.schema.fields) {
1496
- const col = a.getChild(field2.name);
1495
+ for (const field of a.schema.fields) {
1496
+ const col = a.getChild(field.name);
1497
1497
  if (col) {
1498
- const type = field2.type;
1498
+ const type = field.type;
1499
1499
  const canonical = readCanonicalValue(type, col, 0);
1500
- result[field2.name] = codecFor(type).canonicalToRich(canonical);
1500
+ result[field.name] = codecFor(type).canonicalToRich(canonical);
1501
1501
  }
1502
1502
  }
1503
1503
  return result;
@@ -1523,18 +1523,18 @@ function batchToSecretDict(batch) {
1523
1523
  if (a.numRows === 0)
1524
1524
  return {};
1525
1525
  const result = {};
1526
- for (const field2 of a.schema.fields) {
1527
- const col = a.getChild(field2.name);
1526
+ for (const field of a.schema.fields) {
1527
+ const col = a.getChild(field.name);
1528
1528
  if (col) {
1529
- const type = field2.type;
1529
+ const type = field.type;
1530
1530
  const val = codecFor(type).canonicalToRich(readCanonicalValue(type, col, 0));
1531
- let key = field2.name;
1531
+ let key = field.name;
1532
1532
  let scope;
1533
- if (field2.name.startsWith("secret_")) {
1534
- const secretType = field2.metadata?.get?.("secret_type");
1533
+ if (field.name.startsWith("secret_")) {
1534
+ const secretType = field.metadata?.get?.("secret_type");
1535
1535
  if (secretType) {
1536
1536
  key = secretType;
1537
- scope = field2.metadata?.get?.("scope") ?? undefined;
1537
+ scope = field.metadata?.get?.("scope") ?? undefined;
1538
1538
  }
1539
1539
  }
1540
1540
  if (val && typeof val === "object" && !ArrayBuffer.isView(val)) {
@@ -1583,11 +1583,11 @@ function filterBatch(batch, mask) {
1583
1583
  indices.push(i);
1584
1584
  }
1585
1585
  const columns = {};
1586
- for (const field2 of a.schema.fields) {
1587
- const col = a.getChild(field2.name);
1588
- const type = field2.type;
1586
+ for (const field of a.schema.fields) {
1587
+ const col = a.getChild(field.name);
1588
+ const type = field.type;
1589
1589
  const codec = codecFor(type);
1590
- columns[field2.name] = indices.map((i) => codec.canonicalToRich(readCanonicalValue(type, col, i)));
1590
+ columns[field.name] = indices.map((i) => codec.canonicalToRich(readCanonicalValue(type, col, i)));
1591
1591
  }
1592
1592
  return batchFromColumns(columns, a.schema);
1593
1593
  }
@@ -1609,8 +1609,8 @@ function validateProjectionIds(caller, projectionIds, fieldCount) {
1609
1609
  }
1610
1610
  return projectionIds.filter((i) => i >= 0 && i < fieldCount);
1611
1611
  }
1612
- function projectSchema(projectionIds, schema2) {
1613
- const a = schema2;
1612
+ function projectSchema(projectionIds, schema) {
1613
+ const a = schema;
1614
1614
  if (!projectionIds)
1615
1615
  return a;
1616
1616
  const validIds = validateProjectionIds("projectSchema", projectionIds, a.fields.length);
@@ -1651,9 +1651,9 @@ import {
1651
1651
  RecordBatchStreamWriter,
1652
1652
  RecordBatchReader
1653
1653
  } from "@query-farm/apache-arrow";
1654
- function serializeSchema(schema2) {
1654
+ function serializeSchema(schema) {
1655
1655
  const writer = new RecordBatchStreamWriter;
1656
- writer.reset(undefined, schema2);
1656
+ writer.reset(undefined, schema);
1657
1657
  writer.close();
1658
1658
  return writer.toUint8Array(true);
1659
1659
  }
@@ -1721,20 +1721,20 @@ function buildTypedColumnData(values, type) {
1721
1721
  function buildStatisticsBatch(stats) {
1722
1722
  if (stats.length === 0) {
1723
1723
  const nullField = new Field3("0", new Null, true);
1724
- const unionType2 = new SparseUnion([0], [nullField]);
1725
- const minData2 = makeData5({
1726
- type: unionType2,
1724
+ const unionType = new SparseUnion([0], [nullField]);
1725
+ const minData = makeData5({
1726
+ type: unionType,
1727
1727
  length: 0,
1728
1728
  typeIds: new Int8Array(0),
1729
1729
  children: [makeData5({ type: new Null, length: 0, nullCount: 0 })]
1730
1730
  });
1731
- const maxData2 = makeData5({
1732
- type: unionType2,
1731
+ const maxData = makeData5({
1732
+ type: unionType,
1733
1733
  length: 0,
1734
1734
  typeIds: new Int8Array(0),
1735
1735
  children: [makeData5({ type: new Null, length: 0, nullCount: 0 })]
1736
1736
  });
1737
- return assemble([], minData2, maxData2, [], [], [], [], [], unionType2);
1737
+ return assemble([], minData, maxData, [], [], [], [], [], unionType);
1738
1738
  }
1739
1739
  const typeOrder = [];
1740
1740
  const typeIdMap = new Map;
@@ -1778,7 +1778,7 @@ function buildStatisticsBatch(stats) {
1778
1778
  return assemble(stats.map((s) => s.columnName), minData, maxData, stats.map((s) => s.hasNull), stats.map((s) => s.hasNotNull), stats.map((s) => s.distinctCount == null ? null : BigInt(s.distinctCount)), stats.map((s) => s.containsUnicode), stats.map((s) => s.maxStringLength == null ? null : BigInt(s.maxStringLength)), unionType);
1779
1779
  }
1780
1780
  function assemble(columnNames, minData, maxData, hasNull, hasNotNull, distinctCount, containsUnicode, maxStringLength, unionType) {
1781
- const schema2 = new Schema5([
1781
+ const schema = new Schema5([
1782
1782
  new Field3("column_name", new Utf8, false),
1783
1783
  new Field3("min", unionType, true),
1784
1784
  new Field3("max", unionType, true),
@@ -1799,9 +1799,9 @@ function assemble(columnNames, minData, maxData, hasNull, hasNotNull, distinctCo
1799
1799
  buildTypedColumnData(containsUnicode, new Bool),
1800
1800
  buildTypedColumnData(maxStringLength, new Uint64)
1801
1801
  ];
1802
- const structType = new Struct5(schema2.fields);
1802
+ const structType = new Struct5(schema.fields);
1803
1803
  const data = makeData5({ type: structType, length: n, children, nullCount: 0 });
1804
- return new RecordBatch6(schema2, data);
1804
+ return new RecordBatch6(schema, data);
1805
1805
  }
1806
1806
 
1807
1807
  // src/arrow/impl-arrowjs/index.ts
@@ -1819,6 +1819,7 @@ var bool2 = () => bool();
1819
1819
  var int162 = () => int16();
1820
1820
  var int322 = () => int32();
1821
1821
  var int642 = () => int64();
1822
+ var uint642 = () => uint64();
1822
1823
  var float642 = () => float64();
1823
1824
  var utf82 = () => utf8();
1824
1825
  var binary2 = () => binary();
@@ -1905,47 +1906,100 @@ function unwrapScalar(val) {
1905
1906
  return val;
1906
1907
  }
1907
1908
 
1909
+ // src/protocol/serializers/arguments.ts
1910
+ function serializeArguments(args) {
1911
+ const structFields = [];
1912
+ const structValues = {};
1913
+ for (let i = 0;i < args.positional.length; i++) {
1914
+ const val = args.positional[i];
1915
+ const fieldName = `positional_${i}`;
1916
+ structFields.push(field2(fieldName, inferScalarType(val), true));
1917
+ structValues[fieldName] = val;
1918
+ }
1919
+ for (const [name, val] of args.named) {
1920
+ const fieldName = `named_${name}`;
1921
+ structFields.push(field2(fieldName, inferScalarType(val), true));
1922
+ structValues[fieldName] = val;
1923
+ }
1924
+ const structType = struct2(structFields);
1925
+ const sch = schema2([field2("args", structType, true)]);
1926
+ const structRow = {};
1927
+ for (const f of structFields) {
1928
+ let val = structValues[f.name];
1929
+ if (isInt(f.type) && f.type.bitWidth === 64 && typeof val === "number") {
1930
+ val = BigInt(val);
1931
+ }
1932
+ structRow[f.name] = val;
1933
+ }
1934
+ const batch = batchFromColumns({ args: [structRow] }, sch);
1935
+ return serializeBatch(batch);
1936
+ }
1937
+ function inferScalarType(val) {
1938
+ if (val === null || val === undefined)
1939
+ return nullType2();
1940
+ if (typeof val === "string")
1941
+ return utf82();
1942
+ if (typeof val === "boolean")
1943
+ return bool2();
1944
+ if (typeof val === "number")
1945
+ return int642();
1946
+ if (typeof val === "bigint")
1947
+ return int642();
1948
+ if (val instanceof Uint8Array || val instanceof ArrayBuffer)
1949
+ return binary2();
1950
+ return utf82();
1951
+ }
1952
+
1908
1953
  // src/types.ts
1909
1954
  var FunctionType;
1910
- ((FunctionType2) => {
1911
- FunctionType2["SCALAR"] = "scalar";
1912
- FunctionType2["TABLE"] = "table";
1913
- FunctionType2["TABLE_BUFFERING"] = "table_buffering";
1914
- FunctionType2["AGGREGATE"] = "aggregate";
1955
+ ((FunctionType) => {
1956
+ FunctionType["SCALAR"] = "scalar";
1957
+ FunctionType["TABLE"] = "table";
1958
+ FunctionType["TABLE_BUFFERING"] = "table_buffering";
1959
+ FunctionType["AGGREGATE"] = "aggregate";
1915
1960
  })(FunctionType ||= {});
1916
1961
  var FunctionStability;
1917
- ((FunctionStability2) => {
1918
- FunctionStability2["CONSISTENT"] = "CONSISTENT";
1919
- FunctionStability2["VOLATILE"] = "VOLATILE";
1920
- FunctionStability2["CONSISTENT_WITHIN_QUERY"] = "CONSISTENT_WITHIN_QUERY";
1962
+ ((FunctionStability) => {
1963
+ FunctionStability["CONSISTENT"] = "CONSISTENT";
1964
+ FunctionStability["VOLATILE"] = "VOLATILE";
1965
+ FunctionStability["CONSISTENT_WITHIN_QUERY"] = "CONSISTENT_WITHIN_QUERY";
1921
1966
  })(FunctionStability ||= {});
1922
1967
  var NullHandling;
1923
- ((NullHandling2) => {
1924
- NullHandling2["DEFAULT"] = "DEFAULT";
1925
- NullHandling2["SPECIAL"] = "SPECIAL";
1968
+ ((NullHandling) => {
1969
+ NullHandling["DEFAULT"] = "DEFAULT";
1970
+ NullHandling["SPECIAL"] = "SPECIAL";
1926
1971
  })(NullHandling ||= {});
1972
+ var ArgumentMonotonicity;
1973
+ ((ArgumentMonotonicity) => {
1974
+ ArgumentMonotonicity["UNKNOWN"] = "UNKNOWN";
1975
+ ArgumentMonotonicity["CONSTANT"] = "CONSTANT";
1976
+ ArgumentMonotonicity["NON_DECREASING"] = "NON_DECREASING";
1977
+ ArgumentMonotonicity["STRICTLY_INCREASING"] = "STRICTLY_INCREASING";
1978
+ ArgumentMonotonicity["NON_INCREASING"] = "NON_INCREASING";
1979
+ ArgumentMonotonicity["STRICTLY_DECREASING"] = "STRICTLY_DECREASING";
1980
+ })(ArgumentMonotonicity ||= {});
1927
1981
  var OrderPreservation;
1928
- ((OrderPreservation2) => {
1929
- OrderPreservation2["PRESERVES_ORDER"] = "PRESERVES_ORDER";
1930
- OrderPreservation2["NO_ORDER_GUARANTEE"] = "NO_ORDER_GUARANTEE";
1931
- OrderPreservation2["FIXED_ORDER"] = "FIXED_ORDER";
1982
+ ((OrderPreservation) => {
1983
+ OrderPreservation["PRESERVES_ORDER"] = "PRESERVES_ORDER";
1984
+ OrderPreservation["NO_ORDER_GUARANTEE"] = "NO_ORDER_GUARANTEE";
1985
+ OrderPreservation["FIXED_ORDER"] = "FIXED_ORDER";
1932
1986
  })(OrderPreservation ||= {});
1933
1987
  var OrderDependence;
1934
- ((OrderDependence2) => {
1935
- OrderDependence2["ORDER_DEPENDENT"] = "ORDER_DEPENDENT";
1936
- OrderDependence2["NOT_ORDER_DEPENDENT"] = "NOT_ORDER_DEPENDENT";
1988
+ ((OrderDependence) => {
1989
+ OrderDependence["ORDER_DEPENDENT"] = "ORDER_DEPENDENT";
1990
+ OrderDependence["NOT_ORDER_DEPENDENT"] = "NOT_ORDER_DEPENDENT";
1937
1991
  })(OrderDependence ||= {});
1938
1992
  var DistinctDependence;
1939
- ((DistinctDependence2) => {
1940
- DistinctDependence2["DISTINCT_DEPENDENT"] = "DISTINCT_DEPENDENT";
1941
- DistinctDependence2["NOT_DISTINCT_DEPENDENT"] = "NOT_DISTINCT_DEPENDENT";
1993
+ ((DistinctDependence) => {
1994
+ DistinctDependence["DISTINCT_DEPENDENT"] = "DISTINCT_DEPENDENT";
1995
+ DistinctDependence["NOT_DISTINCT_DEPENDENT"] = "NOT_DISTINCT_DEPENDENT";
1942
1996
  })(DistinctDependence ||= {});
1943
1997
  var TableInOutPhase;
1944
- ((TableInOutPhase2) => {
1945
- TableInOutPhase2["INPUT"] = "INPUT";
1946
- TableInOutPhase2["FINALIZE"] = "FINALIZE";
1947
- TableInOutPhase2["TABLE_BUFFERING"] = "TABLE_BUFFERING";
1948
- TableInOutPhase2["TABLE_BUFFERING_FINALIZE"] = "TABLE_BUFFERING_FINALIZE";
1998
+ ((TableInOutPhase) => {
1999
+ TableInOutPhase["INPUT"] = "INPUT";
2000
+ TableInOutPhase["FINALIZE"] = "FINALIZE";
2001
+ TableInOutPhase["TABLE_BUFFERING"] = "TABLE_BUFFERING";
2002
+ TableInOutPhase["TABLE_BUFFERING_FINALIZE"] = "TABLE_BUFFERING_FINALIZE";
1949
2003
  })(TableInOutPhase ||= {});
1950
2004
  var VGI_ARG_KEY = "vgi_arg";
1951
2005
  var VGI_ARG_NAMED = "named";
@@ -1985,60 +2039,16 @@ function toUint8Array2(val) {
1985
2039
  }
1986
2040
  return result;
1987
2041
  }
1988
- function buildSingleRowBatch(schema3, values) {
2042
+ function buildSingleRowBatch(schema, values) {
1989
2043
  const cols = {};
1990
- for (const f of schema3.fields) {
2044
+ for (const f of schema.fields) {
1991
2045
  let val = values[f.name];
1992
2046
  if (isInt(f.type) && f.type.bitWidth === 64 && typeof val === "number") {
1993
2047
  val = BigInt(val);
1994
2048
  }
1995
2049
  cols[f.name] = [val];
1996
2050
  }
1997
- return batchFromColumns(cols, schema3);
1998
- }
1999
-
2000
- // src/protocol/serializers/arguments.ts
2001
- function serializeArguments(args) {
2002
- const structFields = [];
2003
- const structValues = {};
2004
- for (let i = 0;i < args.positional.length; i++) {
2005
- const val = args.positional[i];
2006
- const fieldName = `positional_${i}`;
2007
- structFields.push(field2(fieldName, inferScalarType(val), true));
2008
- structValues[fieldName] = val;
2009
- }
2010
- for (const [name, val] of args.named) {
2011
- const fieldName = `named_${name}`;
2012
- structFields.push(field2(fieldName, inferScalarType(val), true));
2013
- structValues[fieldName] = val;
2014
- }
2015
- const structType = struct2(structFields);
2016
- const sch = schema2([field2("args", structType, true)]);
2017
- const structRow = {};
2018
- for (const f of structFields) {
2019
- let val = structValues[f.name];
2020
- if (isInt(f.type) && f.type.bitWidth === 64 && typeof val === "number") {
2021
- val = BigInt(val);
2022
- }
2023
- structRow[f.name] = val;
2024
- }
2025
- const batch = batchFromColumns({ args: [structRow] }, sch);
2026
- return serializeBatch(batch);
2027
- }
2028
- function inferScalarType(val) {
2029
- if (val === null || val === undefined)
2030
- return nullType2();
2031
- if (typeof val === "string")
2032
- return utf82();
2033
- if (typeof val === "boolean")
2034
- return bool2();
2035
- if (typeof val === "number")
2036
- return int642();
2037
- if (typeof val === "bigint")
2038
- return int642();
2039
- if (val instanceof Uint8Array || val instanceof ArrayBuffer)
2040
- return binary2();
2041
- return utf82();
2051
+ return batchFromColumns(cols, schema);
2042
2052
  }
2043
2053
 
2044
2054
  // src/protocol/serializers/bind.ts
@@ -2065,7 +2075,8 @@ var BIND_REQUEST_SCHEMA = schema2([
2065
2075
  field2("at_value", utf82(), true),
2066
2076
  field2("copy_from", COPY_FROM_STRUCT_TYPE, true),
2067
2077
  field2("copy_to", COPY_TO_STRUCT_TYPE, true),
2068
- field2("schema_name", utf82(), true)
2078
+ field2("schema_path", list2(field2("item", utf82(), true)), true),
2079
+ field2("argument_names", list2(field2("item", utf82(), true)), true)
2069
2080
  ]);
2070
2081
  function serializeBindRequest(req) {
2071
2082
  return buildSingleRowBatch(BIND_REQUEST_SCHEMA, {
@@ -2086,7 +2097,8 @@ function serializeBindRequest(req) {
2086
2097
  expected_schema: serializeSchema(req.copy_from.expected_schema)
2087
2098
  } : null,
2088
2099
  copy_to: req.copy_to ? { format: req.copy_to.format, file_path: req.copy_to.file_path } : null,
2089
- schema_name: req.schema_name ?? null
2100
+ schema_path: req.schema_path ?? null,
2101
+ argument_names: req.argument_names ?? null
2090
2102
  });
2091
2103
  }
2092
2104
  function deserializeBindResponse(params) {
@@ -2221,21 +2233,26 @@ class NoCatalogError extends VgiError {
2221
2233
  }
2222
2234
  }
2223
2235
 
2236
+ // src/schema-path.ts
2237
+ function normalizeSchemaPath(path) {
2238
+ return typeof path === "string" ? [path] : Array.from(path, String);
2239
+ }
2240
+
2224
2241
  // src/codec/asd.ts
2225
- function encodeASD(schema3, obj) {
2226
- return serializeBatch(batchFromRows([obj], schema3));
2242
+ function encodeASD(schema, obj) {
2243
+ return serializeBatch(batchFromRows([obj], schema));
2227
2244
  }
2228
- function decodeASD(schema3, bytes) {
2245
+ function decodeASD(schema, bytes) {
2229
2246
  const batch = deserializeBatch(bytes);
2230
2247
  if (batch.numRows === 0) {
2231
- const names = schema3.fields.map((f) => f.name).join(",");
2248
+ const names = schema.fields.map((f) => f.name).join(",");
2232
2249
  throw new Error(`decodeASD: empty batch (expected 1 row for ${names})`);
2233
2250
  }
2234
2251
  const out = {};
2235
- for (const field3 of schema3.fields) {
2236
- const col = batch.getChild(field3.name);
2252
+ for (const field of schema.fields) {
2253
+ const col = batch.getChild(field.name);
2237
2254
  const raw = col ? col.get(0) : null;
2238
- out[field3.name] = normalizeValue(raw, field3.type);
2255
+ out[field.name] = normalizeValue(raw, field.type);
2239
2256
  }
2240
2257
  return out;
2241
2258
  }
@@ -2320,24 +2337,21 @@ var SchemaInfoSchema = schema2([
2320
2337
  field2("comment", utf82(), true),
2321
2338
  field2("tags", map2(field2("key", utf82(), false), field2("value", utf82(), true), false), false),
2322
2339
  field2("attach_opaque_data", binary2(), false),
2323
- field2("name", utf82(), false),
2340
+ field2("path", list2(field2("item", utf82(), true)), false),
2324
2341
  field2("estimated_object_count", map2(field2("key", utf82(), false), field2("value", int642(), true), false), true)
2325
2342
  ]);
2326
2343
  var TableInfoSchema = schema2([
2327
2344
  field2("comment", utf82(), true),
2328
2345
  field2("tags", map2(field2("key", utf82(), false), field2("value", utf82(), true), false), false),
2329
2346
  field2("name", utf82(), false),
2330
- field2("schema_name", utf82(), false),
2347
+ field2("schema_path", list2(field2("item", utf82(), true)), false),
2331
2348
  field2("columns", binary2(), false),
2332
2349
  field2("not_null_constraints", list2(field2("item", int322(), true)), false),
2333
2350
  field2("unique_constraints", list2(field2("item", list2(field2("item", int322(), true)), true)), false),
2334
2351
  field2("check_constraints", list2(field2("item", utf82(), true)), false),
2335
2352
  field2("primary_key_constraints", list2(field2("item", list2(field2("item", int322(), true)), true)), false),
2336
2353
  field2("foreign_key_constraints", list2(field2("item", binary2(), true)), false),
2337
- field2("supports_insert", bool2(), false),
2338
- field2("supports_update", bool2(), false),
2339
- field2("supports_delete", bool2(), false),
2340
- field2("supports_returning", bool2(), false),
2354
+ field2("write_result_modes", map2(field2("key", utf82(), false), field2("value", utf82(), true), false), false),
2341
2355
  field2("supports_column_statistics", bool2(), false),
2342
2356
  field2("scan_function", binary2(), true),
2343
2357
  field2("insert_function", binary2(), true),
@@ -2353,7 +2367,7 @@ var ViewInfoSchema = schema2([
2353
2367
  field2("comment", utf82(), true),
2354
2368
  field2("tags", map2(field2("key", utf82(), false), field2("value", utf82(), true), false), false),
2355
2369
  field2("name", utf82(), false),
2356
- field2("schema_name", utf82(), false),
2370
+ field2("schema_path", list2(field2("item", utf82(), true)), false),
2357
2371
  field2("definition", utf82(), false),
2358
2372
  field2("column_comments", map2(field2("key", utf82(), false), field2("value", utf82(), true), false), false)
2359
2373
  ]);
@@ -2361,12 +2375,14 @@ var FunctionInfoSchema = schema2([
2361
2375
  field2("comment", utf82(), true),
2362
2376
  field2("tags", map2(field2("key", utf82(), false), field2("value", utf82(), true), false), false),
2363
2377
  field2("name", utf82(), false),
2364
- field2("schema_name", utf82(), false),
2378
+ field2("schema_path", list2(field2("item", utf82(), true)), false),
2365
2379
  field2("function_type", dictionary2(utf82(), int162()), false),
2366
2380
  field2("arguments", binary2(), false),
2367
2381
  field2("output_schema", binary2(), false),
2382
+ field2("parameter_default_values", binary2(), true),
2368
2383
  field2("stability", dictionary2(utf82(), int162()), true),
2369
2384
  field2("null_handling", dictionary2(utf82(), int162()), true),
2385
+ field2("argument_monotonicity", list2(field2("item", utf82(), true)), true),
2370
2386
  field2("description", utf82(), false),
2371
2387
  field2("examples", list2(field2("item", struct2([field2("sql", utf82(), false), field2("description", utf82(), false), field2("expected_output", utf82(), true)]), true)), false),
2372
2388
  field2("categories", list2(field2("item", utf82(), true)), false),
@@ -2374,7 +2390,10 @@ var FunctionInfoSchema = schema2([
2374
2390
  field2("filter_pushdown", bool2(), true),
2375
2391
  field2("sampling_pushdown", bool2(), true),
2376
2392
  field2("late_materialization", bool2(), true),
2377
- field2("supported_expression_filters", list2(field2("item", utf82(), true)), false),
2393
+ field2("filter_semantic_profiles", list2(field2("item", utf82(), true)), false),
2394
+ field2("additional_filter_functions", list2(field2("item", struct2([field2("namespace", utf82(), false), field2("name", utf82(), false), field2("version", uint642(), false)]), true)), false),
2395
+ field2("runtime_filter_algorithms", list2(field2("item", struct2([field2("namespace", utf82(), false), field2("name", utf82(), false), field2("version", uint642(), false)]), true)), false),
2396
+ field2("filter_evaluation_contexts", list2(field2("item", struct2([field2("profile", utf82(), false), field2("provider_fingerprint", utf82(), true)]), true)), false),
2378
2397
  field2("order_preservation", dictionary2(utf82(), int162()), true),
2379
2398
  field2("max_workers", int322(), true),
2380
2399
  field2("supports_batch_index", bool2(), false),
@@ -2399,7 +2418,7 @@ var MacroInfoSchema = schema2([
2399
2418
  field2("comment", utf82(), true),
2400
2419
  field2("tags", map2(field2("key", utf82(), false), field2("value", utf82(), true), false), false),
2401
2420
  field2("name", utf82(), false),
2402
- field2("schema_name", utf82(), false),
2421
+ field2("schema_path", list2(field2("item", utf82(), true)), false),
2403
2422
  field2("macro_type", dictionary2(utf82(), int162()), false),
2404
2423
  field2("parameters", list2(field2("item", utf82(), true)), false),
2405
2424
  field2("parameter_default_values", binary2(), true),
@@ -2410,7 +2429,7 @@ var IndexInfoSchema = schema2([
2410
2429
  field2("comment", utf82(), true),
2411
2430
  field2("tags", map2(field2("key", utf82(), false), field2("value", utf82(), true), false), false),
2412
2431
  field2("name", utf82(), false),
2413
- field2("schema_name", utf82(), false),
2432
+ field2("schema_path", list2(field2("item", utf82(), true)), false),
2414
2433
  field2("table_name", utf82(), false),
2415
2434
  field2("index_type", utf82(), false),
2416
2435
  field2("constraint_type", dictionary2(utf82(), int162()), false),
@@ -2430,7 +2449,8 @@ var CopyFromFormatInfoSchema = schema2([
2430
2449
  var ScanFunctionResultSchema = schema2([
2431
2450
  field2("function_name", utf82(), false),
2432
2451
  field2("arguments", binary2(), false),
2433
- field2("required_extensions", list2(field2("item", utf82(), true)), false)
2452
+ field2("required_extensions", list2(field2("item", utf82(), true)), false),
2453
+ field2("schema_path", list2(field2("item", utf82(), true)), true)
2434
2454
  ]);
2435
2455
  var ScanBranchesResultSchema = schema2([
2436
2456
  field2("branches", list2(field2("item", binary2(), true)), false),
@@ -2442,11 +2462,12 @@ var ScanBranchSchema = schema2([
2442
2462
  field2("branch_filter", utf82(), true),
2443
2463
  field2("writable", bool2(), false),
2444
2464
  field2("source_catalog", utf82(), true),
2445
- field2("source_schema", utf82(), true),
2465
+ field2("source_schema_path", list2(field2("item", utf82(), true)), true),
2446
2466
  field2("source_table", utf82(), true),
2447
2467
  field2("format_name", utf82(), true),
2448
2468
  field2("format_locations", list2(field2("item", utf82(), true)), true),
2449
- field2("format_options", binary2(), true)
2469
+ field2("format_options", binary2(), true),
2470
+ field2("schema_path", list2(field2("item", utf82(), true)), true)
2450
2471
  ]);
2451
2472
  var ScanSplitSchema = schema2([
2452
2473
  field2("payload", binary2(), false),
@@ -2469,6 +2490,12 @@ var AttachCatalogInfoSchema = schema2([
2469
2490
  field2("required", bool2(), false),
2470
2491
  field2("secret_ref", utf82(), false)
2471
2492
  ]);
2493
+ var ForeignKeyInfoSchema = schema2([
2494
+ field2("fk_columns", list2(field2("item", utf82(), true)), false),
2495
+ field2("pk_columns", list2(field2("item", utf82(), true)), false),
2496
+ field2("referenced_table", utf82(), false),
2497
+ field2("referenced_schema_path", list2(field2("item", utf82(), true)), false)
2498
+ ]);
2472
2499
  var AggregateBindRequestSchema = schema2([
2473
2500
  field2("function_name", utf82(), false),
2474
2501
  field2("arguments", binary2(), false),
@@ -2476,21 +2503,22 @@ var AggregateBindRequestSchema = schema2([
2476
2503
  field2("settings", binary2(), true),
2477
2504
  field2("secrets", binary2(), true),
2478
2505
  field2("attach_opaque_data", binary2(), true),
2479
- field2("schema_name", utf82(), true)
2506
+ field2("schema_path", list2(field2("item", utf82(), true)), true),
2507
+ field2("argument_names", list2(field2("item", utf82(), true)), true)
2480
2508
  ]);
2481
2509
  var AggregateCombineRequestSchema = schema2([
2482
2510
  field2("function_name", utf82(), false),
2483
2511
  field2("execution_id", binary2(), false),
2484
2512
  field2("merge_batch", binary2(), false),
2485
2513
  field2("attach_opaque_data", binary2(), true),
2486
- field2("schema_name", utf82(), true)
2514
+ field2("schema_path", list2(field2("item", utf82(), true)), true)
2487
2515
  ]);
2488
2516
  var AggregateDestructorRequestSchema = schema2([
2489
2517
  field2("function_name", utf82(), false),
2490
2518
  field2("execution_id", binary2(), false),
2491
2519
  field2("group_ids_batch", binary2(), false),
2492
2520
  field2("attach_opaque_data", binary2(), true),
2493
- field2("schema_name", utf82(), true)
2521
+ field2("schema_path", list2(field2("item", utf82(), true)), true)
2494
2522
  ]);
2495
2523
  var AggregateFinalizeRequestSchema = schema2([
2496
2524
  field2("function_name", utf82(), false),
@@ -2498,14 +2526,81 @@ var AggregateFinalizeRequestSchema = schema2([
2498
2526
  field2("group_ids_batch", binary2(), false),
2499
2527
  field2("output_schema", binary2(), false),
2500
2528
  field2("attach_opaque_data", binary2(), true),
2501
- field2("schema_name", utf82(), true)
2529
+ field2("schema_path", list2(field2("item", utf82(), true)), true)
2530
+ ]);
2531
+ var AggregateStreamingChunkRequestSchema = schema2([
2532
+ field2("function_name", utf82(), false),
2533
+ field2("execution_id", binary2(), false),
2534
+ field2("input_batch", binary2(), false),
2535
+ field2("attach_opaque_data", binary2(), true),
2536
+ field2("schema_path", list2(field2("item", utf82(), true)), true)
2537
+ ]);
2538
+ var AggregateStreamingCloseRequestSchema = schema2([
2539
+ field2("function_name", utf82(), false),
2540
+ field2("execution_id", binary2(), false),
2541
+ field2("attach_opaque_data", binary2(), true),
2542
+ field2("schema_path", list2(field2("item", utf82(), true)), true)
2543
+ ]);
2544
+ var AggregateStreamingOpenRequestSchema = schema2([
2545
+ field2("function_name", utf82(), false),
2546
+ field2("arguments", binary2(), false),
2547
+ field2("input_schema", binary2(), false),
2548
+ field2("partition_key_count", int642(), false),
2549
+ field2("order_key_count", int642(), false),
2550
+ field2("output_schema", binary2(), false),
2551
+ field2("settings", binary2(), true),
2552
+ field2("secrets", binary2(), true),
2553
+ field2("attach_opaque_data", binary2(), true),
2554
+ field2("schema_path", list2(field2("item", utf82(), true)), true)
2502
2555
  ]);
2503
2556
  var AggregateUpdateRequestSchema = schema2([
2504
2557
  field2("function_name", utf82(), false),
2505
2558
  field2("execution_id", binary2(), false),
2506
2559
  field2("input_batch", binary2(), false),
2507
2560
  field2("attach_opaque_data", binary2(), true),
2508
- field2("schema_name", utf82(), true)
2561
+ field2("schema_path", list2(field2("item", utf82(), true)), true)
2562
+ ]);
2563
+ var AggregateWindowBatchRequestSchema = schema2([
2564
+ field2("function_name", utf82(), false),
2565
+ field2("execution_id", binary2(), false),
2566
+ field2("partition_id", int642(), false),
2567
+ field2("row_idx", int642(), false),
2568
+ field2("count", int642(), false),
2569
+ field2("frames_per_row", list2(field2("item", int642(), true)), false),
2570
+ field2("frame_starts", list2(field2("item", int642(), true)), false),
2571
+ field2("frame_ends", list2(field2("item", int642(), true)), false),
2572
+ field2("attach_opaque_data", binary2(), true),
2573
+ field2("schema_path", list2(field2("item", utf82(), true)), true)
2574
+ ]);
2575
+ var AggregateWindowDestructorRequestSchema = schema2([
2576
+ field2("function_name", utf82(), false),
2577
+ field2("execution_id", binary2(), false),
2578
+ field2("partition_id", int642(), false),
2579
+ field2("attach_opaque_data", binary2(), true),
2580
+ field2("schema_path", list2(field2("item", utf82(), true)), true)
2581
+ ]);
2582
+ var AggregateWindowInitRequestSchema = schema2([
2583
+ field2("function_name", utf82(), false),
2584
+ field2("execution_id", binary2(), false),
2585
+ field2("partition_id", int642(), false),
2586
+ field2("row_count", int642(), false),
2587
+ field2("partition_batch", binary2(), false),
2588
+ field2("output_schema", binary2(), false),
2589
+ field2("filter_mask", binary2(), false),
2590
+ field2("frame_stats", binary2(), false),
2591
+ field2("all_valid", binary2(), false),
2592
+ field2("attach_opaque_data", binary2(), true),
2593
+ field2("schema_path", list2(field2("item", utf82(), true)), true)
2594
+ ]);
2595
+ var AggregateWindowRequestSchema = schema2([
2596
+ field2("function_name", utf82(), false),
2597
+ field2("execution_id", binary2(), false),
2598
+ field2("partition_id", int642(), false),
2599
+ field2("rid", int642(), false),
2600
+ field2("frame_starts", list2(field2("item", int642(), true)), false),
2601
+ field2("frame_ends", list2(field2("item", int642(), true)), false),
2602
+ field2("attach_opaque_data", binary2(), true),
2603
+ field2("schema_path", list2(field2("item", utf82(), true)), true)
2509
2604
  ]);
2510
2605
  var BindRequestSchema = schema2([
2511
2606
  field2("function_name", utf82(), false),
@@ -2521,7 +2616,8 @@ var BindRequestSchema = schema2([
2521
2616
  field2("at_value", utf82(), true),
2522
2617
  field2("copy_from", struct2([field2("format", utf82(), false), field2("file_path", utf82(), false), field2("expected_schema", binary2(), false)]), true),
2523
2618
  field2("copy_to", struct2([field2("format", utf82(), false), field2("file_path", utf82(), false)]), true),
2524
- field2("schema_name", utf82(), true)
2619
+ field2("schema_path", list2(field2("item", utf82(), true)), true),
2620
+ field2("argument_names", list2(field2("item", utf82(), true)), true)
2525
2621
  ]);
2526
2622
  var CatalogAttachRequestSchema = schema2([
2527
2623
  field2("name", utf82(), false),
@@ -2530,6 +2626,18 @@ var CatalogAttachRequestSchema = schema2([
2530
2626
  field2("implementation_version", utf82(), true),
2531
2627
  field2("client_capabilities", binary2(), true)
2532
2628
  ]);
2629
+ var CatalogCreateRequestSchema = schema2([
2630
+ field2("name", utf82(), false),
2631
+ field2("on_conflict", dictionary2(utf82(), int162()), false),
2632
+ field2("options", binary2(), true)
2633
+ ]);
2634
+ var ClientCapabilitiesSchema = schema2([
2635
+ field2("engine", utf82(), false),
2636
+ field2("native_formats", list2(field2("item", utf82(), true)), false),
2637
+ field2("catalogs", list2(field2("item", utf82(), true)), false),
2638
+ field2("can_stream", bool2(), false),
2639
+ field2("filter_encodings", list2(field2("item", utf82(), true)), false)
2640
+ ]);
2533
2641
  var CopyFromContextSchema = schema2([
2534
2642
  field2("format", utf82(), false),
2535
2643
  field2("file_path", utf82(), false),
@@ -2544,6 +2652,18 @@ var GlobalInitResponseSchema = schema2([
2544
2652
  field2("opaque_data", binary2(), true),
2545
2653
  field2("max_workers", int642(), false)
2546
2654
  ]);
2655
+ var IndexCreateRequestSchema = schema2([
2656
+ field2("attach_opaque_data", binary2(), false),
2657
+ field2("schema_path", list2(field2("item", utf82(), true)), false),
2658
+ field2("name", utf82(), false),
2659
+ field2("table_name", utf82(), false),
2660
+ field2("index_type", utf82(), false),
2661
+ field2("constraint_type", dictionary2(utf82(), int162()), false),
2662
+ field2("expressions", list2(field2("item", utf82(), true)), false),
2663
+ field2("on_conflict", dictionary2(utf82(), int162()), false),
2664
+ field2("options", map2(field2("key", utf82(), false), field2("value", utf82(), true), false), false),
2665
+ field2("transaction_opaque_data", binary2(), true)
2666
+ ]);
2547
2667
  var InitRequestSchema = schema2([
2548
2668
  field2("bind_call", binary2(), false),
2549
2669
  field2("output_schema", binary2(), false),
@@ -2565,20 +2685,45 @@ var InitRequestSchema = schema2([
2565
2685
  field2("tablesample_percentage", float642(), true),
2566
2686
  field2("tablesample_seed", int642(), true)
2567
2687
  ]);
2688
+ var MacroCreateRequestSchema = schema2([
2689
+ field2("attach_opaque_data", binary2(), false),
2690
+ field2("schema_path", list2(field2("item", utf82(), true)), false),
2691
+ field2("name", utf82(), false),
2692
+ field2("macro_type", dictionary2(utf82(), int162()), false),
2693
+ field2("parameters", list2(field2("item", utf82(), true)), false),
2694
+ field2("definition", utf82(), false),
2695
+ field2("on_conflict", dictionary2(utf82(), int162()), false),
2696
+ field2("parameter_default_values", binary2(), true),
2697
+ field2("arguments_schema", binary2(), true),
2698
+ field2("transaction_opaque_data", binary2(), true)
2699
+ ]);
2700
+ var TableCreateRequestSchema = schema2([
2701
+ field2("attach_opaque_data", binary2(), false),
2702
+ field2("schema_path", list2(field2("item", utf82(), true)), false),
2703
+ field2("name", utf82(), false),
2704
+ field2("columns", binary2(), false),
2705
+ field2("on_conflict", dictionary2(utf82(), int162()), false),
2706
+ field2("not_null_constraints", list2(field2("item", int322(), true)), false),
2707
+ field2("unique_constraints", list2(field2("item", list2(field2("item", int322(), true)), true)), false),
2708
+ field2("check_constraints", list2(field2("item", utf82(), true)), false),
2709
+ field2("primary_key_constraints", list2(field2("item", list2(field2("item", int322(), true)), true)), false),
2710
+ field2("foreign_key_constraints", list2(field2("item", binary2(), true)), false),
2711
+ field2("transaction_opaque_data", binary2(), true)
2712
+ ]);
2568
2713
  var TableBufferingCombineRequestSchema = schema2([
2569
2714
  field2("function_name", utf82(), false),
2570
2715
  field2("execution_id", binary2(), false),
2571
2716
  field2("state_ids", list2(field2("item", binary2(), true)), false),
2572
2717
  field2("attach_opaque_data", binary2(), true),
2573
2718
  field2("transaction_id", binary2(), true),
2574
- field2("schema_name", utf82(), true)
2719
+ field2("schema_path", list2(field2("item", utf82(), true)), true)
2575
2720
  ]);
2576
2721
  var TableBufferingDestructorRequestSchema = schema2([
2577
2722
  field2("function_name", utf82(), false),
2578
2723
  field2("execution_id", binary2(), false),
2579
2724
  field2("attach_opaque_data", binary2(), true),
2580
2725
  field2("transaction_id", binary2(), true),
2581
- field2("schema_name", utf82(), true)
2726
+ field2("schema_path", list2(field2("item", utf82(), true)), true)
2582
2727
  ]);
2583
2728
  var TableBufferingProcessRequestSchema = schema2([
2584
2729
  field2("function_name", utf82(), false),
@@ -2587,12 +2732,17 @@ var TableBufferingProcessRequestSchema = schema2([
2587
2732
  field2("attach_opaque_data", binary2(), true),
2588
2733
  field2("transaction_id", binary2(), true),
2589
2734
  field2("batch_index", int642(), true),
2590
- field2("schema_name", utf82(), true)
2735
+ field2("schema_path", list2(field2("item", utf82(), true)), true)
2591
2736
  ]);
2592
2737
  var TableFunctionCardinalityRequestSchema = schema2([
2593
2738
  field2("bind_call", binary2(), false),
2594
2739
  field2("bind_opaque_data", binary2(), true)
2595
2740
  ]);
2741
+ var TableFunctionDynamicToStringRequestSchema = schema2([
2742
+ field2("bind_call", binary2(), false),
2743
+ field2("bind_opaque_data", binary2(), true),
2744
+ field2("global_execution_id", binary2(), false)
2745
+ ]);
2596
2746
  var TableFunctionPlanRequestSchema = schema2([
2597
2747
  field2("bind_call", binary2(), false),
2598
2748
  field2("bind_opaque_data", binary2(), true),
@@ -2615,6 +2765,10 @@ var TableFunctionPlanRequestSchema = schema2([
2615
2765
  field2("tablesample_percentage", float642(), true),
2616
2766
  field2("tablesample_seed", int642(), true)
2617
2767
  ]);
2768
+ var TableFunctionStatisticsRequestSchema = schema2([
2769
+ field2("bind_call", binary2(), false),
2770
+ field2("bind_opaque_data", binary2(), true)
2771
+ ]);
2618
2772
  var AggregateBindResultSchema = schema2([
2619
2773
  field2("output_schema", binary2(), false),
2620
2774
  field2("execution_id", binary2(), false)
@@ -2805,7 +2959,7 @@ var CatalogIndexCreateParamsSchema = schema2([
2805
2959
  ]);
2806
2960
  var CatalogIndexDropParamsSchema = schema2([
2807
2961
  field2("attach_opaque_data", binary2(), false),
2808
- field2("schema_name", utf82(), false),
2962
+ field2("schema_path", list2(field2("item", utf82(), true)), false),
2809
2963
  field2("name", utf82(), false),
2810
2964
  field2("ignore_not_found", bool2(), false),
2811
2965
  field2("cascade", bool2(), false),
@@ -2813,7 +2967,7 @@ var CatalogIndexDropParamsSchema = schema2([
2813
2967
  ]);
2814
2968
  var CatalogIndexGetParamsSchema = schema2([
2815
2969
  field2("attach_opaque_data", binary2(), false),
2816
- field2("schema_name", utf82(), false),
2970
+ field2("schema_path", list2(field2("item", utf82(), true)), false),
2817
2971
  field2("name", utf82(), false),
2818
2972
  field2("transaction_opaque_data", binary2(), true)
2819
2973
  ]);
@@ -2822,47 +2976,47 @@ var CatalogMacroCreateParamsSchema = schema2([
2822
2976
  ]);
2823
2977
  var CatalogMacroDropParamsSchema = schema2([
2824
2978
  field2("attach_opaque_data", binary2(), false),
2825
- field2("schema_name", utf82(), false),
2979
+ field2("schema_path", list2(field2("item", utf82(), true)), false),
2826
2980
  field2("name", utf82(), false),
2827
2981
  field2("ignore_not_found", bool2(), false),
2828
2982
  field2("transaction_opaque_data", binary2(), true)
2829
2983
  ]);
2830
2984
  var CatalogMacroGetParamsSchema = schema2([
2831
2985
  field2("attach_opaque_data", binary2(), false),
2832
- field2("schema_name", utf82(), false),
2986
+ field2("schema_path", list2(field2("item", utf82(), true)), false),
2833
2987
  field2("name", utf82(), false),
2834
2988
  field2("transaction_opaque_data", binary2(), true)
2835
2989
  ]);
2836
2990
  var CatalogSchemaContentsFunctionsParamsSchema = schema2([
2837
2991
  field2("attach_opaque_data", binary2(), false),
2838
- field2("name", utf82(), false),
2992
+ field2("path", list2(field2("item", utf82(), true)), false),
2839
2993
  field2("type", dictionary2(utf82(), int162()), false),
2840
2994
  field2("transaction_opaque_data", binary2(), true)
2841
2995
  ]);
2842
2996
  var CatalogSchemaContentsIndexesParamsSchema = schema2([
2843
2997
  field2("attach_opaque_data", binary2(), false),
2844
- field2("name", utf82(), false),
2998
+ field2("path", list2(field2("item", utf82(), true)), false),
2845
2999
  field2("transaction_opaque_data", binary2(), true)
2846
3000
  ]);
2847
3001
  var CatalogSchemaContentsMacrosParamsSchema = schema2([
2848
3002
  field2("attach_opaque_data", binary2(), false),
2849
- field2("name", utf82(), false),
3003
+ field2("path", list2(field2("item", utf82(), true)), false),
2850
3004
  field2("type", dictionary2(utf82(), int162()), false),
2851
3005
  field2("transaction_opaque_data", binary2(), true)
2852
3006
  ]);
2853
3007
  var CatalogSchemaContentsTablesParamsSchema = schema2([
2854
3008
  field2("attach_opaque_data", binary2(), false),
2855
- field2("name", utf82(), false),
3009
+ field2("path", list2(field2("item", utf82(), true)), false),
2856
3010
  field2("transaction_opaque_data", binary2(), true)
2857
3011
  ]);
2858
3012
  var CatalogSchemaContentsViewsParamsSchema = schema2([
2859
3013
  field2("attach_opaque_data", binary2(), false),
2860
- field2("name", utf82(), false),
3014
+ field2("path", list2(field2("item", utf82(), true)), false),
2861
3015
  field2("transaction_opaque_data", binary2(), true)
2862
3016
  ]);
2863
3017
  var CatalogSchemaCreateParamsSchema = schema2([
2864
3018
  field2("attach_opaque_data", binary2(), false),
2865
- field2("name", utf82(), false),
3019
+ field2("path", list2(field2("item", utf82(), true)), false),
2866
3020
  field2("on_conflict", dictionary2(utf82(), int162()), false),
2867
3021
  field2("comment", utf82(), true),
2868
3022
  field2("tags", map2(field2("key", utf82(), false), field2("value", utf82(), true), false), true),
@@ -2870,14 +3024,14 @@ var CatalogSchemaCreateParamsSchema = schema2([
2870
3024
  ]);
2871
3025
  var CatalogSchemaDropParamsSchema = schema2([
2872
3026
  field2("attach_opaque_data", binary2(), false),
2873
- field2("name", utf82(), false),
3027
+ field2("path", list2(field2("item", utf82(), true)), false),
2874
3028
  field2("ignore_not_found", bool2(), false),
2875
3029
  field2("cascade", bool2(), false),
2876
3030
  field2("transaction_opaque_data", binary2(), true)
2877
3031
  ]);
2878
3032
  var CatalogSchemaGetParamsSchema = schema2([
2879
3033
  field2("attach_opaque_data", binary2(), false),
2880
- field2("name", utf82(), false),
3034
+ field2("path", list2(field2("item", utf82(), true)), false),
2881
3035
  field2("transaction_opaque_data", binary2(), true)
2882
3036
  ]);
2883
3037
  var CatalogSchemasParamsSchema = schema2([
@@ -2886,7 +3040,7 @@ var CatalogSchemasParamsSchema = schema2([
2886
3040
  ]);
2887
3041
  var CatalogTableColumnAddParamsSchema = schema2([
2888
3042
  field2("attach_opaque_data", binary2(), false),
2889
- field2("schema_name", utf82(), false),
3043
+ field2("schema_path", list2(field2("item", utf82(), true)), false),
2890
3044
  field2("name", utf82(), false),
2891
3045
  field2("column_definition", binary2(), false),
2892
3046
  field2("ignore_not_found", bool2(), false),
@@ -2895,7 +3049,7 @@ var CatalogTableColumnAddParamsSchema = schema2([
2895
3049
  ]);
2896
3050
  var CatalogTableColumnCommentSetParamsSchema = schema2([
2897
3051
  field2("attach_opaque_data", binary2(), false),
2898
- field2("schema_name", utf82(), false),
3052
+ field2("schema_path", list2(field2("item", utf82(), true)), false),
2899
3053
  field2("name", utf82(), false),
2900
3054
  field2("column_name", utf82(), false),
2901
3055
  field2("comment", utf82(), true),
@@ -2904,7 +3058,7 @@ var CatalogTableColumnCommentSetParamsSchema = schema2([
2904
3058
  ]);
2905
3059
  var CatalogTableColumnDefaultDropParamsSchema = schema2([
2906
3060
  field2("attach_opaque_data", binary2(), false),
2907
- field2("schema_name", utf82(), false),
3061
+ field2("schema_path", list2(field2("item", utf82(), true)), false),
2908
3062
  field2("name", utf82(), false),
2909
3063
  field2("column_name", utf82(), false),
2910
3064
  field2("ignore_not_found", bool2(), false),
@@ -2912,7 +3066,7 @@ var CatalogTableColumnDefaultDropParamsSchema = schema2([
2912
3066
  ]);
2913
3067
  var CatalogTableColumnDefaultSetParamsSchema = schema2([
2914
3068
  field2("attach_opaque_data", binary2(), false),
2915
- field2("schema_name", utf82(), false),
3069
+ field2("schema_path", list2(field2("item", utf82(), true)), false),
2916
3070
  field2("name", utf82(), false),
2917
3071
  field2("column_name", utf82(), false),
2918
3072
  field2("expression", utf82(), false),
@@ -2921,7 +3075,7 @@ var CatalogTableColumnDefaultSetParamsSchema = schema2([
2921
3075
  ]);
2922
3076
  var CatalogTableColumnDropParamsSchema = schema2([
2923
3077
  field2("attach_opaque_data", binary2(), false),
2924
- field2("schema_name", utf82(), false),
3078
+ field2("schema_path", list2(field2("item", utf82(), true)), false),
2925
3079
  field2("name", utf82(), false),
2926
3080
  field2("column_name", utf82(), false),
2927
3081
  field2("ignore_not_found", bool2(), false),
@@ -2931,7 +3085,7 @@ var CatalogTableColumnDropParamsSchema = schema2([
2931
3085
  ]);
2932
3086
  var CatalogTableColumnRenameParamsSchema = schema2([
2933
3087
  field2("attach_opaque_data", binary2(), false),
2934
- field2("schema_name", utf82(), false),
3088
+ field2("schema_path", list2(field2("item", utf82(), true)), false),
2935
3089
  field2("name", utf82(), false),
2936
3090
  field2("column_name", utf82(), false),
2937
3091
  field2("new_column_name", utf82(), false),
@@ -2940,13 +3094,13 @@ var CatalogTableColumnRenameParamsSchema = schema2([
2940
3094
  ]);
2941
3095
  var CatalogTableColumnStatisticsGetParamsSchema = schema2([
2942
3096
  field2("attach_opaque_data", binary2(), false),
2943
- field2("schema_name", utf82(), false),
3097
+ field2("schema_path", list2(field2("item", utf82(), true)), false),
2944
3098
  field2("name", utf82(), false),
2945
3099
  field2("transaction_opaque_data", binary2(), true)
2946
3100
  ]);
2947
3101
  var CatalogTableColumnTypeChangeParamsSchema = schema2([
2948
3102
  field2("attach_opaque_data", binary2(), false),
2949
- field2("schema_name", utf82(), false),
3103
+ field2("schema_path", list2(field2("item", utf82(), true)), false),
2950
3104
  field2("name", utf82(), false),
2951
3105
  field2("column_definition", binary2(), false),
2952
3106
  field2("expression", utf82(), true),
@@ -2955,7 +3109,7 @@ var CatalogTableColumnTypeChangeParamsSchema = schema2([
2955
3109
  ]);
2956
3110
  var CatalogTableCommentSetParamsSchema = schema2([
2957
3111
  field2("attach_opaque_data", binary2(), false),
2958
- field2("schema_name", utf82(), false),
3112
+ field2("schema_path", list2(field2("item", utf82(), true)), false),
2959
3113
  field2("name", utf82(), false),
2960
3114
  field2("comment", utf82(), true),
2961
3115
  field2("ignore_not_found", bool2(), false),
@@ -2966,13 +3120,13 @@ var CatalogTableCreateParamsSchema = schema2([
2966
3120
  ]);
2967
3121
  var CatalogTableDeleteFunctionGetParamsSchema = schema2([
2968
3122
  field2("attach_opaque_data", binary2(), false),
2969
- field2("schema_name", utf82(), false),
3123
+ field2("schema_path", list2(field2("item", utf82(), true)), false),
2970
3124
  field2("name", utf82(), false),
2971
3125
  field2("transaction_opaque_data", binary2(), true)
2972
3126
  ]);
2973
3127
  var CatalogTableDropParamsSchema = schema2([
2974
3128
  field2("attach_opaque_data", binary2(), false),
2975
- field2("schema_name", utf82(), false),
3129
+ field2("schema_path", list2(field2("item", utf82(), true)), false),
2976
3130
  field2("name", utf82(), false),
2977
3131
  field2("ignore_not_found", bool2(), false),
2978
3132
  field2("cascade", bool2(), false),
@@ -2980,7 +3134,7 @@ var CatalogTableDropParamsSchema = schema2([
2980
3134
  ]);
2981
3135
  var CatalogTableGetParamsSchema = schema2([
2982
3136
  field2("attach_opaque_data", binary2(), false),
2983
- field2("schema_name", utf82(), false),
3137
+ field2("schema_path", list2(field2("item", utf82(), true)), false),
2984
3138
  field2("name", utf82(), false),
2985
3139
  field2("at_unit", utf82(), true),
2986
3140
  field2("at_value", utf82(), true),
@@ -2988,14 +3142,14 @@ var CatalogTableGetParamsSchema = schema2([
2988
3142
  ]);
2989
3143
  var CatalogTableInsertFunctionGetParamsSchema = schema2([
2990
3144
  field2("attach_opaque_data", binary2(), false),
2991
- field2("schema_name", utf82(), false),
3145
+ field2("schema_path", list2(field2("item", utf82(), true)), false),
2992
3146
  field2("name", utf82(), false),
2993
3147
  field2("transaction_opaque_data", binary2(), true),
2994
3148
  field2("writable_branch_function_name", utf82(), true)
2995
3149
  ]);
2996
3150
  var CatalogTableNotNullDropParamsSchema = schema2([
2997
3151
  field2("attach_opaque_data", binary2(), false),
2998
- field2("schema_name", utf82(), false),
3152
+ field2("schema_path", list2(field2("item", utf82(), true)), false),
2999
3153
  field2("name", utf82(), false),
3000
3154
  field2("column_name", utf82(), false),
3001
3155
  field2("ignore_not_found", bool2(), false),
@@ -3003,7 +3157,7 @@ var CatalogTableNotNullDropParamsSchema = schema2([
3003
3157
  ]);
3004
3158
  var CatalogTableNotNullSetParamsSchema = schema2([
3005
3159
  field2("attach_opaque_data", binary2(), false),
3006
- field2("schema_name", utf82(), false),
3160
+ field2("schema_path", list2(field2("item", utf82(), true)), false),
3007
3161
  field2("name", utf82(), false),
3008
3162
  field2("column_name", utf82(), false),
3009
3163
  field2("ignore_not_found", bool2(), false),
@@ -3011,7 +3165,7 @@ var CatalogTableNotNullSetParamsSchema = schema2([
3011
3165
  ]);
3012
3166
  var CatalogTableRenameParamsSchema = schema2([
3013
3167
  field2("attach_opaque_data", binary2(), false),
3014
- field2("schema_name", utf82(), false),
3168
+ field2("schema_path", list2(field2("item", utf82(), true)), false),
3015
3169
  field2("name", utf82(), false),
3016
3170
  field2("new_name", utf82(), false),
3017
3171
  field2("ignore_not_found", bool2(), false),
@@ -3019,7 +3173,7 @@ var CatalogTableRenameParamsSchema = schema2([
3019
3173
  ]);
3020
3174
  var CatalogTableScanBranchesGetParamsSchema = schema2([
3021
3175
  field2("attach_opaque_data", binary2(), false),
3022
- field2("schema_name", utf82(), false),
3176
+ field2("schema_path", list2(field2("item", utf82(), true)), false),
3023
3177
  field2("name", utf82(), false),
3024
3178
  field2("at_unit", utf82(), true),
3025
3179
  field2("at_value", utf82(), true),
@@ -3027,7 +3181,7 @@ var CatalogTableScanBranchesGetParamsSchema = schema2([
3027
3181
  ]);
3028
3182
  var CatalogTableScanFunctionGetParamsSchema = schema2([
3029
3183
  field2("attach_opaque_data", binary2(), false),
3030
- field2("schema_name", utf82(), false),
3184
+ field2("schema_path", list2(field2("item", utf82(), true)), false),
3031
3185
  field2("name", utf82(), false),
3032
3186
  field2("at_unit", utf82(), true),
3033
3187
  field2("at_value", utf82(), true),
@@ -3035,7 +3189,7 @@ var CatalogTableScanFunctionGetParamsSchema = schema2([
3035
3189
  ]);
3036
3190
  var CatalogTableUpdateFunctionGetParamsSchema = schema2([
3037
3191
  field2("attach_opaque_data", binary2(), false),
3038
- field2("schema_name", utf82(), false),
3192
+ field2("schema_path", list2(field2("item", utf82(), true)), false),
3039
3193
  field2("name", utf82(), false),
3040
3194
  field2("transaction_opaque_data", binary2(), true)
3041
3195
  ]);
@@ -3056,7 +3210,7 @@ var CatalogVersionParamsSchema = schema2([
3056
3210
  ]);
3057
3211
  var CatalogViewCommentSetParamsSchema = schema2([
3058
3212
  field2("attach_opaque_data", binary2(), false),
3059
- field2("schema_name", utf82(), false),
3213
+ field2("schema_path", list2(field2("item", utf82(), true)), false),
3060
3214
  field2("name", utf82(), false),
3061
3215
  field2("comment", utf82(), true),
3062
3216
  field2("ignore_not_found", bool2(), false),
@@ -3064,7 +3218,7 @@ var CatalogViewCommentSetParamsSchema = schema2([
3064
3218
  ]);
3065
3219
  var CatalogViewCreateParamsSchema = schema2([
3066
3220
  field2("attach_opaque_data", binary2(), false),
3067
- field2("schema_name", utf82(), false),
3221
+ field2("schema_path", list2(field2("item", utf82(), true)), false),
3068
3222
  field2("name", utf82(), false),
3069
3223
  field2("definition", utf82(), false),
3070
3224
  field2("on_conflict", dictionary2(utf82(), int162()), false),
@@ -3072,7 +3226,7 @@ var CatalogViewCreateParamsSchema = schema2([
3072
3226
  ]);
3073
3227
  var CatalogViewDropParamsSchema = schema2([
3074
3228
  field2("attach_opaque_data", binary2(), false),
3075
- field2("schema_name", utf82(), false),
3229
+ field2("schema_path", list2(field2("item", utf82(), true)), false),
3076
3230
  field2("name", utf82(), false),
3077
3231
  field2("ignore_not_found", bool2(), false),
3078
3232
  field2("cascade", bool2(), false),
@@ -3080,13 +3234,13 @@ var CatalogViewDropParamsSchema = schema2([
3080
3234
  ]);
3081
3235
  var CatalogViewGetParamsSchema = schema2([
3082
3236
  field2("attach_opaque_data", binary2(), false),
3083
- field2("schema_name", utf82(), false),
3237
+ field2("schema_path", list2(field2("item", utf82(), true)), false),
3084
3238
  field2("name", utf82(), false),
3085
3239
  field2("transaction_opaque_data", binary2(), true)
3086
3240
  ]);
3087
3241
  var CatalogViewRenameParamsSchema = schema2([
3088
3242
  field2("attach_opaque_data", binary2(), false),
3089
- field2("schema_name", utf82(), false),
3243
+ field2("schema_path", list2(field2("item", utf82(), true)), false),
3090
3244
  field2("name", utf82(), false),
3091
3245
  field2("new_name", utf82(), false),
3092
3246
  field2("ignore_not_found", bool2(), false),
@@ -3136,16 +3290,16 @@ function decodeScanFunctionResult(inner) {
3136
3290
  const namedArguments = {};
3137
3291
  if (argsBytes != null) {
3138
3292
  const batch = deserializeBatch(toUint8Array(argsBytes));
3139
- for (const field3 of batch.schema.fields) {
3140
- const col = batch.getChild(field3.name);
3293
+ for (const field of batch.schema.fields) {
3294
+ const col = batch.getChild(field.name);
3141
3295
  const value = col ? col.get(0) : null;
3142
- if (field3.name.startsWith("arg_")) {
3143
- const idx = parseInt(field3.name.slice(4), 10);
3296
+ if (field.name.startsWith("arg_")) {
3297
+ const idx = parseInt(field.name.slice(4), 10);
3144
3298
  while (positionalArguments.length <= idx)
3145
3299
  positionalArguments.push(null);
3146
3300
  positionalArguments[idx] = value;
3147
3301
  } else {
3148
- namedArguments[field3.name] = value;
3302
+ namedArguments[field.name] = value;
3149
3303
  }
3150
3304
  }
3151
3305
  }
@@ -3155,7 +3309,8 @@ function decodeScanFunctionResult(inner) {
3155
3309
  functionName: String(inner.function_name ?? ""),
3156
3310
  positionalArguments,
3157
3311
  namedArguments,
3158
- requiredExtensions
3312
+ requiredExtensions,
3313
+ schemaPath: inner.schema_path == null ? null : (Array.isArray(inner.schema_path) ? inner.schema_path : [...inner.schema_path]).filter((value) => value != null).map(String)
3159
3314
  };
3160
3315
  }
3161
3316
 
@@ -3202,8 +3357,8 @@ function serializeAttachOptions(options) {
3202
3357
  fields.push(field2(key, type, true));
3203
3358
  columns[key] = [value];
3204
3359
  }
3205
- const schema3 = schema2(fields);
3206
- const batch = batchFromColumns(columns, schema3);
3360
+ const schema = schema2(fields);
3361
+ const batch = batchFromColumns(columns, schema);
3207
3362
  return serializeBatch(batch);
3208
3363
  }
3209
3364
 
@@ -3303,6 +3458,19 @@ class VgiClient {
3303
3458
  this.rpc = wrapRpcWithErrorEnrichment(rpc);
3304
3459
  this.defaultAttachOpaqueData = options?.attachOpaqueData ?? null;
3305
3460
  }
3461
+ static async fromIroh(endpoint, options = {}, clientOptions, connector) {
3462
+ if (!/^(iroh|httpi):\/\//.test(endpoint)) {
3463
+ throw new TypeError("VgiClient.fromIroh requires an iroh:// or httpi:// endpoint");
3464
+ }
3465
+ let selected = connector;
3466
+ if (!selected) {
3467
+ const rpc = await import("@query-farm/vgi-rpc");
3468
+ selected = endpoint.startsWith("iroh://") ? rpc.irohConnect : rpc.httpiConnect;
3469
+ }
3470
+ if (!selected)
3471
+ throw new TypeError("no Iroh connector is available in this runtime");
3472
+ return new VgiClient(await selected(endpoint, options), clientOptions);
3473
+ }
3306
3474
  async _doBind(functionName, functionType, args, inputSchema, settings, secrets, transactionOpaqueData, attachOpaqueData = null, onBind) {
3307
3475
  const request = {
3308
3476
  function_name: functionName,
@@ -3382,7 +3550,7 @@ class VgiClient {
3382
3550
  const inputIter = toAsyncIterator(opts.input);
3383
3551
  const first = await inputIter.next();
3384
3552
  if (first.done) {
3385
- throw new VgiClientError(`scalarFunction(${opts.functionName}): input iterator yielded no batches; ` + `at least one batch is required to determine the input schema`);
3553
+ throw new VgiClientError(`scalarFunction(${opts.functionName}): input iterator yielded no batches; at least one batch is required to determine the input schema`);
3386
3554
  }
3387
3555
  const firstBatch = first.value;
3388
3556
  const inputSchema = firstBatch.schema;
@@ -3406,7 +3574,7 @@ class VgiClient {
3406
3574
  const inputIter = toAsyncIterator(opts.input);
3407
3575
  const first = await inputIter.next();
3408
3576
  if (first.done) {
3409
- throw new VgiClientError(`scalarFunction(${opts.functionName}): input iterator yielded no batches; ` + `at least one batch is required to determine the input schema`);
3577
+ throw new VgiClientError(`scalarFunction(${opts.functionName}): input iterator yielded no batches; at least one batch is required to determine the input schema`);
3410
3578
  }
3411
3579
  const firstBatch = first.value;
3412
3580
  const inputSchema = firstBatch.schema;
@@ -3431,7 +3599,7 @@ class VgiClient {
3431
3599
  const inputIter = toAsyncIterator(opts.input);
3432
3600
  const first = await inputIter.next();
3433
3601
  if (first.done) {
3434
- throw new VgiClientError(`tableInOutFunction(${opts.functionName}): input iterator yielded no batches; ` + `at least one batch is required to determine the input schema`);
3602
+ throw new VgiClientError(`tableInOutFunction(${opts.functionName}): input iterator yielded no batches; at least one batch is required to determine the input schema`);
3435
3603
  }
3436
3604
  const firstBatch = first.value;
3437
3605
  const inputSchema = firstBatch.schema;
@@ -3479,7 +3647,7 @@ class VgiClient {
3479
3647
  const inputIter = toAsyncIterator(opts.input);
3480
3648
  const first = await inputIter.next();
3481
3649
  if (first.done) {
3482
- throw new VgiClientError(`tableInOutFunction(${opts.functionName}): input iterator yielded no batches; ` + `at least one batch is required to determine the input schema`);
3650
+ throw new VgiClientError(`tableInOutFunction(${opts.functionName}): input iterator yielded no batches; at least one batch is required to determine the input schema`);
3483
3651
  }
3484
3652
  const firstBatch = first.value;
3485
3653
  const inputSchema = firstBatch.schema;
@@ -3564,18 +3732,20 @@ class VgiClient {
3564
3732
  } else {
3565
3733
  wireOptions = serializeAttachOptions(opts?.options);
3566
3734
  }
3567
- const schema3 = schema2([
3735
+ const schema = schema2([
3568
3736
  field2("name", utf82(), false),
3569
3737
  field2("options", binary2(), true),
3570
3738
  field2("data_version_spec", utf82(), true),
3571
- field2("implementation_version", utf82(), true)
3739
+ field2("implementation_version", utf82(), true),
3740
+ field2("client_capabilities", binary2(), true)
3572
3741
  ]);
3573
3742
  const innerBatch = batchFromColumns({
3574
3743
  name: [name],
3575
3744
  options: [wireOptions],
3576
3745
  data_version_spec: [opts?.dataVersionSpec ?? null],
3577
- implementation_version: [opts?.implementationVersion ?? null]
3578
- }, schema3);
3746
+ implementation_version: [opts?.implementationVersion ?? null],
3747
+ client_capabilities: [opts?.clientCapabilities ? encodeASD(ClientCapabilitiesSchema, opts.clientCapabilities) : null]
3748
+ }, schema);
3579
3749
  const result = await this.rpc.call("catalog_attach", wrapRequest(innerBatch));
3580
3750
  if (!result)
3581
3751
  throw new VgiClientError("catalog_attach returned null");
@@ -3672,10 +3842,10 @@ class VgiClient {
3672
3842
  const inner = unwrapResult(result);
3673
3843
  return deserializeInfoList(inner.items, decodeSchemaInfo);
3674
3844
  }
3675
- async schemaGet(attachOpaqueData, name, transactionOpaqueData) {
3845
+ async schemaGet(attachOpaqueData, path, transactionOpaqueData) {
3676
3846
  const result = await this.rpc.call("catalog_schema_get", {
3677
3847
  attach_opaque_data: attachOpaqueData,
3678
- name,
3848
+ path: normalizeSchemaPath(path),
3679
3849
  transaction_opaque_data: transactionOpaqueData ?? null
3680
3850
  });
3681
3851
  if (!result)
@@ -3684,30 +3854,30 @@ class VgiClient {
3684
3854
  const items = deserializeInfoList(inner.items, decodeSchemaInfo);
3685
3855
  return items.length > 0 ? items[0] : null;
3686
3856
  }
3687
- async schemaCreate(attachOpaqueData, name, opts) {
3857
+ async schemaCreate(attachOpaqueData, path, opts) {
3688
3858
  const tagsMap = opts?.tags ? new Map(Object.entries(opts.tags)) : null;
3689
3859
  await this.rpc.call("catalog_schema_create", {
3690
3860
  attach_opaque_data: attachOpaqueData,
3691
- name,
3861
+ path: normalizeSchemaPath(path),
3692
3862
  on_conflict: opts?.onConflict ?? "error",
3693
3863
  comment: opts?.comment ?? null,
3694
3864
  tags: tagsMap,
3695
3865
  transaction_opaque_data: opts?.transactionOpaqueData ?? null
3696
3866
  });
3697
3867
  }
3698
- async schemaDrop(attachOpaqueData, name, ignoreNotFound, cascade, transactionOpaqueData) {
3868
+ async schemaDrop(attachOpaqueData, path, ignoreNotFound, cascade, transactionOpaqueData) {
3699
3869
  await this.rpc.call("catalog_schema_drop", {
3700
3870
  attach_opaque_data: attachOpaqueData,
3701
- name,
3871
+ path: normalizeSchemaPath(path),
3702
3872
  ignore_not_found: ignoreNotFound ?? false,
3703
3873
  cascade: cascade ?? false,
3704
3874
  transaction_opaque_data: transactionOpaqueData ?? null
3705
3875
  });
3706
3876
  }
3707
- async schemaContentsTables(attachOpaqueData, name, transactionOpaqueData) {
3877
+ async schemaContentsTables(attachOpaqueData, path, transactionOpaqueData) {
3708
3878
  const result = await this.rpc.call("catalog_schema_contents_tables", {
3709
3879
  attach_opaque_data: attachOpaqueData,
3710
- name,
3880
+ path: normalizeSchemaPath(path),
3711
3881
  transaction_opaque_data: transactionOpaqueData ?? null
3712
3882
  });
3713
3883
  if (!result)
@@ -3715,10 +3885,10 @@ class VgiClient {
3715
3885
  const inner = unwrapResult(result);
3716
3886
  return deserializeInfoList(inner.items, decodeTableInfo);
3717
3887
  }
3718
- async schemaContentsViews(attachOpaqueData, name, transactionOpaqueData) {
3888
+ async schemaContentsViews(attachOpaqueData, path, transactionOpaqueData) {
3719
3889
  const result = await this.rpc.call("catalog_schema_contents_views", {
3720
3890
  attach_opaque_data: attachOpaqueData,
3721
- name,
3891
+ path: normalizeSchemaPath(path),
3722
3892
  transaction_opaque_data: transactionOpaqueData ?? null
3723
3893
  });
3724
3894
  if (!result)
@@ -3726,10 +3896,10 @@ class VgiClient {
3726
3896
  const inner = unwrapResult(result);
3727
3897
  return deserializeInfoList(inner.items, decodeViewInfo);
3728
3898
  }
3729
- async schemaContentsFunctions(attachOpaqueData, name, type, transactionOpaqueData) {
3899
+ async schemaContentsFunctions(attachOpaqueData, path, type, transactionOpaqueData) {
3730
3900
  const result = await this.rpc.call("catalog_schema_contents_functions", {
3731
3901
  attach_opaque_data: attachOpaqueData,
3732
- name,
3902
+ path: normalizeSchemaPath(path),
3733
3903
  type,
3734
3904
  transaction_opaque_data: transactionOpaqueData ?? null
3735
3905
  });
@@ -3738,10 +3908,10 @@ class VgiClient {
3738
3908
  const inner = unwrapResult(result);
3739
3909
  return deserializeInfoList(inner.items, decodeFunctionInfo);
3740
3910
  }
3741
- async tableGet(attachOpaqueData, schemaName, name, transactionOpaqueData) {
3911
+ async tableGet(attachOpaqueData, schemaPath, name, transactionOpaqueData) {
3742
3912
  const result = await this.rpc.call("catalog_table_get", {
3743
3913
  attach_opaque_data: attachOpaqueData,
3744
- schema_name: schemaName,
3914
+ schema_path: normalizeSchemaPath(schemaPath),
3745
3915
  name,
3746
3916
  transaction_opaque_data: transactionOpaqueData ?? null
3747
3917
  });
@@ -3751,10 +3921,10 @@ class VgiClient {
3751
3921
  const items = deserializeInfoList(inner.items, decodeTableInfo);
3752
3922
  return items.length > 0 ? items[0] : null;
3753
3923
  }
3754
- async tableCreate(attachOpaqueData, schemaName, name, columns, onConflict, notNullConstraints, uniqueConstraints, checkConstraints, transactionOpaqueData) {
3924
+ async tableCreate(attachOpaqueData, schemaPath, name, columns, onConflict, notNullConstraints, uniqueConstraints, checkConstraints, transactionOpaqueData) {
3755
3925
  await this.rpc.call("catalog_table_create", {
3756
3926
  attach_opaque_data: attachOpaqueData,
3757
- schema_name: schemaName,
3927
+ schema_path: normalizeSchemaPath(schemaPath),
3758
3928
  name,
3759
3929
  columns,
3760
3930
  on_conflict: onConflict,
@@ -3764,20 +3934,20 @@ class VgiClient {
3764
3934
  transaction_opaque_data: transactionOpaqueData ?? null
3765
3935
  });
3766
3936
  }
3767
- async tableDrop(attachOpaqueData, schemaName, name, ignoreNotFound, cascade, transactionOpaqueData) {
3937
+ async tableDrop(attachOpaqueData, schemaPath, name, ignoreNotFound, cascade, transactionOpaqueData) {
3768
3938
  await this.rpc.call("catalog_table_drop", {
3769
3939
  attach_opaque_data: attachOpaqueData,
3770
- schema_name: schemaName,
3940
+ schema_path: normalizeSchemaPath(schemaPath),
3771
3941
  name,
3772
3942
  ignore_not_found: ignoreNotFound ?? false,
3773
3943
  cascade: cascade ?? false,
3774
3944
  transaction_opaque_data: transactionOpaqueData ?? null
3775
3945
  });
3776
3946
  }
3777
- async tableScanFunctionGet(attachOpaqueData, schemaName, name, atUnit, atValue, transactionOpaqueData) {
3947
+ async tableScanFunctionGet(attachOpaqueData, schemaPath, name, atUnit, atValue, transactionOpaqueData) {
3778
3948
  const result = await this.rpc.call("catalog_table_scan_function_get", {
3779
3949
  attach_opaque_data: attachOpaqueData,
3780
- schema_name: schemaName,
3950
+ schema_path: normalizeSchemaPath(schemaPath),
3781
3951
  name,
3782
3952
  at_unit: atUnit ?? null,
3783
3953
  at_value: atValue ?? null,
@@ -3787,30 +3957,30 @@ class VgiClient {
3787
3957
  throw new VgiClientError("table_scan_function_get returned null");
3788
3958
  return decodeScanFunctionResult(unwrapResult(result));
3789
3959
  }
3790
- async tableCommentSet(attachOpaqueData, schemaName, name, comment, ignoreNotFound, transactionOpaqueData) {
3960
+ async tableCommentSet(attachOpaqueData, schemaPath, name, comment, ignoreNotFound, transactionOpaqueData) {
3791
3961
  await this.rpc.call("catalog_table_comment_set", {
3792
3962
  attach_opaque_data: attachOpaqueData,
3793
- schema_name: schemaName,
3963
+ schema_path: normalizeSchemaPath(schemaPath),
3794
3964
  name,
3795
3965
  comment: comment ?? null,
3796
3966
  ignore_not_found: ignoreNotFound ?? null,
3797
3967
  transaction_opaque_data: transactionOpaqueData ?? null
3798
3968
  });
3799
3969
  }
3800
- async tableRename(attachOpaqueData, schemaName, name, newName, ignoreNotFound, transactionOpaqueData) {
3970
+ async tableRename(attachOpaqueData, schemaPath, name, newName, ignoreNotFound, transactionOpaqueData) {
3801
3971
  await this.rpc.call("catalog_table_rename", {
3802
3972
  attach_opaque_data: attachOpaqueData,
3803
- schema_name: schemaName,
3973
+ schema_path: normalizeSchemaPath(schemaPath),
3804
3974
  name,
3805
3975
  new_name: newName,
3806
3976
  ignore_not_found: ignoreNotFound ?? null,
3807
3977
  transaction_opaque_data: transactionOpaqueData ?? null
3808
3978
  });
3809
3979
  }
3810
- async tableColumnAdd(attachOpaqueData, schemaName, name, columnName, columnType, defaultValue, ignoreNotFound, transactionOpaqueData) {
3980
+ async tableColumnAdd(attachOpaqueData, schemaPath, name, columnName, columnType, defaultValue, ignoreNotFound, transactionOpaqueData) {
3811
3981
  await this.rpc.call("catalog_table_column_add", {
3812
3982
  attach_opaque_data: attachOpaqueData,
3813
- schema_name: schemaName,
3983
+ schema_path: normalizeSchemaPath(schemaPath),
3814
3984
  name,
3815
3985
  column_name: columnName,
3816
3986
  column_type: columnType,
@@ -3819,20 +3989,20 @@ class VgiClient {
3819
3989
  transaction_opaque_data: transactionOpaqueData ?? null
3820
3990
  });
3821
3991
  }
3822
- async tableColumnDrop(attachOpaqueData, schemaName, name, columnName, ignoreNotFound, transactionOpaqueData) {
3992
+ async tableColumnDrop(attachOpaqueData, schemaPath, name, columnName, ignoreNotFound, transactionOpaqueData) {
3823
3993
  await this.rpc.call("catalog_table_column_drop", {
3824
3994
  attach_opaque_data: attachOpaqueData,
3825
- schema_name: schemaName,
3995
+ schema_path: normalizeSchemaPath(schemaPath),
3826
3996
  name,
3827
3997
  column_name: columnName,
3828
3998
  ignore_not_found: ignoreNotFound ?? null,
3829
3999
  transaction_opaque_data: transactionOpaqueData ?? null
3830
4000
  });
3831
4001
  }
3832
- async tableColumnRename(attachOpaqueData, schemaName, name, columnName, newName, ignoreNotFound, transactionOpaqueData) {
4002
+ async tableColumnRename(attachOpaqueData, schemaPath, name, columnName, newName, ignoreNotFound, transactionOpaqueData) {
3833
4003
  await this.rpc.call("catalog_table_column_rename", {
3834
4004
  attach_opaque_data: attachOpaqueData,
3835
- schema_name: schemaName,
4005
+ schema_path: normalizeSchemaPath(schemaPath),
3836
4006
  name,
3837
4007
  column_name: columnName,
3838
4008
  new_name: newName,
@@ -3840,10 +4010,10 @@ class VgiClient {
3840
4010
  transaction_opaque_data: transactionOpaqueData ?? null
3841
4011
  });
3842
4012
  }
3843
- async tableColumnDefaultSet(attachOpaqueData, schemaName, name, columnName, defaultValue, ignoreNotFound, transactionOpaqueData) {
4013
+ async tableColumnDefaultSet(attachOpaqueData, schemaPath, name, columnName, defaultValue, ignoreNotFound, transactionOpaqueData) {
3844
4014
  await this.rpc.call("catalog_table_column_default_set", {
3845
4015
  attach_opaque_data: attachOpaqueData,
3846
- schema_name: schemaName,
4016
+ schema_path: normalizeSchemaPath(schemaPath),
3847
4017
  name,
3848
4018
  column_name: columnName,
3849
4019
  default_value: defaultValue,
@@ -3851,20 +4021,20 @@ class VgiClient {
3851
4021
  transaction_opaque_data: transactionOpaqueData ?? null
3852
4022
  });
3853
4023
  }
3854
- async tableColumnDefaultDrop(attachOpaqueData, schemaName, name, columnName, ignoreNotFound, transactionOpaqueData) {
4024
+ async tableColumnDefaultDrop(attachOpaqueData, schemaPath, name, columnName, ignoreNotFound, transactionOpaqueData) {
3855
4025
  await this.rpc.call("catalog_table_column_default_drop", {
3856
4026
  attach_opaque_data: attachOpaqueData,
3857
- schema_name: schemaName,
4027
+ schema_path: normalizeSchemaPath(schemaPath),
3858
4028
  name,
3859
4029
  column_name: columnName,
3860
4030
  ignore_not_found: ignoreNotFound ?? null,
3861
4031
  transaction_opaque_data: transactionOpaqueData ?? null
3862
4032
  });
3863
4033
  }
3864
- async tableColumnTypeChange(attachOpaqueData, schemaName, name, columnDefinition, expression, ignoreNotFound, transactionOpaqueData) {
4034
+ async tableColumnTypeChange(attachOpaqueData, schemaPath, name, columnDefinition, expression, ignoreNotFound, transactionOpaqueData) {
3865
4035
  await this.rpc.call("catalog_table_column_type_change", {
3866
4036
  attach_opaque_data: attachOpaqueData,
3867
- schema_name: schemaName,
4037
+ schema_path: normalizeSchemaPath(schemaPath),
3868
4038
  name,
3869
4039
  column_definition: columnDefinition,
3870
4040
  expression: expression ?? null,
@@ -3872,30 +4042,30 @@ class VgiClient {
3872
4042
  transaction_opaque_data: transactionOpaqueData ?? null
3873
4043
  });
3874
4044
  }
3875
- async tableNotNullSet(attachOpaqueData, schemaName, name, columnName, ignoreNotFound, transactionOpaqueData) {
4045
+ async tableNotNullSet(attachOpaqueData, schemaPath, name, columnName, ignoreNotFound, transactionOpaqueData) {
3876
4046
  await this.rpc.call("catalog_table_not_null_set", {
3877
4047
  attach_opaque_data: attachOpaqueData,
3878
- schema_name: schemaName,
4048
+ schema_path: normalizeSchemaPath(schemaPath),
3879
4049
  name,
3880
4050
  column_name: columnName,
3881
4051
  ignore_not_found: ignoreNotFound ?? null,
3882
4052
  transaction_opaque_data: transactionOpaqueData ?? null
3883
4053
  });
3884
4054
  }
3885
- async tableNotNullDrop(attachOpaqueData, schemaName, name, columnName, ignoreNotFound, transactionOpaqueData) {
4055
+ async tableNotNullDrop(attachOpaqueData, schemaPath, name, columnName, ignoreNotFound, transactionOpaqueData) {
3886
4056
  await this.rpc.call("catalog_table_not_null_drop", {
3887
4057
  attach_opaque_data: attachOpaqueData,
3888
- schema_name: schemaName,
4058
+ schema_path: normalizeSchemaPath(schemaPath),
3889
4059
  name,
3890
4060
  column_name: columnName,
3891
4061
  ignore_not_found: ignoreNotFound ?? null,
3892
4062
  transaction_opaque_data: transactionOpaqueData ?? null
3893
4063
  });
3894
4064
  }
3895
- async viewGet(attachOpaqueData, schemaName, name, transactionOpaqueData) {
4065
+ async viewGet(attachOpaqueData, schemaPath, name, transactionOpaqueData) {
3896
4066
  const result = await this.rpc.call("catalog_view_get", {
3897
4067
  attach_opaque_data: attachOpaqueData,
3898
- schema_name: schemaName,
4068
+ schema_path: normalizeSchemaPath(schemaPath),
3899
4069
  name,
3900
4070
  transaction_opaque_data: transactionOpaqueData ?? null
3901
4071
  });
@@ -3905,50 +4075,50 @@ class VgiClient {
3905
4075
  const items = deserializeInfoList(inner.items, decodeViewInfo);
3906
4076
  return items.length > 0 ? items[0] : null;
3907
4077
  }
3908
- async viewCreate(attachOpaqueData, schemaName, name, definition, onConflict, transactionOpaqueData) {
4078
+ async viewCreate(attachOpaqueData, schemaPath, name, definition, onConflict, transactionOpaqueData) {
3909
4079
  await this.rpc.call("catalog_view_create", {
3910
4080
  attach_opaque_data: attachOpaqueData,
3911
- schema_name: schemaName,
4081
+ schema_path: normalizeSchemaPath(schemaPath),
3912
4082
  name,
3913
4083
  definition,
3914
4084
  on_conflict: onConflict,
3915
4085
  transaction_opaque_data: transactionOpaqueData ?? null
3916
4086
  });
3917
4087
  }
3918
- async viewDrop(attachOpaqueData, schemaName, name, ignoreNotFound, cascade, transactionOpaqueData) {
4088
+ async viewDrop(attachOpaqueData, schemaPath, name, ignoreNotFound, cascade, transactionOpaqueData) {
3919
4089
  await this.rpc.call("catalog_view_drop", {
3920
4090
  attach_opaque_data: attachOpaqueData,
3921
- schema_name: schemaName,
4091
+ schema_path: normalizeSchemaPath(schemaPath),
3922
4092
  name,
3923
4093
  ignore_not_found: ignoreNotFound ?? false,
3924
4094
  cascade: cascade ?? false,
3925
4095
  transaction_opaque_data: transactionOpaqueData ?? null
3926
4096
  });
3927
4097
  }
3928
- async viewRename(attachOpaqueData, schemaName, name, newName, ignoreNotFound, transactionOpaqueData) {
4098
+ async viewRename(attachOpaqueData, schemaPath, name, newName, ignoreNotFound, transactionOpaqueData) {
3929
4099
  await this.rpc.call("catalog_view_rename", {
3930
4100
  attach_opaque_data: attachOpaqueData,
3931
- schema_name: schemaName,
4101
+ schema_path: normalizeSchemaPath(schemaPath),
3932
4102
  name,
3933
4103
  new_name: newName,
3934
4104
  ignore_not_found: ignoreNotFound ?? null,
3935
4105
  transaction_opaque_data: transactionOpaqueData ?? null
3936
4106
  });
3937
4107
  }
3938
- async viewCommentSet(attachOpaqueData, schemaName, name, comment, ignoreNotFound, transactionOpaqueData) {
4108
+ async viewCommentSet(attachOpaqueData, schemaPath, name, comment, ignoreNotFound, transactionOpaqueData) {
3939
4109
  await this.rpc.call("catalog_view_comment_set", {
3940
4110
  attach_opaque_data: attachOpaqueData,
3941
- schema_name: schemaName,
4111
+ schema_path: normalizeSchemaPath(schemaPath),
3942
4112
  name,
3943
4113
  comment: comment ?? null,
3944
4114
  ignore_not_found: ignoreNotFound ?? null,
3945
4115
  transaction_opaque_data: transactionOpaqueData ?? null
3946
4116
  });
3947
4117
  }
3948
- async macroGet(attachOpaqueData, schemaName, name, transactionOpaqueData) {
4118
+ async macroGet(attachOpaqueData, schemaPath, name, transactionOpaqueData) {
3949
4119
  const result = await this.rpc.call("catalog_macro_get", {
3950
4120
  attach_opaque_data: attachOpaqueData,
3951
- schema_name: schemaName,
4121
+ schema_path: normalizeSchemaPath(schemaPath),
3952
4122
  name,
3953
4123
  transaction_opaque_data: transactionOpaqueData ?? null
3954
4124
  });
@@ -3958,10 +4128,10 @@ class VgiClient {
3958
4128
  const items = deserializeInfoList(inner.items, decodeMacroInfo);
3959
4129
  return items.length > 0 ? items[0] : null;
3960
4130
  }
3961
- async schemaContentsMacros(attachOpaqueData, name, type, transactionOpaqueData) {
4131
+ async schemaContentsMacros(attachOpaqueData, path, type, transactionOpaqueData) {
3962
4132
  const result = await this.rpc.call("catalog_schema_contents_macros", {
3963
4133
  attach_opaque_data: attachOpaqueData,
3964
- name,
4134
+ path: normalizeSchemaPath(path),
3965
4135
  type,
3966
4136
  transaction_opaque_data: transactionOpaqueData ?? null
3967
4137
  });
@@ -3970,22 +4140,10 @@ class VgiClient {
3970
4140
  const inner = unwrapResult(result);
3971
4141
  return deserializeInfoList(inner.items, decodeMacroInfo);
3972
4142
  }
3973
- async macroCreate(attachOpaqueData, schemaName, name, macroType, parameters, definition, onConflict, parameterDefaultValues, argumentsSchema, transactionOpaqueData) {
3974
- const schema3 = schema2([
3975
- field2("attach_opaque_data", binary2(), false),
3976
- field2("schema_name", utf82(), false),
3977
- field2("name", utf82(), false),
3978
- field2("macro_type", utf82(), false),
3979
- field2("parameters", list2(field2("item", utf82(), false)), false),
3980
- field2("definition", utf82(), false),
3981
- field2("on_conflict", utf82(), false),
3982
- field2("parameter_default_values", binary2(), true),
3983
- field2("arguments_schema", binary2(), true),
3984
- field2("transaction_opaque_data", binary2(), true)
3985
- ]);
4143
+ async macroCreate(attachOpaqueData, schemaPath, name, macroType, parameters, definition, onConflict, parameterDefaultValues, argumentsSchema, transactionOpaqueData) {
3986
4144
  const innerBatch = batchFromColumns({
3987
4145
  attach_opaque_data: [attachOpaqueData],
3988
- schema_name: [schemaName],
4146
+ schema_path: [normalizeSchemaPath(schemaPath)],
3989
4147
  name: [name],
3990
4148
  macro_type: [macroType],
3991
4149
  parameters: [parameters],
@@ -3994,13 +4152,13 @@ class VgiClient {
3994
4152
  parameter_default_values: [parameterDefaultValues ?? null],
3995
4153
  arguments_schema: [argumentsSchema ?? null],
3996
4154
  transaction_opaque_data: [transactionOpaqueData ?? null]
3997
- }, schema3);
4155
+ }, MacroCreateRequestSchema);
3998
4156
  await this.rpc.call("catalog_macro_create", wrapRequest(innerBatch));
3999
4157
  }
4000
- async macroDrop(attachOpaqueData, schemaName, name, ignoreNotFound, transactionOpaqueData) {
4158
+ async macroDrop(attachOpaqueData, schemaPath, name, ignoreNotFound, transactionOpaqueData) {
4001
4159
  await this.rpc.call("catalog_macro_drop", {
4002
4160
  attach_opaque_data: attachOpaqueData,
4003
- schema_name: schemaName,
4161
+ schema_path: normalizeSchemaPath(schemaPath),
4004
4162
  name,
4005
4163
  ignore_not_found: ignoreNotFound ?? false,
4006
4164
  transaction_opaque_data: transactionOpaqueData ?? null
@@ -4060,18 +4218,18 @@ function argumentSpecsToSchema(specs) {
4060
4218
  if (spec.pattern !== undefined) {
4061
4219
  metadata.set(VGI_PATTERN_KEY, spec.pattern);
4062
4220
  }
4063
- const field3 = field2(spec.name, spec.arrowType, true, metadata.size > 0 ? metadata : undefined);
4064
- fields.push(field3);
4221
+ const field = field2(spec.name, spec.arrowType, true, metadata.size > 0 ? metadata : undefined);
4222
+ fields.push(field);
4065
4223
  }
4066
4224
  return schema2(fields);
4067
4225
  }
4068
- function schemaToArgumentSpecs(schema3) {
4226
+ function schemaToArgumentSpecs(schema) {
4069
4227
  const specs = [];
4070
4228
  let positionIndex = 0;
4071
- for (const field3 of schema3.fields) {
4072
- const metadata = field3.metadata;
4229
+ for (const field of schema.fields) {
4230
+ const metadata = field.metadata;
4073
4231
  const isNamed = metadata.get(VGI_ARG_KEY) === VGI_ARG_NAMED;
4074
- const position = isNamed ? field3.name : positionIndex++;
4232
+ const position = isNamed ? field.name : positionIndex++;
4075
4233
  const vgiType = metadata.get(VGI_TYPE_KEY);
4076
4234
  const isTableInput = vgiType === VGI_TYPE_TABLE;
4077
4235
  const isAnyType = vgiType === VGI_TYPE_ANY;
@@ -4083,9 +4241,9 @@ function schemaToArgumentSpecs(schema3) {
4083
4241
  const rangeNotation = metadata.get(VGI_RANGE_KEY);
4084
4242
  const pattern = metadata.get(VGI_PATTERN_KEY);
4085
4243
  specs.push({
4086
- name: field3.name,
4244
+ name: field.name,
4087
4245
  position,
4088
- arrowType: field3.type,
4246
+ arrowType: field.type,
4089
4247
  isTableInput,
4090
4248
  isAnyType,
4091
4249
  isVarargs,
@@ -4135,6 +4293,7 @@ function deserializeAttachOptionSpecs(specs) {
4135
4293
  return Array.from(specs, deserializeAttachOptionSpec);
4136
4294
  }
4137
4295
  export {
4296
+ ArgumentMonotonicity,
4138
4297
  ArgumentValidationError,
4139
4298
  Arguments,
4140
4299
  CatalogAlreadyExistsError,
@@ -4185,4 +4344,4 @@ export {
4185
4344
  typeSignature
4186
4345
  };
4187
4346
 
4188
- //# debugId=96F67925F48EAE1464756E2164756E21
4347
+ //# debugId=8F5FB740A8A1AC8864756E2164756E21