@query-farm/vgi 0.29.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.
- package/README.md +26 -1
- package/dist/arguments/argument-spec.d.ts +4 -2
- package/dist/catalog/composite.d.ts +13 -13
- package/dist/catalog/descriptors.d.ts +7 -3
- package/dist/catalog/interface.d.ts +67 -40
- package/dist/catalog/read-only.d.ts +32 -15
- package/dist/client/client.d.ts +36 -29
- package/dist/client/types.d.ts +2 -0
- package/dist/client-entry.d.ts +1 -1
- package/dist/client-entry.js +441 -279
- package/dist/client-entry.js.map +12 -11
- package/dist/filter-pushdown/capabilities.d.ts +3 -0
- package/dist/filter-pushdown/deserialize.d.ts +14 -15
- package/dist/filter-pushdown/evaluate.d.ts +14 -44
- package/dist/filter-pushdown/index.d.ts +2 -2
- package/dist/filter-pushdown/types.d.ts +120 -68
- package/dist/functions/aggregate.d.ts +4 -0
- package/dist/functions/registry.d.ts +5 -5
- package/dist/functions/scalar.d.ts +6 -1
- package/dist/functions/table-buffering.d.ts +9 -0
- package/dist/functions/table-in-out.d.ts +13 -0
- package/dist/functions/table.d.ts +9 -2
- package/dist/functions/types.d.ts +22 -2
- package/dist/generated/vgi-client.d.ts +56 -27
- package/dist/generated/vgi-protocol-schemas.d.ts +15 -0
- package/dist/http/fetch.d.ts +7 -1
- package/dist/index.core.d.ts +2 -1
- package/dist/index.js +2317 -1354
- package/dist/index.js.map +43 -40
- package/dist/metadata/types.d.ts +15 -2
- package/dist/protocol/handlers/shared.d.ts +3 -1
- package/dist/protocol/serializers/splits.d.ts +1 -1
- package/dist/protocol/types.d.ts +9 -3
- package/dist/schema-path.d.ts +7 -0
- package/dist/serve-entry.d.ts +22 -1
- package/dist/serve-entry.js +412 -238
- package/dist/serve-entry.js.map +27 -26
- package/dist/split-token.d.ts +1 -1
- package/dist/types.d.ts +8 -0
- package/dist/worker-cf-entry.js +2030 -1201
- package/dist/worker-cf-entry.js.map +40 -36
- package/dist/worker.d.ts +1 -1
- package/package.json +3 -3
- package/src/arguments/argument-spec.ts +12 -4
- package/src/catalog/composite.ts +26 -26
- package/src/catalog/descriptors.ts +12 -3
- package/src/catalog/interface.ts +98 -48
- package/src/catalog/read-only.ts +124 -67
- package/src/client/client.ts +92 -72
- package/src/client/types.ts +2 -0
- package/src/client-entry.ts +2 -1
- package/src/filter-pushdown/capabilities.ts +13 -0
- package/src/filter-pushdown/collector.ts +22 -35
- package/src/filter-pushdown/deserialize.ts +657 -221
- package/src/filter-pushdown/evaluate.ts +410 -499
- package/src/filter-pushdown/index.ts +16 -2
- package/src/filter-pushdown/types.ts +88 -71
- package/src/functions/aggregate.ts +9 -1
- package/src/functions/registry.ts +24 -22
- package/src/functions/scalar.ts +26 -0
- package/src/functions/table-buffering.ts +46 -7
- package/src/functions/table-in-out.ts +187 -30
- package/src/functions/table.ts +58 -20
- package/src/functions/types.ts +24 -1
- package/src/generated/vgi-client.ts +61 -29
- package/src/generated/vgi-protocol-schemas.ts +225 -54
- package/src/http/fetch.ts +12 -0
- package/src/index.core.ts +2 -0
- package/src/metadata/resolve.ts +43 -1
- package/src/metadata/serialize.ts +43 -5
- package/src/metadata/types.ts +17 -1
- package/src/protocol/dispatch.ts +1 -1
- package/src/protocol/handlers/aggregate.ts +13 -7
- package/src/protocol/handlers/catalog/admin.ts +6 -6
- package/src/protocol/handlers/catalog/index_methods.ts +2 -2
- package/src/protocol/handlers/catalog/macro.ts +4 -4
- package/src/protocol/handlers/catalog/shared.ts +2 -0
- package/src/protocol/handlers/catalog/table.ts +16 -16
- package/src/protocol/handlers/catalog/view.ts +5 -5
- package/src/protocol/handlers/function.ts +2 -2
- package/src/protocol/handlers/shared.ts +12 -3
- package/src/protocol/handlers/table-buffering.ts +4 -4
- package/src/protocol/serializers/bind.ts +15 -6
- package/src/protocol/serializers/splits.ts +4 -2
- package/src/protocol/types.ts +9 -3
- package/src/schema-path.ts +25 -0
- package/src/serve-entry.ts +65 -3
- package/src/split-token.ts +2 -2
- package/src/types.ts +9 -0
- package/src/worker.ts +49 -4
package/dist/serve-entry.js
CHANGED
|
@@ -1,28 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
function __accessProp(key) {
|
|
7
|
-
return this[key];
|
|
8
|
-
}
|
|
9
|
-
var __toCommonJS = (from) => {
|
|
10
|
-
var entry = (__moduleCache ??= new WeakMap).get(from), desc;
|
|
11
|
-
if (entry)
|
|
12
|
-
return entry;
|
|
13
|
-
entry = __defProp({}, "__esModule", { value: true });
|
|
14
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
-
for (var key of __getOwnPropNames(from))
|
|
16
|
-
if (!__hasOwnProp.call(entry, key))
|
|
17
|
-
__defProp(entry, key, {
|
|
18
|
-
get: __accessProp.bind(from, key),
|
|
19
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
20
|
-
});
|
|
21
|
-
}
|
|
22
|
-
__moduleCache.set(from, entry);
|
|
23
|
-
return entry;
|
|
24
|
-
};
|
|
25
|
-
var __moduleCache;
|
|
26
3
|
var __returnValue = (v) => v;
|
|
27
4
|
function __exportSetter(name, newValue) {
|
|
28
5
|
this[name] = __returnValue.bind(null, newValue);
|
|
@@ -36,15 +13,19 @@ var __export = (target, all) => {
|
|
|
36
13
|
set: __exportSetter.bind(all, name)
|
|
37
14
|
});
|
|
38
15
|
};
|
|
39
|
-
var __esm = (fn, res) => () =>
|
|
40
|
-
|
|
16
|
+
var __esm = (fn, res, err) => () => {
|
|
17
|
+
if (fn)
|
|
18
|
+
try {
|
|
19
|
+
res = fn(fn = 0);
|
|
20
|
+
} catch (e) {
|
|
21
|
+
err = [e];
|
|
22
|
+
}
|
|
23
|
+
if (err)
|
|
24
|
+
throw err[0];
|
|
25
|
+
return res;
|
|
26
|
+
};
|
|
41
27
|
|
|
42
28
|
// src/functions/storage-cf-do.ts
|
|
43
|
-
var exports_storage_cf_do = {};
|
|
44
|
-
__export(exports_storage_cf_do, {
|
|
45
|
-
FunctionStorageCfDo: () => FunctionStorageCfDo
|
|
46
|
-
});
|
|
47
|
-
|
|
48
29
|
class FunctionStorageCfDo {
|
|
49
30
|
_baseUrl;
|
|
50
31
|
_token;
|
|
@@ -185,8 +166,8 @@ class FunctionStorageCfDo {
|
|
|
185
166
|
let resp;
|
|
186
167
|
try {
|
|
187
168
|
resp = await this._fetch(url, { method: "POST", headers, body: payload });
|
|
188
|
-
} catch (
|
|
189
|
-
lastErr =
|
|
169
|
+
} catch (err) {
|
|
170
|
+
lastErr = err;
|
|
190
171
|
continue;
|
|
191
172
|
}
|
|
192
173
|
let data;
|
|
@@ -231,16 +212,16 @@ function int64FromKey(b) {
|
|
|
231
212
|
return Number(new DataView(b.buffer, b.byteOffset, 8).getBigInt64(0, false));
|
|
232
213
|
}
|
|
233
214
|
function bytesToB64(buf) {
|
|
234
|
-
let
|
|
215
|
+
let binary = "";
|
|
235
216
|
for (let i = 0;i < buf.length; i++)
|
|
236
|
-
|
|
237
|
-
return btoa(
|
|
217
|
+
binary += String.fromCharCode(buf[i]);
|
|
218
|
+
return btoa(binary);
|
|
238
219
|
}
|
|
239
220
|
function b64ToBytes(b64) {
|
|
240
|
-
const
|
|
241
|
-
const out = new Uint8Array(
|
|
242
|
-
for (let i = 0;i <
|
|
243
|
-
out[i] =
|
|
221
|
+
const binary = atob(b64);
|
|
222
|
+
const out = new Uint8Array(binary.length);
|
|
223
|
+
for (let i = 0;i < binary.length; i++)
|
|
224
|
+
out[i] = binary.charCodeAt(i);
|
|
244
225
|
return out;
|
|
245
226
|
}
|
|
246
227
|
var NS_WORKER;
|
|
@@ -482,18 +463,18 @@ class BoundStorage {
|
|
|
482
463
|
}
|
|
483
464
|
}
|
|
484
465
|
function resolveStorageFromEnv() {
|
|
485
|
-
const
|
|
486
|
-
if (
|
|
466
|
+
const backend = (process.env.VGI_WORKER_SHARED_STORAGE ?? "sqlite").toLowerCase();
|
|
467
|
+
if (backend === "memory") {
|
|
487
468
|
return new FunctionStorageSqlite(":memory:");
|
|
488
469
|
}
|
|
489
|
-
if (
|
|
470
|
+
if (backend === "sqlite") {
|
|
490
471
|
return new FunctionStorageSqlite;
|
|
491
472
|
}
|
|
492
|
-
if (
|
|
493
|
-
|
|
494
|
-
return
|
|
473
|
+
if (backend === "cloudflare-do") {
|
|
474
|
+
init_storage_cf_do();
|
|
475
|
+
return FunctionStorageCfDo.fromEnv();
|
|
495
476
|
}
|
|
496
|
-
throw new Error(`Unknown VGI_WORKER_SHARED_STORAGE backend: '${
|
|
477
|
+
throw new Error(`Unknown VGI_WORKER_SHARED_STORAGE backend: '${backend}'. Supported: 'memory', 'sqlite', 'cloudflare-do'.`);
|
|
497
478
|
}
|
|
498
479
|
function getDefaultStorage() {
|
|
499
480
|
if (_resolved == null)
|
|
@@ -531,6 +512,14 @@ var init_storage = __esm(() => {
|
|
|
531
512
|
});
|
|
532
513
|
});
|
|
533
514
|
|
|
515
|
+
// src/serve-entry.ts
|
|
516
|
+
import {
|
|
517
|
+
irohForwardedHeaderIdentityProvider,
|
|
518
|
+
IROH_FORWARDED_ENDPOINT_HEADER,
|
|
519
|
+
observePeerIdentity,
|
|
520
|
+
peerIdentityPrimary
|
|
521
|
+
} from "@query-farm/vgi-rpc";
|
|
522
|
+
|
|
534
523
|
// src/http/fetch.ts
|
|
535
524
|
import {
|
|
536
525
|
AuthContext,
|
|
@@ -840,8 +829,8 @@ import {
|
|
|
840
829
|
DataType,
|
|
841
830
|
makeData
|
|
842
831
|
} from "@query-farm/apache-arrow";
|
|
843
|
-
function emptyData(
|
|
844
|
-
const type =
|
|
832
|
+
function emptyData(field) {
|
|
833
|
+
const type = field.type;
|
|
845
834
|
if (DataType.isList(type)) {
|
|
846
835
|
const childField = type.children[0];
|
|
847
836
|
return makeData({
|
|
@@ -868,8 +857,8 @@ function emptyData(field2) {
|
|
|
868
857
|
}
|
|
869
858
|
return makeData({ type, length: 0, nullCount: 0 });
|
|
870
859
|
}
|
|
871
|
-
function emptyBatch(
|
|
872
|
-
const a =
|
|
860
|
+
function emptyBatch(schema) {
|
|
861
|
+
const a = schema;
|
|
873
862
|
const children = a.fields.map((f) => emptyData(f));
|
|
874
863
|
const structType = new Struct(a.fields);
|
|
875
864
|
const data = makeData({
|
|
@@ -1876,8 +1865,8 @@ function readUnion(type, col, data, index) {
|
|
|
1876
1865
|
const children = type.children;
|
|
1877
1866
|
const typeIds = data?.typeIds;
|
|
1878
1867
|
const tcode = typeIds ? typeIds[index] : children.length > 0 ? 0 : -1;
|
|
1879
|
-
const
|
|
1880
|
-
const childIdx =
|
|
1868
|
+
const map = type.typeIdToChildIndex;
|
|
1869
|
+
const childIdx = map && map[tcode] !== undefined ? map[tcode] : tcode;
|
|
1881
1870
|
const childField = children[childIdx];
|
|
1882
1871
|
if (!childField)
|
|
1883
1872
|
return { tag: null, value: null };
|
|
@@ -1939,19 +1928,19 @@ function readDictionary(type, col, data, index) {
|
|
|
1939
1928
|
function columnFromArray(values, type) {
|
|
1940
1929
|
return vectorFromArray2(values, type).data[0];
|
|
1941
1930
|
}
|
|
1942
|
-
function batchFromRows(rows,
|
|
1943
|
-
const a =
|
|
1931
|
+
function batchFromRows(rows, schema) {
|
|
1932
|
+
const a = schema;
|
|
1944
1933
|
if (rows.length === 0) {
|
|
1945
1934
|
return emptyBatch(a);
|
|
1946
1935
|
}
|
|
1947
1936
|
const columns = {};
|
|
1948
|
-
for (const
|
|
1949
|
-
columns[
|
|
1937
|
+
for (const field of a.fields) {
|
|
1938
|
+
columns[field.name] = rows.map((r) => r[field.name] ?? null);
|
|
1950
1939
|
}
|
|
1951
1940
|
return batchFromColumns(columns, a);
|
|
1952
1941
|
}
|
|
1953
|
-
function batchFromColumns(columns,
|
|
1954
|
-
const a =
|
|
1942
|
+
function batchFromColumns(columns, schema, repr = "rich") {
|
|
1943
|
+
const a = schema;
|
|
1955
1944
|
const numRows = a.fields.length > 0 ? columns[a.fields[0].name]?.length ?? 0 : 0;
|
|
1956
1945
|
const children = a.fields.map((f) => {
|
|
1957
1946
|
const values = columns[f.name];
|
|
@@ -1979,15 +1968,15 @@ function* iterRows(batch, repr = "rich") {
|
|
|
1979
1968
|
for (let i = 0;i < a.numRows; i++) {
|
|
1980
1969
|
const row = {};
|
|
1981
1970
|
for (let fi = 0;fi < a.schema.fields.length; fi++) {
|
|
1982
|
-
const
|
|
1983
|
-
const col = a.getChild(
|
|
1971
|
+
const field = a.schema.fields[fi];
|
|
1972
|
+
const col = a.getChild(field.name);
|
|
1984
1973
|
if (!col) {
|
|
1985
|
-
row[
|
|
1974
|
+
row[field.name] = null;
|
|
1986
1975
|
continue;
|
|
1987
1976
|
}
|
|
1988
|
-
const canonical = readCanonicalValue(
|
|
1977
|
+
const canonical = readCanonicalValue(field.type, col, i);
|
|
1989
1978
|
const codec = codecs[fi];
|
|
1990
|
-
row[
|
|
1979
|
+
row[field.name] = repr === "raw" ? codec.canonicalToRaw(canonical) : codec.canonicalToRich(canonical);
|
|
1991
1980
|
}
|
|
1992
1981
|
yield row;
|
|
1993
1982
|
}
|
|
@@ -1999,12 +1988,12 @@ function batchToScalarDict(batch) {
|
|
|
1999
1988
|
if (a.numRows === 0)
|
|
2000
1989
|
return {};
|
|
2001
1990
|
const result = {};
|
|
2002
|
-
for (const
|
|
2003
|
-
const col = a.getChild(
|
|
1991
|
+
for (const field of a.schema.fields) {
|
|
1992
|
+
const col = a.getChild(field.name);
|
|
2004
1993
|
if (col) {
|
|
2005
|
-
const type =
|
|
1994
|
+
const type = field.type;
|
|
2006
1995
|
const canonical = readCanonicalValue(type, col, 0);
|
|
2007
|
-
result[
|
|
1996
|
+
result[field.name] = codecFor(type).canonicalToRich(canonical);
|
|
2008
1997
|
}
|
|
2009
1998
|
}
|
|
2010
1999
|
return result;
|
|
@@ -2030,18 +2019,18 @@ function batchToSecretDict(batch) {
|
|
|
2030
2019
|
if (a.numRows === 0)
|
|
2031
2020
|
return {};
|
|
2032
2021
|
const result = {};
|
|
2033
|
-
for (const
|
|
2034
|
-
const col = a.getChild(
|
|
2022
|
+
for (const field of a.schema.fields) {
|
|
2023
|
+
const col = a.getChild(field.name);
|
|
2035
2024
|
if (col) {
|
|
2036
|
-
const type =
|
|
2025
|
+
const type = field.type;
|
|
2037
2026
|
const val = codecFor(type).canonicalToRich(readCanonicalValue(type, col, 0));
|
|
2038
|
-
let key =
|
|
2027
|
+
let key = field.name;
|
|
2039
2028
|
let scope;
|
|
2040
|
-
if (
|
|
2041
|
-
const secretType =
|
|
2029
|
+
if (field.name.startsWith("secret_")) {
|
|
2030
|
+
const secretType = field.metadata?.get?.("secret_type");
|
|
2042
2031
|
if (secretType) {
|
|
2043
2032
|
key = secretType;
|
|
2044
|
-
scope =
|
|
2033
|
+
scope = field.metadata?.get?.("scope") ?? undefined;
|
|
2045
2034
|
}
|
|
2046
2035
|
}
|
|
2047
2036
|
if (val && typeof val === "object" && !ArrayBuffer.isView(val)) {
|
|
@@ -2090,11 +2079,11 @@ function filterBatch(batch, mask) {
|
|
|
2090
2079
|
indices.push(i);
|
|
2091
2080
|
}
|
|
2092
2081
|
const columns = {};
|
|
2093
|
-
for (const
|
|
2094
|
-
const col = a.getChild(
|
|
2095
|
-
const type =
|
|
2082
|
+
for (const field of a.schema.fields) {
|
|
2083
|
+
const col = a.getChild(field.name);
|
|
2084
|
+
const type = field.type;
|
|
2096
2085
|
const codec = codecFor(type);
|
|
2097
|
-
columns[
|
|
2086
|
+
columns[field.name] = indices.map((i) => codec.canonicalToRich(readCanonicalValue(type, col, i)));
|
|
2098
2087
|
}
|
|
2099
2088
|
return batchFromColumns(columns, a.schema);
|
|
2100
2089
|
}
|
|
@@ -2116,8 +2105,8 @@ function validateProjectionIds(caller, projectionIds, fieldCount) {
|
|
|
2116
2105
|
}
|
|
2117
2106
|
return projectionIds.filter((i) => i >= 0 && i < fieldCount);
|
|
2118
2107
|
}
|
|
2119
|
-
function projectSchema(projectionIds,
|
|
2120
|
-
const a =
|
|
2108
|
+
function projectSchema(projectionIds, schema) {
|
|
2109
|
+
const a = schema;
|
|
2121
2110
|
if (!projectionIds)
|
|
2122
2111
|
return a;
|
|
2123
2112
|
const validIds = validateProjectionIds("projectSchema", projectionIds, a.fields.length);
|
|
@@ -2158,9 +2147,9 @@ import {
|
|
|
2158
2147
|
RecordBatchStreamWriter,
|
|
2159
2148
|
RecordBatchReader
|
|
2160
2149
|
} from "@query-farm/apache-arrow";
|
|
2161
|
-
function serializeSchema(
|
|
2150
|
+
function serializeSchema(schema) {
|
|
2162
2151
|
const writer = new RecordBatchStreamWriter;
|
|
2163
|
-
writer.reset(undefined,
|
|
2152
|
+
writer.reset(undefined, schema);
|
|
2164
2153
|
writer.close();
|
|
2165
2154
|
return writer.toUint8Array(true);
|
|
2166
2155
|
}
|
|
@@ -2228,20 +2217,20 @@ function buildTypedColumnData(values, type) {
|
|
|
2228
2217
|
function buildStatisticsBatch(stats) {
|
|
2229
2218
|
if (stats.length === 0) {
|
|
2230
2219
|
const nullField = new Field3("0", new Null, true);
|
|
2231
|
-
const
|
|
2232
|
-
const
|
|
2233
|
-
type:
|
|
2220
|
+
const unionType = new SparseUnion([0], [nullField]);
|
|
2221
|
+
const minData = makeData5({
|
|
2222
|
+
type: unionType,
|
|
2234
2223
|
length: 0,
|
|
2235
2224
|
typeIds: new Int8Array(0),
|
|
2236
2225
|
children: [makeData5({ type: new Null, length: 0, nullCount: 0 })]
|
|
2237
2226
|
});
|
|
2238
|
-
const
|
|
2239
|
-
type:
|
|
2227
|
+
const maxData = makeData5({
|
|
2228
|
+
type: unionType,
|
|
2240
2229
|
length: 0,
|
|
2241
2230
|
typeIds: new Int8Array(0),
|
|
2242
2231
|
children: [makeData5({ type: new Null, length: 0, nullCount: 0 })]
|
|
2243
2232
|
});
|
|
2244
|
-
return assemble([],
|
|
2233
|
+
return assemble([], minData, maxData, [], [], [], [], [], unionType);
|
|
2245
2234
|
}
|
|
2246
2235
|
const typeOrder = [];
|
|
2247
2236
|
const typeIdMap = new Map;
|
|
@@ -2285,7 +2274,7 @@ function buildStatisticsBatch(stats) {
|
|
|
2285
2274
|
return assemble(stats.map((s) => s.columnName), minData, maxData, stats.map((s) => s.hasNull), stats.map((s) => s.hasNotNull), stats.map((s) => s.distinctCount == null ? null : BigInt(s.distinctCount)), stats.map((s) => s.containsUnicode), stats.map((s) => s.maxStringLength == null ? null : BigInt(s.maxStringLength)), unionType);
|
|
2286
2275
|
}
|
|
2287
2276
|
function assemble(columnNames, minData, maxData, hasNull, hasNotNull, distinctCount, containsUnicode, maxStringLength, unionType) {
|
|
2288
|
-
const
|
|
2277
|
+
const schema = new Schema5([
|
|
2289
2278
|
new Field3("column_name", new Utf8, false),
|
|
2290
2279
|
new Field3("min", unionType, true),
|
|
2291
2280
|
new Field3("max", unionType, true),
|
|
@@ -2306,9 +2295,9 @@ function assemble(columnNames, minData, maxData, hasNull, hasNotNull, distinctCo
|
|
|
2306
2295
|
buildTypedColumnData(containsUnicode, new Bool),
|
|
2307
2296
|
buildTypedColumnData(maxStringLength, new Uint64)
|
|
2308
2297
|
];
|
|
2309
|
-
const structType = new Struct5(
|
|
2298
|
+
const structType = new Struct5(schema.fields);
|
|
2310
2299
|
const data = makeData5({ type: structType, length: n, children, nullCount: 0 });
|
|
2311
|
-
return new RecordBatch6(
|
|
2300
|
+
return new RecordBatch6(schema, data);
|
|
2312
2301
|
}
|
|
2313
2302
|
|
|
2314
2303
|
// src/arrow/impl-arrowjs/index.ts
|
|
@@ -2326,6 +2315,7 @@ var bool2 = () => bool();
|
|
|
2326
2315
|
var int162 = () => int16();
|
|
2327
2316
|
var int322 = () => int32();
|
|
2328
2317
|
var int642 = () => int64();
|
|
2318
|
+
var uint642 = () => uint64();
|
|
2329
2319
|
var float642 = () => float64();
|
|
2330
2320
|
var utf82 = () => utf8();
|
|
2331
2321
|
var binary2 = () => binary();
|
|
@@ -2680,7 +2670,8 @@ var BIND_REQUEST_SCHEMA = schema2([
|
|
|
2680
2670
|
field2("at_value", utf82(), true),
|
|
2681
2671
|
field2("copy_from", COPY_FROM_STRUCT_TYPE, true),
|
|
2682
2672
|
field2("copy_to", COPY_TO_STRUCT_TYPE, true),
|
|
2683
|
-
field2("
|
|
2673
|
+
field2("schema_path", list2(field2("item", utf82(), true)), true),
|
|
2674
|
+
field2("argument_names", list2(field2("item", utf82(), true)), true)
|
|
2684
2675
|
]);
|
|
2685
2676
|
function parseCopyFromContext(raw) {
|
|
2686
2677
|
if (raw == null)
|
|
@@ -2732,7 +2723,8 @@ function deserializeBindRequest(params) {
|
|
|
2732
2723
|
resolved_secrets_provided: params.resolved_secrets_provided ?? false,
|
|
2733
2724
|
at_unit: params.at_unit ? String(params.at_unit) : null,
|
|
2734
2725
|
at_value: params.at_value ? String(params.at_value) : null,
|
|
2735
|
-
|
|
2726
|
+
schema_path: params.schema_path ? (Array.isArray(params.schema_path) ? params.schema_path : [...params.schema_path]).map(String) : null,
|
|
2727
|
+
argument_names: params.argument_names ? (Array.isArray(params.argument_names) ? params.argument_names : [...params.argument_names]).map((value) => value == null ? null : String(value)) : null,
|
|
2736
2728
|
copy_from: parseCopyFromContext(params.copy_from),
|
|
2737
2729
|
copy_to: parseCopyToContext(params.copy_to)
|
|
2738
2730
|
};
|
|
@@ -2936,14 +2928,14 @@ var SchemaInfoSchema = schema2([
|
|
|
2936
2928
|
field2("comment", utf82(), true),
|
|
2937
2929
|
field2("tags", map2(field2("key", utf82(), false), field2("value", utf82(), true), false), false),
|
|
2938
2930
|
field2("attach_opaque_data", binary2(), false),
|
|
2939
|
-
field2("
|
|
2931
|
+
field2("path", list2(field2("item", utf82(), true)), false),
|
|
2940
2932
|
field2("estimated_object_count", map2(field2("key", utf82(), false), field2("value", int642(), true), false), true)
|
|
2941
2933
|
]);
|
|
2942
2934
|
var TableInfoSchema = schema2([
|
|
2943
2935
|
field2("comment", utf82(), true),
|
|
2944
2936
|
field2("tags", map2(field2("key", utf82(), false), field2("value", utf82(), true), false), false),
|
|
2945
2937
|
field2("name", utf82(), false),
|
|
2946
|
-
field2("
|
|
2938
|
+
field2("schema_path", list2(field2("item", utf82(), true)), false),
|
|
2947
2939
|
field2("columns", binary2(), false),
|
|
2948
2940
|
field2("not_null_constraints", list2(field2("item", int322(), true)), false),
|
|
2949
2941
|
field2("unique_constraints", list2(field2("item", list2(field2("item", int322(), true)), true)), false),
|
|
@@ -2969,7 +2961,7 @@ var ViewInfoSchema = schema2([
|
|
|
2969
2961
|
field2("comment", utf82(), true),
|
|
2970
2962
|
field2("tags", map2(field2("key", utf82(), false), field2("value", utf82(), true), false), false),
|
|
2971
2963
|
field2("name", utf82(), false),
|
|
2972
|
-
field2("
|
|
2964
|
+
field2("schema_path", list2(field2("item", utf82(), true)), false),
|
|
2973
2965
|
field2("definition", utf82(), false),
|
|
2974
2966
|
field2("column_comments", map2(field2("key", utf82(), false), field2("value", utf82(), true), false), false)
|
|
2975
2967
|
]);
|
|
@@ -2977,12 +2969,14 @@ var FunctionInfoSchema = schema2([
|
|
|
2977
2969
|
field2("comment", utf82(), true),
|
|
2978
2970
|
field2("tags", map2(field2("key", utf82(), false), field2("value", utf82(), true), false), false),
|
|
2979
2971
|
field2("name", utf82(), false),
|
|
2980
|
-
field2("
|
|
2972
|
+
field2("schema_path", list2(field2("item", utf82(), true)), false),
|
|
2981
2973
|
field2("function_type", dictionary2(utf82(), int162()), false),
|
|
2982
2974
|
field2("arguments", binary2(), false),
|
|
2983
2975
|
field2("output_schema", binary2(), false),
|
|
2976
|
+
field2("parameter_default_values", binary2(), true),
|
|
2984
2977
|
field2("stability", dictionary2(utf82(), int162()), true),
|
|
2985
2978
|
field2("null_handling", dictionary2(utf82(), int162()), true),
|
|
2979
|
+
field2("argument_monotonicity", list2(field2("item", utf82(), true)), true),
|
|
2986
2980
|
field2("description", utf82(), false),
|
|
2987
2981
|
field2("examples", list2(field2("item", struct2([field2("sql", utf82(), false), field2("description", utf82(), false), field2("expected_output", utf82(), true)]), true)), false),
|
|
2988
2982
|
field2("categories", list2(field2("item", utf82(), true)), false),
|
|
@@ -2990,7 +2984,10 @@ var FunctionInfoSchema = schema2([
|
|
|
2990
2984
|
field2("filter_pushdown", bool2(), true),
|
|
2991
2985
|
field2("sampling_pushdown", bool2(), true),
|
|
2992
2986
|
field2("late_materialization", bool2(), true),
|
|
2993
|
-
field2("
|
|
2987
|
+
field2("filter_semantic_profiles", list2(field2("item", utf82(), true)), false),
|
|
2988
|
+
field2("additional_filter_functions", list2(field2("item", struct2([field2("namespace", utf82(), false), field2("name", utf82(), false), field2("version", uint642(), false)]), true)), false),
|
|
2989
|
+
field2("runtime_filter_algorithms", list2(field2("item", struct2([field2("namespace", utf82(), false), field2("name", utf82(), false), field2("version", uint642(), false)]), true)), false),
|
|
2990
|
+
field2("filter_evaluation_contexts", list2(field2("item", struct2([field2("profile", utf82(), false), field2("provider_fingerprint", utf82(), true)]), true)), false),
|
|
2994
2991
|
field2("order_preservation", dictionary2(utf82(), int162()), true),
|
|
2995
2992
|
field2("max_workers", int322(), true),
|
|
2996
2993
|
field2("supports_batch_index", bool2(), false),
|
|
@@ -3015,7 +3012,7 @@ var MacroInfoSchema = schema2([
|
|
|
3015
3012
|
field2("comment", utf82(), true),
|
|
3016
3013
|
field2("tags", map2(field2("key", utf82(), false), field2("value", utf82(), true), false), false),
|
|
3017
3014
|
field2("name", utf82(), false),
|
|
3018
|
-
field2("
|
|
3015
|
+
field2("schema_path", list2(field2("item", utf82(), true)), false),
|
|
3019
3016
|
field2("macro_type", dictionary2(utf82(), int162()), false),
|
|
3020
3017
|
field2("parameters", list2(field2("item", utf82(), true)), false),
|
|
3021
3018
|
field2("parameter_default_values", binary2(), true),
|
|
@@ -3026,7 +3023,7 @@ var IndexInfoSchema = schema2([
|
|
|
3026
3023
|
field2("comment", utf82(), true),
|
|
3027
3024
|
field2("tags", map2(field2("key", utf82(), false), field2("value", utf82(), true), false), false),
|
|
3028
3025
|
field2("name", utf82(), false),
|
|
3029
|
-
field2("
|
|
3026
|
+
field2("schema_path", list2(field2("item", utf82(), true)), false),
|
|
3030
3027
|
field2("table_name", utf82(), false),
|
|
3031
3028
|
field2("index_type", utf82(), false),
|
|
3032
3029
|
field2("constraint_type", dictionary2(utf82(), int162()), false),
|
|
@@ -3046,7 +3043,8 @@ var CopyFromFormatInfoSchema = schema2([
|
|
|
3046
3043
|
var ScanFunctionResultSchema = schema2([
|
|
3047
3044
|
field2("function_name", utf82(), false),
|
|
3048
3045
|
field2("arguments", binary2(), false),
|
|
3049
|
-
field2("required_extensions", list2(field2("item", utf82(), true)), false)
|
|
3046
|
+
field2("required_extensions", list2(field2("item", utf82(), true)), false),
|
|
3047
|
+
field2("schema_path", list2(field2("item", utf82(), true)), true)
|
|
3050
3048
|
]);
|
|
3051
3049
|
var ScanBranchesResultSchema = schema2([
|
|
3052
3050
|
field2("branches", list2(field2("item", binary2(), true)), false),
|
|
@@ -3058,11 +3056,12 @@ var ScanBranchSchema = schema2([
|
|
|
3058
3056
|
field2("branch_filter", utf82(), true),
|
|
3059
3057
|
field2("writable", bool2(), false),
|
|
3060
3058
|
field2("source_catalog", utf82(), true),
|
|
3061
|
-
field2("
|
|
3059
|
+
field2("source_schema_path", list2(field2("item", utf82(), true)), true),
|
|
3062
3060
|
field2("source_table", utf82(), true),
|
|
3063
3061
|
field2("format_name", utf82(), true),
|
|
3064
3062
|
field2("format_locations", list2(field2("item", utf82(), true)), true),
|
|
3065
|
-
field2("format_options", binary2(), true)
|
|
3063
|
+
field2("format_options", binary2(), true),
|
|
3064
|
+
field2("schema_path", list2(field2("item", utf82(), true)), true)
|
|
3066
3065
|
]);
|
|
3067
3066
|
var ScanSplitSchema = schema2([
|
|
3068
3067
|
field2("payload", binary2(), false),
|
|
@@ -3085,6 +3084,12 @@ var AttachCatalogInfoSchema = schema2([
|
|
|
3085
3084
|
field2("required", bool2(), false),
|
|
3086
3085
|
field2("secret_ref", utf82(), false)
|
|
3087
3086
|
]);
|
|
3087
|
+
var ForeignKeyInfoSchema = schema2([
|
|
3088
|
+
field2("fk_columns", list2(field2("item", utf82(), true)), false),
|
|
3089
|
+
field2("pk_columns", list2(field2("item", utf82(), true)), false),
|
|
3090
|
+
field2("referenced_table", utf82(), false),
|
|
3091
|
+
field2("referenced_schema_path", list2(field2("item", utf82(), true)), false)
|
|
3092
|
+
]);
|
|
3088
3093
|
var AggregateBindRequestSchema = schema2([
|
|
3089
3094
|
field2("function_name", utf82(), false),
|
|
3090
3095
|
field2("arguments", binary2(), false),
|
|
@@ -3092,21 +3097,22 @@ var AggregateBindRequestSchema = schema2([
|
|
|
3092
3097
|
field2("settings", binary2(), true),
|
|
3093
3098
|
field2("secrets", binary2(), true),
|
|
3094
3099
|
field2("attach_opaque_data", binary2(), true),
|
|
3095
|
-
field2("
|
|
3100
|
+
field2("schema_path", list2(field2("item", utf82(), true)), true),
|
|
3101
|
+
field2("argument_names", list2(field2("item", utf82(), true)), true)
|
|
3096
3102
|
]);
|
|
3097
3103
|
var AggregateCombineRequestSchema = schema2([
|
|
3098
3104
|
field2("function_name", utf82(), false),
|
|
3099
3105
|
field2("execution_id", binary2(), false),
|
|
3100
3106
|
field2("merge_batch", binary2(), false),
|
|
3101
3107
|
field2("attach_opaque_data", binary2(), true),
|
|
3102
|
-
field2("
|
|
3108
|
+
field2("schema_path", list2(field2("item", utf82(), true)), true)
|
|
3103
3109
|
]);
|
|
3104
3110
|
var AggregateDestructorRequestSchema = schema2([
|
|
3105
3111
|
field2("function_name", utf82(), false),
|
|
3106
3112
|
field2("execution_id", binary2(), false),
|
|
3107
3113
|
field2("group_ids_batch", binary2(), false),
|
|
3108
3114
|
field2("attach_opaque_data", binary2(), true),
|
|
3109
|
-
field2("
|
|
3115
|
+
field2("schema_path", list2(field2("item", utf82(), true)), true)
|
|
3110
3116
|
]);
|
|
3111
3117
|
var AggregateFinalizeRequestSchema = schema2([
|
|
3112
3118
|
field2("function_name", utf82(), false),
|
|
@@ -3114,14 +3120,81 @@ var AggregateFinalizeRequestSchema = schema2([
|
|
|
3114
3120
|
field2("group_ids_batch", binary2(), false),
|
|
3115
3121
|
field2("output_schema", binary2(), false),
|
|
3116
3122
|
field2("attach_opaque_data", binary2(), true),
|
|
3117
|
-
field2("
|
|
3123
|
+
field2("schema_path", list2(field2("item", utf82(), true)), true)
|
|
3124
|
+
]);
|
|
3125
|
+
var AggregateStreamingChunkRequestSchema = schema2([
|
|
3126
|
+
field2("function_name", utf82(), false),
|
|
3127
|
+
field2("execution_id", binary2(), false),
|
|
3128
|
+
field2("input_batch", binary2(), false),
|
|
3129
|
+
field2("attach_opaque_data", binary2(), true),
|
|
3130
|
+
field2("schema_path", list2(field2("item", utf82(), true)), true)
|
|
3131
|
+
]);
|
|
3132
|
+
var AggregateStreamingCloseRequestSchema = schema2([
|
|
3133
|
+
field2("function_name", utf82(), false),
|
|
3134
|
+
field2("execution_id", binary2(), false),
|
|
3135
|
+
field2("attach_opaque_data", binary2(), true),
|
|
3136
|
+
field2("schema_path", list2(field2("item", utf82(), true)), true)
|
|
3137
|
+
]);
|
|
3138
|
+
var AggregateStreamingOpenRequestSchema = schema2([
|
|
3139
|
+
field2("function_name", utf82(), false),
|
|
3140
|
+
field2("arguments", binary2(), false),
|
|
3141
|
+
field2("input_schema", binary2(), false),
|
|
3142
|
+
field2("partition_key_count", int642(), false),
|
|
3143
|
+
field2("order_key_count", int642(), false),
|
|
3144
|
+
field2("output_schema", binary2(), false),
|
|
3145
|
+
field2("settings", binary2(), true),
|
|
3146
|
+
field2("secrets", binary2(), true),
|
|
3147
|
+
field2("attach_opaque_data", binary2(), true),
|
|
3148
|
+
field2("schema_path", list2(field2("item", utf82(), true)), true)
|
|
3118
3149
|
]);
|
|
3119
3150
|
var AggregateUpdateRequestSchema = schema2([
|
|
3120
3151
|
field2("function_name", utf82(), false),
|
|
3121
3152
|
field2("execution_id", binary2(), false),
|
|
3122
3153
|
field2("input_batch", binary2(), false),
|
|
3123
3154
|
field2("attach_opaque_data", binary2(), true),
|
|
3124
|
-
field2("
|
|
3155
|
+
field2("schema_path", list2(field2("item", utf82(), true)), true)
|
|
3156
|
+
]);
|
|
3157
|
+
var AggregateWindowBatchRequestSchema = schema2([
|
|
3158
|
+
field2("function_name", utf82(), false),
|
|
3159
|
+
field2("execution_id", binary2(), false),
|
|
3160
|
+
field2("partition_id", int642(), false),
|
|
3161
|
+
field2("row_idx", int642(), false),
|
|
3162
|
+
field2("count", int642(), false),
|
|
3163
|
+
field2("frames_per_row", list2(field2("item", int642(), true)), false),
|
|
3164
|
+
field2("frame_starts", list2(field2("item", int642(), true)), false),
|
|
3165
|
+
field2("frame_ends", list2(field2("item", int642(), true)), false),
|
|
3166
|
+
field2("attach_opaque_data", binary2(), true),
|
|
3167
|
+
field2("schema_path", list2(field2("item", utf82(), true)), true)
|
|
3168
|
+
]);
|
|
3169
|
+
var AggregateWindowDestructorRequestSchema = schema2([
|
|
3170
|
+
field2("function_name", utf82(), false),
|
|
3171
|
+
field2("execution_id", binary2(), false),
|
|
3172
|
+
field2("partition_id", int642(), false),
|
|
3173
|
+
field2("attach_opaque_data", binary2(), true),
|
|
3174
|
+
field2("schema_path", list2(field2("item", utf82(), true)), true)
|
|
3175
|
+
]);
|
|
3176
|
+
var AggregateWindowInitRequestSchema = schema2([
|
|
3177
|
+
field2("function_name", utf82(), false),
|
|
3178
|
+
field2("execution_id", binary2(), false),
|
|
3179
|
+
field2("partition_id", int642(), false),
|
|
3180
|
+
field2("row_count", int642(), false),
|
|
3181
|
+
field2("partition_batch", binary2(), false),
|
|
3182
|
+
field2("output_schema", binary2(), false),
|
|
3183
|
+
field2("filter_mask", binary2(), false),
|
|
3184
|
+
field2("frame_stats", binary2(), false),
|
|
3185
|
+
field2("all_valid", binary2(), false),
|
|
3186
|
+
field2("attach_opaque_data", binary2(), true),
|
|
3187
|
+
field2("schema_path", list2(field2("item", utf82(), true)), true)
|
|
3188
|
+
]);
|
|
3189
|
+
var AggregateWindowRequestSchema = schema2([
|
|
3190
|
+
field2("function_name", utf82(), false),
|
|
3191
|
+
field2("execution_id", binary2(), false),
|
|
3192
|
+
field2("partition_id", int642(), false),
|
|
3193
|
+
field2("rid", int642(), false),
|
|
3194
|
+
field2("frame_starts", list2(field2("item", int642(), true)), false),
|
|
3195
|
+
field2("frame_ends", list2(field2("item", int642(), true)), false),
|
|
3196
|
+
field2("attach_opaque_data", binary2(), true),
|
|
3197
|
+
field2("schema_path", list2(field2("item", utf82(), true)), true)
|
|
3125
3198
|
]);
|
|
3126
3199
|
var BindRequestSchema = schema2([
|
|
3127
3200
|
field2("function_name", utf82(), false),
|
|
@@ -3137,7 +3210,8 @@ var BindRequestSchema = schema2([
|
|
|
3137
3210
|
field2("at_value", utf82(), true),
|
|
3138
3211
|
field2("copy_from", struct2([field2("format", utf82(), false), field2("file_path", utf82(), false), field2("expected_schema", binary2(), false)]), true),
|
|
3139
3212
|
field2("copy_to", struct2([field2("format", utf82(), false), field2("file_path", utf82(), false)]), true),
|
|
3140
|
-
field2("
|
|
3213
|
+
field2("schema_path", list2(field2("item", utf82(), true)), true),
|
|
3214
|
+
field2("argument_names", list2(field2("item", utf82(), true)), true)
|
|
3141
3215
|
]);
|
|
3142
3216
|
var CatalogAttachRequestSchema = schema2([
|
|
3143
3217
|
field2("name", utf82(), false),
|
|
@@ -3146,6 +3220,18 @@ var CatalogAttachRequestSchema = schema2([
|
|
|
3146
3220
|
field2("implementation_version", utf82(), true),
|
|
3147
3221
|
field2("client_capabilities", binary2(), true)
|
|
3148
3222
|
]);
|
|
3223
|
+
var CatalogCreateRequestSchema = schema2([
|
|
3224
|
+
field2("name", utf82(), false),
|
|
3225
|
+
field2("on_conflict", dictionary2(utf82(), int162()), false),
|
|
3226
|
+
field2("options", binary2(), true)
|
|
3227
|
+
]);
|
|
3228
|
+
var ClientCapabilitiesSchema = schema2([
|
|
3229
|
+
field2("engine", utf82(), false),
|
|
3230
|
+
field2("native_formats", list2(field2("item", utf82(), true)), false),
|
|
3231
|
+
field2("catalogs", list2(field2("item", utf82(), true)), false),
|
|
3232
|
+
field2("can_stream", bool2(), false),
|
|
3233
|
+
field2("filter_encodings", list2(field2("item", utf82(), true)), false)
|
|
3234
|
+
]);
|
|
3149
3235
|
var CopyFromContextSchema = schema2([
|
|
3150
3236
|
field2("format", utf82(), false),
|
|
3151
3237
|
field2("file_path", utf82(), false),
|
|
@@ -3160,6 +3246,18 @@ var GlobalInitResponseSchema = schema2([
|
|
|
3160
3246
|
field2("opaque_data", binary2(), true),
|
|
3161
3247
|
field2("max_workers", int642(), false)
|
|
3162
3248
|
]);
|
|
3249
|
+
var IndexCreateRequestSchema = schema2([
|
|
3250
|
+
field2("attach_opaque_data", binary2(), false),
|
|
3251
|
+
field2("schema_path", list2(field2("item", utf82(), true)), false),
|
|
3252
|
+
field2("name", utf82(), false),
|
|
3253
|
+
field2("table_name", utf82(), false),
|
|
3254
|
+
field2("index_type", utf82(), false),
|
|
3255
|
+
field2("constraint_type", dictionary2(utf82(), int162()), false),
|
|
3256
|
+
field2("expressions", list2(field2("item", utf82(), true)), false),
|
|
3257
|
+
field2("on_conflict", dictionary2(utf82(), int162()), false),
|
|
3258
|
+
field2("options", map2(field2("key", utf82(), false), field2("value", utf82(), true), false), false),
|
|
3259
|
+
field2("transaction_opaque_data", binary2(), true)
|
|
3260
|
+
]);
|
|
3163
3261
|
var InitRequestSchema = schema2([
|
|
3164
3262
|
field2("bind_call", binary2(), false),
|
|
3165
3263
|
field2("output_schema", binary2(), false),
|
|
@@ -3181,20 +3279,45 @@ var InitRequestSchema = schema2([
|
|
|
3181
3279
|
field2("tablesample_percentage", float642(), true),
|
|
3182
3280
|
field2("tablesample_seed", int642(), true)
|
|
3183
3281
|
]);
|
|
3282
|
+
var MacroCreateRequestSchema = schema2([
|
|
3283
|
+
field2("attach_opaque_data", binary2(), false),
|
|
3284
|
+
field2("schema_path", list2(field2("item", utf82(), true)), false),
|
|
3285
|
+
field2("name", utf82(), false),
|
|
3286
|
+
field2("macro_type", dictionary2(utf82(), int162()), false),
|
|
3287
|
+
field2("parameters", list2(field2("item", utf82(), true)), false),
|
|
3288
|
+
field2("definition", utf82(), false),
|
|
3289
|
+
field2("on_conflict", dictionary2(utf82(), int162()), false),
|
|
3290
|
+
field2("parameter_default_values", binary2(), true),
|
|
3291
|
+
field2("arguments_schema", binary2(), true),
|
|
3292
|
+
field2("transaction_opaque_data", binary2(), true)
|
|
3293
|
+
]);
|
|
3294
|
+
var TableCreateRequestSchema = schema2([
|
|
3295
|
+
field2("attach_opaque_data", binary2(), false),
|
|
3296
|
+
field2("schema_path", list2(field2("item", utf82(), true)), false),
|
|
3297
|
+
field2("name", utf82(), false),
|
|
3298
|
+
field2("columns", binary2(), false),
|
|
3299
|
+
field2("on_conflict", dictionary2(utf82(), int162()), false),
|
|
3300
|
+
field2("not_null_constraints", list2(field2("item", int322(), true)), false),
|
|
3301
|
+
field2("unique_constraints", list2(field2("item", list2(field2("item", int322(), true)), true)), false),
|
|
3302
|
+
field2("check_constraints", list2(field2("item", utf82(), true)), false),
|
|
3303
|
+
field2("primary_key_constraints", list2(field2("item", list2(field2("item", int322(), true)), true)), false),
|
|
3304
|
+
field2("foreign_key_constraints", list2(field2("item", binary2(), true)), false),
|
|
3305
|
+
field2("transaction_opaque_data", binary2(), true)
|
|
3306
|
+
]);
|
|
3184
3307
|
var TableBufferingCombineRequestSchema = schema2([
|
|
3185
3308
|
field2("function_name", utf82(), false),
|
|
3186
3309
|
field2("execution_id", binary2(), false),
|
|
3187
3310
|
field2("state_ids", list2(field2("item", binary2(), true)), false),
|
|
3188
3311
|
field2("attach_opaque_data", binary2(), true),
|
|
3189
3312
|
field2("transaction_id", binary2(), true),
|
|
3190
|
-
field2("
|
|
3313
|
+
field2("schema_path", list2(field2("item", utf82(), true)), true)
|
|
3191
3314
|
]);
|
|
3192
3315
|
var TableBufferingDestructorRequestSchema = schema2([
|
|
3193
3316
|
field2("function_name", utf82(), false),
|
|
3194
3317
|
field2("execution_id", binary2(), false),
|
|
3195
3318
|
field2("attach_opaque_data", binary2(), true),
|
|
3196
3319
|
field2("transaction_id", binary2(), true),
|
|
3197
|
-
field2("
|
|
3320
|
+
field2("schema_path", list2(field2("item", utf82(), true)), true)
|
|
3198
3321
|
]);
|
|
3199
3322
|
var TableBufferingProcessRequestSchema = schema2([
|
|
3200
3323
|
field2("function_name", utf82(), false),
|
|
@@ -3203,12 +3326,17 @@ var TableBufferingProcessRequestSchema = schema2([
|
|
|
3203
3326
|
field2("attach_opaque_data", binary2(), true),
|
|
3204
3327
|
field2("transaction_id", binary2(), true),
|
|
3205
3328
|
field2("batch_index", int642(), true),
|
|
3206
|
-
field2("
|
|
3329
|
+
field2("schema_path", list2(field2("item", utf82(), true)), true)
|
|
3207
3330
|
]);
|
|
3208
3331
|
var TableFunctionCardinalityRequestSchema = schema2([
|
|
3209
3332
|
field2("bind_call", binary2(), false),
|
|
3210
3333
|
field2("bind_opaque_data", binary2(), true)
|
|
3211
3334
|
]);
|
|
3335
|
+
var TableFunctionDynamicToStringRequestSchema = schema2([
|
|
3336
|
+
field2("bind_call", binary2(), false),
|
|
3337
|
+
field2("bind_opaque_data", binary2(), true),
|
|
3338
|
+
field2("global_execution_id", binary2(), false)
|
|
3339
|
+
]);
|
|
3212
3340
|
var TableFunctionPlanRequestSchema = schema2([
|
|
3213
3341
|
field2("bind_call", binary2(), false),
|
|
3214
3342
|
field2("bind_opaque_data", binary2(), true),
|
|
@@ -3231,6 +3359,10 @@ var TableFunctionPlanRequestSchema = schema2([
|
|
|
3231
3359
|
field2("tablesample_percentage", float642(), true),
|
|
3232
3360
|
field2("tablesample_seed", int642(), true)
|
|
3233
3361
|
]);
|
|
3362
|
+
var TableFunctionStatisticsRequestSchema = schema2([
|
|
3363
|
+
field2("bind_call", binary2(), false),
|
|
3364
|
+
field2("bind_opaque_data", binary2(), true)
|
|
3365
|
+
]);
|
|
3234
3366
|
var AggregateBindResultSchema = schema2([
|
|
3235
3367
|
field2("output_schema", binary2(), false),
|
|
3236
3368
|
field2("execution_id", binary2(), false)
|
|
@@ -3421,7 +3553,7 @@ var CatalogIndexCreateParamsSchema = schema2([
|
|
|
3421
3553
|
]);
|
|
3422
3554
|
var CatalogIndexDropParamsSchema = schema2([
|
|
3423
3555
|
field2("attach_opaque_data", binary2(), false),
|
|
3424
|
-
field2("
|
|
3556
|
+
field2("schema_path", list2(field2("item", utf82(), true)), false),
|
|
3425
3557
|
field2("name", utf82(), false),
|
|
3426
3558
|
field2("ignore_not_found", bool2(), false),
|
|
3427
3559
|
field2("cascade", bool2(), false),
|
|
@@ -3429,7 +3561,7 @@ var CatalogIndexDropParamsSchema = schema2([
|
|
|
3429
3561
|
]);
|
|
3430
3562
|
var CatalogIndexGetParamsSchema = schema2([
|
|
3431
3563
|
field2("attach_opaque_data", binary2(), false),
|
|
3432
|
-
field2("
|
|
3564
|
+
field2("schema_path", list2(field2("item", utf82(), true)), false),
|
|
3433
3565
|
field2("name", utf82(), false),
|
|
3434
3566
|
field2("transaction_opaque_data", binary2(), true)
|
|
3435
3567
|
]);
|
|
@@ -3438,47 +3570,47 @@ var CatalogMacroCreateParamsSchema = schema2([
|
|
|
3438
3570
|
]);
|
|
3439
3571
|
var CatalogMacroDropParamsSchema = schema2([
|
|
3440
3572
|
field2("attach_opaque_data", binary2(), false),
|
|
3441
|
-
field2("
|
|
3573
|
+
field2("schema_path", list2(field2("item", utf82(), true)), false),
|
|
3442
3574
|
field2("name", utf82(), false),
|
|
3443
3575
|
field2("ignore_not_found", bool2(), false),
|
|
3444
3576
|
field2("transaction_opaque_data", binary2(), true)
|
|
3445
3577
|
]);
|
|
3446
3578
|
var CatalogMacroGetParamsSchema = schema2([
|
|
3447
3579
|
field2("attach_opaque_data", binary2(), false),
|
|
3448
|
-
field2("
|
|
3580
|
+
field2("schema_path", list2(field2("item", utf82(), true)), false),
|
|
3449
3581
|
field2("name", utf82(), false),
|
|
3450
3582
|
field2("transaction_opaque_data", binary2(), true)
|
|
3451
3583
|
]);
|
|
3452
3584
|
var CatalogSchemaContentsFunctionsParamsSchema = schema2([
|
|
3453
3585
|
field2("attach_opaque_data", binary2(), false),
|
|
3454
|
-
field2("
|
|
3586
|
+
field2("path", list2(field2("item", utf82(), true)), false),
|
|
3455
3587
|
field2("type", dictionary2(utf82(), int162()), false),
|
|
3456
3588
|
field2("transaction_opaque_data", binary2(), true)
|
|
3457
3589
|
]);
|
|
3458
3590
|
var CatalogSchemaContentsIndexesParamsSchema = schema2([
|
|
3459
3591
|
field2("attach_opaque_data", binary2(), false),
|
|
3460
|
-
field2("
|
|
3592
|
+
field2("path", list2(field2("item", utf82(), true)), false),
|
|
3461
3593
|
field2("transaction_opaque_data", binary2(), true)
|
|
3462
3594
|
]);
|
|
3463
3595
|
var CatalogSchemaContentsMacrosParamsSchema = schema2([
|
|
3464
3596
|
field2("attach_opaque_data", binary2(), false),
|
|
3465
|
-
field2("
|
|
3597
|
+
field2("path", list2(field2("item", utf82(), true)), false),
|
|
3466
3598
|
field2("type", dictionary2(utf82(), int162()), false),
|
|
3467
3599
|
field2("transaction_opaque_data", binary2(), true)
|
|
3468
3600
|
]);
|
|
3469
3601
|
var CatalogSchemaContentsTablesParamsSchema = schema2([
|
|
3470
3602
|
field2("attach_opaque_data", binary2(), false),
|
|
3471
|
-
field2("
|
|
3603
|
+
field2("path", list2(field2("item", utf82(), true)), false),
|
|
3472
3604
|
field2("transaction_opaque_data", binary2(), true)
|
|
3473
3605
|
]);
|
|
3474
3606
|
var CatalogSchemaContentsViewsParamsSchema = schema2([
|
|
3475
3607
|
field2("attach_opaque_data", binary2(), false),
|
|
3476
|
-
field2("
|
|
3608
|
+
field2("path", list2(field2("item", utf82(), true)), false),
|
|
3477
3609
|
field2("transaction_opaque_data", binary2(), true)
|
|
3478
3610
|
]);
|
|
3479
3611
|
var CatalogSchemaCreateParamsSchema = schema2([
|
|
3480
3612
|
field2("attach_opaque_data", binary2(), false),
|
|
3481
|
-
field2("
|
|
3613
|
+
field2("path", list2(field2("item", utf82(), true)), false),
|
|
3482
3614
|
field2("on_conflict", dictionary2(utf82(), int162()), false),
|
|
3483
3615
|
field2("comment", utf82(), true),
|
|
3484
3616
|
field2("tags", map2(field2("key", utf82(), false), field2("value", utf82(), true), false), true),
|
|
@@ -3486,14 +3618,14 @@ var CatalogSchemaCreateParamsSchema = schema2([
|
|
|
3486
3618
|
]);
|
|
3487
3619
|
var CatalogSchemaDropParamsSchema = schema2([
|
|
3488
3620
|
field2("attach_opaque_data", binary2(), false),
|
|
3489
|
-
field2("
|
|
3621
|
+
field2("path", list2(field2("item", utf82(), true)), false),
|
|
3490
3622
|
field2("ignore_not_found", bool2(), false),
|
|
3491
3623
|
field2("cascade", bool2(), false),
|
|
3492
3624
|
field2("transaction_opaque_data", binary2(), true)
|
|
3493
3625
|
]);
|
|
3494
3626
|
var CatalogSchemaGetParamsSchema = schema2([
|
|
3495
3627
|
field2("attach_opaque_data", binary2(), false),
|
|
3496
|
-
field2("
|
|
3628
|
+
field2("path", list2(field2("item", utf82(), true)), false),
|
|
3497
3629
|
field2("transaction_opaque_data", binary2(), true)
|
|
3498
3630
|
]);
|
|
3499
3631
|
var CatalogSchemasParamsSchema = schema2([
|
|
@@ -3502,7 +3634,7 @@ var CatalogSchemasParamsSchema = schema2([
|
|
|
3502
3634
|
]);
|
|
3503
3635
|
var CatalogTableColumnAddParamsSchema = schema2([
|
|
3504
3636
|
field2("attach_opaque_data", binary2(), false),
|
|
3505
|
-
field2("
|
|
3637
|
+
field2("schema_path", list2(field2("item", utf82(), true)), false),
|
|
3506
3638
|
field2("name", utf82(), false),
|
|
3507
3639
|
field2("column_definition", binary2(), false),
|
|
3508
3640
|
field2("ignore_not_found", bool2(), false),
|
|
@@ -3511,7 +3643,7 @@ var CatalogTableColumnAddParamsSchema = schema2([
|
|
|
3511
3643
|
]);
|
|
3512
3644
|
var CatalogTableColumnCommentSetParamsSchema = schema2([
|
|
3513
3645
|
field2("attach_opaque_data", binary2(), false),
|
|
3514
|
-
field2("
|
|
3646
|
+
field2("schema_path", list2(field2("item", utf82(), true)), false),
|
|
3515
3647
|
field2("name", utf82(), false),
|
|
3516
3648
|
field2("column_name", utf82(), false),
|
|
3517
3649
|
field2("comment", utf82(), true),
|
|
@@ -3520,7 +3652,7 @@ var CatalogTableColumnCommentSetParamsSchema = schema2([
|
|
|
3520
3652
|
]);
|
|
3521
3653
|
var CatalogTableColumnDefaultDropParamsSchema = schema2([
|
|
3522
3654
|
field2("attach_opaque_data", binary2(), false),
|
|
3523
|
-
field2("
|
|
3655
|
+
field2("schema_path", list2(field2("item", utf82(), true)), false),
|
|
3524
3656
|
field2("name", utf82(), false),
|
|
3525
3657
|
field2("column_name", utf82(), false),
|
|
3526
3658
|
field2("ignore_not_found", bool2(), false),
|
|
@@ -3528,7 +3660,7 @@ var CatalogTableColumnDefaultDropParamsSchema = schema2([
|
|
|
3528
3660
|
]);
|
|
3529
3661
|
var CatalogTableColumnDefaultSetParamsSchema = schema2([
|
|
3530
3662
|
field2("attach_opaque_data", binary2(), false),
|
|
3531
|
-
field2("
|
|
3663
|
+
field2("schema_path", list2(field2("item", utf82(), true)), false),
|
|
3532
3664
|
field2("name", utf82(), false),
|
|
3533
3665
|
field2("column_name", utf82(), false),
|
|
3534
3666
|
field2("expression", utf82(), false),
|
|
@@ -3537,7 +3669,7 @@ var CatalogTableColumnDefaultSetParamsSchema = schema2([
|
|
|
3537
3669
|
]);
|
|
3538
3670
|
var CatalogTableColumnDropParamsSchema = schema2([
|
|
3539
3671
|
field2("attach_opaque_data", binary2(), false),
|
|
3540
|
-
field2("
|
|
3672
|
+
field2("schema_path", list2(field2("item", utf82(), true)), false),
|
|
3541
3673
|
field2("name", utf82(), false),
|
|
3542
3674
|
field2("column_name", utf82(), false),
|
|
3543
3675
|
field2("ignore_not_found", bool2(), false),
|
|
@@ -3547,7 +3679,7 @@ var CatalogTableColumnDropParamsSchema = schema2([
|
|
|
3547
3679
|
]);
|
|
3548
3680
|
var CatalogTableColumnRenameParamsSchema = schema2([
|
|
3549
3681
|
field2("attach_opaque_data", binary2(), false),
|
|
3550
|
-
field2("
|
|
3682
|
+
field2("schema_path", list2(field2("item", utf82(), true)), false),
|
|
3551
3683
|
field2("name", utf82(), false),
|
|
3552
3684
|
field2("column_name", utf82(), false),
|
|
3553
3685
|
field2("new_column_name", utf82(), false),
|
|
@@ -3556,13 +3688,13 @@ var CatalogTableColumnRenameParamsSchema = schema2([
|
|
|
3556
3688
|
]);
|
|
3557
3689
|
var CatalogTableColumnStatisticsGetParamsSchema = schema2([
|
|
3558
3690
|
field2("attach_opaque_data", binary2(), false),
|
|
3559
|
-
field2("
|
|
3691
|
+
field2("schema_path", list2(field2("item", utf82(), true)), false),
|
|
3560
3692
|
field2("name", utf82(), false),
|
|
3561
3693
|
field2("transaction_opaque_data", binary2(), true)
|
|
3562
3694
|
]);
|
|
3563
3695
|
var CatalogTableColumnTypeChangeParamsSchema = schema2([
|
|
3564
3696
|
field2("attach_opaque_data", binary2(), false),
|
|
3565
|
-
field2("
|
|
3697
|
+
field2("schema_path", list2(field2("item", utf82(), true)), false),
|
|
3566
3698
|
field2("name", utf82(), false),
|
|
3567
3699
|
field2("column_definition", binary2(), false),
|
|
3568
3700
|
field2("expression", utf82(), true),
|
|
@@ -3571,7 +3703,7 @@ var CatalogTableColumnTypeChangeParamsSchema = schema2([
|
|
|
3571
3703
|
]);
|
|
3572
3704
|
var CatalogTableCommentSetParamsSchema = schema2([
|
|
3573
3705
|
field2("attach_opaque_data", binary2(), false),
|
|
3574
|
-
field2("
|
|
3706
|
+
field2("schema_path", list2(field2("item", utf82(), true)), false),
|
|
3575
3707
|
field2("name", utf82(), false),
|
|
3576
3708
|
field2("comment", utf82(), true),
|
|
3577
3709
|
field2("ignore_not_found", bool2(), false),
|
|
@@ -3582,13 +3714,13 @@ var CatalogTableCreateParamsSchema = schema2([
|
|
|
3582
3714
|
]);
|
|
3583
3715
|
var CatalogTableDeleteFunctionGetParamsSchema = schema2([
|
|
3584
3716
|
field2("attach_opaque_data", binary2(), false),
|
|
3585
|
-
field2("
|
|
3717
|
+
field2("schema_path", list2(field2("item", utf82(), true)), false),
|
|
3586
3718
|
field2("name", utf82(), false),
|
|
3587
3719
|
field2("transaction_opaque_data", binary2(), true)
|
|
3588
3720
|
]);
|
|
3589
3721
|
var CatalogTableDropParamsSchema = schema2([
|
|
3590
3722
|
field2("attach_opaque_data", binary2(), false),
|
|
3591
|
-
field2("
|
|
3723
|
+
field2("schema_path", list2(field2("item", utf82(), true)), false),
|
|
3592
3724
|
field2("name", utf82(), false),
|
|
3593
3725
|
field2("ignore_not_found", bool2(), false),
|
|
3594
3726
|
field2("cascade", bool2(), false),
|
|
@@ -3596,7 +3728,7 @@ var CatalogTableDropParamsSchema = schema2([
|
|
|
3596
3728
|
]);
|
|
3597
3729
|
var CatalogTableGetParamsSchema = schema2([
|
|
3598
3730
|
field2("attach_opaque_data", binary2(), false),
|
|
3599
|
-
field2("
|
|
3731
|
+
field2("schema_path", list2(field2("item", utf82(), true)), false),
|
|
3600
3732
|
field2("name", utf82(), false),
|
|
3601
3733
|
field2("at_unit", utf82(), true),
|
|
3602
3734
|
field2("at_value", utf82(), true),
|
|
@@ -3604,14 +3736,14 @@ var CatalogTableGetParamsSchema = schema2([
|
|
|
3604
3736
|
]);
|
|
3605
3737
|
var CatalogTableInsertFunctionGetParamsSchema = schema2([
|
|
3606
3738
|
field2("attach_opaque_data", binary2(), false),
|
|
3607
|
-
field2("
|
|
3739
|
+
field2("schema_path", list2(field2("item", utf82(), true)), false),
|
|
3608
3740
|
field2("name", utf82(), false),
|
|
3609
3741
|
field2("transaction_opaque_data", binary2(), true),
|
|
3610
3742
|
field2("writable_branch_function_name", utf82(), true)
|
|
3611
3743
|
]);
|
|
3612
3744
|
var CatalogTableNotNullDropParamsSchema = schema2([
|
|
3613
3745
|
field2("attach_opaque_data", binary2(), false),
|
|
3614
|
-
field2("
|
|
3746
|
+
field2("schema_path", list2(field2("item", utf82(), true)), false),
|
|
3615
3747
|
field2("name", utf82(), false),
|
|
3616
3748
|
field2("column_name", utf82(), false),
|
|
3617
3749
|
field2("ignore_not_found", bool2(), false),
|
|
@@ -3619,7 +3751,7 @@ var CatalogTableNotNullDropParamsSchema = schema2([
|
|
|
3619
3751
|
]);
|
|
3620
3752
|
var CatalogTableNotNullSetParamsSchema = schema2([
|
|
3621
3753
|
field2("attach_opaque_data", binary2(), false),
|
|
3622
|
-
field2("
|
|
3754
|
+
field2("schema_path", list2(field2("item", utf82(), true)), false),
|
|
3623
3755
|
field2("name", utf82(), false),
|
|
3624
3756
|
field2("column_name", utf82(), false),
|
|
3625
3757
|
field2("ignore_not_found", bool2(), false),
|
|
@@ -3627,7 +3759,7 @@ var CatalogTableNotNullSetParamsSchema = schema2([
|
|
|
3627
3759
|
]);
|
|
3628
3760
|
var CatalogTableRenameParamsSchema = schema2([
|
|
3629
3761
|
field2("attach_opaque_data", binary2(), false),
|
|
3630
|
-
field2("
|
|
3762
|
+
field2("schema_path", list2(field2("item", utf82(), true)), false),
|
|
3631
3763
|
field2("name", utf82(), false),
|
|
3632
3764
|
field2("new_name", utf82(), false),
|
|
3633
3765
|
field2("ignore_not_found", bool2(), false),
|
|
@@ -3635,7 +3767,7 @@ var CatalogTableRenameParamsSchema = schema2([
|
|
|
3635
3767
|
]);
|
|
3636
3768
|
var CatalogTableScanBranchesGetParamsSchema = schema2([
|
|
3637
3769
|
field2("attach_opaque_data", binary2(), false),
|
|
3638
|
-
field2("
|
|
3770
|
+
field2("schema_path", list2(field2("item", utf82(), true)), false),
|
|
3639
3771
|
field2("name", utf82(), false),
|
|
3640
3772
|
field2("at_unit", utf82(), true),
|
|
3641
3773
|
field2("at_value", utf82(), true),
|
|
@@ -3643,7 +3775,7 @@ var CatalogTableScanBranchesGetParamsSchema = schema2([
|
|
|
3643
3775
|
]);
|
|
3644
3776
|
var CatalogTableScanFunctionGetParamsSchema = schema2([
|
|
3645
3777
|
field2("attach_opaque_data", binary2(), false),
|
|
3646
|
-
field2("
|
|
3778
|
+
field2("schema_path", list2(field2("item", utf82(), true)), false),
|
|
3647
3779
|
field2("name", utf82(), false),
|
|
3648
3780
|
field2("at_unit", utf82(), true),
|
|
3649
3781
|
field2("at_value", utf82(), true),
|
|
@@ -3651,7 +3783,7 @@ var CatalogTableScanFunctionGetParamsSchema = schema2([
|
|
|
3651
3783
|
]);
|
|
3652
3784
|
var CatalogTableUpdateFunctionGetParamsSchema = schema2([
|
|
3653
3785
|
field2("attach_opaque_data", binary2(), false),
|
|
3654
|
-
field2("
|
|
3786
|
+
field2("schema_path", list2(field2("item", utf82(), true)), false),
|
|
3655
3787
|
field2("name", utf82(), false),
|
|
3656
3788
|
field2("transaction_opaque_data", binary2(), true)
|
|
3657
3789
|
]);
|
|
@@ -3672,7 +3804,7 @@ var CatalogVersionParamsSchema = schema2([
|
|
|
3672
3804
|
]);
|
|
3673
3805
|
var CatalogViewCommentSetParamsSchema = schema2([
|
|
3674
3806
|
field2("attach_opaque_data", binary2(), false),
|
|
3675
|
-
field2("
|
|
3807
|
+
field2("schema_path", list2(field2("item", utf82(), true)), false),
|
|
3676
3808
|
field2("name", utf82(), false),
|
|
3677
3809
|
field2("comment", utf82(), true),
|
|
3678
3810
|
field2("ignore_not_found", bool2(), false),
|
|
@@ -3680,7 +3812,7 @@ var CatalogViewCommentSetParamsSchema = schema2([
|
|
|
3680
3812
|
]);
|
|
3681
3813
|
var CatalogViewCreateParamsSchema = schema2([
|
|
3682
3814
|
field2("attach_opaque_data", binary2(), false),
|
|
3683
|
-
field2("
|
|
3815
|
+
field2("schema_path", list2(field2("item", utf82(), true)), false),
|
|
3684
3816
|
field2("name", utf82(), false),
|
|
3685
3817
|
field2("definition", utf82(), false),
|
|
3686
3818
|
field2("on_conflict", dictionary2(utf82(), int162()), false),
|
|
@@ -3688,7 +3820,7 @@ var CatalogViewCreateParamsSchema = schema2([
|
|
|
3688
3820
|
]);
|
|
3689
3821
|
var CatalogViewDropParamsSchema = schema2([
|
|
3690
3822
|
field2("attach_opaque_data", binary2(), false),
|
|
3691
|
-
field2("
|
|
3823
|
+
field2("schema_path", list2(field2("item", utf82(), true)), false),
|
|
3692
3824
|
field2("name", utf82(), false),
|
|
3693
3825
|
field2("ignore_not_found", bool2(), false),
|
|
3694
3826
|
field2("cascade", bool2(), false),
|
|
@@ -3696,13 +3828,13 @@ var CatalogViewDropParamsSchema = schema2([
|
|
|
3696
3828
|
]);
|
|
3697
3829
|
var CatalogViewGetParamsSchema = schema2([
|
|
3698
3830
|
field2("attach_opaque_data", binary2(), false),
|
|
3699
|
-
field2("
|
|
3831
|
+
field2("schema_path", list2(field2("item", utf82(), true)), false),
|
|
3700
3832
|
field2("name", utf82(), false),
|
|
3701
3833
|
field2("transaction_opaque_data", binary2(), true)
|
|
3702
3834
|
]);
|
|
3703
3835
|
var CatalogViewRenameParamsSchema = schema2([
|
|
3704
3836
|
field2("attach_opaque_data", binary2(), false),
|
|
3705
|
-
field2("
|
|
3837
|
+
field2("schema_path", list2(field2("item", utf82(), true)), false),
|
|
3706
3838
|
field2("name", utf82(), false),
|
|
3707
3839
|
field2("new_name", utf82(), false),
|
|
3708
3840
|
field2("ignore_not_found", bool2(), false),
|
|
@@ -3733,6 +3865,11 @@ var TableFunctionStatisticsParamsSchema = schema2([
|
|
|
3733
3865
|
field2("request", binary2(), false)
|
|
3734
3866
|
]);
|
|
3735
3867
|
|
|
3868
|
+
// src/schema-path.ts
|
|
3869
|
+
function normalizeSchemaPath(path) {
|
|
3870
|
+
return typeof path === "string" ? [path] : Array.from(path, String);
|
|
3871
|
+
}
|
|
3872
|
+
|
|
3736
3873
|
// src/protocol/handlers/shared.ts
|
|
3737
3874
|
var RESULT_BINARY_SCHEMA = schema2([
|
|
3738
3875
|
field2("result", binary2(), false)
|
|
@@ -3746,7 +3883,15 @@ var RESULT_BINARY_NULLABLE_SCHEMA = schema2([
|
|
|
3746
3883
|
function unwrapRequest(requestBytes) {
|
|
3747
3884
|
const bytes = toUint8Array(requestBytes);
|
|
3748
3885
|
const innerBatch = deserializeBatch(bytes);
|
|
3749
|
-
|
|
3886
|
+
const params = batchToScalarDict(innerBatch);
|
|
3887
|
+
normalizeRequestSchemaPaths(params);
|
|
3888
|
+
return params;
|
|
3889
|
+
}
|
|
3890
|
+
function normalizeRequestSchemaPaths(params) {
|
|
3891
|
+
if (params.path != null)
|
|
3892
|
+
params.path = normalizeSchemaPath(params.path);
|
|
3893
|
+
if (params.schema_path != null)
|
|
3894
|
+
params.schema_path = normalizeSchemaPath(params.schema_path);
|
|
3750
3895
|
}
|
|
3751
3896
|
function wrapResult(values, innerSchema) {
|
|
3752
3897
|
const a = innerSchema;
|
|
@@ -3766,7 +3911,7 @@ function overloadContext(req, catalogInterface) {
|
|
|
3766
3911
|
arguments: req.arguments,
|
|
3767
3912
|
inputSchema: req.input_schema,
|
|
3768
3913
|
isScalar: String(req.function_type).toLowerCase() === "scalar",
|
|
3769
|
-
|
|
3914
|
+
schemaPath: req.schema_path ?? null,
|
|
3770
3915
|
catalogName
|
|
3771
3916
|
};
|
|
3772
3917
|
}
|
|
@@ -3954,14 +4099,14 @@ function getOutput(expectedLength, out, onlyAligned = true) {
|
|
|
3954
4099
|
throw new Error("invalid output, must be aligned");
|
|
3955
4100
|
return out;
|
|
3956
4101
|
}
|
|
3957
|
-
function u64Lengths(dataLength, aadLength,
|
|
4102
|
+
function u64Lengths(dataLength, aadLength, isLE) {
|
|
3958
4103
|
anumber(dataLength);
|
|
3959
4104
|
anumber(aadLength);
|
|
3960
|
-
abool(
|
|
4105
|
+
abool(isLE);
|
|
3961
4106
|
const num = new Uint8Array(16);
|
|
3962
4107
|
const view = createView(num);
|
|
3963
|
-
view.setBigUint64(0, BigInt(aadLength),
|
|
3964
|
-
view.setBigUint64(8, BigInt(dataLength),
|
|
4108
|
+
view.setBigUint64(0, BigInt(aadLength), isLE);
|
|
4109
|
+
view.setBigUint64(8, BigInt(dataLength), isLE);
|
|
3965
4110
|
return num;
|
|
3966
4111
|
}
|
|
3967
4112
|
function isAligned32(bytes) {
|
|
@@ -4528,8 +4673,8 @@ var ATTACH_AAD_PREFIX = _UTF8.encode("vgi.attach_opaque_data.v1\x00");
|
|
|
4528
4673
|
var TRANSACTION_AAD_PREFIX = _UTF8.encode("vgi.transaction_opaque_data.v1\x00");
|
|
4529
4674
|
|
|
4530
4675
|
class OpaqueDataRejectedError extends Error {
|
|
4531
|
-
constructor(
|
|
4532
|
-
super(`${
|
|
4676
|
+
constructor(field = "opaque data") {
|
|
4677
|
+
super(`${field} not recognized`);
|
|
4533
4678
|
this.name = "OpaqueDataRejectedError";
|
|
4534
4679
|
}
|
|
4535
4680
|
}
|
|
@@ -4572,16 +4717,16 @@ async function sealBytes(payload, key, aad, version) {
|
|
|
4572
4717
|
out.set(ciphertext, 1 + NONCE_LEN);
|
|
4573
4718
|
return out;
|
|
4574
4719
|
}
|
|
4575
|
-
async function openBytes(token, key, aad, version,
|
|
4720
|
+
async function openBytes(token, key, aad, version, field = "opaque data") {
|
|
4576
4721
|
if (token.length < MIN_ENVELOPE_LEN || token[0] !== (version & 255)) {
|
|
4577
|
-
throw new OpaqueDataRejectedError(
|
|
4722
|
+
throw new OpaqueDataRejectedError(field);
|
|
4578
4723
|
}
|
|
4579
4724
|
const nonce = token.subarray(1, 1 + NONCE_LEN);
|
|
4580
4725
|
const ciphertext = token.subarray(1 + NONCE_LEN);
|
|
4581
4726
|
try {
|
|
4582
4727
|
return xchacha20poly1305(await normalizeKey(key), nonce, aad).decrypt(ciphertext);
|
|
4583
4728
|
} catch {
|
|
4584
|
-
throw new OpaqueDataRejectedError(
|
|
4729
|
+
throw new OpaqueDataRejectedError(field);
|
|
4585
4730
|
}
|
|
4586
4731
|
}
|
|
4587
4732
|
|
|
@@ -4634,6 +4779,7 @@ function catalogUnary(protocol, signingKey, name, config) {
|
|
|
4634
4779
|
result: config.result,
|
|
4635
4780
|
doc: config.doc,
|
|
4636
4781
|
handler: async (params, ctx) => {
|
|
4782
|
+
normalizeRequestSchemaPaths(params);
|
|
4637
4783
|
await unwrapParamsOpaque(params, ctx, signingKey);
|
|
4638
4784
|
return config.handler(params, ctx);
|
|
4639
4785
|
}
|
|
@@ -4697,7 +4843,7 @@ function deserializePlanRequest(params) {
|
|
|
4697
4843
|
function fingerprintInputs(bindCallBytes) {
|
|
4698
4844
|
const dict = batchToScalarDict(deserializeBatch(bindCallBytes));
|
|
4699
4845
|
return {
|
|
4700
|
-
|
|
4846
|
+
schemaPath: dict.schema_path == null ? [] : (Array.isArray(dict.schema_path) ? dict.schema_path : [...dict.schema_path]).map(String),
|
|
4701
4847
|
functionName: String(dict.function_name ?? ""),
|
|
4702
4848
|
args: dict.arguments ? toUint8Array2(dict.arguments) : new Uint8Array(0),
|
|
4703
4849
|
settings: dict.settings ? toUint8Array2(dict.settings) : new Uint8Array(0)
|
|
@@ -4776,11 +4922,11 @@ function equalBytes2(a, b) {
|
|
|
4776
4922
|
diff |= a[i] ^ b[i];
|
|
4777
4923
|
return diff === 0;
|
|
4778
4924
|
}
|
|
4779
|
-
async function bindFingerprint(
|
|
4925
|
+
async function bindFingerprint(schemaPath, functionName, args, settings, projection) {
|
|
4780
4926
|
const enc = new TextEncoder;
|
|
4781
4927
|
const zero = Uint8Array.of(0);
|
|
4782
|
-
const
|
|
4783
|
-
const message = concat2(AAD_PREFIX,
|
|
4928
|
+
const field = (label, value) => concat2(enc.encode(label), zero, value, zero);
|
|
4929
|
+
const message = concat2(AAD_PREFIX, field("schema_path", enc.encode(JSON.stringify(schemaPath))), field("function_name", enc.encode(functionName)), field("arguments", args), field("settings", settings), field("projection_ids", projection));
|
|
4784
4930
|
const digest = await crypto.subtle.digest("SHA-256", message);
|
|
4785
4931
|
return new Uint8Array(digest).slice(0, FINGERPRINT_LEN);
|
|
4786
4932
|
}
|
|
@@ -4850,8 +4996,8 @@ async function openSplitToken(token, opts = {}) {
|
|
|
4850
4996
|
return new Uint8Array(rest);
|
|
4851
4997
|
try {
|
|
4852
4998
|
return await openBytes(rest, signingKey, splitTokenAad(body, auth), SEAL_VERSION, "split token");
|
|
4853
|
-
} catch (
|
|
4854
|
-
throw new SplitTokenError(SPLIT_TOKEN_INVALID, `split token failed authentication: ${
|
|
4999
|
+
} catch (err) {
|
|
5000
|
+
throw new SplitTokenError(SPLIT_TOKEN_INVALID, `split token failed authentication: ${err instanceof Error ? err.message : String(err)}`);
|
|
4855
5001
|
}
|
|
4856
5002
|
}
|
|
4857
5003
|
|
|
@@ -4876,7 +5022,7 @@ async function resolveSplitPayloads(request, innerParams, opts) {
|
|
|
4876
5022
|
if (!request.split_tokens)
|
|
4877
5023
|
return;
|
|
4878
5024
|
const fp = fingerprintInputs(toUint8Array(innerParams.bind_call));
|
|
4879
|
-
const expected = await bindFingerprint(fp.
|
|
5025
|
+
const expected = await bindFingerprint(fp.schemaPath, fp.functionName, fp.args, fp.settings, new Uint8Array(0));
|
|
4880
5026
|
const currentAnchor = opts.checkAnchor ? await liveSplitAnchor(opts.catalogInterface, request.bind_call, opts.auth, opts.signingKey) : undefined;
|
|
4881
5027
|
request.split_payloads = [];
|
|
4882
5028
|
for (const token of request.split_tokens) {
|
|
@@ -5054,7 +5200,7 @@ function registerFunctionMethods(protocol, config) {
|
|
|
5054
5200
|
const func = registry.get(request.bind_call.function_name, await strippedContext(request.bind_call));
|
|
5055
5201
|
const plan = func.plan ? await func.plan(request) : { splits: [{ payload: new Uint8Array(0) }] };
|
|
5056
5202
|
const fp = fingerprintInputs(toUint8Array(innerParams.bind_call));
|
|
5057
|
-
const fingerprint = await bindFingerprint(fp.
|
|
5203
|
+
const fingerprint = await bindFingerprint(fp.schemaPath, fp.functionName, fp.args, fp.settings, new Uint8Array(0));
|
|
5058
5204
|
const anchor = plan.catalogVersion != null ? splitAnchor(plan.catalogVersion) : await liveSplitAnchor(catalogInterface, request.bind_call, ctx?.auth, signingKey) ?? splitAnchor(0);
|
|
5059
5205
|
const blobs = [];
|
|
5060
5206
|
for (const split of plan.splits) {
|
|
@@ -5100,9 +5246,9 @@ function registerFunctionMethods(protocol, config) {
|
|
|
5100
5246
|
const globalExecutionId = toUint8Array(innerParams.global_execution_id);
|
|
5101
5247
|
const bindOpaqueData = innerParams.bind_opaque_data ? toUint8Array(innerParams.bind_opaque_data) : null;
|
|
5102
5248
|
const func = registry.get(bindCall.function_name, await strippedContext(bindCall));
|
|
5103
|
-
const
|
|
5104
|
-
const keys = Object.keys(
|
|
5105
|
-
const values = keys.map((k) =>
|
|
5249
|
+
const map = func.dynamicToString ? await func.dynamicToString({ bindCall, bindOpaqueData, globalExecutionId }) : {};
|
|
5250
|
+
const keys = Object.keys(map);
|
|
5251
|
+
const values = keys.map((k) => map[k] ?? "");
|
|
5106
5252
|
return wrapResult({ keys, values }, TableFunctionDynamicToStringResultSchema);
|
|
5107
5253
|
}
|
|
5108
5254
|
});
|
|
@@ -5277,12 +5423,12 @@ function persistGroupStates(executionId, gids) {
|
|
|
5277
5423
|
|
|
5278
5424
|
// src/protocol/handlers/aggregate.ts
|
|
5279
5425
|
function registerAggregateMethods(protocol, registry) {
|
|
5280
|
-
function resolveAggregate(name,
|
|
5426
|
+
function resolveAggregate(name, schemaPath) {
|
|
5281
5427
|
const func = registry.get(name, {
|
|
5282
5428
|
arguments: new Arguments,
|
|
5283
5429
|
inputSchema: null,
|
|
5284
5430
|
isScalar: false,
|
|
5285
|
-
|
|
5431
|
+
schemaPath: schemaPath ?? null
|
|
5286
5432
|
});
|
|
5287
5433
|
if (!func || func.kind !== "aggregate") {
|
|
5288
5434
|
throw new Error(`Function '${name}' is not an aggregate function`);
|
|
@@ -5295,7 +5441,7 @@ function registerAggregateMethods(protocol, registry) {
|
|
|
5295
5441
|
handler: async (params) => {
|
|
5296
5442
|
const innerParams = unwrapRequest(params.request);
|
|
5297
5443
|
const functionName = innerParams.function_name;
|
|
5298
|
-
const cfg = resolveAggregate(functionName, innerParams.
|
|
5444
|
+
const cfg = resolveAggregate(functionName, innerParams.schema_path ?? null);
|
|
5299
5445
|
const argBytes = toUint8Array(innerParams.arguments);
|
|
5300
5446
|
const args = deserializeArguments(argBytes);
|
|
5301
5447
|
const inputSchema = innerParams.input_schema ? deserializeSchema(toUint8Array(innerParams.input_schema)) : null;
|
|
@@ -5307,7 +5453,8 @@ function registerAggregateMethods(protocol, registry) {
|
|
|
5307
5453
|
arguments: args,
|
|
5308
5454
|
inputSchema,
|
|
5309
5455
|
settings: {},
|
|
5310
|
-
secrets
|
|
5456
|
+
secrets,
|
|
5457
|
+
argumentNames: innerParams.argument_names ? (Array.isArray(innerParams.argument_names) ? innerParams.argument_names : [...innerParams.argument_names]).map((value) => value == null ? null : String(value)) : null
|
|
5311
5458
|
};
|
|
5312
5459
|
const executionId = new Uint8Array(16);
|
|
5313
5460
|
crypto.getRandomValues(executionId);
|
|
@@ -5328,7 +5475,7 @@ function registerAggregateMethods(protocol, registry) {
|
|
|
5328
5475
|
const innerParams = unwrapRequest(params.request);
|
|
5329
5476
|
const functionName = innerParams.function_name;
|
|
5330
5477
|
const executionId = toUint8Array(innerParams.execution_id);
|
|
5331
|
-
const cfg = resolveAggregate(functionName, innerParams.
|
|
5478
|
+
const cfg = resolveAggregate(functionName, innerParams.schema_path ?? null);
|
|
5332
5479
|
const batch = readSingleBatch(toUint8Array(innerParams.input_batch));
|
|
5333
5480
|
if (!batch || batch.numRows === 0)
|
|
5334
5481
|
return wrapResult({}, schema2([]));
|
|
@@ -5381,7 +5528,7 @@ function registerAggregateMethods(protocol, registry) {
|
|
|
5381
5528
|
const innerParams = unwrapRequest(params.request);
|
|
5382
5529
|
const functionName = innerParams.function_name;
|
|
5383
5530
|
const executionId = toUint8Array(innerParams.execution_id);
|
|
5384
|
-
const cfg = resolveAggregate(functionName, innerParams.
|
|
5531
|
+
const cfg = resolveAggregate(functionName, innerParams.schema_path ?? null);
|
|
5385
5532
|
const batch = readSingleBatch(toUint8Array(innerParams.merge_batch));
|
|
5386
5533
|
if (!batch || batch.numRows === 0)
|
|
5387
5534
|
return wrapResult({}, schema2([]));
|
|
@@ -5426,7 +5573,7 @@ function registerAggregateMethods(protocol, registry) {
|
|
|
5426
5573
|
const innerParams = unwrapRequest(params.request);
|
|
5427
5574
|
const functionName = innerParams.function_name;
|
|
5428
5575
|
const executionId = toUint8Array(innerParams.execution_id);
|
|
5429
|
-
const cfg = resolveAggregate(functionName, innerParams.
|
|
5576
|
+
const cfg = resolveAggregate(functionName, innerParams.schema_path ?? null);
|
|
5430
5577
|
const outputSchema = deserializeSchema(toUint8Array(innerParams.output_schema));
|
|
5431
5578
|
const gidBatch = readSingleBatch(toUint8Array(innerParams.group_ids_batch));
|
|
5432
5579
|
const groupIds = [];
|
|
@@ -5496,9 +5643,9 @@ function extractArgMap(cfg, args) {
|
|
|
5496
5643
|
let v;
|
|
5497
5644
|
try {
|
|
5498
5645
|
v = args.get(i);
|
|
5499
|
-
const
|
|
5500
|
-
if (
|
|
5501
|
-
const scale =
|
|
5646
|
+
const field = args.argumentsSchema?.fields.find((f) => f.name === `positional_${i}`);
|
|
5647
|
+
if (field && isDecimal(field.type)) {
|
|
5648
|
+
const scale = field.type.scale;
|
|
5502
5649
|
if (typeof v === "bigint")
|
|
5503
5650
|
v = Number(v) / Math.pow(10, scale);
|
|
5504
5651
|
else if (typeof v === "number")
|
|
@@ -5572,12 +5719,12 @@ function splitLenPrefixed(buf, count) {
|
|
|
5572
5719
|
|
|
5573
5720
|
// src/protocol/handlers/table-buffering.ts
|
|
5574
5721
|
function registerTableBufferingMethods(protocol, registry, signingKey) {
|
|
5575
|
-
function resolveBuffering(name,
|
|
5722
|
+
function resolveBuffering(name, schemaPath) {
|
|
5576
5723
|
const func = registry.get(name, {
|
|
5577
5724
|
arguments: new Arguments,
|
|
5578
5725
|
inputSchema: null,
|
|
5579
5726
|
isScalar: false,
|
|
5580
|
-
|
|
5727
|
+
schemaPath: schemaPath ?? null
|
|
5581
5728
|
});
|
|
5582
5729
|
if (!func || func.kind !== "table_buffering") {
|
|
5583
5730
|
throw new Error(`Function '${name}' is not a table_buffering function`);
|
|
@@ -5590,7 +5737,7 @@ function registerTableBufferingMethods(protocol, registry, signingKey) {
|
|
|
5590
5737
|
const rawAttach = inner.attach_opaque_data ? toUint8Array(inner.attach_opaque_data) : null;
|
|
5591
5738
|
const attach = rawAttach && rawAttach.length > 0 ? await openAttach(rawAttach, ctx?.auth, signingKey) : rawAttach;
|
|
5592
5739
|
const transactionId = inner.transaction_id ? toUint8Array(inner.transaction_id) : null;
|
|
5593
|
-
const func = resolveBuffering(functionName, inner.
|
|
5740
|
+
const func = resolveBuffering(functionName, inner.schema_path ?? null);
|
|
5594
5741
|
const bound = new BoundStorage(storage, executionId);
|
|
5595
5742
|
const payload = await bound.stateGet(FrameworkNS.BUFFERING_INIT, BoundStorage.packIntKey(-1));
|
|
5596
5743
|
if (payload == null) {
|
|
@@ -5689,8 +5836,8 @@ function hex(buf) {
|
|
|
5689
5836
|
}
|
|
5690
5837
|
|
|
5691
5838
|
// src/codec/asd.ts
|
|
5692
|
-
function encodeASD(
|
|
5693
|
-
return serializeBatch(batchFromRows([obj],
|
|
5839
|
+
function encodeASD(schema, obj) {
|
|
5840
|
+
return serializeBatch(batchFromRows([obj], schema));
|
|
5694
5841
|
}
|
|
5695
5842
|
|
|
5696
5843
|
// src/generated/vgi-client.ts
|
|
@@ -5856,7 +6003,7 @@ function registerCatalogAdminMethods(protocol, getCatalog, signingKey) {
|
|
|
5856
6003
|
result: RESULT_BINARY_SCHEMA,
|
|
5857
6004
|
handler: async (params) => {
|
|
5858
6005
|
const cat = getCatalog();
|
|
5859
|
-
const info = await cat.schemaGet(toUint8Array(params.attach_opaque_data), params.
|
|
6006
|
+
const info = await cat.schemaGet(toUint8Array(params.attach_opaque_data), params.path, params.transaction_opaque_data ? toUint8Array(params.transaction_opaque_data) : undefined);
|
|
5860
6007
|
return wrapResult({
|
|
5861
6008
|
items: info ? [encodeSchemaInfo(info)] : []
|
|
5862
6009
|
}, CatalogSchemaGetResultSchema);
|
|
@@ -5867,7 +6014,7 @@ function registerCatalogAdminMethods(protocol, getCatalog, signingKey) {
|
|
|
5867
6014
|
result: emptyResultSchema,
|
|
5868
6015
|
handler: async (params) => {
|
|
5869
6016
|
const cat = getCatalog();
|
|
5870
|
-
await cat.schemaCreate(toUint8Array(params.attach_opaque_data), params.
|
|
6017
|
+
await cat.schemaCreate(toUint8Array(params.attach_opaque_data), params.path, params.comment, null, params.transaction_opaque_data ? toUint8Array(params.transaction_opaque_data) : undefined);
|
|
5871
6018
|
return {};
|
|
5872
6019
|
}
|
|
5873
6020
|
});
|
|
@@ -5876,7 +6023,7 @@ function registerCatalogAdminMethods(protocol, getCatalog, signingKey) {
|
|
|
5876
6023
|
result: emptyResultSchema,
|
|
5877
6024
|
handler: async (params) => {
|
|
5878
6025
|
const cat = getCatalog();
|
|
5879
|
-
await cat.schemaDrop(toUint8Array(params.attach_opaque_data), params.
|
|
6026
|
+
await cat.schemaDrop(toUint8Array(params.attach_opaque_data), params.path, params.ignore_not_found, params.cascade, params.transaction_opaque_data ? toUint8Array(params.transaction_opaque_data) : undefined);
|
|
5880
6027
|
return {};
|
|
5881
6028
|
}
|
|
5882
6029
|
});
|
|
@@ -5885,7 +6032,7 @@ function registerCatalogAdminMethods(protocol, getCatalog, signingKey) {
|
|
|
5885
6032
|
result: RESULT_BINARY_SCHEMA,
|
|
5886
6033
|
handler: async (params) => {
|
|
5887
6034
|
const cat = getCatalog();
|
|
5888
|
-
const tables = await cat.schemaContentsTables(toUint8Array(params.attach_opaque_data), params.
|
|
6035
|
+
const tables = await cat.schemaContentsTables(toUint8Array(params.attach_opaque_data), params.path, params.transaction_opaque_data ? toUint8Array(params.transaction_opaque_data) : undefined);
|
|
5889
6036
|
return wrapResult({
|
|
5890
6037
|
items: tables.map((t) => encodeTableInfo(t))
|
|
5891
6038
|
}, CatalogSchemaContentsTablesResultSchema);
|
|
@@ -5896,7 +6043,7 @@ function registerCatalogAdminMethods(protocol, getCatalog, signingKey) {
|
|
|
5896
6043
|
result: RESULT_BINARY_SCHEMA,
|
|
5897
6044
|
handler: async (params) => {
|
|
5898
6045
|
const cat = getCatalog();
|
|
5899
|
-
const views = await cat.schemaContentsViews(toUint8Array(params.attach_opaque_data), params.
|
|
6046
|
+
const views = await cat.schemaContentsViews(toUint8Array(params.attach_opaque_data), params.path, params.transaction_opaque_data ? toUint8Array(params.transaction_opaque_data) : undefined);
|
|
5900
6047
|
return wrapResult({
|
|
5901
6048
|
items: views.map((v) => encodeViewInfo(v))
|
|
5902
6049
|
}, CatalogSchemaContentsViewsResultSchema);
|
|
@@ -5907,7 +6054,7 @@ function registerCatalogAdminMethods(protocol, getCatalog, signingKey) {
|
|
|
5907
6054
|
result: RESULT_BINARY_SCHEMA,
|
|
5908
6055
|
handler: async (params) => {
|
|
5909
6056
|
const cat = getCatalog();
|
|
5910
|
-
const funcs = await cat.schemaContentsFunctions(toUint8Array(params.attach_opaque_data), params.
|
|
6057
|
+
const funcs = await cat.schemaContentsFunctions(toUint8Array(params.attach_opaque_data), params.path, decodeDictValue(params.type), params.transaction_opaque_data ? toUint8Array(params.transaction_opaque_data) : undefined);
|
|
5911
6058
|
return wrapResult({
|
|
5912
6059
|
items: funcs.map((f) => encodeFunctionInfo(f))
|
|
5913
6060
|
}, CatalogSchemaContentsFunctionsResultSchema);
|
|
@@ -5922,7 +6069,7 @@ function registerCatalogTableMethods(protocol, getCatalog, signingKey) {
|
|
|
5922
6069
|
result: RESULT_BINARY_SCHEMA,
|
|
5923
6070
|
handler: async (params) => {
|
|
5924
6071
|
const cat = getCatalog();
|
|
5925
|
-
const info = await cat.tableGet(toUint8Array(params.attach_opaque_data), params.
|
|
6072
|
+
const info = await cat.tableGet(toUint8Array(params.attach_opaque_data), params.schema_path, params.name, params.at_unit, params.at_value, params.transaction_opaque_data ? toUint8Array(params.transaction_opaque_data) : undefined);
|
|
5926
6073
|
return wrapResult({
|
|
5927
6074
|
items: info ? [encodeTableInfo(info)] : []
|
|
5928
6075
|
}, CatalogTableGetResultSchema);
|
|
@@ -5933,7 +6080,7 @@ function registerCatalogTableMethods(protocol, getCatalog, signingKey) {
|
|
|
5933
6080
|
result: emptyResultSchema,
|
|
5934
6081
|
handler: async (params) => {
|
|
5935
6082
|
const cat = getCatalog();
|
|
5936
|
-
await cat.tableCreate(toUint8Array(params.attach_opaque_data), params.
|
|
6083
|
+
await cat.tableCreate(toUint8Array(params.attach_opaque_data), params.schema_path, params.name, toUint8Array(params.columns), params.on_conflict, params.not_null_constraints ?? [], params.unique_constraints ?? [], params.check_constraints ?? [], params.transaction_opaque_data ? toUint8Array(params.transaction_opaque_data) : undefined);
|
|
5937
6084
|
return {};
|
|
5938
6085
|
}
|
|
5939
6086
|
});
|
|
@@ -5942,7 +6089,7 @@ function registerCatalogTableMethods(protocol, getCatalog, signingKey) {
|
|
|
5942
6089
|
result: emptyResultSchema,
|
|
5943
6090
|
handler: async (params) => {
|
|
5944
6091
|
const cat = getCatalog();
|
|
5945
|
-
await cat.tableDrop(toUint8Array(params.attach_opaque_data), params.
|
|
6092
|
+
await cat.tableDrop(toUint8Array(params.attach_opaque_data), params.schema_path, params.name, params.ignore_not_found, params.transaction_opaque_data ? toUint8Array(params.transaction_opaque_data) : undefined);
|
|
5946
6093
|
return {};
|
|
5947
6094
|
}
|
|
5948
6095
|
});
|
|
@@ -5951,7 +6098,7 @@ function registerCatalogTableMethods(protocol, getCatalog, signingKey) {
|
|
|
5951
6098
|
result: RESULT_BINARY_NULLABLE_SCHEMA,
|
|
5952
6099
|
handler: async (params) => {
|
|
5953
6100
|
const cat = getCatalog();
|
|
5954
|
-
const stats = await cat.tableColumnStatisticsGet(toUint8Array(params.attach_opaque_data), params.
|
|
6101
|
+
const stats = await cat.tableColumnStatisticsGet(toUint8Array(params.attach_opaque_data), params.schema_path, params.name, params.transaction_opaque_data ? toUint8Array(params.transaction_opaque_data) : undefined);
|
|
5955
6102
|
return { result: stats?.bytes ?? null };
|
|
5956
6103
|
}
|
|
5957
6104
|
});
|
|
@@ -5960,7 +6107,7 @@ function registerCatalogTableMethods(protocol, getCatalog, signingKey) {
|
|
|
5960
6107
|
result: RESULT_BINARY_SCHEMA,
|
|
5961
6108
|
handler: async (params) => {
|
|
5962
6109
|
const cat = getCatalog();
|
|
5963
|
-
const scanResult = await cat.tableScanFunctionGet(toUint8Array(params.attach_opaque_data), params.
|
|
6110
|
+
const scanResult = await cat.tableScanFunctionGet(toUint8Array(params.attach_opaque_data), params.schema_path, params.name, params.at_unit, params.at_value, params.transaction_opaque_data ? toUint8Array(params.transaction_opaque_data) : undefined);
|
|
5964
6111
|
return wrapResult(scanResult, ScanFunctionResultSchema);
|
|
5965
6112
|
}
|
|
5966
6113
|
});
|
|
@@ -5969,7 +6116,7 @@ function registerCatalogTableMethods(protocol, getCatalog, signingKey) {
|
|
|
5969
6116
|
result: RESULT_BINARY_SCHEMA,
|
|
5970
6117
|
handler: async (params) => {
|
|
5971
6118
|
const cat = getCatalog();
|
|
5972
|
-
const branchesResult = await cat.tableScanBranchesGet(toUint8Array(params.attach_opaque_data), params.
|
|
6119
|
+
const branchesResult = await cat.tableScanBranchesGet(toUint8Array(params.attach_opaque_data), params.schema_path, params.name, params.at_unit, params.at_value, params.transaction_opaque_data ? toUint8Array(params.transaction_opaque_data) : undefined);
|
|
5973
6120
|
return wrapResult(branchesResult, ScanBranchesResultSchema);
|
|
5974
6121
|
}
|
|
5975
6122
|
});
|
|
@@ -5978,7 +6125,7 @@ function registerCatalogTableMethods(protocol, getCatalog, signingKey) {
|
|
|
5978
6125
|
result: emptyResultSchema,
|
|
5979
6126
|
handler: async (params) => {
|
|
5980
6127
|
const cat = getCatalog();
|
|
5981
|
-
await cat.tableCommentSet(toUint8Array(params.attach_opaque_data), params.
|
|
6128
|
+
await cat.tableCommentSet(toUint8Array(params.attach_opaque_data), params.schema_path, params.name, params.comment, params.ignore_not_found, params.transaction_opaque_data ? toUint8Array(params.transaction_opaque_data) : undefined);
|
|
5982
6129
|
return {};
|
|
5983
6130
|
}
|
|
5984
6131
|
});
|
|
@@ -5987,7 +6134,7 @@ function registerCatalogTableMethods(protocol, getCatalog, signingKey) {
|
|
|
5987
6134
|
result: emptyResultSchema,
|
|
5988
6135
|
handler: async (params) => {
|
|
5989
6136
|
const cat = getCatalog();
|
|
5990
|
-
await cat.tableRename(toUint8Array(params.attach_opaque_data), params.
|
|
6137
|
+
await cat.tableRename(toUint8Array(params.attach_opaque_data), params.schema_path, params.name, params.new_name, params.ignore_not_found, params.transaction_opaque_data ? toUint8Array(params.transaction_opaque_data) : undefined);
|
|
5991
6138
|
return {};
|
|
5992
6139
|
}
|
|
5993
6140
|
});
|
|
@@ -5996,7 +6143,7 @@ function registerCatalogTableMethods(protocol, getCatalog, signingKey) {
|
|
|
5996
6143
|
result: emptyResultSchema,
|
|
5997
6144
|
handler: async (params) => {
|
|
5998
6145
|
const cat = getCatalog();
|
|
5999
|
-
await cat.tableColumnAdd(toUint8Array(params.attach_opaque_data), params.
|
|
6146
|
+
await cat.tableColumnAdd(toUint8Array(params.attach_opaque_data), params.schema_path, params.name, params.column_name, params.column_type, params.default_value, params.ignore_not_found, params.transaction_opaque_data ? toUint8Array(params.transaction_opaque_data) : undefined);
|
|
6000
6147
|
return {};
|
|
6001
6148
|
}
|
|
6002
6149
|
});
|
|
@@ -6005,7 +6152,7 @@ function registerCatalogTableMethods(protocol, getCatalog, signingKey) {
|
|
|
6005
6152
|
result: emptyResultSchema,
|
|
6006
6153
|
handler: async (params) => {
|
|
6007
6154
|
const cat = getCatalog();
|
|
6008
|
-
await cat.tableColumnDrop(toUint8Array(params.attach_opaque_data), params.
|
|
6155
|
+
await cat.tableColumnDrop(toUint8Array(params.attach_opaque_data), params.schema_path, params.name, params.column_name, params.ignore_not_found, params.transaction_opaque_data ? toUint8Array(params.transaction_opaque_data) : undefined);
|
|
6009
6156
|
return {};
|
|
6010
6157
|
}
|
|
6011
6158
|
});
|
|
@@ -6014,7 +6161,7 @@ function registerCatalogTableMethods(protocol, getCatalog, signingKey) {
|
|
|
6014
6161
|
result: emptyResultSchema,
|
|
6015
6162
|
handler: async (params) => {
|
|
6016
6163
|
const cat = getCatalog();
|
|
6017
|
-
await cat.tableColumnRename(toUint8Array(params.attach_opaque_data), params.
|
|
6164
|
+
await cat.tableColumnRename(toUint8Array(params.attach_opaque_data), params.schema_path, params.name, params.column_name, params.new_name, params.ignore_not_found, params.transaction_opaque_data ? toUint8Array(params.transaction_opaque_data) : undefined);
|
|
6018
6165
|
return {};
|
|
6019
6166
|
}
|
|
6020
6167
|
});
|
|
@@ -6023,7 +6170,7 @@ function registerCatalogTableMethods(protocol, getCatalog, signingKey) {
|
|
|
6023
6170
|
result: emptyResultSchema,
|
|
6024
6171
|
handler: async (params) => {
|
|
6025
6172
|
const cat = getCatalog();
|
|
6026
|
-
await cat.tableColumnDefaultSet(toUint8Array(params.attach_opaque_data), params.
|
|
6173
|
+
await cat.tableColumnDefaultSet(toUint8Array(params.attach_opaque_data), params.schema_path, params.name, params.column_name, params.default_value, params.ignore_not_found, params.transaction_opaque_data ? toUint8Array(params.transaction_opaque_data) : undefined);
|
|
6027
6174
|
return {};
|
|
6028
6175
|
}
|
|
6029
6176
|
});
|
|
@@ -6032,7 +6179,7 @@ function registerCatalogTableMethods(protocol, getCatalog, signingKey) {
|
|
|
6032
6179
|
result: emptyResultSchema,
|
|
6033
6180
|
handler: async (params) => {
|
|
6034
6181
|
const cat = getCatalog();
|
|
6035
|
-
await cat.tableColumnDefaultDrop(toUint8Array(params.attach_opaque_data), params.
|
|
6182
|
+
await cat.tableColumnDefaultDrop(toUint8Array(params.attach_opaque_data), params.schema_path, params.name, params.column_name, params.ignore_not_found, params.transaction_opaque_data ? toUint8Array(params.transaction_opaque_data) : undefined);
|
|
6036
6183
|
return {};
|
|
6037
6184
|
}
|
|
6038
6185
|
});
|
|
@@ -6041,7 +6188,7 @@ function registerCatalogTableMethods(protocol, getCatalog, signingKey) {
|
|
|
6041
6188
|
result: emptyResultSchema,
|
|
6042
6189
|
handler: async (params) => {
|
|
6043
6190
|
const cat = getCatalog();
|
|
6044
|
-
await cat.tableColumnTypeChange(toUint8Array(params.attach_opaque_data), params.
|
|
6191
|
+
await cat.tableColumnTypeChange(toUint8Array(params.attach_opaque_data), params.schema_path, params.name, params.column_name, params.new_type, params.ignore_not_found, params.transaction_opaque_data ? toUint8Array(params.transaction_opaque_data) : undefined);
|
|
6045
6192
|
return {};
|
|
6046
6193
|
}
|
|
6047
6194
|
});
|
|
@@ -6050,7 +6197,7 @@ function registerCatalogTableMethods(protocol, getCatalog, signingKey) {
|
|
|
6050
6197
|
result: emptyResultSchema,
|
|
6051
6198
|
handler: async (params) => {
|
|
6052
6199
|
const cat = getCatalog();
|
|
6053
|
-
await cat.tableNotNullSet(toUint8Array(params.attach_opaque_data), params.
|
|
6200
|
+
await cat.tableNotNullSet(toUint8Array(params.attach_opaque_data), params.schema_path, params.name, params.column_name, params.ignore_not_found, params.transaction_opaque_data ? toUint8Array(params.transaction_opaque_data) : undefined);
|
|
6054
6201
|
return {};
|
|
6055
6202
|
}
|
|
6056
6203
|
});
|
|
@@ -6059,7 +6206,7 @@ function registerCatalogTableMethods(protocol, getCatalog, signingKey) {
|
|
|
6059
6206
|
result: emptyResultSchema,
|
|
6060
6207
|
handler: async (params) => {
|
|
6061
6208
|
const cat = getCatalog();
|
|
6062
|
-
await cat.tableNotNullDrop(toUint8Array(params.attach_opaque_data), params.
|
|
6209
|
+
await cat.tableNotNullDrop(toUint8Array(params.attach_opaque_data), params.schema_path, params.name, params.column_name, params.ignore_not_found, params.transaction_opaque_data ? toUint8Array(params.transaction_opaque_data) : undefined);
|
|
6063
6210
|
return {};
|
|
6064
6211
|
}
|
|
6065
6212
|
});
|
|
@@ -6072,7 +6219,7 @@ function registerCatalogViewMethods(protocol, getCatalog, signingKey) {
|
|
|
6072
6219
|
result: RESULT_BINARY_SCHEMA,
|
|
6073
6220
|
handler: async (params) => {
|
|
6074
6221
|
const cat = getCatalog();
|
|
6075
|
-
const info = await cat.viewGet(toUint8Array(params.attach_opaque_data), params.
|
|
6222
|
+
const info = await cat.viewGet(toUint8Array(params.attach_opaque_data), params.schema_path, params.name, params.transaction_opaque_data ? toUint8Array(params.transaction_opaque_data) : undefined);
|
|
6076
6223
|
return wrapResult({
|
|
6077
6224
|
items: info ? [encodeViewInfo(info)] : []
|
|
6078
6225
|
}, CatalogViewGetResultSchema);
|
|
@@ -6083,7 +6230,7 @@ function registerCatalogViewMethods(protocol, getCatalog, signingKey) {
|
|
|
6083
6230
|
result: emptyResultSchema,
|
|
6084
6231
|
handler: async (params) => {
|
|
6085
6232
|
const cat = getCatalog();
|
|
6086
|
-
await cat.viewCreate(toUint8Array(params.attach_opaque_data), params.
|
|
6233
|
+
await cat.viewCreate(toUint8Array(params.attach_opaque_data), params.schema_path, params.name, params.definition, params.on_conflict, params.transaction_opaque_data ? toUint8Array(params.transaction_opaque_data) : undefined);
|
|
6087
6234
|
return {};
|
|
6088
6235
|
}
|
|
6089
6236
|
});
|
|
@@ -6092,7 +6239,7 @@ function registerCatalogViewMethods(protocol, getCatalog, signingKey) {
|
|
|
6092
6239
|
result: emptyResultSchema,
|
|
6093
6240
|
handler: async (params) => {
|
|
6094
6241
|
const cat = getCatalog();
|
|
6095
|
-
await cat.viewDrop(toUint8Array(params.attach_opaque_data), params.
|
|
6242
|
+
await cat.viewDrop(toUint8Array(params.attach_opaque_data), params.schema_path, params.name, params.ignore_not_found, params.transaction_opaque_data ? toUint8Array(params.transaction_opaque_data) : undefined);
|
|
6096
6243
|
return {};
|
|
6097
6244
|
}
|
|
6098
6245
|
});
|
|
@@ -6101,7 +6248,7 @@ function registerCatalogViewMethods(protocol, getCatalog, signingKey) {
|
|
|
6101
6248
|
result: emptyResultSchema,
|
|
6102
6249
|
handler: async (params) => {
|
|
6103
6250
|
const cat = getCatalog();
|
|
6104
|
-
await cat.viewRename(toUint8Array(params.attach_opaque_data), params.
|
|
6251
|
+
await cat.viewRename(toUint8Array(params.attach_opaque_data), params.schema_path, params.name, params.new_name, params.ignore_not_found, params.transaction_opaque_data ? toUint8Array(params.transaction_opaque_data) : undefined);
|
|
6105
6252
|
return {};
|
|
6106
6253
|
}
|
|
6107
6254
|
});
|
|
@@ -6110,7 +6257,7 @@ function registerCatalogViewMethods(protocol, getCatalog, signingKey) {
|
|
|
6110
6257
|
result: emptyResultSchema,
|
|
6111
6258
|
handler: async (params) => {
|
|
6112
6259
|
const cat = getCatalog();
|
|
6113
|
-
await cat.viewCommentSet(toUint8Array(params.attach_opaque_data), params.
|
|
6260
|
+
await cat.viewCommentSet(toUint8Array(params.attach_opaque_data), params.schema_path, params.name, params.comment, params.ignore_not_found, params.transaction_opaque_data ? toUint8Array(params.transaction_opaque_data) : undefined);
|
|
6114
6261
|
return {};
|
|
6115
6262
|
}
|
|
6116
6263
|
});
|
|
@@ -6123,7 +6270,7 @@ function registerCatalogMacroMethods(protocol, getCatalog, signingKey) {
|
|
|
6123
6270
|
result: RESULT_BINARY_SCHEMA,
|
|
6124
6271
|
handler: async (params) => {
|
|
6125
6272
|
const cat = getCatalog();
|
|
6126
|
-
const info = await cat.macroGet(toUint8Array(params.attach_opaque_data), params.
|
|
6273
|
+
const info = await cat.macroGet(toUint8Array(params.attach_opaque_data), params.schema_path, params.name, params.transaction_opaque_data ? toUint8Array(params.transaction_opaque_data) : undefined);
|
|
6127
6274
|
return wrapResult({
|
|
6128
6275
|
items: info ? [encodeMacroInfo(info)] : []
|
|
6129
6276
|
}, CatalogMacroGetResultSchema);
|
|
@@ -6135,7 +6282,7 @@ function registerCatalogMacroMethods(protocol, getCatalog, signingKey) {
|
|
|
6135
6282
|
handler: async (params) => {
|
|
6136
6283
|
const cat = getCatalog();
|
|
6137
6284
|
const innerParams = unwrapRequest(params.request);
|
|
6138
|
-
await cat.macroCreate(toUint8Array(innerParams.attach_opaque_data), innerParams.
|
|
6285
|
+
await cat.macroCreate(toUint8Array(innerParams.attach_opaque_data), innerParams.schema_path, innerParams.name, innerParams.macro_type, innerParams.parameters ? Array.isArray(innerParams.parameters) ? innerParams.parameters : [...innerParams.parameters] : [], innerParams.definition, innerParams.on_conflict, innerParams.parameter_default_values ? toUint8Array(innerParams.parameter_default_values) : null, innerParams.arguments_schema ? toUint8Array(innerParams.arguments_schema) : null, innerParams.transaction_opaque_data ? toUint8Array(innerParams.transaction_opaque_data) : undefined);
|
|
6139
6286
|
return {};
|
|
6140
6287
|
}
|
|
6141
6288
|
});
|
|
@@ -6144,7 +6291,7 @@ function registerCatalogMacroMethods(protocol, getCatalog, signingKey) {
|
|
|
6144
6291
|
result: emptyResultSchema,
|
|
6145
6292
|
handler: async (params) => {
|
|
6146
6293
|
const cat = getCatalog();
|
|
6147
|
-
await cat.macroDrop(toUint8Array(params.attach_opaque_data), params.
|
|
6294
|
+
await cat.macroDrop(toUint8Array(params.attach_opaque_data), params.schema_path, params.name, params.ignore_not_found, params.transaction_opaque_data ? toUint8Array(params.transaction_opaque_data) : undefined);
|
|
6148
6295
|
return {};
|
|
6149
6296
|
}
|
|
6150
6297
|
});
|
|
@@ -6153,7 +6300,7 @@ function registerCatalogMacroMethods(protocol, getCatalog, signingKey) {
|
|
|
6153
6300
|
result: RESULT_BINARY_SCHEMA,
|
|
6154
6301
|
handler: async (params) => {
|
|
6155
6302
|
const cat = getCatalog();
|
|
6156
|
-
const macros = await cat.schemaContentsMacros(toUint8Array(params.attach_opaque_data), params.
|
|
6303
|
+
const macros = await cat.schemaContentsMacros(toUint8Array(params.attach_opaque_data), params.path, decodeDictValue(params.type), params.transaction_opaque_data ? toUint8Array(params.transaction_opaque_data) : undefined);
|
|
6157
6304
|
return wrapResult({
|
|
6158
6305
|
items: macros.map((m) => encodeMacroInfo(m))
|
|
6159
6306
|
}, CatalogSchemaContentsMacrosResultSchema);
|
|
@@ -6168,7 +6315,7 @@ function registerCatalogIndexMethods(protocol, getCatalog, signingKey) {
|
|
|
6168
6315
|
result: RESULT_BINARY_SCHEMA,
|
|
6169
6316
|
handler: async (params) => {
|
|
6170
6317
|
const cat = getCatalog();
|
|
6171
|
-
const indexes = await cat.schemaContentsIndexes(toUint8Array(params.attach_opaque_data), params.
|
|
6318
|
+
const indexes = await cat.schemaContentsIndexes(toUint8Array(params.attach_opaque_data), params.path, params.transaction_opaque_data ? toUint8Array(params.transaction_opaque_data) : undefined);
|
|
6172
6319
|
return wrapResult({
|
|
6173
6320
|
items: indexes.map((i) => encodeIndexInfo(i))
|
|
6174
6321
|
}, CatalogSchemaContentsIndexesResultSchema);
|
|
@@ -6179,7 +6326,7 @@ function registerCatalogIndexMethods(protocol, getCatalog, signingKey) {
|
|
|
6179
6326
|
result: RESULT_BINARY_SCHEMA,
|
|
6180
6327
|
handler: async (params) => {
|
|
6181
6328
|
const cat = getCatalog();
|
|
6182
|
-
const info = await cat.indexGet(toUint8Array(params.attach_opaque_data), params.
|
|
6329
|
+
const info = await cat.indexGet(toUint8Array(params.attach_opaque_data), params.schema_path, params.name, params.transaction_opaque_data ? toUint8Array(params.transaction_opaque_data) : undefined);
|
|
6183
6330
|
return wrapResult({
|
|
6184
6331
|
items: info ? [encodeIndexInfo(info)] : []
|
|
6185
6332
|
}, CatalogIndexGetResultSchema);
|
|
@@ -6199,7 +6346,7 @@ function registerCatalogMethods(protocol, catalog, _catalogName, signingKey) {
|
|
|
6199
6346
|
|
|
6200
6347
|
// src/protocol/dispatch.ts
|
|
6201
6348
|
function buildVgiProtocol(config) {
|
|
6202
|
-
const protocol = new Protocol("vgi");
|
|
6349
|
+
const protocol = new Protocol("vgi", { protocolVersion: "2.0.0" });
|
|
6203
6350
|
registerFunctionMethods(protocol, {
|
|
6204
6351
|
registry: config.registry,
|
|
6205
6352
|
recoverExchangeState: config.recoverExchangeState,
|
|
@@ -6261,9 +6408,9 @@ function notModified(request, etag, extra) {
|
|
|
6261
6408
|
}
|
|
6262
6409
|
function createLandingRoutes(info) {
|
|
6263
6410
|
return (request, ctx) => {
|
|
6264
|
-
const
|
|
6411
|
+
const path = ctx.url.pathname;
|
|
6265
6412
|
const { prefix } = ctx;
|
|
6266
|
-
if (
|
|
6413
|
+
if (path === prefix || path === `${prefix}/`) {
|
|
6267
6414
|
const accept = request.headers.get("Accept") ?? "";
|
|
6268
6415
|
const wantJson = ctx.url.searchParams.get("format") === "json" || accept.includes("application/json") && !accept.includes("text/html");
|
|
6269
6416
|
if (wantJson) {
|
|
@@ -6278,9 +6425,9 @@ function createLandingRoutes(info) {
|
|
|
6278
6425
|
oauth: ctx.oauthActive,
|
|
6279
6426
|
cupola_base: info.cupolaBase ?? DEFAULT_CUPOLA_BASE
|
|
6280
6427
|
});
|
|
6281
|
-
const
|
|
6282
|
-
ctx.addCorsHeaders(
|
|
6283
|
-
return new Response(body, { status: 200, headers
|
|
6428
|
+
const headers = new Headers({ "Content-Type": "application/json" });
|
|
6429
|
+
ctx.addCorsHeaders(headers);
|
|
6430
|
+
return new Response(body, { status: 200, headers });
|
|
6284
6431
|
}
|
|
6285
6432
|
landingEtag ??= etagFor(LANDING_HTML_BYTES);
|
|
6286
6433
|
const conditional = notModified(request, landingEtag);
|
|
@@ -6296,7 +6443,7 @@ function createLandingRoutes(info) {
|
|
|
6296
6443
|
ctx.addCorsHeaders(headers);
|
|
6297
6444
|
return new Response(LANDING_HTML_BYTES, { status: 200, headers });
|
|
6298
6445
|
}
|
|
6299
|
-
if (
|
|
6446
|
+
if (path === `${prefix}/vgi-client.js`) {
|
|
6300
6447
|
bundleEtag ??= etagFor(CLIENT_BUNDLE_BYTES);
|
|
6301
6448
|
const conditional = notModified(request, bundleEtag);
|
|
6302
6449
|
if (conditional) {
|
|
@@ -6322,10 +6469,10 @@ function ensureRequestAuthStorage() {
|
|
|
6322
6469
|
if (requestAuthStorage !== undefined)
|
|
6323
6470
|
return Promise.resolve(requestAuthStorage);
|
|
6324
6471
|
requestAuthStoragePending ??= import("async_hooks").then((mod) => {
|
|
6325
|
-
const
|
|
6326
|
-
requestAuthStorage =
|
|
6327
|
-
setRequestAuthScope(
|
|
6328
|
-
return
|
|
6472
|
+
const storage = new mod.AsyncLocalStorage;
|
|
6473
|
+
requestAuthStorage = storage;
|
|
6474
|
+
setRequestAuthScope(storage);
|
|
6475
|
+
return storage;
|
|
6329
6476
|
}).catch(() => {
|
|
6330
6477
|
requestAuthStorage = null;
|
|
6331
6478
|
return null;
|
|
@@ -6366,16 +6513,19 @@ function createVgiFetch(opts) {
|
|
|
6366
6513
|
stateSerializer: arrowStateSerializer,
|
|
6367
6514
|
dispatchHook: REQUEST_AUTH_DISPATCH_HOOK,
|
|
6368
6515
|
authenticate: opts.authenticate,
|
|
6516
|
+
peerIdentityProviders: opts.peerIdentityProviders,
|
|
6517
|
+
peerAuthenticationPolicy: opts.peerAuthenticationPolicy,
|
|
6518
|
+
peerResolutionContext: opts.peerResolutionContext,
|
|
6369
6519
|
corsOrigins: opts.corsOrigins === null ? undefined : opts.corsOrigins ?? "*",
|
|
6370
6520
|
repositoryUrl: opts.repositoryUrl,
|
|
6371
6521
|
extraRoutes: createLandingRoutes(opts.landingInfo),
|
|
6372
6522
|
enableLandingPage: false
|
|
6373
6523
|
});
|
|
6374
6524
|
return async (req) => {
|
|
6375
|
-
const
|
|
6376
|
-
if (!
|
|
6525
|
+
const storage = await ensureRequestAuthStorage();
|
|
6526
|
+
if (!storage)
|
|
6377
6527
|
return handler(req);
|
|
6378
|
-
return
|
|
6528
|
+
return storage.run({}, () => handler(req));
|
|
6379
6529
|
};
|
|
6380
6530
|
}
|
|
6381
6531
|
|
|
@@ -6383,8 +6533,8 @@ function createVgiFetch(opts) {
|
|
|
6383
6533
|
var DEFAULT_PORT = 8787;
|
|
6384
6534
|
var DEFAULT_TOKEN_TTL = 3600;
|
|
6385
6535
|
var SIGNING_KEY_BYTES = 32;
|
|
6386
|
-
function parseSigningKeyHex(
|
|
6387
|
-
const cleaned =
|
|
6536
|
+
function parseSigningKeyHex(hex) {
|
|
6537
|
+
const cleaned = hex.trim();
|
|
6388
6538
|
const expected = SIGNING_KEY_BYTES * 2;
|
|
6389
6539
|
if (cleaned.length !== expected || !/^[0-9a-fA-F]+$/.test(cleaned)) {
|
|
6390
6540
|
throw new Error(`VGI_SIGNING_KEY must be exactly ${expected} hex characters ` + `(${SIGNING_KEY_BYTES} bytes); got ${cleaned.length}. ` + `Generate one with: openssl rand -hex ${SIGNING_KEY_BYTES}`);
|
|
@@ -6440,6 +6590,11 @@ function createVgiWorkerFetch(opts) {
|
|
|
6440
6590
|
const signingKey = resolveSigningKey(opts.signingKey, env);
|
|
6441
6591
|
const tokenTtl = resolveTokenTtl(opts.tokenTtl, env);
|
|
6442
6592
|
const corsOrigins = opts.corsOrigins === null ? null : opts.corsOrigins ?? env.CORS_ORIGINS;
|
|
6593
|
+
const bridge = opts.irohBridge;
|
|
6594
|
+
if (bridge && !bridge.peerResolutionContext) {
|
|
6595
|
+
throw new Error("irohBridge requires a peerResolutionContext when createVgiWorkerFetch is used without serveVgiWorker");
|
|
6596
|
+
}
|
|
6597
|
+
const trustedProxyAddresses = bridge?.trustedProxyAddresses ?? ["127.0.0.1"];
|
|
6443
6598
|
return createVgiFetch({
|
|
6444
6599
|
protocol: { registry: opts.registry, catalogInterface: opts.catalogInterface },
|
|
6445
6600
|
signingKey,
|
|
@@ -6449,7 +6604,10 @@ function createVgiWorkerFetch(opts) {
|
|
|
6449
6604
|
corsOrigins,
|
|
6450
6605
|
repositoryUrl: opts.repositoryUrl,
|
|
6451
6606
|
landingInfo: { name: opts.name, doc: opts.doc, version: opts.version },
|
|
6452
|
-
authenticate: opts.authenticate
|
|
6607
|
+
authenticate: opts.authenticate,
|
|
6608
|
+
peerIdentityProviders: bridge ? [irohForwardedHeaderIdentityProvider({ issuer: bridge.issuer, trustedProxyAddresses })] : undefined,
|
|
6609
|
+
peerAuthenticationPolicy: bridge ? bridge.authenticate === false ? observePeerIdentity : peerIdentityPrimary("iroh") : undefined,
|
|
6610
|
+
peerResolutionContext: bridge?.peerResolutionContext
|
|
6453
6611
|
});
|
|
6454
6612
|
}
|
|
6455
6613
|
function serveVgiWorker(opts) {
|
|
@@ -6459,8 +6617,24 @@ function serveVgiWorker(opts) {
|
|
|
6459
6617
|
}
|
|
6460
6618
|
const env = opts.env ?? process.env;
|
|
6461
6619
|
const port = resolvePort(opts.port, env);
|
|
6462
|
-
const
|
|
6463
|
-
|
|
6620
|
+
const hostname = opts.hostname ?? (opts.irohBridge ? "127.0.0.1" : undefined);
|
|
6621
|
+
if (opts.irohBridge && !["127.0.0.1", "::1", "localhost"].includes(hostname ?? "")) {
|
|
6622
|
+
throw new Error("an Iroh HTTP bridge upstream must bind loopback");
|
|
6623
|
+
}
|
|
6624
|
+
let server;
|
|
6625
|
+
const bridge = opts.irohBridge && !opts.irohBridge.peerResolutionContext ? {
|
|
6626
|
+
...opts.irohBridge,
|
|
6627
|
+
peerResolutionContext(request) {
|
|
6628
|
+
const immediatePeer = server.requestIP?.(request)?.address;
|
|
6629
|
+
const forwarded = request.headers.get(IROH_FORWARDED_ENDPOINT_HEADER);
|
|
6630
|
+
return {
|
|
6631
|
+
immediatePeer,
|
|
6632
|
+
headers: forwarded === null ? {} : { [IROH_FORWARDED_ENDPOINT_HEADER]: [forwarded] }
|
|
6633
|
+
};
|
|
6634
|
+
}
|
|
6635
|
+
} : opts.irohBridge;
|
|
6636
|
+
const fetch2 = createVgiWorkerFetch({ ...opts, irohBridge: bridge });
|
|
6637
|
+
server = runtime.serve({ port, hostname, fetch: fetch2 });
|
|
6464
6638
|
if (!opts.quiet) {
|
|
6465
6639
|
const base = `http://localhost:${server.port}`;
|
|
6466
6640
|
console.log(`${opts.name} VGI HTTP worker listening on ${base}`);
|
|
@@ -6481,4 +6655,4 @@ export {
|
|
|
6481
6655
|
serveVgiWorker
|
|
6482
6656
|
};
|
|
6483
6657
|
|
|
6484
|
-
//# debugId=
|
|
6658
|
+
//# debugId=3C4394ABF730E98C64756E2164756E21
|