@query-farm/vgi 0.28.0 → 0.29.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 (83) hide show
  1. package/README.md +26 -7
  2. package/dist/arguments/argument-spec.d.ts +53 -0
  3. package/dist/arrow/impl-arrowjs/index.d.ts +1 -1
  4. package/dist/arrow/impl-arrowjs/iterate.d.ts +10 -1
  5. package/dist/arrow/impl-arrowjs/schema.d.ts +2 -0
  6. package/dist/arrow/impl-flechette/index.d.ts +1 -1
  7. package/dist/arrow/impl-flechette/iterate.d.ts +10 -1
  8. package/dist/arrow/impl-flechette/schema.d.ts +2 -0
  9. package/dist/arrow/index.d.ts +1 -1
  10. package/dist/arrow/schema-types.d.ts +3 -1
  11. package/dist/arrow/types.d.ts +39 -3
  12. package/dist/catalog/interface.d.ts +43 -0
  13. package/dist/client/client.d.ts +1 -1
  14. package/dist/client-entry.js +360 -178
  15. package/dist/client-entry.js.map +14 -14
  16. package/dist/functions/table.d.ts +63 -0
  17. package/dist/functions/types.d.ts +38 -0
  18. package/dist/generated/vgi-client.d.ts +59 -0
  19. package/dist/generated/vgi-protocol-schemas.d.ts +19 -0
  20. package/dist/http/fetch.d.ts +10 -0
  21. package/dist/index.core.d.ts +2 -2
  22. package/dist/index.js +1203 -834
  23. package/dist/index.js.map +40 -37
  24. package/dist/protocol/handlers/catalog/shared.d.ts +0 -8
  25. package/dist/protocol/handlers/function.d.ts +11 -0
  26. package/dist/protocol/serializers/bind.d.ts +1 -2
  27. package/dist/protocol/serializers/cardinality.d.ts +1 -2
  28. package/dist/protocol/serializers/splits.d.ts +126 -0
  29. package/dist/protocol/types.d.ts +27 -0
  30. package/dist/request-auth.d.ts +28 -0
  31. package/dist/serve-entry.d.ts +4 -0
  32. package/dist/serve-entry.js +745 -359
  33. package/dist/serve-entry.js.map +32 -29
  34. package/dist/split-token.d.ts +88 -0
  35. package/dist/worker-cf-entry.js +1029 -619
  36. package/dist/worker-cf-entry.js.map +37 -34
  37. package/package.json +3 -3
  38. package/src/arguments/argument-spec.ts +81 -0
  39. package/src/arguments/arguments.ts +0 -1
  40. package/src/arrow/impl-arrowjs/index.ts +1 -1
  41. package/src/arrow/impl-arrowjs/iterate.ts +21 -0
  42. package/src/arrow/impl-arrowjs/schema.ts +4 -0
  43. package/src/arrow/impl-flechette/index.ts +1 -1
  44. package/src/arrow/impl-flechette/iterate.ts +24 -1
  45. package/src/arrow/impl-flechette/schema.ts +4 -0
  46. package/src/arrow/index.ts +1 -1
  47. package/src/arrow/schema-types.ts +4 -0
  48. package/src/arrow/types.ts +39 -3
  49. package/src/catalog/interface.ts +124 -29
  50. package/src/catalog/read-only.ts +18 -18
  51. package/src/client/client.ts +6 -2
  52. package/src/functions/aggregate.ts +3 -0
  53. package/src/functions/copy-from.ts +2 -1
  54. package/src/functions/copy-to.ts +2 -1
  55. package/src/functions/scalar.ts +11 -0
  56. package/src/functions/table-buffering.ts +3 -0
  57. package/src/functions/table-in-out.ts +8 -4
  58. package/src/functions/table.ts +129 -2
  59. package/src/functions/types.ts +40 -0
  60. package/src/generated/vgi-client.ts +63 -1
  61. package/src/generated/vgi-protocol-schemas.ts +240 -14
  62. package/src/http/fetch.ts +117 -2
  63. package/src/index.core.ts +2 -2
  64. package/src/protocol/handlers/aggregate.ts +10 -5
  65. package/src/protocol/handlers/catalog/admin.ts +41 -48
  66. package/src/protocol/handlers/catalog/index_methods.ts +4 -11
  67. package/src/protocol/handlers/catalog/macro.ts +8 -16
  68. package/src/protocol/handlers/catalog/shared.ts +10 -57
  69. package/src/protocol/handlers/catalog/table.ts +33 -96
  70. package/src/protocol/handlers/catalog/view.ts +13 -17
  71. package/src/protocol/handlers/function.ts +311 -18
  72. package/src/protocol/handlers/table-buffering.ts +7 -4
  73. package/src/protocol/serializers/bind.ts +56 -63
  74. package/src/protocol/serializers/cardinality.ts +7 -7
  75. package/src/protocol/serializers/init.ts +52 -10
  76. package/src/protocol/serializers/splits.ts +219 -0
  77. package/src/protocol/state-serializer.ts +55 -1
  78. package/src/protocol/types.ts +27 -0
  79. package/src/request-auth.ts +73 -0
  80. package/src/serve-entry.ts +5 -0
  81. package/src/split-token.ts +297 -0
  82. package/src/worker-cf-entry.ts +2 -1
  83. package/src/worker.ts +30 -10
