Files
Aislo/B07_DesignDetail/B07_DesignDetail_Note_Options_Node.ts
T
eomsangdonandClaude Opus 5.5 281c71b55b refactor(logic): 348-1 순수 계산 TS 49 파일 <페이지>/logic/ 로 옮김 — 이름 앞머리 그대로 · 동작 고침 없음
- 옮김: B04 2 · B05 23 · B06 11 · A00_Common/design 13 (9,299 줄) · 이미 logic/ 에 있던 16 파일 그대로
- 안 옮김: 묶음 입구(package.json build:*) · 파이썬 · 순수지만 계산 아닌 8 (보기 결선 · 콜백 · API 타입 · 갈아끼움 알림판)
- import 266 줄(142 파일) · 시험 · 주석 · 짝 표시 문자열 경로 고침 · B05 · B06 CLAUDE.md 짝 줄 logic/
- 시험 도우미 새 경로: 가짜 require 열쇠 · B05()/B06() 부름 · 형제 import 자리 · tsc 묶어 돌리는 시험 · 정규식 · rglob
- design_view_cross 줄 한도 시험 685 → 688 (긴 import 경로 줄바꿈 3줄)
- 확인: typecheck 0 · 서버 묶음 넷(corridor · server-calc · b07-extent · b07-note) 다시 지어 코드 같음(//#region 경로 주석만 다름) · 관련 시험 270 파일 — 남은 실패 19 는 옮기기 전과 같음

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014utrjfoW831Vc5wJUd13kL
2026-10-16 13:44:50 +09:00

46 lines
2.1 KiB
TypeScript

/* =============================================================================
* B07_DesignDetail_Note_Options_Node.ts
* B07 횡단도 표 위 CAD 칸 미리 넣음의 **좌측 패널 옵션 줄**을 서버가 내는 Node 진입점(166-1 ·
* CLAUDE.md 5장 「계산 자리」 ②).
*
* 화면(B06 [상세] 모달 `loadNoteThings`)과 같은 함수(`structureOptionLines` · 정의 덧칸 `withDefinition`)를
* 그대로 돌린다 — 파이썬 짝(`B07_DesignDetail_Engine_Cad_CulvertNote`)은 받은 줄을 구조물마다 조합 줄 뒤에 붙인다.
*
* 실행: node <번들> <입력.json> <출력.json>
* 입력 { things: [{ type_id, options }], types: GET /projects/structure-types 의 types,
* definition: 구조물 정의(GET /m02/structure-definition 과 같은 꼴) }
* 출력 { lines: string[][] } — things 차례대로
* 끝 코드: 0 성공 / 2 인자 오류
* ========================================================================== */
import { readFileSync, writeFileSync } from "node:fs";
import type { StructureType } from "../B05_Profile/B05_Profile_Api_Structures";
import { structureOptionLines } from "../B05_Profile/logic/B05_Profile_UI_Structures_Balloon";
import {
withDefinition,
type StructureDefinition,
} from "../B05_Profile/logic/B05_Profile_UI_Structures_Define";
interface Input {
things?: Array<{ type_id: string; options?: Record<string, string | number> }>;
types?: StructureType[];
definition?: StructureDefinition | null;
}
const [inputPath, outputPath] = process.argv.slice(2);
if (!inputPath || !outputPath) {
console.error("사용: node <번들> <입력.json> <출력.json>");
process.exit(2);
}
const input = JSON.parse(readFileSync(inputPath, "utf8")) as Input;
const types = new Map(
withDefinition(input.types ?? [], input.definition ?? null).map((type) => [type.type_id, type]),
);
const lines = (input.things ?? []).map((thing) =>
structureOptionLines(
{ type_id: thing.type_id, options: thing.options ?? {} },
types.get(thing.type_id),
),
);
writeFileSync(outputPath, JSON.stringify({ lines }));