@k-msg/template
K-Message 플랫폼의 템플릿 관리 및 검증 패키지입니다.
npm install @k-msg/template @k-msg/core# orbun add @k-msg/template @k-msg/core주요 기능
섹션 제목: “주요 기능”- Template Engine: 템플릿 종합 관리 시스템
- Variable Parsing: 템플릿 변수 자동 추출 및 검증
- Template Validation: 템플릿 내용/구조 내장 검증
- Template Registry: 템플릿 중앙 저장/조회
- Template Builder: 템플릿 동적 생성/수정
런타임 호환성
섹션 제목: “런타임 호환성”- 런타임에서 Node 내장 모듈에 의존하지 않아 Edge 환경에서
nodejs_compat없이 동작합니다.
기본 사용법
섹션 제목: “기본 사용법”import { interpolate } from '@k-msg/template';
const text = interpolate('[MyApp] Your verification code is #{code}.', { code: '123456',});
console.log(text); // "[MyApp] Your verification code is 123456."Template Registry
섹션 제목: “Template Registry”import { TemplateRegistry } from '@k-msg/template';
const registry = new TemplateRegistry();
// 템플릿 등록await registry.register({ id: 'otp-basic', name: 'Basic OTP Template', content: '[#{service}] Verification code: #{code}', category: 'AUTHENTICATION'});
// 템플릿 검색const templates = await registry.search({ category: 'AUTHENTICATION', status: 'ACTIVE'});Provider-backed TemplateService (선택)
섹션 제목: “Provider-backed TemplateService (선택)”TemplateService는 @k-msg/core의 TemplateProvider 인터페이스를 감싸는 작은 helper입니다.
import { TemplateService } from '@k-msg/template';import type { TemplateProvider } from '@k-msg/core';
const provider: TemplateProvider = /* your implementation */;const templateService = new TemplateService(provider);
await templateService.create({ code: 'OTP_001', name: 'OTP Verification', content: '[MyApp] Your verification code is #{code}.', category: 'AUTHENTICATION'});라이선스
섹션 제목: “라이선스”MIT