feat(m01-sl): 시트 로직 Api 타입 · 함수 머리 · _data 를 git 밖으로

- SlOutside(표 · 노임 · 자재 · 장비 · 로직) · SlOutsideAt · SlOutsideValue · SlLogic · SlListItem · SlSaved
- slList · slGet · slSave · slDelete · slOutside · slPlain 머리(몸은 다음 커밋)
- SheetLogic/.gitignore — _data/

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KmELpdXFDRZHhfbGuRhSmL
This commit is contained in:
2026-10-01 12:59:34 +09:00
co-authored by Claude Opus 5.5
parent cdd670ff61
commit f5ba585f5f
2 changed files with 109 additions and 0 deletions
+1
View File
@@ -0,0 +1 @@
_data/
+108
View File
@@ -0,0 +1,108 @@
/* =============================================================================
* M01_SL_Api.ts
* 시트 로직 Api — 목록 · 열기 · 저장(서버가 바깥 값을 다시 넣고 같은 엔진으로 다시 셈) · 지우기 ·
* 바깥 값 한 번에 받기(품셈 표 · 노임 · 자재 · 장비 · 기존 로직 결과)
* 서버 = `M01_SL_Router.py`(`/api/m01/sl/*`) · 정함 `docs/raw/M01_쉬운단가/시트로직_정함.md` 4 · 5 · 6
* ========================================================================== */
import type { Workbook } from "../../A00_Common/spreadsheet/spreadsheet_types";
/** 바깥 값 하나 — 값은 열 때 · 저장 때 마스터에서 새로(표는 사본으로 들고 있지 않음)
* · 표 = 품셈 표 통째(머리 줄 + 줄 · 범위 조건 · 값은 「이름·아래」 「이름·위」 두 칸)
* · 노임 · 자재 = 그 줄의 단가(`/calc` 와 같은 셈 · 준용 · 낮은 값)
* · 장비 = 기계경비 로직 부름 글(EasyCalc `machineElement` 의 element) + 넘길 입력값 → 한 시간 값
* · 로직 = 기존 로직 결과(`/calc` · 돈 로직은 `field` 비목 · 기본 계) */
export type SlOutside =
| { id: string; kind: "표"; table: string }
| { id: string; kind: "노임"; key: string }
| { id: string; kind: "자재"; key: string }
| {
id: string;
kind: "장비";
element: string;
inputs: Record<string, unknown>;
field?: SlField;
}
| {
id: string;
kind: "로직";
key: string;
inputs: Record<string, unknown>;
field?: SlField;
};
export type SlField = "노무비" | "재료비" | "경비" | "계";
/** 바깥 값이 들어갈 자리 — 시트 id · 칸(표는 이 칸을 왼쪽 위로 펼침) */
export interface SlOutsideAt {
item: SlOutside;
sheet: string;
cell: string;
}
/** 바깥 값 답 — 표는 `rows`(머리 줄 포함) · 그 밖은 `value` · 못 구하면 ok false + 쉬운 말 */
export interface SlOutsideValue {
id: string;
ok: boolean;
value?: number | null;
rows?: (string | number | null)[][];
name?: string;
unit?: string;
reason?: string;
}
/** 시트 로직 한 벌 = 통합문서 하나(상자 = 시트) + 바깥 값 자리 */
export interface SlLogic {
/** 새 로직 null · 저장하면 서버가 `SL-0001` 꼴로 줌 */
key: string | null;
이름: string;
결과단위: string;
book: Workbook;
outside: SlOutsideAt[];
/** 다른 창이 더하는 칸(상자 · 알약 · 선 …)은 그대로 저장 · 돌려줌 */
[extra: string]: unknown;
}
/** 목록 한 줄 */
export interface SlListItem {
key: string;
이름: string;
결과단위: string;
/** 마지막 저장 때(ISO) */
saved: string;
}
/** 저장 답 — `logic.book.계산값` 은 서버가 다시 셈한 값 · `values` 는 넣은 바깥 값 */
export interface SlSaved {
key: string;
logic: SlLogic;
values: SlOutsideValue[];
}
const notReady = (): never => {
throw new Error("준비 중");
};
export async function slList(): Promise<SlListItem[]> {
return notReady();
}
export async function slGet(_key: string): Promise<SlLogic> {
return notReady();
}
export async function slSave(_logic: SlLogic): Promise<SlSaved> {
return notReady();
}
export async function slDelete(_key: string): Promise<void> {
return notReady();
}
export async function slOutside(_items: SlOutside[]): Promise<SlOutsideValue[]> {
return notReady();
}
/** 실패 → 쉬운 말(EasyCalc `plainError` 그대로) */
export function slPlain(_e: unknown): string {
return notReady();
}