자동 변경 추적
JS Proxy가 모든 필드 변경을 감지합니다. 중첩 객체와 배열 변이(push, splice, sort)까지 RFC 6902 형식으로 자동 기록됩니다.
백엔드 DTO를 Proxy로 래핑하여 변경을 추적하고, save() 하나로 올바른 HTTP 메서드를 자동 결정합니다. MyBatis · JSP · 레거시 환경을 위한 데이터 계층 솔루션.
// ❌ 레거시 환경에서 반복되는 보일러플레이트
const name = document.getElementById('name').value
const city = document.getElementById('city').value
// ... 필드 수만큼 반복
const method = isNew ? 'POST' : hasChanges ? 'PATCH' : 'PUT'
const body = method === 'PATCH' ? buildPatchPayload() : JSON.stringify(allFields)
await fetch('/api/users/1', { method, body })
// 이 계산이 매번 정확하다고 보장할 수 있습니까?// ✅ DSM: 변경 추적과 HTTP 분기를 한 번에 위임
import { ApiHandler, DomainState } from '@2davi/rest-domain-state-manager'
const api = new ApiHandler({ host: 'localhost:8080' })
const user = await api.get('/api/users/1') // isNew: false
// 폼 수정 → Proxy가 자동으로 변경 이력 수집
user.data.name = formEl.name.value
user.data.address.city = formEl.city.value
// save() 하나로 끝. POST / PUT / PATCH는 자동 결정됩니다.
await user.save('/api/users/1')