@selvajs/selva 4.20.1-beta.2 → 4.20.1-beta.3
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/chunks/{D-SwRD80.js → D-uUm_OB.js} +43 -43
- package/build/client/_app/immutable/chunks/D-uUm_OB.js.br +0 -0
- package/build/client/_app/immutable/chunks/{D-SwRD80.js.gz → D-uUm_OB.js.gz} +0 -0
- package/build/client/_app/immutable/chunks/D84F7w9g.js +1 -0
- package/build/client/_app/immutable/chunks/D84F7w9g.js.br +1 -0
- package/build/client/_app/immutable/chunks/D84F7w9g.js.gz +0 -0
- package/build/client/_app/immutable/entry/{app.hg2qyLJU.js → app.BpT6WkO1.js} +2 -2
- package/build/client/_app/immutable/entry/app.BpT6WkO1.js.br +0 -0
- package/build/client/_app/immutable/entry/app.BpT6WkO1.js.gz +0 -0
- package/build/client/_app/immutable/nodes/21.BkNlRItr.js +1 -0
- package/build/client/_app/immutable/nodes/21.BkNlRItr.js.br +0 -0
- package/build/client/_app/immutable/nodes/21.BkNlRItr.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 +9 -2
- package/build/server/chunks/access.js +0 -3
- package/build/server/chunks/access.js.map +1 -1
- package/build/server/chunks/definitions.js +178 -1
- package/build/server/chunks/definitions.js.map +1 -1
- package/build/server/chunks/handlers.js +4 -5
- package/build/server/chunks/handlers.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/providers.server.js +89 -188
- package/build/server/chunks/providers.server.js.map +1 -1
- package/build/server/chunks/registry.js +3 -3
- package/build/server/chunks/registry.js.map +1 -1
- package/build/server/chunks/resolve.server.js +1 -1
- package/build/server/chunks/server-config-write.js +13 -1
- package/build/server/chunks/server-config-write.js.map +1 -1
- package/build/server/entries/endpoints/api/admin/compute/_server.ts.js +30 -48
- package/build/server/entries/endpoints/api/admin/compute/_server.ts.js.map +1 -1
- package/build/server/entries/endpoints/api/admin/compute/actions/_server.ts.js +3 -2
- package/build/server/entries/endpoints/api/admin/compute/actions/_server.ts.js.map +1 -1
- package/build/server/entries/endpoints/api/admin/compute/status/_server.ts.js +3 -2
- package/build/server/entries/endpoints/api/admin/compute/status/_server.ts.js.map +1 -1
- package/build/server/entries/endpoints/api/admin/projects/_id_/_server.ts.js +3 -2
- package/build/server/entries/endpoints/api/admin/projects/_id_/_server.ts.js.map +1 -1
- package/build/server/entries/endpoints/api/admin/users/_server.ts.js +6 -2
- package/build/server/entries/endpoints/api/admin/users/_server.ts.js.map +1 -1
- package/build/server/entries/endpoints/api/files/_...path_/_server.ts.js +8 -8
- package/build/server/entries/endpoints/api/files/_...path_/_server.ts.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 +1 -1
- package/build/server/entries/endpoints/docs/api/openapi.yaml/_server.ts.js +1 -1
- package/build/server/entries/hooks.server.js +13 -1
- package/build/server/entries/hooks.server.js.map +1 -1
- package/build/server/entries/pages/library/_guid_/_page.server.ts.js +16 -3
- package/build/server/entries/pages/library/_guid_/_page.server.ts.js.map +1 -1
- package/build/server/entries/pages/library/_guid_/_page.svelte.js +132 -89
- 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/21.js +1 -1
- package/build/server/server.js +1 -1
- package/package.json +11 -11
- package/build/client/_app/immutable/chunks/D-SwRD80.js.br +0 -0
- package/build/client/_app/immutable/chunks/Dvq2vJj6.js +0 -1
- package/build/client/_app/immutable/chunks/Dvq2vJj6.js.br +0 -1
- package/build/client/_app/immutable/chunks/Dvq2vJj6.js.gz +0 -0
- package/build/client/_app/immutable/entry/app.hg2qyLJU.js.br +0 -0
- package/build/client/_app/immutable/entry/app.hg2qyLJU.js.gz +0 -0
- package/build/client/_app/immutable/nodes/21.gGT7QEb1.js +0 -1
- package/build/client/_app/immutable/nodes/21.gGT7QEb1.js.br +0 -1
- package/build/client/_app/immutable/nodes/21.gGT7QEb1.js.gz +0 -0
|
@@ -3647,7 +3647,7 @@ function Scroll_area($$renderer, $$props) {
|
|
|
3647
3647
|
function isFunction(value) {
|
|
3648
3648
|
return typeof value === "function";
|
|
3649
3649
|
}
|
|
3650
|
-
function isObject$
|
|
3650
|
+
function isObject$2(value) {
|
|
3651
3651
|
return value !== null && typeof value === "object";
|
|
3652
3652
|
}
|
|
3653
3653
|
var CLASS_VALUE_PRIMITIVE_TYPES = [
|
|
@@ -3670,7 +3670,7 @@ function isClassValue(value) {
|
|
|
3670
3670
|
var BoxSymbol = Symbol("box");
|
|
3671
3671
|
var isWritableSymbol = Symbol("is-writable");
|
|
3672
3672
|
function isBox(value) {
|
|
3673
|
-
return isObject$
|
|
3673
|
+
return isObject$2(value) && BoxSymbol in value;
|
|
3674
3674
|
}
|
|
3675
3675
|
/**
|
|
3676
3676
|
* @returns Whether the value is a WritableBox
|
|
@@ -4286,10 +4286,10 @@ function afterTick(fn) {
|
|
|
4286
4286
|
// ../../node_modules/.pnpm/svelte-toolbelt@0.9.3_svelte@5.57.3_@typescript-eslint+types@8.72.1_/node_modules/svelte-toolbelt/dist/utils/dom.js
|
|
4287
4287
|
var DOCUMENT_NODE = 9;
|
|
4288
4288
|
function isDocument(node) {
|
|
4289
|
-
return isObject$
|
|
4289
|
+
return isObject$2(node) && node.nodeType === DOCUMENT_NODE;
|
|
4290
4290
|
}
|
|
4291
4291
|
function isWindow(node) {
|
|
4292
|
-
return isObject$
|
|
4292
|
+
return isObject$2(node) && node.constructor?.name === "VisualViewport";
|
|
4293
4293
|
}
|
|
4294
4294
|
function getDocument(node) {
|
|
4295
4295
|
if (isDocument(node)) return node;
|
|
@@ -7010,6 +7010,94 @@ function textureToDataUri(payload) {
|
|
|
7010
7010
|
for (let i = 0; i < data.byteLength; i += step) binary += String.fromCharCode(...data.subarray(i, i + step));
|
|
7011
7011
|
return `data:${mime};base64,${btoa(binary)}`;
|
|
7012
7012
|
}
|
|
7013
|
+
function metadataFail(message, context) {
|
|
7014
|
+
return new VisualizationError(message, ErrorCodes.VALIDATION_ERROR, { context });
|
|
7015
|
+
}
|
|
7016
|
+
var isObject$1 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
7017
|
+
/**
|
|
7018
|
+
* Validates the batch's material and group/mesh metadata against the decoded geometry buffers
|
|
7019
|
+
* before any of it is used arithmetically. Throws on the first inconsistency — a material, group or
|
|
7020
|
+
* mesh that isn't an object, out-of-range `materialId`, non-integer or negative offsets/counts, or a
|
|
7021
|
+
* vertex/index window that overruns the buffers — so malformed or version-skewed metadata fails the
|
|
7022
|
+
* parse loudly instead of corrupting the render.
|
|
7023
|
+
*/
|
|
7024
|
+
function validateBatchMetadata(materials, groups, totalVertexCount, totalIndexCount) {
|
|
7025
|
+
if (!Array.isArray(materials)) throw metadataFail("Batch materials must be an array.", { materials: typeof materials });
|
|
7026
|
+
const badMaterial = materials.findIndex((material) => !isObject$1(material));
|
|
7027
|
+
if (badMaterial !== -1) throw metadataFail("Each material entry must be an object.", { materialIndex: badMaterial });
|
|
7028
|
+
const materialCount = materials.length;
|
|
7029
|
+
if (!Array.isArray(groups)) throw metadataFail("Batch groups must be an array.", { groups: typeof groups });
|
|
7030
|
+
groups.forEach((group, groupIndex) => {
|
|
7031
|
+
if (!isObject$1(group) || !Array.isArray(group.meshes)) throw metadataFail("Each group must be an object with a meshes array.", { groupIndex });
|
|
7032
|
+
if (!group.meshes.every(isObject$1)) throw metadataFail("Each mesh entry must be an object.", { groupIndex });
|
|
7033
|
+
});
|
|
7034
|
+
for (const group of groups) {
|
|
7035
|
+
if (!Number.isInteger(group.materialId) || group.materialId < 0 || group.materialId >= materialCount) throw metadataFail("Group materialId out of range of the materials array.", {
|
|
7036
|
+
materialId: group.materialId,
|
|
7037
|
+
materialCount
|
|
7038
|
+
});
|
|
7039
|
+
for (const mesh of group.meshes) {
|
|
7040
|
+
const fields = {
|
|
7041
|
+
vertexStart: mesh.vertexStart,
|
|
7042
|
+
vertexCount: mesh.vertexCount,
|
|
7043
|
+
indexStart: mesh.indexStart,
|
|
7044
|
+
indexCount: mesh.indexCount
|
|
7045
|
+
};
|
|
7046
|
+
for (const [field, value] of Object.entries(fields)) if (!Number.isInteger(value) || value < 0) throw metadataFail(`Mesh metadata field "${field}" must be a non-negative integer.`, {
|
|
7047
|
+
meshName: mesh.name,
|
|
7048
|
+
field,
|
|
7049
|
+
value
|
|
7050
|
+
});
|
|
7051
|
+
if (mesh.vertexStart + mesh.vertexCount > totalVertexCount) throw metadataFail("Mesh vertex window exceeds the batch vertex buffer.", {
|
|
7052
|
+
meshName: mesh.name,
|
|
7053
|
+
vertexStart: mesh.vertexStart,
|
|
7054
|
+
vertexCount: mesh.vertexCount,
|
|
7055
|
+
totalVertexCount
|
|
7056
|
+
});
|
|
7057
|
+
if (mesh.indexStart + mesh.indexCount > totalIndexCount) throw metadataFail("Mesh index window exceeds the batch index buffer.", {
|
|
7058
|
+
meshName: mesh.name,
|
|
7059
|
+
indexStart: mesh.indexStart,
|
|
7060
|
+
indexCount: mesh.indexCount,
|
|
7061
|
+
totalIndexCount
|
|
7062
|
+
});
|
|
7063
|
+
}
|
|
7064
|
+
}
|
|
7065
|
+
}
|
|
7066
|
+
/**
|
|
7067
|
+
* Error for an index outside its mesh's declared vertex window
|
|
7068
|
+
* `[vertexStart, vertexStart + vertexCount)`. Rebasing (`index - vertexStart`) writes into an
|
|
7069
|
+
* unsigned array, so an out-of-window index would otherwise wrap to ~4 billion and corrupt the
|
|
7070
|
+
* geometry. Range checks live inline in the copy loops (a function call per index measured
|
|
7071
|
+
* noticeably slower at millions of indices) — this only builds the failure.
|
|
7072
|
+
*/
|
|
7073
|
+
function indexOutOfWindow(indexValue, meshMeta) {
|
|
7074
|
+
return metadataFail("Index references a vertex outside its mesh's vertex window.", {
|
|
7075
|
+
meshName: meshMeta.name,
|
|
7076
|
+
indexValue,
|
|
7077
|
+
vertexStart: meshMeta.vertexStart,
|
|
7078
|
+
vertexCount: meshMeta.vertexCount
|
|
7079
|
+
});
|
|
7080
|
+
}
|
|
7081
|
+
/**
|
|
7082
|
+
* Reconstructs world-unit float32 positions from int16 quantized values:
|
|
7083
|
+
* `world = origin + (q + 32767) * scale`. No rotation — the Three scene uses Rhino's Z-up frame,
|
|
7084
|
+
* so vertices pass through as they arrived.
|
|
7085
|
+
*/
|
|
7086
|
+
function dequantizeInt16(q, origin, scale) {
|
|
7087
|
+
const out = new Float32Array(q.length);
|
|
7088
|
+
const ox = origin[0];
|
|
7089
|
+
const oy = origin[1];
|
|
7090
|
+
const oz = origin[2];
|
|
7091
|
+
const sx = scale[0];
|
|
7092
|
+
const sy = scale[1];
|
|
7093
|
+
const sz = scale[2];
|
|
7094
|
+
for (let i = 0; i < q.length; i += 3) {
|
|
7095
|
+
out[i] = ox + (q[i] + 32767) * sx;
|
|
7096
|
+
out[i + 1] = oy + (q[i + 1] + 32767) * sy;
|
|
7097
|
+
out[i + 2] = oz + (q[i + 2] + 32767) * sz;
|
|
7098
|
+
}
|
|
7099
|
+
return out;
|
|
7100
|
+
}
|
|
7013
7101
|
/** Second half of {@link parseBinaryMeshBatch}, for a caller that already holds the raw view. */
|
|
7014
7102
|
function decodeRawMeshBatch(raw) {
|
|
7015
7103
|
let vertices;
|
|
@@ -7080,6 +7168,7 @@ function parseBinaryMeshBatchRaw(input) {
|
|
|
7080
7168
|
} catch (error) {
|
|
7081
7169
|
throw fail(`Failed to parse metadata JSON: ${error instanceof Error ? error.message : String(error)}`, { metadataLen });
|
|
7082
7170
|
}
|
|
7171
|
+
if (!isMetadataShape(metadata)) throw fail("Metadata JSON must be an object whose materials and groups are arrays.", { metadataLen });
|
|
7083
7172
|
if (offset + 56 > bytes.byteLength) throw fail("Insufficient data to read geometry header.", {
|
|
7084
7173
|
expectedBytes: 56,
|
|
7085
7174
|
availableBytes: bytes.byteLength - offset,
|
|
@@ -7170,6 +7259,12 @@ function parseBinaryMeshBatchRaw(input) {
|
|
|
7170
7259
|
colors
|
|
7171
7260
|
};
|
|
7172
7261
|
}
|
|
7262
|
+
/** Missing `materials`/`groups` are allowed: the JSON envelope's copies fill them in. */
|
|
7263
|
+
function isMetadataShape(value) {
|
|
7264
|
+
if (!isObject$1(value)) return false;
|
|
7265
|
+
const { materials, groups } = value;
|
|
7266
|
+
return (materials === void 0 || Array.isArray(materials)) && (groups === void 0 || Array.isArray(groups));
|
|
7267
|
+
}
|
|
7173
7268
|
/**
|
|
7174
7269
|
* True when every member of a geometry is a closed, consistently wound, outward-facing triangle
|
|
7175
7270
|
* surface, so its back faces can never be seen and the material can cull them.
|
|
@@ -8525,83 +8620,6 @@ function applyVertexColorSRGBDecode(material) {
|
|
|
8525
8620
|
#endif`);
|
|
8526
8621
|
});
|
|
8527
8622
|
}
|
|
8528
|
-
function metadataFail(message, context) {
|
|
8529
|
-
return new VisualizationError(message, ErrorCodes.VALIDATION_ERROR, { context });
|
|
8530
|
-
}
|
|
8531
|
-
/**
|
|
8532
|
-
* Validates the batch's group/mesh metadata against the decoded geometry buffers before any of it
|
|
8533
|
-
* is used arithmetically. Throws on the first inconsistency — out-of-range `materialId`,
|
|
8534
|
-
* non-integer or negative offsets/counts, or a vertex/index window that overruns the buffers — so
|
|
8535
|
-
* malformed or version-skewed metadata fails the parse loudly instead of corrupting the render.
|
|
8536
|
-
*/
|
|
8537
|
-
function validateGroupMetadata(groups, materialCount, totalVertexCount, totalIndexCount) {
|
|
8538
|
-
for (const group of groups) {
|
|
8539
|
-
if (!Number.isInteger(group.materialId) || group.materialId < 0 || group.materialId >= materialCount) throw metadataFail("Group materialId out of range of the materials array.", {
|
|
8540
|
-
materialId: group.materialId,
|
|
8541
|
-
materialCount
|
|
8542
|
-
});
|
|
8543
|
-
for (const mesh of group.meshes) {
|
|
8544
|
-
const fields = {
|
|
8545
|
-
vertexStart: mesh.vertexStart,
|
|
8546
|
-
vertexCount: mesh.vertexCount,
|
|
8547
|
-
indexStart: mesh.indexStart,
|
|
8548
|
-
indexCount: mesh.indexCount
|
|
8549
|
-
};
|
|
8550
|
-
for (const [field, value] of Object.entries(fields)) if (!Number.isInteger(value) || value < 0) throw metadataFail(`Mesh metadata field "${field}" must be a non-negative integer.`, {
|
|
8551
|
-
meshName: mesh.name,
|
|
8552
|
-
field,
|
|
8553
|
-
value
|
|
8554
|
-
});
|
|
8555
|
-
if (mesh.vertexStart + mesh.vertexCount > totalVertexCount) throw metadataFail("Mesh vertex window exceeds the batch vertex buffer.", {
|
|
8556
|
-
meshName: mesh.name,
|
|
8557
|
-
vertexStart: mesh.vertexStart,
|
|
8558
|
-
vertexCount: mesh.vertexCount,
|
|
8559
|
-
totalVertexCount
|
|
8560
|
-
});
|
|
8561
|
-
if (mesh.indexStart + mesh.indexCount > totalIndexCount) throw metadataFail("Mesh index window exceeds the batch index buffer.", {
|
|
8562
|
-
meshName: mesh.name,
|
|
8563
|
-
indexStart: mesh.indexStart,
|
|
8564
|
-
indexCount: mesh.indexCount,
|
|
8565
|
-
totalIndexCount
|
|
8566
|
-
});
|
|
8567
|
-
}
|
|
8568
|
-
}
|
|
8569
|
-
}
|
|
8570
|
-
/**
|
|
8571
|
-
* Error for an index outside its mesh's declared vertex window
|
|
8572
|
-
* `[vertexStart, vertexStart + vertexCount)`. Rebasing (`index - vertexStart`) writes into an
|
|
8573
|
-
* unsigned array, so an out-of-window index would otherwise wrap to ~4 billion and corrupt the
|
|
8574
|
-
* geometry. Range checks live inline in the copy loops (a function call per index measured
|
|
8575
|
-
* noticeably slower at millions of indices) — this only builds the failure.
|
|
8576
|
-
*/
|
|
8577
|
-
function indexOutOfWindow(indexValue, meshMeta) {
|
|
8578
|
-
return metadataFail("Index references a vertex outside its mesh's vertex window.", {
|
|
8579
|
-
meshName: meshMeta.name,
|
|
8580
|
-
indexValue,
|
|
8581
|
-
vertexStart: meshMeta.vertexStart,
|
|
8582
|
-
vertexCount: meshMeta.vertexCount
|
|
8583
|
-
});
|
|
8584
|
-
}
|
|
8585
|
-
/**
|
|
8586
|
-
* Reconstructs world-unit float32 positions from int16 quantized values:
|
|
8587
|
-
* `world = origin + (q + 32767) * scale`. No rotation — the Three scene uses Rhino's Z-up frame,
|
|
8588
|
-
* so vertices pass through as they arrived.
|
|
8589
|
-
*/
|
|
8590
|
-
function dequantizeInt16(q, origin, scale) {
|
|
8591
|
-
const out = new Float32Array(q.length);
|
|
8592
|
-
const ox = origin[0];
|
|
8593
|
-
const oy = origin[1];
|
|
8594
|
-
const oz = origin[2];
|
|
8595
|
-
const sx = scale[0];
|
|
8596
|
-
const sy = scale[1];
|
|
8597
|
-
const sz = scale[2];
|
|
8598
|
-
for (let i = 0; i < q.length; i += 3) {
|
|
8599
|
-
out[i] = ox + (q[i] + 32767) * sx;
|
|
8600
|
-
out[i + 1] = oy + (q[i + 1] + 32767) * sy;
|
|
8601
|
-
out[i + 2] = oz + (q[i + 2] + 32767) * sz;
|
|
8602
|
-
}
|
|
8603
|
-
return out;
|
|
8604
|
-
}
|
|
8605
8623
|
/**
|
|
8606
8624
|
* Split a material group into one sub-group per layer, preserving mesh order.
|
|
8607
8625
|
*
|
|
@@ -8945,7 +8963,7 @@ function buildMeshesFromParsed(parsed, opts) {
|
|
|
8945
8963
|
const materialsSrc = parsed.metadata.materials ?? fallback?.materials ?? [];
|
|
8946
8964
|
const groups = parsed.metadata.groups ?? fallback?.groups ?? [];
|
|
8947
8965
|
const isFloat32 = (parsed.flags & 1) !== 0;
|
|
8948
|
-
|
|
8966
|
+
validateBatchMetadata(materialsSrc, groups, parsed.vertices.length / 3, parsed.indices.length);
|
|
8949
8967
|
const worldVertices = isFloat32 ? parsed.vertices : dequantizeInt16(parsed.vertices, parsed.origin, parsed.scale);
|
|
8950
8968
|
if (debug) {
|
|
8951
8969
|
const wireBytes = parsed.vertices.byteLength + parsed.indices.byteLength;
|
|
@@ -9033,7 +9051,7 @@ function buildFromFinishedCache(container, opts) {
|
|
|
9033
9051
|
const { jobs, jobRefs } = planJobs(groups, opts.mergeByMaterial);
|
|
9034
9052
|
const cached = getFinishedBatch(container.geometryBlob, jobs);
|
|
9035
9053
|
if (!cached) return null;
|
|
9036
|
-
|
|
9054
|
+
validateBatchMetadata(materialsSrc, groups, cached.vertexCount, cached.indexCount);
|
|
9037
9055
|
return meshesFromBuilt(cached, jobRefs, materialsSrc, opts.material);
|
|
9038
9056
|
}
|
|
9039
9057
|
/** One job per merged group or per unmerged mesh, with a parallel ref list to unwrap results by index. */
|
|
@@ -9085,7 +9103,7 @@ async function tryBuildViaAssembly(opened, opts) {
|
|
|
9085
9103
|
if (indexCount / 3 < 5e4) return null;
|
|
9086
9104
|
const materialsSrc = raw.metadata.materials ?? opts.fallback?.materials ?? [];
|
|
9087
9105
|
const groups = raw.metadata.groups ?? opts.fallback?.groups ?? [];
|
|
9088
|
-
|
|
9106
|
+
validateBatchMetadata(materialsSrc, groups, raw.vertexCount, indexCount);
|
|
9089
9107
|
const { jobs, jobRefs } = planJobs(groups, opts.mergeByMaterial);
|
|
9090
9108
|
const assembled = await assemble(raw, jobs, opened.source);
|
|
9091
9109
|
if (!assembled) {
|
|
@@ -9125,7 +9143,15 @@ async function assemble(raw, jobs, source) {
|
|
|
9125
9143
|
colors: raw.colors,
|
|
9126
9144
|
jobs
|
|
9127
9145
|
};
|
|
9128
|
-
if (!worker)
|
|
9146
|
+
if (!worker) {
|
|
9147
|
+
let geometries;
|
|
9148
|
+
try {
|
|
9149
|
+
geometries = assembleGeometries(input);
|
|
9150
|
+
} catch (error) {
|
|
9151
|
+
throw new VisualizationError(error instanceof Error ? error.message : String(error), ErrorCodes.VALIDATION_ERROR, { originalError: error instanceof Error ? error : void 0 });
|
|
9152
|
+
}
|
|
9153
|
+
return geometries.map((geometry, i) => finishGeometry(geometry, jobs[i].windows));
|
|
9154
|
+
}
|
|
9129
9155
|
if (!ownsBuffer(raw, source)) {
|
|
9130
9156
|
input.vertexData = raw.vertexData.slice();
|
|
9131
9157
|
input.indexData = raw.indexData.slice();
|
|
@@ -10953,6 +10979,7 @@ function createComputeFetchSolveFn(opts) {
|
|
|
10953
10979
|
const channel = opts.channel?.();
|
|
10954
10980
|
const versionId = opts.versionId?.();
|
|
10955
10981
|
const streamId = opts.streamId?.();
|
|
10982
|
+
const bearerToken = opts.bearerToken?.();
|
|
10956
10983
|
const payload = JSON.stringify({
|
|
10957
10984
|
inputs,
|
|
10958
10985
|
values,
|
|
@@ -10964,7 +10991,10 @@ function createComputeFetchSolveFn(opts) {
|
|
|
10964
10991
|
try {
|
|
10965
10992
|
res = await fetch(opts.endpoint, {
|
|
10966
10993
|
method: "POST",
|
|
10967
|
-
headers: {
|
|
10994
|
+
headers: {
|
|
10995
|
+
"Content-Type": "application/json",
|
|
10996
|
+
...bearerToken ? { Authorization: `Bearer ${bearerToken}` } : {}
|
|
10997
|
+
},
|
|
10968
10998
|
body: payload,
|
|
10969
10999
|
signal
|
|
10970
11000
|
});
|
|
@@ -16745,6 +16775,19 @@ function createSolvingIndicator(isSolving, options = {}) {
|
|
|
16745
16775
|
}
|
|
16746
16776
|
};
|
|
16747
16777
|
}
|
|
16778
|
+
// ../ui/src/lib/compute/computeDriver.ts
|
|
16779
|
+
/**
|
|
16780
|
+
* The request/response driver `ComputeApp` solves through. Its memo caches whole solve results,
|
|
16781
|
+
* meshes included, and the viewer disposes what it renders on the next scene update.
|
|
16782
|
+
* `@selvajs/solve` keeps meshes opaque, so the three.js clone/dispose rules come from the renderer
|
|
16783
|
+
* that owns them: without `meshPolicy`, a memo hit serves an already-disposed mesh.
|
|
16784
|
+
*/
|
|
16785
|
+
function createComputeDriver(onSolve, getReporter, options) {
|
|
16786
|
+
return createRequestResponseDriver(onSolve, getReporter, {
|
|
16787
|
+
...options,
|
|
16788
|
+
meshPolicy
|
|
16789
|
+
});
|
|
16790
|
+
}
|
|
16748
16791
|
// ../ui/src/lib/components/compute/SolveMessages.svelte
|
|
16749
16792
|
function SolveMessages($$renderer, $$props) {
|
|
16750
16793
|
$$renderer.component(($$renderer) => {
|
|
@@ -17095,9 +17138,8 @@ function ComputeApp($$renderer, $$props) {
|
|
|
17095
17138
|
const locale = layerLocaleContext(() => lang, () => messages);
|
|
17096
17139
|
const t = derived(() => locale.messages);
|
|
17097
17140
|
derived(() => externalScopeKey || definitionKey || schema?.id || "");
|
|
17098
|
-
const driver =
|
|
17141
|
+
const driver = createComputeDriver(onSolve, () => session, {
|
|
17099
17142
|
solveDeadlineMs,
|
|
17100
|
-
meshPolicy,
|
|
17101
17143
|
onChange: () => session.notify(),
|
|
17102
17144
|
events
|
|
17103
17145
|
});
|
|
@@ -17242,7 +17284,7 @@ function _page($$renderer, $$props) {
|
|
|
17242
17284
|
function shouldShowViewer() {
|
|
17243
17285
|
return Boolean(data.schema.viewerOptions?.enableRemote);
|
|
17244
17286
|
}
|
|
17245
|
-
const liveEvents = run(() => isAuthed()) ? createSolveEventStream({
|
|
17287
|
+
const liveEvents = run(() => isAuthed() && !data.shareToken) ? createSolveEventStream({
|
|
17246
17288
|
endpoint: "/api/v1/solve-events",
|
|
17247
17289
|
cancelEndpoint: (solveId) => `/api/v1/solve/${solveId}/cancel`
|
|
17248
17290
|
}) : null;
|
|
@@ -17254,6 +17296,7 @@ function _page($$renderer, $$props) {
|
|
|
17254
17296
|
channel: () => data.channel === "draft" ? "draft" : void 0,
|
|
17255
17297
|
versionId: () => data.versionId,
|
|
17256
17298
|
streamId: () => liveEvents?.streamId ?? null,
|
|
17299
|
+
bearerToken: () => data.shareToken,
|
|
17257
17300
|
meshes: shouldShowViewer() ? { extract: (response, opts) => getThreeObjectsFromComputeResponse(response, opts) } : void 0,
|
|
17258
17301
|
debug: true
|
|
17259
17302
|
});
|