@query-farm/vgi 0.26.1 → 0.28.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/dist/http/fetch.d.ts +12 -4
- package/dist/serve-entry.js +3 -3
- package/dist/serve-entry.js.map +4 -4
- package/dist/worker-cf-entry.js +2 -2
- package/dist/worker-cf-entry.js.map +3 -3
- package/package.json +3 -3
- package/src/http/fetch.ts +14 -5
- package/src/serve-entry.ts +5 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@query-farm/vgi",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.28.0",
|
|
4
4
|
"description": "TypeScript framework for extending DuckDB with user-defined functions via the Vector Gateway Interface (VGI) over Arrow IPC.",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE",
|
|
6
6
|
"author": "Query Farm LLC (https://query.farm)",
|
|
@@ -90,12 +90,12 @@
|
|
|
90
90
|
},
|
|
91
91
|
"peerDependencies": {
|
|
92
92
|
"@query-farm/apache-arrow": "^21.1.1",
|
|
93
|
-
"@query-farm/vgi-rpc": ">=0.
|
|
93
|
+
"@query-farm/vgi-rpc": ">=0.21.0 <0.22.0"
|
|
94
94
|
},
|
|
95
95
|
"devDependencies": {
|
|
96
96
|
"@duckdb/node-api": "^1.5.5-r.4",
|
|
97
97
|
"@query-farm/apache-arrow": "^21.1.1",
|
|
98
|
-
"@query-farm/vgi-rpc": "^0.
|
|
98
|
+
"@query-farm/vgi-rpc": "^0.21.0",
|
|
99
99
|
"@types/bun": "latest",
|
|
100
100
|
"typescript": "^7.0.2"
|
|
101
101
|
},
|
package/src/http/fetch.ts
CHANGED
|
@@ -29,10 +29,18 @@ export interface VgiFetchOptions {
|
|
|
29
29
|
prefix?: string;
|
|
30
30
|
/** Server ID for state-token attribution (default "vgi-cf"). */
|
|
31
31
|
serverId?: string;
|
|
32
|
-
/** CORS allowed origins
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
|
|
32
|
+
/** CORS allowed origins, added to all responses so the preflight `OPTIONS`
|
|
33
|
+
* that browser clients send before `__describe__` succeeds.
|
|
34
|
+
*
|
|
35
|
+
* **Defaults to `"*"`.** A VGI worker exists to be attached and explored, and
|
|
36
|
+
* the hosted Cupola UI reaches it from another origin, so cross-origin is the
|
|
37
|
+
* normal case rather than the exception — and a worker that omits this gets
|
|
38
|
+
* no CORS headers at all, which fails only in a browser and only for someone
|
|
39
|
+
* else's page, i.e. nowhere its author is looking. `serveVgiWorker` has
|
|
40
|
+
* always defaulted this way; this matches it so both entries agree.
|
|
41
|
+
*
|
|
42
|
+
* Pass `null` to disable CORS. */
|
|
43
|
+
corsOrigins?: string | null;
|
|
36
44
|
/** Public source-repository URL, surfaced on the landing page. */
|
|
37
45
|
repositoryUrl?: string;
|
|
38
46
|
/** Worker identity for the standardized VGI landing surface: `GET /` serves
|
|
@@ -92,7 +100,8 @@ export function createVgiFetch(opts: VgiFetchOptions): (req: Request) => Promise
|
|
|
92
100
|
tokenKey: opts.signingKey,
|
|
93
101
|
tokenTtl,
|
|
94
102
|
stateSerializer: arrowStateSerializer,
|
|
95
|
-
|
|
103
|
+
// `null` is the explicit opt-out; `undefined` (omitted) means "*".
|
|
104
|
+
corsOrigins: opts.corsOrigins === null ? undefined : (opts.corsOrigins ?? "*"),
|
|
96
105
|
repositoryUrl: opts.repositoryUrl,
|
|
97
106
|
// The landing surface is ours, contributed into vgi-rpc's routing rather
|
|
98
107
|
// than built there. `enableLandingPage: false` drops vgi-rpc's generic
|
package/src/serve-entry.ts
CHANGED
|
@@ -179,9 +179,11 @@ export function createVgiWorkerFetch(
|
|
|
179
179
|
const env = opts.env ?? (process.env as ServeEnv);
|
|
180
180
|
const signingKey = resolveSigningKey(opts.signingKey, env);
|
|
181
181
|
const tokenTtl = resolveTokenTtl(opts.tokenTtl, env);
|
|
182
|
-
// `null` disables CORS
|
|
183
|
-
|
|
184
|
-
|
|
182
|
+
// `null` disables CORS and must stay `null` through to createVgiFetch, which
|
|
183
|
+
// now reads a bare `undefined` as "default to *" — passing `undefined` here to
|
|
184
|
+
// mean "off" would silently re-enable it. `undefined` falls through to the env
|
|
185
|
+
// var and then to that same default.
|
|
186
|
+
const corsOrigins = opts.corsOrigins === null ? null : (opts.corsOrigins ?? env.CORS_ORIGINS);
|
|
185
187
|
|
|
186
188
|
return createVgiFetch({
|
|
187
189
|
protocol: { registry: opts.registry, catalogInterface: opts.catalogInterface },
|