/* 347 덧 관 고정 id — `reconcilePipes`(되돌리기 · 구조물 폼으로 관 목록이 바뀔 때)가 id 를 따라 옮기는지. * `B05_Profile_UI_Drainage_Parts.ts` 를 그 자리에서 트랜스파일 · 그 밖 import 는 빈 껍데기(틀 = helper_281_1). */ const path = require("path"); const { makeLoader } = require("./helper_ts_stub_loader.cjs"); const ROOT = path.join(__dirname, "..", ".."); const stub = new Proxy(function () {}, { get: () => stub, apply: () => stub }); const TOP = path.join(ROOT, "B05_Profile", "B05_Profile_UI_Drainage_Parts.ts"); // 진짜로 부를 import — 맨 위 = 고름 · 그 밑 = 관 짝 맞춤(472-6) · 그 밖 = 빈 껍데기 const realOf = (full) => (full === TOP ? ["design_selection"] : ["common_util_pipe_match"]); const { loadTs } = makeLoader({ root: ROOT, cache: false, requireFor: (full) => (request) => realOf(full).some((name) => request.endsWith(name)) ? loadTs(path.join(path.dirname(full), `${request}.ts`)) : stub, }); const { adoptDraftPipes, reconcilePipes } = loadTs(TOP); 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 }]), }), );