@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.
@@ -14,10 +14,18 @@ export interface VgiFetchOptions {
14
14
  prefix?: string;
15
15
  /** Server ID for state-token attribution (default "vgi-cf"). */
16
16
  serverId?: string;
17
- /** CORS allowed origins. When set, CORS headers are added to all responses,
18
- * and the preflight `OPTIONS` that browser clients (e.g. the hosted Cupola
19
- * UI) send before `__describe__` will succeed. Omit to disable CORS. */
20
- corsOrigins?: string;
17
+ /** CORS allowed origins, added to all responses so the preflight `OPTIONS`
18
+ * that browser clients send before `__describe__` succeeds.
19
+ *
20
+ * **Defaults to `"*"`.** A VGI worker exists to be attached and explored, and
21
+ * the hosted Cupola UI reaches it from another origin, so cross-origin is the
22
+ * normal case rather than the exception — and a worker that omits this gets
23
+ * no CORS headers at all, which fails only in a browser and only for someone
24
+ * else's page, i.e. nowhere its author is looking. `serveVgiWorker` has
25
+ * always defaulted this way; this matches it so both entries agree.
26
+ *
27
+ * Pass `null` to disable CORS. */
28
+ corsOrigins?: string | null;
21
29
  /** Public source-repository URL, surfaced on the landing page. */
22
30
  repositoryUrl?: string;
23
31
  /** Worker identity for the standardized VGI landing surface: `GET /` serves
@@ -5986,7 +5986,7 @@ function createVgiFetch(opts) {
5986
5986
  tokenKey: opts.signingKey,
5987
5987
  tokenTtl,
5988
5988
  stateSerializer: arrowStateSerializer,
5989
- corsOrigins: opts.corsOrigins,
5989
+ corsOrigins: opts.corsOrigins === null ? undefined : opts.corsOrigins ?? "*",
5990
5990
  repositoryUrl: opts.repositoryUrl,
5991
5991
  extraRoutes: createLandingRoutes(opts.landingInfo),
5992
5992
  enableLandingPage: false
@@ -6054,7 +6054,7 @@ function createVgiWorkerFetch(opts) {
6054
6054
  const env = opts.env ?? process.env;
6055
6055
  const signingKey = resolveSigningKey(opts.signingKey, env);
6056
6056
  const tokenTtl = resolveTokenTtl(opts.tokenTtl, env);
6057
- const corsOrigins = opts.corsOrigins === null ? undefined : opts.corsOrigins ?? env.CORS_ORIGINS ?? "*";
6057
+ const corsOrigins = opts.corsOrigins === null ? null : opts.corsOrigins ?? env.CORS_ORIGINS;
6058
6058
  return createVgiFetch({
6059
6059
  protocol: { registry: opts.registry, catalogInterface: opts.catalogInterface },
6060
6060
  signingKey,
@@ -6095,4 +6095,4 @@ export {
6095
6095
  DEFAULT_PORT
6096
6096
  };
6097
6097
 
6098
- //# debugId=D0E9A9375E6AE8FE64756E2164756E21
6098
+ //# debugId=AF152B2CA425E9C164756E2164756E21