- 헬퍼 동작 그대로(풀이 함수 본문은 옮겨 담음) · 제품 코드 안 고침 - 확인: 이 묶음 헬퍼를 쓰는 시험 218 개 전 218 통과 → 후 218 통과 (시험별 junit 대조 · 어긋남 0) Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
33 lines
1.4 KiB
JavaScript
33 lines
1.4 KiB
JavaScript
/* 272-1 측점 한 벌 — 진짜 `common_util_structure_station.ts` 의 `plantedChainages` · `oneStationList` 를
|
|
* Node 로 돌림. 입력 argv[2] JSON(파이썬과 같은 값) · 표준출력 JSON 한 벌.
|
|
*/
|
|
const fs = require("fs");
|
|
const path = require("path");
|
|
const { makeLoader } = require("./helper_ts_stub_loader.cjs");
|
|
const CATALOG = require("./helper_322_catalog_module.cjs"); // 구조물 표(322-1)
|
|
|
|
const ROOT = path.join(__dirname, "..", "..");
|
|
|
|
function loadTs(file) {
|
|
return makeLoader({
|
|
root: ROOT,
|
|
cache: false,
|
|
requireFor: (full) => (request) => {
|
|
if (CATALOG.isCatalogRequest(request)) return CATALOG;
|
|
throw new Error(`stub 없음: ${request} (${file})`);
|
|
},
|
|
}).loadTs(path.join(ROOT, file));
|
|
}
|
|
|
|
const input = JSON.parse(fs.readFileSync(process.argv[2], "utf8"));
|
|
const station = loadTs("common_util/common_util_structure_station.ts");
|
|
const out = {
|
|
planted: station.plantedChainages(input.pipes, input.structures, input.types),
|
|
list: station.oneStationList(input.server, input.fresh),
|
|
nodes: station.followMovedNodes(input.base.basePvi, input.gone, input.born, input.edited).nodes,
|
|
};
|
|
// 368-2 추가 측점 — 화면이 둔 읽는 곳(setPlusStations)으로 심는 자리에 듦
|
|
station.setPlusStations(() => input.plus);
|
|
out.plantedPlus = station.plantedChainages(input.pipes, input.structures, input.types);
|
|
process.stdout.write(JSON.stringify(out));
|