@query-farm/vgi 0.28.0 → 0.29.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (121) hide show
  1. package/README.md +52 -8
  2. package/dist/arguments/argument-spec.d.ts +57 -2
  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/composite.d.ts +13 -13
  13. package/dist/catalog/descriptors.d.ts +7 -3
  14. package/dist/catalog/interface.d.ts +108 -38
  15. package/dist/catalog/read-only.d.ts +32 -15
  16. package/dist/client/client.d.ts +37 -30
  17. package/dist/client/types.d.ts +2 -0
  18. package/dist/client-entry.d.ts +1 -1
  19. package/dist/client-entry.js +791 -447
  20. package/dist/client-entry.js.map +18 -17
  21. package/dist/filter-pushdown/capabilities.d.ts +3 -0
  22. package/dist/filter-pushdown/deserialize.d.ts +14 -15
  23. package/dist/filter-pushdown/evaluate.d.ts +14 -44
  24. package/dist/filter-pushdown/index.d.ts +2 -2
  25. package/dist/filter-pushdown/types.d.ts +120 -68
  26. package/dist/functions/aggregate.d.ts +4 -0
  27. package/dist/functions/registry.d.ts +5 -5
  28. package/dist/functions/scalar.d.ts +6 -1
  29. package/dist/functions/table-buffering.d.ts +9 -0
  30. package/dist/functions/table-in-out.d.ts +13 -0
  31. package/dist/functions/table.d.ts +72 -2
  32. package/dist/functions/types.d.ts +60 -2
  33. package/dist/generated/vgi-client.d.ts +114 -26
  34. package/dist/generated/vgi-protocol-schemas.d.ts +34 -0
  35. package/dist/http/fetch.d.ts +16 -0
  36. package/dist/index.core.d.ts +4 -3
  37. package/dist/index.js +3396 -2064
  38. package/dist/index.js.map +55 -49
  39. package/dist/metadata/types.d.ts +15 -2
  40. package/dist/protocol/handlers/catalog/shared.d.ts +0 -8
  41. package/dist/protocol/handlers/function.d.ts +11 -0
  42. package/dist/protocol/handlers/shared.d.ts +3 -1
  43. package/dist/protocol/serializers/bind.d.ts +1 -2
  44. package/dist/protocol/serializers/cardinality.d.ts +1 -2
  45. package/dist/protocol/serializers/splits.d.ts +126 -0
  46. package/dist/protocol/types.d.ts +36 -3
  47. package/dist/request-auth.d.ts +28 -0
  48. package/dist/schema-path.d.ts +7 -0
  49. package/dist/serve-entry.d.ts +25 -0
  50. package/dist/serve-entry.js +1129 -569
  51. package/dist/serve-entry.js.map +36 -32
  52. package/dist/split-token.d.ts +88 -0
  53. package/dist/types.d.ts +8 -0
  54. package/dist/worker-cf-entry.js +2928 -1689
  55. package/dist/worker-cf-entry.js.map +51 -44
  56. package/dist/worker.d.ts +1 -1
  57. package/package.json +3 -3
  58. package/src/arguments/argument-spec.ts +93 -4
  59. package/src/arguments/arguments.ts +0 -1
  60. package/src/arrow/impl-arrowjs/index.ts +1 -1
  61. package/src/arrow/impl-arrowjs/iterate.ts +21 -0
  62. package/src/arrow/impl-arrowjs/schema.ts +4 -0
  63. package/src/arrow/impl-flechette/index.ts +1 -1
  64. package/src/arrow/impl-flechette/iterate.ts +24 -1
  65. package/src/arrow/impl-flechette/schema.ts +4 -0
  66. package/src/arrow/index.ts +1 -1
  67. package/src/arrow/schema-types.ts +4 -0
  68. package/src/arrow/types.ts +39 -3
  69. package/src/catalog/composite.ts +26 -26
  70. package/src/catalog/descriptors.ts +12 -3
  71. package/src/catalog/interface.ts +217 -72
  72. package/src/catalog/read-only.ts +141 -84
  73. package/src/client/client.ts +97 -73
  74. package/src/client/types.ts +2 -0
  75. package/src/client-entry.ts +2 -1
  76. package/src/filter-pushdown/capabilities.ts +13 -0
  77. package/src/filter-pushdown/collector.ts +22 -35
  78. package/src/filter-pushdown/deserialize.ts +657 -221
  79. package/src/filter-pushdown/evaluate.ts +410 -499
  80. package/src/filter-pushdown/index.ts +16 -2
  81. package/src/filter-pushdown/types.ts +88 -71
  82. package/src/functions/aggregate.ts +12 -1
  83. package/src/functions/copy-from.ts +2 -1
  84. package/src/functions/copy-to.ts +2 -1
  85. package/src/functions/registry.ts +24 -22
  86. package/src/functions/scalar.ts +37 -0
  87. package/src/functions/table-buffering.ts +48 -6
  88. package/src/functions/table-in-out.ts +194 -33
  89. package/src/functions/table.ts +187 -22
  90. package/src/functions/types.ts +64 -1
  91. package/src/generated/vgi-client.ts +122 -28
  92. package/src/generated/vgi-protocol-schemas.ts +455 -58
  93. package/src/http/fetch.ts +129 -2
  94. package/src/index.core.ts +4 -2
  95. package/src/metadata/resolve.ts +43 -1
  96. package/src/metadata/serialize.ts +43 -5
  97. package/src/metadata/types.ts +17 -1
  98. package/src/protocol/dispatch.ts +1 -1
  99. package/src/protocol/handlers/aggregate.ts +23 -12
  100. package/src/protocol/handlers/catalog/admin.ts +47 -54
  101. package/src/protocol/handlers/catalog/index_methods.ts +6 -13
  102. package/src/protocol/handlers/catalog/macro.ts +12 -20
  103. package/src/protocol/handlers/catalog/shared.ts +12 -57
  104. package/src/protocol/handlers/catalog/table.ts +49 -112
  105. package/src/protocol/handlers/catalog/view.ts +18 -22
  106. package/src/protocol/handlers/function.ts +311 -18
  107. package/src/protocol/handlers/shared.ts +12 -3
  108. package/src/protocol/handlers/table-buffering.ts +11 -8
  109. package/src/protocol/serializers/bind.ts +69 -67
  110. package/src/protocol/serializers/cardinality.ts +7 -7
  111. package/src/protocol/serializers/init.ts +52 -10
  112. package/src/protocol/serializers/splits.ts +221 -0
  113. package/src/protocol/state-serializer.ts +55 -1
  114. package/src/protocol/types.ts +36 -3
  115. package/src/request-auth.ts +73 -0
  116. package/src/schema-path.ts +25 -0
  117. package/src/serve-entry.ts +69 -2
  118. package/src/split-token.ts +297 -0
  119. package/src/types.ts +9 -0
  120. package/src/worker-cf-entry.ts +2 -1
  121. package/src/worker.ts +79 -14
