@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.
Files changed (67) hide show
  1. package/build/adapter-node.js +1 -1
  2. package/build/client/_app/immutable/assets/0.Ct4dsf2W.css +2 -0
  3. package/build/client/_app/immutable/assets/0.Ct4dsf2W.css.br +0 -0
  4. package/build/client/_app/immutable/assets/0.Ct4dsf2W.css.gz +0 -0
  5. package/build/client/_app/immutable/chunks/BUxAHI7i.js +1 -0
  6. package/build/client/_app/immutable/chunks/BUxAHI7i.js.br +1 -0
  7. package/build/client/_app/immutable/chunks/BUxAHI7i.js.gz +0 -0
  8. package/build/client/_app/immutable/chunks/C4PDTpD1.js +6085 -0
  9. package/build/client/_app/immutable/chunks/C4PDTpD1.js.br +0 -0
  10. package/build/client/_app/immutable/chunks/C4PDTpD1.js.gz +0 -0
  11. package/build/client/_app/immutable/entry/{app.UvCzfP6E.js → app.Bqmne5hV.js} +2 -2
  12. package/build/client/_app/immutable/entry/app.Bqmne5hV.js.br +0 -0
  13. package/build/client/_app/immutable/entry/app.Bqmne5hV.js.gz +0 -0
  14. package/build/client/_app/immutable/nodes/21.Dv262ba8.js +1 -0
  15. package/build/client/_app/immutable/nodes/21.Dv262ba8.js.br +1 -0
  16. package/build/client/_app/immutable/nodes/21.Dv262ba8.js.gz +0 -0
  17. package/build/client/_app/version.json +1 -1
  18. package/build/client/_app/version.json.br +0 -0
  19. package/build/client/_app/version.json.gz +0 -0
  20. package/build/server/.vite/manifest.json +11 -10
  21. package/build/server/_app/immutable/assets/_layout.Ct4dsf2W.css +2 -0
  22. package/build/server/chunks/capture.js +1 -1
  23. package/build/server/chunks/compute-profile-D3g1Tuyd.js +92 -0
  24. package/build/server/chunks/compute-profile-D3g1Tuyd.js.map +1 -0
  25. package/build/server/chunks/grasshopper.js +6 -1
  26. package/build/server/chunks/grasshopper.js.map +1 -1
  27. package/build/server/chunks/instance.js +3 -3
  28. package/build/server/chunks/internal.js +1 -1
  29. package/build/server/chunks/package.js +1 -1
  30. package/build/server/chunks/package.js.map +1 -1
  31. package/build/server/chunks/server.js +134 -17
  32. package/build/server/chunks/server.js.map +1 -1
  33. package/build/server/chunks/solve.js +1 -1
  34. package/build/server/chunks/solve.server.js +8 -3
  35. package/build/server/chunks/solve.server.js.map +1 -1
  36. package/build/server/entries/endpoints/api/v1/compute/_server.ts.js +1 -1
  37. package/build/server/entries/endpoints/api/v1/definitions/_guid_/solve/_server.ts.js +5 -2
  38. package/build/server/entries/endpoints/api/v1/definitions/_guid_/solve/_server.ts.js.map +1 -1
  39. package/build/server/entries/endpoints/api/v1/solves/_solveId_/_server.ts.js +1 -1
  40. package/build/server/entries/pages/library/_guid_/_page.svelte.js +122 -30
  41. package/build/server/entries/pages/library/_guid_/_page.svelte.js.map +1 -1
  42. package/build/server/manifest-full.js +1 -1
  43. package/build/server/manifest.js +1 -1
  44. package/build/server/nodes/0.js +2 -2
  45. package/build/server/nodes/21.js +1 -1
  46. package/build/server/server.js +1 -1
  47. package/package.json +9 -9
  48. package/build/client/_app/immutable/assets/0.DOeouCe4.css +0 -2
  49. package/build/client/_app/immutable/assets/0.DOeouCe4.css.br +0 -0
  50. package/build/client/_app/immutable/assets/0.DOeouCe4.css.gz +0 -0
  51. package/build/client/_app/immutable/chunks/A_2RYLH9.js +0 -1
  52. package/build/client/_app/immutable/chunks/A_2RYLH9.js.br +0 -1
  53. package/build/client/_app/immutable/chunks/A_2RYLH9.js.gz +0 -0
  54. package/build/client/_app/immutable/chunks/BMp0Pt9F.js +0 -6085
  55. package/build/client/_app/immutable/chunks/BMp0Pt9F.js.br +0 -0
  56. package/build/client/_app/immutable/chunks/BMp0Pt9F.js.gz +0 -0
  57. package/build/client/_app/immutable/entry/app.UvCzfP6E.js.br +0 -0
  58. package/build/client/_app/immutable/entry/app.UvCzfP6E.js.gz +0 -0
  59. package/build/client/_app/immutable/nodes/21.BAYqxLPV.js +0 -1
  60. package/build/client/_app/immutable/nodes/21.BAYqxLPV.js.br +0 -1
  61. package/build/client/_app/immutable/nodes/21.BAYqxLPV.js.gz +0 -0
  62. package/build/server/_app/immutable/assets/_layout.DOeouCe4.css +0 -2
  63. package/build/server/chunks/async-solve-Doflh4BJ.js +0 -27
  64. package/build/server/chunks/async-solve-Doflh4BJ.js.map +0 -1
  65. /package/build/client/_app/immutable/nodes/{0.BQ4J6cqX.js → 0.BsaBi01M.js} +0 -0
  66. /package/build/client/_app/immutable/nodes/{0.BQ4J6cqX.js.br → 0.BsaBi01M.js.br} +0 -0
  67. /package/build/client/_app/immutable/nodes/{0.BQ4J6cqX.js.gz → 0.BsaBi01M.js.gz} +0 -0
