- 손 고침 [저장] = 492 이전처럼 바로 저장(확인 창 없음 · 세션 초안 통째 비움 없음) · 평면 · B06 평면 패널 띠 걷음 - 추천 [적용] 확인 창 = 서버 저장분(구조물 · 관 저장 파일 · 추가 측점) 수 — 응답 route_reset.dropped 와 같은 셈 · 세션 초안 안 셈 · 종단 편집 수 뺌 - 안 쓰게 된 것 걷음: routeShapeChanged(TS) · draftShapeChanged · askRouteReset · ROUTE_RESET_BAND · pageRoutePlan · 띠 CSS - 추가 측점 저장분 받기 fetchSavedPlusStations 한 줄 - 시험: test_283_route_reset_confirm 고쳐 씀(걷음 소스 · 창 수 = 알림 수 · 관 저장 파일 없음 0) · 저장 헬퍼 셋 확인 창 가짜 걷음 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
69 lines
2.6 KiB
JavaScript
69 lines
2.6 KiB
JavaScript
/* 472-5 남음 헬퍼 — 노선 바뀐 [저장] 뒤 옛 노선 세션 칸 · 초안 전 hold 비움(`design_save.ts` 그대로 · 서버 창구 ·
|
|
* 세션 창구는 가짜). 짝 = `test_472_5r_rock_owner.py`. 표준출력 JSON. */
|
|
const fs = require("fs");
|
|
const path = require("path");
|
|
const ts = require(path.join(__dirname, "..", "..", "config", "node_modules", "typescript"));
|
|
|
|
const ROOT = path.join(__dirname, "..", "..");
|
|
globalThis.window = { setTimeout, clearTimeout };
|
|
|
|
const anything = () =>
|
|
new Proxy({}, { get: (_target, key) => (key === "__esModule" ? false : () => undefined) });
|
|
|
|
function load(file, stubs) {
|
|
const js = ts.transpileModule(fs.readFileSync(file, "utf8"), {
|
|
compilerOptions: { module: ts.ModuleKind.CommonJS, target: ts.ScriptTarget.ES2020 },
|
|
}).outputText;
|
|
const box = { exports: {} };
|
|
new Function("exports", "module", "require", js)(box.exports, box, (r) => stubs[r] ?? anything());
|
|
return box.exports;
|
|
}
|
|
|
|
async function once(newRouteId, fail) {
|
|
const calls = [];
|
|
const KEYS = ["settings", "pipes", "structures", "plusStations", "alignment"];
|
|
const save = load(path.join(ROOT, "A00_Common", "design", "design_save.ts"), {
|
|
"../b_page_state": {
|
|
clearRouteDrafts: (p, r) => calls.push(`clearRouteDrafts:${p}:${r}`),
|
|
clearState: (name, p) => calls.push(`clearState:${name}:${p}`),
|
|
stateKey: () => null,
|
|
},
|
|
"./design_save_api": {
|
|
SAVE_PART_KEYS: [...KEYS, "cross"],
|
|
DesignSaveError: Error,
|
|
postDesignSave: async () => {
|
|
calls.push("post");
|
|
if (fail) throw new Error("서버 500");
|
|
return { waited: false, steps: { route: { route_id: newRouteId } } };
|
|
},
|
|
},
|
|
"../../B05_Profile/B05_Profile_UI_RouteEdit_Apply": {
|
|
pendingRouteSave: async () => ({ draft: 1 }),
|
|
routeCarryPart: () => ({ carry: {}, cross: { body: {} } }),
|
|
routeSaved: () => calls.push("routeSaved"),
|
|
routeSaveSummary: () => "",
|
|
rebuildAfterRouteSave: async () => calls.push("rebuild"),
|
|
},
|
|
});
|
|
const done = await save.saveDesign({
|
|
projectId: "p1",
|
|
routeId: () => 3,
|
|
crossPart: async () => null,
|
|
failed: () => calls.push("failed"),
|
|
});
|
|
// 저장 뒤 정리와 무관한 칸(종류 캐시)은 빼고 봄
|
|
return { done, calls: calls.filter((c) => !c.includes("structure-type-cache")) };
|
|
}
|
|
|
|
(async () => {
|
|
const out = {
|
|
moved: await once(9, false),
|
|
same: await once(3, false),
|
|
failed: await once(9, true),
|
|
};
|
|
process.stdout.write(JSON.stringify(out));
|
|
})().catch((error) => {
|
|
process.stderr.write(String(error.stack || error));
|
|
process.exit(1);
|
|
});
|