Files
Aislo/resources/tester/helper_m02_precombo_scope.cjs
T
eomsangdonandClaude Opus 5.5 064d9ebae7 feat(m02): 일위대가 사전조합 나무 = 자유 폴더 — 분류 고정 폴더 걷어 냄(158-1)
- 서버: 층 뿌리 precombo_폴더.json 에 폴더 · 문서 자리만 적음(문서 파일 제자리) · GET/POST /layers/{층}/precombo-tree · 새 폴더 · 이름 바꾸기 · 옮기기 · 지우기(빈 폴더만) · 판 409 · 층 권한 그대로
- 화면: 오른쪽 클릭 [새 폴더] · [여기에 새 사전조합] · [이름 바꾸기] · [지우기] · 빈 자리 = 뿌리 메뉴 · 끌어 옮기기(구조물 조합 부품) · 자리 없는 문서 = 뿌리
- 구분 · 상세구분은 문서 칸 그대로(고르기 창 거름 precomboClasses)
- 시험: test_m02_precombo_folders 새로 · test_m02_precombo_scope 나무 시험 갈음

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SE9MxeXTu2uaDZ55BJowAY
2026-10-09 21:30:49 +09:00

58 lines
2.7 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/* M02 일위대가 사전조합 층(134-3) 헬퍼 — `M02_MasterTemplete_Api_Fetch.ts` 명시 owner 길 ·
* `M02_MasterTemplete_UI_Side_Precombo.ts` `buildPrecomboFolders`(158-1 자유 폴더) 를 트랜스파일해 Node 로 돌림 ·
* `precomboClasses`(134-5 · 구조물군 › 종류 + 공통) · fetch 대역이 부른 주소를 모음 ·
* stdin = {rows, def?, view?} · stdout = {urls, tree, classes} JSON. */
const fs = require("fs");
const path = require("path");
const ts = require(path.join(__dirname, "..", "..", "config", "node_modules", "typescript"));
const ROOT = path.join(__dirname, "..", "..");
const STUBS = { "@config/config_frontend": { API_BASE_URL: "/api" } };
const stub = new Proxy({}, { get: (_t, k) => (k === "currentLanguageIndex" ? () => 0 : () => {}) });
const cache = new Map();
function loadTs(file) {
const full = path.resolve(file);
if (cache.has(full)) return cache.get(full);
const js = ts.transpileModule(fs.readFileSync(full, "utf8"), {
compilerOptions: { module: ts.ModuleKind.CommonJS, target: ts.ScriptTarget.ES2020 },
}).outputText;
const box = { exports: {} };
cache.set(full, box.exports);
const localRequire = (request) => {
if (STUBS[request]) return STUBS[request];
if (request.startsWith(".") && !request.endsWith(".css"))
return loadTs(`${path.resolve(path.dirname(full), request)}.ts`);
return stub;
};
new Function("exports", "module", "require", js)(box.exports, box, localRequire);
return box.exports;
}
const urls = [];
global.fetch = async (url) => {
urls.push(url);
return { status: 200, ok: true, json: async () => ({ 양식: [] }) };
};
(async () => {
const input = JSON.parse(fs.readFileSync(0, "utf8"));
const api = loadTs(path.join(ROOT, "M02_MasterTemplete", "M02_MasterTemplete_Api_Fetch.ts"));
const side = loadTs(
path.join(ROOT, "M02_MasterTemplete", "M02_MasterTemplete_UI_Side_Precombo.ts"),
);
api.setActiveLayer("personal", "7/99"); // 페이지 = 남의 개인을 보는 중
await api.readTemplate("personal", "labor", "x1", null); // 페이지 층 = 그 사람
await api.readTemplate("personal", "precombo", "SC-000001", null, null); // 사전조합 = 내 개인
await api.listTemplates("company", null, "8"); // 사전조합 = 볼 회사
await api.saveTemplate("system", "precombo", "SC-000002", null, "v", {}, null);
const shape = (f) => ({
path: f.path,
count: side.docCount(f),
docs: f.docs.map((r) => r.이름),
folders: f.folders.map(shape),
});
const tree = shape(side.buildPrecomboFolders(input.rows, input.view ?? { 폴더: [], 자리: {} }));
const classes = input.def ? side.precomboClasses(input.def) : null; // 134-5
process.stdout.write(JSON.stringify({ urls, tree, classes }));
})();