@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
@@ -47,6 +47,9 @@ import { wrapRequest, unwrapResult } from "./protocol.js";
47
47
  import { toUint8Array } from "../util/bytes.js";
48
48
  import { serializeAttachOptions } from "../catalog/attach-options.js";
49
49
  import { VgiClientError, wrapRpcWithErrorEnrichment } from "./errors.js";
50
+ import { normalizeSchemaPath } from "../schema-path.js";
51
+ import { encodeASD } from "../codec/asd.js";
52
+ import { ClientCapabilitiesSchema, MacroCreateRequestSchema } from "../generated/vgi-protocol-schemas.js";
50
53
  import { deserializeInfoList, deserializeTags, toAsyncIterator } from "./helpers.js";
51
54
 
52
55
  export { VgiClientError };
@@ -102,6 +105,32 @@ export class VgiClient {
102
105
  this.defaultAttachOpaqueData = options?.attachOpaqueData ?? null;
103
106
  }
104
107
 
108
+ /**
109
+ * Connect the high-level client to a canonical `iroh://` or `httpi://`
110
+ * endpoint. Native Node/Bun connectors are selected from the URI scheme.
111
+ * Browser callers may inject the connector exported by the browser Iroh
112
+ * package without changing the VGI client API.
113
+ */
114
+ static async fromIroh(
115
+ endpoint: string,
116
+ options: Record<string, unknown> = {},
117
+ clientOptions?: VgiClientOptions,
118
+ connector?: (endpoint: string, options: Record<string, unknown>) => Promise<RpcClient>,
119
+ ): Promise<VgiClient> {
120
+ if (!/^(iroh|httpi):\/\//.test(endpoint)) {
121
+ throw new TypeError("VgiClient.fromIroh requires an iroh:// or httpi:// endpoint");
122
+ }
123
+ let selected = connector;
124
+ if (!selected) {
125
+ const rpc = await import("@query-farm/vgi-rpc");
126
+ selected = endpoint.startsWith("iroh://")
127
+ ? (rpc.irohConnect as unknown as NonNullable<typeof selected>)
128
+ : (rpc.httpiConnect as unknown as NonNullable<typeof selected>);
129
+ }
130
+ if (!selected) throw new TypeError("no Iroh connector is available in this runtime");
131
+ return new VgiClient(await selected(endpoint, options), clientOptions);
132
+ }
133
+
105
134
  // ==========================================================================
106
135
  // Private helpers
107
136
  // ==========================================================================
@@ -599,6 +628,7 @@ export class VgiClient {
599
628
  field("options", binary(), true),
600
629
  field("data_version_spec", utf8(), true),
601
630
  field("implementation_version", utf8(), true),
631
+ field("client_capabilities", binary(), true),
602
632
  ]);