@@ -7,16 +7,33 @@ import { Protocol, type CallContext } from "@query-farm/vgi-rpc";
7
7
  import { encodeSchemaInfo, encodeTableInfo, encodeViewInfo, encodeFunctionInfo, encodeCatalogInfo } from "../../../generated/vgi-client.js";
8
8
  import { encodeCopyFromFormatInfo } from "../../../catalog/interface.js";
9
9
  import {
10
- CatalogCatalogsResultSchema,
10
+ CatalogAttachParamsSchema,
11
11
  CatalogAttachResultSchema,
12
- CatalogVersionResultSchema,
13
- CatalogTransactionBeginResultSchema,
14
- CatalogSchemasResultSchema,
15
- CatalogSchemaGetResultSchema,
12
+ CatalogCatalogsParamsSchema,
13
+ CatalogCatalogsResultSchema,
14
+ CatalogCopyFromFormatsParamsSchema,
15
+ CatalogCopyFromFormatsResultSchema,
16
+ CatalogCreateParamsSchema,
17
+ CatalogDetachParamsSchema,
18
+ CatalogDropParamsSchema,
19
+ CatalogSchemaContentsFunctionsParamsSchema,
20
+ CatalogSchemaContentsFunctionsResultSchema,
21
+ CatalogSchemaContentsTablesParamsSchema,
16
22
  CatalogSchemaContentsTablesResultSchema,
23
+ CatalogSchemaContentsViewsParamsSchema,
17
24
  CatalogSchemaContentsViewsResultSchema,
18
- CatalogSchemaContentsFunctionsResultSchema,
19
- CatalogCopyFromFormatsResultSchema,
25
+ CatalogSchemaCreateParamsSchema,
26
+ CatalogSchemaDropParamsSchema,
27
+ CatalogSchemaGetParamsSchema,
28
+ CatalogSchemaGetResultSchema,
29
+ CatalogSchemasParamsSchema,
30
+ CatalogSchemasResultSchema,
31
+ CatalogTransactionBeginParamsSchema,
32
+ CatalogTransactionBeginResultSchema,
33
+ CatalogTransactionCommitParamsSchema,
34
+ CatalogTransactionRollbackParamsSchema,
35
+ CatalogVersionParamsSchema,
36
+ CatalogVersionResultSchema,
20
37
  } from "../../../generated/vgi-protocol-schemas.js";
21
38
  import { toUint8Array } from "../../../util/bytes.js";
22
39
  import { decodeDictValue } from "../../../util/arrow/index.js";
