- 화면이 처음 열릴 때 「낡음」을 모르면 [자동 제안]이 409 오류로 끝나던 흠 — 곧바로 drainage/live 로 다시 - 되돌리기가 관 자리만 되살리고 속성은 지금 것을 끌고 가 [배관 배치 초기화] 뒤 되돌려도 세월교가 사라지던 흠 — 되살린 걸음의 관 초안(세션)이 같은 자리면 그 속성 · id 로(adoptDraftPipes) - 시험 — 349 흐름(409 → 다시) · 347 pipe id(초안 속성 되살림) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VmC34fsxxbweEG3RUjs3Mn
54 lines
2.1 KiB
JavaScript
54 lines
2.1 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 { adoptDraftPipes, 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]),
|
|
// 369 되돌리기 — 그 걸음 초안이 같은 자리면 초안 속성 · id 를 씀 · 다르면 null
|
|
adopt: (() => {
|
|
const next = [
|
|
{ chainage_m: 100, reason: "user" },
|
|
{ chainage_m: 200, reason: "user" },
|
|
];
|
|
const draft = [
|
|
{ chainage_m: 100, id: "a1", facility: "ford_bridge" },
|
|
{ chainage_m: 200.004, id: "b2" },
|
|
];
|
|
return { draft: adoptDraftPipes(draft, next), next };
|
|
})(),
|
|
adoptOther: adoptDraftPipes([{ chainage_m: 120, id: "z" }], [{ chainage_m: 100 }]),
|
|
adoptNone: adoptDraftPipes(null, [{ chainage_m: 100 }]),
|
|
}),
|
|
);
|