@query-farm/vgi 0.48.0 → 0.48.2
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 +24 -1
- package/dist/arguments/argument-spec.d.ts +17 -11
- package/dist/catalog/descriptors.d.ts +16 -2
- package/dist/catalog/publication.d.ts +7 -7
- package/dist/catalog/read-only.d.ts +4 -5
- 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/registry.d.ts +1 -0
- package/dist/functions/scalar.d.ts +17 -6
- 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 +51 -47
- package/dist/http/fetch.d.ts +10 -10
- package/dist/index.core.d.ts +2 -2
- package/dist/index.js +201 -116
- 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 +47 -24
- 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 +164 -106
- 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 +15 -1
- package/src/catalog/interface.ts +12 -12
- package/src/catalog/publication.ts +9 -8
- package/src/catalog/read-only.ts +27 -21
- 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 +20 -17
- package/src/functions/scalar.ts +33 -11
- package/src/functions/storage-cf-do.ts +2 -2
- package/src/functions/table-buffering.ts +28 -21
- package/src/functions/table-in-out.ts +37 -17
- package/src/functions/table.ts +36 -31
- package/src/functions/types.ts +58 -48
- package/src/generated/vgi-service.ts +5 -3
- package/src/http/fetch.ts +17 -12
- package/src/index.core.ts +3 -1
- 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 +18 -5
- 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
|
@@ -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
|
|
@@ -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 };
|
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,
|
|
@@ -3133,10 +3143,19 @@ function deserializeCardinalityRequest(params) {
|
|
|
3133
3143
|
bind_opaque_data: params.bind_opaque_data ? toUint8Array2(params.bind_opaque_data) : null
|
|
3134
3144
|
};
|
|
3135
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
|
+
}
|
|
3136
3155
|
function serializeTableCardinality(card) {
|
|
3137
3156
|
return {
|
|
3138
|
-
estimate: card.estimate,
|
|
3139
|
-
max: card.max
|
|
3157
|
+
estimate: cardinalityValue("estimate", card.estimate),
|
|
3158
|
+
max: cardinalityValue("max", card.max)
|
|
3140
3159
|
};
|
|
3141
3160
|
}
|
|
3142
3161
|
// src/protocol/carried-init-request.ts
|
|
@@ -4857,9 +4876,9 @@ function registerVgiService(protocol, service) {
|
|
|
4857
4876
|
const common = {
|
|
4858
4877
|
params: m.params,
|
|
4859
4878
|
outputSchema: stream.outputSchema,
|
|
4860
|
-
headerSchema: m.header
|
|
4861
|
-
headerInit: stream.headerInit,
|
|
4862
|
-
onCancel: stream.onCancel,
|
|
4879
|
+
...m.header ? { headerSchema: m.header } : {},
|
|
4880
|
+
...stream.headerInit ? { headerInit: stream.headerInit } : {},
|
|
4881
|
+
...stream.onCancel ? { onCancel: stream.onCancel } : {},
|
|
4863
4882
|
doc: m.doc
|
|
4864
4883
|
};
|
|
4865
4884
|
if (stream.kind === "exchange") {
|
|
@@ -8686,13 +8705,14 @@ function functionHandlers(config) {
|
|
|
8686
8705
|
} else {
|
|
8687
8706
|
const carried = parseCarriedInitRequest(state.initRequestPacked);
|
|
8688
8707
|
const request = carried.request;
|
|
8708
|
+
request.bind_call.attach_opaque_data = await stripAttach(request.bind_call.attach_opaque_data, undefined);
|
|
8689
8709
|
await resolveSplitPayloads(request, { bind_call: carried.bindCallIpc }, {
|
|
8690
8710
|
auth: currentRequestAuth(),
|
|
8691
8711
|
signingKey,
|
|
8692
8712
|
catalogInterface,
|
|
8693
8713
|
checkAnchor: false
|
|
8694
8714
|
});
|
|
8695
|
-
const func = registry.get(state.functionName,
|
|
8715
|
+
const func = registry.get(state.functionName, overloadContext(request.bind_call, catalogInterface));
|
|
8696
8716
|
const executionId = state.executionId;
|
|
8697
8717
|
const opaqueData = state.opaqueData ?? null;
|
|
8698
8718
|
const initResponse = {
|
|
@@ -8701,10 +8721,11 @@ function functionHandlers(config) {
|
|
|
8701
8721
|
opaque_data: opaqueData
|
|
8702
8722
|
};
|
|
8703
8723
|
handlers = func.createStreamHandlers(request, initResponse, state.filterHistory ?? null);
|
|
8724
|
+
const restored = state.userState != null ? { state: state.userState } : undefined;
|
|
8704
8725
|
if (handlers.producerInit) {
|
|
8705
|
-
handlerState = handlers.producerInit();
|
|
8726
|
+
handlerState = handlers.producerInit(restored);
|
|
8706
8727
|
} else if (handlers.exchangeInit) {
|
|
8707
|
-
handlerState = handlers.exchangeInit();
|
|
8728
|
+
handlerState = handlers.exchangeInit(restored);
|
|
8708
8729
|
}
|
|
8709
8730
|
if (state.userState != null && handlerState?.state !== undefined) {
|
|
8710
8731
|
handlerState.state = state.userState;
|
|
@@ -9206,6 +9227,7 @@ function extractArgMap(cfg, args) {
|
|
|
9206
9227
|
}
|
|
9207
9228
|
}
|
|
9208
9229
|
for (let i = 0;i < constNames.length; i++) {
|
|
9230
|
+
const name = constNames[i];
|
|
9209
9231
|
let v;
|
|
9210
9232
|
try {
|
|
9211
9233
|
v = args.get(i);
|
|
@@ -9220,16 +9242,16 @@ function extractArgMap(cfg, args) {
|
|
|
9220
9242
|
v = Number(v);
|
|
9221
9243
|
}
|
|
9222
9244
|
} catch {
|
|
9223
|
-
const def = cfg.argDefaults?.[
|
|
9245
|
+
const def = cfg.argDefaults?.[name];
|
|
9224
9246
|
if (def !== undefined)
|
|
9225
|
-
out[
|
|
9247
|
+
out[name] = def;
|
|
9226
9248
|
continue;
|
|
9227
9249
|
}
|
|
9228
|
-
const constraints = cfg.argConstraints?.[
|
|
9250
|
+
const constraints = cfg.argConstraints?.[name];
|
|
9229
9251
|
if (constraints !== undefined) {
|
|
9230
|
-
validateConstConstraints(
|
|
9252
|
+
validateConstConstraints(name, constraints, v);
|
|
9231
9253
|
}
|
|
9232
|
-
out[
|
|
9254
|
+
out[name] = v;
|
|
9233
9255
|
}
|
|
9234
9256
|
if (cfg.argDefaults) {
|
|
9235
9257
|
for (const [name, def] of Object.entries(cfg.argDefaults)) {
|
|
@@ -10205,15 +10227,16 @@ class CatalogSnapshotManager {
|
|
|
10205
10227
|
validateCatalogPublicationEnvelope(bytes);
|
|
10206
10228
|
}
|
|
10207
10229
|
});
|
|
10208
|
-
|
|
10230
|
+
const resultField = resolved.schema.fields.length === 1 ? resolved.schema.fields[0] : undefined;
|
|
10231
|
+
if (resolved.numRows !== 1 || !resultField || resultField.name !== "result" || typeSignature(resultField.type) !== typeSignature(binary2()) || resultField.nullable)
|
|
10209
10232
|
throw new Error("invalid published RPC envelope");
|
|
10210
10233
|
const bytes = resolved.getChild("result")?.get(0);
|
|
10211
10234
|
if (!(bytes instanceof Uint8Array))
|
|
10212
10235
|
throw new Error("published catalog has no result bytes");
|
|
10213
10236
|
const decoded = decodeASDCollection(CatalogContentsResultSchema, bytes);
|
|
10214
|
-
|
|
10237
|
+
const response = decoded.length === 1 ? decoded[0] : undefined;
|
|
10238
|
+
if (!response)
|
|
10215
10239
|
throw new Error("published catalog must contain exactly one response row");
|
|
10216
|
-
const response = decoded[0];
|
|
10217
10240
|
if (response.not_modified || Number(response.catalog_version) !== identity.catalogVersion || response.etag !== m.etag)
|
|
10218
10241
|
throw new Error("published catalog version or ETag mismatch");
|
|
10219
10242
|
decodeCatalogStreams(response);
|
|
@@ -11589,12 +11612,12 @@ function buildRpcServer(primary, hosting, options) {
|
|
|
11589
11612
|
if (tickets)
|
|
11590
11613
|
protocols.push(tickets);
|
|
11591
11614
|
}
|
|
11592
|
-
return new VgiRpcServer(primary, {
|
|
11615
|
+
return new VgiRpcServer(primary, omitUndefined({
|
|
11593
11616
|
serverId: options.serverId,
|
|
11594
11617
|
protocols,
|
|
11595
11618
|
identity,
|
|
11596
11619
|
grantKeys: null
|
|
11597
|
-
});
|
|
11620
|
+
}));
|
|
11598
11621
|
}
|
|
11599
11622
|
function validatedHostedProtocols(hosting, primary) {
|
|
11600
11623
|
if (hosting.hostedProtocols === undefined)
|
|
@@ -11638,13 +11661,13 @@ function buildIdentity(hosting, grantKeys, env) {
|
|
|
11638
11661
|
const { resolveToken, mintGrant } = hosting;
|
|
11639
11662
|
if (!resolveToken && !mintGrant && !grantKeys)
|
|
11640
11663
|
return;
|
|
11641
|
-
return new IdentityImpl({
|
|
11664
|
+
return new IdentityImpl(omitUndefined({
|
|
11642
11665
|
resolveToken,
|
|
11643
11666
|
mintGrant,
|
|
11644
11667
|
grantKeys: grantKeys ?? undefined,
|
|
11645
11668
|
introspectPrincipals: resolveToken ? resolveIntrospectPrincipals(hosting.introspectPrincipals, env) : undefined,
|
|
11646
11669
|
maxAuthAge: hosting.maxAuthAge
|
|
11647
|
-
});
|
|
11670
|
+
}));
|
|
11648
11671
|
}
|
|
11649
11672
|
function buildAttachTickets(hosting, grantKeys, config, env) {
|
|
11650
11673
|
if (!config || !config.signingKeyConfigured || !config.signingKey)
|
|
@@ -11743,7 +11766,7 @@ function createVgiFetch(opts) {
|
|
|
11743
11766
|
});
|
|
11744
11767
|
const reservedCheck = checkReservedAttachOptions(opts.protocol.catalogInterface);
|
|
11745
11768
|
reservedCheck.catch((e) => console.error(`VGI worker refused to serve: ${e.message}`));
|
|
11746
|
-
const handler = createHttpHandler(server, {
|
|
11769
|
+
const handler = createHttpHandler(server, omitUndefined({
|
|
11747
11770
|
prefix,
|
|
11748
11771
|
serverId,
|
|
11749
11772
|
tokenKey: opts.signingKey,
|
|
@@ -11758,7 +11781,7 @@ function createVgiFetch(opts) {
|
|
|
11758
11781
|
repositoryUrl: opts.repositoryUrl,
|
|
11759
11782
|
extraRoutes: createLandingRoutes(opts.landingInfo),
|
|
11760
11783
|
enableLandingPage: false
|
|
11761
|
-
});
|
|
11784
|
+
}));
|
|
11762
11785
|
return async (req) => {
|
|
11763
11786
|
await reservedCheck;
|
|
11764
11787
|
const storage = await ensureRequestAuthStorage();
|
|
@@ -11875,7 +11898,7 @@ function serveVgiWorker(opts) {
|
|
|
11875
11898
|
const immediatePeer = server.requestIP?.(request)?.address;
|
|
11876
11899
|
const forwarded = request.headers.get(IROH_FORWARDED_ENDPOINT_HEADER);
|
|
11877
11900
|
return {
|
|
11878
|
-
immediatePeer,
|
|
11901
|
+
...immediatePeer !== undefined ? { immediatePeer } : {},
|
|
11879
11902
|
headers: forwarded === null ? {} : { [IROH_FORWARDED_ENDPOINT_HEADER]: [forwarded] }
|
|
11880
11903
|
};
|
|
11881
11904
|
}
|
|
@@ -11902,4 +11925,4 @@ export {
|
|
|
11902
11925
|
serveVgiWorker
|
|
11903
11926
|
};
|
|
11904
11927
|
|
|
11905
|
-
//# debugId=
|
|
11928
|
+
//# debugId=AA979855B0C12EAC64756E2164756E21
|