- PipePoint.id · ensure_pipe_ids(빈 id = p<누가거리 cm> · 겹치면 꼬리) — 읽기(parse) · 되붙이기(carry · 원본 id) · 저장(save) 세 자리 · 옛 자료는 다음 저장에 남음 · 노선 투영 · 새 자동 관 = 새 id - 화면 관 모양 DetailPipePoint.id · 배관 편집기 관이 id 를 쥐고 요청에 실음 · reconcilePipes 제자리 · 하나 옮긴 관 id 따라감 - 시험 test_347_pipe_id(8 · station_key = pipe:<id> · 화면 거울) · test_b04_pipe_points_facility 옛 자료 = id 하나만 더함 · test_312 옛 분석 = 낡음(409) 뒤 지문 찍고 자동 배치(새 지문 동작에 맞춤) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XWh5wNNycMkbwMpACz1rte
40 lines
1.5 KiB
JavaScript
40 lines
1.5 KiB
JavaScript
/* 347 덧 관 고정 id — `reconcilePipes`(되돌리기 · 구조물 폼으로 관 목록이 바뀔 때)가 id 를 따라 옮기는지.
|
|
* `B05_Profile_UI_Drainage_Parts.ts` 를 그 자리에서 트랜스파일 · 그 밖 import 는 빈 껍데기(틀 = helper_281_1).
|
|
*/
|
|
const fs = require("fs");
|
|
const path = require("path");
|
|
const ts = require(path.join(__dirname, "..", "..", "config", "node_modules", "typescript"));
|
|
|
|
const ROOT = path.join(__dirname, "..", "..");
|
|
const stub = new Proxy(function () {}, { get: () => stub, apply: () => stub });
|
|
|
|
function loadTs(file, real) {
|
|
const js = ts.transpileModule(fs.readFileSync(file, "utf8"), {
|
|
compilerOptions: { module: ts.ModuleKind.CommonJS, target: ts.ScriptTarget.ES2020 },
|
|
}).outputText;
|
|
const box = { exports: {} };
|
|
const localRequire = (request) =>
|
|
real.some((name) => request.endsWith(name))
|
|
? loadTs(path.join(path.dirname(file), `${request}.ts`), [])
|
|
: stub;
|
|
new Function("exports", "module", "require", js)(box.exports, box, localRequire);
|
|
return box.exports;
|
|
}
|
|
|
|
const { reconcilePipes } = loadTs(
|
|
path.join(ROOT, "B05_Profile", "B05_Profile_UI_Drainage_Parts.ts"),
|
|
["design_selection"],
|
|
);
|
|
const before = [
|
|
{ chainage_m: 100, reason: "stream", id: "a1" },
|
|
{ chainage_m: 200, reason: "user", id: "b2" },
|
|
];
|
|
process.stdout.write(
|
|
JSON.stringify({
|
|
same: reconcilePipes(before, [100, 200]),
|
|
moved: reconcilePipes(before, [100, 250]),
|
|
added: reconcilePipes(before, [100, 200, 300]),
|
|
twoMoved: reconcilePipes(before, [150, 250]),
|
|
}),
|
|
);
|