@query-farm/vgi 0.51.0 → 0.52.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 +45 -3
- package/dist/arrow/impl-flechette/ipc.d.ts +9 -1
- package/dist/client-entry.js +833 -775
- package/dist/client-entry.js.map +10 -10
- package/dist/functions/storage-blobs.d.ts +173 -0
- package/dist/functions/storage-cf-do.d.ts +12 -0
- package/dist/functions/storage.d.ts +22 -0
- package/dist/functions/table.d.ts +6 -1
- package/dist/generated/vgi-client.d.ts +7 -1
- package/dist/generated/vgi-protocol-schemas.d.ts +10 -9
- package/dist/generated/vgi-protocol-types.d.ts +244 -2
- package/dist/generated/vgi-service.d.ts +1 -1
- package/dist/hosted.d.ts +117 -0
- package/dist/http/blob-vendor.d.ts +33 -0
- package/dist/http/fetch.d.ts +53 -2
- package/dist/http/hosted-auth.d.ts +45 -0
- package/dist/index.core.d.ts +9 -2
- package/dist/index.js +5238 -3619
- package/dist/index.js.map +44 -28
- package/dist/protocol/arguments-ref.d.ts +107 -0
- package/dist/protocol/dispatch.d.ts +3 -2
- package/dist/protocol/handlers/function.d.ts +21 -0
- package/dist/protocol/serialize.d.ts +1 -1
- package/dist/protocol/serializers/bind.d.ts +27 -1
- package/dist/protocol/serializers/cardinality.d.ts +1 -1
- package/dist/protocol/serializers/splits.d.ts +7 -0
- package/dist/protocol/state-serializer.d.ts +8 -7
- package/dist/protocol/stream-init.d.ts +17 -0
- package/dist/protocol/types.d.ts +24 -0
- package/dist/secrets/lookups.d.ts +31 -0
- package/dist/serve-entry.d.ts +25 -4
- package/dist/serve-entry.js +2940 -1219
- package/dist/serve-entry.js.map +44 -29
- package/dist/worker-cf-entry.d.ts +5 -0
- package/dist/worker-cf-entry.js +2928 -1223
- package/dist/worker-cf-entry.js.map +47 -31
- package/package.json +5 -4
- package/src/arrow/impl-flechette/ipc.ts +9 -1
- package/src/functions/storage-blobs.ts +654 -0
- package/src/functions/storage-cf-do.ts +24 -0
- package/src/functions/storage.ts +54 -5
- package/src/functions/table-buffering.ts +14 -4
- package/src/functions/table.ts +8 -4
- package/src/generated/vgi-client.ts +9 -2
- package/src/generated/vgi-protocol-schemas.ts +115 -107
- package/src/generated/vgi-protocol-types.ts +640 -3
- package/src/generated/vgi-service.ts +2 -2
- package/src/hosted.ts +254 -0
- package/src/http/blob-vendor.ts +80 -0
- package/src/http/fetch.ts +170 -8
- package/src/http/hosted-auth.ts +326 -0
- package/src/index.core.ts +64 -1
- package/src/protocol/arguments-ref.ts +260 -0
- package/src/protocol/dispatch.ts +3 -2
- package/src/protocol/handlers/function.ts +109 -60
- package/src/protocol/handlers/table-buffering.ts +5 -0
- package/src/protocol/serialize.ts +3 -0
- package/src/protocol/serializers/bind.ts +96 -69
- package/src/protocol/serializers/cardinality.ts +4 -7
- package/src/protocol/serializers/init.ts +5 -11
- package/src/protocol/serializers/splits.ts +31 -4
- package/src/protocol/state-serializer.ts +27 -39
- package/src/protocol/stream-init.ts +87 -0
- package/src/protocol/types.ts +25 -0
- package/src/secrets/lookups.ts +53 -0
- package/src/serve-entry.ts +105 -8
- package/src/worker-cf-entry.ts +33 -0
- package/src/worker.ts +25 -0
- package/dist/protocol/carried-init-request.d.ts +0 -28
- package/dist/util/zstd-sync.d.ts +0 -7
- package/src/protocol/carried-init-request.ts +0 -139
- package/src/util/zstd-sync.ts +0 -50
package/dist/hosted.d.ts
ADDED
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
/** Environment variable that turns hosted mode on. Baked into the hosted base image. */
|
|
2
|
+
export declare const HOSTED_ENV = "VGI_ORCHARD_HOSTED";
|
|
3
|
+
/** The challenge on every hosted-mode 401. No `resource_metadata`: a Field
|
|
4
|
+
* Worker never sends a client off to discover an authorization server. */
|
|
5
|
+
export declare const HOSTED_CHALLENGE = "Bearer error=\"invalid_token\"";
|
|
6
|
+
/** `AuthContext.domain` of a caller authenticated by a Pass. */
|
|
7
|
+
export declare const HOSTED_AUTH_DOMAIN = "orchard";
|
|
8
|
+
/** Default (and only-by-override) signing algorithm for Passes. */
|
|
9
|
+
export declare const DEFAULT_HOSTED_ALGORITHMS: readonly string[];
|
|
10
|
+
/** Required JOSE `typ` (RFC 9068). */
|
|
11
|
+
export declare const REQUIRED_TYP = "at+jwt";
|
|
12
|
+
/** Clock skew allowed on `exp` / `nbf`, seconds. */
|
|
13
|
+
export declare const LEEWAY_SECONDS = 60;
|
|
14
|
+
/** Hard upper bound on how long JWKS keys are trusted, seconds. */
|
|
15
|
+
export declare const JWKS_MAX_AGE_SECONDS = 600;
|
|
16
|
+
/** Minimum time between JWKS re-fetches triggered by an unknown `kid`, seconds. */
|
|
17
|
+
export declare const JWKS_REFRESH_MIN_INTERVAL_SECONDS = 60;
|
|
18
|
+
/** Timeout for each JWKS request, seconds. */
|
|
19
|
+
export declare const JWKS_FETCH_TIMEOUT_SECONDS = 10;
|
|
20
|
+
/** The shortest signing key a hosted worker accepts, bytes. */
|
|
21
|
+
export declare const MIN_SIGNING_KEY_BYTES = 32;
|
|
22
|
+
/**
|
|
23
|
+
* The request cap a hosted worker serves with when neither
|
|
24
|
+
* `VGI_RPC_MAX_REQUEST_BYTES` nor `maxRequestBytes` sets one: 32 MiB
|
|
25
|
+
* (vgi-python `HOSTED_DEFAULT_MAX_REQUEST_BYTES`). Advertised as
|
|
26
|
+
* `VGI-Max-Request-Bytes`, so with the blob vendor a larger request goes up
|
|
27
|
+
* through an upload URL instead.
|
|
28
|
+
*/
|
|
29
|
+
export declare const HOSTED_DEFAULT_MAX_REQUEST_BYTES: number;
|
|
30
|
+
/** An environment: `process.env`, a Cloudflare Worker's `env`, or a test map. */
|
|
31
|
+
export type HostedEnv = Readonly<Record<string, string | undefined>>;
|
|
32
|
+
/**
|
|
33
|
+
* A hosted-mode configuration error. The worker must not start.
|
|
34
|
+
*
|
|
35
|
+
* `serveVgiWorker` and `Worker.run` print the message and exit non-zero;
|
|
36
|
+
* `createVgiFetch` / `createVgiWorkerFetch` throw it at construction.
|
|
37
|
+
*/
|
|
38
|
+
export declare class OrchardHostedConfigError extends Error {
|
|
39
|
+
constructor(reason: string, options?: {
|
|
40
|
+
raw?: boolean;
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
/** Verified hosted-mode settings, read from the environment. */
|
|
44
|
+
export interface HostedConfig {
|
|
45
|
+
/** The Front Desk issuer (`iss`), matched exactly. */
|
|
46
|
+
readonly issuer: string;
|
|
47
|
+
/** The one canonical Desk Address (`aud`), matched exactly. */
|
|
48
|
+
readonly audience: string;
|
|
49
|
+
/** Where the Front Desk publishes its signing keys. */
|
|
50
|
+
readonly jwksUri: string;
|
|
51
|
+
/** Accepted JWS algorithms (`ES256` unless overridden). */
|
|
52
|
+
readonly algorithms: readonly string[];
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Whether `VGI_ORCHARD_HOSTED` turns hosted mode on.
|
|
56
|
+
*
|
|
57
|
+
* True for `1`/`true`/`yes`/`on` (any case), false when unset or
|
|
58
|
+
* `0`/`false`/`no`/`off`/empty. Any other value throws
|
|
59
|
+
* {@link OrchardHostedConfigError}: a typo must not quietly start a worker
|
|
60
|
+
* without authentication.
|
|
61
|
+
*/
|
|
62
|
+
export declare function hostedModeEnabled(env?: HostedEnv): boolean;
|
|
63
|
+
/**
|
|
64
|
+
* Parse a `VGI_JWT_ALGORITHMS` value: comma-separated JWS algorithm names.
|
|
65
|
+
* `none` and `HS*` are always refused: an HMAC algorithm checked against a
|
|
66
|
+
* JWKS lets anyone holding the *public* key mint tokens.
|
|
67
|
+
*
|
|
68
|
+
* Returns the default (`ES256`) when unset or blank.
|
|
69
|
+
*/
|
|
70
|
+
export declare function parseJwtAlgorithms(raw: string | undefined): readonly string[];
|
|
71
|
+
/**
|
|
72
|
+
* Read and validate the hosted-mode environment.
|
|
73
|
+
*
|
|
74
|
+
* @throws OrchardHostedConfigError when a required variable is missing, empty
|
|
75
|
+
* or multi-valued, or `VGI_JWT_ALGORITHMS` is unusable.
|
|
76
|
+
*/
|
|
77
|
+
export declare function resolveHostedConfig(env?: HostedEnv): HostedConfig;
|
|
78
|
+
/**
|
|
79
|
+
* Refuse when the environment configures another credential.
|
|
80
|
+
*
|
|
81
|
+
* The TypeScript SDK reads none of these itself, but a hosted image built from
|
|
82
|
+
* another SDK's conventions may carry them, and each one means the operator
|
|
83
|
+
* expects a second way in. Refusing is the only answer that cannot be wrong.
|
|
84
|
+
*
|
|
85
|
+
* @throws OrchardHostedConfigError on `VGI_BEARER_TOKENS`, `VGI_RPC_GRANT_KEYS`,
|
|
86
|
+
* `VGI_OAUTH_RESOURCE` or an active `VGI_PROXY_PROOF_MODE`.
|
|
87
|
+
*/
|
|
88
|
+
export declare function checkHostedEnvironment(env?: HostedEnv): void;
|
|
89
|
+
/**
|
|
90
|
+
* Refuse a hosted worker whose signing key is not stable across restarts.
|
|
91
|
+
*
|
|
92
|
+
* The key seals catalog opaque data and HTTP state tokens. A Field Worker's
|
|
93
|
+
* machines stop and start, and a deployment can run on several of them: a key
|
|
94
|
+
* generated per process makes every restart (and every other machine) reject
|
|
95
|
+
* the sessions DuckDB already holds.
|
|
96
|
+
*
|
|
97
|
+
* @param env the environment (`VGI_SIGNING_KEY`, `VGI_SIGNING_KEY_MINTED`).
|
|
98
|
+
* @param explicit a key passed in code, if any. It counts as configured.
|
|
99
|
+
* @throws OrchardHostedConfigError when there is no configured key, the
|
|
100
|
+
* environment marks it as minted by a parent process, or it is shorter than
|
|
101
|
+
* {@link MIN_SIGNING_KEY_BYTES}.
|
|
102
|
+
*/
|
|
103
|
+
export declare function checkHostedSigningKey(env: HostedEnv, explicit?: Uint8Array | string): void;
|
|
104
|
+
/**
|
|
105
|
+
* Hosted mode from an environment, for `createVgiFetch({ orchardHosted })`.
|
|
106
|
+
*
|
|
107
|
+
* Returns `undefined` when `VGI_ORCHARD_HOSTED` is off. When it is on, returns
|
|
108
|
+
* the validated configuration after checking the environment for any other
|
|
109
|
+
* credential. Cloudflare Workers pass the Worker's `env`; `serveVgiWorker`
|
|
110
|
+
* reads `process.env` itself.
|
|
111
|
+
*
|
|
112
|
+
* @throws OrchardHostedConfigError on any misconfiguration.
|
|
113
|
+
*/
|
|
114
|
+
export declare function orchardHostedFromEnv(env?: HostedEnv): HostedConfig | undefined;
|
|
115
|
+
/** Refuse a non-HTTP transport (stdio, AF_UNIX, TCP, the Iroh raw upstream,
|
|
116
|
+
* a caller-provided byte stream) when hosted mode is on: none carries a Pass. */
|
|
117
|
+
export declare function refuseNonHttpTransportInHostedMode(transport: string, env?: HostedEnv): void;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { type ExternalLocationConfig, type UploadUrlProvider } from "@query-farm/vgi-rpc";
|
|
2
|
+
/** The variables {@link blobVendorHttpConfigFromEnv} reads. */
|
|
3
|
+
export interface BlobVendorEnv {
|
|
4
|
+
VGI_BLOB_VENDOR_URL?: string | undefined;
|
|
5
|
+
VGI_BLOB_VENDOR_TOKEN?: string | undefined;
|
|
6
|
+
VGI_CF_DO_TOKEN?: string | undefined;
|
|
7
|
+
VGI_RPC_EXTERNALIZE_THRESHOLD_BYTES?: string | undefined;
|
|
8
|
+
VGI_RPC_EXTERNAL_COMPRESSION?: string | undefined;
|
|
9
|
+
VGI_RPC_MAX_REQUEST_BYTES?: string | undefined;
|
|
10
|
+
VGI_RPC_MAX_UPLOAD_BYTES?: string | undefined;
|
|
11
|
+
}
|
|
12
|
+
/** HTTP handler options from the blob-vendor environment. Every field is
|
|
13
|
+
* absent when nothing is configured. */
|
|
14
|
+
export interface BlobVendorHttpConfig {
|
|
15
|
+
/** Large results are uploaded to the vendor and replaced by a pointer
|
|
16
|
+
* carrying `vgi_rpc.location.sha256`; inbound pointers are fetched only from
|
|
17
|
+
* the vendor's storage hosts. */
|
|
18
|
+
externalLocation?: ExternalLocationConfig | undefined;
|
|
19
|
+
/** The vendor, vending pre-signed upload URLs (`__upload_url__/init`) so
|
|
20
|
+
* clients can send requests over {@link maxRequestBytes}. */
|
|
21
|
+
uploadUrlProvider?: UploadUrlProvider | undefined;
|
|
22
|
+
/** `VGI_RPC_MAX_UPLOAD_BYTES`, advertised as `VGI-Max-Upload-Bytes`. */
|
|
23
|
+
maxUploadBytes?: number | undefined;
|
|
24
|
+
/** `VGI_RPC_MAX_REQUEST_BYTES`, advertised as `VGI-Max-Request-Bytes` and enforced. */
|
|
25
|
+
maxRequestBytes?: number | undefined;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Read the blob-vendor HTTP settings from `env`.
|
|
29
|
+
*
|
|
30
|
+
* @throws Error if a variable is set but malformed, or the vendor URL is set
|
|
31
|
+
* without a token.
|
|
32
|
+
*/
|
|
33
|
+
export declare function blobVendorHttpConfigFromEnv(env: BlobVendorEnv): BlobVendorHttpConfig;
|
package/dist/http/fetch.d.ts
CHANGED
|
@@ -2,7 +2,16 @@ import { type AuthenticateFn, type PeerAuthenticationPolicy, type PeerIdentityPr
|
|
|
2
2
|
import { type ProtocolConfig } from "../protocol/dispatch.js";
|
|
3
3
|
import { type LandingInfo } from "./landing.js";
|
|
4
4
|
import { type HostingOptions } from "../rpc-server.js";
|
|
5
|
-
|
|
5
|
+
import type { BlobVendorHttpConfig } from "./blob-vendor.js";
|
|
6
|
+
import { type HostedConfig } from "../hosted.js";
|
|
7
|
+
import { type HostedVerifierDeps } from "./hosted-auth.js";
|
|
8
|
+
/**
|
|
9
|
+
* The external-location fields ({@link BlobVendorHttpConfig}) are forwarded to
|
|
10
|
+
* vgi-rpc's handler: spread `blobVendorHttpConfigFromEnv(env)` in to serve
|
|
11
|
+
* through the blob vendor (results over the threshold become pointers, large
|
|
12
|
+
* requests arrive through vended upload URLs).
|
|
13
|
+
*/
|
|
14
|
+
export interface VgiFetchOptions extends HostingOptions, BlobVendorHttpConfig {
|
|
6
15
|
/** Wire-protocol config (registry + catalogInterface). */
|
|
7
16
|
protocol: ProtocolConfig;
|
|
8
17
|
/** HMAC key for state-token signing. Pass a stable, secret 32-byte key
|
|
@@ -22,8 +31,27 @@ export interface VgiFetchOptions extends HostingOptions {
|
|
|
22
31
|
* bytes to use unchanged. Defaults to {@link signingKey}'s bytes.
|
|
23
32
|
*/
|
|
24
33
|
storageSealKey?: Uint8Array | string | undefined;
|
|
25
|
-
/** State-token TTL in seconds (default
|
|
34
|
+
/** State-token TTL in seconds (default 21600, 6 h: vgi-rpc STATE_REF_V1.md). */
|
|
26
35
|
tokenTtl?: number | undefined;
|
|
36
|
+
/**
|
|
37
|
+
* vgi-rpc's cursor rule for a stream state token over its turn budget
|
|
38
|
+
* (STATE_REF_V1.md §9). Defaults to `"error"` (`cursor_too_large`): this SDK
|
|
39
|
+
* carries its init request as an `init` StateRef, so a cursor over budget
|
|
40
|
+
* is a bug to surface, not a size to tolerate.
|
|
41
|
+
*/
|
|
42
|
+
cursorRule?: "warn" | "error" | undefined;
|
|
43
|
+
/**
|
|
44
|
+
* The `VGI-Arguments-Ref-Bytes` value advertised when the server vends
|
|
45
|
+
* upload URLs and its storage is a vgi-rpc ObjectStore (protocol 3.4
|
|
46
|
+
* argument references). Defaults to `$VGI_ARGUMENTS_REF_BYTES`, else 4 MiB.
|
|
47
|
+
*/
|
|
48
|
+
argumentsRefBytes?: number | undefined;
|
|
49
|
+
/**
|
|
50
|
+
* Environment read for `VGI_ARGUMENTS_REF_BYTES` and the test switch
|
|
51
|
+
* `VGI_TEST_DISABLE_ARGUMENTS_REF` (a Cloudflare Worker passes its `env`).
|
|
52
|
+
* Defaults to `process.env` where there is one.
|
|
53
|
+
*/
|
|
54
|
+
env?: Readonly<Record<string, string | undefined>> | undefined;
|
|
27
55
|
/** URL path prefix for VGI requests (default "/vgi"). Pass "" to mount at
|
|
28
56
|
* the root, which is what a dedicated single-worker HTTP server wants. */
|
|
29
57
|
prefix?: string | undefined;
|
|
@@ -72,7 +100,30 @@ export interface VgiFetchOptions extends HostingOptions {
|
|
|
72
100
|
peerAuthenticationPolicy?: PeerAuthenticationPolicy | undefined;
|
|
73
101
|
/** Host adapter supplying the physical peer and multiplicity-preserving headers. */
|
|
74
102
|
peerResolutionContext?: ((request: Request) => PeerResolutionOptions | Promise<PeerResolutionOptions>) | undefined;
|
|
103
|
+
/**
|
|
104
|
+
* Orchard hosted mode: accept only Orchard Passes (RFC 9068 JWT access
|
|
105
|
+
* tokens) on every request except `HEAD /health` and CORS preflights. Pass
|
|
106
|
+
* `orchardHostedFromEnv(env)`, which is `undefined` unless
|
|
107
|
+
* `VGI_ORCHARD_HOSTED` is on. `serveVgiWorker` / `createVgiWorkerFetch` set
|
|
108
|
+
* it from `process.env` themselves.
|
|
109
|
+
*
|
|
110
|
+
* Construction throws `OrchardHostedConfigError` when any other way in is
|
|
111
|
+
* configured (`authenticate`, `grantKeys`, `resolveToken`, `mintGrant`, peer
|
|
112
|
+
* identity) or the signing key is not a configured one. CORS is forced open
|
|
113
|
+
* (`*`): the only credential is the bearer Pass.
|
|
114
|
+
*/
|
|
115
|
+
orchardHosted?: HostedConfig | undefined;
|
|
116
|
+
/** Test seam for hosted mode's JWKS fetch and clock. */
|
|
117
|
+
orchardHostedDeps?: HostedVerifierDeps | undefined;
|
|
75
118
|
}
|
|
119
|
+
/**
|
|
120
|
+
* Refuse a `createVgiFetch` configuration that admits a caller without a Pass.
|
|
121
|
+
* Called by `createVgiFetch` whenever `orchardHosted` is set; throws
|
|
122
|
+
* {@link OrchardHostedConfigError}.
|
|
123
|
+
*/
|
|
124
|
+
export declare function checkHostedFetchOptions(opts: VgiFetchOptions): void;
|
|
125
|
+
/** Default state-token TTL: 6 h (vgi-rpc STATE_REF_V1.md, protocol 3.4). */
|
|
126
|
+
export declare const DEFAULT_TOKEN_TTL = 21600;
|
|
76
127
|
/**
|
|
77
128
|
* Build a fetch handler suitable for `export default { fetch }` in a CF
|
|
78
129
|
* Worker module, or for `Bun.serve({ fetch })`. The returned handler is
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { type AuthenticateFn } from "@query-farm/vgi-rpc";
|
|
2
|
+
import { type HostedConfig } from "../hosted.js";
|
|
3
|
+
/** The slice of `fetch` the JWKS client uses. */
|
|
4
|
+
export type JwksFetch = (url: string, init: RequestInit) => Promise<Response>;
|
|
5
|
+
/** Injection points for tests. Production uses the global `fetch` and clock. */
|
|
6
|
+
export interface HostedVerifierDeps {
|
|
7
|
+
/** Fetch used for the JWKS (default `globalThis.fetch`). */
|
|
8
|
+
fetch?: JwksFetch | undefined;
|
|
9
|
+
/** Clock, milliseconds since the epoch (default `Date.now`). */
|
|
10
|
+
now?: (() => number) | undefined;
|
|
11
|
+
/** Operator warnings (JWKS failures). Never receives a credential. Default `console.error`. */
|
|
12
|
+
warn?: ((message: string) => void) | undefined;
|
|
13
|
+
/** Debug lines (per-request rejections). Never receives a credential. Default: off. */
|
|
14
|
+
debug?: ((message: string) => void) | undefined;
|
|
15
|
+
}
|
|
16
|
+
/** The `max-age` directive of a `Cache-Control` header, seconds, or `null`. */
|
|
17
|
+
export declare function cacheControlMaxAge(value: string | null | undefined): number | null;
|
|
18
|
+
/**
|
|
19
|
+
* Build the Pass verifier for `config`: an `AuthenticateFn` returning an
|
|
20
|
+
* `AuthContext` with domain `"orchard"`, principal `sub` and the Pass's claims
|
|
21
|
+
* exactly as decoded (booleans stay booleans, numbers stay numbers).
|
|
22
|
+
*
|
|
23
|
+
* It throws `AuthFailure` (401) with reason `missing_credential`,
|
|
24
|
+
* `invalid_credential` or `expired_credential`, and `AuthUnavailableError`
|
|
25
|
+
* (503 with `Retry-After`) when no JWKS within its maximum age can be fetched.
|
|
26
|
+
*/
|
|
27
|
+
export declare function hostedAuthenticate(config: HostedConfig, deps?: HostedVerifierDeps): AuthenticateFn;
|
|
28
|
+
/** Whether `fn` was built by {@link hostedAuthenticate}. */
|
|
29
|
+
export declare function isHostedAuthenticate(fn: unknown): boolean;
|
|
30
|
+
/** A hosted gate: the verifier, the `authenticate` to hand vgi-rpc, and the wrapper. */
|
|
31
|
+
export interface HostedGate {
|
|
32
|
+
/** The Pass verifier. */
|
|
33
|
+
readonly verify: AuthenticateFn;
|
|
34
|
+
/**
|
|
35
|
+
* The `authenticate` to give `createHttpHandler`. It returns the identity
|
|
36
|
+
* the gate already verified for this request (re-verifying only if the
|
|
37
|
+
* handler was given a different `Request` object), so a Pass is checked
|
|
38
|
+
* once per request.
|
|
39
|
+
*/
|
|
40
|
+
readonly authenticate: AuthenticateFn;
|
|
41
|
+
/** Put the gate in front of a vgi-rpc HTTP handler mounted at `prefix`. */
|
|
42
|
+
wrap(handler: (req: Request) => Promise<Response> | Response, prefix: string): (req: Request) => Promise<Response>;
|
|
43
|
+
}
|
|
44
|
+
/** Build the hosted-mode request gate for `config`. */
|
|
45
|
+
export declare function createHostedGate(config: HostedConfig, deps?: HostedVerifierDeps): HostedGate;
|
package/dist/index.core.d.ts
CHANGED
|
@@ -18,7 +18,9 @@ export * from "./catalog/public-codecs.js";
|
|
|
18
18
|
export { CompositeCatalogInterface } from "./catalog/composite.js";
|
|
19
19
|
export { FunctionRegistry } from "./functions/registry.js";
|
|
20
20
|
export { FunctionType, FunctionStability, NullHandling, ArgumentMonotonicity, OrderPreservation, OrderDependence, DistinctDependence, TableInOutPhase, DEFAULT_MAX_WORKERS, } from "./types.js";
|
|
21
|
-
export type { BindRequest, BindResponse, BindRepeatability, CopyFromContext, CopyToContext, InitRequest, GlobalInitResponse, TableCardinality, } from "./protocol/types.js";
|
|
21
|
+
export type { ArgumentsLocation, BindRequest, BindResponse, BindRepeatability, CopyFromContext, CopyToContext, InitRequest, GlobalInitResponse, TableCardinality, } from "./protocol/types.js";
|
|
22
|
+
export { decodeBindCall, bindCallBytes, receivedBindCall } from "./protocol/serializers/bind.js";
|
|
23
|
+
export { resolveBindCall, argumentsResolved, argumentsRefBytesFromEnv, argumentsRefHeaderValue, ARGUMENTS_REF_BYTES_HEADER, ARGUMENTS_REF_BYTES_ENV, DEFAULT_ARGUMENTS_REF_BYTES, DISABLE_ARGUMENTS_REF_ENV, ARGUMENTS_REF_MISSING_KIND, ARGUMENTS_REF_MISSING_MESSAGE, INVALID_BIND_REQUEST_KIND, INVALID_BIND_REQUEST_MESSAGE, INVALID_ARGUMENTS_REF_KIND, } from "./protocol/arguments-ref.js";
|
|
22
24
|
export type { ScanSplit, PlanResult, TableFunctionPlanRequest, } from "./protocol/serializers/splits.js";
|
|
23
25
|
export { type FieldPath, type FieldPathInit, buildFieldPath, encodeFieldPath, decodeFieldPath, type TransformSpec, type TransformSpecInit, buildTransformSpec, encodeTransformSpec, decodeTransformSpec, type KeyGrouping, type KeyGroupingInit, buildKeyGrouping, encodeKeyGrouping, decodeKeyGrouping, type RangeKey, type RangeKeyInit, buildRangeKey, encodeRangeKey, decodeRangeKey, type RangePartitioning, type RangePartitioningInit, buildRangePartitioning, encodeRangePartitioning, decodeRangePartitioning, } from "./generated/vgi-protocol-types.js";
|
|
24
26
|
export { Arguments } from "./arguments/arguments.js";
|
|
@@ -44,12 +46,15 @@ export { toUint8Array } from "./util/bytes.js";
|
|
|
44
46
|
export { iterRows, batchFromRows, batchFromColumns, emptyBatch, filterBatch, projectSchema, projectBatch, batchToScalarDict, batchToSecretDict, safeNumber, } from "./util/arrow/index.js";
|
|
45
47
|
export { type SecretFields, type SecretsDict, secretType, secretsOfType, secretOfType, requireSecretOfType, secretByName, secretForScope, secretForScopeOfType, } from "./secrets/helpers.js";
|
|
46
48
|
export { type RequiredSecret, type SecretRequirement, type SecretRequirementSpec, normalizeRequiredSecrets, } from "./secrets/requirements.js";
|
|
49
|
+
export type { SecretLookupFields } from "./secrets/lookups.js";
|
|
47
50
|
export { serializeSchema, deserializeSchema, serializeBatch, deserializeBatch, } from "./util/arrow/index.js";
|
|
48
51
|
export { schema, field, nullType, int8, int16, int64, uint8, uint16, uint32, uint64, float16, float64, utf8, largeUtf8, binary, largeBinary, fixedSizeBinary, decimal, decimal128, decimal256, date, dateDay, dateMillisecond, time, timeSecond, timeMillisecond, timeMicrosecond, timeNanosecond, timestamp, duration, interval, timestampSeconds, timestampMillis, timestampMicros, timestampNanos, durationSeconds, durationMillis, durationMicros, durationNanos, list, fixedSizeList, struct, map, dictionary, union, sparseUnion, denseUnion, TimeUnit, DateUnit, IntervalUnit, UnionMode, codecFor, asDate32, asDate64Ms, asTime32S, asTime32Ms, asTime64Us, asTime64Ns, asTimestampSeconds, asTimestampMillis, asTimestampMicros, asTimestampNanos, asDurationSeconds, asDurationMillis, asDurationMicros, asDurationNanos, asUnscaledDecimal, asInt64, asUint64, fromBranded, fromBrandedNumber, fromBrandedBigInt, TypeId, isNull, isInt, isFloat, isBinary, isUtf8, isBool, isDecimal, isDate, isTime, isTimestamp, isInterval, isList, isStruct, isUnion, isFixedSizeBinary, isFixedSizeList, isMap, isDuration, isDictionary, isBatch, typeSignature, readCanonicalValue, columnFromArray, decodeDictValue, backend, adoptArrowJsShape, } from "./arrow/index.js";
|
|
49
52
|
export type { VgiTypeId, VgiDataType, VgiField, VgiSchema, VgiColumn, VgiColumnData, VgiBatch, VgiBackendInfo, TaggedUnion, NullDescriptor, BoolType, IntType, Int8Type, Int16Type, Int32Type, Int64Type, Uint8Type, Uint16Type, Uint32Type, Uint64Type, FloatType, Utf8Type, LargeUtf8Type, BinaryType, LargeBinaryType, FixedSizeBinaryType, DecimalType, Date32Type, Date64Type, Time32Type, Time64Type, TimestampType, DurationType, IntervalType, ListType, FixedSizeListType, StructType, MapType, DictionaryType, UnionType, TypedField, TUnit, RichValue, RawValue, ValueFor, Repr, Codec, Branded, Date32, Date64Ms, Time32S, Time32Ms, Time64Us, Time64Ns, TimestampSeconds, TimestampMillis, TimestampMicros, TimestampNanos, DurationSeconds, DurationMillis, DurationMicros, DurationNanos, UnscaledDecimal, Int64Raw, Uint64Raw, } from "./arrow/index.js";
|
|
50
53
|
export type { ScalarComputeRow, ScalarOutputValue, ScalarComputeResult } from "./functions/scalar.js";
|
|
51
54
|
export { type FunctionStorage, type WorkerStateKey, FunctionStorageSqlite, BoundStorage, UnknownInvocationError, resolveStorageFromEnv, setStorage, shardKeyOf, storage as functionStorage, } from "./functions/storage.js";
|
|
52
|
-
export { FunctionStorageCfDo, type FetchLike, type CfDoRetryOptions } from "./functions/storage-cf-do.js";
|
|
55
|
+
export { FunctionStorageCfDo, MAX_VALUE_BYTES as CF_DO_MAX_VALUE_BYTES, type FetchLike, type CfDoRetryOptions, } from "./functions/storage-cf-do.js";
|
|
56
|
+
export { ExternalizingStorage, type ExternalizingStorageOptions, StorageBlobError, StorageBlobIntegrityError, StorageBlobMissingError, StorageEnvelopeError, StorageValueTooLargeError, DEFAULT_EXTERNALIZE_BYTES, blobClientFromEnv, externalizeBytesFromEnv, wrapStorageFromEnv, type WrapStorageOptions, } from "./functions/storage-blobs.js";
|
|
57
|
+
export { blobVendorHttpConfigFromEnv, type BlobVendorEnv, type BlobVendorHttpConfig, } from "./http/blob-vendor.js";
|
|
53
58
|
export { StoragePayloadError } from "./functions/storage-seal.js";
|
|
54
59
|
export { VgiClient, VgiClientError } from "./client/client.js";
|
|
55
60
|
export type { VgiClientOptions, TableFunctionOptions, TableFunctionRowsOptions, Int64Mode, ScalarFunctionOptions, TableInOutFunctionOptions, OnCreateConflict, CatalogFunctionType as ClientCatalogFunctionType, CatalogAttachOptions, AttachOptionValue, CatalogSnapshot, LoadCatalogOptions, } from "./client/types.js";
|
|
@@ -59,5 +64,7 @@ export type { RpcClient, StreamSession, LogMessage } from "@query-farm/vgi-rpc";
|
|
|
59
64
|
export { buildRpcServer, grantKeysFromArgv, INTROSPECT_PRINCIPALS_ENV, type BuildRpcServerOptions, type HostingOptions, type ServerTransport, } from "./rpc-server.js";
|
|
60
65
|
export { AuthUnavailableError, GrantKeys, GrantRefusedError, IdentityUnavailableError, StatusError, } from "@query-farm/vgi-rpc";
|
|
61
66
|
export type { GrantMinter, IssuedGrant, TokenIdentity, TokenResolver } from "@query-farm/vgi-rpc";
|
|
67
|
+
export { HOSTED_ENV, HOSTED_CHALLENGE, HOSTED_AUTH_DOMAIN, OrchardHostedConfigError, hostedModeEnabled, resolveHostedConfig, orchardHostedFromEnv, checkHostedEnvironment, checkHostedSigningKey, type HostedConfig, type HostedEnv, } from "./hosted.js";
|
|
68
|
+
export { hostedAuthenticate, isHostedAuthenticate, type HostedVerifierDeps } from "./http/hosted-auth.js";
|
|
62
69
|
export { normalizeSchemaPath, schemaPathDisplay, schemaPathKey, schemaPathsEqual, type SchemaPath } from "./schema-path.js";
|
|
63
70
|
export { SCALAR_PROJECTION_PROFILE, type ProjectionProposal, type ProjectionAcceptance } from "./functions/projection.js";
|