"use client"; /** * REST API 소스 노드 */ import { memo } from "react"; import { Handle, Position, NodeProps } from "reactflow"; import { Globe, Lock } from "lucide-react"; import type { RestAPISourceNodeData } from "@/types/node-editor"; const METHOD_COLORS: Record = { GET: "bg-green-100 text-green-700", POST: "bg-blue-100 text-blue-700", PUT: "bg-yellow-100 text-yellow-700", DELETE: "bg-red-100 text-red-700", PATCH: "bg-purple-100 text-purple-700", }; export const RestAPISourceNode = memo(({ data, selected }: NodeProps) => { const methodColor = METHOD_COLORS[data.method] || "bg-gray-100 text-gray-700"; return (
{/* 헤더 */}
{data.displayName || "REST API"}
{data.url || "URL 미설정"}
{data.authentication && }
{/* 본문 */}
{/* HTTP 메서드 */}
{data.method} {data.timeout && {data.timeout}ms}
{/* 헤더 */} {data.headers && Object.keys(data.headers).length > 0 && (
헤더:
{Object.entries(data.headers) .slice(0, 2) .map(([key, value]) => (
{key}: {value}
))} {Object.keys(data.headers).length > 2 && (
... 외 {Object.keys(data.headers).length - 2}개
)}
)} {/* 응답 매핑 */} {data.responseMapping && (
응답 경로: {data.responseMapping}
)}
{/* 핸들 */}
); }); RestAPISourceNode.displayName = "RestAPISourceNode";