Files
Aislo/resources/tester/helper_823_1_swap.cjs
T
eomsangdonandClaude Opus 5.5 8bb22b39b1 fix(823-1): 불러온 단가산출 기계 바꿔 끼움 = 그 줄만 우리 값 즉시 · 바꿈 표시 · 되돌리기
- 원인: 다시 고르기(repick)가 엑셀 값 기억을 일부러 남김(812-9) → 엑셀 단가 기준 보기가 바꾼 기계 줄도 옛 엑셀 값으로 셈 · 이름만 바뀜
- 이은 가져온 줄을 다른 것으로 = 엑셀 값 뗌 · 연결 `바꿈` = 원래 연결 · 이름 · 규격 · 원래 것 다시 고름 = 되돌림 · 못 이은 줄 고름(812-9)은 그대로
- 줄에 「바꿈」 배지 + [되돌리기] · 머리 「바꾼 줄 n — 원본과 다름」 · 인력 · 재료 바꿈도 같은 길
- 서버: 바꾼 줄 있으면 셈 색인 = 로직 사본 위 · 저장 때 셈이 읽은 줄(내 기계 등)을 로직 사본에 박음(822-1 사본 규칙)
- 옛 칸 지문: 파일 24554.0 = 화면 왕복 24554 — 가져온 식 수식 저장 뒤 페이지 [저장] 409(「그 사이 양식이 바뀜」) 막음
- 시험 test_823_1_imported_swap 5(+ 헬퍼 helper_823_1_swap.cjs)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-12 18:54:16 +09:00

35 lines
1.7 KiB
JavaScript

/* 823-1 헬퍼 — common_util_line_stack_pick.ts(repick · unswap · swappedCount) · 가져온 식 보기(importView)를
* 그 자리에서 트랜스파일해 Node 로 돌림. stdin = {문서, 걸음 [{고름: {i, id, kind, p}} | {되돌림: {i, id}}]}
* stdout = 걸음마다 {문서, 엑셀보기, 바꾼줄} */
const fs = require("fs");
const path = require("path");
const ts = require(path.join(__dirname, "..", "..", "config", "node_modules", "typescript"));
const cache = new Map();
function load(at) {
if (cache.has(at)) return cache.get(at);
const js = ts.transpileModule(fs.readFileSync(at, "utf8"), {
compilerOptions: { module: ts.ModuleKind.CommonJS, target: ts.ScriptTarget.ES2020 },
}).outputText;
const box = { exports: {} };
cache.set(at, box.exports);
const need = (p) =>
p.startsWith(".") ? load(path.resolve(path.dirname(at), `${p}.ts`)) : require(p);
new Function("exports", "module", "require", js)(box.exports, box, need);
return box.exports;
}
const util = (name) => load(path.join(__dirname, "..", "..", "common_util", `${name}.ts`));
const pick = util("common_util_line_stack_pick");
const imp = util("common_util_formula_doc_import");
const input = JSON.parse(fs.readFileSync(0, "utf8"));
const doc = input.문서;
const out = [];
for (const step of input.걸음) {
if (step.고름) pick.repick(doc, step.고름.i, step.고름.id, step.고름.kind, step.고름.p);
if (step.되돌림) pick.unswap(doc, step.되돌림.i, step.되돌림.id);
const now = JSON.parse(JSON.stringify(doc));
out.push({ 문서: now, 엑셀보기: imp.importView(now, "엑셀"), 바꾼줄: pick.swappedCount(now) });
}
process.stdout.write(JSON.stringify(out));