@query-farm/vgi 0.46.0 → 0.47.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 (89) hide show
  1. package/README.md +11 -5
  2. package/dist/arrow/impl-arrowjs/index.d.ts +1 -1
  3. package/dist/arrow/impl-arrowjs/iterate.d.ts +2 -0
  4. package/dist/arrow/impl-flechette/index.d.ts +1 -1
  5. package/dist/arrow/impl-flechette/iterate.d.ts +2 -0
  6. package/dist/arrow/index.d.ts +1 -1
  7. package/dist/catalog/column-expressions.d.ts +8 -0
  8. package/dist/catalog/column-metadata.d.ts +11 -0
  9. package/dist/catalog/composite.d.ts +2 -1
  10. package/dist/catalog/descriptors.d.ts +21 -29
  11. package/dist/catalog/interface.d.ts +15 -20
  12. package/dist/catalog/macro-overloads.d.ts +4 -0
  13. package/dist/catalog/read-only.d.ts +1 -1
  14. package/dist/catalog/unconstrained-columns.d.ts +2 -0
  15. package/dist/client/client.d.ts +18 -13
  16. package/dist/client-entry.js +753 -103
  17. package/dist/client-entry.js.map +16 -14
  18. package/dist/functions/projection.d.ts +18 -0
  19. package/dist/functions/table.d.ts +6 -1
  20. package/dist/functions/types.d.ts +1 -0
  21. package/dist/generated/vgi-client.d.ts +177 -36
  22. package/dist/generated/vgi-protocol-schemas.d.ts +51 -1
  23. package/dist/generated/vgi-protocol-types.d.ts +317 -3
  24. package/dist/generated/vgi-service.d.ts +266 -29
  25. package/dist/index.core.d.ts +2 -1
  26. package/dist/index.js +1480 -238
  27. package/dist/index.js.map +40 -34
  28. package/dist/protocol/dispatch.d.ts +9 -9
  29. package/dist/protocol/handlers/aggregate.d.ts +1 -1
  30. package/dist/protocol/handlers/catalog/index.d.ts +1 -1
  31. package/dist/protocol/handlers/catalog/metadata.d.ts +1 -0
  32. package/dist/protocol/handlers/function.d.ts +1 -1
  33. package/dist/protocol/handlers/table-buffering.d.ts +1 -1
  34. package/dist/protocol/handlers/unimplemented.d.ts +1 -1
  35. package/dist/protocol/serializers/bind.d.ts +5 -1
  36. package/dist/protocol/types.d.ts +5 -0
  37. package/dist/rpc-server.d.ts +6 -6
  38. package/dist/serve-entry.js +1593 -452
  39. package/dist/serve-entry.js.map +31 -26
  40. package/dist/util/arrow/index.d.ts +1 -1
  41. package/dist/worker-cf-entry.js +1814 -589
  42. package/dist/worker-cf-entry.js.map +39 -33
  43. package/dist/worker.d.ts +1 -1
  44. package/package.json +5 -4
  45. package/src/arrow/impl-arrowjs/index.ts +1 -1
  46. package/src/arrow/impl-arrowjs/iterate.ts +9 -1
  47. package/src/arrow/impl-arrowjs/project.ts +1 -1
  48. package/src/arrow/impl-flechette/index.ts +1 -1
  49. package/src/arrow/impl-flechette/ipc.ts +12 -0
  50. package/src/arrow/impl-flechette/iterate.ts +5 -0
  51. package/src/arrow/impl-flechette/project.ts +6 -8
  52. package/src/arrow/index.ts +1 -1
  53. package/src/catalog/column-expressions.ts +224 -0
  54. package/src/catalog/column-metadata.ts +151 -0
  55. package/src/catalog/composite.ts +5 -1
  56. package/src/catalog/contents-codec.ts +6 -1
  57. package/src/catalog/descriptors.ts +21 -29
  58. package/src/catalog/interface.ts +70 -55
  59. package/src/catalog/macro-overloads.ts +44 -0
  60. package/src/catalog/read-only.ts +63 -71
  61. package/src/catalog/unconstrained-columns.ts +23 -0
  62. package/src/client/client.ts +100 -58
  63. package/src/codec/asd.ts +3 -1
  64. package/src/functions/projection.ts +207 -0
  65. package/src/functions/table.ts +10 -0
  66. package/src/functions/types.ts +1 -0
  67. package/src/generated/vgi-client.ts +199 -37
  68. package/src/generated/vgi-protocol-schemas.ts +455 -41
  69. package/src/generated/vgi-protocol-types.ts +879 -5
  70. package/src/generated/vgi-service.ts +514 -42
  71. package/src/http/client-bundle.ts +1 -1
  72. package/src/http/fetch.ts +1 -1
  73. package/src/index.core.ts +4 -0
  74. package/src/protocol/dispatch.ts +9 -9
  75. package/src/protocol/handlers/aggregate.ts +1 -1
  76. package/src/protocol/handlers/catalog/admin.ts +10 -5
  77. package/src/protocol/handlers/catalog/index.ts +2 -2
  78. package/src/protocol/handlers/catalog/macro.ts +6 -5
  79. package/src/protocol/handlers/catalog/metadata.ts +16 -0
  80. package/src/protocol/handlers/catalog/table.ts +72 -26
  81. package/src/protocol/handlers/catalog/view.ts +24 -3
  82. package/src/protocol/handlers/function.ts +67 -1
  83. package/src/protocol/handlers/table-buffering.ts +1 -1
  84. package/src/protocol/handlers/unimplemented.ts +6 -6
  85. package/src/protocol/serializers/bind.ts +17 -1
  86. package/src/protocol/types.ts +6 -0
  87. package/src/rpc-server.ts +9 -9
  88. package/src/util/arrow/index.ts +1 -1
  89. package/src/worker.ts +1 -1
package/README.md CHANGED
@@ -40,8 +40,14 @@ npm install @query-farm/vgi
40
40
 
41
41
  Requires **Node.js ≥ 22.15** or **Bun**.
42
42
 
