@selvajs/selva 4.21.0-beta.25 → 4.21.0-beta.27
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/BQZN0u9q.js +1 -0
- package/build/client/_app/immutable/chunks/BQZN0u9q.js.br +1 -0
- package/build/client/_app/immutable/chunks/BQZN0u9q.js.gz +0 -0
- package/build/client/_app/immutable/chunks/{BMp0Pt9F.js → CLqXGk8r.js} +53 -53
- package/build/client/_app/immutable/chunks/CLqXGk8r.js.br +0 -0
- package/build/client/_app/immutable/chunks/CLqXGk8r.js.gz +0 -0
- package/build/client/_app/immutable/entry/{app.UvCzfP6E.js → app.DrB4p41y.js} +2 -2
- package/build/client/_app/immutable/entry/app.DrB4p41y.js.br +0 -0
- package/build/client/_app/immutable/entry/app.DrB4p41y.js.gz +0 -0
- package/build/client/_app/immutable/nodes/21.SQ-lrVC6.js +1 -0
- package/build/client/_app/immutable/nodes/21.SQ-lrVC6.js.br +0 -0
- package/build/client/_app/immutable/nodes/21.SQ-lrVC6.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 +135 -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/endpoints/mcp/_server.ts.js +0 -1
- package/build/server/entries/endpoints/mcp/_server.ts.js.map +1 -1
- package/build/server/entries/pages/library/_guid_/_page.server.ts.js +9 -4
- package/build/server/entries/pages/library/_guid_/_page.server.ts.js.map +1 -1
- package/build/server/entries/pages/library/_guid_/_page.svelte.js +134 -33
- 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 +8 -8
- 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.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_v4z27m";
|
|
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_v4z27m";
|
|
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("1795255483257")}`];
|
|
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", "1795255483257");
|
|
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.27\",\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,42 @@ 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,
|
|
27593
|
+
...variant === "gzip" ? { encoding: "gzip" } : {},
|
|
27585
27594
|
headers,
|
|
27586
27595
|
result,
|
|
27587
27596
|
metrics
|
|
27588
27597
|
};
|
|
27589
27598
|
}
|
|
27590
|
-
/** Whether
|
|
27591
|
-
function
|
|
27592
|
-
return
|
|
27593
|
-
const [
|
|
27594
|
-
if (
|
|
27599
|
+
/** Whether a comma-separated header lists `token` without `q=0`, which is a client refusing it. */
|
|
27600
|
+
function listsToken(header, token) {
|
|
27601
|
+
return header.split(",").some((part) => {
|
|
27602
|
+
const [value, ...params] = part.split(";").map((s) => s.trim().toLowerCase());
|
|
27603
|
+
if (value !== token) return false;
|
|
27595
27604
|
const q = params.find((p) => p.startsWith("q="));
|
|
27596
27605
|
return q === void 0 || Number(q.slice(2)) > 0;
|
|
27597
27606
|
});
|
|
27598
27607
|
}
|
|
27608
|
+
/** Whether an `Accept-Encoding` header takes gzip. */
|
|
27609
|
+
function acceptsGzip(acceptEncoding) {
|
|
27610
|
+
return listsToken(acceptEncoding, "gzip");
|
|
27611
|
+
}
|
|
27612
|
+
/** The form a request with these headers is answered in. Only an explicit `Accept` gets binary. */
|
|
27613
|
+
function responseVariant(headers) {
|
|
27614
|
+
if (listsToken(headers.accept ?? "", "application/vnd.selva.solve+binary")) return "binary";
|
|
27615
|
+
return acceptsGzip(headers.acceptEncoding ?? "") ? "gzip" : "identity";
|
|
27616
|
+
}
|
|
27599
27617
|
/**
|
|
27600
27618
|
* A scheduler cache hit returns the same response object, so a repeat solve reuses its bytes rather
|
|
27601
27619
|
* than paying to serialize and compress them again. Entries live exactly as long as the response.
|
|
@@ -27603,6 +27621,7 @@ function acceptsGzip(acceptEncoding) {
|
|
|
27603
27621
|
* Holds the promise, so callers arriving during the compression share it.
|
|
27604
27622
|
*/
|
|
27605
27623
|
var gzippedBodies = /* @__PURE__ */ new WeakMap();
|
|
27624
|
+
var binaryBodies = /* @__PURE__ */ new WeakMap();
|
|
27606
27625
|
function gzipOnce(response, json, serializedBytes) {
|
|
27607
27626
|
const pending = gzipAsync(Buffer.from(json), { level: GZIP_LEVEL }).then((body) => ({
|
|
27608
27627
|
body,
|
|
@@ -27613,6 +27632,83 @@ function gzipOnce(response, json, serializedBytes) {
|
|
|
27613
27632
|
return pending;
|
|
27614
27633
|
}
|
|
27615
27634
|
/**
|
|
27635
|
+
* Splits every display batch's base64 blob out of `response` and frames the rest (wire format in
|
|
27636
|
+
* `shared/binary-response.ts`). The blobs are already deflated, so only the JSON section is gzipped.
|
|
27637
|
+
*/
|
|
27638
|
+
async function encodeBinary(response, maxBytes) {
|
|
27639
|
+
const serializeStart = performance.now();
|
|
27640
|
+
const blobs = [];
|
|
27641
|
+
let jsonBuffer;
|
|
27642
|
+
try {
|
|
27643
|
+
jsonBuffer = Buffer.from(JSON.stringify(withBlobsSplit(response, blobs)));
|
|
27644
|
+
} catch (err) {
|
|
27645
|
+
if (!(err instanceof RangeError)) throw err;
|
|
27646
|
+
return "too_large";
|
|
27647
|
+
}
|
|
27648
|
+
const blobBytes = blobs.reduce((sum, blob) => sum + blob.byteLength, 0);
|
|
27649
|
+
const serializedBytes = jsonBuffer.byteLength + blobBytes;
|
|
27650
|
+
if (serializedBytes > maxBytes) return "too_large";
|
|
27651
|
+
const serializeMs = performance.now() - serializeStart;
|
|
27652
|
+
const gzipJson = jsonBuffer.byteLength > GZIP_MIN_BYTES;
|
|
27653
|
+
const gzipStart = performance.now();
|
|
27654
|
+
const json = gzipJson ? await gzipAsync(jsonBuffer, { level: GZIP_LEVEL }) : jsonBuffer;
|
|
27655
|
+
const gzipMs = gzipJson ? performance.now() - gzipStart : 0;
|
|
27656
|
+
const lengths = blobs.map((blob) => blob.byteLength);
|
|
27657
|
+
let total = headerBytes(blobs.length) + align8(json.byteLength);
|
|
27658
|
+
for (const length of lengths) total += align8(length);
|
|
27659
|
+
const body = new Uint8Array(total);
|
|
27660
|
+
writeHeader(body, gzipJson ? 1 : 0, json.byteLength, lengths);
|
|
27661
|
+
let offset = headerBytes(blobs.length);
|
|
27662
|
+
body.set(json, offset);
|
|
27663
|
+
offset += align8(json.byteLength);
|
|
27664
|
+
for (const blob of blobs) {
|
|
27665
|
+
body.set(blob, offset);
|
|
27666
|
+
offset += align8(blob.byteLength);
|
|
27667
|
+
}
|
|
27668
|
+
return {
|
|
27669
|
+
body,
|
|
27670
|
+
serializedBytes,
|
|
27671
|
+
serializeMs,
|
|
27672
|
+
gzipMs
|
|
27673
|
+
};
|
|
27674
|
+
}
|
|
27675
|
+
/** A copy of `response` whose display batches point into `blobs`. Leaves `response` untouched: the solve cache still holds it. */
|
|
27676
|
+
function withBlobsSplit(response, blobs) {
|
|
27677
|
+
const { values } = response;
|
|
27678
|
+
if (!Array.isArray(values)) return response;
|
|
27679
|
+
return {
|
|
27680
|
+
...response,
|
|
27681
|
+
values: values.map((value) => {
|
|
27682
|
+
const out = { ...value };
|
|
27683
|
+
for (const key of ["InnerTree", "innerTree"]) {
|
|
27684
|
+
const tree = value[key];
|
|
27685
|
+
if (!tree || typeof tree !== "object") continue;
|
|
27686
|
+
out[key] = Object.fromEntries(Object.entries(tree).map(([path, branch]) => [path, Array.isArray(branch) ? branch.map((item) => splitDisplayItem(item, blobs)) : branch]));
|
|
27687
|
+
}
|
|
27688
|
+
return out;
|
|
27689
|
+
})
|
|
27690
|
+
};
|
|
27691
|
+
}
|
|
27692
|
+
function splitDisplayItem(item, blobs) {
|
|
27693
|
+
const { type, data } = item ?? {};
|
|
27694
|
+
if (typeof type !== "string" || typeof data !== "string" || !isDisplayItemType(type)) return item;
|
|
27695
|
+
let batch;
|
|
27696
|
+
try {
|
|
27697
|
+
batch = JSON.parse(data);
|
|
27698
|
+
} catch {
|
|
27699
|
+
return item;
|
|
27700
|
+
}
|
|
27701
|
+
if (typeof batch?.compressedData !== "string" || batch.compressedData === "") return item;
|
|
27702
|
+
blobs.push(Buffer.from(batch.compressedData, "base64"));
|
|
27703
|
+
return {
|
|
27704
|
+
...item,
|
|
27705
|
+
data: JSON.stringify({
|
|
27706
|
+
...batch,
|
|
27707
|
+
compressedData: { $blob: blobs.length - 1 }
|
|
27708
|
+
})
|
|
27709
|
+
};
|
|
27710
|
+
}
|
|
27711
|
+
/**
|
|
27616
27712
|
* One per solve. The JSON is kept here rather than beside the gzip body: it only has to outlive the
|
|
27617
27713
|
* callers of this flight, who would otherwise each stringify the same response and hold a copy.
|
|
27618
27714
|
*/
|
|
@@ -27633,8 +27729,26 @@ function createResponseEncoder(response, maxBytes) {
|
|
|
27633
27729
|
}
|
|
27634
27730
|
return serialized;
|
|
27635
27731
|
}
|
|
27636
|
-
return { async encode(
|
|
27637
|
-
|
|
27732
|
+
return { async encode(variant) {
|
|
27733
|
+
if (variant === "binary") {
|
|
27734
|
+
let pending = binaryBodies.get(response);
|
|
27735
|
+
const cached = pending !== void 0;
|
|
27736
|
+
if (!pending) {
|
|
27737
|
+
pending = encodeBinary(response, maxBytes);
|
|
27738
|
+
binaryBodies.set(response, pending);
|
|
27739
|
+
pending.catch(() => binaryBodies.delete(response));
|
|
27740
|
+
}
|
|
27741
|
+
const verdict = await pending;
|
|
27742
|
+
if (verdict === "too_large") return verdict;
|
|
27743
|
+
return {
|
|
27744
|
+
body: verdict.body,
|
|
27745
|
+
variant: "binary",
|
|
27746
|
+
serializedBytes: verdict.serializedBytes,
|
|
27747
|
+
serializeMs: cached ? 0 : verdict.serializeMs,
|
|
27748
|
+
gzipMs: cached ? 0 : verdict.gzipMs
|
|
27749
|
+
};
|
|
27750
|
+
}
|
|
27751
|
+
const wantsGzip = variant === "gzip";
|
|
27638
27752
|
let gzipped = wantsGzip ? gzippedBodies.get(response) : void 0;
|
|
27639
27753
|
let serializeMs = 0;
|
|
27640
27754
|
if (!gzipped) {
|
|
@@ -27647,6 +27761,7 @@ function createResponseEncoder(response, maxBytes) {
|
|
|
27647
27761
|
}
|
|
27648
27762
|
if (!wantsGzip || plain.bytes <= GZIP_MIN_BYTES) return {
|
|
27649
27763
|
body: plain.json,
|
|
27764
|
+
variant: "identity",
|
|
27650
27765
|
serializedBytes: plain.bytes,
|
|
27651
27766
|
serializeMs,
|
|
27652
27767
|
gzipMs: 0
|
|
@@ -27658,7 +27773,7 @@ function createResponseEncoder(response, maxBytes) {
|
|
|
27658
27773
|
if (verdict === "too_large") return verdict;
|
|
27659
27774
|
return {
|
|
27660
27775
|
body: verdict.body,
|
|
27661
|
-
|
|
27776
|
+
variant: "gzip",
|
|
27662
27777
|
serializedBytes: verdict.serializedBytes,
|
|
27663
27778
|
serializeMs,
|
|
27664
27779
|
gzipMs: performance.now() - gzipStart
|
|
@@ -27989,7 +28104,10 @@ var SolveEngine = class {
|
|
|
27989
28104
|
if (flight.kind !== "solved") return flight;
|
|
27990
28105
|
let encoded;
|
|
27991
28106
|
try {
|
|
27992
|
-
encoded = await flight.encoder.encode(
|
|
28107
|
+
encoded = await flight.encoder.encode(responseVariant({
|
|
28108
|
+
accept: args.accept,
|
|
28109
|
+
acceptEncoding: args.acceptEncoding
|
|
28110
|
+
}));
|
|
27993
28111
|
} catch (error) {
|
|
27994
28112
|
return {
|
|
27995
28113
|
kind: "compute_error",
|
|
@@ -28021,7 +28139,7 @@ var SolveEngine = class {
|
|
|
28021
28139
|
envelope: buildEnvelope(encoded, response, serverTiming, {
|
|
28022
28140
|
...timing,
|
|
28023
28141
|
serializedBytes,
|
|
28024
|
-
compressedBytes: encoded.
|
|
28142
|
+
compressedBytes: encoded.variant === "identity" ? null : body.byteLength
|
|
28025
28143
|
}),
|
|
28026
28144
|
solveMs,
|
|
28027
28145
|
errorCount: response.errors?.length ?? 0,
|
|
@@ -28301,6 +28419,6 @@ function waitFor(done, ms, signal) {
|
|
|
28301
28419
|
}
|
|
28302
28420
|
});
|
|
28303
28421
|
}
|
|
28304
|
-
export { acceptedResponse as a, respondWithKeepalive as c,
|
|
28422
|
+
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
28423
|
|
|
28306
28424
|
//# sourceMappingURL=server.js.map
|