@query-farm/vgi 0.7.0 → 0.8.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/dist/catalog/descriptors.d.ts +6 -0
- package/dist/catalog/interface.d.ts +34 -0
- package/dist/generated/vgi-client.d.ts +1 -0
- package/dist/generated/vgi-protocol-schemas.d.ts +1 -0
- package/dist/index.js +36 -4
- package/dist/index.js.map +8 -8
- package/dist/worker-cf-entry.js +31 -3
- package/dist/worker-cf-entry.js.map +7 -7
- package/package.json +1 -1
- package/src/catalog/descriptors.ts +6 -0
- package/src/catalog/interface.ts +55 -1
- package/src/catalog/read-only.ts +6 -0
- package/src/client/client.ts +3 -0
- package/src/generated/vgi-client.ts +2 -1
- package/src/generated/vgi-protocol-schemas.ts +16 -1
- package/src/protocol/handlers/catalog/admin.ts +1 -0
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { VgiSchema, VgiDataType } from "../arrow/index.js";
|
|
2
|
+
import type { AttachCatalogInfo } from "./interface.js";
|
|
2
3
|
import type { VgiFunction } from "../functions/types.js";
|
|
3
4
|
import type { Arguments } from "../arguments/arguments.js";
|
|
4
5
|
import type { ColumnStatistics } from "../util/statistics.js";
|
|
@@ -142,6 +143,11 @@ export interface CatalogDescriptor {
|
|
|
142
143
|
schemas: SchemaDescriptor[];
|
|
143
144
|
settings?: SettingDescriptor[];
|
|
144
145
|
secretTypes?: SecretTypeDescriptor[];
|
|
146
|
+
/**
|
|
147
|
+
* Companion catalogs (lakehouse federation) the client should ATTACH when this
|
|
148
|
+
* VGI catalog attaches. Surfaced via `catalog_attach.attach_catalogs`.
|
|
149
|
+
*/
|
|
150
|
+
attachCatalogs?: AttachCatalogInfo[];
|
|
145
151
|
comment?: string;
|
|
146
152
|
tags?: Record<string, string>;
|
|
147
153
|
/**
|
|
@@ -56,6 +56,31 @@ export interface CopyFromFormatInfo {
|
|
|
56
56
|
}
|
|
57
57
|
/** Encode a CopyFromFormatInfo to Arrow IPC bytes (single-row batch). */
|
|
58
58
|
export declare const encodeCopyFromFormatInfo: (v: CopyFromFormatInfo) => Uint8Array;
|
|
59
|
+
/**
|
|
60
|
+
* A companion catalog the client should ATTACH when this VGI catalog attaches
|
|
61
|
+
* (lakehouse federation). Serialized into `CatalogAttachResult.attach_catalogs`;
|
|
62
|
+
* the C++ VGI extension attaches each at VGI-attach time so multi-branch
|
|
63
|
+
* catalog-table branches can resolve tables in a companion DuckLake / Iceberg /
|
|
64
|
+
* Postgres / DuckDB.
|
|
65
|
+
*/
|
|
66
|
+
export interface AttachCatalogInfo {
|
|
67
|
+
/** ATTACH alias; also a catalog-table ScanBranch's `sourceCatalog`. */
|
|
68
|
+
alias: string;
|
|
69
|
+
/** ATTACH target — a path or DSN (e.g. `ducklake:sqlite:/data/meta.sqlite`). */
|
|
70
|
+
target: string;
|
|
71
|
+
/** DuckDB db type; empty => inferred from the target scheme prefix. */
|
|
72
|
+
db_type?: string;
|
|
73
|
+
/** Extra ATTACH options forwarded verbatim (e.g. DuckLake DATA_PATH). */
|
|
74
|
+
options?: Record<string, string>;
|
|
75
|
+
/** Attach hidden (excluded from duckdb_databases()); still resolvable. */
|
|
76
|
+
hidden?: boolean;
|
|
77
|
+
/** When true, attach failure fails the whole VGI ATTACH. */
|
|
78
|
+
required?: boolean;
|
|
79
|
+
/** Optional named secret to inject into the companion's ATTACH options. */
|
|
80
|
+
secret_ref?: string;
|
|
81
|
+
}
|
|
82
|
+
/** Encode an AttachCatalogInfo to Arrow IPC bytes (single-row batch). */
|
|
83
|
+
export declare const encodeAttachCatalogInfo: (v: AttachCatalogInfo) => Uint8Array;
|
|
59
84
|
import { type VgiDataType } from "../arrow/index.js";
|
|
60
85
|
/**
|
|
61
86
|
* Result from `tableScanFunctionGet` — tells the VGI DuckDB extension which
|
|
@@ -124,6 +149,15 @@ export interface ScanBranchInput {
|
|
|
124
149
|
branchFilter?: string | null;
|
|
125
150
|
/** Declares this branch as the INSERT target (at most one per table). */
|
|
126
151
|
writable?: boolean;
|
|
152
|
+
/**
|
|
153
|
+
* Catalog-table branch (lakehouse federation): leave `functionName` empty and
|
|
154
|
+
* set these to scan the base table
|
|
155
|
+
* `sourceCatalog.sourceSchema.sourceTable` in a companion catalog instead of
|
|
156
|
+
* calling a table function.
|
|
157
|
+
*/
|
|
158
|
+
sourceCatalog?: string | null;
|
|
159
|
+
sourceSchema?: string | null;
|
|
160
|
+
sourceTable?: string | null;
|
|
127
161
|
}
|
|
128
162
|
/**
|
|
129
163
|
* Build a multi-branch `ScanBranchesResult` wire dict from explicit branch
|
|
@@ -304,6 +304,7 @@ export interface CatalogAttachResult {
|
|
|
304
304
|
default_schema: string;
|
|
305
305
|
settings: Uint8Array[];
|
|
306
306
|
secret_types: Uint8Array[];
|
|
307
|
+
attach_catalogs: Uint8Array[];
|
|
307
308
|
comment?: string | null;
|
|
308
309
|
tags: Record<string, string>;
|
|
309
310
|
supports_column_statistics: boolean;
|
|
@@ -9,6 +9,7 @@ export declare const CopyFromFormatInfoSchema: import("../index.core.js").VgiSch
|
|
|
9
9
|
export declare const ScanFunctionResultSchema: import("../index.core.js").VgiSchema;
|
|
10
10
|
export declare const ScanBranchesResultSchema: import("../index.core.js").VgiSchema;
|
|
11
11
|
export declare const ScanBranchSchema: import("../index.core.js").VgiSchema;
|
|
12
|
+
export declare const AttachCatalogInfoSchema: import("../index.core.js").VgiSchema;
|
|
12
13
|
export declare const AggregateBindResultSchema: import("../index.core.js").VgiSchema;
|
|
13
14
|
export declare const AggregateCombineResultSchema: import("../index.core.js").VgiSchema;
|
|
14
15
|
export declare const AggregateDestructorResultSchema: import("../index.core.js").VgiSchema;
|
package/dist/index.js
CHANGED
|
@@ -5584,7 +5584,19 @@ var ScanBranchSchema = schema2([
|
|
|
5584
5584
|
field2("function_name", utf82(), false),
|
|
5585
5585
|
field2("arguments", binary2(), false),
|
|
5586
5586
|
field2("branch_filter", utf82(), true),
|
|
5587
|
-
field2("writable", bool2(), false)
|
|
5587
|
+
field2("writable", bool2(), false),
|
|
5588
|
+
field2("source_catalog", utf82(), true),
|
|
5589
|
+
field2("source_schema", utf82(), true),
|
|
5590
|
+
field2("source_table", utf82(), true)
|
|
5591
|
+
]);
|
|
5592
|
+
var AttachCatalogInfoSchema = schema2([
|
|
5593
|
+
field2("alias", utf82(), false),
|
|
5594
|
+
field2("target", utf82(), false),
|
|
5595
|
+
field2("db_type", utf82(), false),
|
|
5596
|
+
field2("options", map2(field2("key", utf82(), false), field2("value", utf82(), true), false), false),
|
|
5597
|
+
field2("hidden", bool2(), false),
|
|
5598
|
+
field2("required", bool2(), false),
|
|
5599
|
+
field2("secret_ref", utf82(), false)
|
|
5588
5600
|
]);
|
|
5589
5601
|
var AggregateBindResultSchema = schema2([
|
|
5590
5602
|
field2("output_schema", binary2(), false),
|
|
@@ -5628,6 +5640,7 @@ var CatalogAttachResultSchema = schema2([
|
|
|
5628
5640
|
field2("default_schema", utf82(), false),
|
|
5629
5641
|
field2("settings", list2(field2("item", binary2(), true)), false),
|
|
5630
5642
|
field2("secret_types", list2(field2("item", binary2(), true)), false),
|
|
5643
|
+
field2("attach_catalogs", list2(field2("item", binary2(), true)), false),
|
|
5631
5644
|
field2("comment", utf82(), true),
|
|
5632
5645
|
field2("tags", map2(field2("key", utf82(), false), field2("value", utf82(), true), false), false),
|
|
5633
5646
|
field2("supports_column_statistics", bool2(), false),
|
|
@@ -6090,6 +6103,15 @@ var encodeCopyFromFormatInfo = (v) => encodeASD(CopyFromFormatInfoSchema, {
|
|
|
6090
6103
|
description: v.description ?? "",
|
|
6091
6104
|
ordered: v.ordered ?? false
|
|
6092
6105
|
});
|
|
6106
|
+
var encodeAttachCatalogInfo = (v) => encodeASD(AttachCatalogInfoSchema, {
|
|
6107
|
+
alias: v.alias,
|
|
6108
|
+
target: v.target,
|
|
6109
|
+
db_type: v.db_type ?? "",
|
|
6110
|
+
options: v.options ?? {},
|
|
6111
|
+
hidden: v.hidden ?? false,
|
|
6112
|
+
required: v.required ?? false,
|
|
6113
|
+
secret_ref: v.secret_ref ?? ""
|
|
6114
|
+
});
|
|
6093
6115
|
function decodeScanFunctionResult(inner) {
|
|
6094
6116
|
const argsBytes = inner.arguments;
|
|
6095
6117
|
const positionalArguments = [];
|
|
@@ -6123,7 +6145,10 @@ function singleBranchResult(legacy) {
|
|
|
6123
6145
|
function_name: [legacy.function_name],
|
|
6124
6146
|
arguments: [toUint8Array(legacy.arguments)],
|
|
6125
6147
|
branch_filter: [null],
|
|
6126
|
-
writable: [false]
|
|
6148
|
+
writable: [false],
|
|
6149
|
+
source_catalog: [null],
|
|
6150
|
+
source_schema: [null],
|
|
6151
|
+
source_table: [null]
|
|
6127
6152
|
}, ScanBranchSchema);
|
|
6128
6153
|
return {
|
|
6129
6154
|
branches: [serializeBatch(branchBatch)],
|
|
@@ -6152,7 +6177,10 @@ function buildScanBranchesResult(branches, requiredExtensions = []) {
|
|
|
6152
6177
|
function_name: [branch.functionName],
|
|
6153
6178
|
arguments: [serializeBranchArguments(branch)],
|
|
6154
6179
|
branch_filter: [branch.branchFilter ?? null],
|
|
6155
|
-
writable: [branch.writable ?? false]
|
|
6180
|
+
writable: [branch.writable ?? false],
|
|
6181
|
+
source_catalog: [branch.sourceCatalog ?? null],
|
|
6182
|
+
source_schema: [branch.sourceSchema ?? null],
|
|
6183
|
+
source_table: [branch.sourceTable ?? null]
|
|
6156
6184
|
}, ScanBranchSchema);
|
|
6157
6185
|
return serializeBatch(branchBatch);
|
|
6158
6186
|
});
|
|
@@ -6525,6 +6553,7 @@ class ReadOnlyCatalogInterface extends CatalogInterface {
|
|
|
6525
6553
|
this._attachments.set(name, attachOpaqueData);
|
|
6526
6554
|
const settings = (this._descriptor.settings ?? []).map((s) => serializeSetting(s));
|
|
6527
6555
|
const secretTypes = (this._descriptor.secretTypes ?? []).map((s) => serializeSecretType(s));
|
|
6556
|
+
const attachCatalogs = (this._descriptor.attachCatalogs ?? []).map((c) => encodeAttachCatalogInfo(c));
|
|
6528
6557
|
const hasTimeTravel = this._descriptor.schemas.some((s) => s.tables?.some((t) => t.supportsTimeTravel) ?? false);
|
|
6529
6558
|
return {
|
|
6530
6559
|
attach_opaque_data: attachOpaqueData,
|
|
@@ -6536,6 +6565,7 @@ class ReadOnlyCatalogInterface extends CatalogInterface {
|
|
|
6536
6565
|
default_schema: this._descriptor.defaultSchema ?? "main",
|
|
6537
6566
|
settings,
|
|
6538
6567
|
secret_types: secretTypes,
|
|
6568
|
+
attach_catalogs: attachCatalogs,
|
|
6539
6569
|
comment: this._descriptor.comment ?? null,
|
|
6540
6570
|
tags: this._descriptor.tags ?? {},
|
|
6541
6571
|
supports_column_statistics: true,
|
|
@@ -9166,6 +9196,7 @@ function registerCatalogAdminMethods(protocol, getCatalog, signingKey) {
|
|
|
9166
9196
|
default_schema: result.default_schema ?? "main",
|
|
9167
9197
|
settings: result.settings ?? [],
|
|
9168
9198
|
secret_types: result.secret_types ?? [],
|
|
9199
|
+
attach_catalogs: result.attach_catalogs ?? [],
|
|
9169
9200
|
comment: result.comment ?? null,
|
|
9170
9201
|
tags: result.tags ?? {},
|
|
9171
9202
|
supports_column_statistics: result.supports_column_statistics ?? true,
|
|
@@ -10256,6 +10287,7 @@ class VgiClient {
|
|
|
10256
10287
|
default_schema: inner.default_schema ?? "main",
|
|
10257
10288
|
settings: inner.settings ? (Array.isArray(inner.settings) ? inner.settings : [...inner.settings]).map(toUint8Array) : [],
|
|
10258
10289
|
secret_types: inner.secret_types ? (Array.isArray(inner.secret_types) ? inner.secret_types : [...inner.secret_types]).map(toUint8Array) : [],
|
|
10290
|
+
attach_catalogs: inner.attach_catalogs ? (Array.isArray(inner.attach_catalogs) ? inner.attach_catalogs : [...inner.attach_catalogs]).map(toUint8Array) : [],
|
|
10259
10291
|
comment: inner.comment ?? null,
|
|
10260
10292
|
tags: deserializeTags(inner.tags),
|
|
10261
10293
|
supports_column_statistics: inner.supports_column_statistics ?? false,
|
|
@@ -10885,4 +10917,4 @@ export {
|
|
|
10885
10917
|
ArgumentValidationError
|
|
10886
10918
|
};
|
|
10887
10919
|
|
|
10888
|
-
//# debugId=
|
|
10920
|
+
//# debugId=2E19C6BFB109AD5C64756E2164756E21
|