190 lines
4.7 KiB
TypeScript
190 lines
4.7 KiB
TypeScript
/**
|
|
* 노드 팔레트 설정
|
|
*/
|
|
|
|
import type { NodePaletteItem } from "@/types/node-editor";
|
|
|
|
export const NODE_PALETTE: NodePaletteItem[] = [
|
|
// ========================================================================
|
|
// 데이터 소스
|
|
// ========================================================================
|
|
{
|
|
type: "tableSource",
|
|
label: "테이블",
|
|
icon: "",
|
|
description: "내부 데이터베이스 테이블에서 데이터를 읽어옵니다",
|
|
category: "source",
|
|
color: "#3B82F6", // 파란색
|
|
},
|
|
{
|
|
type: "externalDBSource",
|
|
label: "외부 DB",
|
|
icon: "",
|
|
description: "외부 데이터베이스에서 데이터를 읽어옵니다",
|
|
category: "source",
|
|
color: "#F59E0B", // 주황색
|
|
},
|
|
{
|
|
type: "restAPISource",
|
|
label: "REST API",
|
|
icon: "",
|
|
description: "REST API를 호출하여 데이터를 가져옵니다",
|
|
category: "source",
|
|
color: "#10B981", // 초록색
|
|
},
|
|
|
|
// ========================================================================
|
|
// 변환/조건
|
|
// ========================================================================
|
|
{
|
|
type: "condition",
|
|
label: "조건 분기",
|
|
icon: "",
|
|
description: "조건에 따라 데이터 흐름을 분기합니다",
|
|
category: "transform",
|
|
color: "#EAB308", // 노란색
|
|
},
|
|
{
|
|
type: "dataTransform",
|
|
label: "데이터 변환",
|
|
icon: "",
|
|
description: "데이터를 변환하거나 가공합니다",
|
|
category: "transform",
|
|
color: "#06B6D4", // 청록색
|
|
},
|
|
{
|
|
type: "aggregate",
|
|
label: "집계",
|
|
icon: "",
|
|
description: "SUM, COUNT, AVG 등 집계 연산을 수행합니다",
|
|
category: "transform",
|
|
color: "#A855F7", // 보라색
|
|
},
|
|
{
|
|
type: "formulaTransform",
|
|
label: "수식 변환",
|
|
icon: "",
|
|
description: "산술 연산, 함수, 조건문으로 새 필드를 계산합니다",
|
|
category: "transform",
|
|
color: "#F97316", // 오렌지색
|
|
},
|
|
|
|
// ========================================================================
|
|
// 액션
|
|
// ========================================================================
|
|
{
|
|
type: "insertAction",
|
|
label: "INSERT",
|
|
icon: "",
|
|
description: "데이터를 삽입합니다",
|
|
category: "action",
|
|
color: "#22C55E", // 초록색
|
|
},
|
|
{
|
|
type: "updateAction",
|
|
label: "UPDATE",
|
|
icon: "",
|
|
description: "데이터를 수정합니다",
|
|
category: "action",
|
|
color: "#3B82F6", // 파란색
|
|
},
|
|
{
|
|
type: "deleteAction",
|
|
label: "DELETE",
|
|
icon: "",
|
|
description: "데이터를 삭제합니다",
|
|
category: "action",
|
|
color: "#EF4444", // 빨간색
|
|
},
|
|
{
|
|
type: "upsertAction",
|
|
label: "UPSERT",
|
|
icon: "",
|
|
description: "데이터를 삽입하거나 수정합니다",
|
|
category: "action",
|
|
color: "#8B5CF6", // 보라색
|
|
},
|
|
|
|
// ========================================================================
|
|
// 외부 연동
|
|
// ========================================================================
|
|
{
|
|
type: "emailAction",
|
|
label: "메일 발송",
|
|
icon: "",
|
|
description: "SMTP를 통해 이메일을 발송합니다",
|
|
category: "external",
|
|
color: "#EC4899", // 핑크색
|
|
},
|
|
{
|
|
type: "scriptAction",
|
|
label: "스크립트 실행",
|
|
icon: "",
|
|
description: "Python, Shell 등 외부 스크립트를 실행합니다",
|
|
category: "external",
|
|
color: "#10B981", // 에메랄드
|
|
},
|
|
{
|
|
type: "httpRequestAction",
|
|
label: "HTTP 요청",
|
|
icon: "",
|
|
description: "REST API를 호출합니다",
|
|
category: "external",
|
|
color: "#06B6D4", // 시안
|
|
},
|
|
|
|
// ========================================================================
|
|
// 유틸리티
|
|
// ========================================================================
|
|
{
|
|
type: "comment",
|
|
label: "주석",
|
|
icon: "",
|
|
description: "주석을 추가합니다",
|
|
category: "utility",
|
|
color: "#6B7280", // 회색
|
|
},
|
|
];
|
|
|
|
export const NODE_CATEGORIES = [
|
|
{
|
|
id: "source",
|
|
label: "데이터 소스",
|
|
icon: "",
|
|
},
|
|
{
|
|
id: "transform",
|
|
label: "변환/조건",
|
|
icon: "",
|
|
},
|
|
{
|
|
id: "action",
|
|
label: "데이터 액션",
|
|
icon: "",
|
|
},
|
|
{
|
|
id: "external",
|
|
label: "외부 연동",
|
|
icon: "",
|
|
},
|
|
{
|
|
id: "utility",
|
|
label: "유틸리티",
|
|
icon: "",
|
|
},
|
|
] as const;
|
|
|
|
/**
|
|
* 노드 타입별 팔레트 아이템 조회
|
|
*/
|
|
export function getNodePaletteItem(type: string): NodePaletteItem | undefined {
|
|
return NODE_PALETTE.find((item) => item.type === type);
|
|
}
|
|
|
|
/**
|
|
* 카테고리별 노드 목록 조회
|
|
*/
|
|
export function getNodesByCategory(category: string): NodePaletteItem[] {
|
|
return NODE_PALETTE.filter((item) => item.category === category);
|
|
}
|