@query-farm/vgi 0.26.0 → 0.27.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/client-entry.js +2 -1
- package/dist/client-entry.js.map +4 -4
- package/dist/http/fetch.d.ts +12 -4
- package/dist/index.js +46 -3
- package/dist/index.js.map +5 -5
- package/dist/serve-entry.js +47 -5
- package/dist/serve-entry.js.map +6 -6
- package/dist/types.d.ts +1 -0
- package/dist/worker-cf-entry.d.ts +2 -2
- package/dist/worker-cf-entry.js +49 -8
- package/dist/worker-cf-entry.js.map +9 -9
- package/package.json +1 -1
- package/src/http/fetch.ts +14 -5
- package/src/http/landing.ts +75 -2
- package/src/protocol/serializers/bind.ts +2 -0
- package/src/serve-entry.ts +5 -3
- package/src/types.ts +4 -0
- package/src/worker-cf-entry.ts +7 -0
package/dist/types.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { createVgiFetch } from "./http/fetch.js";
|
|
2
2
|
export type { VgiFetchOptions } from "./http/fetch.js";
|
|
3
|
-
export { defineScalarFunction, defineTableFunction, defineAggregate, defineTableInOutFunction, defineRowTransformFunction, parentRowsMetadata, PARENT_ROW_METADATA_KEY, constraintSpecFields, FunctionRegistry, ReadOnlyCatalogInterface, CompositeCatalogInterface, CatalogInterface, Arguments, FunctionType, serializeAttachOptionSpec, serializeAttachOptionSpecs, serializeColumnStatistics, BindResultSchema, ScanFunctionResultSchema, } from "./index.core.js";
|
|
4
|
-
export type { AttachOptionSpec, ColumnStatistics, CatalogAttachResult, CatalogDescriptor, CatalogInfo, TableInfo, AttachOpaqueData, TransactionOpaqueData, SchemaInfo, VgiFunction, TableProcessParams, ArgumentSpec, ArgumentConstraints, RowTransformConfig, RowTransformProcessParams, TableInOutBindParams, } from "./index.core.js";
|
|
3
|
+
export { defineScalarFunction, defineTableFunction, defineAggregate, defineTableInOutFunction, defineRowTransformFunction, parentRowsMetadata, PARENT_ROW_METADATA_KEY, constraintSpecFields, cacheControlMetadata, FunctionRegistry, ReadOnlyCatalogInterface, CompositeCatalogInterface, CatalogInterface, Arguments, FunctionType, serializeAttachOptionSpec, serializeAttachOptionSpecs, serializeColumnStatistics, BindResultSchema, ScanFunctionResultSchema, } from "./index.core.js";
|
|
4
|
+
export type { CacheControl, CacheScope, AttachOptionSpec, ColumnStatistics, CatalogAttachResult, CatalogDescriptor, CatalogInfo, TableInfo, AttachOpaqueData, TransactionOpaqueData, SchemaInfo, VgiFunction, TableProcessParams, ArgumentSpec, ArgumentConstraints, RowTransformConfig, RowTransformProcessParams, TableInOutBindParams, } from "./index.core.js";
|
|
5
5
|
export type { ProtocolConfig } from "./protocol/dispatch.js";
|
|
6
6
|
export type { LandingInfo } from "./http/landing.js";
|
|
7
7
|
export { createLandingRoutes } from "./http/landing.js";
|
package/dist/worker-cf-entry.js
CHANGED
|
@@ -2891,6 +2891,7 @@ var FunctionType;
|
|
|
2891
2891
|
((FunctionType2) => {
|
|
2892
2892
|
FunctionType2["SCALAR"] = "scalar";
|
|
2893
2893
|
FunctionType2["TABLE"] = "table";
|
|
2894
|
+
FunctionType2["TABLE_BUFFERING"] = "table_buffering";
|
|
2894
2895
|
FunctionType2["AGGREGATE"] = "aggregate";
|
|
2895
2896
|
})(FunctionType ||= {});
|
|
2896
2897
|
var VGI_ARG_KEY = "vgi_arg";
|
|
@@ -2987,6 +2988,8 @@ function deserializeBindRequest(params) {
|
|
|
2987
2988
|
functionType = "scalar" /* SCALAR */;
|
|
2988
2989
|
} else if (ftStr === "table" || ftStr === "TABLE") {
|
|
2989
2990
|
functionType = "table" /* TABLE */;
|
|
2991
|
+
} else if (ftStr === "table_buffering" || ftStr === "TABLE_BUFFERING") {
|
|
2992
|
+
functionType = "table_buffering" /* TABLE_BUFFERING */;
|
|
2990
2993
|
} else if (ftStr === "aggregate" || ftStr === "AGGREGATE") {
|
|
2991
2994
|
functionType = "aggregate" /* AGGREGATE */;
|
|
2992
2995
|
} else {
|
|
@@ -7251,6 +7254,29 @@ var CLIENT_BUNDLE_BYTES = decodeBase642(CLIENT_BUNDLE_B64);
|
|
|
7251
7254
|
|
|
7252
7255
|
// src/http/landing.ts
|
|
7253
7256
|
var DEFAULT_CUPOLA_BASE = "https://cupola.query-farm.services";
|
|
7257
|
+
var REVALIDATE = "public, no-cache";
|
|
7258
|
+
function etagFor(bytes) {
|
|
7259
|
+
let hash = 2166136261;
|
|
7260
|
+
for (let i = 0;i < bytes.length; i++) {
|
|
7261
|
+
hash ^= bytes[i];
|
|
7262
|
+
hash = Math.imul(hash, 16777619) >>> 0;
|
|
7263
|
+
}
|
|
7264
|
+
return `"${hash.toString(16)}-${bytes.length.toString(16)}"`;
|
|
7265
|
+
}
|
|
7266
|
+
var landingEtag = null;
|
|
7267
|
+
var bundleEtag = null;
|
|
7268
|
+
function notModified(request, etag, extra) {
|
|
7269
|
+
const ifNoneMatch = request.headers.get("If-None-Match");
|
|
7270
|
+
if (!ifNoneMatch)
|
|
7271
|
+
return null;
|
|
7272
|
+
const matches = ifNoneMatch.split(",").map((c) => c.trim().replace(/^W\//, "")).includes(etag);
|
|
7273
|
+
if (!matches)
|
|
7274
|
+
return null;
|
|
7275
|
+
const headers = new Headers(extra);
|
|
7276
|
+
headers.set("ETag", etag);
|
|
7277
|
+
headers.set("Cache-Control", REVALIDATE);
|
|
7278
|
+
return new Response(null, { status: 304, headers });
|
|
7279
|
+
}
|
|
7254
7280
|
function createLandingRoutes(info) {
|
|
7255
7281
|
return (request, ctx) => {
|
|
7256
7282
|
const path2 = ctx.url.pathname;
|
|
@@ -7274,14 +7300,31 @@ function createLandingRoutes(info) {
|
|
|
7274
7300
|
ctx.addCorsHeaders(headers2);
|
|
7275
7301
|
return new Response(body, { status: 200, headers: headers2 });
|
|
7276
7302
|
}
|
|
7277
|
-
|
|
7303
|
+
landingEtag ??= etagFor(LANDING_HTML_BYTES);
|
|
7304
|
+
const conditional = notModified(request, landingEtag);
|
|
7305
|
+
if (conditional) {
|
|
7306
|
+
ctx.addCorsHeaders(conditional.headers);
|
|
7307
|
+
return conditional;
|
|
7308
|
+
}
|
|
7309
|
+
const headers = new Headers({
|
|
7310
|
+
"Content-Type": "text/html; charset=utf-8",
|
|
7311
|
+
"Cache-Control": REVALIDATE,
|
|
7312
|
+
ETag: landingEtag
|
|
7313
|
+
});
|
|
7278
7314
|
ctx.addCorsHeaders(headers);
|
|
7279
7315
|
return new Response(LANDING_HTML_BYTES, { status: 200, headers });
|
|
7280
7316
|
}
|
|
7281
7317
|
if (path2 === `${prefix}/vgi-client.js`) {
|
|
7318
|
+
bundleEtag ??= etagFor(CLIENT_BUNDLE_BYTES);
|
|
7319
|
+
const conditional = notModified(request, bundleEtag);
|
|
7320
|
+
if (conditional) {
|
|
7321
|
+
ctx.addCorsHeaders(conditional.headers);
|
|
7322
|
+
return conditional;
|
|
7323
|
+
}
|
|
7282
7324
|
const headers = new Headers({
|
|
7283
7325
|
"Content-Type": "text/javascript; charset=utf-8",
|
|
7284
|
-
"Cache-Control":
|
|
7326
|
+
"Cache-Control": REVALIDATE,
|
|
7327
|
+
ETag: bundleEtag
|
|
7285
7328
|
});
|
|
7286
7329
|
ctx.addCorsHeaders(headers);
|
|
7287
7330
|
return new Response(CLIENT_BUNDLE_BYTES, { status: 200, headers });
|
|
@@ -7313,16 +7356,13 @@ function createVgiFetch(opts) {
|
|
|
7313
7356
|
tokenKey: opts.signingKey,
|
|
7314
7357
|
tokenTtl,
|
|
7315
7358
|
stateSerializer: arrowStateSerializer,
|
|
7316
|
-
corsOrigins: opts.corsOrigins,
|
|
7359
|
+
corsOrigins: opts.corsOrigins === null ? undefined : opts.corsOrigins ?? "*",
|
|
7317
7360
|
repositoryUrl: opts.repositoryUrl,
|
|
7318
7361
|
extraRoutes: createLandingRoutes(opts.landingInfo),
|
|
7319
7362
|
enableLandingPage: false
|
|
7320
7363
|
});
|
|
7321
7364
|
return async (req) => handler(req);
|
|
7322
7365
|
}
|
|
7323
|
-
// src/functions/scalar.ts
|
|
7324
|
-
init_arrow();
|
|
7325
|
-
|
|
7326
7366
|
// src/cache-control.ts
|
|
7327
7367
|
var CACHE_TTL_KEY = "vgi.cache.ttl";
|
|
7328
7368
|
var CACHE_EXPIRES_KEY = "vgi.cache.expires";
|
|
@@ -7378,8 +7418,8 @@ function cacheControlMetadata(cc, extra) {
|
|
|
7378
7418
|
md.set(CACHE_PER_VALUE_KEY, "1");
|
|
7379
7419
|
return md;
|
|
7380
7420
|
}
|
|
7381
|
-
|
|
7382
7421
|
// src/functions/scalar.ts
|
|
7422
|
+
init_arrow();
|
|
7383
7423
|
function defineScalarFunction(config) {
|
|
7384
7424
|
const repr = config.repr ?? "rich";
|
|
7385
7425
|
const specs = [];
|
|
@@ -9492,6 +9532,7 @@ export {
|
|
|
9492
9532
|
createLandingRoutes,
|
|
9493
9533
|
constraintSpecFields,
|
|
9494
9534
|
columnFromArray,
|
|
9535
|
+
cacheControlMetadata,
|
|
9495
9536
|
buildStatisticsBatch,
|
|
9496
9537
|
bool2 as bool,
|
|
9497
9538
|
binary2 as binary,
|
|
@@ -9520,4 +9561,4 @@ export {
|
|
|
9520
9561
|
Arguments
|
|
9521
9562
|
};
|
|
9522
9563
|
|
|
9523
|
-
//# debugId=
|
|
9564
|
+
//# debugId=A753E54332CCB1AB64756E2164756E21
|