/* ============================================================================= * A00_Common/design/logic/design_calc_node_carry.ts * 계산 Node 입구(`design_calc_node.ts`)의 노선 바뀐 [저장] 다시 얹기 몫(PLAN 472-6 6-B) — 브라우저가 쓰던 같은 TS. * * facility.rebase 입력 rebase { pipes?: { draft · before · after } · structures?: { draft · before · after } } → * { pipes · structures }(세션 초안을 서버가 따라 옮긴 정본 위에 · `rebasePipeDraft` · * `rebaseStructureDraft` · 없는 몫 null) * stations.carry 입력 carry(`RouteCarryInput` — 새 노선 상세 · 옛 노선 세션 칸 · 옛 열쇠 목록 · 측점 주인 · * 관 세션 장부 · 저장 관 앞뒤) → { patches · outside }(`routeCarryPatches`) * ========================================================================== */ import { rebasePipeDraft, rebaseStructureDraft, type FollowingPoint, type FollowingStructure, } from "@util/common_util_route_follow"; import { routeCarryPatches, type RouteCarryInput, } from "../../../B06_Section/logic/B06_Section_Route_Carry_Patch"; type Pipe = FollowingPoint & { id?: string | null }; type Structure = FollowingStructure & { structure_id?: string | null }; type Rebase = { draft: T[]; before: T[]; after: T[] }; export interface CarryInputs { rebase?: { pipes?: Rebase | null; structures?: Rebase | null }; carry?: RouteCarryInput; } /** id → 셈(입구 `RUNNERS` 에 얹음). */ export function carryRunners(inputs: CarryInputs): Record unknown> { return { "facility.rebase": () => { const rebase = inputs.rebase; if (!rebase) return null; const { pipes, structures } = rebase; return { pipes: pipes ? rebasePipeDraft(pipes.draft, pipes.before, pipes.after) : null, structures: structures ? rebaseStructureDraft(structures.draft, structures.before, structures.after) : null, }; }, "stations.carry": () => (inputs.carry ? routeCarryPatches(inputs.carry) : null), }; }