@floless/app 0.110.0 → 0.111.1
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/floless-server.cjs +484 -67
- package/dist/skills/floless-app-steel-model/SKILL.md +5 -1
- package/dist/skills/floless-app-steel-takeoff/SKILL.md +120 -8
- package/dist/skills/steel-drawing-abbreviations/references/standard-us-abbreviations.md +6 -0
- package/dist/web/app.css +73 -9
- package/dist/web/aware.js +4 -4
- package/dist/web/index.html +19 -0
- package/dist/web/steel-editor.html +59 -31
- package/dist/web/workspaces.js +417 -6
- package/package.json +1 -1
package/dist/floless-server.cjs
CHANGED
|
@@ -53792,7 +53792,7 @@ function appVersion() {
|
|
|
53792
53792
|
return resolveVersion({
|
|
53793
53793
|
isSea: isSea2(),
|
|
53794
53794
|
sqVersionXml: readSqVersionXml(),
|
|
53795
|
-
define: true ? "0.
|
|
53795
|
+
define: true ? "0.111.1" : void 0,
|
|
53796
53796
|
pkgVersion: readPkgVersion()
|
|
53797
53797
|
});
|
|
53798
53798
|
}
|
|
@@ -53808,7 +53808,7 @@ function resolveChannel(s) {
|
|
|
53808
53808
|
function appChannel() {
|
|
53809
53809
|
return resolveChannel({
|
|
53810
53810
|
isSea: isSea2(),
|
|
53811
|
-
define: true ? "0.
|
|
53811
|
+
define: true ? "0.111.1" : void 0,
|
|
53812
53812
|
// argv[1] is the entry the runtime actually loaded (…/dist/floless-server.cjs), which is what
|
|
53813
53813
|
// carries the npx cache prefix. Absent under the SEA exe, which never reaches the npx branch.
|
|
53814
53814
|
modulePath: process.argv[1]
|
|
@@ -60251,6 +60251,13 @@ var GROUPS = {
|
|
|
60251
60251
|
bolt: { key: "bolt", label: "Bolts", color: "#b0c4d8" },
|
|
60252
60252
|
// cool zinc-grey (matches the anchor fasteners)
|
|
60253
60253
|
stiffener: { key: "stiffener", label: "Stiffeners", color: "#9aafc3" },
|
|
60254
|
+
// Brace gusset — the design pass picked this by LUMINANCE, not by eye: the plate band is a pure
|
|
60255
|
+
// lightness ramp (every swatch is the same hue family), so a new row has to land in a real gap. The
|
|
60256
|
+
// first try, #8d9bb0, sat ~4/255 off `custom` (#8a97a8) — indistinguishable at swatch size, so a model
|
|
60257
|
+
// holding an imported connection beside a modelled gusset showed two rows of the same grey. #94a2b7
|
|
60258
|
+
// sits between `custom` (~150) and washer-plate/stiffener (~172), ~11 clear of each. Being a lightness
|
|
60259
|
+
// step rather than a hue shift is also what keeps the band colour-blind-legible.
|
|
60260
|
+
"gusset-plate": { key: "gusset-plate", label: "Gusset plates", color: "#94a2b7" },
|
|
60254
60261
|
cope: { key: "cope", label: "Copes", color: "#c2703a" },
|
|
60255
60262
|
// a muted cut/burn amber — the removed corner (subtractive; rendered as the notch, not a swatch mesh)
|
|
60256
60263
|
// Imported (custom) connection — one neutral steel band for the whole opaque assembly, so it reads
|
|
@@ -60498,7 +60505,11 @@ function inferSupport(beam, end, memberGeo) {
|
|
|
60498
60505
|
best = m;
|
|
60499
60506
|
}
|
|
60500
60507
|
}
|
|
60501
|
-
return best &&
|
|
60508
|
+
return best && supportReaches(end, best) ? best : void 0;
|
|
60509
|
+
}
|
|
60510
|
+
function supportReaches(end, support) {
|
|
60511
|
+
if (!finite3(support.from) || !finite3(support.to) || !support.dims) return false;
|
|
60512
|
+
return distPointSeg(end, support.from, support.to) <= Math.max(support.dims.w, support.dims.d);
|
|
60502
60513
|
}
|
|
60503
60514
|
function flangeThk(profile, d) {
|
|
60504
60515
|
return profileKind(profile) === "I" ? Math.min(d * 0.5, Math.max(d * 0.1, 6)) : d / 2;
|
|
@@ -60791,6 +60802,194 @@ function expandShearPlate(joint, beam, support, nativeSupport) {
|
|
|
60791
60802
|
}
|
|
60792
60803
|
return { parts, operations, viewOperations };
|
|
60793
60804
|
}
|
|
60805
|
+
function braceSetback(member, support, at) {
|
|
60806
|
+
if (!support || !finite3(support.from) || !finite3(support.to)) return null;
|
|
60807
|
+
if (!finite3(member.from) || !finite3(member.to)) return null;
|
|
60808
|
+
const halfW = (support.dims?.w ?? 0) / 2;
|
|
60809
|
+
if (!(halfW > 0)) return null;
|
|
60810
|
+
const endPt = at === "end1" ? member.to : member.from;
|
|
60811
|
+
const farPt = at === "end1" ? member.from : member.to;
|
|
60812
|
+
let ux = farPt[0] - endPt[0], uy = farPt[1] - endPt[1];
|
|
60813
|
+
const hLen = Math.hypot(ux, uy);
|
|
60814
|
+
if (!(hLen > 1e-6)) return null;
|
|
60815
|
+
ux /= hLen;
|
|
60816
|
+
uy /= hLen;
|
|
60817
|
+
const sx = support.to[0] - support.from[0], sy = support.to[1] - support.from[1];
|
|
60818
|
+
const sLen = Math.hypot(sx, sy);
|
|
60819
|
+
if (!(sLen > 1e-6)) return null;
|
|
60820
|
+
const mx = -sy / sLen, my = sx / sLen;
|
|
60821
|
+
const d0 = (endPt[0] - support.from[0]) * mx + (endPt[1] - support.from[1]) * my;
|
|
60822
|
+
const rate = ux * mx + uy * my;
|
|
60823
|
+
if (Math.abs(rate) < 1e-6) return null;
|
|
60824
|
+
const skew = (uy * mx - ux * my) / rate;
|
|
60825
|
+
if (Math.abs(d0) >= halfW) return { mm: 0, skew };
|
|
60826
|
+
const tA = (halfW - d0) / rate, tB = (-halfW - d0) / rate;
|
|
60827
|
+
const forward = [tA, tB].filter((t2) => Number.isFinite(t2) && t2 > 0);
|
|
60828
|
+
if (!forward.length) return { mm: 0, skew };
|
|
60829
|
+
const t = Math.min(...forward);
|
|
60830
|
+
const own = Math.hypot(farPt[0] - endPt[0], farPt[1] - endPt[1], farPt[2] - endPt[2]);
|
|
60831
|
+
return t < own * 0.5 ? { mm: t, skew } : null;
|
|
60832
|
+
}
|
|
60833
|
+
function expandBraceGusset(joint, brace, support, nativeSupport) {
|
|
60834
|
+
const p = joint.params;
|
|
60835
|
+
const none = { parts: [], operations: [], viewOperations: [] };
|
|
60836
|
+
const at = joint.at === "end1" ? "end1" : "end0";
|
|
60837
|
+
const endPt = at === "end1" ? brace.to : brace.from;
|
|
60838
|
+
const farPt = at === "end1" ? brace.from : brace.to;
|
|
60839
|
+
let ux = farPt[0] - endPt[0], uy = farPt[1] - endPt[1];
|
|
60840
|
+
const hLen = Math.hypot(ux, uy);
|
|
60841
|
+
if (!(hLen > 1e-6)) return none;
|
|
60842
|
+
ux /= hLen;
|
|
60843
|
+
uy /= hLen;
|
|
60844
|
+
const uDir = [ux, uy, 0];
|
|
60845
|
+
const vDir = [0, 0, 1];
|
|
60846
|
+
const nDir = [uy, -ux, 0];
|
|
60847
|
+
const len3d = Math.hypot(farPt[0] - endPt[0], farPt[1] - endPt[1], farPt[2] - endPt[2]);
|
|
60848
|
+
if (!(len3d > 1e-6)) return none;
|
|
60849
|
+
const levelness = hLen / len3d;
|
|
60850
|
+
if (levelness < 0.99875) return none;
|
|
60851
|
+
const setback = braceSetback(brace, support, at);
|
|
60852
|
+
if (setback == null) return none;
|
|
60853
|
+
const faceAt = (n) => setback.mm - n * setback.skew;
|
|
60854
|
+
const halfAcross = Math.max(brace.dims.w, brace.dims.d) / 2;
|
|
60855
|
+
const trimMm = (setback.mm + halfAcross * Math.abs(setback.skew)) / levelness;
|
|
60856
|
+
if (!(trimMm < len3d * 0.5)) return none;
|
|
60857
|
+
const posOff = typeof brace.posOffset === "number" && isFinite(brace.posOffset) ? brace.posOffset : 0;
|
|
60858
|
+
const midZ = endPt[2] + posOff;
|
|
60859
|
+
const P = (u, v, n) => [
|
|
60860
|
+
endPt[0] + uDir[0] * u + nDir[0] * n,
|
|
60861
|
+
endPt[1] + uDir[1] * u + nDir[1] * n,
|
|
60862
|
+
midZ + v
|
|
60863
|
+
];
|
|
60864
|
+
const thickness = pos(p, "plateThickness", 9.525);
|
|
60865
|
+
const width = pos(p, "plateWidth", 177.8);
|
|
60866
|
+
const boltDia = pos(p, "boltDia", 19.05);
|
|
60867
|
+
const cols = intMin1(p, "boltCols", 2);
|
|
60868
|
+
const rows2 = intMin1(p, "boltRows", 1);
|
|
60869
|
+
const pitch = pos(p, "boltPitch", 76.2);
|
|
60870
|
+
const colPitch = pos(p, "boltColPitch", pitch);
|
|
60871
|
+
const holeClr = num(p, "holeClearance", 2);
|
|
60872
|
+
const edge = Math.max(0, num(p, "edgeDist", Math.max(1.5 * boltDia, 30)));
|
|
60873
|
+
const weldLeg = num(p, "weldLeg", 6.35);
|
|
60874
|
+
const plateCount = num(p, "plateCount", 2) >= 2 ? 2 : 1;
|
|
60875
|
+
const height = pos(p, "plateHeight", (rows2 - 1) * pitch + 2 * edge);
|
|
60876
|
+
const webSide = num(p, "webSide", 1) >= 0 ? 1 : -1;
|
|
60877
|
+
const lap = lapFaces(brace, webSide, at === "end1");
|
|
60878
|
+
if (!lap) return none;
|
|
60879
|
+
const aMid = lap.lapN + lap.sideDir * (thickness / 2);
|
|
60880
|
+
const bMid = lap.plyFarN - lap.sideDir * (thickness / 2);
|
|
60881
|
+
const aOuter = lap.lapN + lap.sideDir * thickness;
|
|
60882
|
+
const bOuter = lap.plyFarN - lap.sideDir * thickness;
|
|
60883
|
+
const uA = faceAt(aMid);
|
|
60884
|
+
const uB = faceAt(bMid);
|
|
60885
|
+
const edgeV = Math.min(edge, height * 0.4);
|
|
60886
|
+
const pV = rows2 > 1 ? Math.min(pitch, Math.max(0, height - 2 * edgeV) / (rows2 - 1)) : 0;
|
|
60887
|
+
const vOffs = Array.from({ length: rows2 }, (_, i) => (i - (rows2 - 1) / 2) * pV);
|
|
60888
|
+
const edgeU = Math.min(edge, width * 0.4);
|
|
60889
|
+
const platesLo = plateCount === 2 ? Math.max(uA, uB) : uA;
|
|
60890
|
+
const platesHi = (plateCount === 2 ? Math.min(uA, uB) : uA) + width;
|
|
60891
|
+
const regLo = Math.max(platesLo, trimMm) + edgeU;
|
|
60892
|
+
const regHi = platesHi - edgeU;
|
|
60893
|
+
if (!(regHi > regLo)) return none;
|
|
60894
|
+
const cU = (regLo + regHi) / 2;
|
|
60895
|
+
const pU = cols > 1 ? Math.min(colPitch, (regHi - regLo) / (cols - 1)) : 0;
|
|
60896
|
+
const uAbs = Array.from({ length: cols }, (_, j) => cU + (j - (cols - 1) / 2) * pU);
|
|
60897
|
+
const nutH = 0.8 * boltDia, nutAF = 1.6 * boltDia;
|
|
60898
|
+
const grade = p?.["boltGrade"] === "A490" ? "A490" : "A325";
|
|
60899
|
+
const plateMaterial = authoredText(p, "plateMaterial");
|
|
60900
|
+
const fastenerMaterial = authoredText(p, "fastenerMaterial");
|
|
60901
|
+
const standard = text(p, "fastenerStandard", `${grade}N`);
|
|
60902
|
+
const boltType = p?.["boltType"] === "site" ? "site" : "shop";
|
|
60903
|
+
const grip = thickness * plateCount + lap.ply;
|
|
60904
|
+
const boltLen = aiscBoltLength(grip, boltDia);
|
|
60905
|
+
const callout = `\u2300${Math.round(boltDia)} ${grade} \xD7 ${Math.round(boltLen)}`;
|
|
60906
|
+
const headN = aOuter;
|
|
60907
|
+
const nutFaceN = plateCount === 2 ? bOuter : lap.plyFarN;
|
|
60908
|
+
const headTipN = headN + lap.sideDir * nutH;
|
|
60909
|
+
const nutTipN = nutFaceN - lap.sideDir * nutH;
|
|
60910
|
+
const holesA = [];
|
|
60911
|
+
const holesB = [];
|
|
60912
|
+
const bolts = [];
|
|
60913
|
+
const instances = [];
|
|
60914
|
+
let k = 0;
|
|
60915
|
+
for (const v of vOffs) {
|
|
60916
|
+
for (const u of uAbs) {
|
|
60917
|
+
const jid = joint.id;
|
|
60918
|
+
holesA.push({ id: `${jid}:plateA-hole${k}`, u: u - uA - width / 2, v, d: boltDia + holeClr });
|
|
60919
|
+
if (plateCount === 2) holesB.push({ id: `${jid}:plateB-hole${k}`, u: u - uB - width / 2, v, d: boltDia + holeClr });
|
|
60920
|
+
bolts.push(
|
|
60921
|
+
{ id: `${jid}:bolt${k}`, group: "bolt", kind: "rod", nativeKind: "bolt-shank", from: P(u, v, headN), to: P(u, v, headN - lap.sideDir * boltLen), d: boltDia, material: fastenerMaterial, fastener: { role: "brace-bolt" }, meta: { label: `Bolt ${callout}` } },
|
|
60922
|
+
{ id: `${jid}:head${k}`, group: "nut", kind: "nut", nativeKind: "bolt-head", from: P(u, v, headN), to: P(u, v, headTipN), acrossFlats: nutAF, material: fastenerMaterial, fastener: { role: "bolt-head" }, meta: { label: `Bolt head ${callout}` } },
|
|
60923
|
+
{ id: `${jid}:nut${k}`, group: "nut", kind: "nut", nativeKind: "nut", from: P(u, v, nutFaceN), to: P(u, v, nutTipN), acrossFlats: nutAF, material: fastenerMaterial, fastener: { role: "nut" }, meta: { label: `Bolt nut ${callout}` } }
|
|
60924
|
+
);
|
|
60925
|
+
const point = P(u, v, aMid);
|
|
60926
|
+
const instanceId = `${jid}:bolt-array:instance${k}`;
|
|
60927
|
+
const holeEffects = [
|
|
60928
|
+
{ id: `${instanceId}:hole:plateA`, targetId: `${jid}:plateA`, center: point, axis: nDir, diameterMm: boltDia + holeClr },
|
|
60929
|
+
{ id: `${instanceId}:hole:member`, targetId: brace.id, center: point, axis: nDir, diameterMm: boltDia + holeClr }
|
|
60930
|
+
];
|
|
60931
|
+
if (plateCount === 2) holeEffects.push({ id: `${instanceId}:hole:plateB`, targetId: `${jid}:plateB`, center: point, axis: nDir, diameterMm: boltDia + holeClr });
|
|
60932
|
+
instances.push({ id: instanceId, point, shankId: `${jid}:bolt${k}`, headId: `${jid}:head${k}`, nutIds: [`${jid}:nut${k}`], washerIds: [], holeEffects });
|
|
60933
|
+
k++;
|
|
60934
|
+
}
|
|
60935
|
+
}
|
|
60936
|
+
const mkPlate = (suffix, uStart, mid, holes, side) => ({
|
|
60937
|
+
id: `${joint.id}:${suffix}`,
|
|
60938
|
+
group: "gusset-plate",
|
|
60939
|
+
kind: "plate",
|
|
60940
|
+
center: P(uStart + width / 2, 0, mid),
|
|
60941
|
+
uDir,
|
|
60942
|
+
vDir,
|
|
60943
|
+
width,
|
|
60944
|
+
depth: height,
|
|
60945
|
+
thickness,
|
|
60946
|
+
holes,
|
|
60947
|
+
material: plateMaterial,
|
|
60948
|
+
meta: { label: `Gusset plate ${Math.round(width)}\xD7${Math.round(height)}\xD7${Math.round(thickness)}${side}`, setbackMm: trimMm }
|
|
60949
|
+
});
|
|
60950
|
+
const plateA = mkPlate("plateA", uA, aMid, holesA, plateCount === 2 ? " (near)" : "");
|
|
60951
|
+
const parts = [plateA];
|
|
60952
|
+
if (plateCount === 2) parts.push(mkPlate("plateB", uB, bMid, holesB, " (far)"));
|
|
60953
|
+
const welds = [];
|
|
60954
|
+
const faceWeld = (suffix, uStart, n) => ({
|
|
60955
|
+
id: `${joint.id}:${suffix}`,
|
|
60956
|
+
group: "weld",
|
|
60957
|
+
kind: "weld",
|
|
60958
|
+
closed: false,
|
|
60959
|
+
path: [P(uStart, -height / 2, n), P(uStart, height / 2, n)],
|
|
60960
|
+
leg: weldLeg,
|
|
60961
|
+
meta: { label: `Fillet ${weldLeg}` }
|
|
60962
|
+
});
|
|
60963
|
+
welds.push(faceWeld("weld", uA, aMid));
|
|
60964
|
+
if (plateCount === 2) welds.push(faceWeld("weld2", uB, bMid));
|
|
60965
|
+
parts.push(...bolts, ...welds);
|
|
60966
|
+
const operations = [{
|
|
60967
|
+
id: `${joint.id}:bolt-array`,
|
|
60968
|
+
kind: "bolt-array",
|
|
60969
|
+
partToBoltTo: plateA.id,
|
|
60970
|
+
partToBeBolted: brace.id,
|
|
60971
|
+
frame: { origin: P(cU, 0, aMid), uDir, vDir, normal: nDir },
|
|
60972
|
+
uOffsetsMm: uAbs.map((u) => u - cU),
|
|
60973
|
+
vOffsetsMm: vOffs.slice(),
|
|
60974
|
+
diameterMm: boltDia,
|
|
60975
|
+
toleranceMm: holeClr,
|
|
60976
|
+
standard,
|
|
60977
|
+
grade,
|
|
60978
|
+
boltType,
|
|
60979
|
+
threadInMaterial: false,
|
|
60980
|
+
components: { bolt: true, nut: true, washer: false },
|
|
60981
|
+
instances
|
|
60982
|
+
}];
|
|
60983
|
+
const viewOperations = [];
|
|
60984
|
+
const weldRecords = (into, mainId) => {
|
|
60985
|
+
for (const weld of welds) {
|
|
60986
|
+
into.push({ id: weld.id, kind: "weld", mainId, secondaryId: weld.id === `${joint.id}:weld2` ? `${joint.id}:plateB` : plateA.id, path: weld.path, weldType: "fillet", sizeMm: weld.leg, around: false, shop: true });
|
|
60987
|
+
}
|
|
60988
|
+
};
|
|
60989
|
+
if (nativeSupport) weldRecords(operations, nativeSupport.id);
|
|
60990
|
+
else if (support) weldRecords(viewOperations, support.id);
|
|
60991
|
+
return { parts, operations, viewOperations, trims: [{ id: brace.id, end: at, mm: trimMm }] };
|
|
60992
|
+
}
|
|
60794
60993
|
function expandCustom(joint) {
|
|
60795
60994
|
const place = finite3(joint.place) ? joint.place : [0, 0, 0];
|
|
60796
60995
|
const [dx, dy, dz] = place;
|
|
@@ -60814,6 +61013,7 @@ function expandJoints(joints, memberGeo) {
|
|
|
60814
61013
|
const elements = [];
|
|
60815
61014
|
const operations = [];
|
|
60816
61015
|
const viewOperations = [];
|
|
61016
|
+
const memberTrims = [];
|
|
60817
61017
|
const skipped = [];
|
|
60818
61018
|
const usedGroups = /* @__PURE__ */ new Set();
|
|
60819
61019
|
(joints ?? []).forEach((j, i) => {
|
|
@@ -60878,13 +61078,42 @@ function expandJoints(joints, memberGeo) {
|
|
|
60878
61078
|
elements.push(part);
|
|
60879
61079
|
if (part.kind !== "cut") usedGroups.add(part.group);
|
|
60880
61080
|
}
|
|
61081
|
+
} else if (j.kind === "brace-gusset") {
|
|
61082
|
+
const braceMember = j.main ? memberGeo.get(j.main) : void 0;
|
|
61083
|
+
if (!braceMember || braceMember.role !== "beam" || !braceMember.isBrace) {
|
|
61084
|
+
skipped.push(j.id);
|
|
61085
|
+
return;
|
|
61086
|
+
}
|
|
61087
|
+
if (!finite3(braceMember.from) || !finite3(braceMember.to) || !braceMember.dims || !(braceMember.dims.w > 0) || !(braceMember.dims.d > 0)) {
|
|
61088
|
+
skipped.push(j.id);
|
|
61089
|
+
return;
|
|
61090
|
+
}
|
|
61091
|
+
const braceEnd = j.at === "end1" ? braceMember.to : braceMember.from;
|
|
61092
|
+
let nativeSupport = j.secondaries && j.secondaries[0] ? memberGeo.get(j.secondaries[0]) : void 0;
|
|
61093
|
+
if (nativeSupport && nativeSupport.isBrace) nativeSupport = void 0;
|
|
61094
|
+
if (nativeSupport && !supportReaches(braceEnd, nativeSupport)) nativeSupport = void 0;
|
|
61095
|
+
const support = nativeSupport ?? inferSupport(braceMember, braceEnd, memberGeo);
|
|
61096
|
+
const expansion = expandBraceGusset(j, braceMember, support, nativeSupport);
|
|
61097
|
+
if (!expansion.parts.length) {
|
|
61098
|
+
skipped.push(j.id);
|
|
61099
|
+
return;
|
|
61100
|
+
}
|
|
61101
|
+
operations.push(...expansion.operations);
|
|
61102
|
+
viewOperations.push(...expansion.viewOperations);
|
|
61103
|
+
if (expansion.trims) memberTrims.push(...expansion.trims);
|
|
61104
|
+
for (const part of expansion.parts) {
|
|
61105
|
+
part.conn = j.id;
|
|
61106
|
+
part.connKind = j.kind;
|
|
61107
|
+
elements.push(part);
|
|
61108
|
+
usedGroups.add(part.group);
|
|
61109
|
+
}
|
|
60881
61110
|
} else {
|
|
60882
61111
|
skipped.push(j.id);
|
|
60883
61112
|
}
|
|
60884
61113
|
});
|
|
60885
61114
|
for (const part of elements) if (part.kind === "cut") operations.push(cutToBooleanCut(part));
|
|
60886
61115
|
const groups = [...usedGroups].map((k) => GROUPS[k]);
|
|
60887
|
-
return { elements, operations, viewOperations, groups, skipped };
|
|
61116
|
+
return { elements, operations, viewOperations, memberTrims, groups, skipped };
|
|
60888
61117
|
}
|
|
60889
61118
|
|
|
60890
61119
|
// ../web/steel-3d-core.js
|
|
@@ -62187,6 +62416,30 @@ function teklaClassFor(profile, role) {
|
|
|
62187
62416
|
if (isW || isHSS) return role === "brace" ? "4" : role === "column" ? "2" : "3";
|
|
62188
62417
|
return "1";
|
|
62189
62418
|
}
|
|
62419
|
+
var BOLT_OWNED_HOLE_GROUPS = /* @__PURE__ */ new Set(["shear-plate", "gusset-plate"]);
|
|
62420
|
+
function applyMemberTrims(elements, trims) {
|
|
62421
|
+
const unapplied = [];
|
|
62422
|
+
for (const trim of trims) {
|
|
62423
|
+
if (!(trim.mm > 0)) continue;
|
|
62424
|
+
const box = elements.find((e) => e.kind === "box" && e.id === trim.id);
|
|
62425
|
+
if (!box || !box.from || !box.to) {
|
|
62426
|
+
unapplied.push(trim.id);
|
|
62427
|
+
continue;
|
|
62428
|
+
}
|
|
62429
|
+
const [a, b] = trim.end === "end1" ? [box.to, box.from] : [box.from, box.to];
|
|
62430
|
+
const dx = b[0] - a[0], dy = b[1] - a[1], dz = b[2] - a[2];
|
|
62431
|
+
const L = Math.hypot(dx, dy, dz);
|
|
62432
|
+
if (!(L > trim.mm)) {
|
|
62433
|
+
unapplied.push(trim.id);
|
|
62434
|
+
continue;
|
|
62435
|
+
}
|
|
62436
|
+
const t = trim.mm / L;
|
|
62437
|
+
a[0] += dx * t;
|
|
62438
|
+
a[1] += dy * t;
|
|
62439
|
+
a[2] += dz * t;
|
|
62440
|
+
}
|
|
62441
|
+
return unapplied;
|
|
62442
|
+
}
|
|
62190
62443
|
function contractToScene(contractInput) {
|
|
62191
62444
|
if (isModelV2(contractInput)) {
|
|
62192
62445
|
const { view, issues } = readModelOrIssues(contractInput);
|
|
@@ -62299,6 +62552,7 @@ function contractToScene(contractInput) {
|
|
|
62299
62552
|
color: pickColor(profile, paletteRank.indexOf(profile), contract)
|
|
62300
62553
|
}));
|
|
62301
62554
|
const joints = expandJoints(contract.joints, memberGeo);
|
|
62555
|
+
for (const id of applyMemberTrims(elements, joints.memberTrims)) skipped.push(`trim:${id}`);
|
|
62302
62556
|
for (const part of joints.elements) {
|
|
62303
62557
|
const canonical = canonicalConnectionElement(part);
|
|
62304
62558
|
if (!canonical) {
|
|
@@ -62351,7 +62605,7 @@ function canonicalConnectionElement(part) {
|
|
|
62351
62605
|
if (part.kind === "plate") {
|
|
62352
62606
|
const halfW = part.width / 2;
|
|
62353
62607
|
const halfD = part.depth / 2;
|
|
62354
|
-
const independentHoles = part.group
|
|
62608
|
+
const independentHoles = BOLT_OWNED_HOLE_GROUPS.has(part.group) ? [] : part.holes.map((hole, index) => ({
|
|
62355
62609
|
id: hole.id || `${part.id}:hole${index}`,
|
|
62356
62610
|
center: [hole.u, hole.v],
|
|
62357
62611
|
diameterMm: hole.d
|
|
@@ -62708,6 +62962,7 @@ function sceneFromModel(view) {
|
|
|
62708
62962
|
color: pickColor(profile, paletteRank.indexOf(profile), view.doc)
|
|
62709
62963
|
}));
|
|
62710
62964
|
const joints = expandJoints(view.doc.joints, memberGeo);
|
|
62965
|
+
for (const id of applyMemberTrims(elements, joints.memberTrims)) skipped.push(`trim:${id}`);
|
|
62711
62966
|
for (const part of joints.elements) elements.push(part);
|
|
62712
62967
|
for (const g of joints.groups) groups.push(g);
|
|
62713
62968
|
for (const id of joints.skipped) skipped.push(`joint:${id}`);
|
|
@@ -63495,6 +63750,49 @@ function registerRevisionRoutes(app) {
|
|
|
63495
63750
|
return { ok: true, version };
|
|
63496
63751
|
}
|
|
63497
63752
|
);
|
|
63753
|
+
app.get(
|
|
63754
|
+
"/api/projects/:id/revision-read/staged",
|
|
63755
|
+
async (req, reply) => {
|
|
63756
|
+
const project = getProject(req.params.id);
|
|
63757
|
+
if (!project) return reply.status(404).send({ ok: false, error: `unknown project: ${req.params.id}` });
|
|
63758
|
+
const requestId = typeof req.query?.requestId === "string" ? req.query.requestId : "";
|
|
63759
|
+
if (!requestId) return reply.status(400).send({ ok: false, error: "requestId is required \u2014 a review belongs to the read that staged it" });
|
|
63760
|
+
const request = getRequest(requestId);
|
|
63761
|
+
if (!request || request.type !== "revision-read" || request.project !== project.id) {
|
|
63762
|
+
return reply.status(410).send({ ok: false, error: "that revision request no longer exists \u2014 re-attach the revised set and read it again" });
|
|
63763
|
+
}
|
|
63764
|
+
if (request.status !== "staged") {
|
|
63765
|
+
return reply.status(409).send({ ok: false, error: `that revision request is "${request.status}", not staged for review` });
|
|
63766
|
+
}
|
|
63767
|
+
const stagingKey = getProjectStagingId(project.id);
|
|
63768
|
+
const st = stagingKey ? readStaged(stagingKey) : null;
|
|
63769
|
+
if (!st) {
|
|
63770
|
+
return reply.status(410).send({ ok: false, error: "there is no staged review for this project \u2014 read the revised set again" });
|
|
63771
|
+
}
|
|
63772
|
+
if (st.record.requestId !== requestId) {
|
|
63773
|
+
return reply.status(409).send({
|
|
63774
|
+
ok: false,
|
|
63775
|
+
error: "this review belongs to a different read of this project \u2014 reload and review the current one",
|
|
63776
|
+
code: "stage-superseded"
|
|
63777
|
+
});
|
|
63778
|
+
}
|
|
63779
|
+
const current = readAcceptedForRequest(project.app, project.id, "read");
|
|
63780
|
+
if (current == null || declaredTypeOf(current) !== STEEL_V2) {
|
|
63781
|
+
return reply.status(409).send({ ok: false, error: "this project no longer holds the model this review was staged against" });
|
|
63782
|
+
}
|
|
63783
|
+
let candidate;
|
|
63784
|
+
try {
|
|
63785
|
+
candidate = acceptContract(st.candidate, { appId: project.app, projectId: project.id, operation: "read" });
|
|
63786
|
+
} catch (e) {
|
|
63787
|
+
if (e instanceof ContractPolicyError) {
|
|
63788
|
+
return reply.status(409).send({ ok: false, error: `this staged review can no longer be applied \u2014 ${e.message}`, code: e.code });
|
|
63789
|
+
}
|
|
63790
|
+
throw e;
|
|
63791
|
+
}
|
|
63792
|
+
const fresh = stageRevisionRead(current, candidate);
|
|
63793
|
+
return { ok: true, staged: stagedSummary(fresh, st.record) };
|
|
63794
|
+
}
|
|
63795
|
+
);
|
|
63498
63796
|
app.post(
|
|
63499
63797
|
"/api/projects/:id/revision-read/confirm",
|
|
63500
63798
|
async (req, reply) => {
|
|
@@ -63605,6 +63903,124 @@ function registerRevisionRoutes(app) {
|
|
|
63605
63903
|
);
|
|
63606
63904
|
}
|
|
63607
63905
|
|
|
63906
|
+
// steel-prepass-route.ts
|
|
63907
|
+
var ROOT_KEYS = ["filter", "datum"];
|
|
63908
|
+
var PLAN_KEYS = ["grid", "datum_at", "datum_ref", "control2_at", "control2_ref", "elevation_in"];
|
|
63909
|
+
var isObj3 = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
|
|
63910
|
+
function registerSteelPrepassRoute(app, deps) {
|
|
63911
|
+
app.put(
|
|
63912
|
+
"/api/projects/:id/steel-prepass",
|
|
63913
|
+
{ bodyLimit: 25 * 1024 * 1024 },
|
|
63914
|
+
// the filter block enumerates every drawing element (matches the contract PUT)
|
|
63915
|
+
async (req, reply) => {
|
|
63916
|
+
const project = deps.getProject(req.params.id);
|
|
63917
|
+
if (!project) return reply.status(404).send({ ok: false, error: `unknown project: ${req.params.id}` });
|
|
63918
|
+
const rawIfMatch = typeof req.headers["if-match"] === "string" ? req.headers["if-match"] : void 0;
|
|
63919
|
+
if (rawIfMatch === "*") {
|
|
63920
|
+
return reply.status(428).send({
|
|
63921
|
+
ok: false,
|
|
63922
|
+
code: "precondition-required",
|
|
63923
|
+
error: "this verb patches the document you read, so it needs that document's exact ETag \u2014 `If-Match: *` cannot detect a write that landed since your GET. Re-GET and send `If-Match: <the ETag>`."
|
|
63924
|
+
});
|
|
63925
|
+
}
|
|
63926
|
+
const body = isObj3(req.body) ? req.body : null;
|
|
63927
|
+
if (!body) return reply.status(400).send({ ok: false, error: "body must be an object of the form { filter?, datum?, sheets? }" });
|
|
63928
|
+
const unknownRoot = Object.keys(body).filter((k) => ![...ROOT_KEYS, "sheets"].includes(k));
|
|
63929
|
+
if (unknownRoot.length) {
|
|
63930
|
+
return reply.status(400).send({
|
|
63931
|
+
ok: false,
|
|
63932
|
+
code: "prepass-path-refused",
|
|
63933
|
+
error: `the pre-read pass may write ${ROOT_KEYS.map((k) => `\`${k}\``).join(", ")} and \`sheets\` \u2014 not ${unknownRoot.map((k) => `\`${k}\``).join(", ")}. Members and their observations go through POST /revision-read, which stages them for review.`
|
|
63934
|
+
});
|
|
63935
|
+
}
|
|
63936
|
+
if (body.sheets !== void 0 && !isObj3(body.sheets)) {
|
|
63937
|
+
return reply.status(400).send({ ok: false, error: "`sheets` must be an object keyed by sheet name, never an array \u2014 a positional list writes each sheet's grid onto the other" });
|
|
63938
|
+
}
|
|
63939
|
+
const sheets = isObj3(body.sheets) ? body.sheets : {};
|
|
63940
|
+
for (const [sheet, patch2] of Object.entries(sheets)) {
|
|
63941
|
+
if (!isObj3(patch2)) return reply.status(400).send({ ok: false, error: `\`sheets["${sheet}"]\` must be an object of ${PLAN_KEYS.map((k) => `\`${k}\``).join(", ")}` });
|
|
63942
|
+
const unknown = Object.keys(patch2).filter((k) => !PLAN_KEYS.includes(k));
|
|
63943
|
+
if (unknown.length) {
|
|
63944
|
+
return reply.status(400).send({
|
|
63945
|
+
ok: false,
|
|
63946
|
+
code: "prepass-path-refused",
|
|
63947
|
+
error: `\`sheets["${sheet}"]\` may write ${PLAN_KEYS.map((k) => `\`${k}\``).join(", ")} \u2014 not ${unknown.map((k) => `\`${k}\``).join(", ")}`
|
|
63948
|
+
});
|
|
63949
|
+
}
|
|
63950
|
+
}
|
|
63951
|
+
const current = readAcceptedForRequest(project.app, project.id, "put");
|
|
63952
|
+
if (current == null) {
|
|
63953
|
+
return reply.status(404).send({ ok: false, error: "this project has no contract yet \u2014 the first write of a read creates it through the contract route" });
|
|
63954
|
+
}
|
|
63955
|
+
const declared = declaredTypeOf(current);
|
|
63956
|
+
if (declared !== STEEL_V1 && declared !== STEEL_V2) {
|
|
63957
|
+
return reply.status(400).send({
|
|
63958
|
+
ok: false,
|
|
63959
|
+
code: "prepass-not-steel",
|
|
63960
|
+
error: `this project holds a "${declared}" contract, and the pre-read pass writes ${STEEL_V1} / ${STEEL_V2} \u2014 nothing was written`
|
|
63961
|
+
});
|
|
63962
|
+
}
|
|
63963
|
+
const doc = structuredClone(current);
|
|
63964
|
+
const plans = Array.isArray(doc.plans) ? doc.plans : [];
|
|
63965
|
+
const storedNames = plans.map((p) => isObj3(p) ? String(p.sheet ?? "") : "");
|
|
63966
|
+
const known = new Set(storedNames);
|
|
63967
|
+
const missing = Object.keys(sheets).filter((s) => !known.has(s));
|
|
63968
|
+
if (missing.length) {
|
|
63969
|
+
return reply.status(400).send({
|
|
63970
|
+
ok: false,
|
|
63971
|
+
code: "prepass-unknown-sheet",
|
|
63972
|
+
error: `this project has no plan for ${missing.map((s) => `"${s}"`).join(", ")} \u2014 the pre-read pass writes to sheets a read has already created, it never adds one`
|
|
63973
|
+
});
|
|
63974
|
+
}
|
|
63975
|
+
const dupes = [...new Set(Object.keys(sheets).filter((s) => storedNames.filter((n) => n === s).length > 1))];
|
|
63976
|
+
if (dupes.length) {
|
|
63977
|
+
return reply.status(400).send({
|
|
63978
|
+
ok: false,
|
|
63979
|
+
code: "prepass-duplicate-sheet",
|
|
63980
|
+
error: `this project has more than one plan named ${dupes.map((s) => `"${s}"`).join(", ")}, so there is no single sheet to write to \u2014 give the duplicate plans distinct sheet names before re-reading`
|
|
63981
|
+
});
|
|
63982
|
+
}
|
|
63983
|
+
if (plans.length && isObj3(body.filter)) {
|
|
63984
|
+
const fSheets = Array.isArray(body.filter.sheets) ? body.filter.sheets : [];
|
|
63985
|
+
const strays = fSheets.map((s) => isObj3(s) ? String(s.sheet ?? "") : "").filter((s) => s && !known.has(s));
|
|
63986
|
+
if (strays.length) {
|
|
63987
|
+
return reply.status(400).send({
|
|
63988
|
+
ok: false,
|
|
63989
|
+
code: "prepass-unknown-sheet",
|
|
63990
|
+
error: `\`filter.sheets\` names ${[...new Set(strays)].map((s) => `"${s}"`).join(", ")}, which this project has no plan for`
|
|
63991
|
+
});
|
|
63992
|
+
}
|
|
63993
|
+
}
|
|
63994
|
+
let applied = false;
|
|
63995
|
+
for (const k of ROOT_KEYS) if (body[k] !== void 0) {
|
|
63996
|
+
doc[k] = body[k];
|
|
63997
|
+
applied = true;
|
|
63998
|
+
}
|
|
63999
|
+
for (const p of plans) {
|
|
64000
|
+
const patch2 = isObj3(p) ? sheets[String(p.sheet ?? "")] : void 0;
|
|
64001
|
+
if (!isObj3(patch2)) continue;
|
|
64002
|
+
for (const k of PLAN_KEYS) if (patch2[k] !== void 0) {
|
|
64003
|
+
p[k] = patch2[k];
|
|
64004
|
+
applied = true;
|
|
64005
|
+
}
|
|
64006
|
+
}
|
|
64007
|
+
const ifNoneMatch = typeof req.headers["if-none-match"] === "string" ? req.headers["if-none-match"] : void 0;
|
|
64008
|
+
let written;
|
|
64009
|
+
try {
|
|
64010
|
+
written = await writeContractChecked(project.app, doc, project.id, { origin: "client", ifMatch: rawIfMatch, ifNoneMatch });
|
|
64011
|
+
} catch (e) {
|
|
64012
|
+
if (e instanceof PreconditionRequiredError) return reply.status(428).send({ ok: false, error: e.message, code: e.code });
|
|
64013
|
+
if (e instanceof PreconditionFailedError) return reply.status(412).send({ ok: false, error: e.message, code: e.code });
|
|
64014
|
+
if (e instanceof ContractError) return reply.status(400).send({ ok: false, error: e.message, ...e.code ? { code: e.code } : {} });
|
|
64015
|
+
throw e;
|
|
64016
|
+
}
|
|
64017
|
+
reply.header("ETag", written.etag);
|
|
64018
|
+
if (applied) deps.clearApproval(project.id);
|
|
64019
|
+
return { ok: true, etag: written.etag };
|
|
64020
|
+
}
|
|
64021
|
+
);
|
|
64022
|
+
}
|
|
64023
|
+
|
|
63608
64024
|
// project-export-files.ts
|
|
63609
64025
|
var import_node_fs27 = require("node:fs");
|
|
63610
64026
|
var import_node_path24 = require("node:path");
|
|
@@ -64231,8 +64647,8 @@ function resolveMember(ctx, sheet, v1Id) {
|
|
|
64231
64647
|
function remapJoints(v1, ctx) {
|
|
64232
64648
|
const issues = [];
|
|
64233
64649
|
const joints = [];
|
|
64234
|
-
if (!
|
|
64235
|
-
for (const j of arr3(v1.joints).filter(
|
|
64650
|
+
if (!isObj4(v1)) return { joints, issues };
|
|
64651
|
+
for (const j of arr3(v1.joints).filter(isObj4)) {
|
|
64236
64652
|
const id = str3(j.id) ?? "";
|
|
64237
64653
|
const kind = str3(j.kind) ?? "";
|
|
64238
64654
|
const out = { id, kind };
|
|
@@ -64261,7 +64677,7 @@ function remapJoints(v1, ctx) {
|
|
|
64261
64677
|
if (str3(j.at)) out.at = str3(j.at);
|
|
64262
64678
|
if (str3(j.conn)) out.conn = str3(j.conn);
|
|
64263
64679
|
if (str3(j.name)) out.name = str3(j.name);
|
|
64264
|
-
if (
|
|
64680
|
+
if (isObj4(j.params)) out.params = clone(j.params);
|
|
64265
64681
|
const jSource = enumOr(j.source, ["auto", "user"], `$.joints[id=${id}].source`, issues);
|
|
64266
64682
|
if (jSource) out.source = jSource;
|
|
64267
64683
|
if (typeof j.verified === "boolean") out.verified = j.verified;
|
|
@@ -64278,7 +64694,7 @@ function remapPlanDims(plan, ctx) {
|
|
|
64278
64694
|
const dims = [];
|
|
64279
64695
|
const sheet = str3(plan.sheet) ?? "";
|
|
64280
64696
|
const gridMap = ctx.gridIds[sheet] ?? {};
|
|
64281
|
-
for (const d of arr3(plan.dims).filter(
|
|
64697
|
+
for (const d of arr3(plan.dims).filter(isObj4)) {
|
|
64282
64698
|
const out = {
|
|
64283
64699
|
id: str3(d.id) ?? "",
|
|
64284
64700
|
a: clone(d.a),
|
|
@@ -64289,7 +64705,7 @@ function remapPlanDims(plan, ctx) {
|
|
|
64289
64705
|
if (num3(d.rot) !== null) out.rot = num3(d.rot);
|
|
64290
64706
|
if (typeof d.pin === "boolean") out.pin = d.pin;
|
|
64291
64707
|
for (const side of ["aRef", "bRef"]) {
|
|
64292
|
-
const ref =
|
|
64708
|
+
const ref = isObj4(d[side]) ? d[side] : null;
|
|
64293
64709
|
if (!ref) continue;
|
|
64294
64710
|
const m = str3(ref.m), g = str3(ref.g);
|
|
64295
64711
|
if (m !== null && g !== null) {
|
|
@@ -64328,7 +64744,7 @@ function remapPlanDims(plan, ctx) {
|
|
|
64328
64744
|
}
|
|
64329
64745
|
function remapPropLabels(v1, ctx) {
|
|
64330
64746
|
const issues = [];
|
|
64331
|
-
if (!
|
|
64747
|
+
if (!isObj4(v1) || !isObj4(v1.prop_labels)) return { propLabels: void 0, issues };
|
|
64332
64748
|
const p = v1.prop_labels;
|
|
64333
64749
|
const out = {};
|
|
64334
64750
|
if (Array.isArray(p.props)) out.props = clone(p.props);
|
|
@@ -64365,15 +64781,15 @@ function parseLegacySceneRef(raw, ctx) {
|
|
|
64365
64781
|
function remapViews(v1, ctx, planSheets) {
|
|
64366
64782
|
const issues = [];
|
|
64367
64783
|
const views = [];
|
|
64368
|
-
if (!
|
|
64369
|
-
for (const v of arr3(v1.views).filter(
|
|
64784
|
+
if (!isObj4(v1)) return { views, issues };
|
|
64785
|
+
for (const v of arr3(v1.views).filter(isObj4)) {
|
|
64370
64786
|
const id = str3(v.id) ?? "";
|
|
64371
64787
|
const out = { id, name: str3(v.name) ?? "" };
|
|
64372
64788
|
if (num3(v.v) !== null) out.v = num3(v.v);
|
|
64373
64789
|
if (num3(v.order) !== null) out.order = num3(v.order);
|
|
64374
64790
|
const mode = enumOr(v.mode, ["solid", "wire", "xray"], `$.views[id=${id}].mode`, issues);
|
|
64375
64791
|
if (mode) out.mode = mode;
|
|
64376
|
-
if (
|
|
64792
|
+
if (isObj4(v.camera)) {
|
|
64377
64793
|
const c = v.camera;
|
|
64378
64794
|
const cam = {};
|
|
64379
64795
|
if (num3(c.v) !== null) cam.v = num3(c.v);
|
|
@@ -64385,11 +64801,11 @@ function remapViews(v1, ctx, planSheets) {
|
|
|
64385
64801
|
if (num3(c.zoom) !== null) cam.zoom = num3(c.zoom);
|
|
64386
64802
|
out.camera = cam;
|
|
64387
64803
|
}
|
|
64388
|
-
if (
|
|
64804
|
+
if (isObj4(v.clips)) out.clips = clone(v.clips);
|
|
64389
64805
|
if (out.camera || out.clips) {
|
|
64390
64806
|
issues.push({ code: "view-camera-unframed", severity: "decision", message: `saved view "${id}" carries camera/clip coordinates in the OLD scene frame; assign a frame, confirm keep-as-world, or discard before commit (epic \xA710)` });
|
|
64391
64807
|
}
|
|
64392
|
-
if (
|
|
64808
|
+
if (isObj4(v.objects)) {
|
|
64393
64809
|
const o = v.objects;
|
|
64394
64810
|
const objs = {};
|
|
64395
64811
|
if (num3(o.v) !== null) objs.v = num3(o.v);
|
|
@@ -64422,7 +64838,7 @@ function remapViews(v1, ctx, planSheets) {
|
|
|
64422
64838
|
}
|
|
64423
64839
|
out.objects = objs;
|
|
64424
64840
|
}
|
|
64425
|
-
const gen =
|
|
64841
|
+
const gen = isObj4(v.generated) ? v.generated : null;
|
|
64426
64842
|
if (gen) {
|
|
64427
64843
|
const kind = str3(gen.kind);
|
|
64428
64844
|
const dir = kind === "level" ? "z" : kind === "grid-x" ? "x" : kind === "grid-y" ? "y" : null;
|
|
@@ -64485,8 +64901,8 @@ function axisCoordinate(ctx, id) {
|
|
|
64485
64901
|
}
|
|
64486
64902
|
function remapDetailPlacements(v1) {
|
|
64487
64903
|
const issues = [];
|
|
64488
|
-
if (!
|
|
64489
|
-
for (const d of arr3(v1.detail_placements).filter(
|
|
64904
|
+
if (!isObj4(v1)) return { placements: [], issues };
|
|
64905
|
+
for (const d of arr3(v1.detail_placements).filter(isObj4)) {
|
|
64490
64906
|
const id = str3(d.id) ?? "", sheet = str3(d.sheet) ?? "";
|
|
64491
64907
|
issues.push({
|
|
64492
64908
|
code: str3(d.anchorId) ? "detail-placement-unmigrated" : "detail-unanchored",
|
|
@@ -64499,7 +64915,7 @@ function remapDetailPlacements(v1) {
|
|
|
64499
64915
|
}
|
|
64500
64916
|
function remapDims3d(v1) {
|
|
64501
64917
|
const issues = [];
|
|
64502
|
-
const entries2 =
|
|
64918
|
+
const entries2 = isObj4(v1) ? arr3(v1.dims3d).filter(isObj4) : [];
|
|
64503
64919
|
if (entries2.length) {
|
|
64504
64920
|
issues.push({ code: "dims3d-ownerless", severity: "block", message: `${entries2.length} 3D dimension(s) carry world coordinates in the OLD scene frame and have no owner to recompute from; assign a frame, confirm keep-as-world, or discard them before migrating (epic \xA710)` });
|
|
64505
64921
|
}
|
|
@@ -64507,7 +64923,7 @@ function remapDims3d(v1) {
|
|
|
64507
64923
|
}
|
|
64508
64924
|
|
|
64509
64925
|
// steel-model-migrate.ts
|
|
64510
|
-
var
|
|
64926
|
+
var isObj4 = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
|
|
64511
64927
|
var arr3 = (v) => Array.isArray(v) ? v : [];
|
|
64512
64928
|
var str3 = (v) => typeof v === "string" ? v : null;
|
|
64513
64929
|
var num3 = (v) => typeof v === "number" && Number.isFinite(v) ? v : null;
|
|
@@ -64534,7 +64950,7 @@ var axisId = (dir, index) => `ax:${dir}:${index}`;
|
|
|
64534
64950
|
var v1GridId = (dir, index) => `${dir === "x" ? "gv" : "gh"}:${index}`;
|
|
64535
64951
|
function sheetAxes(plan, issues) {
|
|
64536
64952
|
const sheet = str3(plan.sheet) ?? "";
|
|
64537
|
-
const g =
|
|
64953
|
+
const g = isObj4(plan.grid) ? plan.grid : null;
|
|
64538
64954
|
if (!g) {
|
|
64539
64955
|
issues.push({ code: "grid-missing", severity: "block", sheet, message: `sheet "${sheet}" has no grid, so it cannot be registered` });
|
|
64540
64956
|
return null;
|
|
@@ -64558,11 +64974,11 @@ function sheetAxes(plan, issues) {
|
|
|
64558
64974
|
function bootstrapGrid(v1) {
|
|
64559
64975
|
const issues = [];
|
|
64560
64976
|
const empty = { grid: null, authority: null, frames: {}, samples: {}, gridIdRemap: {}, issues };
|
|
64561
|
-
if (!
|
|
64977
|
+
if (!isObj4(v1)) {
|
|
64562
64978
|
issues.push({ code: "not-an-object", severity: "block", message: "contract must be an object" });
|
|
64563
64979
|
return empty;
|
|
64564
64980
|
}
|
|
64565
|
-
const plans = arr3(v1.plans).filter(
|
|
64981
|
+
const plans = arr3(v1.plans).filter(isObj4);
|
|
64566
64982
|
if (!plans.length) {
|
|
64567
64983
|
issues.push({ code: "no-plans", severity: "block", message: "contract has no plans" });
|
|
64568
64984
|
return empty;
|
|
@@ -64577,7 +64993,7 @@ function bootstrapGrid(v1) {
|
|
|
64577
64993
|
if (ppf === null || ppf <= 0) issues.push({ code: "sheet-scale-missing", severity: "block", sheet, message: `sheet "${sheet}" has no usable pt_per_ft, so its display geometry cannot be converted to mm` });
|
|
64578
64994
|
else if (a) frames[sheet] = { originPx: a.originPx, k: mmPerPx(ppf) };
|
|
64579
64995
|
}
|
|
64580
|
-
const rootDatum =
|
|
64996
|
+
const rootDatum = isObj4(v1.datum) ? v1.datum : null;
|
|
64581
64997
|
let authority = null;
|
|
64582
64998
|
const datumSheet = rootDatum ? str3(rootDatum.sheet) : null;
|
|
64583
64999
|
if (datumSheet && parsed.get(datumSheet)) {
|
|
@@ -64624,7 +65040,7 @@ function bootstrapGrid(v1) {
|
|
|
64624
65040
|
const zUnion = [];
|
|
64625
65041
|
const zSeen = /* @__PURE__ */ new Map();
|
|
64626
65042
|
for (const p of plans) {
|
|
64627
|
-
const g =
|
|
65043
|
+
const g = isObj4(p.grid) ? p.grid : {};
|
|
64628
65044
|
const zSheet = str3(p.sheet) ?? "";
|
|
64629
65045
|
const authoredLabels = arr3(g.labels_z).map(str3);
|
|
64630
65046
|
for (const l of parsed.get(zSheet)?.z ?? []) {
|
|
@@ -64649,7 +65065,7 @@ function bootstrapGrid(v1) {
|
|
|
64649
65065
|
const canonicalZ = new Map(zUnion.map((l) => [gridLevelKey(l.mm), l.mm]));
|
|
64650
65066
|
const hiddenPerSheet = plans.map((p) => ({
|
|
64651
65067
|
sheet: str3(p.sheet) ?? "",
|
|
64652
|
-
hidden: new Set(arr3((
|
|
65068
|
+
hidden: new Set(arr3((isObj4(p.grid) ? p.grid : {}).hidden_z).map(num3).filter((v) => v !== null).map((mm) => canonicalZ.get(gridLevelKey(mm))).filter((v) => v !== void 0))
|
|
64653
65069
|
}));
|
|
64654
65070
|
const hiddenZ = [...new Set(hiddenPerSheet.flatMap((h) => [...h.hidden]))].sort((a, b) => a - b);
|
|
64655
65071
|
for (const mm of hiddenZ) {
|
|
@@ -64668,7 +65084,7 @@ function bootstrapGrid(v1) {
|
|
|
64668
65084
|
issues.push({ code: "grid-authority-missing", severity: "block", message: `the chosen authority sheet "${authority.sheet}" is not resolvable among the plans` });
|
|
64669
65085
|
return empty;
|
|
64670
65086
|
}
|
|
64671
|
-
const ag =
|
|
65087
|
+
const ag = isObj4(authPlan.grid) ? authPlan.grid : {};
|
|
64672
65088
|
const grid = { origin: [-shift[0], -shift[1]], x: str3(ag.x) ?? "", y: str3(ag.y) ?? "", z: formatLevels(zUnion.map((l) => l.mm)), axes };
|
|
64673
65089
|
if (typeof ag.on === "boolean") grid.on = ag.on;
|
|
64674
65090
|
if (str3(ag.labels_x) !== null) grid.labels_x = str3(ag.labels_x);
|
|
@@ -64679,7 +65095,7 @@ function bootstrapGrid(v1) {
|
|
|
64679
65095
|
for (const p of plans) {
|
|
64680
65096
|
const sheet = str3(p.sheet) ?? "";
|
|
64681
65097
|
if (sheet === authority.sheet) continue;
|
|
64682
|
-
const og =
|
|
65098
|
+
const og = isObj4(p.grid) ? p.grid : {};
|
|
64683
65099
|
for (const key of ["on", "labels_x", "labels_y", "ext"]) {
|
|
64684
65100
|
if (og[key] === void 0) continue;
|
|
64685
65101
|
const emitted = grid[key];
|
|
@@ -64716,7 +65132,7 @@ function bootstrapGrid(v1) {
|
|
|
64716
65132
|
}
|
|
64717
65133
|
function sheetPointsLocalMm(plan, f) {
|
|
64718
65134
|
const pts = [];
|
|
64719
|
-
for (const m of arr3(plan.members).filter(
|
|
65135
|
+
for (const m of arr3(plan.members).filter(isObj4)) {
|
|
64720
65136
|
for (const p of arr3(m.wp)) {
|
|
64721
65137
|
const q = toLocalMm(f, p);
|
|
64722
65138
|
if (q) pts.push(q);
|
|
@@ -64727,8 +65143,8 @@ function sheetPointsLocalMm(plan, f) {
|
|
|
64727
65143
|
function registerSheets(v1, boot) {
|
|
64728
65144
|
const issues = [];
|
|
64729
65145
|
const registrations = [];
|
|
64730
|
-
if (!
|
|
64731
|
-
for (const p of arr3(v1.plans).filter(
|
|
65146
|
+
if (!isObj4(v1)) return { registrations, issues };
|
|
65147
|
+
for (const p of arr3(v1.plans).filter(isObj4)) {
|
|
64732
65148
|
const sheet = str3(p.sheet) ?? "";
|
|
64733
65149
|
const f = boot.frames[sheet];
|
|
64734
65150
|
const samples = boot.samples[sheet] ?? [];
|
|
@@ -64816,12 +65232,12 @@ function materializeMembers(v1, boot, regs) {
|
|
|
64816
65232
|
const members = [];
|
|
64817
65233
|
const pendingColMetadata = [];
|
|
64818
65234
|
let skipped = 0;
|
|
64819
|
-
if (!
|
|
65235
|
+
if (!isObj4(v1)) return { members, pendingColMetadata, skipped, issues };
|
|
64820
65236
|
const bySheet = new Map(regs.map((r) => [r.sheet, r]));
|
|
64821
|
-
arr3(v1.plans).filter(
|
|
65237
|
+
arr3(v1.plans).filter(isObj4).forEach((p, pi) => {
|
|
64822
65238
|
const sheet = str3(p.sheet) ?? "";
|
|
64823
65239
|
const reg2 = bySheet.get(sheet), f = boot.frames[sheet];
|
|
64824
|
-
const planMembers = arr3(p.members).filter(
|
|
65240
|
+
const planMembers = arr3(p.members).filter(isObj4);
|
|
64825
65241
|
if (!reg2?.transform || !f) {
|
|
64826
65242
|
skipped += planMembers.length;
|
|
64827
65243
|
return;
|
|
@@ -64838,7 +65254,7 @@ function materializeMembers(v1, boot, regs) {
|
|
|
64838
65254
|
return;
|
|
64839
65255
|
}
|
|
64840
65256
|
const a = applySimilarity(reg2.transform, la), b = applySimilarity(reg2.transform, lb);
|
|
64841
|
-
const col =
|
|
65257
|
+
const col = isObj4(m.col) ? m.col : null;
|
|
64842
65258
|
const role = str3(m.role);
|
|
64843
65259
|
const srcEnds = arr3(m.ends);
|
|
64844
65260
|
const ends = [clone(srcEnds[0] ?? {}), clone(srcEnds[1] ?? {})];
|
|
@@ -65151,29 +65567,29 @@ function enumerateDispositions(v1) {
|
|
|
65151
65567
|
counts.set(k, e);
|
|
65152
65568
|
};
|
|
65153
65569
|
const walk2 = (obj2, path) => {
|
|
65154
|
-
if (!
|
|
65570
|
+
if (!isObj4(obj2)) return;
|
|
65155
65571
|
const known = DISPOSITIONS[path];
|
|
65156
65572
|
if (!known) return;
|
|
65157
65573
|
for (const key of Object.keys(obj2)) bump(path, key, known[key] ?? "unmapped");
|
|
65158
65574
|
};
|
|
65159
65575
|
walk2(v1, "$");
|
|
65160
|
-
walk2(
|
|
65161
|
-
for (const j of arr3(v1.joints).filter(
|
|
65162
|
-
for (const v of arr3(v1.views).filter(
|
|
65576
|
+
walk2(isObj4(v1.prop_labels) ? v1.prop_labels : {}, "$.prop_labels");
|
|
65577
|
+
for (const j of arr3(v1.joints).filter(isObj4)) walk2(j, "$.joints[]");
|
|
65578
|
+
for (const v of arr3(v1.views).filter(isObj4)) {
|
|
65163
65579
|
walk2(v, "$.views[]");
|
|
65164
65580
|
walk2(v.camera, "$.views[].camera");
|
|
65165
65581
|
walk2(v.objects, "$.views[].objects");
|
|
65166
65582
|
walk2(v.clips, "$.views[].clips");
|
|
65167
65583
|
}
|
|
65168
|
-
for (const d of arr3(v1.detail_placements).filter(
|
|
65169
|
-
for (const p of arr3(v1.plans).filter(
|
|
65584
|
+
for (const d of arr3(v1.detail_placements).filter(isObj4)) walk2(d, "$.detail_placements[]");
|
|
65585
|
+
for (const p of arr3(v1.plans).filter(isObj4)) {
|
|
65170
65586
|
walk2(p, "$.plans[]");
|
|
65171
|
-
if (
|
|
65172
|
-
for (const d of arr3(p.dims).filter(
|
|
65173
|
-
for (const m of arr3(p.members).filter(
|
|
65587
|
+
if (isObj4(p.grid)) walk2(p.grid, "$.plans[].grid");
|
|
65588
|
+
for (const d of arr3(p.dims).filter(isObj4)) walk2(d, "$.plans[].dims[]");
|
|
65589
|
+
for (const m of arr3(p.members).filter(isObj4)) {
|
|
65174
65590
|
walk2(m, "$.plans[].members[]");
|
|
65175
|
-
if (
|
|
65176
|
-
for (const e of arr3(m.ends).filter(
|
|
65591
|
+
if (isObj4(m.col)) walk2(m.col, "$.plans[].members[].col");
|
|
65592
|
+
for (const e of arr3(m.ends).filter(isObj4)) walk2(e, "$.plans[].members[].ends[]");
|
|
65177
65593
|
}
|
|
65178
65594
|
}
|
|
65179
65595
|
return [...counts.values()].sort((a, b) => a.path.localeCompare(b.path) || a.key.localeCompare(b.key));
|
|
@@ -65201,16 +65617,16 @@ function blobDigest(s) {
|
|
|
65201
65617
|
function canonicalHash(doc) {
|
|
65202
65618
|
const norm = (v, key) => {
|
|
65203
65619
|
if (key === "raster_b64" || key === "bg_b64") return typeof v === "string" ? blobDigest(v) : v;
|
|
65204
|
-
if (key === "sheet_previews" &&
|
|
65620
|
+
if (key === "sheet_previews" && isObj4(v)) return Object.fromEntries(Object.keys(v).sort().map((k) => [k, blobDigest(String(v[k]))]));
|
|
65205
65621
|
if (Array.isArray(v)) return v.map((e) => norm(e));
|
|
65206
|
-
if (
|
|
65622
|
+
if (isObj4(v)) return Object.fromEntries(Object.keys(v).sort().map((k) => [k, norm(v[k], k)]));
|
|
65207
65623
|
return v;
|
|
65208
65624
|
};
|
|
65209
65625
|
return (0, import_node_crypto18.createHash)("sha256").update(JSON.stringify(norm(doc))).digest("hex");
|
|
65210
65626
|
}
|
|
65211
65627
|
var KNOWN_READ_KINDS = /* @__PURE__ */ new Set(["steel-filter-segment"]);
|
|
65212
65628
|
function previewMigration(v1, ctx) {
|
|
65213
|
-
const doc =
|
|
65629
|
+
const doc = isObj4(v1) ? v1 : {};
|
|
65214
65630
|
const boot = bootstrapGrid(v1);
|
|
65215
65631
|
const reg2 = registerSheets(v1, boot);
|
|
65216
65632
|
const mat = materializeMembers(v1, boot, reg2.registrations);
|
|
@@ -65231,13 +65647,13 @@ function previewMigration(v1, ctx) {
|
|
|
65231
65647
|
if (role) out.role = role;
|
|
65232
65648
|
if (str3(r.memberType)) out.memberType = str3(r.memberType);
|
|
65233
65649
|
if (num3(r.rot) !== null) out.rot = num3(r.rot);
|
|
65234
|
-
if (
|
|
65650
|
+
if (isObj4(r.section)) out.section = clone(r.section);
|
|
65235
65651
|
if (typeof r.bf === "boolean") out.bf = r.bf;
|
|
65236
65652
|
if (typeof r.rfi === "boolean") out.rfi = r.rfi;
|
|
65237
65653
|
if (typeof r.mf === "boolean") out.mf = r.mf;
|
|
65238
65654
|
if (typeof r.verified === "boolean") out.verified = r.verified;
|
|
65239
|
-
if (
|
|
65240
|
-
if (
|
|
65655
|
+
if (isObj4(r.source)) out.source = clone(r.source);
|
|
65656
|
+
if (isObj4(r.brace)) out.brace = clone(r.brace);
|
|
65241
65657
|
const position = enumOr(r.position, ["top", "middle", "bottom"], `$.members[${m.sheet}/${m.v1Id}].position`, issues, m.sheet);
|
|
65242
65658
|
if (position) out.position = position;
|
|
65243
65659
|
const ends = m.ends.map((e) => {
|
|
@@ -65251,7 +65667,7 @@ function previewMigration(v1, ctx) {
|
|
|
65251
65667
|
return out;
|
|
65252
65668
|
});
|
|
65253
65669
|
const docHash = canonicalHash(doc);
|
|
65254
|
-
const authoredDrawingHash = str3((
|
|
65670
|
+
const authoredDrawingHash = str3((isObj4(doc.source) ? doc.source : {}).sha256);
|
|
65255
65671
|
const drawingHash = authoredDrawingHash ?? docHash;
|
|
65256
65672
|
if (!authoredDrawingHash) {
|
|
65257
65673
|
issues.push({ code: "drawing-hash-substituted", severity: "decision", message: "this contract records no source.sha256, so observations cite the v1 document hash in place of a source drawing hash; confirm the provenance before commit" });
|
|
@@ -65271,9 +65687,9 @@ function previewMigration(v1, ctx) {
|
|
|
65271
65687
|
let provisionalLocators = 0;
|
|
65272
65688
|
const obsBySheet = /* @__PURE__ */ new Map();
|
|
65273
65689
|
const obsIds = /* @__PURE__ */ new Set();
|
|
65274
|
-
const planByS = new Map(arr3(doc.plans).filter(
|
|
65690
|
+
const planByS = new Map(arr3(doc.plans).filter(isObj4).map((p) => [str3(p.sheet) ?? "", p]));
|
|
65275
65691
|
for (const { rec, memberId } of contributions) {
|
|
65276
|
-
const src =
|
|
65692
|
+
const src = isObj4(rec.raw.source) ? rec.raw.source : {};
|
|
65277
65693
|
const kind = str3(src.kind);
|
|
65278
65694
|
if (!kind || !KNOWN_READ_KINDS.has(kind)) legacyProvenance++;
|
|
65279
65695
|
const ppf = num3(planByS.get(rec.sheet)?.pt_per_ft) ?? 0;
|
|
@@ -65290,7 +65706,7 @@ function previewMigration(v1, ctx) {
|
|
|
65290
65706
|
str3(rec.raw.material),
|
|
65291
65707
|
str3(rec.raw.memberType),
|
|
65292
65708
|
num3(rec.raw.rot),
|
|
65293
|
-
|
|
65709
|
+
isObj4(rec.raw.col) ? [rec.raw.col.bos, rec.raw.col.tos, rec.raw.col.tosDef] : null,
|
|
65294
65710
|
// num(), not str(): an end's `tos` is NUMERIC, so str() returned null for every one of them and
|
|
65295
65711
|
// an authored endpoint-elevation change left the observation id untouched.
|
|
65296
65712
|
rec.ends.map((e) => [num3(e.tos), e.tosDef ?? null])
|
|
@@ -65321,7 +65737,7 @@ function previewMigration(v1, ctx) {
|
|
|
65321
65737
|
if (legacyProvenance) {
|
|
65322
65738
|
issues.push({ code: "legacy-provenance-assumed", severity: "decision", message: `${legacyProvenance} record(s) carry no recognised source.kind; their observations are recorded as 'auto-read' because a steel.takeoff/v1 document is by definition reader output, but that assumption must be confirmed before commit` });
|
|
65323
65739
|
}
|
|
65324
|
-
const plans = arr3(doc.plans).filter(
|
|
65740
|
+
const plans = arr3(doc.plans).filter(isObj4).map((p) => {
|
|
65325
65741
|
const sheet = str3(p.sheet) ?? "";
|
|
65326
65742
|
const out = { sheet, memberObservations: obsBySheet.get(sheet) ?? [] };
|
|
65327
65743
|
if (str3(p.title)) out.title = str3(p.title);
|
|
@@ -65336,7 +65752,7 @@ function previewMigration(v1, ctx) {
|
|
|
65336
65752
|
if (Array.isArray(p.read_notes)) out.read_notes = clone(p.read_notes);
|
|
65337
65753
|
if (str3(p.raster_b64)) out.raster_b64 = str3(p.raster_b64);
|
|
65338
65754
|
if (Array.isArray(p.clip)) out.clip = clone(p.clip);
|
|
65339
|
-
if (
|
|
65755
|
+
if (isObj4(p.frame) || p.frame === null) out.frame = clone(p.frame);
|
|
65340
65756
|
for (const k of ["segments", "labels", "details", "callouts", "tos_callouts"]) {
|
|
65341
65757
|
if (Array.isArray(p[k])) out[k] = clone(p[k]);
|
|
65342
65758
|
}
|
|
@@ -65346,15 +65762,15 @@ function previewMigration(v1, ctx) {
|
|
|
65346
65762
|
if (str3(p.control2_ref)) out.control2_ref = str3(p.control2_ref);
|
|
65347
65763
|
return out;
|
|
65348
65764
|
});
|
|
65349
|
-
for (const p of arr3(doc.plans).filter(
|
|
65350
|
-
const g =
|
|
65765
|
+
for (const p of arr3(doc.plans).filter(isObj4)) {
|
|
65766
|
+
const g = isObj4(p.grid) ? p.grid : {};
|
|
65351
65767
|
const sheet = str3(p.sheet) ?? "";
|
|
65352
65768
|
if (arr3(g.lines).length) issues.push({ code: "grid-lines-unmigrated", severity: "block", sheet, message: `sheet "${sheet}" carries ${arr3(g.lines).length} free grid line(s); migrating them onto the model grid is not implemented in this unit, so the contract refuses rather than losing them` });
|
|
65353
65769
|
for (const k of ["ends_x", "ends_y"]) {
|
|
65354
|
-
if (
|
|
65770
|
+
if (isObj4(g[k]) && Object.keys(g[k]).length) issues.push({ code: "grid-ends-unmigrated", severity: "block", sheet, message: `sheet "${sheet}" carries per-axis grid extents (${k}); converting them to v2 world-mm grid.ends is not implemented in this unit` });
|
|
65355
65771
|
}
|
|
65356
65772
|
}
|
|
65357
|
-
const scratch = arr3(doc.plans).filter(
|
|
65773
|
+
const scratch = arr3(doc.plans).filter(isObj4).reduce((n, p) => n + arr3(p.undo).length + arr3(p.redo).length, 0);
|
|
65358
65774
|
if (scratch) issues.push({ code: "scratch-history-discarded", severity: "decision", message: `${scratch} undo/redo entries are discarded: the undo snapshot shape changes with this migration (epic \xA710), so the history cannot carry` });
|
|
65359
65775
|
const remap = {
|
|
65360
65776
|
v: 1,
|
|
@@ -65383,7 +65799,7 @@ function previewMigration(v1, ctx) {
|
|
|
65383
65799
|
const labelsOut = remapPropLabels(doc, refCtx);
|
|
65384
65800
|
const dims3dOut = remapDims3d(doc);
|
|
65385
65801
|
issues.push(...jointsOut.issues, ...placementsOut.issues, ...viewsOut.issues, ...labelsOut.issues, ...dims3dOut.issues);
|
|
65386
|
-
arr3(doc.plans).filter(
|
|
65802
|
+
arr3(doc.plans).filter(isObj4).forEach((p, i) => {
|
|
65387
65803
|
const r = remapPlanDims(p, refCtx);
|
|
65388
65804
|
issues.push(...r.issues);
|
|
65389
65805
|
if (r.dims.length && plans[i]) plans[i].dims = r.dims;
|
|
@@ -65439,7 +65855,7 @@ function previewMigration(v1, ctx) {
|
|
|
65439
65855
|
fields,
|
|
65440
65856
|
unmapped,
|
|
65441
65857
|
counts: {
|
|
65442
|
-
v1Records: arr3(doc.plans).filter(
|
|
65858
|
+
v1Records: arr3(doc.plans).filter(isObj4).reduce((n, p) => n + arr3(p.members).length, 0),
|
|
65443
65859
|
materialized: mat.members.length,
|
|
65444
65860
|
skipped: mat.skipped,
|
|
65445
65861
|
canonicalMembers: members.length,
|
|
@@ -65488,7 +65904,7 @@ function registerMigrationPreviewRoute(app, deps) {
|
|
|
65488
65904
|
const bad = deps.projectAppMismatch(req.params.appId, project);
|
|
65489
65905
|
if (bad) return reply.status(404).send({ ok: false, error: bad });
|
|
65490
65906
|
}
|
|
65491
|
-
const body =
|
|
65907
|
+
const body = isObj4(req.body) ? req.body : null;
|
|
65492
65908
|
const doc = body && "contract" in body ? body.contract : project ? deps.readContract(req.params.appId, project) : deps.readContractForApp(req.params.appId);
|
|
65493
65909
|
if (doc == null) return reply.status(404).send({ ok: false, error: "no contract to migrate" });
|
|
65494
65910
|
const v = validateSteelTakeoff(doc);
|
|
@@ -76109,6 +76525,7 @@ async function startServer() {
|
|
|
76109
76525
|
return { ok: true, version: row };
|
|
76110
76526
|
});
|
|
76111
76527
|
registerRevisionRoutes(app);
|
|
76528
|
+
registerSteelPrepassRoute(app, { getProject, clearApproval });
|
|
76112
76529
|
registerKnowledgeRoutes(app);
|
|
76113
76530
|
function projectAppMismatch(appId, project) {
|
|
76114
76531
|
const p = getProject(project);
|
|
@@ -77510,7 +77927,7 @@ async function startServer() {
|
|
|
77510
77927
|
app.post("/api/steel-favourites", async (req, reply) => {
|
|
77511
77928
|
const { name, category, kind, params, geometry, schemaVersion, emittedBy } = req.body ?? {};
|
|
77512
77929
|
if (!name || !name.trim()) return reply.status(400).send({ ok: false, error: "name required" });
|
|
77513
|
-
if (kind !== "base-plate" && kind !== "shear-plate" && kind !== "custom") {
|
|
77930
|
+
if (kind !== "base-plate" && kind !== "shear-plate" && kind !== "brace-gusset" && kind !== "custom") {
|
|
77514
77931
|
return reply.status(400).send({ ok: false, error: "valid kind required" });
|
|
77515
77932
|
}
|
|
77516
77933
|
if (kind === "custom" ? !Array.isArray(geometry) || geometry.length === 0 : params == null || typeof params !== "object") {
|