@query-farm/vgi 0.50.1 → 0.52.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 +45 -3
- package/dist/client-entry.js +833 -775
- package/dist/client-entry.js.map +10 -10
- package/dist/functions/aggregate.d.ts +25 -21
- package/dist/functions/execution-cache.d.ts +11 -0
- package/dist/functions/storage-blobs.d.ts +173 -0
- package/dist/functions/storage-cf-do.d.ts +50 -0
- package/dist/functions/storage-seal.d.ts +27 -0
- package/dist/functions/storage.d.ts +71 -1
- package/dist/functions/table-buffering.d.ts +30 -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 +60 -2
- package/dist/http/hosted-auth.d.ts +45 -0
- package/dist/index.core.d.ts +11 -3
- package/dist/index.js +8661 -6677
- package/dist/index.js.map +52 -34
- package/dist/protocol/arguments-ref.d.ts +107 -0
- package/dist/protocol/dispatch.d.ts +12 -2
- package/dist/protocol/handlers/aggregate.d.ts +1 -1
- package/dist/protocol/handlers/catalog/shared.d.ts +10 -0
- package/dist/protocol/handlers/function.d.ts +23 -0
- package/dist/protocol/handlers/table-buffering.d.ts +1 -1
- 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 +32 -0
- package/dist/secrets/lookups.d.ts +31 -0
- package/dist/serve-entry.d.ts +41 -6
- package/dist/serve-entry.js +8531 -6302
- package/dist/serve-entry.js.map +52 -35
- package/dist/worker-cf-entry.d.ts +5 -0
- package/dist/worker-cf-entry.js +7191 -4990
- package/dist/worker-cf-entry.js.map +59 -41
- package/package.json +5 -4
- package/src/functions/aggregate.ts +101 -152
- package/src/functions/copy-from.ts +2 -2
- package/src/functions/execution-cache.ts +59 -0
- package/src/functions/storage-blobs.ts +654 -0
- package/src/functions/storage-cf-do.ts +176 -22
- package/src/functions/storage-seal.ts +208 -0
- package/src/functions/storage.ts +174 -8
- package/src/functions/table-buffering.ts +104 -18
- package/src/functions/table-in-out.ts +3 -1
- package/src/functions/table.ts +12 -8
- 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 +179 -8
- package/src/http/hosted-auth.ts +326 -0
- package/src/index.core.ts +66 -1
- package/src/protocol/arguments-ref.ts +260 -0
- package/src/protocol/dispatch.ts +15 -4
- package/src/protocol/handlers/aggregate.ts +123 -82
- package/src/protocol/handlers/catalog/shared.ts +20 -0
- package/src/protocol/handlers/function.ts +135 -59
- package/src/protocol/handlers/table-buffering.ts +49 -32
- 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 +33 -0
- package/src/secrets/lookups.ts +53 -0
- package/src/serve-entry.ts +138 -11
- 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/README.md
CHANGED
|
@@ -60,14 +60,14 @@ npm install @query-farm/vgi
|
|
|
60
60
|
|
|
61
61
|
Requires **Node.js ≥ 22.15** or **Bun**.
|
|
62
62
|
|
|
63
|
-
This branch uses **`vgi.v3` / `3.
|
|
63
|
+
This branch uses **`vgi.v3` / `3.4.0`** and requires a matching VGI
|
|
64
64
|
extension. Existing `vgi.v2` extensions need SDK 0.46.x; upgrade the engine-side
|
|
65
65
|
extension and workers together. This release prepares the shared protocol for
|
|
66
66
|
DuckDB 2.0; it does not require upgrading DuckDB itself. See
|
|
67
67
|
[the migration notes](MIGRATION.md#0470--vgiv3).
|
|
68
68
|
|
|
69
69
|
> **Peer dependencies (since 0.3.0).** `@query-farm/apache-arrow` (`^21.1.1`) and
|
|
70
|
-
> `@query-farm/vgi-rpc` (`^0.
|
|
70
|
+
> `@query-farm/vgi-rpc` (`^0.30.0`) are **peerDependencies** — install them directly
|
|
71
71
|
> alongside `@query-farm/vgi`:
|
|
72
72
|
>
|
|
73
73
|
> ```bash
|
|
@@ -585,7 +585,8 @@ It also serves `GET /` (landing page), `GET /describe.json` (catalog contract),
|
|
|
585
585
|
| ----------------- | ------- | ----------------------------------------------------------- |
|
|
586
586
|
| `PORT` | `8787` | Listen port. `0` binds an ephemeral port. |
|
|
587
587
|
| `VGI_SIGNING_KEY` | random | State-token HMAC key, **64 hex chars** (`openssl rand -hex 32`). |
|
|
588
|
-
| `VGI_TOKEN_TTL` | `
|
|
588
|
+
| `VGI_TOKEN_TTL` | `21600` | State-token lifetime in seconds (6 h). |
|
|
589
|
+
| `VGI_ARGUMENTS_REF_BYTES` | `4194304` | Argument size above which clients send an argument reference (see *Large values*). |
|
|
589
590
|
| `CORS_ORIGINS` | `*` | Allowed origins. Pass `corsOrigins: null` to disable CORS. |
|
|
590
591
|
|
|
591
592
|
Every variable has an explicit option that takes precedence over it.
|
|
@@ -605,6 +606,47 @@ its own required `name`/`doc`/`version`, so only the Cloudflare entry passes it
|
|
|
605
606
|
explicitly. Without it there is no landing page and no `/vgi-client.js`; see
|
|
606
607
|
[MIGRATION.md](MIGRATION.md).
|
|
607
608
|
|
|
609
|
+
### Large values (protocol 3.4)
|
|
610
|
+
|
|
611
|
+
Over HTTP a stream has no memory between turns, so everything it needs rides in
|
|
612
|
+
its sealed state token. Two things keep that token small however large the
|
|
613
|
+
query's values get (vgi `docs/large-values-3.4.md`):
|
|
614
|
+
|
|
615
|
+
- **Argument references.** A worker that vends upload URLs over an object store
|
|
616
|
+
(`VGI_BLOB_VENDOR_URL`, or any vgi-rpc `ObjectStore`) advertises
|
|
617
|
+
`VGI-Arguments-Ref-Bytes` (default 4 MiB, `VGI_ARGUMENTS_REF_BYTES` or the
|
|
618
|
+
`argumentsRefBytes` option). Arguments above that size are uploaded once by
|
|
619
|
+
the client and every request carries a small `arguments_location` instead of
|
|
620
|
+
the value. The framework resolves it at the entry of each request (through
|
|
621
|
+
vgi-rpc's object cache, one storage read per object per process), so
|
|
622
|
+
`bindCall.arguments` always holds the value in function code. A bind call
|
|
623
|
+
re-encodes as the bytes it was received as, so the reference, never the
|
|
624
|
+
value, goes back on the wire, into a state token or into storage.
|
|
625
|
+
- **`init: StateRef`.** A stream carries its init request (bind call, filters,
|
|
626
|
+
join keys, split tokens) and init response as one vgi-rpc `StateRef`: inline
|
|
627
|
+
and compressed when small, stored once and named by a ~130-byte tag when
|
|
628
|
+
large. Its state tokens live 6 hours, and a cursor over the request budget is
|
|
629
|
+
a hard `cursor_too_large` error (`cursorRule: "error"`).
|
|
630
|
+
|
|
631
|
+
A prepared statement whose large argument has expired (objects live about a
|
|
632
|
+
day) fails with `this prepared statement's large argument has expired; prepare
|
|
633
|
+
it again`.
|
|
634
|
+
|
|
635
|
+
### Orchard hosted mode (`VGI_ORCHARD_HOSTED=1`)
|
|
636
|
+
|
|
637
|
+
Set `VGI_ORCHARD_HOSTED=1` with `VGI_JWT_ISSUER`, `VGI_JWT_AUDIENCE`,
|
|
638
|
+
`VGI_JWT_JWKS_URI` and a stable `VGI_SIGNING_KEY`, and `serveVgiWorker` serves only
|
|
639
|
+
callers holding an Orchard *Pass* (an ES256 RFC 9068 JWT access token, verified
|
|
640
|
+
locally against the Front Desk's JWKS). Every request except `HEAD /health` and CORS
|
|
641
|
+
preflights needs one; anything else gets a 401 with
|
|
642
|
+
`WWW-Authenticate: Bearer error="invalid_token"`. Startup fails closed on a missing or
|
|
643
|
+
multi-valued setting and on any other way in (bearer tokens, grant keys,
|
|
644
|
+
`resolveToken`/`mintGrant`, a custom `authenticate`, peer identity, a non-HTTP
|
|
645
|
+
transport). Function code reads the Pass's claims from `info.auth` (domain
|
|
646
|
+
`"orchard"`, principal `sub`). Works on Bun, Node and Cloudflare Workers
|
|
647
|
+
(`createVgiFetch({ ..., orchardHosted: orchardHostedFromEnv(env) })`). See
|
|
648
|
+
[docs/orchard-hosted.md](docs/orchard-hosted.md).
|
|
649
|
+
|
|
608
650
|
### Hosting additional protocols
|
|
609
651
|
|
|
610
652
|
A worker can serve other [vgi-rpc](https://www.npmjs.com/package/@query-farm/vgi-rpc)
|