@query-farm/vgi 0.48.0 → 0.48.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/dist/arguments/argument-spec.d.ts +17 -11
- package/dist/catalog/descriptors.d.ts +2 -2
- package/dist/catalog/publication.d.ts +7 -7
- package/dist/client/client.d.ts +9 -3
- package/dist/client/errors.d.ts +2 -2
- package/dist/client/types.d.ts +21 -0
- package/dist/client-entry.d.ts +1 -1
- package/dist/client-entry.js +31 -7
- package/dist/client-entry.js.map +20 -20
- package/dist/filter-pushdown/deserialize.d.ts +1 -1
- package/dist/filter-pushdown/types.d.ts +10 -10
- package/dist/functions/scalar.d.ts +1 -1
- package/dist/functions/table-buffering.d.ts +20 -20
- package/dist/functions/table-in-out.d.ts +4 -4
- package/dist/functions/table.d.ts +7 -7
- package/dist/functions/types.d.ts +47 -47
- package/dist/http/fetch.d.ts +10 -10
- package/dist/index.core.d.ts +1 -1
- package/dist/index.js +155 -94
- package/dist/index.js.map +53 -52
- package/dist/protocol/dispatch.d.ts +3 -3
- package/dist/protocol/handlers/function.d.ts +2 -2
- package/dist/protocol/serializers/cardinality.d.ts +4 -1
- package/dist/protocol/types.d.ts +5 -5
- package/dist/rpc-server.d.ts +6 -6
- package/dist/serve-entry.d.ts +16 -16
- package/dist/serve-entry.js +42 -21
- package/dist/serve-entry.js.map +38 -37
- package/dist/split-token.d.ts +6 -6
- package/dist/types.d.ts +9 -2
- package/dist/util/defined.d.ts +21 -0
- package/dist/worker-cf-entry.js +120 -85
- package/dist/worker-cf-entry.js.map +51 -50
- package/dist/worker.d.ts +2 -2
- package/package.json +6 -4
- package/src/arguments/argument-spec.ts +17 -11
- package/src/arrow/codec/registry.ts +2 -2
- package/src/arrow/impl-arrowjs/build.ts +1 -1
- package/src/arrow/impl-arrowjs/canonical.ts +23 -23
- package/src/arrow/impl-arrowjs/empty.ts +2 -2
- package/src/arrow/impl-arrowjs/ipc.ts +2 -2
- package/src/arrow/impl-arrowjs/iterate.ts +2 -2
- package/src/arrow/impl-arrowjs/project.ts +2 -2
- package/src/arrow/impl-flechette/build.ts +2 -1
- package/src/arrow/impl-flechette/canonical.ts +10 -9
- package/src/arrow/impl-flechette/compat.ts +3 -3
- package/src/arrow/impl-flechette/message-meta.ts +5 -4
- package/src/arrow/impl-flechette/statistics.ts +2 -2
- package/src/attach-ticket.ts +2 -2
- package/src/catalog/column-metadata.ts +1 -1
- package/src/catalog/composite.ts +2 -2
- package/src/catalog/constraints.ts +9 -9
- package/src/catalog/descriptors.ts +1 -1
- package/src/catalog/interface.ts +12 -12
- package/src/catalog/publication.ts +9 -8
- package/src/catalog/read-only.ts +9 -8
- package/src/catalog/sql-grammar.ts +6 -6
- package/src/client/client.ts +52 -15
- package/src/client/errors.ts +1 -1
- package/src/client/types.ts +23 -0
- package/src/client-entry.ts +2 -0
- package/src/codec/asd.ts +3 -3
- package/src/codec/conform.ts +3 -3
- package/src/filter-pushdown/collector.ts +1 -1
- package/src/filter-pushdown/deserialize.ts +13 -10
- package/src/filter-pushdown/evaluate.ts +3 -2
- package/src/filter-pushdown/history.ts +3 -2
- package/src/filter-pushdown/types.ts +10 -10
- package/src/functions/continuation.ts +1 -1
- package/src/functions/projection.ts +1 -1
- package/src/functions/registry.ts +14 -14
- package/src/functions/scalar.ts +3 -3
- package/src/functions/storage-cf-do.ts +2 -2
- package/src/functions/table-buffering.ts +25 -21
- package/src/functions/table-in-out.ts +8 -8
- package/src/functions/table.ts +27 -25
- package/src/functions/types.ts +47 -47
- package/src/generated/vgi-service.ts +5 -3
- package/src/http/fetch.ts +17 -12
- package/src/index.core.ts +2 -0
- package/src/protocol/carried-init-request.ts +1 -1
- package/src/protocol/dispatch.ts +3 -3
- package/src/protocol/handlers/aggregate.ts +8 -7
- package/src/protocol/handlers/catalog/shared.ts +1 -1
- package/src/protocol/handlers/function.ts +2 -2
- package/src/protocol/serializers/cardinality.ts +16 -3
- package/src/protocol/state-serializer.ts +1 -1
- package/src/protocol/types.ts +5 -5
- package/src/rpc-server.ts +13 -12
- package/src/serve-entry.ts +18 -18
- package/src/split-token.ts +10 -9
- package/src/types.ts +9 -2
- package/src/util/defined.ts +30 -0
- package/src/util/parent-rows.ts +2 -2
- package/src/worker.ts +15 -14
|
@@ -3,11 +3,11 @@ export interface ArgumentSpec {
|
|
|
3
3
|
name: string;
|
|
4
4
|
position: number | string;
|
|
5
5
|
arrowType: VgiDataType;
|
|
6
|
-
isTableInput?: boolean;
|
|
7
|
-
isAnyType?: boolean;
|
|
8
|
-
isVarargs?: boolean;
|
|
9
|
-
isConst?: boolean;
|
|
10
|
-
doc?: string;
|
|
6
|
+
isTableInput?: boolean | undefined;
|
|
7
|
+
isAnyType?: boolean | undefined;
|
|
8
|
+
isVarargs?: boolean | undefined;
|
|
9
|
+
isConst?: boolean | undefined;
|
|
10
|
+
doc?: string | undefined;
|
|
11
11
|
/**
|
|
12
12
|
* Discovery-facing constraint metadata, pre-encoded to their surfaced UTF-8
|
|
13
13
|
* forms (presence-only — `undefined` means the constraint is absent and the
|
|
@@ -15,10 +15,10 @@ export interface ArgumentSpec {
|
|
|
15
15
|
* `ArgumentSpec.default_json` / `choices_json` / `range_notation` / `pattern`
|
|
16
16
|
* so `argumentSpecsToSchema`/`schemaToArgumentSpecs` round-trip symmetrically.
|
|
17
17
|
*/
|
|
18
|
-
defaultJson?: string;
|
|
19
|
-
choicesJson?: string;
|
|
20
|
-
rangeNotation?: string;
|
|
21
|
-
pattern?: string;
|
|
18
|
+
defaultJson?: string | undefined;
|
|
19
|
+
choicesJson?: string | undefined;
|
|
20
|
+
rangeNotation?: string | undefined;
|
|
21
|
+
pattern?: string | undefined;
|
|
22
22
|
}
|
|
23
23
|
/**
|
|
24
24
|
* Raw per-argument constraint declarations, as authored on a function's
|
|
@@ -36,7 +36,11 @@ export interface ArgumentConstraints {
|
|
|
36
36
|
gt?: number;
|
|
37
37
|
/** Exclusive upper bound (`<`). */
|
|
38
38
|
lt?: number;
|
|
39
|
-
/**
|
|
39
|
+
/**
|
|
40
|
+
* Regex the value must match (surfaced as `vgi_pattern`, as-is). Matching is
|
|
41
|
+
* an UNANCHORED search (JSON Schema / ECMA-262 semantics, same across SDKs):
|
|
42
|
+
* `"\\d"` accepts `"ab1"`. Anchor with `^...$` to require a full match.
|
|
43
|
+
*/
|
|
40
44
|
pattern?: string;
|
|
41
45
|
/** Default value (JSON-encoded into `vgi_default`); optional args only. */
|
|
42
46
|
default?: unknown;
|
|
@@ -117,7 +121,9 @@ export declare function assertArrowTypes(types: Record<string, unknown> | undefi
|
|
|
117
121
|
* Enforce a bind-time const value against its declared {@link ArgumentConstraints},
|
|
118
122
|
* throwing {@link ArgumentValidationError} on violation. Mirrors the Python SDK's
|
|
119
123
|
* `Arg._validate`: numeric range (`ge`/`le`/`gt`/`lt`), closed choice set, and
|
|
120
|
-
* regex `pattern
|
|
124
|
+
* regex `pattern` (an unanchored search — `RegExp.prototype.test`, matching the
|
|
125
|
+
* JSON Schema `pattern` keyword). A `null`/`undefined` value skips its value
|
|
126
|
+
* constraints.
|
|
121
127
|
*/
|
|
122
128
|
export declare function validateConstConstraints(name: string, constraints: ArgumentConstraints, value: unknown): void;
|
|
123
129
|
/**
|
|
@@ -85,8 +85,8 @@ export interface TableDescriptor {
|
|
|
85
85
|
* tables; static-column tables don't have a function to call.
|
|
86
86
|
*/
|
|
87
87
|
inlinedCardinality?: {
|
|
88
|
-
estimate: bigint;
|
|
89
|
-
max: bigint;
|
|
88
|
+
estimate: number | bigint;
|
|
89
|
+
max: number | bigint;
|
|
90
90
|
};
|
|
91
91
|
comment?: string;
|
|
92
92
|
tags?: Record<string, string>;
|
|
@@ -11,7 +11,7 @@ export interface SnapshotIdentity {
|
|
|
11
11
|
export interface SnapshotRequest {
|
|
12
12
|
catalog: CatalogInterface;
|
|
13
13
|
attachOpaqueData: AttachOpaqueData;
|
|
14
|
-
callContext?: CallContext;
|
|
14
|
+
callContext?: CallContext | undefined;
|
|
15
15
|
catalogVersion: number;
|
|
16
16
|
}
|
|
17
17
|
export interface CatalogPublicationManifest {
|
|
@@ -29,9 +29,9 @@ export interface CatalogPublicationManifest {
|
|
|
29
29
|
rawSize: number;
|
|
30
30
|
storedSize: number;
|
|
31
31
|
url: string;
|
|
32
|
-
objectId?: string;
|
|
33
|
-
expiresAt?: number;
|
|
34
|
-
retainUntil?: number;
|
|
32
|
+
objectId?: string | undefined;
|
|
33
|
+
expiresAt?: number | undefined;
|
|
34
|
+
retainUntil?: number | undefined;
|
|
35
35
|
stable: boolean;
|
|
36
36
|
validated: true;
|
|
37
37
|
}
|
|
@@ -87,9 +87,9 @@ export declare class MemoryCatalogPublicationRepository implements CatalogPublic
|
|
|
87
87
|
rawSize: number;
|
|
88
88
|
storedSize: number;
|
|
89
89
|
url: string;
|
|
90
|
-
objectId?: string;
|
|
91
|
-
expiresAt?: number;
|
|
92
|
-
retainUntil?: number;
|
|
90
|
+
objectId?: string | undefined;
|
|
91
|
+
expiresAt?: number | undefined;
|
|
92
|
+
retainUntil?: number | undefined;
|
|
93
93
|
stable: boolean;
|
|
94
94
|
validated: true;
|
|
95
95
|
}>>;
|
package/dist/client/client.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import type { RpcClient, StreamSession } from "@query-farm/vgi-rpc";
|
|
|
3
3
|
import { type SchemaInfo, type TableInfo, type ViewInfo, type FunctionInfo, type MacroInfo, type MacroType, type CatalogAttachResult, type SchemaContentsInfo, type IndexInfo, type AttachOpaqueData, type TransactionOpaqueData, type CatalogInfo, type ScanFunctionResult } from "../catalog/interface.js";
|
|
4
4
|
import { VgiClientError } from "./errors.js";
|
|
5
5
|
export { VgiClientError };
|
|
6
|
-
import type { VgiClientOptions, TableFunctionOptions, ScalarFunctionOptions, TableInOutFunctionOptions, OnCreateConflict, CatalogFunctionType, CatalogMacroType, CatalogAttachOptions, AttachOptionValue, CatalogSnapshot, LoadCatalogOptions } from "./types.js";
|
|
6
|
+
import type { VgiClientOptions, TableFunctionOptions, TableFunctionRowsOptions, ScalarFunctionOptions, TableInOutFunctionOptions, OnCreateConflict, CatalogFunctionType, CatalogMacroType, CatalogAttachOptions, AttachOptionValue, CatalogSnapshot, LoadCatalogOptions } from "./types.js";
|
|
7
7
|
/**
|
|
8
8
|
* Send one input batch on a table-in-out exchange and yield the rows of every
|
|
9
9
|
* reply it gets (continued output, docs/table_in_out.md "Continued Output").
|
|
@@ -75,8 +75,14 @@ export declare class VgiClient {
|
|
|
75
75
|
tableInOutFunctionRows(opts: TableInOutFunctionOptions): AsyncGenerator<Record<string, any>[]>;
|
|
76
76
|
/** Call a table-in-out function, yielding output as RecordBatch instances. */
|
|
77
77
|
tableInOutFunction(opts: TableInOutFunctionOptions): AsyncGenerator<VgiBatch>;
|
|
78
|
-
/**
|
|
79
|
-
|
|
78
|
+
/**
|
|
79
|
+
* Call a table function, yielding output as row objects.
|
|
80
|
+
*
|
|
81
|
+
* int64/uint64 columns follow `opts.int64` (see {@link Int64Mode}); pass
|
|
82
|
+
* `int64: "bigint"` to get a `bigint` for every value instead of a
|
|
83
|
+
* magnitude-dependent mix of `number` and `bigint`.
|
|
84
|
+
*/
|
|
85
|
+
tableFunctionRows(opts: TableFunctionRowsOptions): AsyncGenerator<Record<string, any>[]>;
|
|
80
86
|
/**
|
|
81
87
|
* List all catalogs with their advertised version metadata.
|
|
82
88
|
*
|
package/dist/client/errors.d.ts
CHANGED
|
@@ -7,8 +7,8 @@ export declare class VgiClientError extends Error {
|
|
|
7
7
|
/** Underlying error type from the worker (e.g. "ValueError"), when known. */
|
|
8
8
|
readonly errorType?: string;
|
|
9
9
|
constructor(message: string, options?: {
|
|
10
|
-
remoteTraceback?: string;
|
|
11
|
-
errorType?: string;
|
|
10
|
+
remoteTraceback?: string | undefined;
|
|
11
|
+
errorType?: string | undefined;
|
|
12
12
|
cause?: unknown;
|
|
13
13
|
});
|
|
14
14
|
/**
|
package/dist/client/types.d.ts
CHANGED
|
@@ -84,6 +84,27 @@ export interface TableFunctionOptions {
|
|
|
84
84
|
/** Invoked after bind, before init. Receives the bind response. */
|
|
85
85
|
onBind?: BindResultCallback;
|
|
86
86
|
}
|
|
87
|
+
/**
|
|
88
|
+
* How {@link VgiClient.tableFunctionRows} surfaces int64/uint64 column
|
|
89
|
+
* values. Same vocabulary as `@query-farm/vgi-rpc`'s client `int64` option.
|
|
90
|
+
*
|
|
91
|
+
* - `"number-if-safe"`: values within `Number.MAX_SAFE_INTEGER` become
|
|
92
|
+
* `number`, larger ones stay `bigint` (one column can hold both).
|
|
93
|
+
* - `"bigint"`: every value stays a `bigint` — one JS type per column.
|
|
94
|
+
*/
|
|
95
|
+
export type Int64Mode = "number-if-safe" | "bigint";
|
|
96
|
+
/** Options for {@link VgiClient.tableFunctionRows}. */
|
|
97
|
+
export interface TableFunctionRowsOptions extends TableFunctionOptions {
|
|
98
|
+
/**
|
|
99
|
+
* Surfacing of top-level int64/uint64 output columns (see {@link Int64Mode}).
|
|
100
|
+
* When omitted, rows are returned as the underlying `RpcClient` produced
|
|
101
|
+
* them — `"number-if-safe"` unless that client was created with
|
|
102
|
+
* `int64: "bigint"` (`@query-farm/vgi-rpc` >= 0.29.6). Setting it here
|
|
103
|
+
* overrides the client either way. The omitted-default may become
|
|
104
|
+
* `"bigint"` in a future minor release; pass it explicitly to pin it.
|
|
105
|
+
*/
|
|
106
|
+
int64?: Int64Mode;
|
|
107
|
+
}
|
|
87
108
|
/** Options for calling a scalar function. */
|
|
88
109
|
export interface ScalarFunctionOptions {
|
|
89
110
|
/** Name of the function to call. */
|
package/dist/client-entry.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { VgiClient, VgiClientError } from "./client/client.js";
|
|
2
|
-
export type { VgiClientOptions, TableFunctionOptions, ScalarFunctionOptions, TableInOutFunctionOptions, OnCreateConflict, CatalogFunctionType, } from "./client/types.js";
|
|
2
|
+
export type { VgiClientOptions, TableFunctionOptions, TableFunctionRowsOptions, Int64Mode, ScalarFunctionOptions, TableInOutFunctionOptions, OnCreateConflict, CatalogFunctionType, } from "./client/types.js";
|
|
3
3
|
export { Arguments } from "./arguments/arguments.js";
|
|
4
4
|
export { type ArgumentSpec, argumentSpecsToSchema, schemaToArgumentSpecs, } from "./arguments/argument-spec.js";
|
|
5
5
|
export { FunctionType, FunctionStability, NullHandling, ArgumentMonotonicity, OrderPreservation, OrderDependence, DistinctDependence, TableInOutPhase, } from "./types.js";
|
package/dist/client-entry.js
CHANGED
|
@@ -5703,6 +5703,26 @@ function toAsyncIterator(input) {
|
|
|
5703
5703
|
}
|
|
5704
5704
|
|
|
5705
5705
|
// src/client/client.ts
|
|
5706
|
+
function int64ColumnNames(s) {
|
|
5707
|
+
if (!s)
|
|
5708
|
+
return [];
|
|
5709
|
+
return s.fields.filter((f) => isInt(f.type) && f.type.bitWidth === 64).map((f) => f.name);
|
|
5710
|
+
}
|
|
5711
|
+
var MIN_SAFE_BIGINT = BigInt(Number.MIN_SAFE_INTEGER);
|
|
5712
|
+
var MAX_SAFE_BIGINT = BigInt(Number.MAX_SAFE_INTEGER);
|
|
5713
|
+
function applyInt64Mode(rows, columns, mode) {
|
|
5714
|
+
for (const row of rows) {
|
|
5715
|
+
for (const name of columns) {
|
|
5716
|
+
const v = row[name];
|
|
5717
|
+
if (mode === "bigint") {
|
|
5718
|
+
if (typeof v === "number" && Number.isInteger(v))
|
|
5719
|
+
row[name] = BigInt(v);
|
|
5720
|
+
} else if (typeof v === "bigint" && v >= MIN_SAFE_BIGINT && v <= MAX_SAFE_BIGINT) {
|
|
5721
|
+
row[name] = Number(v);
|
|
5722
|
+
}
|
|
5723
|
+
}
|
|
5724
|
+
}
|
|
5725
|
+
}
|
|
5706
5726
|
function onConflictName(onConflict) {
|
|
5707
5727
|
return String(onConflict).toUpperCase();
|
|
5708
5728
|
}
|
|
@@ -5994,10 +6014,14 @@ class VgiClient {
|
|
|
5994
6014
|
tablesample: opts.tablesample,
|
|
5995
6015
|
joinKeys: opts.joinKeys
|
|
5996
6016
|
});
|
|
6017
|
+
const int64Columns = opts.int64 === undefined ? [] : int64ColumnNames(bindResp.output_schema);
|
|
5997
6018
|
try {
|
|
5998
6019
|
for await (const rows of session) {
|
|
5999
|
-
if (rows.length
|
|
6000
|
-
|
|
6020
|
+
if (rows.length === 0)
|
|
6021
|
+
continue;
|
|
6022
|
+
if (int64Columns.length > 0)
|
|
6023
|
+
applyInt64Mode(rows, int64Columns, opts.int64);
|
|
6024
|
+
yield rows;
|
|
6001
6025
|
}
|
|
6002
6026
|
} finally {
|
|
6003
6027
|
session.close();
|
|
@@ -6239,7 +6263,7 @@ class VgiClient {
|
|
|
6239
6263
|
return null;
|
|
6240
6264
|
const inner = unwrapResult(result);
|
|
6241
6265
|
const items = deserializeInfoList(inner.items, decodeSchemaInfo);
|
|
6242
|
-
return items
|
|
6266
|
+
return items[0] ?? null;
|
|
6243
6267
|
}
|
|
6244
6268
|
async schemaCreate(attachOpaqueData, path, opts) {
|
|
6245
6269
|
const tagsMap = opts?.tags ? new Map(Object.entries(opts.tags)) : null;
|
|
@@ -6317,7 +6341,7 @@ class VgiClient {
|
|
|
6317
6341
|
return null;
|
|
6318
6342
|
const inner = unwrapResult(result);
|
|
6319
6343
|
const items = deserializeInfoList(inner.items, decodeTableInfo);
|
|
6320
|
-
return items
|
|
6344
|
+
return items[0] ?? null;
|
|
6321
6345
|
}
|
|
6322
6346
|
async tableCreate(attachOpaqueData, schemaPath, name, columns, onConflict, constraintDefinitions = [], transactionOpaqueData) {
|
|
6323
6347
|
await this.rpc.call("catalog_table_create", {
|
|
@@ -6485,7 +6509,7 @@ class VgiClient {
|
|
|
6485
6509
|
return null;
|
|
6486
6510
|
const inner = unwrapResult(result);
|
|
6487
6511
|
const items = deserializeInfoList(inner.items, decodeViewInfo);
|
|
6488
|
-
return items
|
|
6512
|
+
return items[0] ?? null;
|
|
6489
6513
|
}
|
|
6490
6514
|
async viewCreate(attachOpaqueData, schemaPath, name, definition, onConflict, transactionOpaqueData, aliases, security = "regular", comment, tags, columnComments) {
|
|
6491
6515
|
await this.rpc.call("catalog_view_create", {
|
|
@@ -6554,7 +6578,7 @@ class VgiClient {
|
|
|
6554
6578
|
return null;
|
|
6555
6579
|
const inner = unwrapResult(result);
|
|
6556
6580
|
const items = deserializeInfoList(inner.items, decodeMacroInfo);
|
|
6557
|
-
return items
|
|
6581
|
+
return items[0] ?? null;
|
|
6558
6582
|
}
|
|
6559
6583
|
async schemaContentsMacros(attachOpaqueData, path, type, transactionOpaqueData) {
|
|
6560
6584
|
const result = await this.rpc.call("catalog_schema_contents_macros", {
|
|
@@ -6849,4 +6873,4 @@ export {
|
|
|
6849
6873
|
validateTableConstraints
|
|
6850
6874
|
};
|
|
6851
6875
|
|
|
6852
|
-
//# debugId=
|
|
6876
|
+
//# debugId=F1A002FFA544727064756E2164756E21
|