- 헬퍼 동작 그대로(풀이 함수 본문은 옮겨 담음) · 제품 코드 안 고침 - 확인: 이 묶음 헬퍼를 쓰는 시험 428 개 전 417 통과 → 후 417 통과 (시험별 junit 대조 · 어긋남 0) Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
114 lines
4.0 KiB
JavaScript
114 lines
4.0 KiB
JavaScript
/* 54-14 종단 알약 정보 라벨 줄 단위검증 헬퍼 — TS 를 그 자리에서 트랜스파일해 Node 로 돌린다.
|
|
* 결과는 표준출력에 JSON 한 벌. 화면 그릇은 쓰지 않는다.
|
|
*
|
|
* ⚠ 확장자가 `.cjs` 인 까닭은 `helper_b05_structures_form_summary.cjs` 머리와 같다.
|
|
*/
|
|
const fs = require("fs");
|
|
const path = require("path");
|
|
const CATALOG = require("./helper_322_catalog_module.cjs"); // 구조물 표(322-1)
|
|
const { makeLoader } = require("./helper_ts_stub_loader.cjs");
|
|
|
|
const ROOT = path.join(__dirname, "..", "..");
|
|
|
|
const { loadTs } = makeLoader({
|
|
root: ROOT,
|
|
requireFor: (full) => (request) => {
|
|
if (CATALOG.isCatalogRequest(request)) return CATALOG; // 구조물 표(본보기 · 323-7)
|
|
if (request.startsWith(".")) return loadTs(path.join(path.dirname(full), `${request}.ts`));
|
|
return require(request);
|
|
},
|
|
});
|
|
|
|
const { balloonLines } = loadTs(
|
|
path.join(ROOT, "B05_Profile", "logic", "B05_Profile_UI_Structures_Balloon.ts"),
|
|
);
|
|
|
|
const opt = (key, label, extra = {}) => ({ key, label, default: null, unit: null, ...extra });
|
|
const TYPES = {
|
|
pipe: {
|
|
type_id: "pipe",
|
|
name: "배관",
|
|
options: [
|
|
opt("pipe_diameter_mm", "관경", { default: "1000" }),
|
|
opt("inlet_type", "유입", { default: "기슭막이" }),
|
|
],
|
|
groups: [
|
|
{ id: "grv6lny", name: "관", options: [] },
|
|
{ id: "gnbf9m9", name: "관 보호공(유입)", options: [] },
|
|
{ id: "g9lq9uk", name: "관 보호공(유출)", options: [] },
|
|
],
|
|
spec_names: { soil_add: "흙막이 추가" },
|
|
},
|
|
box_culvert: {
|
|
type_id: "box_culvert",
|
|
name: "BOX암거",
|
|
options: [
|
|
opt("body_width_m", "폭", { default: 2 }),
|
|
opt("body_height_m", "높이", { default: 2 }),
|
|
],
|
|
groups: [],
|
|
},
|
|
cross_underdrain: {
|
|
type_id: "cross_underdrain",
|
|
name: "맹암거",
|
|
options: [
|
|
opt("culvert_height_m", "높이", { unit: "m" }),
|
|
opt("culvert_slope_pct", "기울기", { unit: "%" }),
|
|
],
|
|
groups: [
|
|
{ id: "gcrossud", name: "맹암거", options: ["culvert_height_m", "culvert_slope_pct"] },
|
|
],
|
|
},
|
|
retaining_wall: {
|
|
type_id: "retaining_wall",
|
|
name: "옹벽",
|
|
options: [
|
|
opt("height_m", "높이", { default: 2, unit: "m", visible: false }),
|
|
opt("length_m", "길이", { default: 10, unit: "m" }),
|
|
],
|
|
groups: [{ id: "gretaindetail", name: "상세 내용", options: ["height_m", "length_m"] }],
|
|
},
|
|
mirror: { type_id: "mirror", name: "반사경", options: [], groups: [] },
|
|
etc: { type_id: "etc", name: "기타", options: [opt("name", "이름")], groups: [] },
|
|
};
|
|
const point = (type_id, options = {}) => ({
|
|
structure_id: type_id,
|
|
type_id,
|
|
placement: "point",
|
|
chainage_m: 100,
|
|
options,
|
|
memo: "메모는 안 씀",
|
|
});
|
|
const head = (name) => ({ name, position: "5+0" });
|
|
const run = (structure, count) =>
|
|
balloonLines(structure, TYPES[structure.type_id], head("이름"), count);
|
|
|
|
const out = {
|
|
pipeFull: run(
|
|
point("pipe", {
|
|
pipe_diameter_mm: 1200,
|
|
inlet_type: "집수정",
|
|
inlet_structure: "L",
|
|
outlet_type: "기슭막이",
|
|
soil_add_1_structure: "기슭막이",
|
|
soil_add_1_form: "돌망태",
|
|
chute_add_1_structure: "도수로",
|
|
}),
|
|
),
|
|
pipeBlank: run(point("pipe")),
|
|
// 흙막이 개수 = 밖에서 정한 단 수(2) — 저장 1 벌 · 모자란 둘째는 빈 상자
|
|
pipeCount: run(point("pipe", { soil_add_1_structure: "기슭막이" }), (id) =>
|
|
id === "soil_add" ? 2 : undefined,
|
|
),
|
|
boxPreset: run(point("box_culvert", { body_width_m: 3, body_height_m: 3, wing_in: "있음" })),
|
|
boxBlank: run(point("box_culvert")),
|
|
underdrain: run(point("cross_underdrain", { culvert_height_m: 0.6 })),
|
|
underdrainBlank: run(point("cross_underdrain")),
|
|
wall: run(point("retaining_wall")),
|
|
wallAuto: run(point("retaining_wall", { length_m: "auto" })),
|
|
mirror: run(point("mirror", { anything: 1 })),
|
|
etcEmpty: run(point("etc", { name: "안내판" })),
|
|
etcNote: run(point("etc", { name: "안내판", etc_detail_1_note: "시험 비고" })),
|
|
};
|
|
process.stdout.write(JSON.stringify(out));
|