@@ -0,0 +1,92 @@
1
+ import { n as getInputItems } from "./traversal.js";
2
+ // ../solve/dist/binary-response-CcX2wou-.js
3
+ var BINARY_SOLVE_MEDIA_TYPE = "application/vnd.selva.solve+binary";
4
+ /** ASCII "SLVR", read as a little-endian u32. */
5
+ var BINARY_SOLVE_MAGIC = 1381387347;
6
+ var FIXED_HEADER_BYTES = 16;
7
+ function isBlobRef(value) {
8
+ return typeof value === "object" && value !== null && typeof value.$blob === "number";
9
+ }
10
+ /**
11
+ * True when a wire `type` names a Display payload: one dot-separated token is exactly `Display` or
12
+ * `DisplayBatch`. Must match `isDisplayItemType` in `@selvajs/visualization`'s webdisplay parser,
13
+ * which can't share this one: visualization takes no dependency on this package.
14
+ */
15
+ function isDisplayItemType(type) {
16
+ const tokens = type.split(".");
17
+ return tokens.includes("Display") || tokens.includes("DisplayBatch");
18
+ }
19
+ var align8 = (n) => n + 7 & -8;
20
+ function headerBytes(blobCount) {
21
+ return align8(FIXED_HEADER_BYTES + 4 * blobCount);
22
+ }
23
+ function writeHeader(target, flags, jsonBytes, blobLengths) {
24
+ const view = new DataView(target.buffer, target.byteOffset, target.byteLength);
25
+ view.setUint32(0, BINARY_SOLVE_MAGIC, true);
26
+ view.setUint16(4, 1, true);
27
+ view.setUint16(6, flags, true);
28
+ view.setUint32(8, jsonBytes, true);
29
+ view.setUint32(12, blobLengths.length, true);
30
+ blobLengths.forEach((length, i) => view.setUint32(FIXED_HEADER_BYTES + 4 * i, length, true));
31
+ }
32
+ /** Splits a frame into views over `bytes`; nothing is copied. Throws on a malformed frame. */
33
+ function readFrame(bytes) {
34
+ const fail = (why) => {
35
+ throw new Error(`Malformed binary solve response: ${why}`);
36
+ };
37
+ if (bytes.byteLength < FIXED_HEADER_BYTES) fail("shorter than its header");
38
+ const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
39
+ if (view.getUint32(0, true) !== 1381387347) fail("bad magic");
40
+ const version = view.getUint16(4, true);
41
+ if (version !== 1) fail(`unsupported version ${version}`);
42
+ const flags = view.getUint16(6, true);
43
+ const jsonBytes = view.getUint32(8, true);
44
+ const blobCount = view.getUint32(12, true);
45
+ if (FIXED_HEADER_BYTES + 4 * blobCount > bytes.byteLength) fail("blob table runs past the end");
46
+ let offset = headerBytes(blobCount);
47
+ const take = (length) => {
48
+ if (offset + length > bytes.byteLength) fail("truncated");
49
+ const section = bytes.subarray(offset, offset + length);
50
+ offset = align8(offset + length);
51
+ return section;
52
+ };
53
+ const json = take(jsonBytes);
54
+ const blobs = [];
55
+ for (let i = 0; i < blobCount; i++) blobs.push(take(view.getUint32(FIXED_HEADER_BYTES + 4 * i, true)));
56
+ return {
57
+ flags,
58
+ json,
59
+ blobs
60
+ };
61
+ }
62
+ // ../solve/dist/compute-profile-D3g1Tuyd.js
63
+ /**
64
+ * Inputs the schema marks `source.kind === 'server'`. Only the host fills them, through
65
+ * `SolveEngine.solve`'s `boundValues`; without a value there they solve on their schema default.
66
+ * The client sends no value for them, and the server refuses one.
67
+ */
68
+ function serverSourcedInputIds(schema) {
69
+ return new Set(getInputItems(schema).filter((item) => item.source?.kind === "server").map((item) => item.paramId));
70
+ }
71
+ /** `promise`'s outcome, or a rejection with `signal`'s reason if that fires first. */
72
+ function raceAbort(promise, signal) {
73
+ return new Promise((resolve, reject) => {
74
+ const onAbort = () => reject(signal.reason);
75
+ if (signal.aborted) onAbort();
76
+ signal.addEventListener("abort", onAbort, { once: true });
77
+ promise.then(resolve, reject).finally(() => signal.removeEventListener("abort", onAbort));
78
+ });
79
+ }
80
+ var KEEPALIVE_PREFERENCE = "selva-keepalive";
81
+ /** Under the 30 s many load balancers allow an idle upstream. */
82
+ var KEEPALIVE_INTERVAL_MS = 15e3;
83
+ /** RFC 7240's own preference, so a generic proxy or client already knows what it means. */
84
+ var ASYNC_PREFERENCE = "respond-async";
85
+ /**
86
+ * The VektorNode fork's slowest-objects profile, a JSON array of `{ name, nick, ms }`. Selva passes
87
+ * it on to a signed-in browser under the same name.
88
+ */
89
+ var COMPUTE_PROFILE_HEADER = "X-Compute-Profile";
90
+ export { raceAbort as a, align8 as c, isDisplayItemType as d, readFrame as f, KEEPALIVE_PREFERENCE as i, headerBytes as l, COMPUTE_PROFILE_HEADER as n, serverSourcedInputIds as o, writeHeader as p, KEEPALIVE_INTERVAL_MS as r, BINARY_SOLVE_MEDIA_TYPE as s, ASYNC_PREFERENCE as t, isBlobRef as u };
91
+
92
+ //# sourceMappingURL=compute-profile-D3g1Tuyd.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compute-profile-D3g1Tuyd.js","names":[],"sources":["../../../../solve/dist/binary-response-CcX2wou-.js","../../../../solve/dist/compute-profile-D3g1Tuyd.js"],"sourcesContent":["// src/shared/binary-response.ts\nconst BINARY_SOLVE_MEDIA_TYPE = \"application/vnd.selva.solve+binary\";\n/** ASCII \"SLVR\", read as a little-endian u32. */\nconst BINARY_SOLVE_MAGIC = 1381387347;\nconst FIXED_HEADER_BYTES = 16;\nfunction isBlobRef(value) {\n\treturn typeof value === \"object\" && value !== null && typeof value.$blob === \"number\";\n}\n/**\n* True when a wire `type` names a Display payload: one dot-separated token is exactly `Display` or\n* `DisplayBatch`. Must match `isDisplayItemType` in `@selvajs/visualization`'s webdisplay parser,\n* which can't share this one: visualization takes no dependency on this package.\n*/\nfunction isDisplayItemType(type) {\n\tconst tokens = type.split(\".\");\n\treturn tokens.includes(\"Display\") || tokens.includes(\"DisplayBatch\");\n}\nconst align8 = (n) => n + 7 & -8;\nfunction headerBytes(blobCount) {\n\treturn align8(FIXED_HEADER_BYTES + 4 * blobCount);\n}\nfunction writeHeader(target, flags, jsonBytes, blobLengths) {\n\tconst view = new DataView(target.buffer, target.byteOffset, target.byteLength);\n\tview.setUint32(0, BINARY_SOLVE_MAGIC, true);\n\tview.setUint16(4, 1, true);\n\tview.setUint16(6, flags, true);\n\tview.setUint32(8, jsonBytes, true);\n\tview.setUint32(12, blobLengths.length, true);\n\tblobLengths.forEach((length, i) => view.setUint32(FIXED_HEADER_BYTES + 4 * i, length, true));\n}\n/** Splits a frame into views over `bytes`; nothing is copied. Throws on a malformed frame. */\nfunction readFrame(bytes) {\n\tconst fail = (why) => {\n\t\tthrow new Error(`Malformed binary solve response: ${why}`);\n\t};\n\tif (bytes.byteLength < FIXED_HEADER_BYTES) fail(\"shorter than its header\");\n\tconst view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);\n\tif (view.getUint32(0, true) !== 1381387347) fail(\"bad magic\");\n\tconst version = view.getUint16(4, true);\n\tif (version !== 1) fail(`unsupported version ${version}`);\n\tconst flags = view.getUint16(6, true);\n\tconst jsonBytes = view.getUint32(8, true);\n\tconst blobCount = view.getUint32(12, true);\n\tif (FIXED_HEADER_BYTES + 4 * blobCount > bytes.byteLength) fail(\"blob table runs past the end\");\n\tlet offset = headerBytes(blobCount);\n\tconst take = (length) => {\n\t\tif (offset + length > bytes.byteLength) fail(\"truncated\");\n\t\tconst section = bytes.subarray(offset, offset + length);\n\t\toffset = align8(offset + length);\n\t\treturn section;\n\t};\n\tconst json = take(jsonBytes);\n\tconst blobs = [];\n\tfor (let i = 0; i < blobCount; i++) blobs.push(take(view.getUint32(FIXED_HEADER_BYTES + 4 * i, true)));\n\treturn {\n\t\tflags,\n\t\tjson,\n\t\tblobs\n\t};\n}\nexport { isDisplayItemType as a, isBlobRef as i, align8 as n, readFrame as o, headerBytes as r, writeHeader as s, BINARY_SOLVE_MEDIA_TYPE as t };\n\n//# sourceMappingURL=binary-response-CcX2wou-.js.map","import { getInputItems } from \"@selvajs/schemas\";\n// src/shared/server-sourced.ts\n/**\n* Inputs the schema marks `source.kind === 'server'`. Only the host fills them, through\n* `SolveEngine.solve`'s `boundValues`; without a value there they solve on their schema default.\n* The client sends no value for them, and the server refuses one.\n*/\nfunction serverSourcedInputIds(schema) {\n\treturn new Set(getInputItems(schema).filter((item) => item.source?.kind === \"server\").map((item) => item.paramId));\n}\n// src/shared/abort.ts\n/** `promise`'s outcome, or a rejection with `signal`'s reason if that fires first. */\nfunction raceAbort(promise, signal) {\n\treturn new Promise((resolve, reject) => {\n\t\tconst onAbort = () => reject(signal.reason);\n\t\tif (signal.aborted) onAbort();\n\t\tsignal.addEventListener(\"abort\", onAbort, { once: true });\n\t\tpromise.then(resolve, reject).finally(() => signal.removeEventListener(\"abort\", onAbort));\n\t});\n}\n// src/shared/keepalive.ts\nconst KEEPALIVE_PREFERENCE = \"selva-keepalive\";\n/** Under the 30 s many load balancers allow an idle upstream. */\nconst KEEPALIVE_INTERVAL_MS = 15e3;\n// src/shared/async-solve.ts\n/** RFC 7240's own preference, so a generic proxy or client already knows what it means. */\nconst ASYNC_PREFERENCE = \"respond-async\";\n/** Seconds one poll may wait. Under the 30 s many load balancers allow an idle upstream. */\nconst ASYNC_POLL_WAIT_S = 25;\n// src/shared/compute-profile.ts\n/**\n* The VektorNode fork's slowest-objects profile, a JSON array of `{ name, nick, ms }`. Selva passes\n* it on to a signed-in browser under the same name.\n*/\nconst COMPUTE_PROFILE_HEADER = \"X-Compute-Profile\";\nexport { KEEPALIVE_PREFERENCE as a, KEEPALIVE_INTERVAL_MS as i, ASYNC_POLL_WAIT_S as n, raceAbort as o, ASYNC_PREFERENCE as r, serverSourcedInputIds as s, COMPUTE_PROFILE_HEADER as t };\n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
3
3
  /** Connection failure, a gateway status (502/503/504), or a 2xx body cut off mid-stream. */
4
4
  NETWORK_ERROR: "NETWORK_ERROR",
@@ -563,6 +563,11 @@ function parseServerTiming(headerValue) {
563
563
  if (!Number.isFinite(dur)) continue;
564
564
  timing[name] = dur;
565
565
  sawMetric = true;
566
+ } else if (name === "proxy_wait") {
567
+ const dur = Number(param(params, "dur"));
568
+ if (!Number.isFinite(dur)) continue;
569
+ timing.wait = dur;
570
+ sawMetric = true;
566
571
  } else if (name === "recomputed") {
567
572
  const [ran, total] = (param(params, "desc") ?? "").split("/").map(Number);
568
573
  if (!Number.isInteger(ran) || !Number.isInteger(total)) continue;