@query-farm/vgi 0.41.0 → 0.42.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@query-farm/vgi",
3
- "version": "0.41.0",
3
+ "version": "0.42.0",
4
4
  "description": "TypeScript framework for extending DuckDB with user-defined functions via the Vector Gateway Interface (VGI) over Arrow IPC.",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "author": "Query Farm LLC (https://query.farm)",
@@ -15,6 +15,7 @@ import { registerFunctionMethods } from "./handlers/function.js";
15
15
  import { registerAggregateMethods } from "./handlers/aggregate.js";
16
16
  import { registerTableBufferingMethods } from "./handlers/table-buffering.js";
17
17
  import { registerCatalogMethods } from "./handlers/catalog/index.js";
18
+ import { registerUnimplementedMethods } from "./handlers/unimplemented.js";
18
19
 
19
20
  export interface ProtocolConfig {
20
21
  registry: FunctionRegistry;
@@ -56,6 +57,20 @@ export interface ProtocolConfig {
56
57
  */
57
58
  export const VGI_PROTOCOL_NAME = "vgi.v2";
58
59
 
60
+ /**
61
+ * The `vgi.v2` protocol hash `vgi_rpc.Reflection.v1` must report for this
62
+ * worker: the reference's (vgi-python 0.43.0, 72 methods). Every SDK hosts
63
+ * every `vgi.v2` method with the reference's schemas, so the hash is one value
64
+ * across the ports; a method this SDK does not implement is still registered
65
+ * (handlers/unimplemented.ts). The hash covers method names, types and the
66
+ * params/result/header schemas only (WIRE_PROTOCOL.md §14).
67
+ *
68
+ * It changes only with vgi.v2's protocol version (currently 2.1.0). Asserted
69
+ * by src/protocol/__tests__/vgi-v2-hash.test.ts; if that test fails, the
70
+ * surface drifted from the reference -- fix the schemas, do not bump this.
71
+ */
72
+ export const VGI_V2_PROTOCOL_HASH = "774cb80090d71ea76d09aa311b9cda4ca4c33c3bf72c43242eb6dc87b6f79ce5";
73
+
59
74
  export function buildVgiProtocol(config: ProtocolConfig): Protocol {
60
75
  const protocol = new Protocol(VGI_PROTOCOL_NAME, { protocolVersion: "2.1.0" });
61
76
 
@@ -67,6 +82,7 @@ export function buildVgiProtocol(config: ProtocolConfig): Protocol {
67
82
  registerAggregateMethods(protocol, config.registry);
68
83
  registerTableBufferingMethods(protocol, config.registry, config.signingKey);
69
84
  registerCatalogMethods(protocol, config.catalogInterface, config.catalogName, config.signingKey);
85
+ registerUnimplementedMethods(protocol);
70
86
 
71
87
  return protocol;
72
88
  }
@@ -0,0 +1,74 @@
1
+ // Copyright 2025, 2026 Query Farm LLC - https://query.farm
2
+ // vgi.v2 methods this SDK registers but does not implement.
3
+ //
4
+ // "The protocol is the unit of optionality": every SDK hosts EVERY vgi.v2
5
+ // method with exactly the reference's schemas, so vgi_rpc.Reflection.v1
6
+ // reports one vgi.v2 protocol hash everywhere (see VGI_V2_PROTOCOL_HASH in
7
+ // ../dispatch.ts). A method this port has no implementation for is still
8
+ // registered -- with the reference's params/result schemas -- and answers
9
+ // every call with vgi-rpc's MethodNotImplementedError: error_code
10
+ // UNIMPLEMENTED, error_kind method_not_implemented. Never a silent success.
11
+ //
12
+ // When one of these gains a real implementation, move it out of this list
13
+ // into its handler module; the schemas must not change (the hash test fails
14
+ // if they do).
15
+
16
+ import { MethodNotImplementedError, type Protocol } from "@query-farm/vgi-rpc";
17
+ import type { VgiSchema } from "../../arrow/index.js";
18
+ import {
19
+ CatalogIndexCreateParamsSchema,
20
+ CatalogIndexDropParamsSchema,
21
+ CatalogTableColumnCommentSetParamsSchema,
22
+ CatalogTableDeleteFunctionGetParamsSchema,
23
+ CatalogTableInsertFunctionGetParamsSchema,
24
+ CatalogTableUpdateFunctionGetParamsSchema,
25
+ } from "../../generated/vgi-protocol-schemas.js";
26
+ import { REQUEST_PARAMS_SCHEMA, RESULT_BINARY_SCHEMA } from "./shared.js";
27
+ import { emptyResultSchema } from "./catalog/shared.js";
28
+
29
+ /** One unimplemented method: its wire name and the reference's schemas. */
30
+ interface UnimplementedMethod {
31
+ readonly name: string;
32
+ readonly params: VgiSchema;
33
+ readonly result: VgiSchema;
34
+ }
35
+
36
+ /**
37
+ * The vgi.v2 methods (of the reference's 72) this SDK does not implement.
38
+ * Exported so a test can assert each one refuses with UNIMPLEMENTED.
39
+ */
40
+ export const UNIMPLEMENTED_METHODS: readonly UnimplementedMethod[] = [
41
+ // Streaming and window aggregates: request/result are wrapped ASD blobs.
42
+ { name: "aggregate_streaming_open", params: REQUEST_PARAMS_SCHEMA, result: RESULT_BINARY_SCHEMA },
43
+ { name: "aggregate_streaming_chunk", params: REQUEST_PARAMS_SCHEMA, result: RESULT_BINARY_SCHEMA },
44
+ { name: "aggregate_streaming_close", params: REQUEST_PARAMS_SCHEMA, result: RESULT_BINARY_SCHEMA },
45
+ { name: "aggregate_window_init", params: REQUEST_PARAMS_SCHEMA, result: RESULT_BINARY_SCHEMA },
46
+ { name: "aggregate_window", params: REQUEST_PARAMS_SCHEMA, result: RESULT_BINARY_SCHEMA },
47
+ { name: "aggregate_window_batch", params: REQUEST_PARAMS_SCHEMA, result: RESULT_BINARY_SCHEMA },
48
+ { name: "aggregate_window_destructor", params: REQUEST_PARAMS_SCHEMA, result: RESULT_BINARY_SCHEMA },
49
+ // Index DDL and per-column comments.
50
+ { name: "catalog_index_create", params: CatalogIndexCreateParamsSchema, result: emptyResultSchema },
51
+ { name: "catalog_index_drop", params: CatalogIndexDropParamsSchema, result: emptyResultSchema },
52
+ { name: "catalog_table_column_comment_set", params: CatalogTableColumnCommentSetParamsSchema, result: emptyResultSchema },
53
+ // Per-table DML function getters.
54
+ { name: "catalog_table_insert_function_get", params: CatalogTableInsertFunctionGetParamsSchema, result: RESULT_BINARY_SCHEMA },
55
+ { name: "catalog_table_update_function_get", params: CatalogTableUpdateFunctionGetParamsSchema, result: RESULT_BINARY_SCHEMA },
56
+ { name: "catalog_table_delete_function_get", params: CatalogTableDeleteFunctionGetParamsSchema, result: RESULT_BINARY_SCHEMA },
57
+ ];
58
+
59
+ /** The message every unimplemented method answers with. */
60
+ export function unimplementedMessage(method: string): string {
61
+ return `${method} is not implemented by this worker`;
62
+ }
63
+
64
+ export function registerUnimplementedMethods(protocol: Protocol): void {
65
+ for (const m of UNIMPLEMENTED_METHODS) {
66
+ protocol.unary(m.name, {
67
+ params: m.params,
68
+ result: m.result,
69
+ handler: async () => {
70
+ throw new MethodNotImplementedError(unimplementedMessage(m.name));
71
+ },
72
+ });
73
+ }
74
+ }