@query-farm/vgi 0.42.0 → 0.44.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -2
- package/dist/attach-ticket.d.ts +18 -7
- package/dist/client-entry.js +215 -91
- package/dist/client-entry.js.map +10 -9
- package/dist/codec/asd.d.ts +3 -1
- package/dist/codec/conform.d.ts +51 -0
- package/dist/errors.d.ts +5 -1
- package/dist/generated/vgi-service.d.ts +1315 -0
- package/dist/index.core.d.ts +1 -1
- package/dist/index.js +2143 -932
- package/dist/index.js.map +29 -28
- package/dist/protocol/dispatch.d.ts +14 -5
- package/dist/protocol/handlers/aggregate.d.ts +3 -2
- package/dist/protocol/handlers/catalog/admin.d.ts +2 -2
- package/dist/protocol/handlers/catalog/index.d.ts +3 -2
- package/dist/protocol/handlers/catalog/index_methods.d.ts +2 -2
- package/dist/protocol/handlers/catalog/macro.d.ts +2 -2
- package/dist/protocol/handlers/catalog/shared.d.ts +7 -14
- package/dist/protocol/handlers/catalog/table.d.ts +2 -2
- package/dist/protocol/handlers/catalog/view.d.ts +2 -2
- package/dist/protocol/handlers/function.d.ts +3 -2
- package/dist/protocol/handlers/shared.d.ts +2 -2
- package/dist/protocol/handlers/table-buffering.d.ts +3 -2
- package/dist/protocol/handlers/unimplemented.d.ts +4 -17
- package/dist/protocol/serializers/shared.d.ts +2 -1
- package/dist/rpc-server.d.ts +2 -2
- package/dist/serve-entry.js +2104 -903
- package/dist/serve-entry.js.map +25 -24
- package/dist/worker-cf-entry.js +2045 -842
- package/dist/worker-cf-entry.js.map +29 -28
- package/package.json +3 -3
- package/src/attach-ticket.ts +41 -13
- package/src/catalog/composite.ts +2 -1
- package/src/catalog/interface.ts +5 -4
- package/src/catalog/read-only.ts +8 -6
- package/src/client/client.ts +13 -5
- package/src/codec/asd.ts +5 -2
- package/src/codec/conform.ts +193 -0
- package/src/errors.ts +27 -7
- package/src/functions/registry.ts +3 -2
- package/src/generated/vgi-service.ts +2678 -0
- package/src/http/fetch.ts +1 -1
- package/src/index.core.ts +3 -1
- package/src/protocol/dispatch.ts +40 -29
- package/src/protocol/handlers/aggregate.ts +205 -232
- package/src/protocol/handlers/catalog/admin.ts +228 -299
- package/src/protocol/handlers/catalog/index.ts +17 -16
- package/src/protocol/handlers/catalog/index_methods.ts +26 -36
- package/src/protocol/handlers/catalog/macro.ts +54 -77
- package/src/protocol/handlers/catalog/shared.ts +30 -47
- package/src/protocol/handlers/catalog/table.ts +205 -270
- package/src/protocol/handlers/catalog/view.ts +59 -85
- package/src/protocol/handlers/function.ts +127 -156
- package/src/protocol/handlers/shared.ts +8 -6
- package/src/protocol/handlers/table-buffering.ts +53 -71
- package/src/protocol/handlers/unimplemented.ts +18 -62
- package/src/protocol/serializers/bind.ts +3 -1
- package/src/protocol/serializers/shared.ts +5 -2
- package/src/rpc-server.ts +7 -7
package/dist/codec/asd.d.ts
CHANGED
|
@@ -15,7 +15,9 @@
|
|
|
15
15
|
import { type VgiSchema } from "../arrow/index.js";
|
|
16
16
|
/**
|
|
17
17
|
* Encode a typed object as a single-row Arrow IPC stream using `schema`.
|
|
18
|
-
* Matches Python's `ArrowSerializableDataclass.serialize_to_bytes()
|
|
18
|
+
* Matches Python's `ArrowSerializableDataclass.serialize_to_bytes()`, including
|
|
19
|
+
* its container rules: a non-nullable list/map left out or null is written as
|
|
20
|
+
* empty, and list items / map values are never null (see `conformRecord`).
|
|
19
21
|
*/
|
|
20
22
|
export declare function encodeASD(schema: VgiSchema, obj: Record<string, any>): Uint8Array;
|
|
21
23
|
/** Compare two strings by Unicode code point (= UTF-8 byte order). */
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Wire conformance for protocol records.
|
|
3
|
+
*
|
|
4
|
+
* vgi-python is the reference for the wire shape, and two of its rules are not
|
|
5
|
+
* expressed by a record's Arrow schema nullability flags alone:
|
|
6
|
+
*
|
|
7
|
+
* 1. A **non-nullable list or map column is never null.** Python's dataclass
|
|
8
|
+
* defaults a `list[...]` / `dict[...]` field to an empty container, so an
|
|
9
|
+
* "absent" list goes out as `[]`. A JS caller that leaves the field out (or
|
|
10
|
+
* passes `null`) would otherwise put a null in a column the schema calls
|
|
11
|
+
* non-null — `CatalogInfo.releases`, `CatalogInfo.attach_option_specs`,
|
|
12
|
+
* ... — which a strict client rejects as a protocol error.
|
|
13
|
+
*
|
|
14
|
+
* 2. **List items and map values are never null** unless the Python annotation
|
|
15
|
+
* says so (`list[str | None]`). pyarrow marks every list item field nullable,
|
|
16
|
+
* so the generated schemas carry `item: nullable=true` everywhere and cannot
|
|
17
|
+
* tell the two apart. In the whole protocol exactly one field has optional
|
|
18
|
+
* items — `argument_names` on `BindRequest` / `AggregateBindRequest` (a
|
|
19
|
+
* positional argument has no name). Every other null item is a bug on the
|
|
20
|
+
* sending side (e.g. `BindResponse.lookup_names` built from an unset secret
|
|
21
|
+
* name, where Python sends `""`).
|
|
22
|
+
*
|
|
23
|
+
* `conformRecord` applies both rules to a record about to be encoded: a null or
|
|
24
|
+
* absent non-nullable list/map becomes empty, and a null list item / map value
|
|
25
|
+
* becomes its type's zero value (`""`, `0`, `false`, empty bytes, empty list),
|
|
26
|
+
* which is also what the C++ client reads such an item as. It never mutates its
|
|
27
|
+
* input (catalog items may be frozen and shared) and returns the input itself
|
|
28
|
+
* when nothing needed changing. Nullable columns, and scalars, pass through
|
|
29
|
+
* untouched: a null in a non-nullable scalar column has no safe default and is
|
|
30
|
+
* left for the caller to fix (see `wireViolations`).
|
|
31
|
+
*/
|
|
32
|
+
import { type VgiSchema, type VgiDataType } from "../arrow/index.js";
|
|
33
|
+
/**
|
|
34
|
+
* Top-level / struct-child field names whose list items may legitimately be
|
|
35
|
+
* null (the Python annotation is `list[X | None]`). Derived from vgi-python by
|
|
36
|
+
* walking every protocol dataclass's type hints; keep in sync if the protocol
|
|
37
|
+
* adds another optional-item list.
|
|
38
|
+
*/
|
|
39
|
+
export declare const OPTIONAL_ITEM_FIELDS: ReadonlySet<string>;
|
|
40
|
+
/** The value a non-null slot of `type` takes when the sender left it null. */
|
|
41
|
+
export declare function zeroValue(type: VgiDataType): unknown;
|
|
42
|
+
/**
|
|
43
|
+
* `obj` conformed to `schema`'s wire rules (see the module comment). Returns
|
|
44
|
+
* `obj` itself when nothing changed.
|
|
45
|
+
*/
|
|
46
|
+
export declare function conformRecord<T extends Record<string, any>>(schema: VgiSchema, obj: T): T;
|
|
47
|
+
/**
|
|
48
|
+
* Column-dict form of `conformRecord` for `batchFromColumns` callers: each
|
|
49
|
+
* value is a one-element array holding the row's value.
|
|
50
|
+
*/
|
|
51
|
+
export declare function conformColumns(schema: VgiSchema, columns: Record<string, unknown[]>): Record<string, unknown[]>;
|
package/dist/errors.d.ts
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
|
+
import type { ErrorCode } from "@query-farm/vgi-rpc";
|
|
1
2
|
export declare class VgiError extends Error {
|
|
2
|
-
|
|
3
|
+
/** Canonical code hoisted as `vgi_rpc.error_code`; unset means `UNKNOWN`. */
|
|
4
|
+
readonly errorCode?: ErrorCode;
|
|
5
|
+
constructor(message: string, code?: ErrorCode);
|
|
3
6
|
}
|
|
7
|
+
/** A worker bug (the function returned the wrong number of rows): UNKNOWN. */
|
|
4
8
|
export declare class RowCountMismatchError extends VgiError {
|
|
5
9
|
constructor(expected: number, actual: number);
|
|
6
10
|
}
|