603
633
  const innerBatch = batchFromColumns(
604
634
  {
@@ -606,6 +636,9 @@ export class VgiClient {
606
636
  options: [wireOptions],
607
637
  data_version_spec: [opts?.dataVersionSpec ?? null],
608
638
  implementation_version: [opts?.implementationVersion ?? null],
639
+ client_capabilities: [opts?.clientCapabilities
640
+ ? encodeASD(ClientCapabilitiesSchema, opts.clientCapabilities)
641
+ : null],
609
642
  },
610
643
  schema,
611
644
  );
@@ -757,12 +790,12 @@ export class VgiClient {
757
790
  /** Get a schema by name, or null if not found. */
758
791
  async schemaGet(
759
792
  attachOpaqueData: AttachOpaqueData,
760
- name: string,
793
+ path: string[] | string,
761
794
  transactionOpaqueData?: TransactionOpaqueData,
762
795
  ): Promise<SchemaInfo | null> {
763
796
  const result = await this.rpc.call("catalog_schema_get", {
764
797
  attach_opaque_data: attachOpaqueData,
765
- name,
798
+ path: normalizeSchemaPath(path),
766
799
  transaction_opaque_data: transactionOpaqueData ?? null,
767
800
  });
768
801
  if (!result) return null;
@@ -774,7 +807,7 @@ export class VgiClient {
774
807
  /** Create a new schema. */
775
808
  async schemaCreate(
776
809
  attachOpaqueData: AttachOpaqueData,
777
- name: string,
810
+ path: string[] | string,
778
811
  opts?: {
779
812
  onConflict?: OnCreateConflict;
780
813
  comment?: string | null;
@@ -787,7 +820,7 @@ export class VgiClient {
787
820
  : null;
788
821
  await this.rpc.call("catalog_schema_create", {
789
822
  attach_opaque_data: attachOpaqueData,
790
- name,
823
+ path: normalizeSchemaPath(path),
791
824
  on_conflict: opts?.onConflict ?? "error",
792
825
  comment: opts?.comment ?? null,
793
826
  tags: tagsMap,
@@ -798,14 +831,14 @@ export class VgiClient {
798
831
  /** Drop a schema by name. */
799
832
  async schemaDrop(
800
833
  attachOpaqueData: AttachOpaqueData,
801
- name: string,
834
+ path: string[] | string,
802
835
  ignoreNotFound?: boolean,
803
836
  cascade?: boolean,
804
837
  transactionOpaqueData?: TransactionOpaqueData,
805
838
  ): Promise<void> {
806
839
  await this.rpc.call("catalog_schema_drop", {
807
840
  attach_opaque_data: attachOpaqueData,
808
- name,
841
+ path: normalizeSchemaPath(path),
809
842
  ignore_not_found: ignoreNotFound ?? false,
810
843
  cascade: cascade ?? false,
811
844
  transaction_opaque_data: transactionOpaqueData ?? null,
@@ -815,12 +848,12 @@ export class VgiClient {
815
848
  /** List tables in a schema. */
816
849
  async schemaContentsTables(
817
850
  attachOpaqueData: AttachOpaqueData,
818
- name: string,
851
+ path: string[] | string,
819
852
  transactionOpaqueData?: TransactionOpaqueData,
820
853
  ): Promise<TableInfo[]> {
821
854
  const result = await this.rpc.call("catalog_schema_contents_tables", {
822
855
  attach_opaque_data: attachOpaqueData,
823
- name,
856
+ path: normalizeSchemaPath(path),
824
857
  transaction_opaque_data: transactionOpaqueData ?? null,
825
858
  });
826
859
  if (!result) return [];
@@ -831,12 +864,12 @@ export class VgiClient {
831
864
  /** List views in a schema. */
832
865
  async schemaContentsViews(
833
866
  attachOpaqueData: AttachOpaqueData,
834
- name: string,
867
+ path: string[] | string,
835
868
  transactionOpaqueData?: TransactionOpaqueData,
836
869
  ): Promise<ViewInfo[]> {
837
870
  const result = await this.rpc.call("catalog_schema_contents_views", {
838
871
  attach_opaque_data: attachOpaqueData,
839
- name,
872
+ path: normalizeSchemaPath(path),
840
873
  transaction_opaque_data: transactionOpaqueData ?? null,
841
874
  });
842
875
  if (!result) return [];
@@ -847,13 +880,13 @@ export class VgiClient {
847
880
  /** List functions in a schema, filtered by type. */
848
881
  async schemaContentsFunctions(
849
882
  attachOpaqueData: AttachOpaqueData,
850
- name: string,
883
+ path: string[] | string,
851
884
  type: CatalogFunctionType,
852
885
  transactionOpaqueData?: TransactionOpaqueData,
853
886
  ): Promise<FunctionInfo[]> {
854
887
  const result = await this.rpc.call("catalog_schema_contents_functions", {
855
888
  attach_opaque_data: attachOpaqueData,
856
- name,
889
+ path: normalizeSchemaPath(path),
857
890
  type,
858
891
  transaction_opaque_data: transactionOpaqueData ?? null,
859
892
  });
@@ -865,13 +898,13 @@ export class VgiClient {
865
898
  /** Get a table by name, or null if not found. */
866
899
  async tableGet(
867
900
  attachOpaqueData: AttachOpaqueData,
868
- schemaName: string,
901
+ schemaPath: string[] | string,
869
902
  name: string,
870
903
  transactionOpaqueData?: TransactionOpaqueData,
871
904
  ): Promise<TableInfo | null> {
872
905
  const result = await this.rpc.call("catalog_table_get", {
873
906
  attach_opaque_data: attachOpaqueData,
874
- schema_name: schemaName,
907
+ schema_path: normalizeSchemaPath(schemaPath),
875
908
  name,
876
909
  transaction_opaque_data: transactionOpaqueData ?? null,
877
910
  });
@@ -884,7 +917,7 @@ export class VgiClient {
884
917
  /** Create a new table. */
885
918
  async tableCreate(
886
919
  attachOpaqueData: AttachOpaqueData,
887
- schemaName: string,
920
+ schemaPath: string[] | string,
888
921
  name: string,
889
922
  columns: Uint8Array,
890
923
  onConflict: OnCreateConflict,
@@ -895,7 +928,7 @@ export class VgiClient {
895
928
  ): Promise<void> {
896
929
  await this.rpc.call("catalog_table_create", {
897
930
  attach_opaque_data: attachOpaqueData,
898
- schema_name: schemaName,
931
+ schema_path: normalizeSchemaPath(schemaPath),
899
932
  name,
900
933
  columns,
901
934
  on_conflict: onConflict,
@@ -909,7 +942,7 @@ export class VgiClient {
909
942
  /** Drop a table by name. */
910
943
  async tableDrop(
911
944
  attachOpaqueData: AttachOpaqueData,
912
- schemaName: string,
945
+ schemaPath: string[] | string,
913
946
  name: string,
914
947
  ignoreNotFound?: boolean,
915
948
  cascade?: boolean,
@@ -917,7 +950,7 @@ export class VgiClient {
917
950
  ): Promise<void> {
918
951
  await this.rpc.call("catalog_table_drop", {
919
952
  attach_opaque_data: attachOpaqueData,
920
- schema_name: schemaName,
953
+ schema_path: normalizeSchemaPath(schemaPath),
921
954
  name,
922
955
  ignore_not_found: ignoreNotFound ?? false,
923
956
  cascade: cascade ?? false,
@@ -932,7 +965,7 @@ export class VgiClient {
932
965
  */
933
966
  async tableScanFunctionGet(
934
967
  attachOpaqueData: AttachOpaqueData,
935
- schemaName: string,
968
+ schemaPath: string[] | string,
936
969
  name: string,
937
970
  atUnit?: string | null,
938
971
  atValue?: string | null,
@@ -940,7 +973,7 @@ export class VgiClient {
940
973
  ): Promise<ScanFunctionResult> {
941
974
  const result = await this.rpc.call("catalog_table_scan_function_get", {
942
975
  attach_opaque_data: attachOpaqueData,
943
- schema_name: schemaName,
976
+ schema_path: normalizeSchemaPath(schemaPath),
944
977
  name,
945
978
  at_unit: atUnit ?? null,
946
979
  at_value: atValue ?? null,
@@ -953,7 +986,7 @@ export class VgiClient {
953
986
  /** Set or clear the comment on a table. */
954
987
  async tableCommentSet(
955
988
  attachOpaqueData: AttachOpaqueData,
956
- schemaName: string,
989
+ schemaPath: string[] | string,
957
990
  name: string,
958
991
  comment?: string | null,
959
992
  ignoreNotFound?: boolean,
@@ -961,7 +994,7 @@ export class VgiClient {
961
994
  ): Promise<void> {
962
995
  await this.rpc.call("catalog_table_comment_set", {
963
996
  attach_opaque_data: attachOpaqueData,
964
- schema_name: schemaName,
997
+ schema_path: normalizeSchemaPath(schemaPath),
965
998
  name,
966
999
  comment: comment ?? null,
967
1000
  ignore_not_found: ignoreNotFound ?? null,
@@ -972,7 +1005,7 @@ export class VgiClient {
972
1005
  /** Rename a table. */
973
1006
  async tableRename(
974
1007
  attachOpaqueData: AttachOpaqueData,
975
- schemaName: string,
1008
+ schemaPath: string[] | string,
976
1009
  name: string,
977
1010
  newName: string,
978
1011
  ignoreNotFound?: boolean,
@@ -980,7 +1013,7 @@ export class VgiClient {
980
1013
  ): Promise<void> {
981
1014
  await this.rpc.call("catalog_table_rename", {
982
1015
  attach_opaque_data: attachOpaqueData,
983
- schema_name: schemaName,
1016
+ schema_path: normalizeSchemaPath(schemaPath),
984
1017
  name,
985
1018
  new_name: newName,
986
1019
  ignore_not_found: ignoreNotFound ?? null,
@@ -991,7 +1024,7 @@ export class VgiClient {
991
1024
  /** Add a column to a table. */
992
1025
  async tableColumnAdd(
993
1026
  attachOpaqueData: AttachOpaqueData,
994
- schemaName: string,
1027
+ schemaPath: string[] | string,
995
1028
  name: string,
996
1029
  columnName: string,
997
1030
  columnType: string,
@@ -1001,7 +1034,7 @@ export class VgiClient {
1001
1034
  ): Promise<void> {
1002
1035
  await this.rpc.call("catalog_table_column_add", {
1003
1036
  attach_opaque_data: attachOpaqueData,
1004
- schema_name: schemaName,
1037
+ schema_path: normalizeSchemaPath(schemaPath),
1005
1038
  name,
1006
1039
  column_name: columnName,
1007
1040
  column_type: columnType,
@@ -1014,7 +1047,7 @@ export class VgiClient {
1014
1047
  /** Drop a column from a table. */
1015
1048
  async tableColumnDrop(
1016
1049
  attachOpaqueData: AttachOpaqueData,
1017
- schemaName: string,
1050
+ schemaPath: string[] | string,
1018
1051
  name: string,
1019
1052
  columnName: string,
1020
1053
  ignoreNotFound?: boolean,
@@ -1022,7 +1055,7 @@ export class VgiClient {
1022
1055
  ): Promise<void> {
1023
1056
  await this.rpc.call("catalog_table_column_drop", {
1024
1057
  attach_opaque_data: attachOpaqueData,
1025
- schema_name: schemaName,
1058
+ schema_path: normalizeSchemaPath(schemaPath),
1026
1059
  name,
1027
1060
  column_name: columnName,
1028
1061
  ignore_not_found: ignoreNotFound ?? null,
@@ -1033,7 +1066,7 @@ export class VgiClient {
1033
1066
  /** Rename a column in a table. */
1034
1067
  async tableColumnRename(
1035
1068
  attachOpaqueData: AttachOpaqueData,
1036
- schemaName: string,
1069
+ schemaPath: string[] | string,
1037
1070
  name: string,
1038
1071
  columnName: string,
1039
1072
  newName: string,
@@ -1042,7 +1075,7 @@ export class VgiClient {
1042
1075
  ): Promise<void> {
1043
1076
  await this.rpc.call("catalog_table_column_rename", {
1044
1077
  attach_opaque_data: attachOpaqueData,
1045
- schema_name: schemaName,
1078
+ schema_path: normalizeSchemaPath(schemaPath),
1046
1079
  name,
1047
1080
  column_name: columnName,
1048
1081
  new_name: newName,
@@ -1054,7 +1087,7 @@ export class VgiClient {
1054
1087
  /** Set the default value for a column. */
1055
1088
  async tableColumnDefaultSet(
1056
1089
  attachOpaqueData: AttachOpaqueData,
1057
- schemaName: string,
1090
+ schemaPath: string[] | string,
1058
1091
  name: string,
1059
1092
  columnName: string,
1060
1093
  defaultValue: string,
@@ -1063,7 +1096,7 @@ export class VgiClient {
1063
1096
  ): Promise<void> {
1064
1097
  await this.rpc.call("catalog_table_column_default_set", {
1065
1098
  attach_opaque_data: attachOpaqueData,
1066
- schema_name: schemaName,
1099
+ schema_path: normalizeSchemaPath(schemaPath),
1067
1100
  name,
1068
1101
  column_name: columnName,
1069
1102
  default_value: defaultValue,
@@ -1075,7 +1108,7 @@ export class VgiClient {
1075
1108
  /** Remove the default value from a column. */
1076
1109
  async tableColumnDefaultDrop(
1077
1110
  attachOpaqueData: AttachOpaqueData,
1078
- schemaName: string,
1111
+ schemaPath: string[] | string,
1079
1112
  name: string,
1080
1113
  columnName: string,
1081
1114
  ignoreNotFound?: boolean,
@@ -1083,7 +1116,7 @@ export class VgiClient {
1083
1116
  ): Promise<void> {
1084
1117
  await this.rpc.call("catalog_table_column_default_drop", {
1085
1118
  attach_opaque_data: attachOpaqueData,
1086
- schema_name: schemaName,
1119
+ schema_path: normalizeSchemaPath(schemaPath),
1087
1120
  name,
1088
1121
  column_name: columnName,
1089
1122
  ignore_not_found: ignoreNotFound ?? null,
@@ -1100,7 +1133,7 @@ export class VgiClient {
1100
1133
  */
1101
1134
  async tableColumnTypeChange(
1102
1135
  attachOpaqueData: AttachOpaqueData,
1103
- schemaName: string,
1136
+ schemaPath: string[] | string,
1104
1137
  name: string,
1105
1138
  columnDefinition: Uint8Array,
1106
1139
  expression?: string | null,
@@ -1109,7 +1142,7 @@ export class VgiClient {
1109
1142
  ): Promise<void> {
1110
1143
  await this.rpc.call("catalog_table_column_type_change", {
1111
1144
  attach_opaque_data: attachOpaqueData,
1112
- schema_name: schemaName,
1145
+ schema_path: normalizeSchemaPath(schemaPath),
1113
1146
  name,
1114
1147
  column_definition: columnDefinition,
1115
1148
  expression: expression ?? null,
@@ -1121,7 +1154,7 @@ export class VgiClient {
1121
1154
  /** Set a NOT NULL constraint on a column. */
1122
1155
  async tableNotNullSet(
1123
1156
  attachOpaqueData: AttachOpaqueData,
1124
- schemaName: string,
1157
+ schemaPath: string[] | string,
1125
1158
  name: string,
1126
1159
  columnName: string,
1127
1160
  ignoreNotFound?: boolean,
@@ -1129,7 +1162,7 @@ export class VgiClient {
1129
1162
  ): Promise<void> {
1130
1163
  await this.rpc.call("catalog_table_not_null_set", {
1131
1164
  attach_opaque_data: attachOpaqueData,
1132
- schema_name: schemaName,
1165
+ schema_path: normalizeSchemaPath(schemaPath),
1133
1166
  name,
1134
1167
  column_name: columnName,
1135
1168
  ignore_not_found: ignoreNotFound ?? null,
@@ -1140,7 +1173,7 @@ export class VgiClient {
1140
1173
  /** Remove a NOT NULL constraint from a column. */
1141
1174
  async tableNotNullDrop(
1142
1175
  attachOpaqueData: AttachOpaqueData,
1143
- schemaName: string,
1176
+ schemaPath: string[] | string,
1144
1177
  name: string,
1145
1178
  columnName: string,
1146
1179
  ignoreNotFound?: boolean,
@@ -1148,7 +1181,7 @@ export class VgiClient {
1148
1181
  ): Promise<void> {
1149
1182
  await this.rpc.call("catalog_table_not_null_drop", {
1150
1183
  attach_opaque_data: attachOpaqueData,
1151
- schema_name: schemaName,
1184
+ schema_path: normalizeSchemaPath(schemaPath),
1152
1185
  name,
1153
1186
  column_name: columnName,
1154
1187
  ignore_not_found: ignoreNotFound ?? null,
@@ -1159,13 +1192,13 @@ export class VgiClient {
1159
1192
  /** Get a view by name, or null if not found. */
1160
1193
  async viewGet(
1161
1194
  attachOpaqueData: AttachOpaqueData,
1162
- schemaName: string,
1195
+ schemaPath: string[] | string,
1163
1196
  name: string,
1164
1197
  transactionOpaqueData?: TransactionOpaqueData,
1165
1198
  ): Promise<ViewInfo | null> {
1166
1199
  const result = await this.rpc.call("catalog_view_get", {
1167
1200
  attach_opaque_data: attachOpaqueData,
1168
- schema_name: schemaName,
1201
+ schema_path: normalizeSchemaPath(schemaPath),
1169
1202
  name,
1170
1203
  transaction_opaque_data: transactionOpaqueData ?? null,
1171
1204
  });
@@ -1178,7 +1211,7 @@ export class VgiClient {
1178
1211
  /** Create a new view. */
1179
1212
  async viewCreate(
1180
1213
  attachOpaqueData: AttachOpaqueData,
1181
- schemaName: string,
1214
+ schemaPath: string[] | string,
1182
1215
  name: string,
1183
1216
  definition: string,
1184
1217
  onConflict: OnCreateConflict,
@@ -1186,7 +1219,7 @@ export class VgiClient {
1186
1219
  ): Promise<void> {
1187
1220
  await this.rpc.call("catalog_view_create", {
1188
1221
  attach_opaque_data: attachOpaqueData,
1189
- schema_name: schemaName,
1222
+ schema_path: normalizeSchemaPath(schemaPath),
1190
1223
  name,
1191
1224
  definition,
1192
1225
  on_conflict: onConflict,
@@ -1197,7 +1230,7 @@ export class VgiClient {
1197
1230
  /** Drop a view by name. */
1198
1231
  async viewDrop(
1199
1232
  attachOpaqueData: AttachOpaqueData,
1200
- schemaName: string,
1233
+ schemaPath: string[] | string,
1201
1234
  name: string,
1202
1235
  ignoreNotFound?: boolean,
1203
1236
  cascade?: boolean,
@@ -1205,7 +1238,7 @@ export class VgiClient {
1205
1238
  ): Promise<void> {
1206
1239
  await this.rpc.call("catalog_view_drop", {
1207
1240
  attach_opaque_data: attachOpaqueData,
1208
- schema_name: schemaName,
1241
+ schema_path: normalizeSchemaPath(schemaPath),
1209
1242
  name,
1210
1243
  ignore_not_found: ignoreNotFound ?? false,
1211
1244
  cascade: cascade ?? false,
@@ -1216,7 +1249,7 @@ export class VgiClient {
1216
1249
  /** Rename a view. */
1217
1250
  async viewRename(
1218
1251
  attachOpaqueData: AttachOpaqueData,
1219
- schemaName: string,
1252
+ schemaPath: string[] | string,
1220
1253
  name: string,
1221
1254
  newName: string,
1222
1255
  ignoreNotFound?: boolean,
@@ -1224,7 +1257,7 @@ export class VgiClient {
1224
1257
  ): Promise<void> {
1225
1258
  await this.rpc.call("catalog_view_rename", {
1226
1259
  attach_opaque_data: attachOpaqueData,
1227
- schema_name: schemaName,
1260
+ schema_path: normalizeSchemaPath(schemaPath),
1228
1261
  name,
1229
1262
  new_name: newName,
1230
1263
  ignore_not_found: ignoreNotFound ?? null,
@@ -1235,7 +1268,7 @@ export class VgiClient {
1235
1268
  /** Set or clear the comment on a view. */
1236
1269
  async viewCommentSet(
1237
1270
  attachOpaqueData: AttachOpaqueData,
1238
- schemaName: string,
1271
+ schemaPath: string[] | string,
1239
1272
  name: string,
1240
1273
  comment?: string | null,
1241
1274
  ignoreNotFound?: boolean,
@@ -1243,7 +1276,7 @@ export class VgiClient {
1243
1276
  ): Promise<void> {
1244
1277
  await this.rpc.call("catalog_view_comment_set", {
1245
1278
  attach_opaque_data: attachOpaqueData,
1246
- schema_name: schemaName,
1279
+ schema_path: normalizeSchemaPath(schemaPath),
1247
1280
  name,
1248
1281
  comment: comment ?? null,
1249
1282
  ignore_not_found: ignoreNotFound ?? null,
@@ -1258,13 +1291,13 @@ export class VgiClient {
1258
1291
  /** Get a macro by name, or null if not found. */
1259
1292
  async macroGet(
1260
1293
  attachOpaqueData: AttachOpaqueData,
1261
- schemaName: string,
1294
+ schemaPath: string[] | string,
1262
1295
  name: string,
1263
1296
  transactionOpaqueData?: TransactionOpaqueData,
1264
1297
  ): Promise<MacroInfo | null> {
1265
1298
  const result = await this.rpc.call("catalog_macro_get", {
1266
1299
  attach_opaque_data: attachOpaqueData,
1267
- schema_name: schemaName,
1300
+ schema_path: normalizeSchemaPath(schemaPath),
1268
1301
  name,
1269
1302
  transaction_opaque_data: transactionOpaqueData ?? null,
1270
1303
  });
@@ -1277,13 +1310,13 @@ export class VgiClient {
1277
1310
  /** List macros in a schema, filtered by type. */
1278
1311
  async schemaContentsMacros(
1279
1312
  attachOpaqueData: AttachOpaqueData,
1280
- name: string,
1313
+ path: string[] | string,
1281
1314
  type: CatalogMacroType,
1282
1315
  transactionOpaqueData?: TransactionOpaqueData,
1283
1316
  ): Promise<MacroInfo[]> {
1284
1317
  const result = await this.rpc.call("catalog_schema_contents_macros", {
1285
1318
  attach_opaque_data: attachOpaqueData,
1286
- name,
1319
+ path: normalizeSchemaPath(path),
1287
1320
  type,
1288
1321
  transaction_opaque_data: transactionOpaqueData ?? null,
1289
1322
  });
@@ -1295,7 +1328,7 @@ export class VgiClient {
1295
1328
  /** Create a new macro. */
1296
1329
  async macroCreate(
1297
1330
  attachOpaqueData: AttachOpaqueData,
1298
- schemaName: string,
1331
+ schemaPath: string[] | string,
1299
1332
  name: string,
1300
1333
  macroType: MacroType,
1301
1334
  parameters: string[],
@@ -1305,22 +1338,10 @@ export class VgiClient {
1305
1338
  argumentsSchema?: Uint8Array | null,
1306
1339
  transactionOpaqueData?: TransactionOpaqueData,
1307
1340
  ): Promise<void> {
1308
- const schema = schema_([
1309
- field("attach_opaque_data", binary(), false),
1310
- field("schema_name", utf8(), false),
1311
- field("name", utf8(), false),
1312
- field("macro_type", utf8(), false),
1313
- field("parameters", list(field("item", utf8(), false)), false),
1314
- field("definition", utf8(), false),
1315
- field("on_conflict", utf8(), false),
1316
- field("parameter_default_values", binary(), true),
1317
- field("arguments_schema", binary(), true),
1318
- field("transaction_opaque_data", binary(), true),
1319
- ]);
1320
1341
  const innerBatch = batchFromColumns(
1321
1342
  {
1322
1343
  attach_opaque_data: [attachOpaqueData],
1323
- schema_name: [schemaName],
1344
+ schema_path: [normalizeSchemaPath(schemaPath)],
1324
1345
  name: [name],
1325
1346
  macro_type: [macroType],
1326
1347
  parameters: [parameters],
@@ -1330,7 +1351,7 @@ export class VgiClient {
1330
1351
  arguments_schema: [argumentsSchema ?? null],
1331
1352
  transaction_opaque_data: [transactionOpaqueData ?? null],
1332
1353
  },
1333
- schema,
1354
+ MacroCreateRequestSchema,
1334
1355
  );
1335
1356
  await this.rpc.call("catalog_macro_create", wrapRequest(innerBatch));
1336
1357
  }
@@ -1338,14 +1359,14 @@ export class VgiClient {
1338
1359
  /** Drop a macro by name. */
1339
1360
  async macroDrop(
1340
1361
  attachOpaqueData: AttachOpaqueData,
1341
- schemaName: string,
1362
+ schemaPath: string[] | string,
1342
1363
  name: string,
1343
1364
  ignoreNotFound?: boolean,
1344
1365
  transactionOpaqueData?: TransactionOpaqueData,
1345
1366
  ): Promise<void> {
1346
1367
  await this.rpc.call("catalog_macro_drop", {
1347
1368
  attach_opaque_data: attachOpaqueData,
1348
- schema_name: schemaName,
1369
+ schema_path: normalizeSchemaPath(schemaPath),
1349
1370
  name,
1350
1371
  ignore_not_found: ignoreNotFound ?? false,
1351
1372
  transaction_opaque_data: transactionOpaqueData ?? null,
@@ -1357,4 +1378,3 @@ export class VgiClient {
1357
1378
  this.rpc.close();
1358
1379
  }
1359
1380
  }
1360
-
@@ -48,6 +48,8 @@ export interface CatalogAttachOptions {
48
48
  optionsBytes?: Uint8Array;
49
49
  dataVersionSpec?: string | null;
50
50
  implementationVersion?: string | null;
51
+ /** Engine capabilities serialized into the protocol's named inner record. */
52
+ clientCapabilities?: import("../generated/vgi-client.js").ClientCapabilities | null;
51
53
  }
52
54
 
53
55
  /** Conflict resolution strategy for create operations. */
@@ -8,7 +8,7 @@
8
8
  //
9
9
  // Usage:
10
10
  // import { VgiClient, Arguments } from "vgi/client";
11
- // import { httpConnect } from "@query-farm/vgi-rpc"; // or your own RpcClient
11
+ // import { httpConnect } from "@query-farm/vgi-rpc"; // or VgiClient.fromIroh(...)
12
12
  //
13
13
  // const rpc = httpConnect("https://my-vgi-server/");
14
14
  // const client = new VgiClient(rpc);
@@ -37,6 +37,7 @@ export {
37
37
  FunctionType,
38
38
  FunctionStability,
39
39
  NullHandling,
40
+ ArgumentMonotonicity,
40
41
  OrderPreservation,
41
42
  OrderDependence,
42
43
  DistinctDependence,
@@ -0,0 +1,13 @@
1
+ // Copyright 2025, 2026 Query Farm LLC - https://query.farm
2
+
3
+ import type { FunctionIdentity } from "./types.js";
4
+
5
+ const SUPPORTED_EXTENSION_FUNCTIONS = new Set(["duckdb.spatial/intersects_extent@1"]);
6
+
7
+ export function filterFunctionIdentityKey(identity: FunctionIdentity): string {
8
+ return `${identity.namespace}/${identity.name}@${identity.version}`;
9
+ }
10
+
11
+ export function supportsExtensionFilterFunction(identity: FunctionIdentity): boolean {
12
+ return SUPPORTED_EXTENSION_FUNCTIONS.has(filterFunctionIdentityKey(identity));
13
+ }