@query-farm/vgi 0.47.2 → 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/README.md +1 -1
- 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 +56 -7
- package/dist/client-entry.js.map +23 -23
- 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/generated/vgi-client.d.ts +5 -0
- package/dist/generated/vgi-protocol-schemas.d.ts +5 -0
- package/dist/generated/vgi-protocol-types.d.ts +57 -0
- package/dist/generated/vgi-service.d.ts +1 -1
- package/dist/http/fetch.d.ts +10 -10
- package/dist/index.core.d.ts +3 -1
- package/dist/index.js +289 -103
- package/dist/index.js.map +57 -55
- package/dist/protocol/dispatch.d.ts +4 -4
- package/dist/protocol/handlers/function.d.ts +2 -2
- package/dist/protocol/serializers/cardinality.d.ts +4 -1
- package/dist/protocol/serializers/splits.d.ts +41 -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 +119 -30
- package/dist/serve-entry.js.map +42 -40
- 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 +199 -94
- package/dist/worker-cf-entry.js.map +55 -53
- 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-client.ts +6 -1
- package/src/generated/vgi-protocol-schemas.ts +36 -1
- package/src/generated/vgi-protocol-types.ts +130 -1
- package/src/generated/vgi-service.ts +7 -5
- package/src/http/fetch.ts +17 -12
- package/src/index.core.ts +34 -0
- package/src/protocol/carried-init-request.ts +1 -1
- package/src/protocol/dispatch.ts +4 -4
- 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/serializers/splits.ts +82 -9
- 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
|
@@ -4,15 +4,15 @@ import type { CatalogInterface } from "../catalog/interface.js";
|
|
|
4
4
|
import { VGI_PROTOCOL_NAME, type VgiService } from "../generated/vgi-service.js";
|
|
5
5
|
export interface ProtocolConfig {
|
|
6
6
|
registry: FunctionRegistry;
|
|
7
|
-
catalogInterface?: CatalogInterface;
|
|
8
|
-
catalogName?: string;
|
|
7
|
+
catalogInterface?: CatalogInterface | undefined;
|
|
8
|
+
catalogName?: string | undefined;
|
|
9
9
|
/**
|
|
10
10
|
* AEAD signing key for sealing catalog opaque-data envelopes. Pass the same
|
|
11
11
|
* 32-byte key used for HTTP state tokens. When omitted (subprocess / unix
|
|
12
12
|
* transports) attach_opaque_data / transaction_opaque_data pass through
|
|
13
13
|
* unsealed — OS process ownership already enforces identity there.
|
|
14
14
|
*/
|
|
15
|
-
signingKey?: Uint8Array;
|
|
15
|
+
signingKey?: Uint8Array | undefined;
|
|
16
16
|
}
|
|
17
17
|
/**
|
|
18
18
|
* Wire name of the VGI protocol: the `vgi_rpc.protocol` routing key and the
|
|
@@ -50,7 +50,7 @@ export { VGI_PROTOCOL_NAME };
|
|
|
50
50
|
* hash covers method names, types and the params/result/header schemas only
|
|
51
51
|
* (WIRE_PROTOCOL.md §14).
|
|
52
52
|
*
|
|
53
|
-
* It changes only with vgi.v3's protocol version (currently 3.
|
|
53
|
+
* It changes only with vgi.v3's protocol version (currently 3.1.0). Asserted
|
|
54
54
|
* by src/protocol/__tests__/vgi-v3-hash.test.ts; if that test fails, the
|
|
55
55
|
* surface drifted from the reference -- fix the schemas, do not bump this.
|
|
56
56
|
*/
|
|
@@ -2,7 +2,7 @@ import { type VgiService } from "../../generated/vgi-service.js";
|
|
|
2
2
|
import type { FunctionRegistry } from "../../functions/registry.js";
|
|
3
3
|
export interface FunctionHandlerConfig {
|
|
4
4
|
registry: FunctionRegistry;
|
|
5
|
-
signingKey?: Uint8Array;
|
|
5
|
+
signingKey?: Uint8Array | undefined;
|
|
6
6
|
/**
|
|
7
7
|
* Used to map a bind's `attach_opaque_data` to its catalog, so resolution can
|
|
8
8
|
* be scoped when two catalogs declare the same schema and function name.
|
|
@@ -21,7 +21,7 @@ export interface FunctionHandlerConfig {
|
|
|
21
21
|
* livelock returning no rows, blaming the data for moving when it has not.
|
|
22
22
|
*/
|
|
23
23
|
version?(attach: Uint8Array, txn?: Uint8Array): number | Promise<number>;
|
|
24
|
-
};
|
|
24
|
+
} | undefined;
|
|
25
25
|
}
|
|
26
26
|
/** The per-function lifecycle's `vgi.v3` handlers. */
|
|
27
27
|
export declare function functionHandlers(config: FunctionHandlerConfig): Partial<VgiService>;
|
|
@@ -2,5 +2,8 @@ import { type VgiSchema } from "../../arrow/index.js";
|
|
|
2
2
|
import type { TableFunctionCardinalityRequest, TableCardinality } from "../types.js";
|
|
3
3
|
declare const TABLE_FUNCTION_CARDINALITY_REQUEST_SCHEMA: VgiSchema;
|
|
4
4
|
export declare function deserializeCardinalityRequest(params: Record<string, any>): TableFunctionCardinalityRequest;
|
|
5
|
-
export declare function serializeTableCardinality(card: TableCardinality):
|
|
5
|
+
export declare function serializeTableCardinality(card: TableCardinality): {
|
|
6
|
+
estimate: bigint | null;
|
|
7
|
+
max: bigint | null;
|
|
8
|
+
};
|
|
6
9
|
export { TABLE_FUNCTION_CARDINALITY_REQUEST_SCHEMA };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type VgiSchema } from "../../arrow/index.js";
|
|
2
2
|
import type { BindRequest } from "../types.js";
|
|
3
|
+
import { OrderByDirection, OrderByNullOrder } from "../types.js";
|
|
3
4
|
/**
|
|
4
5
|
* One named, independently redeemable unit of scan work.
|
|
5
6
|
*
|
|
@@ -21,7 +22,16 @@ export interface ScanSplit {
|
|
|
21
22
|
* claiming client needs no cost model at all.
|
|
22
23
|
*/
|
|
23
24
|
estimatedBytes?: number | bigint | null;
|
|
24
|
-
/**
|
|
25
|
+
/** One-row exact transformed-key tuple aligned with `PlanResult.keyGrouping`. */
|
|
26
|
+
keyValue?: Uint8Array | null;
|
|
27
|
+
/** Zero-based range owned by this split under `PlanResult.rangePartitioning`. */
|
|
28
|
+
rangeIndex?: number | bigint | null;
|
|
29
|
+
/** Two-row (min, max) pruning batch; never an exact distribution claim. */
|
|
30
|
+
columnBounds?: Uint8Array | null;
|
|
31
|
+
/**
|
|
32
|
+
* Two-row (min, max) batch in the legacy `vgi_partition_values` encoding.
|
|
33
|
+
* @deprecated Protocol 3 producers should use `columnBounds`.
|
|
34
|
+
*/
|
|
25
35
|
partitionBounds?: Uint8Array | null;
|
|
26
36
|
columnStatistics?: Uint8Array | null;
|
|
27
37
|
locationIds?: number[] | null;
|
|
@@ -61,7 +71,21 @@ export interface PlanResult {
|
|
|
61
71
|
* cacheable and is not redeemable after commit or rollback.
|
|
62
72
|
*/
|
|
63
73
|
scope?: "catalog" | "transaction";
|
|
74
|
+
/** Hoisted host list indexed by each split's `locationIds`. */
|
|
75
|
+
locations?: string[] | null;
|
|
76
|
+
/** Serialized `KeyGrouping` shared by every page of this plan. */
|
|
77
|
+
keyGrouping?: Uint8Array | null;
|
|
78
|
+
/** Serialized `RangePartitioning` shared by every page of this plan. */
|
|
79
|
+
rangePartitioning?: Uint8Array | null;
|
|
80
|
+
/** @deprecated Protocol 3 producers should use `keyGrouping` or `rangePartitioning`. */
|
|
81
|
+
partitioning?: Uint8Array[] | null;
|
|
82
|
+
/** Serialized `SortField` records describing order within each split. */
|
|
83
|
+
sortOrder?: Uint8Array[] | null;
|
|
64
84
|
cacheMaxAgeSeconds?: number | null;
|
|
85
|
+
/** Actual exclusive lower data position selected by the worker. */
|
|
86
|
+
startPosition?: Uint8Array | null;
|
|
87
|
+
/** Data frontier resolved by the worker for this plan. */
|
|
88
|
+
endPosition?: Uint8Array | null;
|
|
65
89
|
}
|
|
66
90
|
/** The request a client sends to divide a scan. */
|
|
67
91
|
export interface TableFunctionPlanRequest {
|
|
@@ -69,6 +93,8 @@ export interface TableFunctionPlanRequest {
|
|
|
69
93
|
bind_opaque_data: Uint8Array | null;
|
|
70
94
|
projection_ids: number[] | null;
|
|
71
95
|
pushdown_filters: Uint8Array | null;
|
|
96
|
+
join_keys: Uint8Array[] | null;
|
|
97
|
+
row_limit: bigint | null;
|
|
72
98
|
/** The primary sizing lever: every engine is byte-driven. */
|
|
73
99
|
target_split_bytes: bigint | null;
|
|
74
100
|
/**
|
|
@@ -76,12 +102,26 @@ export interface TableFunctionPlanRequest {
|
|
|
76
102
|
* per thread, which a byte target alone would not give it.
|
|
77
103
|
*/
|
|
78
104
|
min_splits: bigint | null;
|
|
105
|
+
/** Maximum number of splits to enumerate on this response page. */
|
|
106
|
+
max_splits_per_response: bigint | null;
|
|
79
107
|
/**
|
|
80
108
|
* A place in the ENUMERATION of splits — NOT a place in the data. A cursor
|
|
81
109
|
* lives for one plan call; a position is checkpointed and must survive
|
|
82
110
|
* restarts, upgrades and key rotation.
|
|
83
111
|
*/
|
|
84
112
|
cursor: Uint8Array | null;
|
|
113
|
+
/** Narrower filters supplied on a continuation request. */
|
|
114
|
+
refined_filters: Uint8Array | null;
|
|
115
|
+
/** False while the client may still send further filter refinement. */
|
|
116
|
+
filters_complete: boolean;
|
|
117
|
+
start_position: Uint8Array | null;
|
|
118
|
+
end_position: Uint8Array | null;
|
|
119
|
+
order_by_column_name: string | null;
|
|
120
|
+
order_by_direction: OrderByDirection | null;
|
|
121
|
+
order_by_null_order: OrderByNullOrder | null;
|
|
122
|
+
order_by_limit: bigint | null;
|
|
123
|
+
tablesample_percentage: number | null;
|
|
124
|
+
tablesample_seed: bigint | null;
|
|
85
125
|
}
|
|
86
126
|
/**
|
|
87
127
|
* The ScanSplit shape, from codegen rather than hand-written.
|
package/dist/protocol/types.d.ts
CHANGED
|
@@ -92,13 +92,13 @@ export interface BindRequest {
|
|
|
92
92
|
export type BindRepeatability = "UNKNOWN" | "STABLE_WITHIN_QUERY";
|
|
93
93
|
export interface BindResponse {
|
|
94
94
|
/** Omitted provider values serialize as UNKNOWN. Wire values are required. */
|
|
95
|
-
repeatability?: BindRepeatability;
|
|
96
|
-
projection_expression_profiles?: string[];
|
|
95
|
+
repeatability?: BindRepeatability | undefined;
|
|
96
|
+
projection_expression_profiles?: string[] | undefined;
|
|
97
97
|
output_schema: VgiSchema;
|
|
98
98
|
opaque_data: Uint8Array | null;
|
|
99
|
-
lookup_secret_types?: string[];
|
|
100
|
-
lookup_scopes?: string[];
|
|
101
|
-
lookup_names?: string[];
|
|
99
|
+
lookup_secret_types?: string[] | undefined;
|
|
100
|
+
lookup_scopes?: string[] | undefined;
|
|
101
|
+
lookup_names?: string[] | undefined;
|
|
102
102
|
}
|
|
103
103
|
export interface InitRequest {
|
|
104
104
|
bind_call: BindRequest;
|
package/dist/rpc-server.d.ts
CHANGED
|
@@ -34,7 +34,7 @@ export interface HostingOptions {
|
|
|
34
34
|
* `vgi_rpc.Identity.v2` is enabled through {@link resolveToken} /
|
|
35
35
|
* {@link mintGrant}. Violations are a startup error naming this hook.
|
|
36
36
|
*/
|
|
37
|
-
hostedProtocols?: () => Iterable<Protocol
|
|
37
|
+
hostedProtocols?: (() => Iterable<Protocol>) | undefined;
|
|
38
38
|
/**
|
|
39
39
|
* Resolve an opaque bearer credential to the identity it authenticates as.
|
|
40
40
|
* Supplying it hosts `vgi_rpc.Identity.v2`'s `introspect_token` -- on HTTP,
|
|
@@ -54,7 +54,7 @@ export interface HostingOptions {
|
|
|
54
54
|
* Requires {@link introspectPrincipals} (or `VGI_INTROSPECT_PRINCIPALS`);
|
|
55
55
|
* there is no permissive default, and a worker without one refuses to start.
|
|
56
56
|
*/
|
|
57
|
-
resolveToken?: TokenResolver;
|
|
57
|
+
resolveToken?: TokenResolver | undefined;
|
|
58
58
|
/**
|
|
59
59
|
* Mint a standing delegation credential for the *calling* user. Supplying
|
|
60
60
|
* it hosts `issue_grant` (HTTP only). Throw `GrantRefusedError` to decline,
|
|
@@ -62,16 +62,16 @@ export interface HostingOptions {
|
|
|
62
62
|
* {@link resolveToken}). Needs no allowlist: it is not an oracle about
|
|
63
63
|
* anybody else.
|
|
64
64
|
*/
|
|
65
|
-
mintGrant?: GrantMinter;
|
|
65
|
+
mintGrant?: GrantMinter | undefined;
|
|
66
66
|
/**
|
|
67
67
|
* Principals permitted to call `introspect_token`. When omitted,
|
|
68
68
|
* `VGI_INTROSPECT_PRINCIPALS` (comma-separated) is read. Only consulted when
|
|
69
69
|
* {@link resolveToken} is supplied.
|
|
70
70
|
*/
|
|
71
|
-
introspectPrincipals?: Iterable<string
|
|
71
|
+
introspectPrincipals?: Iterable<string> | undefined;
|
|
72
72
|
/** Maximum age of the caller's authentication for `issue_grant`, in
|
|
73
73
|
* seconds. vgi-rpc's default when omitted. */
|
|
74
|
-
maxAuthAge?: number;
|
|
74
|
+
maxAuthAge?: number | undefined;
|
|
75
75
|
/**
|
|
76
76
|
* Sealed-grant keys (vgi-rpc `GrantKeys`), turning on the framework's own
|
|
77
77
|
* grants on HTTP: `issue_grant` mints `vgig1.` tokens (unless
|
|
@@ -84,7 +84,7 @@ export interface HostingOptions {
|
|
|
84
84
|
* malformed key refuses to start. `null` turns grants off regardless of the
|
|
85
85
|
* environment.
|
|
86
86
|
*/
|
|
87
|
-
grantKeys?: GrantKeys | null;
|
|
87
|
+
grantKeys?: GrantKeys | null | undefined;
|
|
88
88
|
}
|
|
89
89
|
/** Server-level options passed through to `VgiRpcServer`. */
|
|
90
90
|
export interface BuildRpcServerOptions {
|
package/dist/serve-entry.d.ts
CHANGED
|
@@ -26,14 +26,14 @@ export interface IrohHttpBridgeOptions {
|
|
|
26
26
|
/** Worker-local namespace for EndpointId principals. */
|
|
27
27
|
issuer: string;
|
|
28
28
|
/** Exact bridge IP addresses. No CIDRs or hostnames. */
|
|
29
|
-
trustedProxyAddresses?: readonly string[];
|
|
29
|
+
trustedProxyAddresses?: readonly string[] | undefined;
|
|
30
30
|
/** Authenticate the EndpointId (default) or expose evidence only. */
|
|
31
|
-
authenticate?: boolean;
|
|
31
|
+
authenticate?: boolean | undefined;
|
|
32
32
|
/**
|
|
33
33
|
* Host-specific physical peer and raw-header adapter. Required because a
|
|
34
34
|
* Fetch Request alone does not preserve duplicate header fields.
|
|
35
35
|
*/
|
|
36
|
-
peerResolutionContext?: (request: Request) => PeerResolutionOptions | Promise<PeerResolutionOptions
|
|
36
|
+
peerResolutionContext?: ((request: Request) => PeerResolutionOptions | Promise<PeerResolutionOptions>) | undefined;
|
|
37
37
|
}
|
|
38
38
|
export interface ServeVgiWorkerOptions extends HostingOptions {
|
|
39
39
|
/** Short worker name shown on the landing page, e.g. "ishares". */
|
|
@@ -47,34 +47,34 @@ export interface ServeVgiWorkerOptions extends HostingOptions {
|
|
|
47
47
|
/** Catalog DuckDB attaches to. */
|
|
48
48
|
catalogInterface: CatalogInterface;
|
|
49
49
|
/** Public source-repository URL, linked from the landing page. */
|
|
50
|
-
repositoryUrl?: string;
|
|
50
|
+
repositoryUrl?: string | undefined;
|
|
51
51
|
/** Overrides `$PORT` (default 8787). Pass 0 to bind an ephemeral port. */
|
|
52
|
-
port?: number;
|
|
52
|
+
port?: number | undefined;
|
|
53
53
|
/** Bind address. Iroh bridge mode defaults to loopback; otherwise Bun's default. */
|
|
54
|
-
hostname?: string;
|
|
54
|
+
hostname?: string | undefined;
|
|
55
55
|
/** Overrides `$VGI_SIGNING_KEY`. 32 bytes. */
|
|
56
|
-
signingKey?: Uint8Array;
|
|
56
|
+
signingKey?: Uint8Array | undefined;
|
|
57
57
|
/** Overrides `$VGI_TOKEN_TTL` (default 3600 seconds). */
|
|
58
|
-
tokenTtl?: number;
|
|
58
|
+
tokenTtl?: number | undefined;
|
|
59
59
|
/** Overrides `$CORS_ORIGINS` (default "*"). Pass `null` to disable CORS. */
|
|
60
|
-
corsOrigins?: string | null;
|
|
60
|
+
corsOrigins?: string | null | undefined;
|
|
61
61
|
/** Server ID for state-token attribution (default: `name`). */
|
|
62
|
-
serverId?: string;
|
|
62
|
+
serverId?: string | undefined;
|
|
63
63
|
/** Mount point for the VGI endpoints (default "", the origin root). */
|
|
64
|
-
prefix?: string;
|
|
64
|
+
prefix?: string | undefined;
|
|
65
65
|
/** Suppress the startup banner on stdout. */
|
|
66
|
-
quiet?: boolean;
|
|
66
|
+
quiet?: boolean | undefined;
|
|
67
67
|
/** Environment source (default `process.env`). */
|
|
68
|
-
env?: ServeEnv;
|
|
68
|
+
env?: ServeEnv | undefined;
|
|
69
69
|
/** Command-line arguments to read `--grant-key KEY` (repeatable, first mints)
|
|
70
70
|
* from. Default `process.argv.slice(2)`. A key here takes precedence over
|
|
71
71
|
* `VGI_RPC_GRANT_KEYS`; an explicit {@link grantKeys} over both. */
|
|
72
|
-
argv?: readonly string[];
|
|
72
|
+
argv?: readonly string[] | undefined;
|
|
73
73
|
/** Authenticates each request, returning the caller's `AuthContext`.
|
|
74
74
|
* Omit for an anonymous worker (the default). */
|
|
75
|
-
authenticate?: AuthenticateFn;
|
|
75
|
+
authenticate?: AuthenticateFn | undefined;
|
|
76
76
|
/** Preserve authenticated Iroh identity forwarded by an adjacent HTTP bridge. */
|
|
77
|
-
irohBridge?: IrohHttpBridgeOptions;
|
|
77
|
+
irohBridge?: IrohHttpBridgeOptions | undefined;
|
|
78
78
|
}
|
|
79
79
|
/** The slice of `Bun.serve`'s return value this module uses. */
|
|
80
80
|
export interface VgiHttpServer {
|
package/dist/serve-entry.js
CHANGED
|
@@ -626,6 +626,16 @@ import {
|
|
|
626
626
|
GrantKeys as GrantKeys2
|
|
627
627
|
} from "@query-farm/vgi-rpc";
|
|
628
628
|
|
|
629
|
+
// src/util/defined.ts
|
|
630
|
+
function omitUndefined(obj) {
|
|
631
|
+
const out = {};
|
|
632
|
+
for (const [k, v] of Object.entries(obj)) {
|
|
633
|
+
if (v !== undefined)
|
|
634
|
+
out[k] = v;
|
|
635
|
+
}
|
|
636
|
+
return out;
|
|
637
|
+
}
|
|
638
|
+
|
|
629
639
|
// src/http/fetch.ts
|
|
630
640
|
import {
|
|
631
641
|
AuthContext,
|
|
@@ -2955,6 +2965,18 @@ function deserializeBindResponse(params) {
|
|
|
2955
2965
|
repeatability: parseBindRepeatability(params.repeatability)
|
|
2956
2966
|
};
|
|
2957
2967
|
}
|
|
2968
|
+
// src/protocol/types.ts
|
|
2969
|
+
var OrderByDirection;
|
|
2970
|
+
((OrderByDirection) => {
|
|
2971
|
+
OrderByDirection["ASC"] = "ASC";
|
|
2972
|
+
OrderByDirection["DESC"] = "DESC";
|
|
2973
|
+
})(OrderByDirection ||= {});
|
|
2974
|
+
var OrderByNullOrder;
|
|
2975
|
+
((OrderByNullOrder) => {
|
|
2976
|
+
OrderByNullOrder["NULLS_FIRST"] = "NULLS_FIRST";
|
|
2977
|
+
OrderByNullOrder["NULLS_LAST"] = "NULLS_LAST";
|
|
2978
|
+
})(OrderByNullOrder ||= {});
|
|
2979
|
+
|
|
2958
2980
|
// src/protocol/serializers/init.ts
|
|
2959
2981
|
var INIT_REQUEST_SCHEMA = schema2([
|
|
2960
2982
|
field2("bind_call", binary2(), false),
|
|
@@ -3121,10 +3143,19 @@ function deserializeCardinalityRequest(params) {
|
|
|
3121
3143
|
bind_opaque_data: params.bind_opaque_data ? toUint8Array2(params.bind_opaque_data) : null
|
|
3122
3144
|
};
|
|
3123
3145
|
}
|
|
3146
|
+
function cardinalityValue(name, v) {
|
|
3147
|
+
if (v === null || v === undefined)
|
|
3148
|
+
return null;
|
|
3149
|
+
if (typeof v === "bigint")
|
|
3150
|
+
return v;
|
|
3151
|
+
if (typeof v === "number" && Number.isInteger(v))
|
|
3152
|
+
return BigInt(v);
|
|
3153
|
+
throw new TypeError(`TableCardinality.${name} must be an integer number, a bigint, or null (got ${typeof v}: ${String(v)})`);
|
|
3154
|
+
}
|
|
3124
3155
|
function serializeTableCardinality(card) {
|
|
3125
3156
|
return {
|
|
3126
|
-
estimate: card.estimate,
|
|
3127
|
-
max: card.max
|
|
3157
|
+
estimate: cardinalityValue("estimate", card.estimate),
|
|
3158
|
+
max: cardinalityValue("max", card.max)
|
|
3128
3159
|
};
|
|
3129
3160
|
}
|
|
3130
3161
|
// src/protocol/carried-init-request.ts
|
|
@@ -3396,7 +3427,7 @@ import {
|
|
|
3396
3427
|
Protocol
|
|
3397
3428
|
} from "@query-farm/vgi-rpc";
|
|
3398
3429
|
var VGI_PROTOCOL_NAME = "vgi.v3";
|
|
3399
|
-
var VGI_PROTOCOL_VERSION = "3.
|
|
3430
|
+
var VGI_PROTOCOL_VERSION = "3.1.0";
|
|
3400
3431
|
function exchangeStream(callbacks) {
|
|
3401
3432
|
return { kind: "exchange", ...callbacks };
|
|
3402
3433
|
}
|
|
@@ -4845,9 +4876,9 @@ function registerVgiService(protocol, service) {
|
|
|
4845
4876
|
const common = {
|
|
4846
4877
|
params: m.params,
|
|
4847
4878
|
outputSchema: stream.outputSchema,
|
|
4848
|
-
headerSchema: m.header
|
|
4849
|
-
headerInit: stream.headerInit,
|
|
4850
|
-
onCancel: stream.onCancel,
|
|
4879
|
+
...m.header ? { headerSchema: m.header } : {},
|
|
4880
|
+
...stream.headerInit ? { headerInit: stream.headerInit } : {},
|
|
4881
|
+
...stream.onCancel ? { onCancel: stream.onCancel } : {},
|
|
4851
4882
|
doc: m.doc
|
|
4852
4883
|
};
|
|
4853
4884
|
if (stream.kind === "exchange") {
|
|
@@ -4986,6 +5017,26 @@ var CopyFromFormatInfoSchema = schema2([
|
|
|
4986
5017
|
field2("description", utf82(), false),
|
|
4987
5018
|
field2("ordered", bool2(), false)
|
|
4988
5019
|
]);
|
|
5020
|
+
var FieldPathSchema = schema2([
|
|
5021
|
+
field2("components", list2(field2("item", utf82(), true)), false)
|
|
5022
|
+
]);
|
|
5023
|
+
var TransformSpecSchema = schema2([
|
|
5024
|
+
field2("id", utf82(), false),
|
|
5025
|
+
field2("inputs", list2(field2("item", binary2(), true)), false),
|
|
5026
|
+
field2("parameters", binary2(), true)
|
|
5027
|
+
]);
|
|
5028
|
+
var KeyGroupingSchema = schema2([
|
|
5029
|
+
field2("keys", list2(field2("item", binary2(), true)), false)
|
|
5030
|
+
]);
|
|
5031
|
+
var RangeKeySchema = schema2([
|
|
5032
|
+
field2("transform", binary2(), false),
|
|
5033
|
+
field2("direction", dictionary2(utf82(), int162()), false),
|
|
5034
|
+
field2("null_order", dictionary2(utf82(), int162()), false)
|
|
5035
|
+
]);
|
|
5036
|
+
var RangePartitioningSchema = schema2([
|
|
5037
|
+
field2("keys", list2(field2("item", binary2(), true)), false),
|
|
5038
|
+
field2("split_points", binary2(), false)
|
|
5039
|
+
]);
|
|
4989
5040
|
var MacroParameterSchema = schema2([
|
|
4990
5041
|
field2("name", utf82(), false),
|
|
4991
5042
|
field2("declared_type", binary2(), true),
|
|
@@ -5216,6 +5267,9 @@ var ScanSplitSchema = schema2([
|
|
|
5216
5267
|
field2("estimated_rows", int642(), true),
|
|
5217
5268
|
field2("rows_exact", bool2(), false),
|
|
5218
5269
|
field2("estimated_bytes", int642(), true),
|
|
5270
|
+
field2("key_value", binary2(), true),
|
|
5271
|
+
field2("range_index", int642(), true),
|
|
5272
|
+
field2("column_bounds", binary2(), true),
|
|
5219
5273
|
field2("partition_bounds", binary2(), true),
|
|
5220
5274
|
field2("column_statistics", binary2(), true),
|
|
5221
5275
|
field2("location_ids", list2(field2("item", int642(), true)), true),
|
|
@@ -5691,6 +5745,8 @@ var TableFunctionPlanResultSchema = schema2([
|
|
|
5691
5745
|
field2("catalog_version", int642(), true),
|
|
5692
5746
|
field2("scope", utf82(), false),
|
|
5693
5747
|
field2("locations", list2(field2("item", utf82(), true)), true),
|
|
5748
|
+
field2("key_grouping", binary2(), true),
|
|
5749
|
+
field2("range_partitioning", binary2(), true),
|
|
5694
5750
|
field2("partitioning", list2(field2("item", binary2(), true)), true),
|
|
5695
5751
|
field2("sort_order", list2(field2("item", binary2(), true)), true),
|
|
5696
5752
|
field2("cache_max_age_seconds", int642(), true),
|
|
@@ -8328,14 +8384,40 @@ function deserializePlanRequest(params) {
|
|
|
8328
8384
|
projectionIds = [...raw].map(Number);
|
|
8329
8385
|
}
|
|
8330
8386
|
const asBigInt = (v) => v == null ? null : typeof v === "bigint" ? v : BigInt(Number(v));
|
|
8387
|
+
const asBytes = (v) => v == null ? null : toUint8Array2(v);
|
|
8388
|
+
const asBytesList = (v) => {
|
|
8389
|
+
if (v == null)
|
|
8390
|
+
return null;
|
|
8391
|
+
const values = Array.isArray(v) ? v : v && typeof v[Symbol.iterator] === "function" ? [...v] : [];
|
|
8392
|
+
return values.filter((entry) => entry != null).map(toUint8Array2);
|
|
8393
|
+
};
|
|
8394
|
+
const enumValue = (v, values) => {
|
|
8395
|
+
if (v == null)
|
|
8396
|
+
return null;
|
|
8397
|
+
const text = String(v);
|
|
8398
|
+
return values.includes(text) ? text : null;
|
|
8399
|
+
};
|
|
8331
8400
|
return {
|
|
8332
8401
|
bind_call: bindCall,
|
|
8333
|
-
bind_opaque_data:
|
|
8402
|
+
bind_opaque_data: asBytes(params.bind_opaque_data),
|
|
8334
8403
|
projection_ids: projectionIds,
|
|
8335
|
-
pushdown_filters:
|
|
8404
|
+
pushdown_filters: asBytes(params.pushdown_filters),
|
|
8405
|
+
join_keys: asBytesList(params.join_keys),
|
|
8406
|
+
row_limit: asBigInt(params.row_limit),
|
|
8336
8407
|
target_split_bytes: asBigInt(params.target_split_bytes),
|
|
8337
8408
|
min_splits: asBigInt(params.min_splits),
|
|
8338
|
-
|
|
8409
|
+
max_splits_per_response: asBigInt(params.max_splits_per_response),
|
|
8410
|
+
cursor: asBytes(params.cursor),
|
|
8411
|
+
refined_filters: asBytes(params.refined_filters),
|
|
8412
|
+
filters_complete: params.filters_complete == null ? true : Boolean(params.filters_complete),
|
|
8413
|
+
start_position: asBytes(params.start_position),
|
|
8414
|
+
end_position: asBytes(params.end_position),
|
|
8415
|
+
order_by_column_name: params.order_by_column_name == null ? null : String(params.order_by_column_name),
|
|
8416
|
+
order_by_direction: enumValue(params.order_by_direction, Object.values(OrderByDirection)),
|
|
8417
|
+
order_by_null_order: enumValue(params.order_by_null_order, Object.values(OrderByNullOrder)),
|
|
8418
|
+
order_by_limit: asBigInt(params.order_by_limit),
|
|
8419
|
+
tablesample_percentage: params.tablesample_percentage == null ? null : Number(params.tablesample_percentage),
|
|
8420
|
+
tablesample_seed: asBigInt(params.tablesample_seed)
|
|
8339
8421
|
};
|
|
8340
8422
|
}
|
|
8341
8423
|
function fingerprintInputs(bindCallBytes) {
|
|
@@ -8355,6 +8437,9 @@ function scanSplitRow(split, token) {
|
|
|
8355
8437
|
estimated_rows: asBigInt(split.estimatedRows),
|
|
8356
8438
|
rows_exact: split.rowsExact === true,
|
|
8357
8439
|
estimated_bytes: asBigInt(split.estimatedBytes),
|
|
8440
|
+
key_value: split.keyValue ?? null,
|
|
8441
|
+
range_index: asBigInt(split.rangeIndex),
|
|
8442
|
+
column_bounds: split.columnBounds ?? null,
|
|
8358
8443
|
partition_bounds: split.partitionBounds ?? null,
|
|
8359
8444
|
column_statistics: split.columnStatistics ?? null,
|
|
8360
8445
|
location_ids: split.locationIds ?? null,
|
|
@@ -8375,12 +8460,14 @@ function planResponseRow(result, splitBlobs) {
|
|
|
8375
8460
|
estimated_total_bytes: asBigInt(result.estimatedTotalBytes),
|
|
8376
8461
|
catalog_version: asBigInt(result.catalogVersion),
|
|
8377
8462
|
scope: result.scope ?? "catalog",
|
|
8378
|
-
locations: null,
|
|
8379
|
-
|
|
8380
|
-
|
|
8463
|
+
locations: result.locations ?? null,
|
|
8464
|
+
key_grouping: result.keyGrouping ?? null,
|
|
8465
|
+
range_partitioning: result.rangePartitioning ?? null,
|
|
8466
|
+
partitioning: result.partitioning ?? null,
|
|
8467
|
+
sort_order: result.sortOrder ?? null,
|
|
8381
8468
|
cache_max_age_seconds: asBigInt(result.cacheMaxAgeSeconds),
|
|
8382
|
-
start_position:
|
|
8383
|
-
end_position:
|
|
8469
|
+
start_position: result.startPosition ?? null,
|
|
8470
|
+
end_position: result.endPosition ?? null
|
|
8384
8471
|
};
|
|
8385
8472
|
}
|
|
8386
8473
|
|
|
@@ -9138,6 +9225,7 @@ function extractArgMap(cfg, args) {
|
|
|
9138
9225
|
}
|
|
9139
9226
|
}
|
|
9140
9227
|
for (let i = 0;i < constNames.length; i++) {
|
|
9228
|
+
const name = constNames[i];
|
|
9141
9229
|
let v;
|
|
9142
9230
|
try {
|
|
9143
9231
|
v = args.get(i);
|
|
@@ -9152,16 +9240,16 @@ function extractArgMap(cfg, args) {
|
|
|
9152
9240
|
v = Number(v);
|
|
9153
9241
|
}
|
|
9154
9242
|
} catch {
|
|
9155
|
-
const def = cfg.argDefaults?.[
|
|
9243
|
+
const def = cfg.argDefaults?.[name];
|
|
9156
9244
|
if (def !== undefined)
|
|
9157
|
-
out[
|
|
9245
|
+
out[name] = def;
|
|
9158
9246
|
continue;
|
|
9159
9247
|
}
|
|
9160
|
-
const constraints = cfg.argConstraints?.[
|
|
9248
|
+
const constraints = cfg.argConstraints?.[name];
|
|
9161
9249
|
if (constraints !== undefined) {
|
|
9162
|
-
validateConstConstraints(
|
|
9250
|
+
validateConstConstraints(name, constraints, v);
|
|
9163
9251
|
}
|
|
9164
|
-
out[
|
|
9252
|
+
out[name] = v;
|
|
9165
9253
|
}
|
|
9166
9254
|
if (cfg.argDefaults) {
|
|
9167
9255
|
for (const [name, def] of Object.entries(cfg.argDefaults)) {
|
|
@@ -10137,15 +10225,16 @@ class CatalogSnapshotManager {
|
|
|
10137
10225
|
validateCatalogPublicationEnvelope(bytes);
|
|
10138
10226
|
}
|
|
10139
10227
|
});
|
|
10140
|
-
|
|
10228
|
+
const resultField = resolved.schema.fields.length === 1 ? resolved.schema.fields[0] : undefined;
|
|
10229
|
+
if (resolved.numRows !== 1 || !resultField || resultField.name !== "result" || typeSignature(resultField.type) !== typeSignature(binary2()) || resultField.nullable)
|
|
10141
10230
|
throw new Error("invalid published RPC envelope");
|
|
10142
10231
|
const bytes = resolved.getChild("result")?.get(0);
|
|
10143
10232
|
if (!(bytes instanceof Uint8Array))
|
|
10144
10233
|
throw new Error("published catalog has no result bytes");
|
|
10145
10234
|
const decoded = decodeASDCollection(CatalogContentsResultSchema, bytes);
|
|
10146
|
-
|
|
10235
|
+
const response = decoded.length === 1 ? decoded[0] : undefined;
|
|
10236
|
+
if (!response)
|
|
10147
10237
|
throw new Error("published catalog must contain exactly one response row");
|
|
10148
|
-
const response = decoded[0];
|
|
10149
10238
|
if (response.not_modified || Number(response.catalog_version) !== identity.catalogVersion || response.etag !== m.etag)
|
|
10150
10239
|
throw new Error("published catalog version or ETag mismatch");
|
|
10151
10240
|
decodeCatalogStreams(response);
|
|
@@ -11521,12 +11610,12 @@ function buildRpcServer(primary, hosting, options) {
|
|
|
11521
11610
|
if (tickets)
|
|
11522
11611
|
protocols.push(tickets);
|
|
11523
11612
|
}
|
|
11524
|
-
return new VgiRpcServer(primary, {
|
|
11613
|
+
return new VgiRpcServer(primary, omitUndefined({
|
|
11525
11614
|
serverId: options.serverId,
|
|
11526
11615
|
protocols,
|
|
11527
11616
|
identity,
|
|
11528
11617
|
grantKeys: null
|
|
11529
|
-
});
|
|
11618
|
+
}));
|
|
11530
11619
|
}
|
|
11531
11620
|
function validatedHostedProtocols(hosting, primary) {
|
|
11532
11621
|
if (hosting.hostedProtocols === undefined)
|
|
@@ -11570,13 +11659,13 @@ function buildIdentity(hosting, grantKeys, env) {
|
|
|
11570
11659
|
const { resolveToken, mintGrant } = hosting;
|
|
11571
11660
|
if (!resolveToken && !mintGrant && !grantKeys)
|
|
11572
11661
|
return;
|
|
11573
|
-
return new IdentityImpl({
|
|
11662
|
+
return new IdentityImpl(omitUndefined({
|
|
11574
11663
|
resolveToken,
|
|
11575
11664
|
mintGrant,
|
|
11576
11665
|
grantKeys: grantKeys ?? undefined,
|
|
11577
11666
|
introspectPrincipals: resolveToken ? resolveIntrospectPrincipals(hosting.introspectPrincipals, env) : undefined,
|
|
11578
11667
|
maxAuthAge: hosting.maxAuthAge
|
|
11579
|
-
});
|
|
11668
|
+
}));
|
|
11580
11669
|
}
|
|
11581
11670
|
function buildAttachTickets(hosting, grantKeys, config, env) {
|
|
11582
11671
|
if (!config || !config.signingKeyConfigured || !config.signingKey)
|
|
@@ -11675,7 +11764,7 @@ function createVgiFetch(opts) {
|
|
|
11675
11764
|
});
|
|
11676
11765
|
const reservedCheck = checkReservedAttachOptions(opts.protocol.catalogInterface);
|
|
11677
11766
|
reservedCheck.catch((e) => console.error(`VGI worker refused to serve: ${e.message}`));
|
|
11678
|
-
const handler = createHttpHandler(server, {
|
|
11767
|
+
const handler = createHttpHandler(server, omitUndefined({
|
|
11679
11768
|
prefix,
|
|
11680
11769
|
serverId,
|
|
11681
11770
|
tokenKey: opts.signingKey,
|
|
@@ -11690,7 +11779,7 @@ function createVgiFetch(opts) {
|
|
|
11690
11779
|
repositoryUrl: opts.repositoryUrl,
|
|
11691
11780
|
extraRoutes: createLandingRoutes(opts.landingInfo),
|
|
11692
11781
|
enableLandingPage: false
|
|
11693
|
-
});
|
|
11782
|
+
}));
|
|
11694
11783
|
return async (req) => {
|
|
11695
11784
|
await reservedCheck;
|
|
11696
11785
|
const storage = await ensureRequestAuthStorage();
|
|
@@ -11807,7 +11896,7 @@ function serveVgiWorker(opts) {
|
|
|
11807
11896
|
const immediatePeer = server.requestIP?.(request)?.address;
|
|
11808
11897
|
const forwarded = request.headers.get(IROH_FORWARDED_ENDPOINT_HEADER);
|
|
11809
11898
|
return {
|
|
11810
|
-
immediatePeer,
|
|
11899
|
+
...immediatePeer !== undefined ? { immediatePeer } : {},
|
|
11811
11900
|
headers: forwarded === null ? {} : { [IROH_FORWARDED_ENDPOINT_HEADER]: [forwarded] }
|
|
11812
11901
|
};
|
|
11813
11902
|
}
|
|
@@ -11834,4 +11923,4 @@ export {
|
|
|
11834
11923
|
serveVgiWorker
|
|
11835
11924
|
};
|
|
11836
11925
|
|
|
11837
|
-
//# debugId=
|
|
11926
|
+
//# debugId=7B9431FBBB6E4B0564756E2164756E21
|