@selvajs/selva 4.21.0-beta.25 → 4.21.0-beta.26
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/build/adapter-node.js +1 -1
- package/build/client/_app/immutable/assets/0.Ct4dsf2W.css +2 -0
- package/build/client/_app/immutable/assets/0.Ct4dsf2W.css.br +0 -0
- package/build/client/_app/immutable/assets/0.Ct4dsf2W.css.gz +0 -0
- package/build/client/_app/immutable/chunks/BUxAHI7i.js +1 -0
- package/build/client/_app/immutable/chunks/BUxAHI7i.js.br +1 -0
- package/build/client/_app/immutable/chunks/BUxAHI7i.js.gz +0 -0
- package/build/client/_app/immutable/chunks/C4PDTpD1.js +6085 -0
- package/build/client/_app/immutable/chunks/C4PDTpD1.js.br +0 -0
- package/build/client/_app/immutable/chunks/C4PDTpD1.js.gz +0 -0
- package/build/client/_app/immutable/entry/{app.UvCzfP6E.js → app.Bqmne5hV.js} +2 -2
- package/build/client/_app/immutable/entry/app.Bqmne5hV.js.br +0 -0
- package/build/client/_app/immutable/entry/app.Bqmne5hV.js.gz +0 -0
- package/build/client/_app/immutable/nodes/21.Dv262ba8.js +1 -0
- package/build/client/_app/immutable/nodes/21.Dv262ba8.js.br +1 -0
- package/build/client/_app/immutable/nodes/21.Dv262ba8.js.gz +0 -0
- package/build/client/_app/version.json +1 -1
- package/build/client/_app/version.json.br +0 -0
- package/build/client/_app/version.json.gz +0 -0
- package/build/server/.vite/manifest.json +11 -10
- package/build/server/_app/immutable/assets/_layout.Ct4dsf2W.css +2 -0
- package/build/server/chunks/capture.js +1 -1
- package/build/server/chunks/compute-profile-D3g1Tuyd.js +92 -0
- package/build/server/chunks/compute-profile-D3g1Tuyd.js.map +1 -0
- package/build/server/chunks/grasshopper.js +6 -1
- package/build/server/chunks/grasshopper.js.map +1 -1
- package/build/server/chunks/instance.js +3 -3
- package/build/server/chunks/internal.js +1 -1
- package/build/server/chunks/package.js +1 -1
- package/build/server/chunks/package.js.map +1 -1
- package/build/server/chunks/server.js +134 -17
- package/build/server/chunks/server.js.map +1 -1
- package/build/server/chunks/solve.js +1 -1
- package/build/server/chunks/solve.server.js +8 -3
- package/build/server/chunks/solve.server.js.map +1 -1
- package/build/server/entries/endpoints/api/v1/compute/_server.ts.js +1 -1
- package/build/server/entries/endpoints/api/v1/definitions/_guid_/solve/_server.ts.js +5 -2
- package/build/server/entries/endpoints/api/v1/definitions/_guid_/solve/_server.ts.js.map +1 -1
- package/build/server/entries/endpoints/api/v1/solves/_solveId_/_server.ts.js +1 -1
- package/build/server/entries/pages/library/_guid_/_page.svelte.js +122 -30
- package/build/server/entries/pages/library/_guid_/_page.svelte.js.map +1 -1
- package/build/server/manifest-full.js +1 -1
- package/build/server/manifest.js +1 -1
- package/build/server/nodes/0.js +2 -2
- package/build/server/nodes/21.js +1 -1
- package/build/server/server.js +1 -1
- package/package.json +9 -9
- package/build/client/_app/immutable/assets/0.DOeouCe4.css +0 -2
- package/build/client/_app/immutable/assets/0.DOeouCe4.css.br +0 -0
- package/build/client/_app/immutable/assets/0.DOeouCe4.css.gz +0 -0
- package/build/client/_app/immutable/chunks/A_2RYLH9.js +0 -1
- package/build/client/_app/immutable/chunks/A_2RYLH9.js.br +0 -1
- package/build/client/_app/immutable/chunks/A_2RYLH9.js.gz +0 -0
- package/build/client/_app/immutable/chunks/BMp0Pt9F.js +0 -6085
- package/build/client/_app/immutable/chunks/BMp0Pt9F.js.br +0 -0
- package/build/client/_app/immutable/chunks/BMp0Pt9F.js.gz +0 -0
- package/build/client/_app/immutable/entry/app.UvCzfP6E.js.br +0 -0
- package/build/client/_app/immutable/entry/app.UvCzfP6E.js.gz +0 -0
- package/build/client/_app/immutable/nodes/21.BAYqxLPV.js +0 -1
- package/build/client/_app/immutable/nodes/21.BAYqxLPV.js.br +0 -1
- package/build/client/_app/immutable/nodes/21.BAYqxLPV.js.gz +0 -0
- package/build/server/_app/immutable/assets/_layout.DOeouCe4.css +0 -2
- package/build/server/chunks/async-solve-Doflh4BJ.js +0 -27
- package/build/server/chunks/async-solve-Doflh4BJ.js.map +0 -1
- /package/build/client/_app/immutable/nodes/{0.BQ4J6cqX.js → 0.BsaBi01M.js} +0 -0
- /package/build/client/_app/immutable/nodes/{0.BQ4J6cqX.js.br → 0.BsaBi01M.js.br} +0 -0
- /package/build/client/_app/immutable/nodes/{0.BQ4J6cqX.js.gz → 0.BsaBi01M.js.gz} +0 -0
|
@@ -213,7 +213,7 @@ function server_data_serializer(event, state) {
|
|
|
213
213
|
let promise_id = 1;
|
|
214
214
|
let max_nodes = -1;
|
|
215
215
|
const iterator = create_async_iterator();
|
|
216
|
-
const global = "
|
|
216
|
+
const global = "__sveltekit_rvuwqj";
|
|
217
217
|
/** @param {number} index */
|
|
218
218
|
function get_replacer(index) {
|
|
219
219
|
/** @param {any} thing */
|
|
@@ -1443,7 +1443,7 @@ async function render_response({ branch, fetched, page_config, status, error = n
|
|
|
1443
1443
|
"crossorigin"
|
|
1444
1444
|
]);
|
|
1445
1445
|
}
|
|
1446
|
-
const global = "
|
|
1446
|
+
const global = "__sveltekit_rvuwqj";
|
|
1447
1447
|
const { data, chunks } = data_serializer.get_data(csp);
|
|
1448
1448
|
if (page_config.ssr && page_config.csr) body += `\n\t\t\t${fetched.map((item) => serialize_data(item, resolve_opts.filterSerializedResponseHeaders, !!(state.prerendering || state.prerender_default === true))).join("\n ")}`;
|
|
1449
1449
|
if (page_config.csr && client) {
|
|
@@ -1467,7 +1467,7 @@ async function render_response({ branch, fetched, page_config, status, error = n
|
|
|
1467
1467
|
}
|
|
1468
1468
|
}
|
|
1469
1469
|
const blocks = [];
|
|
1470
|
-
const properties = [`base: ${base_expression}`, `version: ${s("
|
|
1470
|
+
const properties = [`base: ${base_expression}`, `version: ${s("1795252697999")}`];
|
|
1471
1471
|
if (assets) properties.push(`assets: ${s(assets)}`);
|
|
1472
1472
|
if (client.uses_env_dynamic_public) properties.push(`env: ${load_env_eagerly ? "null" : uneval$1(rendered_env)}`);
|
|
1473
1473
|
if (chunks) {
|
|
@@ -2363,7 +2363,7 @@ function redirect_response(status, location) {
|
|
|
2363
2363
|
* @param {Response} response
|
|
2364
2364
|
*/
|
|
2365
2365
|
function with_version_header(response) {
|
|
2366
|
-
response.headers.set("x-sveltekit-version", "
|
|
2366
|
+
response.headers.set("x-sveltekit-version", "1795252697999");
|
|
2367
2367
|
return response;
|
|
2368
2368
|
}
|
|
2369
2369
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"package.js","names":[],"sources":["../../../package.json"],"sourcesContent":["{\n\t\"name\": \"@selvajs/selva\",\n\t\"version\": \"4.21.0-beta.
|
|
1
|
+
{"version":3,"file":"package.js","names":[],"sources":["../../../package.json"],"sourcesContent":["{\n\t\"name\": \"@selvajs/selva\",\n\t\"version\": \"4.21.0-beta.26\",\n\t\"description\": \"Selva — self-contained Grasshopper-driven web app. Install, configure via .env, deploy.\",\n\t\"license\": \"MIT\",\n\t\"author\": \"VektorNode\",\n\t\"homepage\": \"https://selva.dev\",\n\t\"bugs\": \"https://github.com/VektorNode/selva/issues\",\n\t\"keywords\": [\n\t\t\"grasshopper\",\n\t\t\"rhino\",\n\t\t\"rhino-compute\",\n\t\t\"parametric-design\",\n\t\t\"web-app\",\n\t\t\"sveltekit\"\n\t],\n\t\"publishConfig\": {\n\t\t\"access\": \"public\"\n\t},\n\t\"repository\": {\n\t\t\"type\": \"git\",\n\t\t\"url\": \"git+https://github.com/VektorNode/selva.git\",\n\t\t\"directory\": \"packages/selva\"\n\t},\n\t\"type\": \"module\",\n\t\"main\": \"./build/index.js\",\n\t\"files\": [\n\t\t\"build\",\n\t\t\"templates\"\n\t],\n\t\"engines\": {\n\t\t\"node\": \">=24.0.0\"\n\t},\n\t\"selva\": {\n\t\t\"dataFormat\": 3\n\t},\n\t\"scripts\": {\n\t\t\"dev\": \"vite dev\",\n\t\t\"dev:lan\": \"vite dev --host\",\n\t\t\"build\": \"rimraf build && vite build && node ./scripts/generate-templates.js && node ./scripts/write-runtime-meta.js && node ./scripts/check-build-assets.js\",\n\t\t\"preview\": \"vite preview\",\n\t\t\"start\": \"node build/index.js\",\n\t\t\"clean\": \"rimraf build templates\",\n\t\t\"prepare\": \"svelte-kit sync || echo ''\",\n\t\t\"check\": \"svelte-kit sync && svelte-check --tsconfig ./tsconfig.json\",\n\t\t\"test\": \"vitest run\",\n\t\t\"test:watch\": \"vitest\",\n\t\t\"openapi:generate\": \"node scripts/generate-openapi.js\",\n\t\t\"test:e2e\": \"playwright test\",\n\t\t\"lint\": \"eslint .\",\n\t\t\"lint:types\": \"eslint . --config eslint.typed.config.js\",\n\t\t\"generate:cli-config\": \"node scripts/generate-cli-config.js\"\n\t},\n\t\"dependencies\": {\n\t\t\"@lucide/svelte\": \"catalog:\",\n\t\t\"@supabase/supabase-js\": \"catalog:\",\n\t\t\"@sveltejs/kit\": \"catalog:\",\n\t\t\"bits-ui\": \"catalog:\",\n\t\t\"clsx\": \"catalog:\",\n\t\t\"mode-watcher\": \"catalog:\",\n\t\t\"nodemailer\": \"catalog:\",\n\t\t\"pino\": \"^10.4.0\",\n\t\t\"playwright-core\": \"catalog:\",\n\t\t\"rhino3dm\": \"catalog:\",\n\t\t\"sharp\": \"catalog:\",\n\t\t\"tailwind-merge\": \"catalog:\",\n\t\t\"tailwind-variants\": \"catalog:\",\n\t\t\"three\": \"catalog:\",\n\t\t\"zod\": \"catalog:\"\n\t},\n\t\"optionalDependencies\": {\n\t\t\"@sentry/node\": \"^11.10.0\"\n\t},\n\t\"devDependencies\": {\n\t\t\"@playwright/test\": \"catalog:\",\n\t\t\"@selvajs/compute\": \"workspace:*\",\n\t\t\"@selvajs/config\": \"workspace:*\",\n\t\t\"@selvajs/header-auth-provider\": \"workspace:*\",\n\t\t\"@selvajs/local-provider\": \"workspace:*\",\n\t\t\"@selvajs/mcp\": \"workspace:*\",\n\t\t\"@selvajs/notifications\": \"workspace:*\",\n\t\t\"@selvajs/platform\": \"workspace:*\",\n\t\t\"@selvajs/schemas\": \"workspace:*\",\n\t\t\"@selvajs/server\": \"workspace:*\",\n\t\t\"@selvajs/solve\": \"workspace:*\",\n\t\t\"@selvajs/supabase-provider\": \"workspace:*\",\n\t\t\"@selvajs/ui\": \"workspace:*\",\n\t\t\"@selvajs/visualization\": \"workspace:*\",\n\t\t\"@sveltejs/adapter-node\": \"catalog:\",\n\t\t\"@types/nodemailer\": \"catalog:\",\n\t\t\"@types/three\": \"catalog:\",\n\t\t\"rimraf\": \"catalog:\",\n\t\t\"tw-animate-css\": \"catalog:\",\n\t\t\"vitest\": \"catalog:\"\n\t},\n\t\"imports\": {\n\t\t\"#lib/*\": \"./src/lib/*\"\n\t}\n}\n"],"mappings":""}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { n as getInputItems } from "./traversal.js";
|
|
2
2
|
import { c as stableStringify, d as ErrorCodes, g as isDefinitionRef, h as enableDebugLogging, i as TreeBuilder, l as withSolveMode, n as GrasshopperClient, u as ComputeError } from "./grasshopper.js";
|
|
3
|
-
import { a as
|
|
3
|
+
import { a as raceAbort, c as align8, d as isDisplayItemType, i as KEEPALIVE_PREFERENCE, l as headerBytes, o as serverSourcedInputIds, p as writeHeader, r as KEEPALIVE_INTERVAL_MS, s as BINARY_SOLVE_MEDIA_TYPE, t as ASYNC_PREFERENCE } from "./compute-profile-D3g1Tuyd.js";
|
|
4
4
|
import { createRequire } from "node:module";
|
|
5
5
|
import { randomUUID } from "node:crypto";
|
|
6
6
|
import { promisify } from "node:util";
|
|
@@ -27117,6 +27117,7 @@ function buildServerTiming(parts) {
|
|
|
27117
27117
|
const computeLinkMs = Math.max(0, parts.solveMs - decode - solve - encode);
|
|
27118
27118
|
header += `, rhino_decode;dur=${decode.toFixed(1)}, rhino_solve;dur=${solve.toFixed(1)}, rhino_encode;dur=${encode.toFixed(1)}, compute_link;dur=${computeLinkMs.toFixed(1)}, rhino_cache;dur=${rhino.cacheHit ? 1 : 0}`;
|
|
27119
27119
|
if (rhino.gh !== void 0) header += `, rhino_gh;dur=${rhino.gh.toFixed(1)}`;
|
|
27120
|
+
if (rhino.wait !== void 0) header += `, rhino_wait;dur=${rhino.wait.toFixed(1)}`;
|
|
27120
27121
|
if (rhino.recomputed) header += `, rhino_recomputed;desc="${rhino.recomputed.ran}/${rhino.recomputed.total}"`;
|
|
27121
27122
|
}
|
|
27122
27123
|
if (rhino?.affinity) header += `, rhino_affinity;desc=${rhino.affinity}`;
|
|
@@ -27127,6 +27128,13 @@ function buildServerTiming(parts) {
|
|
|
27127
27128
|
if (parts.defBytes) header += `, def_bytes;desc=${parts.defBytes}`;
|
|
27128
27129
|
return header;
|
|
27129
27130
|
}
|
|
27131
|
+
/**
|
|
27132
|
+
* The fork's slowest-objects profile as an `X-Compute-Profile` value. Names come from the
|
|
27133
|
+
* definition and can be any script; a header value must be ASCII.
|
|
27134
|
+
*/
|
|
27135
|
+
function computeProfileHeader(profile) {
|
|
27136
|
+
return JSON.stringify(profile).replace(/[\u007f-\uffff]/g, (c) => `\\u${c.charCodeAt(0).toString(16).padStart(4, "0")}`);
|
|
27137
|
+
}
|
|
27130
27138
|
/** Rhino.Compute's own default `--timeout`, for a server that can't report its own. */
|
|
27131
27139
|
var DEFAULT_SOLVE_DEADLINE_MS = 1e5;
|
|
27132
27140
|
/**
|
|
@@ -27570,32 +27578,41 @@ var GZIP_LEVEL = 1;
|
|
|
27570
27578
|
var GZIP_MIN_BYTES = 1024;
|
|
27571
27579
|
var COMPUTE_VERSION_HEADER = "X-Selva-Compute-Version";
|
|
27572
27580
|
function buildEnvelope(encoded, result, serverTiming, metrics) {
|
|
27581
|
+
const { body, variant } = encoded;
|
|
27573
27582
|
const headers = {
|
|
27574
|
-
"Content-Type": "application/json",
|
|
27583
|
+
"Content-Type": variant === "binary" ? BINARY_SOLVE_MEDIA_TYPE : "application/json",
|
|
27575
27584
|
"Server-Timing": serverTiming,
|
|
27576
27585
|
[COMPUTE_VERSION_HEADER]: String(1),
|
|
27577
|
-
Vary: "Accept-Encoding"
|
|
27586
|
+
Vary: "Accept, Accept-Encoding"
|
|
27578
27587
|
};
|
|
27579
|
-
|
|
27580
|
-
if (encoding === "gzip") headers["Content-Encoding"] = "gzip";
|
|
27588
|
+
if (variant === "gzip") headers["Content-Encoding"] = "gzip";
|
|
27581
27589
|
headers["Content-Length"] = String(typeof body === "string" ? Buffer.byteLength(body) : body.byteLength);
|
|
27582
27590
|
return {
|
|
27583
27591
|
body,
|
|
27584
|
-
|
|
27592
|
+
variant,
|
|
27585
27593
|
headers,
|
|
27586
27594
|
result,
|
|
27587
27595
|
metrics
|
|
27588
27596
|
};
|
|
27589
27597
|
}
|
|
27590
|
-
/** Whether
|
|
27591
|
-
function
|
|
27592
|
-
return
|
|
27593
|
-
const [
|
|
27594
|
-
if (
|
|
27598
|
+
/** Whether a comma-separated header lists `token` without `q=0`, which is a client refusing it. */
|
|
27599
|
+
function listsToken(header, token) {
|
|
27600
|
+
return header.split(",").some((part) => {
|
|
27601
|
+
const [value, ...params] = part.split(";").map((s) => s.trim().toLowerCase());
|
|
27602
|
+
if (value !== token) return false;
|
|
27595
27603
|
const q = params.find((p) => p.startsWith("q="));
|
|
27596
27604
|
return q === void 0 || Number(q.slice(2)) > 0;
|
|
27597
27605
|
});
|
|
27598
27606
|
}
|
|
27607
|
+
/** Whether an `Accept-Encoding` header takes gzip. */
|
|
27608
|
+
function acceptsGzip(acceptEncoding) {
|
|
27609
|
+
return listsToken(acceptEncoding, "gzip");
|
|
27610
|
+
}
|
|
27611
|
+
/** The form a request with these headers is answered in. Only an explicit `Accept` gets binary. */
|
|
27612
|
+
function responseVariant(headers) {
|
|
27613
|
+
if (listsToken(headers.accept ?? "", "application/vnd.selva.solve+binary")) return "binary";
|
|
27614
|
+
return acceptsGzip(headers.acceptEncoding ?? "") ? "gzip" : "identity";
|
|
27615
|
+
}
|
|
27599
27616
|
/**
|
|
27600
27617
|
* A scheduler cache hit returns the same response object, so a repeat solve reuses its bytes rather
|
|
27601
27618
|
* than paying to serialize and compress them again. Entries live exactly as long as the response.
|
|
@@ -27603,6 +27620,7 @@ function acceptsGzip(acceptEncoding) {
|
|
|
27603
27620
|
* Holds the promise, so callers arriving during the compression share it.
|
|
27604
27621
|
*/
|
|
27605
27622
|
var gzippedBodies = /* @__PURE__ */ new WeakMap();
|
|
27623
|
+
var binaryBodies = /* @__PURE__ */ new WeakMap();
|
|
27606
27624
|
function gzipOnce(response, json, serializedBytes) {
|
|
27607
27625
|
const pending = gzipAsync(Buffer.from(json), { level: GZIP_LEVEL }).then((body) => ({
|
|
27608
27626
|
body,
|
|
@@ -27613,6 +27631,83 @@ function gzipOnce(response, json, serializedBytes) {
|
|
|
27613
27631
|
return pending;
|
|
27614
27632
|
}
|
|
27615
27633
|
/**
|
|
27634
|
+
* Splits every display batch's base64 blob out of `response` and frames the rest (wire format in
|
|
27635
|
+
* `shared/binary-response.ts`). The blobs are already deflated, so only the JSON section is gzipped.
|
|
27636
|
+
*/
|
|
27637
|
+
async function encodeBinary(response, maxBytes) {
|
|
27638
|
+
const serializeStart = performance.now();
|
|
27639
|
+
const blobs = [];
|
|
27640
|
+
let jsonBuffer;
|
|
27641
|
+
try {
|
|
27642
|
+
jsonBuffer = Buffer.from(JSON.stringify(withBlobsSplit(response, blobs)));
|
|
27643
|
+
} catch (err) {
|
|
27644
|
+
if (!(err instanceof RangeError)) throw err;
|
|
27645
|
+
return "too_large";
|
|
27646
|
+
}
|
|
27647
|
+
const blobBytes = blobs.reduce((sum, blob) => sum + blob.byteLength, 0);
|
|
27648
|
+
const serializedBytes = jsonBuffer.byteLength + blobBytes;
|
|
27649
|
+
if (serializedBytes > maxBytes) return "too_large";
|
|
27650
|
+
const serializeMs = performance.now() - serializeStart;
|
|
27651
|
+
const gzipJson = jsonBuffer.byteLength > GZIP_MIN_BYTES;
|
|
27652
|
+
const gzipStart = performance.now();
|
|
27653
|
+
const json = gzipJson ? await gzipAsync(jsonBuffer, { level: GZIP_LEVEL }) : jsonBuffer;
|
|
27654
|
+
const gzipMs = gzipJson ? performance.now() - gzipStart : 0;
|
|
27655
|
+
const lengths = blobs.map((blob) => blob.byteLength);
|
|
27656
|
+
let total = headerBytes(blobs.length) + align8(json.byteLength);
|
|
27657
|
+
for (const length of lengths) total += align8(length);
|
|
27658
|
+
const body = new Uint8Array(total);
|
|
27659
|
+
writeHeader(body, gzipJson ? 1 : 0, json.byteLength, lengths);
|
|
27660
|
+
let offset = headerBytes(blobs.length);
|
|
27661
|
+
body.set(json, offset);
|
|
27662
|
+
offset += align8(json.byteLength);
|
|
27663
|
+
for (const blob of blobs) {
|
|
27664
|
+
body.set(blob, offset);
|
|
27665
|
+
offset += align8(blob.byteLength);
|
|
27666
|
+
}
|
|
27667
|
+
return {
|
|
27668
|
+
body,
|
|
27669
|
+
serializedBytes,
|
|
27670
|
+
serializeMs,
|
|
27671
|
+
gzipMs
|
|
27672
|
+
};
|
|
27673
|
+
}
|
|
27674
|
+
/** A copy of `response` whose display batches point into `blobs`. Leaves `response` untouched: the solve cache still holds it. */
|
|
27675
|
+
function withBlobsSplit(response, blobs) {
|
|
27676
|
+
const { values } = response;
|
|
27677
|
+
if (!Array.isArray(values)) return response;
|
|
27678
|
+
return {
|
|
27679
|
+
...response,
|
|
27680
|
+
values: values.map((value) => {
|
|
27681
|
+
const out = { ...value };
|
|
27682
|
+
for (const key of ["InnerTree", "innerTree"]) {
|
|
27683
|
+
const tree = value[key];
|
|
27684
|
+
if (!tree || typeof tree !== "object") continue;
|
|
27685
|
+
out[key] = Object.fromEntries(Object.entries(tree).map(([path, branch]) => [path, Array.isArray(branch) ? branch.map((item) => splitDisplayItem(item, blobs)) : branch]));
|
|
27686
|
+
}
|
|
27687
|
+
return out;
|
|
27688
|
+
})
|
|
27689
|
+
};
|
|
27690
|
+
}
|
|
27691
|
+
function splitDisplayItem(item, blobs) {
|
|
27692
|
+
const { type, data } = item ?? {};
|
|
27693
|
+
if (typeof type !== "string" || typeof data !== "string" || !isDisplayItemType(type)) return item;
|
|
27694
|
+
let batch;
|
|
27695
|
+
try {
|
|
27696
|
+
batch = JSON.parse(data);
|
|
27697
|
+
} catch {
|
|
27698
|
+
return item;
|
|
27699
|
+
}
|
|
27700
|
+
if (typeof batch?.compressedData !== "string" || batch.compressedData === "") return item;
|
|
27701
|
+
blobs.push(Buffer.from(batch.compressedData, "base64"));
|
|
27702
|
+
return {
|
|
27703
|
+
...item,
|
|
27704
|
+
data: JSON.stringify({
|
|
27705
|
+
...batch,
|
|
27706
|
+
compressedData: { $blob: blobs.length - 1 }
|
|
27707
|
+
})
|
|
27708
|
+
};
|
|
27709
|
+
}
|
|
27710
|
+
/**
|
|
27616
27711
|
* One per solve. The JSON is kept here rather than beside the gzip body: it only has to outlive the
|
|
27617
27712
|
* callers of this flight, who would otherwise each stringify the same response and hold a copy.
|
|
27618
27713
|
*/
|
|
@@ -27633,8 +27728,26 @@ function createResponseEncoder(response, maxBytes) {
|
|
|
27633
27728
|
}
|
|
27634
27729
|
return serialized;
|
|
27635
27730
|
}
|
|
27636
|
-
return { async encode(
|
|
27637
|
-
|
|
27731
|
+
return { async encode(variant) {
|
|
27732
|
+
if (variant === "binary") {
|
|
27733
|
+
let pending = binaryBodies.get(response);
|
|
27734
|
+
const cached = pending !== void 0;
|
|
27735
|
+
if (!pending) {
|
|
27736
|
+
pending = encodeBinary(response, maxBytes);
|
|
27737
|
+
binaryBodies.set(response, pending);
|
|
27738
|
+
pending.catch(() => binaryBodies.delete(response));
|
|
27739
|
+
}
|
|
27740
|
+
const verdict = await pending;
|
|
27741
|
+
if (verdict === "too_large") return verdict;
|
|
27742
|
+
return {
|
|
27743
|
+
body: verdict.body,
|
|
27744
|
+
variant: "binary",
|
|
27745
|
+
serializedBytes: verdict.serializedBytes,
|
|
27746
|
+
serializeMs: cached ? 0 : verdict.serializeMs,
|
|
27747
|
+
gzipMs: cached ? 0 : verdict.gzipMs
|
|
27748
|
+
};
|
|
27749
|
+
}
|
|
27750
|
+
const wantsGzip = variant === "gzip";
|
|
27638
27751
|
let gzipped = wantsGzip ? gzippedBodies.get(response) : void 0;
|
|
27639
27752
|
let serializeMs = 0;
|
|
27640
27753
|
if (!gzipped) {
|
|
@@ -27647,6 +27760,7 @@ function createResponseEncoder(response, maxBytes) {
|
|
|
27647
27760
|
}
|
|
27648
27761
|
if (!wantsGzip || plain.bytes <= GZIP_MIN_BYTES) return {
|
|
27649
27762
|
body: plain.json,
|
|
27763
|
+
variant: "identity",
|
|
27650
27764
|
serializedBytes: plain.bytes,
|
|
27651
27765
|
serializeMs,
|
|
27652
27766
|
gzipMs: 0
|
|
@@ -27658,7 +27772,7 @@ function createResponseEncoder(response, maxBytes) {
|
|
|
27658
27772
|
if (verdict === "too_large") return verdict;
|
|
27659
27773
|
return {
|
|
27660
27774
|
body: verdict.body,
|
|
27661
|
-
|
|
27775
|
+
variant: "gzip",
|
|
27662
27776
|
serializedBytes: verdict.serializedBytes,
|
|
27663
27777
|
serializeMs,
|
|
27664
27778
|
gzipMs: performance.now() - gzipStart
|
|
@@ -27989,7 +28103,10 @@ var SolveEngine = class {
|
|
|
27989
28103
|
if (flight.kind !== "solved") return flight;
|
|
27990
28104
|
let encoded;
|
|
27991
28105
|
try {
|
|
27992
|
-
encoded = await flight.encoder.encode(
|
|
28106
|
+
encoded = await flight.encoder.encode(responseVariant({
|
|
28107
|
+
accept: args.accept,
|
|
28108
|
+
acceptEncoding: args.acceptEncoding
|
|
28109
|
+
}));
|
|
27993
28110
|
} catch (error) {
|
|
27994
28111
|
return {
|
|
27995
28112
|
kind: "compute_error",
|
|
@@ -28021,7 +28138,7 @@ var SolveEngine = class {
|
|
|
28021
28138
|
envelope: buildEnvelope(encoded, response, serverTiming, {
|
|
28022
28139
|
...timing,
|
|
28023
28140
|
serializedBytes,
|
|
28024
|
-
compressedBytes: encoded.
|
|
28141
|
+
compressedBytes: encoded.variant === "identity" ? null : body.byteLength
|
|
28025
28142
|
}),
|
|
28026
28143
|
solveMs,
|
|
28027
28144
|
errorCount: response.errors?.length ?? 0,
|
|
@@ -28301,6 +28418,6 @@ function waitFor(done, ms, signal) {
|
|
|
28301
28418
|
}
|
|
28302
28419
|
});
|
|
28303
28420
|
}
|
|
28304
|
-
export { acceptedResponse as a, respondWithKeepalive as c,
|
|
28421
|
+
export { acceptedResponse as a, respondWithKeepalive as c, storedToResponse as d, wantsAsync as f, SolveEngine as i, responseVariant as l, DEFAULT_SOLVE_DEADLINE_MS as n, computeProfileHeader as o, wantsKeepalive as p, MAX_SOLVE_DEADLINE_MS as r, postedServerSourcedIds as s, AsyncSolveStore as t, solveInputsFromSchema as u };
|
|
28305
28422
|
|
|
28306
28423
|
//# sourceMappingURL=server.js.map
|