@@ -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,13 +265,13 @@ 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();
262
272
  const info = await cat.schemaGet(
263
273
  toUint8Array(params.attach_opaque_data),
264
- params.name,
274
+ params.path,
265
275
  params.transaction_opaque_data ? toUint8Array(params.transaction_opaque_data) : undefined
266
276
  );
267
277
  return wrapResult({
@@ -272,19 +282,13 @@ 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();
285
289
  await cat.schemaCreate(
286
290
  toUint8Array(params.attach_opaque_data),
287
- params.name,
291
+ params.path,
288
292
  params.comment,
289
293
  null, // tags
290
294
  params.transaction_opaque_data ? toUint8Array(params.transaction_opaque_data) : undefined
@@ -295,19 +299,13 @@ 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();
308
306
  await cat.schemaDrop(
309
307
  toUint8Array(params.attach_opaque_data),
310
- params.name,
308
+ params.path,
311
309
  params.ignore_not_found,
312
310
  params.cascade,
313
311
  params.transaction_opaque_data ? toUint8Array(params.transaction_opaque_data) : undefined
@@ -318,13 +316,13 @@ 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();
325
323
  const tables = await cat.schemaContentsTables(
326
324
  toUint8Array(params.attach_opaque_data),
327
- params.name,
325
+ params.path,
328
326
  params.transaction_opaque_data ? toUint8Array(params.transaction_opaque_data) : undefined
329
327
  );
330
328
  return wrapResult({
@@ -335,13 +333,13 @@ 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();
342
340
  const views = await cat.schemaContentsViews(
343
341
  toUint8Array(params.attach_opaque_data),
344
- params.name,
342
+ params.path,
345
343
  params.transaction_opaque_data ? toUint8Array(params.transaction_opaque_data) : undefined
346
344
  );
347
345
  return wrapResult({
@@ -352,18 +350,13 @@ 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();
364
357
  const funcs = await cat.schemaContentsFunctions(
365
358
  toUint8Array(params.attach_opaque_data),
366
- params.name,
359
+ params.path,
367
360
  decodeDictValue(params.type),
368
361
  params.transaction_opaque_data ? toUint8Array(params.transaction_opaque_data) : undefined
369
362
  );
@@ -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,17 +23,13 @@ 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();
32
30
  const indexes = await cat.schemaContentsIndexes(
33
31
  toUint8Array(params.attach_opaque_data),
34
- params.name,
32
+ params.path,
35
33
  params.transaction_opaque_data ? toUint8Array(params.transaction_opaque_data) : undefined,
36
34
  );
37
35
  return wrapResult({
@@ -42,18 +40,13 @@ 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();
54
47
  const info = await cat.indexGet(
55
48
  toUint8Array(params.attach_opaque_data),
56
- params.schema_name,
49
+ params.schema_path,
57
50
  params.name,
58
51
  params.transaction_opaque_data ? toUint8Array(params.transaction_opaque_data) : undefined,
59
52
  );
@@ -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,20 +24,19 @@ 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();
34
37
  const info = await cat.macroGet(
35
38
  toUint8Array(params.attach_opaque_data),
36
- params.schema_name,
39
+ params.schema_path,
37
40
  params.name,
38
41
  params.transaction_opaque_data ? toUint8Array(params.transaction_opaque_data) : undefined
39
42
  );
@@ -45,14 +48,14 @@ 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();
52
55
  const innerParams = unwrapRequest(params.request);
53
56
  await cat.macroCreate(
54
57
  toUint8Array(innerParams.attach_opaque_data),
55
- innerParams.schema_name,
58
+ innerParams.schema_path,
56
59
  innerParams.name,
57
60
  innerParams.macro_type as MacroType,
58
61
  innerParams.parameters ? (Array.isArray(innerParams.parameters) ? innerParams.parameters : [...innerParams.parameters]) : [],
@@ -68,19 +71,13 @@ 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();
81
78
  await cat.macroDrop(
82
79
  toUint8Array(params.attach_opaque_data),
83
- params.schema_name,
80
+ params.schema_path,
84
81
  params.name,
85
82
  params.ignore_not_found,
86
83
  params.transaction_opaque_data ? toUint8Array(params.transaction_opaque_data) : undefined
@@ -91,18 +88,13 @@ 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();
103
95
  const macros = await cat.schemaContentsMacros(
104
96
  toUint8Array(params.attach_opaque_data),
105
- params.name,
97
+ params.path,
106
98
  decodeDictValue(params.type),
107
99
  params.transaction_opaque_data ? toUint8Array(params.transaction_opaque_data) : undefined
108
100
  );
@@ -1,12 +1,13 @@
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";
8
8
  import { deserializeBatch } from "../../../util/arrow/index.js";
9
9
  import { toUint8Array } from "../../../util/bytes.js";
10
+ import { normalizeRequestSchemaPaths } from "../shared.js";
10
11
  import {
11
12
  sealBytes,
12
13
  openBytes,
@@ -194,6 +195,7 @@ export function catalogUnary(
194
195
  result: config.result as any,
195
196
  doc: config.doc,
196
197
  handler: async (params: Record<string, any>, ctx: any) => {
198
+ normalizeRequestSchemaPaths(params);
197
199
  await unwrapParamsOpaque(params, ctx, signingKey);
198
200
  return config.handler(params, ctx);
199
201
  },
@@ -233,59 +235,12 @@ export function decodeOptionsBatch(bytes: any): Record<string, unknown> {
233
235
 
234
236
  export const emptyResultSchema = schema([]);
235
237
 
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
- ]);
238
+ // Eight hand-written catalog param schemas used to live here, restating shapes
239
+ // codegen already emits. Every `params:` slot now points at a generated
240
+ // `…ParamsSchema` and these were left behind, referenced by nothing but their
241
+ // own import lines. A stale duplicate is worse than no duplicate: the copies
242
+ // this SDK kept had drifted on `attach_opaque_data` nullability (45 generated
243
+ // schemas say non-null, every copy said nullable) and on `type` being
244
+ // dictionary-encoded utf8 rather than plain utf8, and the result was that a
245
+ // CORRECT client got rejected at the very first catalog call. Import from
246
+ // src/generated/vgi-protocol-schemas.ts instead of reviving one.