- Logic_Api.ts · Api_Fetch.ts · Logic_Note.ts — `/m01` 박힘 대신 setLogicApiPaths({ read, calc }) 길 묶음 · 안 넘기면 /m01 그대로 · 저장 · 만들기 · 관리자 길은 늘 /m01
- 새 M02_Logic_Lib_Read.py — /api/m02/logic-lib/ 로그인 길(logic/auto · logic/flow · elements · pick · materials · rows(인력 · 재료 · 기계만) · table(소요량 · 계수만) · calc · text) · M01 길 함수 그대로 부름 · row = 저장 안 한 줄 셈만 · 쓰기 없음
- main.py 등록(로그인만) · 지킴 시험 test_717_1_logic_lib.py + helper
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
48 lines
1.6 KiB
JavaScript
48 lines
1.6 KiB
JavaScript
/* 717-1 헬퍼 — 상세 부품 길 주입 · 가짜 fetch 로 부른 주소만 모음. 짝 = `test_717_1_logic_lib.py`. */
|
|
const path = require("path");
|
|
const { makeLoader } = require("./helper_ts_stub_loader.cjs");
|
|
|
|
const ROOT = path.join(__dirname, "..", "..");
|
|
const { load } = makeLoader({
|
|
root: ROOT,
|
|
stubs: { M01_MasterData_UI_Logic_Edit: {}, M01_MasterData_UI_Logic_Text: {} },
|
|
});
|
|
const urls = [];
|
|
global.fetch = async (url) => {
|
|
urls.push(String(url).replace("http://fake", ""));
|
|
return {
|
|
ok: true,
|
|
status: 200,
|
|
statusText: "",
|
|
json: async () => ({ logics: [], subs: [], items: [], rows: [] }),
|
|
};
|
|
};
|
|
|
|
const api = load("M01_MasterData", "M01_MasterData_UI_Logic_Api.ts");
|
|
const rows = load("M01_MasterData", "M01_MasterData_Api_Fetch.ts");
|
|
const note = load("M01_MasterData", "M01_MasterData_UI_Logic_Note.ts");
|
|
|
|
async function round(tag) {
|
|
await api.fetchLogic("K");
|
|
await api.fetchAuto("K");
|
|
await api.searchElements("재료", "q");
|
|
await api.fetchMaterials({ sub: "s" });
|
|
await api.runCalc({ key: "K", inputs: {} });
|
|
await api.runText({ key: "K", inputs: {} });
|
|
await rows.fetchRows("기계.json", 1, 5, "q");
|
|
await rows.fetchPick("price", "q");
|
|
await note.loadTable(`T-${tag}`);
|
|
await rows.fetchGroups(); // 관리자 길 — 늘 /m01
|
|
await api.saveFiles([]); // 저장 — 늘 /m01
|
|
return urls.splice(0).map((u) => u.split("?")[0]);
|
|
}
|
|
|
|
(async () => {
|
|
const out = { before: await round("a") };
|
|
api.setLogicApiPaths({ read: "/m02/logic-lib", calc: "/m02/calc-x" });
|
|
out.injected = await round("b");
|
|
api.setLogicApiPaths();
|
|
out.after = await round("c");
|
|
process.stdout.write(JSON.stringify(out));
|
|
})();
|