43
+ Version 0.47.0 uses **`vgi.v3` / `3.0.0`** and requires a matching VGI
44
+ extension. Existing `vgi.v2` extensions need SDK 0.46.x; upgrade the engine-side
45
+ extension and workers together. This release prepares the shared protocol for
46
+ DuckDB 2.0; it does not require upgrading DuckDB itself. See
47
+ [the migration notes](MIGRATION.md#0470--vgiv3).
48
+
43
49
  > **Peer dependencies (since 0.3.0).** `@query-farm/apache-arrow` (`^21.1.1`) and
44
- > `@query-farm/vgi-rpc` (`^0.25.2`) are **peerDependencies** — install them directly
50
+ > `@query-farm/vgi-rpc` (`^0.29.2`) are **peerDependencies** — install them directly
45
51
  > alongside `@query-farm/vgi`:
46
52
  >
47
53
  > ```bash
@@ -552,7 +558,7 @@ explicitly. Without it there is no landing page and no `/vgi-client.js`; see
552
558
  ### Hosting additional protocols
553
559
 
554
560
  A worker can serve other [vgi-rpc](https://www.npmjs.com/package/@query-farm/vgi-rpc)
555
- protocols beside `vgi.v2`, on the same listener, through the `hostedProtocols` hook:
561
+ protocols beside `vgi.v3`, on the same listener, through the `hostedProtocols` hook:
556
562
 
557
563
  ```ts
558
564
  import { Protocol, str } from "@query-farm/vgi-rpc";
@@ -571,12 +577,12 @@ new Worker({ functions, hostedProtocols: () => [reports] }).run();
571
577
  - The hook is called **once**, when the server is built; it may read configuration,
572
578
  but its answer is fixed for the life of the process.
573
579
  - Its protocols are hosted on **every** transport (stdio, AF_UNIX, TCP, the Iroh raw
574
- upstream, `serveStream`, HTTP), after `vgi.v2`, in the order returned. Every
580
+ upstream, `serveStream`, HTTP), after `vgi.v3`, in the order returned. Every
575
581
  transport builds its server through one function, `buildRpcServer`.
576
- - Each needs a distinct name, which may not be `vgi.v2` or start with the reserved
582
+ - Each needs a distinct name, which may not be `vgi.v3` or start with the reserved
577
583
  `vgi_rpc.`. Violations are a startup error naming `hostedProtocols()`.
578
584
  - Requests route on their `vgi_rpc.protocol` key, so hosting more protocols never
579
- changes how DuckDB's `vgi.v2` calls are dispatched.
585
+ changes how DuckDB's `vgi.v3` calls are dispatched.
580
586
  - The protocol is the unit of optionality: an optional capability is its own protocol.
581
587
 
582
588
  ### Token introspection and grants (`vgi_rpc.Identity.v2`)
@@ -3,7 +3,7 @@ export declare const backend: VgiBackendInfo;
3
3
  export { schema, field, nullType, bool, int, int8, int16, int32, int64, uint8, uint16, uint32, uint64, float16, float32, float64, utf8, largeUtf8, binary, largeBinary, fixedSizeBinary, decimal, decimal128, decimal256, date, dateDay, dateMillisecond, time, timeSecond, timeMillisecond, timeMicrosecond, timeNanosecond, timestamp, duration, interval, list, fixedSizeList, struct, map, dictionary, union, sparseUnion, denseUnion, TimeUnit, DateUnit, IntervalUnit, UnionMode, } from "./schema.js";
4
4
  export { emptyBatch } from "./empty.js";
5
5
  export { batchFromRows, batchFromColumns, columnFromArray } from "./build.js";
6
- export { iterRows, batchToScalarDict, batchToSecretDict, safeNumber, decodeDictValue, } from "./iterate.js";
6
+ export { iterRows, batchToScalarDict, batchToSecretDict, safeNumber, decodeDictValue, decodeMapValue, } from "./iterate.js";
7
7
  export { filterBatch } from "./filter.js";
8
8
  export { projectSchema, projectBatch } from "./project.js";
9
9
  export { readCanonicalValue } from "./canonical.js";
@@ -46,3 +46,5 @@ export declare function batchToSecretDict(batch: RecordBatch | VgiBatch | null):
46
46
  * from mismatched output weeks later.
47
47
  */
48
48
  export declare function safeNumber(value: any): number;
49
+ /** Decode a map parameter carried as opaque Arrow Data by the RPC reader. */
50
+ export declare function decodeMapValue(value: any, index?: number): any;
@@ -4,7 +4,7 @@ export declare const backend: VgiBackendInfo;
4
4
  export { schema, field, nullType, bool, int, int8, int16, int32, int64, uint8, uint16, uint32, uint64, float16, float32, float64, utf8, largeUtf8, binary, largeBinary, fixedSizeBinary, decimal, decimal128, decimal256, date, dateDay, dateMillisecond, time, timeSecond, timeMillisecond, timeMicrosecond, timeNanosecond, timestamp, duration, interval, list, fixedSizeList, struct, map, dictionary, union, sparseUnion, denseUnion, TimeUnit, DateUnit, IntervalUnit, UnionMode, } from "./schema.js";
5
5
  export { emptyBatch } from "./empty.js";
6
6
  export { batchFromRows, batchFromColumns, columnFromArray } from "./build.js";
7
- export { iterRows, batchToScalarDict, batchToSecretDict, safeNumber, decodeDictValue, } from "./iterate.js";
7
+ export { iterRows, batchToScalarDict, batchToSecretDict, safeNumber, decodeDictValue, decodeMapValue, } from "./iterate.js";
8
8
  export { filterBatch } from "./filter.js";
9
9
  export { projectSchema, projectBatch } from "./project.js";
10
10
  export { readCanonicalValue } from "./canonical.js";
@@ -36,3 +36,5 @@ export declare function batchToSecretDict(batch: VgiBatch | null): Record<string
36
36
  * from mismatched output weeks later.
37
37
  */
38
38
  export declare function safeNumber(value: any): number;
39
+ /** Flechette already extracts map parameters as ordinary values. */
40
+ export declare function decodeMapValue(value: any, _index?: number): any;
@@ -1,6 +1,6 @@
1
1
  export type { VgiTypeId, VgiDataType, VgiField, VgiSchema, VgiColumn, VgiColumnData, VgiBatch, VgiBackendInfo, TaggedUnion, } from "./types.js";
