@query-farm/vgi 0.26.0 → 0.26.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/dist/index.js CHANGED
@@ -2662,6 +2662,7 @@ var FunctionType;
2662
2662
  ((FunctionType2) => {
2663
2663
  FunctionType2["SCALAR"] = "scalar";
2664
2664
  FunctionType2["TABLE"] = "table";
2665
+ FunctionType2["TABLE_BUFFERING"] = "table_buffering";
2665
2666
  FunctionType2["AGGREGATE"] = "aggregate";
2666
2667
  })(FunctionType ||= {});
2667
2668
  var FunctionStability;
@@ -5197,6 +5198,8 @@ function deserializeBindRequest(params) {
5197
5198
  functionType = "scalar" /* SCALAR */;
5198
5199
  } else if (ftStr === "table" || ftStr === "TABLE") {
5199
5200
  functionType = "table" /* TABLE */;
5201
+ } else if (ftStr === "table_buffering" || ftStr === "TABLE_BUFFERING") {
5202
+ functionType = "table_buffering" /* TABLE_BUFFERING */;
5200
5203
  } else if (ftStr === "aggregate" || ftStr === "AGGREGATE") {
5201
5204
  functionType = "aggregate" /* AGGREGATE */;
5202
5205
  } else {
@@ -10510,6 +10513,29 @@ var CLIENT_BUNDLE_BYTES = decodeBase642(CLIENT_BUNDLE_B64);
10510
10513
 
10511
10514
  // src/http/landing.ts
10512
10515
  var DEFAULT_CUPOLA_BASE = "https://cupola.query-farm.services";
10516
+ var REVALIDATE = "public, no-cache";
10517
+ function etagFor(bytes) {
10518
+ let hash = 2166136261;
10519
+ for (let i = 0;i < bytes.length; i++) {
10520
+ hash ^= bytes[i];
10521
+ hash = Math.imul(hash, 16777619) >>> 0;
10522
+ }
10523
+ return `"${hash.toString(16)}-${bytes.length.toString(16)}"`;
10524
+ }
10525
+ var landingEtag = null;
10526
+ var bundleEtag = null;
10527
+ function notModified(request, etag, extra) {
10528
+ const ifNoneMatch = request.headers.get("If-None-Match");
10529
+ if (!ifNoneMatch)
10530
+ return null;
10531
+ const matches = ifNoneMatch.split(",").map((c) => c.trim().replace(/^W\//, "")).includes(etag);
10532
+ if (!matches)
10533
+ return null;
10534
+ const headers = new Headers(extra);
10535
+ headers.set("ETag", etag);
10536
+ headers.set("Cache-Control", REVALIDATE);
10537
+ return new Response(null, { status: 304, headers });
10538
+ }
10513
10539
  function createLandingRoutes(info) {
10514
10540
  return (request, ctx) => {
10515
10541
  const path2 = ctx.url.pathname;
@@ -10533,14 +10559,31 @@ function createLandingRoutes(info) {
10533
10559
  ctx.addCorsHeaders(headers2);
10534
10560
  return new Response(body, { status: 200, headers: headers2 });
10535
10561
  }
10536
- const headers = new Headers({ "Content-Type": "text/html; charset=utf-8" });
10562
+ landingEtag ??= etagFor(LANDING_HTML_BYTES);
10563
+ const conditional = notModified(request, landingEtag);
10564
+ if (conditional) {
10565
+ ctx.addCorsHeaders(conditional.headers);
10566
+ return conditional;
10567
+ }
10568
+ const headers = new Headers({
10569
+ "Content-Type": "text/html; charset=utf-8",
10570
+ "Cache-Control": REVALIDATE,
10571
+ ETag: landingEtag
10572
+ });
10537
10573
  ctx.addCorsHeaders(headers);
10538
10574
  return new Response(LANDING_HTML_BYTES, { status: 200, headers });
10539
10575
  }
10540
10576
  if (path2 === `${prefix}/vgi-client.js`) {
10577
+ bundleEtag ??= etagFor(CLIENT_BUNDLE_BYTES);
10578
+ const conditional = notModified(request, bundleEtag);
10579
+ if (conditional) {
10580
+ ctx.addCorsHeaders(conditional.headers);
10581
+ return conditional;
10582
+ }
10541
10583
  const headers = new Headers({
10542
10584
  "Content-Type": "text/javascript; charset=utf-8",
10543
- "Cache-Control": "public, max-age=3600"
10585
+ "Cache-Control": REVALIDATE,
10586
+ ETag: bundleEtag
10544
10587
  });
10545
10588
  ctx.addCorsHeaders(headers);
10546
10589
  return new Response(CLIENT_BUNDLE_BYTES, { status: 200, headers });
@@ -11828,4 +11871,4 @@ export {
11828
11871
  ArgumentValidationError
11829
11872
  };
11830
11873
 
11831
- //# debugId=FF5A8B350114CCD964756E2164756E21
11874
+ //# debugId=86694E0569653A9D64756E2164756E21