Files
Aislo/resources/tester/helper_m02_treepanel.cjs
T
eomsangdonandClaude Opus 5.5 59cb28ce58 feat(M02): 구조물 라이브러리 한 화면 · 뿌리 셋 · 층 권한 한 벌 · 남의 층 목록 · 해시 진입 (PLAN 27-1)
- 층 권한 한 벌 M02_Layer_Access — 나무 · 항목(Router_Items) · 양식(Router_Layers) 같은 규칙 · owner 인자 · 남의 층은 읽기만 · 읽기로 남의 층에 뼈대 안 씀
- 남의 층 목록 GET /api/m02/layers/{company|personal}/owners — 시스템 관리자 회사 목록 · 회사 관리자 같은 회사 사람
- ?layer= 페이지 분리 폐기 → 한 화면 뿌리 셋(마스터 · 회사 · 개인) · 뿌리 부품 TreePanel_Roots(펼칠 때 불러옴) · TreePanel 은 owner · api 를 받는 공용 부품
- 진입 해시 ?open=구조물조합|일위대가|옵션|도면&root=&owner= · 항목 고르기 [관리 화면에서 고치기]도 이 해시
- 「항목 나무」 → 「구조물 라이브러리」
- 시험 test_m02_layer_access 새로 · layer_screen · template_layers 새 규칙으로

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-30 13:19:29 +09:00

55 lines
2.1 KiB
JavaScript

/* M02 구조물 라이브러리 자료(`M02_MasterTemplete_TreePanel_Model.ts`) 단위검증 헬퍼 — 트랜스파일해 Node 로 돌리고 JSON 으로 냄. */
const fs = require("fs");
const path = require("path");
const ts = require(path.join(__dirname, "..", "..", "config", "node_modules", "typescript"));
const file = path.join(__dirname, "..", "..", "M02_MasterTemplete", "M02_MasterTemplete_TreePanel_Model.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, require);
const m = box.exports;
const item = (열, 경로, key) => ({ key, 열, 경로, 이름: 경로.join(" "), 단위: "m", 일위대가: null });
const view = {
판: "v1",
폴더: [["빈 폴더"], ["돌기슭막이", "빈 아래"]],
items: [
item("c1", ["돌기슭막이", "메쌓기", "1.2m"], "SS000001"),
item("c2", ["돌기슭막이", "찰쌓기"], "SS000002"),
item("c3", ["다섯", "둘", "셋", "넷", "잎"], "SS000003"),
item("c4", ["최상위 항목"], "SS000004"),
],
};
const shape = (n) => ({
path: n.path,
items: n.items.map((i) => i.열),
folders: n.folders.map(shape),
});
const all = m.buildFolders(view);
const found = m.buildFolders(view, "찰쌓기");
process.stdout.write(
JSON.stringify({
all: shape(all),
count: m.countItems(all),
found: shape(found),
foundCount: m.countItems(found),
none: shape(m.buildFolders(view, "없는말")),
folders: m.listFolders(all),
ancestors: m.ancestorsOf(view, "c3"),
ancestorsTop: m.ancestorsOf(view, "c4"),
ancestorsNone: m.ancestorsOf(view, "zz"),
under: [
m.isUnder(["a", "b"], ["a"]),
m.isUnder(["a"], ["a"]),
m.isUnder(["a"], ["a", "b"]),
m.isUnder(["x"], ["a"]),
],
leaf: m.leafName(view.items[0]),
dir: m.folderOf(view.items[0]),
byKey: m.buildFolders(view, "ss000003").items.length + m.buildFolders(view, "SS000003").folders.length,
}),
);