2
2
  export { TypeId, isNull, isInt, isFloat, isBinary, isUtf8, isBool, isDecimal, isDate, isTime, isTimestamp, isInterval, isList, isStruct, isUnion, isFixedSizeBinary, isFixedSizeList, isMap, isDuration, isDictionary, isBatch, typeSignature, } from "./predicates.js";
3
- export { backend, emptyBatch, batchFromRows, batchFromColumns, columnFromArray, iterRows, batchToScalarDict, batchToSecretDict, safeNumber, decodeDictValue, filterBatch, projectSchema, projectBatch, withBatchMetadata, adoptArrowJsShape, readCanonicalValue, serializeSchema, deserializeSchema, serializeBatch, deserializeBatch, deserializeBatches, serializeBatches, serializeCollectionRows, buildStatisticsBatch, } from "#arrow-impl";
3
+ export { backend, emptyBatch, batchFromRows, batchFromColumns, columnFromArray, iterRows, batchToScalarDict, batchToSecretDict, safeNumber, decodeDictValue, decodeMapValue, filterBatch, projectSchema, projectBatch, withBatchMetadata, adoptArrowJsShape, readCanonicalValue, serializeSchema, deserializeSchema, serializeBatch, deserializeBatch, deserializeBatches, serializeBatches, serializeCollectionRows, buildStatisticsBatch, } from "#arrow-impl";
4
4
  export type { ColumnStatistics } from "#arrow-impl";
5
5
  export { schema, field, nullType, bool, int, int8, int16, int32, int64, uint8, uint16, uint32, uint64, float16, float32, float64, utf8, largeUtf8, binary, largeBinary, fixedSizeBinary, decimal, decimal128, decimal256, date, dateDay, dateMillisecond, time, timeSecond, timeMillisecond, timeMicrosecond, timeNanosecond, timestamp, duration, interval, timestampSeconds, timestampMillis, timestampMicros, timestampNanos, durationSeconds, durationMillis, durationMicros, durationNanos, list, fixedSizeList, struct, map, dictionary, union, sparseUnion, denseUnion, TimeUnit, DateUnit, IntervalUnit, UnionMode, } from "./schema-types.js";
6
6
  export type { NullDescriptor, BoolType, IntType, Int8Type, Int16Type, Int32Type, Int64Type, Uint8Type, Uint16Type, Uint32Type, Uint64Type, FloatType, Utf8Type, LargeUtf8Type, BinaryType, LargeBinaryType, FixedSizeBinaryType, DecimalType, Date32Type, Date64Type, Time32Type, Time64Type, TimestampType, DurationType, IntervalType, ListType, FixedSizeListType, StructType, MapType, DictionaryType, UnionType, TypedField, TUnit, } from "./codec/type-descriptors.js";
