/* 472-5 5-B 헬퍼 — 상세 가게 칸 셋(`B06_Section_Section_Canon.ts`) 넣고 비움. 짝 = `test_472_5b_detail_owner.py`. */ const fs = require("fs"); const path = require("path"); const ROOT = path.join(__dirname, "..", ".."); const ts = require(path.join(ROOT, "config", "node_modules", "typescript")); const file = path.join(ROOT, "B06_Section", "B06_Section_Section_Canon.ts"); 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, () => ({ readState: () => null, })); const c = box.exports; const [a, b, d] = [{ tag: "a" }, { tag: "b" }, { tag: "d" }]; c.keepSavedDetail("P", 1, a); c.keepSavedDetail("P", 2, b); c.keepHeldDetail("P", 1, b); c.setDraftSectionDetail("P", d); const tag = (x) => x?.tag ?? null; const out = { saved1: tag(c.savedSectionDetail("P", 1)), held1: tag(c.heldSectionDetail("P", 1)), draft: tag(c.draftDetailOf("P")), }; c.forgetDetailSlots("P", 1); out.after1 = [ tag(c.savedSectionDetail("P", 1)), tag(c.heldSectionDetail("P", 1)), tag(c.savedSectionDetail("P", 2)), tag(c.draftDetailOf("P")), ]; c.forgetDetailSlots("P"); out.afterAll = [tag(c.savedSectionDetail("P", 2)), tag(c.draftDetailOf("P"))]; console.log(JSON.stringify(out));