@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/client-entry.js +2 -1
- package/dist/client-entry.js.map +4 -4
- package/dist/index.js +46 -3
- package/dist/index.js.map +5 -5
- package/dist/serve-entry.js +45 -3
- package/dist/serve-entry.js.map +4 -4
- package/dist/types.d.ts +1 -0
- package/dist/worker-cf-entry.d.ts +2 -2
- package/dist/worker-cf-entry.js +48 -7
- package/dist/worker-cf-entry.js.map +8 -8
- package/package.json +1 -1
- package/src/http/landing.ts +75 -2
- package/src/protocol/serializers/bind.ts +2 -0
- package/src/types.ts +4 -0
- package/src/worker-cf-entry.ts +7 -0
package/dist/serve-entry.js
CHANGED
|
@@ -2646,6 +2646,8 @@ function deserializeBindRequest(params) {
|
|
|
2646
2646
|
functionType = "scalar" /* SCALAR */;
|
|
2647
2647
|
} else if (ftStr === "table" || ftStr === "TABLE") {
|
|
2648
2648
|
functionType = "table" /* TABLE */;
|
|
2649
|
+
} else if (ftStr === "table_buffering" || ftStr === "TABLE_BUFFERING") {
|
|
2650
|
+
functionType = "table_buffering" /* TABLE_BUFFERING */;
|
|
2649
2651
|
} else if (ftStr === "aggregate" || ftStr === "AGGREGATE") {
|
|
2650
2652
|
functionType = "aggregate" /* AGGREGATE */;
|
|
2651
2653
|
} else {
|
|
@@ -5882,6 +5884,29 @@ var CLIENT_BUNDLE_BYTES = decodeBase642(CLIENT_BUNDLE_B64);
|
|
|
5882
5884
|
|
|
5883
5885
|
// src/http/landing.ts
|
|
5884
5886
|
var DEFAULT_CUPOLA_BASE = "https://cupola.query-farm.services";
|
|
5887
|
+
var REVALIDATE = "public, no-cache";
|
|
5888
|
+
function etagFor(bytes) {
|
|
5889
|
+
let hash = 2166136261;
|
|
5890
|
+
for (let i = 0;i < bytes.length; i++) {
|
|
5891
|
+
hash ^= bytes[i];
|
|
5892
|
+
hash = Math.imul(hash, 16777619) >>> 0;
|
|
5893
|
+
}
|
|
5894
|
+
return `"${hash.toString(16)}-${bytes.length.toString(16)}"`;
|
|
5895
|
+
}
|
|
5896
|
+
var landingEtag = null;
|
|
5897
|
+
var bundleEtag = null;
|
|
5898
|
+
function notModified(request, etag, extra) {
|
|
5899
|
+
const ifNoneMatch = request.headers.get("If-None-Match");
|
|
5900
|
+
if (!ifNoneMatch)
|
|
5901
|
+
return null;
|
|
5902
|
+
const matches = ifNoneMatch.split(",").map((c) => c.trim().replace(/^W\//, "")).includes(etag);
|
|
5903
|
+
if (!matches)
|
|
5904
|
+
return null;
|
|
5905
|
+
const headers = new Headers(extra);
|
|
5906
|
+
headers.set("ETag", etag);
|
|
5907
|
+
headers.set("Cache-Control", REVALIDATE);
|
|
5908
|
+
return new Response(null, { status: 304, headers });
|
|
5909
|
+
}
|
|
5885
5910
|
function createLandingRoutes(info) {
|
|
5886
5911
|
return (request, ctx) => {
|
|
5887
5912
|
const path2 = ctx.url.pathname;
|
|
@@ -5905,14 +5930,31 @@ function createLandingRoutes(info) {
|
|
|
5905
5930
|
ctx.addCorsHeaders(headers2);
|
|
5906
5931
|
return new Response(body, { status: 200, headers: headers2 });
|
|
5907
5932
|
}
|
|
5908
|
-
|
|
5933
|
+
landingEtag ??= etagFor(LANDING_HTML_BYTES);
|
|
5934
|
+
const conditional = notModified(request, landingEtag);
|
|
5935
|
+
if (conditional) {
|
|
5936
|
+
ctx.addCorsHeaders(conditional.headers);
|
|
5937
|
+
return conditional;
|
|
5938
|
+
}
|
|
5939
|
+
const headers = new Headers({
|
|
5940
|
+
"Content-Type": "text/html; charset=utf-8",
|
|
5941
|
+
"Cache-Control": REVALIDATE,
|
|
5942
|
+
ETag: landingEtag
|
|
5943
|
+
});
|
|
5909
5944
|
ctx.addCorsHeaders(headers);
|
|
5910
5945
|
return new Response(LANDING_HTML_BYTES, { status: 200, headers });
|
|
5911
5946
|
}
|
|
5912
5947
|
if (path2 === `${prefix}/vgi-client.js`) {
|
|
5948
|
+
bundleEtag ??= etagFor(CLIENT_BUNDLE_BYTES);
|
|
5949
|
+
const conditional = notModified(request, bundleEtag);
|
|
5950
|
+
if (conditional) {
|
|
5951
|
+
ctx.addCorsHeaders(conditional.headers);
|
|
5952
|
+
return conditional;
|
|
5953
|
+
}
|
|
5913
5954
|
const headers = new Headers({
|
|
5914
5955
|
"Content-Type": "text/javascript; charset=utf-8",
|
|
5915
|
-
"Cache-Control":
|
|
5956
|
+
"Cache-Control": REVALIDATE,
|
|
5957
|
+
ETag: bundleEtag
|
|
5916
5958
|
});
|
|
5917
5959
|
ctx.addCorsHeaders(headers);
|
|
5918
5960
|
return new Response(CLIENT_BUNDLE_BYTES, { status: 200, headers });
|
|
@@ -6053,4 +6095,4 @@ export {
|
|
|
6053
6095
|
DEFAULT_PORT
|
|
6054
6096
|
};
|
|
6055
6097
|
|
|
6056
|
-
//# debugId=
|
|
6098
|
+
//# debugId=D0E9A9375E6AE8FE64756E2164756E21
|