@@ -0,0 +1,8 @@
1
+ import { type VgiSchema } from "../arrow/index.js";
2
+ export declare const GENERATED_EXPRESSION_KEY = "vgi.column.generated.v1";
3
+ export declare const GENERATION_KEY = "vgi.column.generation.v1";
4
+ export declare function validateEncoded(encoded: string, owner: string[]): void;
5
+ export declare function generatedExpressionMetadata(sql: string, owner: string[]): string;
6
+ /** Validate canonical VIRTUAL metadata without evaluating or rewriting SQL. */
7
+ export declare function validateColumnExpressions(schema: VgiSchema, owner: string[], allowGenerated?: boolean): void;
8
+ export declare function validateColumnExpressionsIpc(bytes: Uint8Array, owner: string[], allowGenerated?: boolean): void;
@@ -0,0 +1,11 @@
1
+ import type { VgiSchema } from "../arrow/index.js";
2
+ import { type TableInfo } from "../generated/vgi-client.js";
3
+ /** Validate reserved metadata without replacing the original schema or values. */
4
+ export declare function validateColumnMetadata(schema: VgiSchema): void;
5
+ /** Inspect raw schema-message metadata before Arrow can replace malformed UTF-8.
6
+ * FlatBuffer slots come from Arrow's Message, Schema, Field and KeyValue tables.
7
+ * Only reserved field values are interpreted; all original IPC bytes stay intact.
8
+ */
9
+ export declare function validateColumnMetadataIpc(bytes: Uint8Array): void;
10
+ export declare function validateTableInfoColumns(info: TableInfo): void;
11
+ export declare function encodeValidatedTableInfo(info: TableInfo): Uint8Array;
@@ -8,7 +8,7 @@ export declare class CompositeCatalogInterface extends CatalogInterface {
8
8
  catalogNameForAttach(attachOpaqueData: Uint8Array): string | null;
9
9
  catalogs(): string[];
10
10
  catalogsInfo(): Promise<CatalogInfo[]>;
11
- attach(name: string, options?: Record<string, unknown>, dataVersionSpec?: string | null, implementationVersion?: string | null): Promise<CatalogAttachResult>;
11
+ attach(name: string, options?: Record<string, unknown>, dataVersionSpec?: string | null, implementationVersion?: string | null, clientCapabilities?: Uint8Array | null): Promise<CatalogAttachResult>;
12
12
  detach(attachOpaqueData: AttachOpaqueData): Promise<void>;
13
13
  version(attachOpaqueData: AttachOpaqueData, transactionOpaqueData?: TransactionOpaqueData): Promise<number>;
14
14
  schemas(attachOpaqueData: AttachOpaqueData, transactionOpaqueData?: TransactionOpaqueData): Promise<SchemaInfo[]>;
@@ -46,6 +46,7 @@ export declare class CompositeCatalogInterface extends CatalogInterface {
46
46
  viewDrop(...args: Parameters<CatalogInterface["viewDrop"]>): Promise<void>;
47
47
  viewRename(...args: Parameters<CatalogInterface["viewRename"]>): Promise<void>;
48
48
  viewCommentSet(...args: Parameters<CatalogInterface["viewCommentSet"]>): Promise<void>;
49
+ viewColumnCommentSet(...args: Parameters<CatalogInterface["viewColumnCommentSet"]>): Promise<void>;
49
50
  macroCreate(...args: Parameters<CatalogInterface["macroCreate"]>): Promise<void>;
50
51
  macroDrop(...args: Parameters<CatalogInterface["macroDrop"]>): Promise<void>;
51
52
  catalogContents(attachOpaqueData: AttachOpaqueData, ifNoneMatch?: string | null): Promise<CatalogContentsResult>;
@@ -18,6 +18,9 @@ export interface ForeignKeyDef {
18
18
  }
19
19
  export type DefaultValue = string | number | boolean | null;
20
20
  export interface TableDescriptor {
21
+ /** Canonical ConstraintInfo IPC records with provider-owned stable identities. */
22
+ constraints?: Uint8Array[];
23
+ definitionRevision?: Uint8Array | null;
21
24
  name: string;
22
25
  columns?: VgiSchema;
23
26
  function?: VgiFunction;
@@ -33,7 +36,7 @@ export interface TableDescriptor {
33
36
  /**
34
37
  * Generated (virtual) columns: map of column name → SQL expression computed
35
38
  * from other physical columns. Applied as Arrow field metadata
36
- * `generated_expression`, which the DuckDB VGI extension reads at table
39
+ * canonical SqlExpression IPC with explicit owner/context, which DuckDB reads at table
37
40
  * registration. The backing scan function should not return these columns —
38
41
  * DuckDB evaluates the expressions client-side.
39
42
  */
@@ -52,25 +55,10 @@ export interface TableDescriptor {
52
55
  * (always re-fetch).
53
56
  */
54
57
  statisticsCacheMaxAgeSeconds?: number | null;
55
- /**
56
- * Required WHERE-filter groups in conjunctive normal form — an AND (outer
57
- * list) of OR-groups (inner lists) of dotted-path column references that MUST
58
- * appear in a WHERE expression for any scan of this table. A group is
59
- * satisfied when any one of its paths has a filter; every group must be
60
- * satisfied. So `[["accession_number"], ["ticker", "cik"]]` means
61
- * "accession_number AND one of (ticker, cik)"; a single-path group
62
- * `[["country"]]` is a plain mandatory filter. Paths are top-level names
63
- * (`"country"`) or struct subfields (`"bbox.xmin"`, `"nested.outer.inner"`).
64
- * Empty/undefined (default) means no enforcement — the zero-cost fast path
65
- * for every existing table.
66
- *
67
- * Satisfaction is prefix-based: a present filter on a shorter path satisfies
68
- * any required path it is a prefix of. So a whole-struct filter on `bbox`
69
- * satisfies all of `bbox.xmin` / `.xmax` / `.ymin` / `.ymax`. The VGI DuckDB
70
- * extension's optimizer pass consults this at bind time and throws a
71
- * `BinderException` listing any unsatisfied groups.
72
- */
73
- requiredFilters?: string[][];
58
+ /** AND-of-OR groups of raw component paths, e.g. `[[["bbox", "xmin"]], [["ticker"], ["cik"]]]`.
59
+ * Dots and quotes are literal. A present component prefix satisfies a path;
60
+ * a child does not satisfy its parent. Empty/undefined means no requirements. */
61
+ requiredFilters?: string[][][];
74
62
  supportsTimeTravel?: boolean;
75
63
  /**
76
64
  * Inline cardinality estimate/max surfaced through TableInfo. When set,
@@ -87,6 +75,10 @@ export interface TableDescriptor {
87
75
  }
88
76
  export interface ViewDescriptor {
89
77
  name: string;
78
+ /** Ordered raw output identifiers; empty uses query names. */
79
+ aliases?: string[];
80
+ /** Optimization barrier mode; readers must enforce or reject it. */
81
+ security?: "regular" | "barrier";
90
82
  definition: string;
91
83
  comment?: string;
92
84
  /**
@@ -105,11 +97,12 @@ export interface MacroDescriptor {
105
97
  macroType: "scalar" | "table";
106
98
  parameters: string[];
107
99
  parameterDefaultValues?: Uint8Array | null;
100
+ /** Complete canonical family; simple-definition fields must be empty when supplied. */
101
+ overloads?: import("../generated/vgi-client.js").MacroOverload[];
108
102
  /**
109
103
  * Optional mapping of parameter name to a human/agent-facing description.
110
104
  * Keys must appear in `parameters`. Descriptions flow over the wire via the
111
- * macro `arguments_schema`'s `vgi_doc` field metadata (the same channel
112
- * functions use for per-argument docs), so the DuckDB extension's
105
+ * canonical parameter's `documentation` field, so the DuckDB extension's
113
106
  * `vgi_function_arguments()` can surface them. Empty/omitted = no docs.
114
107
  */
115
108
  parameterDocs?: Record<string, string>;
@@ -119,12 +112,10 @@ export interface MacroDescriptor {
119
112
  }
120
113
  export interface IndexDescriptor {
121
114
  name: string;
122
- tableName: string;
123
- expressions: string[];
124
- /** UNIQUE / PRIMARY / NONE; defaults to NONE. */
125
- constraintType?: "NONE" | "UNIQUE" | "PRIMARY";
126
- indexType?: string;
127
- options?: Record<string, string>;
115
+ /** Complete provider-authored definition; no expression strings or options are inferred. */
116
+ definition: Uint8Array;
117
+ /** Effective values and persisted override names, including explicit NULL. */
118
+ options: Uint8Array;
128
119
  comment?: string;
129
120
  tags?: Record<string, string>;
130
121
  }
@@ -149,7 +140,8 @@ export interface SecretTypeDescriptor {
149
140
  }
150
141
  export interface CatalogDescriptor {
151
142
  name: string;
152
- defaultSchema?: string;
143
+ /** One raw root identifier; null means no implicit default, omitted means main. */
144
+ defaultSchema?: string | null;
153
145
  schemas: SchemaDescriptor[];
154
146
  settings?: SettingDescriptor[];
155
147
  secretTypes?: SecretTypeDescriptor[];
@@ -342,7 +342,7 @@ export declare abstract class CatalogInterface {
342
342
  * validated, decoded `{name: value}` dict with typed column values.
343
343
  * Use `{}` if no options were supplied.
344
344
  */
345
- abstract attach(name: string, options?: Record<string, unknown>, dataVersionSpec?: string | null, implementationVersion?: string | null): Awaitable<CatalogAttachResult>;
345
+ abstract attach(name: string, options?: Record<string, unknown>, dataVersionSpec?: string | null, implementationVersion?: string | null, clientCapabilities?: Uint8Array | null): Awaitable<CatalogAttachResult>;
346
346
  /**
347
347
  * List the catalogs this worker exposes with their version metadata. The
348
348
  * `implementation_version` / `data_version_spec` come from the CatalogInfo
@@ -357,13 +357,13 @@ export declare abstract class CatalogInterface {
357
357
  create(name: string, onConflict: string, options?: any): Awaitable<void>;
358
358
  drop(name: string): Awaitable<void>;
359
359
  schemaGet(attachOpaqueData: AttachOpaqueData, path: string[], transactionOpaqueData?: TransactionOpaqueData): Awaitable<SchemaInfo | null>;
360
- schemaCreate(attachOpaqueData: AttachOpaqueData, path: string[], comment?: string | null, tags?: any, transactionOpaqueData?: TransactionOpaqueData): Awaitable<void>;
360
+ schemaCreate(attachOpaqueData: AttachOpaqueData, path: string[], comment?: string | null, tags?: Record<string, string> | null, transactionOpaqueData?: TransactionOpaqueData, onConflict?: string): Awaitable<void>;
361
361
  schemaDrop(attachOpaqueData: AttachOpaqueData, path: string[], ignoreNotFound?: boolean, cascade?: boolean, transactionOpaqueData?: TransactionOpaqueData): Awaitable<void>;
362
362
  schemaContentsTables(attachOpaqueData: AttachOpaqueData, path: string[], transactionOpaqueData?: TransactionOpaqueData): Awaitable<TableInfo[]>;
363
363
  schemaContentsViews(attachOpaqueData: AttachOpaqueData, path: string[], transactionOpaqueData?: TransactionOpaqueData): Awaitable<ViewInfo[]>;
364
364
  schemaContentsFunctions(attachOpaqueData: AttachOpaqueData, path: string[], type: string, transactionOpaqueData?: TransactionOpaqueData): Awaitable<FunctionInfo[]>;
365
365
  tableGet(attachOpaqueData: AttachOpaqueData, schemaPath: string[], name: string, atUnit?: string, atValue?: string, transactionOpaqueData?: TransactionOpaqueData): Awaitable<TableInfo | null>;
366
- tableCreate(attachOpaqueData: AttachOpaqueData, schemaPath: string[], name: string, columns: Uint8Array, onConflict: string, notNullConstraints?: number[], uniqueConstraints?: number[][], checkConstraints?: string[], transactionOpaqueData?: TransactionOpaqueData): Awaitable<void>;
366
+ tableCreate(attachOpaqueData: AttachOpaqueData, schemaPath: string[], name: string, columns: Uint8Array, onConflict: string, constraintDefinitions?: Uint8Array[], transactionOpaqueData?: TransactionOpaqueData): Awaitable<void>;
367
367
  tableDrop(attachOpaqueData: AttachOpaqueData, schemaPath: string[], name: string, ignoreNotFound?: boolean, transactionOpaqueData?: TransactionOpaqueData): Awaitable<void>;
368
368
  tableScanFunctionGet(attachOpaqueData: AttachOpaqueData, schemaPath: string[], name: string, atUnit?: string, atValue?: string, transactionOpaqueData?: TransactionOpaqueData): Awaitable<any>;
369
369
  /**
@@ -387,28 +387,23 @@ export declare abstract class CatalogInterface {
387
387
  } | null>;
388
388
  tableCommentSet(attachOpaqueData: AttachOpaqueData, schemaPath: string[], name: string, comment?: string | null, ignoreNotFound?: boolean, transactionOpaqueData?: TransactionOpaqueData): Awaitable<void>;
389
389
  tableRename(attachOpaqueData: AttachOpaqueData, schemaPath: string[], name: string, newName: string, ignoreNotFound?: boolean, transactionOpaqueData?: TransactionOpaqueData): Awaitable<void>;
390
- tableColumnAdd(attachOpaqueData: AttachOpaqueData, schemaPath: string[], name: string, columnName: string, columnType: string, defaultValue?: string, ignoreNotFound?: boolean, transactionOpaqueData?: TransactionOpaqueData): Awaitable<void>;
391
- tableColumnDrop(attachOpaqueData: AttachOpaqueData, schemaPath: string[], name: string, columnName: string, ignoreNotFound?: boolean, transactionOpaqueData?: TransactionOpaqueData): Awaitable<void>;
392
- tableColumnRename(attachOpaqueData: AttachOpaqueData, schemaPath: string[], name: string, columnName: string, newName: string, ignoreNotFound?: boolean, transactionOpaqueData?: TransactionOpaqueData): Awaitable<void>;
393
- tableColumnDefaultSet(attachOpaqueData: AttachOpaqueData, schemaPath: string[], name: string, columnName: string, defaultValue: string, ignoreNotFound?: boolean, transactionOpaqueData?: TransactionOpaqueData): Awaitable<void>;
394
- tableColumnDefaultDrop(attachOpaqueData: AttachOpaqueData, schemaPath: string[], name: string, columnName: string, ignoreNotFound?: boolean, transactionOpaqueData?: TransactionOpaqueData): Awaitable<void>;
395
- tableColumnTypeChange(attachOpaqueData: AttachOpaqueData, schemaPath: string[], name: string, columnName: string, newType: string, ignoreNotFound?: boolean, transactionOpaqueData?: TransactionOpaqueData): Awaitable<void>;
396
- tableNotNullSet(attachOpaqueData: AttachOpaqueData, schemaPath: string[], name: string, columnName: string, ignoreNotFound?: boolean, transactionOpaqueData?: TransactionOpaqueData): Awaitable<void>;
397
- tableNotNullDrop(attachOpaqueData: AttachOpaqueData, schemaPath: string[], name: string, columnName: string, ignoreNotFound?: boolean, transactionOpaqueData?: TransactionOpaqueData): Awaitable<void>;
390
+ tableColumnAdd(attachOpaqueData: AttachOpaqueData, schemaPath: string[], name: string, columnPath: string[], columnDefinition: Uint8Array, ignoreNotFound?: boolean, ifColumnNotExists?: boolean, transactionOpaqueData?: TransactionOpaqueData): Awaitable<void>;
391
+ tableColumnDrop(attachOpaqueData: AttachOpaqueData, schemaPath: string[], name: string, columnPath: string[], ignoreNotFound?: boolean, ifColumnExists?: boolean, cascade?: boolean, transactionOpaqueData?: TransactionOpaqueData): Awaitable<void>;
392
+ tableColumnRename(attachOpaqueData: AttachOpaqueData, schemaPath: string[], name: string, columnPath: string[], newColumnName: string, ignoreNotFound?: boolean, transactionOpaqueData?: TransactionOpaqueData): Awaitable<void>;
393
+ tableColumnCommentSet(attachOpaqueData: AttachOpaqueData, schemaPath: string[], name: string, columnPath: string[], comment: string | null, ignoreNotFound?: boolean, transactionOpaqueData?: TransactionOpaqueData): Awaitable<void>;
394
+ tableColumnDefaultSet(attachOpaqueData: AttachOpaqueData, schemaPath: string[], name: string, columnPath: string[], expression: Uint8Array, ignoreNotFound?: boolean, transactionOpaqueData?: TransactionOpaqueData): Awaitable<void>;
395
+ tableColumnDefaultDrop(attachOpaqueData: AttachOpaqueData, schemaPath: string[], name: string, columnPath: string[], ignoreNotFound?: boolean, transactionOpaqueData?: TransactionOpaqueData): Awaitable<void>;
396
+ tableColumnTypeChange(attachOpaqueData: AttachOpaqueData, schemaPath: string[], name: string, columnPath: string[], columnDefinition: Uint8Array, expression?: Uint8Array | null, ignoreNotFound?: boolean, transactionOpaqueData?: TransactionOpaqueData): Awaitable<void>;
397
+ tableNotNullSet(attachOpaqueData: AttachOpaqueData, schemaPath: string[], name: string, columnPath: string[], ignoreNotFound?: boolean, transactionOpaqueData?: TransactionOpaqueData): Awaitable<void>;
398
+ tableNotNullDrop(attachOpaqueData: AttachOpaqueData, schemaPath: string[], name: string, columnPath: string[], ignoreNotFound?: boolean, transactionOpaqueData?: TransactionOpaqueData): Awaitable<void>;
398
399
  viewGet(attachOpaqueData: AttachOpaqueData, schemaPath: string[], name: string, transactionOpaqueData?: TransactionOpaqueData): Awaitable<ViewInfo | null>;
399
- viewCreate(attachOpaqueData: AttachOpaqueData, schemaPath: string[], name: string, definition: string, onConflict: string, transactionOpaqueData?: TransactionOpaqueData): Awaitable<void>;
400
+ viewCreate(attachOpaqueData: AttachOpaqueData, schemaPath: string[], name: string, definition: string, onConflict: string, transactionOpaqueData?: TransactionOpaqueData, aliases?: string[], comment?: string | null, tags?: Record<string, string> | null, columnComments?: Record<string, string> | null): Awaitable<void>;
400
401
  viewDrop(attachOpaqueData: AttachOpaqueData, schemaPath: string[], name: string, ignoreNotFound?: boolean, transactionOpaqueData?: TransactionOpaqueData): Awaitable<void>;
401
402
  viewRename(attachOpaqueData: AttachOpaqueData, schemaPath: string[], name: string, newName: string, ignoreNotFound?: boolean, transactionOpaqueData?: TransactionOpaqueData): Awaitable<void>;
402
403
  viewCommentSet(attachOpaqueData: AttachOpaqueData, schemaPath: string[], name: string, comment?: string | null, ignoreNotFound?: boolean, transactionOpaqueData?: TransactionOpaqueData): Awaitable<void>;
404
+ viewColumnCommentSet(attachOpaqueData: AttachOpaqueData, schemaPath: string[], name: string, columnPath: string[], comment?: string | null, ignoreNotFound?: boolean, transactionOpaqueData?: TransactionOpaqueData): Awaitable<void>;
403
405
  macroGet(attachOpaqueData: AttachOpaqueData, schemaPath: string[], name: string, transactionOpaqueData?: TransactionOpaqueData): Awaitable<MacroInfo | null>;
404
- macroCreate(attachOpaqueData: AttachOpaqueData, schemaPath: string[], name: string, macroType: MacroType, parameters: string[], definition: string, onConflict: string, parameterDefaultValues?: Uint8Array | null,
405
- /**
406
- * Optional Arrow schema (one nullable field per parameter, in `parameters`
407
- * order) serialized as IPC bytes, carrying per-parameter descriptions via the
408
- * `vgi_doc` field metadata key. `null`/omitted when no per-parameter docs are
409
- * supplied. Build with `macroArgumentsSchema` + `serializeSchema`.
410
- */
411
- argumentsSchema?: Uint8Array | null, transactionOpaqueData?: TransactionOpaqueData): Awaitable<void>;
406
+ macroCreate(attachOpaqueData: AttachOpaqueData, schemaPath: string[], name: string, macroType: MacroType, overloads: import("../generated/vgi-client.js").MacroOverload[], onConflict: string, transactionOpaqueData?: TransactionOpaqueData): Awaitable<void>;
412
407
  macroDrop(attachOpaqueData: AttachOpaqueData, schemaPath: string[], name: string, ignoreNotFound?: boolean, transactionOpaqueData?: TransactionOpaqueData): Awaitable<void>;
413
408
  schemaContentsMacros(attachOpaqueData: AttachOpaqueData, path: string[], type: string, transactionOpaqueData?: TransactionOpaqueData): Awaitable<MacroInfo[]>;
414
409
  schemaContentsIndexes(attachOpaqueData: AttachOpaqueData, path: string[], transactionOpaqueData?: TransactionOpaqueData): Awaitable<IndexInfo[]>;
@@ -0,0 +1,4 @@
1
+ import type { MacroDescriptor } from "./descriptors.js";
2
+ import type { MacroOverload } from "../generated/vgi-client.js";
3
+ /** Convert a simple descriptor without treating default-value types as declarations. */
4
+ export declare function macroOverloads(macro: MacroDescriptor, owner: string[]): MacroOverload[];
@@ -86,7 +86,7 @@ export declare class ReadOnlyCatalogInterface extends CatalogInterface {
86
86
  */
87
87
  attachOptionSpecs(_name: string): AttachOptionSpec[];
88
88
  catalogsInfo(): CatalogInfo[];
89
- attach(name: string, options?: Record<string, unknown>, dataVersionSpec?: string | null, implementationVersion?: string | null): CatalogAttachResult | Promise<CatalogAttachResult>;
89
+ attach(name: string, options?: Record<string, unknown>, dataVersionSpec?: string | null, implementationVersion?: string | null, clientCapabilities?: Uint8Array | null): CatalogAttachResult | Promise<CatalogAttachResult>;
90
90
  detach(attachOpaqueData: AttachOpaqueData): void;
91
91
  version(attachOpaqueData: AttachOpaqueData, transactionOpaqueData?: TransactionOpaqueData): number | Promise<number>;
92
92
  /**
@@ -0,0 +1,2 @@
1
+ /** No constraint authority means every SQL user field must remain nullable. */
2
+ export declare function requireUnconstrainedColumns(columns: Uint8Array): void;
@@ -204,7 +204,7 @@ export declare class VgiClient {
204
204
  /** Get a table by name, or null if not found. */
205
205
  tableGet(attachOpaqueData: AttachOpaqueData, schemaPath: string[] | string, name: string, transactionOpaqueData?: TransactionOpaqueData): Promise<TableInfo | null>;
206
206
  /** Create a new table. */
207
- tableCreate(attachOpaqueData: AttachOpaqueData, schemaPath: string[] | string, name: string, columns: Uint8Array, onConflict: OnCreateConflict, notNullConstraints?: number[], uniqueConstraints?: number[][], checkConstraints?: string[], transactionOpaqueData?: TransactionOpaqueData): Promise<void>;
207
+ tableCreate(attachOpaqueData: AttachOpaqueData, schemaPath: string[] | string, name: string, columns: Uint8Array, onConflict: OnCreateConflict, constraintDefinitions?: Uint8Array[], transactionOpaqueData?: TransactionOpaqueData): Promise<void>;
208
208
  /** Drop a table by name. */
209
209
  tableDrop(attachOpaqueData: AttachOpaqueData, schemaPath: string[] | string, name: string, ignoreNotFound?: boolean, cascade?: boolean, transactionOpaqueData?: TransactionOpaqueData): Promise<void>;
210
210
  /**
@@ -218,43 +218,48 @@ export declare class VgiClient {
218
218
  /** Rename a table. */
219
219
  tableRename(attachOpaqueData: AttachOpaqueData, schemaPath: string[] | string, name: string, newName: string, ignoreNotFound?: boolean, transactionOpaqueData?: TransactionOpaqueData): Promise<void>;
220
220
  /** Add a column to a table. */
221
- tableColumnAdd(attachOpaqueData: AttachOpaqueData, schemaPath: string[] | string, name: string, columnName: string, columnType: string, defaultValue?: string | null, ignoreNotFound?: boolean, transactionOpaqueData?: TransactionOpaqueData): Promise<void>;
221
+ tableColumnAdd(attachOpaqueData: AttachOpaqueData, schemaPath: string[] | string, name: string, columnPath: string[], columnDefinition: Uint8Array, ignoreNotFound?: boolean, ifColumnNotExists?: boolean, transactionOpaqueData?: TransactionOpaqueData): Promise<void>;
222
222
  /** Drop a column from a table. */
223
- tableColumnDrop(attachOpaqueData: AttachOpaqueData, schemaPath: string[] | string, name: string, columnName: string, ignoreNotFound?: boolean, transactionOpaqueData?: TransactionOpaqueData): Promise<void>;
223
+ tableColumnDrop(attachOpaqueData: AttachOpaqueData, schemaPath: string[] | string, name: string, columnPath: string[], ignoreNotFound?: boolean, ifColumnExists?: boolean, cascade?: boolean, transactionOpaqueData?: TransactionOpaqueData): Promise<void>;
224
224
  /** Rename a column in a table. */
225
- tableColumnRename(attachOpaqueData: AttachOpaqueData, schemaPath: string[] | string, name: string, columnName: string, newName: string, ignoreNotFound?: boolean, transactionOpaqueData?: TransactionOpaqueData): Promise<void>;
226
- /** Set the default value for a column. */
227
- tableColumnDefaultSet(attachOpaqueData: AttachOpaqueData, schemaPath: string[] | string, name: string, columnName: string, defaultValue: string, ignoreNotFound?: boolean, transactionOpaqueData?: TransactionOpaqueData): Promise<void>;
225
+ tableColumnRename(attachOpaqueData: AttachOpaqueData, schemaPath: string[] | string, name: string, columnPath: string[], newColumnName: string, ignoreNotFound?: boolean, transactionOpaqueData?: TransactionOpaqueData): Promise<void>;
226
+ /** Set or clear the comment on a column. */
227
+ tableColumnCommentSet(attachOpaqueData: AttachOpaqueData, schemaPath: string[] | string, name: string, columnPath: string[], comment: string | null, ignoreNotFound?: boolean, transactionOpaqueData?: TransactionOpaqueData): Promise<void>;
228
+ /** Set the default using a serialized canonical SqlExpression record. */
229
+ tableColumnDefaultSet(attachOpaqueData: AttachOpaqueData, schemaPath: string[] | string, name: string, columnPath: string[], expression: Uint8Array, ignoreNotFound?: boolean, transactionOpaqueData?: TransactionOpaqueData): Promise<void>;
228
230
  /** Remove the default value from a column. */
229
- tableColumnDefaultDrop(attachOpaqueData: AttachOpaqueData, schemaPath: string[] | string, name: string, columnName: string, ignoreNotFound?: boolean, transactionOpaqueData?: TransactionOpaqueData): Promise<void>;
231
+ tableColumnDefaultDrop(attachOpaqueData: AttachOpaqueData, schemaPath: string[] | string, name: string, columnPath: string[], ignoreNotFound?: boolean, transactionOpaqueData?: TransactionOpaqueData): Promise<void>;
230
232
  /**
231
233
  * Change the type of a column.
232
234
  *
233
235
  * `columnDefinition` is a serialized Arrow Schema with a single field whose
234
236
  * name identifies the target column and whose type is the new column type.
235
- * `expression` is an optional SQL expression used to convert existing values.
237
+ * `expression` is a serialized canonical SqlExpression for USING, or null
238
+ * when no conversion expression was supplied.
236
239
  */
237
- tableColumnTypeChange(attachOpaqueData: AttachOpaqueData, schemaPath: string[] | string, name: string, columnDefinition: Uint8Array, expression?: string | null, ignoreNotFound?: boolean, transactionOpaqueData?: TransactionOpaqueData): Promise<void>;
240
+ tableColumnTypeChange(attachOpaqueData: AttachOpaqueData, schemaPath: string[] | string, name: string, columnPath: string[], columnDefinition: Uint8Array, expression?: Uint8Array | null, ignoreNotFound?: boolean, transactionOpaqueData?: TransactionOpaqueData): Promise<void>;
238
241
  /** Set a NOT NULL constraint on a column. */
239
- tableNotNullSet(attachOpaqueData: AttachOpaqueData, schemaPath: string[] | string, name: string, columnName: string, ignoreNotFound?: boolean, transactionOpaqueData?: TransactionOpaqueData): Promise<void>;
242
+ tableNotNullSet(attachOpaqueData: AttachOpaqueData, schemaPath: string[] | string, name: string, columnPath: string[], ignoreNotFound?: boolean, transactionOpaqueData?: TransactionOpaqueData): Promise<void>;
240
243
  /** Remove a NOT NULL constraint from a column. */
241
- tableNotNullDrop(attachOpaqueData: AttachOpaqueData, schemaPath: string[] | string, name: string, columnName: string, ignoreNotFound?: boolean, transactionOpaqueData?: TransactionOpaqueData): Promise<void>;
244
+ tableNotNullDrop(attachOpaqueData: AttachOpaqueData, schemaPath: string[] | string, name: string, columnPath: string[], ignoreNotFound?: boolean, transactionOpaqueData?: TransactionOpaqueData): Promise<void>;
242
245
  /** Get a view by name, or null if not found. */
243
246
  viewGet(attachOpaqueData: AttachOpaqueData, schemaPath: string[] | string, name: string, transactionOpaqueData?: TransactionOpaqueData): Promise<ViewInfo | null>;
244
247
  /** Create a new view. */
245
- viewCreate(attachOpaqueData: AttachOpaqueData, schemaPath: string[] | string, name: string, definition: string, onConflict: OnCreateConflict, transactionOpaqueData?: TransactionOpaqueData): Promise<void>;
248
+ viewCreate(attachOpaqueData: AttachOpaqueData, schemaPath: string[] | string, name: string, definition: string, onConflict: OnCreateConflict, transactionOpaqueData?: TransactionOpaqueData, aliases?: string[], security?: "regular" | "barrier", comment?: string | null, tags?: Record<string, string> | null, columnComments?: Record<string, string> | null): Promise<void>;
246
249
  /** Drop a view by name. */
247
250
  viewDrop(attachOpaqueData: AttachOpaqueData, schemaPath: string[] | string, name: string, ignoreNotFound?: boolean, cascade?: boolean, transactionOpaqueData?: TransactionOpaqueData): Promise<void>;
248
251
  /** Rename a view. */
249
252
  viewRename(attachOpaqueData: AttachOpaqueData, schemaPath: string[] | string, name: string, newName: string, ignoreNotFound?: boolean, transactionOpaqueData?: TransactionOpaqueData): Promise<void>;
250
253
  /** Set or clear the comment on a view. */
251
254
  viewCommentSet(attachOpaqueData: AttachOpaqueData, schemaPath: string[] | string, name: string, comment?: string | null, ignoreNotFound?: boolean, transactionOpaqueData?: TransactionOpaqueData): Promise<void>;
255
+ /** Set or clear a comment on one raw view output name. */
256
+ viewColumnCommentSet(attachOpaqueData: AttachOpaqueData, schemaPath: string[] | string, name: string, columnPath: string[], comment?: string | null, ignoreNotFound?: boolean, transactionOpaqueData?: TransactionOpaqueData): Promise<void>;
252
257
  /** Get a macro by name, or null if not found. */
253
258
  macroGet(attachOpaqueData: AttachOpaqueData, schemaPath: string[] | string, name: string, transactionOpaqueData?: TransactionOpaqueData): Promise<MacroInfo | null>;
254
259
  /** List macros in a schema, filtered by type. */
255
260
  schemaContentsMacros(attachOpaqueData: AttachOpaqueData, path: string[] | string, type: CatalogMacroType, transactionOpaqueData?: TransactionOpaqueData): Promise<MacroInfo[]>;
256
261
  /** Create a new macro. */
257
- macroCreate(attachOpaqueData: AttachOpaqueData, schemaPath: string[] | string, name: string, macroType: MacroType, parameters: string[], definition: string, onConflict: OnCreateConflict, parameterDefaultValues?: Uint8Array | null, argumentsSchema?: Uint8Array | null, transactionOpaqueData?: TransactionOpaqueData): Promise<void>;
262
+ macroCreate(attachOpaqueData: AttachOpaqueData, schemaPath: string[] | string, name: string, macroType: MacroType, overloads: import("../generated/vgi-client.js").MacroOverload[], onConflict: OnCreateConflict, transactionOpaqueData?: TransactionOpaqueData): Promise<void>;
258
263
  /** Drop a macro by name. */
259
264
  macroDrop(attachOpaqueData: AttachOpaqueData, schemaPath: string[] | string, name: string, ignoreNotFound?: boolean, transactionOpaqueData?: TransactionOpaqueData): Promise<void>;
260
265
  /** Close the underlying RPC connection. */