@@ -30,9 +47,6 @@ import {
30
47
  type GetCatalog,
31
48
  decodeOptionsBatch,
32
49
  emptyResultSchema,
33
- attachOpaqueDataParam,
34
- attachOpaqueDataTxnParams,
35
- attachOpaqueDataNameTxnParams,
36
50
  catalogUnary,
37
51
  sealAttach,
38
52
  openAttach,
@@ -42,7 +56,7 @@ import {
42
56
  export function registerCatalogAdminMethods(protocol: Protocol, getCatalog: GetCatalog, signingKey?: Uint8Array): void {
43
57
  // catalog_catalogs
44
58
  catalogUnary(protocol, signingKey, "catalog_catalogs", {
45
- params: emptyResultSchema,
59
+ params: CatalogCatalogsParamsSchema,
46
60
  result: RESULT_BINARY_SCHEMA,
47
61
  handler: async () => {
48
62
  const cat = getCatalog();
@@ -66,7 +80,7 @@ export function registerCatalogAdminMethods(protocol: Protocol, getCatalog: GetC
66
80
 
67
81
  // catalog_attach (params wrapped in request: Binary like bind/init)
68
82
  protocol.unary("catalog_attach", {
69
- params: REQUEST_PARAMS_SCHEMA,
83
+ params: CatalogAttachParamsSchema,
70
84
  result: RESULT_BINARY_SCHEMA,
71
85
  handler: async (params, ctx) => {
72
86
  const innerParams = unwrapRequest(params.request);
@@ -122,7 +136,7 @@ export function registerCatalogAdminMethods(protocol: Protocol, getCatalog: GetC
122
136
 
123
137
  // catalog_detach
124
138
  catalogUnary(protocol, signingKey, "catalog_detach", {
125
- params: attachOpaqueDataParam,
139
+ params: CatalogDetachParamsSchema,
126
140
  result: emptyResultSchema,
127
141
  handler: async (params) => {
128
142
  const cat = getCatalog();
@@ -133,11 +147,7 @@ export function registerCatalogAdminMethods(protocol: Protocol, getCatalog: GetC
133
147
 
134
148
  // catalog_create
135
149
  catalogUnary(protocol, signingKey, "catalog_create", {
136
- params: schema([
137
- field("name", utf8(), false),
138
- field("on_conflict", utf8(), false),
139
- field("options", binary(), true),
140
- ]),
150
+ params: CatalogCreateParamsSchema,
141
151
  result: emptyResultSchema,
142
152
  handler: async (params) => {
143
153
  const cat = getCatalog();
@@ -148,7 +158,7 @@ export function registerCatalogAdminMethods(protocol: Protocol, getCatalog: GetC
148
158
 
149
159
  // catalog_drop
150
160
  catalogUnary(protocol, signingKey, "catalog_drop", {
151
- params: schema([field("name", utf8(), false)]),
161
+ params: CatalogDropParamsSchema,
152
162
  result: emptyResultSchema,
153
163
  handler: async (params) => {
154
164
  const cat = getCatalog();
@@ -159,7 +169,7 @@ export function registerCatalogAdminMethods(protocol: Protocol, getCatalog: GetC
159
169
 
160
170
  // catalog_version
161
171
  catalogUnary(protocol, signingKey, "catalog_version", {
162
- params: attachOpaqueDataTxnParams,
172
+ params: CatalogVersionParamsSchema,
163
173
  result: RESULT_BINARY_SCHEMA,
164
174
  handler: async (params) => {
165
175
  const cat = getCatalog();
@@ -175,7 +185,7 @@ export function registerCatalogAdminMethods(protocol: Protocol, getCatalog: GetC
175
185
  // envelope to bind the transaction envelope's AAD, so it cannot route
176
186
  // through catalogUnary (which would replace it with plaintext).
177
187
  protocol.unary("catalog_transaction_begin", {
178
- params: attachOpaqueDataParam,
188
+ params: CatalogTransactionBeginParamsSchema,
179
189
  result: RESULT_BINARY_SCHEMA,
180
190
  handler: async (params, ctx) => {
181
191
  const auth = (ctx as CallContext | undefined)?.auth;
@@ -194,7 +204,7 @@ export function registerCatalogAdminMethods(protocol: Protocol, getCatalog: GetC
194
204
 
195
205
  // catalog_transaction_commit
196
206
  catalogUnary(protocol, signingKey, "catalog_transaction_commit", {
197
- params: attachOpaqueDataTxnParams,
207
+ params: CatalogTransactionCommitParamsSchema,
198
208
  result: emptyResultSchema,
199
209
  handler: async (params) => {
200
210
  const cat = getCatalog();
@@ -208,7 +218,7 @@ export function registerCatalogAdminMethods(protocol: Protocol, getCatalog: GetC
208
218
 
209
219
  // catalog_transaction_rollback
210
220
  catalogUnary(protocol, signingKey, "catalog_transaction_rollback", {
211
- params: attachOpaqueDataTxnParams,
221
+ params: CatalogTransactionRollbackParamsSchema,
212
222
  result: emptyResultSchema,
213
223
  handler: async (params) => {
214
224
  const cat = getCatalog();
@@ -222,7 +232,7 @@ export function registerCatalogAdminMethods(protocol: Protocol, getCatalog: GetC
222
232
 
223
233
  // catalog_schemas
224
234
  catalogUnary(protocol, signingKey, "catalog_schemas", {
225
- params: attachOpaqueDataTxnParams,
235
+ params: CatalogSchemasParamsSchema,
226
236
  result: RESULT_BINARY_SCHEMA,
227
237
  handler: async (params) => {
228
238
  const cat = getCatalog();
@@ -239,7 +249,7 @@ export function registerCatalogAdminMethods(protocol: Protocol, getCatalog: GetC
239
249
  // catalog_copy_from_formats — catalog-level (not schema-scoped). Lists the
240
250
  // custom COPY ... FROM formats this catalog advertises; empty list when none.
241
251
  catalogUnary(protocol, signingKey, "catalog_copy_from_formats", {
242
- params: attachOpaqueDataTxnParams,
252
+ params: CatalogCopyFromFormatsParamsSchema,
243
253
  result: RESULT_BINARY_SCHEMA,
244
254
  handler: async (params) => {
245
255
  const cat = getCatalog();
@@ -255,7 +265,7 @@ export function registerCatalogAdminMethods(protocol: Protocol, getCatalog: GetC
255
265
 
256
266
  // catalog_schema_get
257
267
  catalogUnary(protocol, signingKey, "catalog_schema_get", {
258
- params: attachOpaqueDataNameTxnParams,
268
+ params: CatalogSchemaGetParamsSchema,
259
269
  result: RESULT_BINARY_SCHEMA,
260
270
  handler: async (params) => {
261
271
  const cat = getCatalog();
@@ -272,13 +282,7 @@ export function registerCatalogAdminMethods(protocol: Protocol, getCatalog: GetC
272
282
 
273
283
  // catalog_schema_create
274
284
  catalogUnary(protocol, signingKey, "catalog_schema_create", {
275
- params: schema([
276
- field("attach_opaque_data", binary(), true),
277
- field("name", utf8(), false),
278
- field("comment", utf8(), true),
279
- field("tags", binary(), true),
280
- field("transaction_opaque_data", binary(), true),
281
- ]),
285
+ params: CatalogSchemaCreateParamsSchema,
282
286
  result: emptyResultSchema,
283
287
  handler: async (params) => {
284
288
  const cat = getCatalog();
@@ -295,13 +299,7 @@ export function registerCatalogAdminMethods(protocol: Protocol, getCatalog: GetC
295
299
 
296
300
  // catalog_schema_drop
297
301
  catalogUnary(protocol, signingKey, "catalog_schema_drop", {
298
- params: schema([
299
- field("attach_opaque_data", binary(), true),
300
- field("name", utf8(), false),
301
- field("ignore_not_found", bool(), true),
302
- field("cascade", bool(), true),
303
- field("transaction_opaque_data", binary(), true),
304
- ]),
302
+ params: CatalogSchemaDropParamsSchema,
305
303
  result: emptyResultSchema,
306
304
  handler: async (params) => {
307
305
  const cat = getCatalog();
@@ -318,7 +316,7 @@ export function registerCatalogAdminMethods(protocol: Protocol, getCatalog: GetC
318
316
 
319
317
  // catalog_schema_contents_tables
320
318
  catalogUnary(protocol, signingKey, "catalog_schema_contents_tables", {
321
- params: attachOpaqueDataNameTxnParams,
319
+ params: CatalogSchemaContentsTablesParamsSchema,
322
320
  result: RESULT_BINARY_SCHEMA,
323
321
  handler: async (params) => {
324
322
  const cat = getCatalog();
@@ -335,7 +333,7 @@ export function registerCatalogAdminMethods(protocol: Protocol, getCatalog: GetC
335
333
 
336
334
  // catalog_schema_contents_views
337
335
  catalogUnary(protocol, signingKey, "catalog_schema_contents_views", {
338
- params: attachOpaqueDataNameTxnParams,
336
+ params: CatalogSchemaContentsViewsParamsSchema,
339
337
  result: RESULT_BINARY_SCHEMA,
340
338
  handler: async (params) => {
341
339
  const cat = getCatalog();
@@ -352,12 +350,7 @@ export function registerCatalogAdminMethods(protocol: Protocol, getCatalog: GetC
352
350
 
353
351
  // catalog_schema_contents_functions
354
352
  catalogUnary(protocol, signingKey, "catalog_schema_contents_functions", {
355
- params: schema([
356
- field("attach_opaque_data", binary(), true),
357
- field("name", utf8(), false),
358
- field("type", utf8(), false),
359
- field("transaction_opaque_data", binary(), true),
360
- ]),
353
+ params: CatalogSchemaContentsFunctionsParamsSchema,
361
354
  result: RESULT_BINARY_SCHEMA,
362
355
  handler: async (params) => {
363
356
  const cat = getCatalog();
@@ -5,7 +5,9 @@ import { type VgiSchema, schema, type VgiField, field, type VgiDataType, binary,
5
5
  import { Protocol } from "@query-farm/vgi-rpc";
6
6
  import { encodeIndexInfo } from "../../../generated/vgi-client.js";
7
7
  import {
8
+ CatalogIndexGetParamsSchema,
8
9
  CatalogIndexGetResultSchema,
10
+ CatalogSchemaContentsIndexesParamsSchema,
9
11
  CatalogSchemaContentsIndexesResultSchema,
10
12
  } from "../../../generated/vgi-protocol-schemas.js";
11
13
  import { toUint8Array } from "../../../util/bytes.js";
@@ -21,11 +23,7 @@ import {
21
23
  export function registerCatalogIndexMethods(protocol: Protocol, getCatalog: GetCatalog, signingKey?: Uint8Array): void {
22
24
  // catalog_schema_contents_indexes
23
25
  catalogUnary(protocol, signingKey, "catalog_schema_contents_indexes", {
24
- params: schema([
25
- field("attach_opaque_data", binary(), true),
26
- field("name", utf8(), false),
27
- field("transaction_opaque_data", binary(), true),
28
- ]),
26
+ params: CatalogSchemaContentsIndexesParamsSchema,
29
27
  result: RESULT_BINARY_SCHEMA,
30
28
  handler: async (params) => {
31
29
  const cat = getCatalog();
@@ -42,12 +40,7 @@ export function registerCatalogIndexMethods(protocol: Protocol, getCatalog: GetC
42
40
 
43
41
  // catalog_index_get
44
42
  catalogUnary(protocol, signingKey, "catalog_index_get", {
45
- params: schema([
46
- field("attach_opaque_data", binary(), true),
47
- field("schema_name", utf8(), false),
48
- field("name", utf8(), false),
49
- field("transaction_opaque_data", binary(), true),
50
- ]),
43
+ params: CatalogIndexGetParamsSchema,
51
44
  result: RESULT_BINARY_SCHEMA,
52
45
  handler: async (params) => {
53
46
  const cat = getCatalog();
@@ -5,7 +5,11 @@ import { type VgiSchema, schema, type VgiField, field, type VgiDataType, binary,
5
5
  import { Protocol } from "@query-farm/vgi-rpc";
6
6
  import { encodeMacroInfo } from "../../../generated/vgi-client.js";
7
7
  import {
8
+ CatalogMacroCreateParamsSchema,
9
+ CatalogMacroDropParamsSchema,
10
+ CatalogMacroGetParamsSchema,
8
11
  CatalogMacroGetResultSchema,
12
+ CatalogSchemaContentsMacrosParamsSchema,
9
13
  CatalogSchemaContentsMacrosResultSchema,
10
14
  } from "../../../generated/vgi-protocol-schemas.js";
11
15
  import type { MacroType } from "../../../catalog/interface.js";
@@ -20,14 +24,13 @@ import {
20
24
  import {
21
25
  type GetCatalog,
22
26
  emptyResultSchema,
23
- attachOpaqueDataSchemaNameTxnParams,
24
27
  catalogUnary,
25
28
  } from "./shared.js";
26
29
 
27
30
  export function registerCatalogMacroMethods(protocol: Protocol, getCatalog: GetCatalog, signingKey?: Uint8Array): void {
28
31
  // catalog_macro_get
29
32
  catalogUnary(protocol, signingKey, "catalog_macro_get", {
30
- params: attachOpaqueDataSchemaNameTxnParams,
33
+ params: CatalogMacroGetParamsSchema,
31
34
  result: RESULT_BINARY_SCHEMA,
32
35
  handler: async (params) => {
33
36
  const cat = getCatalog();
@@ -45,7 +48,7 @@ export function registerCatalogMacroMethods(protocol: Protocol, getCatalog: GetC
45
48
 
46
49
  // catalog_macro_create
47
50
  catalogUnary(protocol, signingKey, "catalog_macro_create", {
48
- params: REQUEST_PARAMS_SCHEMA,
51
+ params: CatalogMacroCreateParamsSchema,
49
52
  result: emptyResultSchema,
50
53
  handler: async (params) => {
51
54
  const cat = getCatalog();
@@ -68,13 +71,7 @@ export function registerCatalogMacroMethods(protocol: Protocol, getCatalog: GetC
68
71
 
69
72
  // catalog_macro_drop
70
73
  catalogUnary(protocol, signingKey, "catalog_macro_drop", {
71
- params: schema([
72
- field("attach_opaque_data", binary(), true),
73
- field("schema_name", utf8(), false),
74
- field("name", utf8(), false),
75
- field("ignore_not_found", bool(), true),
76
- field("transaction_opaque_data", binary(), true),
77
- ]),
74
+ params: CatalogMacroDropParamsSchema,
78
75
  result: emptyResultSchema,
79
76
  handler: async (params) => {
80
77
  const cat = getCatalog();
@@ -91,12 +88,7 @@ export function registerCatalogMacroMethods(protocol: Protocol, getCatalog: GetC
91
88
 
92
89
  // catalog_schema_contents_macros
93
90
  catalogUnary(protocol, signingKey, "catalog_schema_contents_macros", {
94
- params: schema([
95
- field("attach_opaque_data", binary(), true),
96
- field("name", utf8(), false),
97
- field("type", utf8(), false),
98
- field("transaction_opaque_data", binary(), true),
99
- ]),
91
+ params: CatalogSchemaContentsMacrosParamsSchema,
100
92
  result: RESULT_BINARY_SCHEMA,
101
93
  handler: async (params) => {
102
94
  const cat = getCatalog();
@@ -1,7 +1,7 @@
1
1
  // Copyright 2025, 2026 Query Farm LLC - https://query.farm
2
2
  // Shared param schemas and helpers for catalog protocol handlers.
3
3
 
4
- import { type VgiSchema, schema, type VgiField, field, type VgiDataType, binary, utf8, bool, iterRows } from "../../../arrow/index.js";
4
+ import { type VgiSchema, schema, iterRows } from "../../../arrow/index.js";
5
5
  import { Protocol, type AuthContext, type CallContext } from "@query-farm/vgi-rpc";
6
6
  import type { CatalogInterface } from "../../../catalog/interface.js";
7
7
  import { NoCatalogError } from "../../../errors.js";
@@ -233,59 +233,12 @@ export function decodeOptionsBatch(bytes: any): Record<string, unknown> {
233
233
 
234
234
  export const emptyResultSchema = schema([]);
235
235
 
236
- export const attachOpaqueDataParam = schema([
237
- field("attach_opaque_data", binary(), true),
238
- ]);
239
-
240
- export const attachOpaqueDataTxnParams = schema([
241
- field("attach_opaque_data", binary(), true),
242
- field("transaction_opaque_data", binary(), true),
243
- ]);
244
-
245
- export const attachOpaqueDataNameTxnParams = schema([
246
- field("attach_opaque_data", binary(), true),
247
- field("name", utf8(), false),
248
- field("transaction_opaque_data", binary(), true),
249
- ]);
250
-
251
- export const attachOpaqueDataSchemaNameTxnParams = schema([
252
- field("attach_opaque_data", binary(), true),
253
- field("schema_name", utf8(), false),
254
- field("name", utf8(), false),
255
- field("transaction_opaque_data", binary(), true),
256
- ]);
257
-
258
- export const schemaNameIgnoreNotFoundTxnParams = schema([
259
- field("attach_opaque_data", binary(), true),
260
- field("schema_name", utf8(), false),
261
- field("name", utf8(), false),
262
- field("ignore_not_found", bool(), true),
263
- field("transaction_opaque_data", binary(), true),
264
- ]);
265
-
266
- export const schemaNameCommentParams = schema([
267
- field("attach_opaque_data", binary(), true),
268
- field("schema_name", utf8(), false),
269
- field("name", utf8(), false),
270
- field("comment", utf8(), true),
271
- field("ignore_not_found", bool(), true),
272
- field("transaction_opaque_data", binary(), true),
273
- ]);
274
-
275
- export const schemaNameRenameParams = schema([
276
- field("attach_opaque_data", binary(), true),
277
- field("schema_name", utf8(), false),
278
- field("name", utf8(), false),
279
- field("new_name", utf8(), false),
280
- field("ignore_not_found", bool(), true),
281
- field("transaction_opaque_data", binary(), true),
282
- ]);
283
-
284
- export const columnOpParams = schema([
285
- field("attach_opaque_data", binary(), true),
286
- field("schema_name", utf8(), false),
287
- field("name", utf8(), false),
288
- field("column_name", utf8(), false),
289
- field("ignore_not_found", bool(), true),
290
- field("transaction_opaque_data", binary(), true),
291
- ]);
236
+ // Eight hand-written catalog param schemas used to live here, restating shapes
237
+ // codegen already emits. Every `params:` slot now points at a generated
238
+ // `…ParamsSchema` and these were left behind, referenced by nothing but their
239
+ // own import lines. A stale duplicate is worse than no duplicate: the copies
240
+ // this SDK kept had drifted on `attach_opaque_data` nullability (45 generated
241
+ // schemas say non-null, every copy said nullable) and on `type` being
242
+ // dictionary-encoded utf8 rather than plain utf8, and the result was that a
243
+ // CORRECT client got rejected at the very first catalog call. Import from
244
+ // src/generated/vgi-protocol-schemas.ts instead of reviving one.
@@ -6,9 +6,25 @@ import { type VgiSchema, schema, type VgiField, field, type VgiDataType, binary,
6
6
  import { Protocol } from "@query-farm/vgi-rpc";
7
7
  import { encodeTableInfo } from "../../../generated/vgi-client.js";
8
8
  import {
9
+ CatalogTableColumnAddParamsSchema,
10
+ CatalogTableColumnDefaultDropParamsSchema,
11
+ CatalogTableColumnDefaultSetParamsSchema,
12
+ CatalogTableColumnDropParamsSchema,
13
+ CatalogTableColumnRenameParamsSchema,
14
+ CatalogTableColumnStatisticsGetParamsSchema,
15
+ CatalogTableColumnTypeChangeParamsSchema,
16
+ CatalogTableCommentSetParamsSchema,
17
+ CatalogTableCreateParamsSchema,
18
+ CatalogTableDropParamsSchema,
19
+ CatalogTableGetParamsSchema,
9
20
  CatalogTableGetResultSchema,
10
- ScanFunctionResultSchema,
21
+ CatalogTableNotNullDropParamsSchema,
22
+ CatalogTableNotNullSetParamsSchema,
23
+ CatalogTableRenameParamsSchema,
24
+ CatalogTableScanBranchesGetParamsSchema,
25
+ CatalogTableScanFunctionGetParamsSchema,
11
26
  ScanBranchesResultSchema,
27
+ ScanFunctionResultSchema,
12
28
  } from "../../../generated/vgi-protocol-schemas.js";
13
29
  import { toUint8Array } from "../../../util/bytes.js";
14
30
  import {
@@ -19,24 +35,13 @@ import {
19
35
  import {
20
36
  type GetCatalog,
21
37
  emptyResultSchema,
22
- schemaNameIgnoreNotFoundTxnParams,
23
- schemaNameCommentParams,
24
- schemaNameRenameParams,
25
- columnOpParams,
26
38
  catalogUnary,
27
39
  } from "./shared.js";
28
40
 
29
41
  export function registerCatalogTableMethods(protocol: Protocol, getCatalog: GetCatalog, signingKey?: Uint8Array): void {
30
42
  // catalog_table_get
31
43
  catalogUnary(protocol, signingKey, "catalog_table_get", {
32
- params: schema([
33
- field("attach_opaque_data", binary(), true),
34
- field("schema_name", utf8(), false),
35
- field("name", utf8(), false),
36
- field("at_unit", utf8(), true),
37
- field("at_value", utf8(), true),
38
- field("transaction_opaque_data", binary(), true),
39
- ]),
44
+ params: CatalogTableGetParamsSchema,
40
45
  result: RESULT_BINARY_SCHEMA,
41
46
  handler: async (params) => {
42
47
  const cat = getCatalog();
@@ -56,17 +61,7 @@ export function registerCatalogTableMethods(protocol: Protocol, getCatalog: GetC
56
61
 
57
62
  // catalog_table_create
58
63
  catalogUnary(protocol, signingKey, "catalog_table_create", {
59
- params: schema([
60
- field("attach_opaque_data", binary(), true),
61
- field("schema_name", utf8(), false),
62
- field("name", utf8(), false),
63
- field("columns", binary(), false),
64
- field("on_conflict", utf8(), false),
65
- field("not_null_constraints", list(field("item", int32(), false)), true),
66
- field("unique_constraints", list(field("item", list(field("item", int32(), false)), false)), true),
67
- field("check_constraints", list(field("item", utf8(), false)), true),
68
- field("transaction_opaque_data", binary(), true),
69
- ]),
64
+ params: CatalogTableCreateParamsSchema,
70
65
  result: emptyResultSchema,
71
66
  handler: async (params) => {
72
67
  const cat = getCatalog();
@@ -87,13 +82,7 @@ export function registerCatalogTableMethods(protocol: Protocol, getCatalog: GetC
87
82
 
88
83
  // catalog_table_drop
89
84
  catalogUnary(protocol, signingKey, "catalog_table_drop", {
90
- params: schema([
91
- field("attach_opaque_data", binary(), true),
92
- field("schema_name", utf8(), false),
93
- field("name", utf8(), false),
94
- field("ignore_not_found", bool(), true),
95
- field("transaction_opaque_data", binary(), true),
96
- ]),
85
+ params: CatalogTableDropParamsSchema,
97
86
  result: emptyResultSchema,
98
87
  handler: async (params) => {
99
88
  const cat = getCatalog();
@@ -110,12 +99,7 @@ export function registerCatalogTableMethods(protocol: Protocol, getCatalog: GetC
110
99
 
111
100
  // catalog_table_column_statistics_get
112
101
  catalogUnary(protocol, signingKey, "catalog_table_column_statistics_get", {
113
- params: schema([
114
- field("attach_opaque_data", binary(), true),
115
- field("schema_name", utf8(), false),
116
- field("name", utf8(), false),
117
- field("transaction_opaque_data", binary(), true),
118
- ]),
102
+ params: CatalogTableColumnStatisticsGetParamsSchema,
119
103
  result: RESULT_BINARY_NULLABLE_SCHEMA,
120
104
  handler: async (params) => {
121
105
  const cat = getCatalog();
@@ -131,14 +115,7 @@ export function registerCatalogTableMethods(protocol: Protocol, getCatalog: GetC
131
115
 
132
116
  // catalog_table_scan_function_get
133
117
  catalogUnary(protocol, signingKey, "catalog_table_scan_function_get", {
134
- params: schema([
135
- field("attach_opaque_data", binary(), true),
136
- field("schema_name", utf8(), false),
137
- field("name", utf8(), false),
138
- field("at_unit", utf8(), true),
139
- field("at_value", utf8(), true),
140
- field("transaction_opaque_data", binary(), true),
141
- ]),
118
+ params: CatalogTableScanFunctionGetParamsSchema,
142
119
  result: RESULT_BINARY_SCHEMA,
143
120
  handler: async (params) => {
144
121
  const cat = getCatalog();
@@ -158,14 +135,7 @@ export function registerCatalogTableMethods(protocol: Protocol, getCatalog: GetC
158
135
  // scan_function_get. The branches-aware C++ extension calls this for every
159
136
  // table scan; single-source catalogs synthesise a one-branch result.
160
137
  catalogUnary(protocol, signingKey, "catalog_table_scan_branches_get", {
161
- params: schema([
162
- field("attach_opaque_data", binary(), true),
163
- field("schema_name", utf8(), false),
164
- field("name", utf8(), false),
165
- field("at_unit", utf8(), true),
166
- field("at_value", utf8(), true),
167
- field("transaction_opaque_data", binary(), true),
168
- ]),
138
+ params: CatalogTableScanBranchesGetParamsSchema,
169
139
  result: RESULT_BINARY_SCHEMA,
170
140
  handler: async (params) => {
171
141
  const cat = getCatalog();
@@ -183,7 +153,7 @@ export function registerCatalogTableMethods(protocol: Protocol, getCatalog: GetC
183
153
 
184
154
  // catalog_table_comment_set
185
155
  catalogUnary(protocol, signingKey, "catalog_table_comment_set", {
186
- params: schemaNameCommentParams,
156
+ params: CatalogTableCommentSetParamsSchema,
187
157
  result: emptyResultSchema,
188
158
  handler: async (params) => {
189
159
  const cat = getCatalog();
@@ -201,7 +171,7 @@ export function registerCatalogTableMethods(protocol: Protocol, getCatalog: GetC
201
171
 
202
172
  // catalog_table_rename
203
173
  catalogUnary(protocol, signingKey, "catalog_table_rename", {
204
- params: schemaNameRenameParams,
174
+ params: CatalogTableRenameParamsSchema,
205
175
  result: emptyResultSchema,
206
176
  handler: async (params) => {
207
177
  const cat = getCatalog();
@@ -219,16 +189,7 @@ export function registerCatalogTableMethods(protocol: Protocol, getCatalog: GetC
219
189
 
220
190
  // catalog_table_column_add
221
191
  catalogUnary(protocol, signingKey, "catalog_table_column_add", {
222
- params: schema([
223
- field("attach_opaque_data", binary(), true),
224
- field("schema_name", utf8(), false),
225
- field("name", utf8(), false),
226
- field("column_name", utf8(), false),
227
- field("column_type", utf8(), false),
228
- field("default_value", utf8(), true),
229
- field("ignore_not_found", bool(), true),
230
- field("transaction_opaque_data", binary(), true),
231
- ]),
192
+ params: CatalogTableColumnAddParamsSchema,
232
193
  result: emptyResultSchema,
233
194
  handler: async (params) => {
234
195
  const cat = getCatalog();
@@ -248,7 +209,7 @@ export function registerCatalogTableMethods(protocol: Protocol, getCatalog: GetC
248
209
 
249
210
  // catalog_table_column_drop
250
211
  catalogUnary(protocol, signingKey, "catalog_table_column_drop", {
251
- params: columnOpParams,
212
+ params: CatalogTableColumnDropParamsSchema,
252
213
  result: emptyResultSchema,
253
214
  handler: async (params) => {
254
215
  const cat = getCatalog();
@@ -266,15 +227,7 @@ export function registerCatalogTableMethods(protocol: Protocol, getCatalog: GetC
266
227
 
267
228
  // catalog_table_column_rename
268
229
  catalogUnary(protocol, signingKey, "catalog_table_column_rename", {
269
- params: schema([
270
- field("attach_opaque_data", binary(), true),
271
- field("schema_name", utf8(), false),
272
- field("name", utf8(), false),
273
- field("column_name", utf8(), false),
274
- field("new_name", utf8(), false),
275
- field("ignore_not_found", bool(), true),
276
- field("transaction_opaque_data", binary(), true),
277
- ]),
230
+ params: CatalogTableColumnRenameParamsSchema,
278
231
  result: emptyResultSchema,
279
232
  handler: async (params) => {
280
233
  const cat = getCatalog();
@@ -293,15 +246,7 @@ export function registerCatalogTableMethods(protocol: Protocol, getCatalog: GetC
293
246
 
294
247
  // catalog_table_column_default_set
295
248
  catalogUnary(protocol, signingKey, "catalog_table_column_default_set", {
296
- params: schema([
297
- field("attach_opaque_data", binary(), true),
298
- field("schema_name", utf8(), false),
299
- field("name", utf8(), false),
300
- field("column_name", utf8(), false),
301
- field("default_value", utf8(), false),
302
- field("ignore_not_found", bool(), true),
303
- field("transaction_opaque_data", binary(), true),
304
- ]),
249
+ params: CatalogTableColumnDefaultSetParamsSchema,
305
250
  result: emptyResultSchema,
306
251
  handler: async (params) => {
307
252
  const cat = getCatalog();
@@ -320,7 +265,7 @@ export function registerCatalogTableMethods(protocol: Protocol, getCatalog: GetC
320
265
 
321
266
  // catalog_table_column_default_drop
322
267
  catalogUnary(protocol, signingKey, "catalog_table_column_default_drop", {
323
- params: columnOpParams,
268
+ params: CatalogTableColumnDefaultDropParamsSchema,
324
269
  result: emptyResultSchema,
325
270
  handler: async (params) => {
326
271
  const cat = getCatalog();
@@ -338,15 +283,7 @@ export function registerCatalogTableMethods(protocol: Protocol, getCatalog: GetC
338
283
 
339
284
  // catalog_table_column_type_change
340
285
  catalogUnary(protocol, signingKey, "catalog_table_column_type_change", {
341
- params: schema([
342
- field("attach_opaque_data", binary(), true),
343
- field("schema_name", utf8(), false),
344
- field("name", utf8(), false),
345
- field("column_name", utf8(), false),
346
- field("new_type", utf8(), false),
347
- field("ignore_not_found", bool(), true),
348
- field("transaction_opaque_data", binary(), true),
349
- ]),
286
+ params: CatalogTableColumnTypeChangeParamsSchema,
350
287
  result: emptyResultSchema,
351
288
  handler: async (params) => {
352
289
  const cat = getCatalog();
@@ -365,7 +302,7 @@ export function registerCatalogTableMethods(protocol: Protocol, getCatalog: GetC
365
302
 
366
303
  // catalog_table_not_null_set
367
304
  catalogUnary(protocol, signingKey, "catalog_table_not_null_set", {
368
- params: columnOpParams,
305
+ params: CatalogTableNotNullSetParamsSchema,
369
306
  result: emptyResultSchema,
370
307
  handler: async (params) => {
371
308
  const cat = getCatalog();
@@ -383,7 +320,7 @@ export function registerCatalogTableMethods(protocol: Protocol, getCatalog: GetC
383
320
 
384
321
  // catalog_table_not_null_drop
385
322
  catalogUnary(protocol, signingKey, "catalog_table_not_null_drop", {
386
- params: columnOpParams,
323
+ params: CatalogTableNotNullDropParamsSchema,
387
324
  result: emptyResultSchema,
388
325
  handler: async (params) => {
389
326
  const cat = getCatalog();