Spaces:
Sleeping
Sleeping
Caner Giden commited on
Commit ·
8c55e35
1
Parent(s): ce754a0
fixed
Browse filesFiles changed (33)
- .DS_StoreAdded
- .gitattributesDeleted-2
- .gitignoreAdded+1
- README.md+362-2
- app/globals.cssAdded+103
- app/layout.tsxAdded+20
- app/page.tsxAdded+182
- app/workflow/[id]/page.tsxAdded+70
- components/ui/Badge.tsxAdded+35
- components/ui/Button.tsxAdded+39
- components/ui/Card.tsxAdded+25
- components/ui/Input.tsxAdded+29
- components/ui/Textarea.tsxAdded+28
- components/workflow/AIChatPanel.tsxAdded+191
- components/workflow/NodePalette.tsxAdded+290
- components/workflow/NodeSettingsPanel.tsxAdded+287
- components/workflow/NodeTypes.tsxAdded+221
- components/workflow/RunLogPanel.tsxAdded+129
- components/workflow/WorkflowCanvas.tsxAdded+170
- components/workflow/WorkflowMetaPanel.tsxAdded+213
- lib/api.tsAdded+220
- lib/utils.tsAdded+7
- next-env.d.tsAdded+6
- next.config.jsAdded+7
- package-lock.jsonAdded
- package.jsonAdded+33
- postcss.config.jsAdded+7
- store/workflowStore.tsAdded+376
- tailwind.config.tsAdded+49
- tsconfig.jsonAdded+41
- tsconfig.tsbuildinfoAdded
- types/nodes.tsAdded+2757
- types/workflow.tsAdded+60
12# Auto detect text files and perform LF normalization* text=auto1node_modules12# flowmind-studioAI destekli görsel workflow otomasyon platformu. n8n benzeri sürükle-bırak editörü ile 100+ node tipi, AI asistanı entegrasyonu ve çoklu servis entegrasyonları sunar.123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362# FlowMind StudioAI-Powered Workflow Automation Studio - n8n benzeri görsel workflow editörü ile yapay zeka asistanı entegrasyonu.## 🎯 Proje HakkındaFlowMind Studio, görsel bir workflow otomasyon platformudur. Kullanıcılar, sürükle-bırak arayüzü ile karmaşık iş akışlarını tasarlayabilir, AI asistanı ile doğal dil kullanarak workflow'lar oluşturabilir ve çeşitli entegrasyonlar ile otomasyonlar geliştirebilirler.## ✨ Özellikler### 🎨 Görsel Workflow Editörü- **ReactFlow Tabanlı Canvas**: Modern ve kullanıcı dostu node-based tasarım arayüzü- **Sürükle-Bırak**: Sol panelden node'ları canvas'a sürükleyerek ekleme- **Bağlantı Sistemi**: Node'ları birbirine bağlayarak akış oluşturma- **Zoom & Pan**: Canvas üzerinde gezinme ve yakınlaştırma- **MiniMap**: Workflow'un genel görünümünü gösteren harita- **Koyu Tema**: Göz yormayan modern arayüz tasarımı### 📊 Kapsamlı Node Sistemi (100+ Node Tipi)#### 🔴 Triggers (Tetikleyiciler)- `start` - Workflow başlangıç noktası- `webhook_trigger` - Webhook ile tetikleme- `schedule_trigger` - Zamanlanmış tetikleme- `email_trigger` - Email ile tetikleme- `file_watch_trigger` - Dosya değişikliği izleme#### 🔵 Flow & Logic (Akış Kontrolü)- `decision` - Koşullu dallanma- `switch` - Çoklu dallanma- `delay` - Gecikme ekleme- `parallel_split` - Paralel işlem başlatma- `parallel_join` - Paralel işlem birleştirme- `loop` - Döngü oluşturma- `merge` - Akışları birleştirme- `wait` - Bekleme#### 🤖 AI Nodes (Yapay Zeka)- `ai_step` - Genel AI adımı- `ai_classify` - Sınıflandırma- `ai_extract` - Veri çıkarma- `ai_simulate` - Simülasyon- `ai_embed` - Embedding oluşturma- `ai_summarize` - Özetleme- `ai_translate` - Çeviri#### 🔌 Integrations (Entegrasyonlar)**HTTP & Webhooks:**- `http` - HTTP istekleri- `webhook_call` - Webhook çağrıları- `rest_api` - REST API entegrasyonu- `graphql` - GraphQL sorguları**Database:**- `db_query` - Veritabanı sorgulama- `db_insert` - Veri ekleme- `db_update` - Veri güncelleme- `db_delete` - Veri silme**Google Servisleri:**- `google_sheets` - Google Sheets- `google_drive` - Google Drive- `google_calendar` - Google Calendar- `google_gmail` - Gmail- `google_analytics` - Google Analytics- `google_cloud_storage` - Cloud Storage**İletişim:**- `slack` - Slack entegrasyonu- `discord` - Discord entegrasyonu- `telegram` - Telegram entegrasyonu- `whatsapp` - WhatsApp entegrasyonu- `sms` - SMS gönderimi**Cloud Storage:**- `aws_s3` - Amazon S3- `azure_blob` - Azure Blob Storage- `dropbox` - Dropbox**Productivity:**- `notion` - Notion- `airtable` - Airtable- `trello` - Trello- `asana` - Asana- `jira` - Jira**E-commerce:**- `shopify` - Shopify- `woocommerce` - WooCommerce- `stripe` - Stripe- `paypal` - PayPal**Social Media:**- `twitter` - Twitter/X- `facebook` - Facebook- `instagram` - Instagram- `linkedin` - LinkedIn- `youtube` - YouTube**CRM:**- `salesforce` - Salesforce- `hubspot` - HubSpot- `zoho` - Zoho#### 🛠️ Data & Utils (Veri İşleme)- `transform` - Veri dönüştürme- `filter` - Veri filtreleme- `map_fields` - Alan eşleştirme- `log` - Loglama- `set_variable` - Değişken atama- `get_variable` - Değişken okuma- `json_parse` / `json_stringify` - JSON işlemleri- `csv_parse` / `csv_generate` - CSV işlemleri- `xml_parse` - XML işlemleri- `base64_encode` / `base64_decode` - Base64 işlemleri- `hash` - Hash oluşturma- `encrypt` / `decrypt` - Şifreleme#### 📤 Outputs (Çıktılar)- `output` - Çıktı oluşturma- `notify` - Bildirim gönderme- `email_send` - Email gönderme- `file_write` - Dosya yazma- `file_download` - Dosya indirme### 🤖 AI Asistanı- **Doğal Dil İşleme**: Türkçe ve İngilizce destekli AI asistanı- **Otomatik Workflow Oluşturma**: Doğal dilde istek yazarak workflow oluşturma- **Akıllı Node Önerileri**: AI'ın uygun node'ları önermesi- **Chat Arayüzü**: Kullanıcı dostu sohbet paneli### 💾 State Yönetimi- **Zustand Store**: Merkezi state yönetimi- **Workflow CRUD**: Oluşturma, okuma, güncelleme, silme- **Workflow Metadata**: Ad, açıklama ve aktif/pasif durumu güncelleme- **Node Yönetimi**: Node ekleme, güncelleme, silme- **Edge Yönetimi**: Bağlantı yönetimi- **Real-time Sync**: Canvas ve store arasında anlık senkronizasyon- **Kaydetme Sistemi**: Workflow adı, açıklaması, nodes ve edges birlikte kaydetme### 🔗 Backend Entegrasyonu- **REST API**: Tam RESTful API entegrasyonu- **Hata Yönetimi**: Kapsamlı hata yakalama ve gösterimi- **Veri Normalizasyonu**: Backend (snake_case) ↔ Frontend (camelCase) dönüşümü- **Workflow Kaydetme**: Ad, açıklama, aktif/pasif durumu ve graph yapısını birlikte kaydetme- **API Endpoints**: GET, POST, PUT, DELETE işlemleri ile tam CRUD desteği- **Veri Senkronizasyonu**: Workflow adı, açıklaması ve graph yapısının backend ile senkronizasyonu### 🎛️ UI Bileşenleri- **WorkflowMetaPanel**: Workflow bilgileri, ad, açıklama, aktif/pasif durumu - ad ve açıklama değişikliklerini kaydetme- **NodePalette**: Kategorize edilmiş node listesi, arama özelliği- **WorkflowCanvas**: Ana editör canvas, ReactFlow entegrasyonu- **NodeSettingsPanel**: Seçili node'un ayarlarını düzenleme- **AIChatPanel**: AI asistanı ile sohbet paneli- **RunLogPanel**: Workflow çalıştırma logları ve sonuçları## 🛠️ Teknolojiler- **Next.js 16** - App Router ile modern React framework- **React 18** - UI kütüphanesi- **TypeScript** - Tip güvenliği- **TailwindCSS** - Utility-first CSS framework- **ReactFlow** - Görsel workflow editörü- **Zustand** - Hafif state management- **Lucide React** - Modern ikon kütüphanesi## 📦 Kurulum```bash# Bağımlılıkları yüklenpm install# Geliştirme sunucusunu başlatnpm run dev```Uygulama [http://localhost:3000](http://localhost:3000) adresinde çalışacaktır.## 📁 Proje Yapısı```├── app/│ ├── page.tsx # Ana sayfa (Dashboard)│ ├── workflow/[id]/│ │ └── page.tsx # Workflow editör sayfası│ ├── layout.tsx # Root layout│ └── globals.css # Global stiller├── components/│ ├── ui/ # Temel UI bileşenleri│ │ ├── Badge.tsx│ │ ├── Button.tsx│ │ ├── Card.tsx│ │ ├── Input.tsx│ │ └── Textarea.tsx│ └── workflow/ # Workflow özel bileşenleri│ ├── NodeTypes.tsx # Custom node tipleri ve render│ ├── NodePalette.tsx # Node ekleme paneli│ ├── WorkflowCanvas.tsx # ReactFlow canvas│ ├── NodeSettingsPanel.tsx # Node ayarları paneli│ ├── AIChatPanel.tsx # AI asistan paneli│ ├── RunLogPanel.tsx # Çalıştırma logları paneli│ └── WorkflowMetaPanel.tsx # Workflow meta bilgileri paneli├── store/│ └── workflowStore.ts # Zustand state management├── types/│ ├── workflow.ts # Workflow TypeScript tipleri│ └── nodes.ts # Node tipleri ve metadata├── lib/│ ├── api.ts # Backend API entegrasyonu│ └── utils.ts # Yardımcı fonksiyonlar└── package.json # Proje bağımlılıkları```## 🚀 Kullanım### Yeni Workflow Oluşturma1. Ana sayfada **"Yeni Workflow"** butonuna tıklayın2. Otomatik olarak editör sayfasına yönlendirilirsiniz3. Üst panelden (WorkflowMetaPanel) workflow **adı** ve **açıklamasını** düzenleyin4. Sol panelden (NodePalette) istediğiniz node'u seçin5. Node'u canvas'a sürükleyin veya tıklayarak ekleyin6. Node'ları birbirine bağlamak için output portundan input portuna sürükleyin7. Node'a tıklayarak sağ panelden (NodeSettingsPanel) ayarlarını düzenleyin8. **"Kaydet"** butonuna tıklayarak workflow adı, açıklaması, nodes ve edges'i birlikte kaydedin> **Not**: Workflow adı ve açıklaması değişiklikleri kaydetmek için **"Kaydet"** butonuna tıklamanız gerekir. Kaydet butonu, workflow'un tüm bilgilerini (ad, açıklama, aktif/pasif durumu, nodes, edges) backend'e gönderir.### AI ile Workflow Oluşturma1. Workflow editör sayfasında sağ paneldeki **AI Chat** sekmesine gidin2. Doğal dilde workflow isteğinizi yazın (örn: "Bir email al, AI ile analiz et, sonucu Slack'e gönder")3. **"Akışı Öner"** butonuna tıklayın4. AI otomatik olarak uygun node'ları ve bağlantıları oluşturacak5. Oluşturulan workflow'u düzenleyebilir ve özelleştirebilirsiniz### Node Ayarlarını Düzenleme1. Canvas üzerinde bir node'a tıklayın2. Sağ panelde (NodeSettingsPanel) node'un ayarları görünecektir3. Node'un label'ını, config parametrelerini düzenleyin4. Değişiklikler anlık olarak uygulanır### Workflow Çalıştırma1. Workflow'u tasarlayın ve kaydedin2. Üst paneldeki **"Çalıştır"** butonuna tıklayın3. Alt panelde (RunLogPanel) çalıştırma logları görünecektir4. Her node'un durumunu (başarılı, hata, çalışıyor) görebilirsiniz5. Node'lara tıklayarak payload ve hata detaylarını inceleyebilirsiniz### Workflow Yönetimi- **Dashboard**: Ana sayfada tüm workflow'larınızı görüntüleyin- **Düzenleme**: Workflow kartına tıklayarak editöre gidin- **Ad/Açıklama Güncelleme**: Üst panelde workflow adı ve açıklamasını düzenleyip **"Kaydet"** butonuna tıklayın- **Silme**: Workflow kartındaki çöp kutusu ikonuna tıklayın veya üst paneldeki **"Sil"** butonunu kullanın- **Aktif/Pasif**: Workflow'un aktif/pasif durumunu üst panelden **"Aktifleştir/Pasifleştir"** butonu ile değiştirin- **Kaydetme**: Workflow adı, açıklaması, nodes ve edges değişikliklerini kaydetmek için **"Kaydet"** butonunu kullanın## 🔧 Geliştirme### Linting```bashnpm run lint```### Build```bashnpm run build```### Production```bashnpm run start```## 🌐 API EntegrasyonuProje, backend API ile entegre çalışmaktadır. API base URL'i `lib/api.ts` dosyasında tanımlanmıştır:```typescriptconst API_BASE = "https://flowmind-ai-flowmind-core-api.hf.space/api";```### API Endpoints- `GET /workflows/` - Tüm workflow'ları listele- `GET /workflows/:id` - Tek bir workflow getir- `POST /workflows/` - Yeni workflow oluştur- `PUT /workflows/:id` - Workflow güncelle (ad, açıklama, aktif/pasif durumu, graphJson)- `DELETE /workflows/:id` - Workflow sil### API Veri Formatı**Backend'e gönderilen format (snake_case):**```json{"name": "Workflow Adı","description": "Workflow Açıklaması","is_active": true,"graph_json": {"nodes": [...],"edges": [...]}}```**Backend'den gelen format (snake_case → camelCase):**```json{"id": "workflow-id","name": "Workflow Adı","description": "Workflow Açıklaması","isActive": true,"createdAt": "2024-01-01T00:00:00Z","updatedAt": "2024-01-01T00:00:00Z","graphJson": {"nodes": [...],"edges": [...]}}```Veri normalizasyonu `lib/api.ts` dosyasında otomatik olarak yapılmaktadır.## 📝 Önemli Notlar### Workflow Kaydetme- **Workflow adı ve açıklaması** değişikliklerini kaydetmek için **"Kaydet"** butonuna tıklamanız gerekir- Kaydet butonu, workflow'un tüm bilgilerini (ad, açıklama, aktif/pasif durumu, nodes, edges) backend'e gönderir- Workflow adı, açıklaması ve graph yapısı (nodes, edges) birlikte kaydedilir- Aktif/pasif durumu ayrı olarak **"Aktifleştir/Pasifleştir"** butonu ile güncellenebilir### Node Yönetimi- Tüm node'lar kategorize edilmiştir ve NodePalette'de gruplar halinde gösterilir- Node ayarları, her node tipine özel config schema'ya göre dinamik olarak oluşturulur- Node değişiklikleri anlık olarak store'a kaydedilir- Workflow kaydedildiğinde tüm node'lar ve bağlantılar backend'e gönderilir### Backend Entegrasyonu- Workflow'lar JSON formatında backend'e kaydedilir (graphJson)- Backend snake_case formatı kullanır, frontend camelCase formatı kullanır- Veri normalizasyonu otomatik olarak yapılır- API hataları kullanıcıya gösterilir### State Yönetimi- Canvas ve store arasında iki yönlü senkronizasyon vardır- Workflow adı ve açıklaması local state'te tutulur, kaydet butonuna tıklandığında backend'e gönderilir- Nodes ve edges değişiklikleri anlık olarak store'a kaydedilir### AI Asistanı- AI asistanı şu anda simüle edilmiş yanıtlar üretmektedir (gerçek API entegrasyonu için güncellenebilir)## 📄 LisansMIT
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103@tailwind base;@tailwind components;@tailwind utilities;
:root { --background: #0f172a; --foreground: #f8fafc; --card: #1e293b; --card-foreground: #f1f5f9; --border: #334155; --input: #1e293b; --ring: #0ea5e9; --muted: #334155; --muted-foreground: #94a3b8; --accent: #1e293b; --accent-foreground: #f8fafc;}
body { --muted-foreground: var(--muted-foreground);}
* { margin: 0; padding: 0; box-sizing: border-box;}
html { color-scheme: dark;}
body { @apply bg-dark-950 text-foreground antialiased; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;}
@layer utilities { .scrollbar-hide { -ms-overflow-style: none; scrollbar-width: none; } .scrollbar-hide::-webkit-scrollbar { display: none; } .scrollbar-thin { scrollbar-width: thin; } .scrollbar-thin::-webkit-scrollbar { width: 6px; height: 6px; } .scrollbar-thin::-webkit-scrollbar-track { @apply bg-dark-900; } .scrollbar-thin::-webkit-scrollbar-thumb { @apply bg-dark-600 rounded-full; } .scrollbar-thin::-webkit-scrollbar-thumb:hover { @apply bg-dark-500; }}
/* ReactFlow custom styles */.react-flow__node { @apply font-medium;}
.react-flow__handle { @apply bg-primary-500 border-2 border-dark-800; width: 10px; height: 10px;}
.react-flow__handle-top { top: -5px;}
.react-flow__handle-bottom { bottom: -5px;}
.react-flow__edge-path { @apply stroke-primary-500; stroke-width: 2;}
.react-flow__edge.selected .react-flow__edge-path { @apply stroke-primary-400; stroke-width: 3;}
.react-flow__controls { @apply bg-dark-800 border-dark-700;}
.react-flow__controls-button { @apply bg-dark-800 border-dark-700 text-foreground hover:bg-dark-700;}
1234567891011121314151617181920import type { Metadata } from "next";import "./globals.css";
export const metadata: Metadata = { title: "FlowMind Studio", description: "AI-Powered Workflow Automation Studio",};
export default function RootLayout({ children,}: Readonly<{ children: React.ReactNode;}>) { return ( <html lang="tr" className="dark"> <body>{children}</body> </html> );}
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182"use client";
import { useEffect, useState } from "react";import { useRouter } from "next/navigation";import { useWorkflowStore } from "@/store/workflowStore";import { Workflow } from "@/types/workflow";import Button from "@/components/ui/Button";import Card from "@/components/ui/Card";import Badge from "@/components/ui/Badge";import { Plus, Play, Edit, Trash2, Sparkles, Clock } from "lucide-react";
export default function HomePage() { const router = useRouter(); const { workflows, isLoading, error, fetchWorkflows, createWorkflow, deleteWorkflow, } = useWorkflowStore();
useEffect(() => { fetchWorkflows(); }, [fetchWorkflows]);
const handleCreateNew = async () => { const newWorkflow = await createWorkflow({ name: "Yeni Workflow", description: "", isActive: false, graphJson: { nodes: [], edges: [] }, });
if (newWorkflow) { router.push(`/workflow/${newWorkflow.id}`); } else { alert("Workflow oluşturulurken bir hata oluştu!"); } };
const handleEdit = (workflow: Workflow) => { router.push(`/workflow/${workflow.id}`); };
const handleDelete = async (id: string) => { if (confirm("Bu workflow'u silmek istediğinize emin misiniz?")) { const success = await deleteWorkflow(id); if (!success) { alert("Workflow silinirken bir hata oluştu!"); } } };
const formatDate = (dateString: string) => { const date = new Date(dateString); return date.toLocaleDateString("tr-TR", { day: "numeric", month: "short", year: "numeric", }); };
return ( <div className="min-h-screen bg-dark-950"> {/* Header */} <header className="border-b border-dark-800 bg-dark-900/50 backdrop-blur-sm sticky top-0 z-50"> <div className="max-w-7xl mx-auto px-6 py-4"> <div className="flex items-center justify-between"> <div className="flex items-center gap-3"> <div className="w-10 h-10 bg-gradient-to-br from-primary-500 to-primary-700 rounded-lg flex items-center justify-center"> <Sparkles className="w-6 h-6 text-white" /> </div> <div> <h1 className="text-2xl font-bold text-foreground">FlowMind Studio</h1> <p className="text-sm text-muted-foreground">AI-Powered Workflow Automation</p> </div> </div> <Button onClick={handleCreateNew} size="lg" className="gap-2"> <Plus className="w-5 h-5" /> Yeni Workflow </Button> </div> </div> </header>
{/* Main Content */} <main className="max-w-7xl mx-auto px-6 py-8"> <div className="mb-8"> <h2 className="text-3xl font-bold text-foreground mb-2">Hoş Geldiniz</h2> <p className="text-muted-foreground"> Workflow'larınızı yönetin, yeni otomasyonlar oluşturun ve AI asistanı ile akışlarınızı tasarlayın. </p> </div>
{error && ( <div className="mb-4 p-4 bg-red-600/10 border border-red-600/30 rounded-lg"> <p className="text-red-400 text-sm">Hata: {error}</p> </div> )}
{isLoading ? ( <div className="flex items-center justify-center py-20"> <div className="animate-spin rounded-full h-12 w-12 border-t-2 border-b-2 border-primary-500"></div> </div> ) : workflows.length === 0 ? ( <Card className="text-center py-16"> <Sparkles className="w-16 h-16 text-primary-500 mx-auto mb-4 opacity-50" /> <h3 className="text-xl font-semibold text-foreground mb-2"> Henüz workflow'unuz yok </h3> <p className="text-muted-foreground mb-6"> İlk workflow'unuzu oluşturarak başlayın </p> <Button onClick={handleCreateNew} size="lg" className="gap-2"> <Plus className="w-5 h-5" /> Yeni Workflow Oluştur </Button> </Card> ) : ( <div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6"> {workflows.map((workflow: Workflow) => ( <Card key={workflow.id} className="hover:border-primary-500/50 transition-all duration-200 cursor-pointer group" onClick={() => handleEdit(workflow)} > <div className="flex items-start justify-between mb-4"> <div className="flex-1"> <h3 className="text-lg font-semibold text-foreground mb-1 group-hover:text-primary-400 transition-colors"> {workflow.name} </h3> {workflow.description && ( <p className="text-sm text-muted-foreground line-clamp-2"> {workflow.description} </p> )} </div> <Badge variant={workflow.isActive ? "success" : "default"}> {workflow.isActive ? "Aktif" : "Pasif"} </Badge> </div>
<div className="flex items-center gap-2 text-xs text-muted-foreground mb-4"> <Clock className="w-3 h-3" /> <span>Güncellendi: {formatDate(workflow.updatedAt)}</span> </div>
<div className="flex items-center gap-2 pt-4 border-t border-dark-800"> <Button variant="ghost" size="sm" className="flex-1 gap-2" onClick={(e: React.MouseEvent) => { e.stopPropagation(); handleEdit(workflow); }} > <Edit className="w-4 h-4" /> Düzenle </Button> <Button variant="ghost" size="sm" className="gap-2 text-red-400 hover:text-red-300 hover:bg-red-600/10" onClick={(e: React.MouseEvent) => { e.stopPropagation(); handleDelete(workflow.id); }} > <Trash2 className="w-4 h-4" /> </Button> </div> </Card> ))} </div> )} </main> </div> );}
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970"use client";
import { useEffect } from "react";import { useParams } from "next/navigation";import { useWorkflowStore } from "@/store/workflowStore";import { ReactFlowProvider } from "reactflow";import WorkflowMetaPanel from "@/components/workflow/WorkflowMetaPanel";import NodePalette from "@/components/workflow/NodePalette";import WorkflowCanvas from "@/components/workflow/WorkflowCanvas";import NodeSettingsPanel from "@/components/workflow/NodeSettingsPanel";import AIChatPanel from "@/components/workflow/AIChatPanel";import RunLogPanel from "@/components/workflow/RunLogPanel";
export default function WorkflowPage() { const params = useParams(); const { fetchWorkflow, isLoading, error } = useWorkflowStore();
useEffect(() => { if (params.id && typeof params.id === "string") { fetchWorkflow(params.id); } }, [params.id, fetchWorkflow]);
if (isLoading) { return ( <div className="h-screen flex items-center justify-center bg-dark-950"> <div className="animate-spin rounded-full h-12 w-12 border-t-2 border-b-2 border-primary-500"></div> </div> ); }
if (error) { return ( <div className="h-screen flex items-center justify-center bg-dark-950"> <div className="text-center"> <p className="text-red-400 mb-4">Hata: {error}</p> <button onClick={() => window.location.href = "/"} className="px-4 py-2 bg-primary-600 text-white rounded-lg hover:bg-primary-700" > Ana Sayfaya Dön </button> </div> </div> ); }
return ( <div className="h-screen flex flex-col bg-dark-950"> <WorkflowMetaPanel /> <div className="flex-1 flex overflow-hidden relative"> <ReactFlowProvider> <NodePalette /> <div className="flex-1 relative"> <WorkflowCanvas /> <RunLogPanel /> </div> </ReactFlowProvider> <div className="flex"> <NodeSettingsPanel /> <AIChatPanel /> </div> </div> </div> );}
1234567891011121314151617181920212223242526272829303132333435import { HTMLAttributes, forwardRef } from "react";import { cn } from "@/lib/utils";
interface BadgeProps extends HTMLAttributes<HTMLSpanElement> { variant?: "default" | "success" | "error" | "warning" | "info";}
const Badge = forwardRef<HTMLSpanElement, BadgeProps>( ({ className, variant = "default", ...props }, ref) => { const variants = { default: "bg-dark-800 text-foreground", success: "bg-green-600/20 text-green-400 border border-green-600/30", error: "bg-red-600/20 text-red-400 border border-red-600/30", warning: "bg-yellow-600/20 text-yellow-400 border border-yellow-600/30", info: "bg-blue-600/20 text-blue-400 border border-blue-600/30", }; return ( <span ref={ref} className={cn( "inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium", variants[variant], className )} {...props} /> ); });
Badge.displayName = "Badge";
export default Badge;
123456789101112131415161718192021222324252627282930313233343536373839import { ButtonHTMLAttributes, forwardRef } from "react";import { cn } from "@/lib/utils";
interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> { variant?: "primary" | "secondary" | "danger" | "ghost"; size?: "sm" | "md" | "lg";}
const Button = forwardRef<HTMLButtonElement, ButtonProps>( ({ className, variant = "primary", size = "md", ...props }, ref) => { const baseStyles = "inline-flex items-center justify-center rounded-lg font-medium transition-all duration-200 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-offset-dark-950 disabled:opacity-50 disabled:cursor-not-allowed"; const variants = { primary: "bg-primary-600 text-white hover:bg-primary-700 focus:ring-primary-500", secondary: "bg-dark-800 text-foreground border border-dark-700 hover:bg-dark-700 focus:ring-dark-600", danger: "bg-red-600 text-white hover:bg-red-700 focus:ring-red-500", ghost: "text-foreground hover:bg-dark-800 focus:ring-dark-600", }; const sizes = { sm: "px-3 py-1.5 text-sm", md: "px-4 py-2 text-base", lg: "px-6 py-3 text-lg", }; return ( <button ref={ref} className={cn(baseStyles, variants[variant], sizes[size], className)} {...props} /> ); });
Button.displayName = "Button";
export default Button;
12345678910111213141516171819202122232425import { HTMLAttributes, forwardRef } from "react";import { cn } from "@/lib/utils";
interface CardProps extends HTMLAttributes<HTMLDivElement> {}
const Card = forwardRef<HTMLDivElement, CardProps>( ({ className, ...props }, ref) => { return ( <div ref={ref} className={cn( "bg-dark-900 border border-dark-800 rounded-xl p-6", "shadow-lg", className )} {...props} /> ); });
Card.displayName = "Card";
export default Card;
1234567891011121314151617181920212223242526272829import { InputHTMLAttributes, forwardRef } from "react";import { cn } from "@/lib/utils";
interface InputProps extends InputHTMLAttributes<HTMLInputElement> {}
const Input = forwardRef<HTMLInputElement, InputProps>( ({ className, type = "text", ...props }, ref) => { return ( <input type={type} ref={ref} className={cn( "w-full px-4 py-2 bg-dark-800 border border-dark-700 rounded-lg", "text-foreground placeholder:text-muted-foreground", "focus:outline-none focus:ring-2 focus:ring-primary-500 focus:border-transparent", "transition-all duration-200", "disabled:opacity-50 disabled:cursor-not-allowed", className )} {...props} /> ); });
Input.displayName = "Input";
export default Input;
12345678910111213141516171819202122232425262728import { TextareaHTMLAttributes, forwardRef } from "react";import { cn } from "@/lib/utils";
interface TextareaProps extends TextareaHTMLAttributes<HTMLTextAreaElement> {}
const Textarea = forwardRef<HTMLTextAreaElement, TextareaProps>( ({ className, ...props }, ref) => { return ( <textarea ref={ref} className={cn( "w-full px-4 py-2 bg-dark-800 border border-dark-700 rounded-lg", "text-foreground placeholder:text-muted-foreground", "focus:outline-none focus:ring-2 focus:ring-primary-500 focus:border-transparent", "transition-all duration-200 resize-none", "disabled:opacity-50 disabled:cursor-not-allowed", className )} {...props} /> ); });
Textarea.displayName = "Textarea";
export default Textarea;
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191"use client";
import { useState, useRef, useEffect } from "react";import { useWorkflowStore } from "@/store/workflowStore";import Button from "@/components/ui/Button";import Textarea from "@/components/ui/Textarea";import { Send, Sparkles, Loader2 } from "lucide-react";
interface Message { role: "user" | "assistant"; content: string;}
export default function AIChatPanel() { const { nodes, edges, setNodes, setEdges } = useWorkflowStore(); const [messages, setMessages] = useState<Message[]>([ { role: "assistant", content: "Merhaba! Workflow'unuzu oluşturmanıza yardımcı olabilirim. Ne yapmak istiyorsunuz?", }, ]); const [input, setInput] = useState(""); const [isLoading, setIsLoading] = useState(false); const messagesEndRef = useRef<HTMLDivElement>(null);
const scrollToBottom = () => { messagesEndRef.current?.scrollIntoView({ behavior: "smooth" }); };
useEffect(() => { scrollToBottom(); }, [messages]);
const handleGenerateFlow = async () => { if (!input.trim()) return;
const userInput = input.trim(); const userMessage: Message = { role: "user", content: userInput }; setMessages((prev) => [...prev, userMessage]); setInput(""); setIsLoading(true);
// Simüle edilmiş AI yanıtı - gerçek uygulamada API'ye istek atılacak setTimeout(() => { const assistantMessage: Message = { role: "assistant", content: `Anladım! "${userInput}" için bir workflow oluşturuyorum...`, }; setMessages((prev) => [...prev, assistantMessage]);
// Örnek workflow oluştur const generatedNodes = [ { id: "start-1", type: "custom", position: { x: 250, y: 100 }, data: { type: "start", label: "Start" }, }, { id: "http-1", type: "custom", position: { x: 250, y: 200 }, data: { type: "http", label: "Fetch Data", method: "GET", url: "" }, }, { id: "ai-step-1", type: "custom", position: { x: 250, y: 300 }, data: { type: "ai_step", label: "AI Analysis", config: { provider: "openai", model: "gpt-4", user_template: userInput, temperature: 0.7, max_tokens: 1000, output_mode: "text", }, }, }, { id: "output-1", type: "custom", position: { x: 250, y: 400 }, data: { type: "output", label: "Output" }, }, ];
const generatedEdges = [ { id: "e1", source: "start-1", target: "http-1" }, { id: "e2", source: "http-1", target: "ai-step-1" }, { id: "e3", source: "ai-step-1", target: "output-1" }, ];
setNodes(generatedNodes as any); setEdges(generatedEdges as any);
setTimeout(() => { setMessages((prev) => [ ...prev, { role: "assistant", content: "Workflow oluşturuldu! Canvas'da görüntüleyebilir ve düzenleyebilirsiniz.", }, ]); setIsLoading(false); }, 1000); }, 1500); };
return ( <div className="w-80 bg-dark-900 border-l border-dark-800 h-full flex flex-col"> <div className="p-4 border-b border-dark-800"> <div className="flex items-center gap-2 mb-1"> <div className="w-8 h-8 bg-gradient-to-br from-purple-500 to-purple-700 rounded-lg flex items-center justify-center"> <Sparkles className="w-4 h-4 text-white" /> </div> <h3 className="text-sm font-semibold text-foreground">AI Asistan</h3> </div> <p className="text-xs text-muted-foreground"> Doğal dil ile workflow oluşturun </p> </div>
<div className="flex-1 overflow-y-auto scrollbar-thin p-4 space-y-4"> {messages.map((message, index) => ( <div key={index} className={`flex ${message.role === "user" ? "justify-end" : "justify-start"}`} > <div className={`max-w-[85%] rounded-lg px-3 py-2 ${ message.role === "user" ? "bg-primary-600 text-white" : "bg-dark-800 text-foreground" }`} > <p className="text-sm whitespace-pre-wrap">{message.content}</p> </div> </div> ))} {isLoading && ( <div className="flex justify-start"> <div className="bg-dark-800 rounded-lg px-3 py-2"> <Loader2 className="w-4 h-4 text-primary-500 animate-spin" /> </div> </div> )} <div ref={messagesEndRef} /> </div>
<div className="p-4 border-t border-dark-800"> <div className="space-y-2"> <Textarea value={input} onChange={(e) => setInput(e.target.value)} placeholder="Örn: Her gün saat 09:00'da Twitter'dan #btc etiketli son 10 tweet'i çek, sentiment analizi yap, negatifse bana e-posta gönder." rows={3} onKeyDown={(e) => { if (e.key === "Enter" && !e.shiftKey) { e.preventDefault(); handleGenerateFlow(); } }} /> <Button onClick={handleGenerateFlow} disabled={!input.trim() || isLoading} className="w-full gap-2" > {isLoading ? ( <> <Loader2 className="w-4 h-4 animate-spin" /> Oluşturuluyor... </> ) : ( <> <Send className="w-4 h-4" /> Akışı Öner </> )} </Button> </div> </div> </div> );}
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290"use client";
import { useState } from "react";import { useReactFlow } from "reactflow";import { NODE_REGISTRY, NODE_CATEGORIES, NodeCategory } from "@/types/nodes";import { NodeType } from "@/types/workflow";import { useWorkflowStore } from "@/store/workflowStore";import { Play, Brain, GitBranch, Globe, FileOutput, Settings, Filter, Clock, Webhook, Database, Bell, Zap, Repeat, GitMerge, ArrowRightLeft, FileText, PlayCircle, ChevronDown, ChevronRight, Mail, File, Code, Variable, FileSpreadsheet, HardDrive, Calendar, BarChart, Cloud, MessageSquare, MessageCircle, Send, Phone, Table, CheckSquare, Bug, ShoppingCart, ShoppingBag, CreditCard, Twitter, Facebook, Instagram, Linkedin, Youtube, TrendingUp, Lock, Unlock, FileCode, Download, Grid,} from "lucide-react";
// Icon mappingconst iconMap: Record<string, any> = { Play, Brain, GitBranch, Globe, FileOutput, Settings, Filter, Clock, Webhook, Database, Bell, Zap, Repeat, GitMerge, ArrowRightLeft, FileText, PlayCircle, Mail, File, Code, Variable, FileSpreadsheet, HardDrive, Calendar, BarChart, Cloud, MessageSquare, MessageCircle, Send, Phone, Table, CheckSquare, Bug, ShoppingCart, ShoppingBag, CreditCard, Twitter, Facebook, Instagram, Linkedin, Youtube, TrendingUp, Lock, Unlock, FileCode, Download, Grid,};
interface NodeOption { type: NodeType; label: string; icon: any; description: string; color: string; phase?: 1 | 2 | 3;}
export default function NodePalette() { const { screenToFlowPosition } = useReactFlow(); const { addNode: addNodeToStore } = useWorkflowStore(); const [expandedCategories, setExpandedCategories] = useState<Set<NodeCategory>>( new Set(["triggers", "flow-logic", "ai-nodes", "integrations", "data-utils", "outputs"]) );
const toggleCategory = (category: NodeCategory) => { const newExpanded = new Set(expandedCategories); if (newExpanded.has(category)) { newExpanded.delete(category); } else { newExpanded.add(category); } setExpandedCategories(newExpanded); };
const handleAddNode = (nodeType: NodeType) => { const metadata = NODE_REGISTRY[nodeType]; if (!metadata) return;
const position = screenToFlowPosition({ x: window.innerWidth / 2, y: window.innerHeight / 2, });
const Icon = iconMap[metadata.icon] || Settings;
const newNode = { id: `${nodeType}-${Date.now()}`, type: "custom", // ReactFlow için her zaman "custom" position, data: { type: nodeType, // Gerçek node type'ı (start, ai_step, http, vs.) label: metadata.label, description: metadata.description, config: {}, }, };
// Direkt store'a ekle - WorkflowCanvas otomatik olarak ReactFlow'a yazacak console.log("➕ NodePalette - Node ekleniyor:", newNode); addNodeToStore(newNode); console.log("➕ NodePalette - Node store'a eklendi"); };
// Kategorilere göre node'ları grupla const nodesByCategory = Object.entries(NODE_REGISTRY).reduce( (acc, [nodeType, metadata]) => { if (!acc[metadata.category]) { acc[metadata.category] = []; } acc[metadata.category].push({ ...metadata, type: nodeType as NodeType }); return acc; }, {} as Record<NodeCategory, Array<{ type: NodeType } & typeof NODE_REGISTRY[NodeType]>> );
// Kategori sırası const categoryOrder: NodeCategory[] = [ "triggers", "flow-logic", "ai-nodes", "integrations", "data-utils", "outputs", ];
return ( <div className="w-72 bg-dark-900 border-r border-dark-800 h-full flex flex-col"> <div className="p-4 border-b border-dark-800"> <h3 className="text-sm font-semibold text-foreground mb-1">Node'lar</h3> <p className="text-xs text-muted-foreground"> Kategorilere göre düzenlenmiş node'lar </p> </div>
<div className="flex-1 overflow-y-auto scrollbar-thin"> {categoryOrder.map((category) => { const categoryInfo = NODE_CATEGORIES[category]; const nodes = nodesByCategory[category] || []; const isExpanded = expandedCategories.has(category); const CategoryIcon = iconMap[categoryInfo.icon] || Settings;
// Sadece Phase 1 node'ları göster (isteğe bağlı filtreleme) const visibleNodes = nodes; // Tüm node'ları göster, phase 2+ olanları disabled yapabiliriz
if (visibleNodes.length === 0) return null;
return ( <div key={category} className="border-b border-dark-800"> <button onClick={() => toggleCategory(category)} className="w-full px-4 py-3 flex items-center justify-between hover:bg-dark-800 transition-colors" > <div className="flex items-center gap-2"> {isExpanded ? ( <ChevronDown className="w-4 h-4 text-muted-foreground" /> ) : ( <ChevronRight className="w-4 h-4 text-muted-foreground" /> )} <CategoryIcon className="w-4 h-4 text-primary-500" /> <span className="text-sm font-medium text-foreground"> {categoryInfo.label} </span> </div> <span className="text-xs text-muted-foreground"> {visibleNodes.length} </span> </button>
{isExpanded && ( <div className="px-2 pb-2 space-y-1"> {visibleNodes.map((node) => { const Icon = iconMap[node.icon] || Settings; const isPhase2Plus = node.phase && node.phase > 1;
return ( <button key={node.type} onClick={() => !isPhase2Plus && handleAddNode(node.type)} disabled={isPhase2Plus} className={`w-full p-2.5 rounded-lg border transition-all duration-200 text-left group ${ isPhase2Plus ? "border-dark-700 bg-dark-800/50 opacity-50 cursor-not-allowed" : "border-dark-700 bg-dark-800 hover:border-primary-500/50 hover:bg-dark-700" }`} title={ isPhase2Plus ? `${node.label} - Phase ${node.phase} (Yakında)` : node.description } > <div className="flex items-center gap-2.5"> <div className={`${node.color} p-1.5 rounded flex-shrink-0`}> <Icon className="w-3.5 h-3.5 text-white" /> </div> <div className="flex-1 min-w-0"> <div className={`text-xs font-medium ${ isPhase2Plus ? "text-muted-foreground" : "text-foreground group-hover:text-primary-400 transition-colors" }`} > {node.label} {isPhase2Plus && ( <span className="ml-1 text-[10px] text-muted-foreground"> (Phase {node.phase}) </span> )} </div> {!isPhase2Plus && ( <div className="text-[10px] text-muted-foreground mt-0.5 line-clamp-1"> {node.description} </div> )} </div> </div> </button> ); })} </div> )} </div> ); })} </div> </div> );}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287"use client";
import { useEffect, useState } from "react";import { useWorkflowStore } from "@/store/workflowStore";import { NodeType } from "@/types/workflow";import { NODE_REGISTRY } from "@/types/nodes";import Input from "@/components/ui/Input";import Textarea from "@/components/ui/Textarea";import { X } from "lucide-react";
export default function NodeSettingsPanel() { const { selectedNode, updateNode, setSelectedNode } = useWorkflowStore(); const [config, setConfig] = useState<any>({});
useEffect(() => { if (selectedNode) { setConfig(selectedNode.data.config || {}); } }, [selectedNode]);
if (!selectedNode) { return ( <div className="w-80 bg-dark-900 border-l border-dark-800 h-full flex items-center justify-center"> <div className="text-center p-6"> <p className="text-muted-foreground text-sm"> Bir node seçin veya yeni node ekleyin </p> </div> </div> ); }
const nodeType = selectedNode.data.type as NodeType; const metadata = NODE_REGISTRY[nodeType];
const handleUpdate = (field: string, value: any) => { const newConfig = { ...config, [field]: value }; setConfig(newConfig); updateNode(selectedNode.id, { ...selectedNode.data, config: newConfig, }); };
const handleLabelUpdate = (label: string) => { updateNode(selectedNode.id, { ...selectedNode.data, label, }); };
const renderConfigField = (key: string, fieldSchema: any) => { const value = config[key] ?? fieldSchema.default ?? "";
switch (fieldSchema.type) { case "string": return ( <div key={key} className="space-y-2"> <label className="block text-sm font-medium text-foreground"> {fieldSchema.label} {fieldSchema.required && <span className="text-red-400 ml-1">*</span>} </label> {fieldSchema.description && ( <p className="text-xs text-muted-foreground">{fieldSchema.description}</p> )} <Input value={value} onChange={(e) => handleUpdate(key, e.target.value)} placeholder={fieldSchema.placeholder} required={fieldSchema.required} /> </div> );
case "textarea": return ( <div key={key} className="space-y-2"> <label className="block text-sm font-medium text-foreground"> {fieldSchema.label} {fieldSchema.required && <span className="text-red-400 ml-1">*</span>} </label> {fieldSchema.description && ( <p className="text-xs text-muted-foreground">{fieldSchema.description}</p> )} <Textarea value={value} onChange={(e) => handleUpdate(key, e.target.value)} placeholder={fieldSchema.placeholder} rows={fieldSchema.rows || 4} required={fieldSchema.required} /> </div> );
case "number": return ( <div key={key} className="space-y-2"> <label className="block text-sm font-medium text-foreground"> {fieldSchema.label} {fieldSchema.required && <span className="text-red-400 ml-1">*</span>} </label> {fieldSchema.description && ( <p className="text-xs text-muted-foreground">{fieldSchema.description}</p> )} <Input type="number" value={value} onChange={(e) => handleUpdate( key, fieldSchema.step === 0.1 ? parseFloat(e.target.value) : parseInt(e.target.value) ) } placeholder={fieldSchema.placeholder} min={fieldSchema.min} max={fieldSchema.max} step={fieldSchema.step} required={fieldSchema.required} /> </div> );
case "boolean": return ( <div key={key} className="space-y-2"> <label className="flex items-center gap-2 cursor-pointer"> <input type="checkbox" checked={value} onChange={(e) => handleUpdate(key, e.target.checked)} className="w-4 h-4 rounded border-dark-700 bg-dark-800 text-primary-600 focus:ring-primary-500" /> <span className="text-sm font-medium text-foreground"> {fieldSchema.label} {fieldSchema.required && <span className="text-red-400 ml-1">*</span>} </span> </label> {fieldSchema.description && ( <p className="text-xs text-muted-foreground ml-6">{fieldSchema.description}</p> )} </div> );
case "select": return ( <div key={key} className="space-y-2"> <label className="block text-sm font-medium text-foreground"> {fieldSchema.label} {fieldSchema.required && <span className="text-red-400 ml-1">*</span>} </label> {fieldSchema.description && ( <p className="text-xs text-muted-foreground">{fieldSchema.description}</p> )} <select value={value} onChange={(e) => handleUpdate(key, e.target.value)} className="w-full px-4 py-2 bg-dark-800 border border-dark-700 rounded-lg text-foreground focus:outline-none focus:ring-2 focus:ring-primary-500" required={fieldSchema.required} > {fieldSchema.options?.map((option: any) => ( <option key={option.value} value={option.value}> {option.label} </option> ))} </select> </div> );
case "object": return ( <div key={key} className="space-y-2"> <label className="block text-sm font-medium text-foreground"> {fieldSchema.label} {fieldSchema.required && <span className="text-red-400 ml-1">*</span>} </label> {fieldSchema.description && ( <p className="text-xs text-muted-foreground">{fieldSchema.description}</p> )} <Textarea value={ typeof value === "object" ? JSON.stringify(value, null, 2) : value || "{}" } onChange={(e) => { try { handleUpdate(key, JSON.parse(e.target.value)); } catch { // Invalid JSON, ignore } }} rows={6} placeholder="{}" /> </div> );
case "array": return ( <div key={key} className="space-y-2"> <label className="block text-sm font-medium text-foreground"> {fieldSchema.label} {fieldSchema.required && <span className="text-red-400 ml-1">*</span>} </label> {fieldSchema.description && ( <p className="text-xs text-muted-foreground">{fieldSchema.description}</p> )} <Textarea value={ Array.isArray(value) ? JSON.stringify(value, null, 2) : value || "[]" } onChange={(e) => { try { handleUpdate(key, JSON.parse(e.target.value)); } catch { // Invalid JSON, ignore } }} rows={4} placeholder="[]" /> </div> );
default: return null; } };
return ( <div className="w-80 bg-dark-900 border-l border-dark-800 h-full flex flex-col"> <div className="p-4 border-b border-dark-800 flex items-center justify-between"> <div> <h3 className="text-sm font-semibold text-foreground">Node Ayarları</h3> <p className="text-xs text-muted-foreground mt-0.5"> {selectedNode.data.label || metadata?.label || nodeType} </p> </div> <button onClick={() => setSelectedNode(null)} className="p-1.5 hover:bg-dark-800 rounded-lg transition-colors" > <X className="w-4 h-4 text-muted-foreground" /> </button> </div>
<div className="flex-1 overflow-y-auto scrollbar-thin p-4"> <div className="space-y-4"> {/* Label */} <div> <label className="block text-sm font-medium text-foreground mb-2"> Label </label> <Input value={selectedNode.data.label || ""} onChange={(e) => handleLabelUpdate(e.target.value)} placeholder={metadata?.label || "Node adı"} /> </div>
{/* Description */} {metadata?.description && ( <div> <p className="text-xs text-muted-foreground">{metadata.description}</p> </div> )}
{/* Config Fields */} {metadata?.configSchema && Object.entries(metadata.configSchema).map(([key, fieldSchema]) => renderConfigField(key, fieldSchema) )}
{/* Phase 2+ warning */} {metadata?.phase && metadata.phase > 1 && ( <div className="p-3 bg-yellow-600/10 border border-yellow-600/30 rounded-lg"> <p className="text-xs text-yellow-400"> ⚠️ Bu node Phase {metadata.phase} özelliğidir ve henüz tam olarak implement edilmemiştir. </p> </div> )} </div> </div> </div> );}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221import { Handle, Position, NodeProps } from "reactflow";import { NodeType } from "@/types/workflow";import { NODE_REGISTRY } from "@/types/nodes";import { Play, Brain, GitBranch, Globe, FileOutput, Settings, Filter, Clock, Webhook, Database, Bell, Zap, Repeat, GitMerge, ArrowRightLeft, FileText, PlayCircle, Mail, File, Code, Variable, FileSpreadsheet, HardDrive, Calendar, BarChart, Cloud, MessageSquare, MessageCircle, Send, Phone, Table, CheckSquare, Bug, ShoppingCart, ShoppingBag, CreditCard, Twitter, Facebook, Instagram, Linkedin, Youtube, TrendingUp, Lock, Unlock, FileCode, Download, Grid,} from "lucide-react";
// Icon mappingconst iconMap: Record<string, any> = { Play, Brain, GitBranch, Globe, FileOutput, Settings, Filter, Clock, Webhook, Database, Bell, Zap, Repeat, GitMerge, ArrowRightLeft, FileText, PlayCircle, Mail, File, Code, Variable, FileSpreadsheet, HardDrive, Calendar, BarChart, Cloud, MessageSquare, MessageCircle, Send, Phone, Table, CheckSquare, Bug, ShoppingCart, ShoppingBag, CreditCard, Twitter, Facebook, Instagram, Linkedin, Youtube, TrendingUp, Lock, Unlock, FileCode, Download, Grid,};
export function CustomNode({ data, selected }: NodeProps) { const nodeType = data.type as NodeType; const metadata = NODE_REGISTRY[nodeType];
if (!metadata) { // Fallback for unknown node types const Icon = Settings; const label = data.label || nodeType; return ( <div className={`px-4 py-3 shadow-lg rounded-lg border-2 min-w-[150px] bg-dark-900 ${ selected ? "border-primary-500 shadow-primary-500/20" : "border-dark-700" } transition-all duration-200`} > <Handle type="target" position={Position.Top} className="!bg-primary-500 !border-2 !border-dark-800" /> <div className="flex items-center gap-2 mb-1"> <div className="bg-gray-600 p-1.5 rounded"> <Icon className="w-4 h-4 text-white" /> </div> <div className="text-sm font-semibold text-foreground">{label}</div> </div> <Handle type="source" position={Position.Bottom} className="!bg-primary-500 !border-2 !border-dark-800" /> </div> ); }
const Icon = iconMap[metadata.icon] || Settings; const label = data.label || metadata.label; const description = data.description || metadata.description;
// Output port sayısını belirle const outputCount = Array.isArray(metadata.outputs) ? metadata.outputs.length : typeof metadata.outputs === "number" ? metadata.outputs : 1;
return ( <div className={`px-4 py-3 shadow-lg rounded-lg border-2 min-w-[150px] bg-dark-900 ${ selected ? "border-primary-500 shadow-primary-500/20" : "border-dark-700" } transition-all duration-200`} > {/* Input handles */} {((typeof metadata.inputs === "number" && metadata.inputs > 0) || (Array.isArray(metadata.inputs) && metadata.inputs.length > 0)) && ( <Handle type="target" position={Position.Top} className="!bg-primary-500 !border-2 !border-dark-800" /> )}
<div className="flex items-center gap-2 mb-1"> <div className={`${metadata.color} p-1.5 rounded`}> <Icon className="w-4 h-4 text-white" /> </div> <div className="flex-1"> <div className="text-sm font-semibold text-foreground">{label}</div> </div> </div>
{description && ( <div className="text-xs text-muted-foreground mt-1 line-clamp-2"> {description} </div> )}
{/* Output handles */} {outputCount > 0 && ( <> {outputCount === 1 ? ( <Handle type="source" position={Position.Bottom} className="!bg-primary-500 !border-2 !border-dark-800" /> ) : ( // Multiple outputs - named handles Array.isArray(metadata.outputs) && metadata.outputs.map((outputName, index) => { const outputsArray = metadata.outputs as string[]; return ( <Handle key={outputName} type="source" position={Position.Bottom} id={outputName} style={{ left: `${((index + 1) * 100) / (outputsArray.length + 1)}%`, }} className="!bg-primary-500 !border-2 !border-dark-800" /> ); }) )} </> )} </div> );}
export const nodeTypes = { custom: CustomNode,};123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129"use client";
import { useWorkflowStore } from "@/store/workflowStore";import Badge from "@/components/ui/Badge";import { CheckCircle2, XCircle, Loader2, Clock } from "lucide-react";
export default function RunLogPanel() { const { runLogs, isRunning } = useWorkflowStore();
if (!isRunning && runLogs.length === 0) { return null; }
const getStatusIcon = (status: string) => { switch (status) { case "success": return <CheckCircle2 className="w-4 h-4 text-green-400" />; case "error": return <XCircle className="w-4 h-4 text-red-400" />; case "running": return <Loader2 className="w-4 h-4 text-primary-500 animate-spin" />; default: return <Clock className="w-4 h-4 text-muted-foreground" />; } };
const getStatusBadge = (status: string) => { switch (status) { case "success": return <Badge variant="success">Başarılı</Badge>; case "error": return <Badge variant="error">Hata</Badge>; case "running": return <Badge variant="info">Çalışıyor</Badge>; default: return <Badge>Bekliyor</Badge>; } };
const formatTime = (timeString: string) => { return new Date(timeString).toLocaleTimeString("tr-TR", { hour: "2-digit", minute: "2-digit", second: "2-digit", }); };
const getDuration = (start: string, end?: string) => { if (!end) return "-"; const duration = new Date(end).getTime() - new Date(start).getTime(); return `${duration}ms`; };
return ( <div className="absolute bottom-0 left-0 right-0 h-64 bg-dark-900 border-t border-dark-800 flex flex-col"> <div className="p-4 border-b border-dark-800"> <div className="flex items-center justify-between"> <h3 className="text-sm font-semibold text-foreground">Run Logs</h3> {isRunning && ( <Badge variant="info" className="gap-2"> <Loader2 className="w-3 h-3 animate-spin" /> Çalışıyor... </Badge> )} </div> </div>
<div className="flex-1 overflow-y-auto scrollbar-thin p-4 space-y-3"> {runLogs.length === 0 ? ( <div className="text-center text-muted-foreground text-sm py-8"> Henüz log yok </div> ) : ( runLogs.map((log, index) => ( <div key={index} className="bg-dark-800 rounded-lg p-3 border border-dark-700" > <div className="flex items-start justify-between mb-2"> <div className="flex items-center gap-2"> {getStatusIcon(log.status)} <span className="text-sm font-medium text-foreground"> {log.nodeName} </span> </div> {getStatusBadge(log.status)} </div>
<div className="grid grid-cols-2 gap-2 text-xs text-muted-foreground mb-2"> <div> <span className="font-medium">Başlangıç:</span>{" "} {formatTime(log.startTime)} </div> {log.endTime && ( <div> <span className="font-medium">Bitiş:</span>{" "} {formatTime(log.endTime)} </div> )} <div> <span className="font-medium">Süre:</span>{" "} {getDuration(log.startTime, log.endTime)} </div> </div>
{log.payload && ( <details className="mt-2"> <summary className="text-xs text-muted-foreground cursor-pointer hover:text-foreground"> Payload'ı göster </summary> <pre className="mt-2 p-2 bg-dark-950 rounded text-xs text-foreground overflow-x-auto"> {JSON.stringify(log.payload, null, 2)} </pre> </details> )}
{log.error && ( <div className="mt-2 p-2 bg-red-600/10 border border-red-600/30 rounded text-xs text-red-400"> <span className="font-medium">Hata:</span> {log.error} </div> )} </div> )) )} </div> </div> );}
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170"use client";
import { useCallback, useEffect, useRef } from "react";import ReactFlow, { Background, Controls, MiniMap, addEdge, useNodesState, useEdgesState, Connection, Edge, Node, NodeChange, EdgeChange, applyNodeChanges, applyEdgeChanges,} from "reactflow";import "reactflow/dist/style.css";import { useWorkflowStore } from "@/store/workflowStore";import { nodeTypes } from "./NodeTypes";
export default function WorkflowCanvas() { const { nodes: storeNodes, edges: storeEdges, setNodes: setStoreNodes, setEdges: setStoreEdges, setSelectedNode, } = useWorkflowStore();
// Store'dan başlangıç değerlerini al const [nodes, setNodes, onNodesChange] = useNodesState(storeNodes); const [edges, setEdges, onEdgesChange] = useEdgesState(storeEdges); const isInitializedRef = useRef(false); const isUpdatingFromStoreRef = useRef(false);
// Store'dan gelen değişiklikleri ReactFlow state'ine yansıt useEffect(() => { // İlk yükleme if (!isInitializedRef.current) { console.log("🎬 WorkflowCanvas - İlk yükleme, nodes:", storeNodes.length, "edges:", storeEdges.length); isInitializedRef.current = true; isUpdatingFromStoreRef.current = true; setNodes(storeNodes); setEdges(storeEdges); // Flag'i hemen false yap ki sonraki değişiklikler store'a yazılabilsin setTimeout(() => { isUpdatingFromStoreRef.current = false; }, 0); return; }
// Store'dan gelen yeni değişiklikleri kontrol et const storeNodesStr = JSON.stringify(storeNodes); const currentNodesStr = JSON.stringify(nodes); const storeEdgesStr = JSON.stringify(storeEdges); const currentEdgesStr = JSON.stringify(edges);
// Eğer store'dan gelen değişiklik varsa ve biz store'dan güncelliyorsak if (storeNodesStr !== currentNodesStr && !isUpdatingFromStoreRef.current) { console.log("🔄 WorkflowCanvas - Store'dan node değişikliği algılandı:", storeNodes.length, "node"); isUpdatingFromStoreRef.current = true; setNodes(storeNodes); // Flag'i hemen false yap setTimeout(() => { isUpdatingFromStoreRef.current = false; }, 0); } if (storeEdgesStr !== currentEdgesStr && !isUpdatingFromStoreRef.current) { console.log("🔄 WorkflowCanvas - Store'dan edge değişikliği algılandı:", storeEdges.length, "edge"); isUpdatingFromStoreRef.current = true; setEdges(storeEdges); // Flag'i hemen false yap setTimeout(() => { isUpdatingFromStoreRef.current = false; }, 0); } // eslint-disable-next-line react-hooks/exhaustive-deps }, [storeNodes, storeEdges]);
// ReactFlow'dan gelen değişiklikleri store'a yansıt (anlık) const handleNodesChange = useCallback( (changes: NodeChange[]) => { console.log("🔄 handleNodesChange çağrıldı, changes:", changes); const updatedNodes = applyNodeChanges(changes, nodes); console.log("🔄 handleNodesChange - updatedNodes:", updatedNodes); console.log("🔄 handleNodesChange - updatedNodes sayısı:", updatedNodes.length); setNodes(updatedNodes); // Store'a her zaman yaz - isUpdatingFromStoreRef kontrolünü kaldırdık console.log("🔄 handleNodesChange - Store'a yazılıyor:", updatedNodes.length, "node"); setStoreNodes(updatedNodes); }, [nodes, setNodes, setStoreNodes] );
const handleEdgesChange = useCallback( (changes: EdgeChange[]) => { console.log("🔄 handleEdgesChange çağrıldı, changes:", changes); const updatedEdges = applyEdgeChanges(changes, edges); console.log("🔄 handleEdgesChange - updatedEdges:", updatedEdges); console.log("🔄 handleEdgesChange - updatedEdges sayısı:", updatedEdges.length); setEdges(updatedEdges); // Store'a her zaman yaz console.log("🔄 handleEdgesChange - Store'a yazılıyor:", updatedEdges.length, "edge"); setStoreEdges(updatedEdges); }, [edges, setEdges, setStoreEdges] );
const onConnect = useCallback( (params: Connection) => { console.log("🔗 onConnect çağrıldı, params:", params); const newEdge = addEdge(params, edges); console.log("🔗 onConnect - newEdge:", newEdge); setEdges(newEdge); // Store'a anlık yaz setStoreEdges(newEdge); console.log("🔗 onConnect - Store'a yazıldı"); }, [edges, setEdges, setStoreEdges] );
const onNodeClick = useCallback( (_: React.MouseEvent, node: Node) => { setSelectedNode(node); }, [setSelectedNode] );
const onPaneClick = useCallback(() => { setSelectedNode(null); }, [setSelectedNode]);
return ( <div className="w-full h-full bg-dark-950"> <ReactFlow nodes={nodes} edges={edges} onNodesChange={handleNodesChange} onEdgesChange={handleEdgesChange} onConnect={onConnect} onNodeClick={onNodeClick} onPaneClick={onPaneClick} nodeTypes={nodeTypes} fitView className="bg-dark-950" > <Background color="#334155" gap={16} /> <Controls className="bg-dark-800 border-dark-700" /> <MiniMap className="bg-dark-900 border-dark-800" nodeColor={(node) => { const colors: Record<string, string> = { start: "#16a34a", "ai-step": "#9333ea", decision: "#eab308", http: "#2563eb", output: "#ea580c", }; return colors[node.data?.type] || "#64748b"; }} maskColor="rgba(15, 23, 42, 0.6)" /> </ReactFlow> </div> );}
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213"use client";
import { useState, useEffect } from "react";import { useRouter } from "next/navigation";import { useWorkflowStore } from "@/store/workflowStore";import Button from "@/components/ui/Button";import Input from "@/components/ui/Input";import Textarea from "@/components/ui/Textarea";import Badge from "@/components/ui/Badge";import { Save, Trash2, Play, ArrowLeft, Power } from "lucide-react";
export default function WorkflowMetaPanel() { const router = useRouter(); const { currentWorkflow, setCurrentWorkflow, saveWorkflow, updateWorkflow, deleteWorkflow, setIsRunning, clearRunLogs, isLoading, } = useWorkflowStore();
const [name, setName] = useState(""); const [description, setDescription] = useState(""); const [isActive, setIsActive] = useState(false);
useEffect(() => { if (currentWorkflow) { setName(currentWorkflow.name); setDescription(currentWorkflow.description || ""); setIsActive(currentWorkflow.isActive); } }, [currentWorkflow]);
const handleSave = async () => { if (!currentWorkflow) return;
// Local state'teki name, description, isActive değerlerini saveWorkflow'a gönder const { nodes, edges } = useWorkflowStore.getState(); console.log("💾 handleSave - Mevcut nodes:", nodes.length, "edges:", edges.length); console.log("💾 handleSave - Name:", name, "Description:", description, "IsActive:", isActive); // Sonra API'ye kaydet (nodes, edges, name, description, isActive dahil) const success = await saveWorkflow({ name, description, isActive, }); if (success) { alert("Workflow kaydedildi!"); } else { const { error } = useWorkflowStore.getState(); alert(`Workflow kaydedilirken bir hata oluştu: ${error || "Bilinmeyen hata"}`); } };
const handleDelete = async () => { if (!currentWorkflow) return; if (confirm("Bu workflow'u silmek istediğinize emin misiniz?")) { const success = await deleteWorkflow(currentWorkflow.id); if (success) { router.push("/"); } else { alert("Workflow silinirken bir hata oluştu!"); } } };
const handleToggleActive = async () => { if (!currentWorkflow) return; const newActiveState = !isActive; setIsActive(newActiveState); const success = await updateWorkflow(currentWorkflow.id, { isActive: newActiveState, }); if (!success) { setIsActive(!newActiveState); // Rollback alert("Durum güncellenirken bir hata oluştu!"); } };
const handleRun = async () => { if (!currentWorkflow) return;
setIsRunning(true); clearRunLogs();
const { nodes, addRunLog } = useWorkflowStore.getState();
// Simüle edilmiş run - gerçek uygulamada API'ye istek atılacak for (const node of nodes) { const startTime = new Date().toISOString(); addRunLog({ nodeId: node.id, nodeName: node.data.label || node.data.type, status: "running", startTime, });
// Simüle edilmiş işlem süresi await new Promise((resolve) => setTimeout(resolve, 1000));
const endTime = new Date().toISOString(); const success = Math.random() > 0.2; // %80 başarı oranı
addRunLog({ nodeId: node.id, nodeName: node.data.label || node.data.type, status: success ? "success" : "error", startTime, endTime, payload: { input: "test data", output: "processed data" }, error: success ? undefined : "Simüle edilmiş hata", }); }
setIsRunning(false); };
if (!currentWorkflow) { return null; }
return ( <div className="h-48 bg-dark-900 border-b border-dark-800 p-4 flex flex-col"> <div className="flex items-center justify-between mb-4"> <div className="flex items-center gap-3"> <Button variant="ghost" size="sm" onClick={() => router.push("/")} className="gap-2" > <ArrowLeft className="w-4 h-4" /> Geri </Button> <div> <Input value={name} onChange={(e) => setName(e.target.value)} placeholder="Workflow adı" className="text-lg font-semibold border-0 bg-transparent focus:ring-0 p-0 h-auto" /> </div> <Badge variant={isActive ? "success" : "default"}> {isActive ? "Aktif" : "Pasif"} </Badge> </div>
<div className="flex items-center gap-2"> <Button variant="ghost" size="sm" onClick={handleToggleActive} disabled={isLoading} className="gap-2" > <Power className="w-4 h-4" /> {isActive ? "Pasifleştir" : "Aktifleştir"} </Button> <Button variant="danger" size="sm" onClick={handleDelete} disabled={isLoading} className="gap-2" > <Trash2 className="w-4 h-4" /> Sil </Button> <Button variant="secondary" size="sm" onClick={handleSave} disabled={isLoading} className="gap-2" > <Save className="w-4 h-4" /> {isLoading ? "Kaydediliyor..." : "Kaydet"} </Button> <Button size="sm" onClick={handleRun} disabled={isLoading} className="gap-2" > <Play className="w-4 h-4" /> Çalıştır </Button> </div> </div>
<div> <Textarea value={description} onChange={(e) => setDescription(e.target.value)} placeholder="Workflow açıklaması..." rows={2} className="bg-dark-800" /> </div> </div> );}
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220import { Workflow } from "@/types/workflow";
const API_BASE = "https://flowmind-ai-flowmind-core-api.hf.space/api";
export interface ApiError { message: string; status?: number;}
// API Response wrapperinterface ApiResponse<T> { data?: T; error?: ApiError;}
async function apiRequest<T>( endpoint: string, options?: RequestInit): Promise<ApiResponse<T>> { try { const url = `${API_BASE}${endpoint}`; console.log(`API Request: ${options?.method || "GET"} ${url}`); const response = await fetch(url, { ...options, headers: { "Content-Type": "application/json", ...options?.headers, }, });
if (!response.ok) { let errorText = ""; try { errorText = await response.text(); // JSON ise parse et try { const errorJson = JSON.parse(errorText); errorText = errorJson.message || errorJson.detail || errorText; } catch { // JSON değilse olduğu gibi kullan } } catch { errorText = `HTTP error! status: ${response.status}`; } return { error: { message: errorText || `HTTP error! status: ${response.status}`, status: response.status, }, }; }
// DELETE için body olmayabilir if (options?.method === "DELETE") { // 204 No Content için body yok if (response.status === 204) { return { data: undefined as T }; } // 200 OK için body olabilir veya olmayabilir if (response.status === 200) { const contentType = response.headers.get("content-type"); if (contentType && contentType.includes("application/json")) { try { const data = await response.json(); return { data }; } catch { return { data: undefined as T }; } } return { data: undefined as T }; } }
const data = await response.json(); return { data }; } catch (error) { console.error("API Request Error:", error); return { error: { message: error instanceof Error ? error.message : "Unknown error occurred", }, }; }}
// Backend'den gelen snake_case formatını frontend camelCase formatına çevirfunction normalizeWorkflowFromBackend(workflow: any): Workflow { const graphJson = (workflow.graph_json || workflow.graphJson || {}); // Boş obje {} ise veya nodes/edges yoksa normalize et const normalizedGraphJson = { nodes: Array.isArray(graphJson.nodes) ? graphJson.nodes : [], edges: Array.isArray(graphJson.edges) ? graphJson.edges : [], };
return { id: String(workflow.id), name: workflow.name || "", description: workflow.description || "", isActive: workflow.is_active ?? workflow.isActive ?? false, createdAt: workflow.created_at || workflow.createdAt || "", updatedAt: workflow.updated_at || workflow.updatedAt || "", graphJson: normalizedGraphJson, };}
// Frontend'den backend'e gönderirken camelCase'i snake_case'e çevirfunction normalizeWorkflowToBackend(workflow: Partial<Workflow>): any { const graphJson = workflow.graphJson || { nodes: [], edges: [] }; console.log("🔄 normalizeWorkflowToBackend - Input:", workflow); console.log("🔄 normalizeWorkflowToBackend - graphJson:", graphJson); console.log("🔄 normalizeWorkflowToBackend - nodes:", graphJson.nodes); console.log("🔄 normalizeWorkflowToBackend - edges:", graphJson.edges); const result = { name: workflow.name, description: workflow.description, is_active: workflow.isActive, graph_json: { nodes: graphJson.nodes || [], edges: graphJson.edges || [], }, }; console.log("🔄 normalizeWorkflowToBackend - Output:", JSON.stringify(result, null, 2)); return result;}
// Workflow API functionsexport const workflowApi = { // GET /workflows/ - Get all workflows getAll: async (): Promise<ApiResponse<Workflow[]>> => { const response = await apiRequest<any[]>("/workflows/"); // API'den gelen workflow'ları normalize et if (response.data) { response.data = response.data.map(normalizeWorkflowFromBackend); } return response as ApiResponse<Workflow[]>; },
// GET /workflows/:id - Get single workflow getById: async (id: string): Promise<ApiResponse<Workflow>> => { // ID'yi encode et ve temizle const cleanId = String(id).trim(); if (!cleanId) { return { error: { message: "Workflow ID is required", }, }; } const response = await apiRequest<any>(`/workflows/${encodeURIComponent(cleanId)}`); // API'den gelen workflow'u normalize et if (response.data) { response.data = normalizeWorkflowFromBackend(response.data); } return response as ApiResponse<Workflow>; },
// POST /workflows/ - Create new workflow create: async (workflow: Partial<Workflow>): Promise<ApiResponse<Workflow>> => { const workflowData = normalizeWorkflowToBackend(workflow); const response = await apiRequest<any>("/workflows/", { method: "POST", body: JSON.stringify(workflowData), }); // API'den dönen workflow'u normalize et if (response.data) { response.data = normalizeWorkflowFromBackend(response.data); } return response as ApiResponse<Workflow>; },
// PUT /workflows/:id - Update workflow update: async ( id: string, workflow: Partial<Workflow> ): Promise<ApiResponse<Workflow>> => { // ID'yi encode et ve temizle const cleanId = String(id).trim(); if (!cleanId) { return { error: { message: "Workflow ID is required", }, }; } const workflowData = normalizeWorkflowToBackend(workflow); const response = await apiRequest<any>(`/workflows/${encodeURIComponent(cleanId)}`, { method: "PUT", body: JSON.stringify(workflowData), }); // API'den dönen workflow'u normalize et if (response.data) { response.data = normalizeWorkflowFromBackend(response.data); } return response as ApiResponse<Workflow>; },
// DELETE /workflows/:id - Delete workflow delete: async (id: string): Promise<ApiResponse<void>> => { // ID'yi encode et ve temizle const cleanId = String(id).trim(); if (!cleanId) { return { error: { message: "Workflow ID is required", }, }; } return apiRequest<void>(`/workflows/${encodeURIComponent(cleanId)}`, { method: "DELETE", }); },};
1234567import { type ClassValue, clsx } from "clsx";import { twMerge } from "tailwind-merge";
export function cn(...inputs: ClassValue[]) { return twMerge(clsx(inputs));}
123456/// <reference types="next" />/// <reference types="next/image-types/global" />import "./.next/dev/types/routes.d.ts";
// NOTE: This file should not be edited// see https://nextjs.org/docs/app/api-reference/config/typescript for more information.1234567/** @type {import('next').NextConfig} */const nextConfig = { reactStrictMode: true,}
module.exports = nextConfig
123456789101112131415161718192021222324252627282930313233{ "name": "flowmind-studio", "version": "0.1.0", "private": true, "scripts": { "dev": "next dev", "build": "next build", "start": "next start", "lint": "next lint" }, "dependencies": { "next": "^16.0.0", "react": "^18.3.1", "react-dom": "^18.3.1", "reactflow": "^11.11.4", "zustand": "^4.5.2", "lucide-react": "^0.344.0", "clsx": "^2.1.0", "tailwind-merge": "^2.2.1" }, "devDependencies": { "@types/node": "^20.11.5", "@types/react": "^18.2.48", "@types/react-dom": "^18.2.18", "typescript": "^5.3.3", "tailwindcss": "^3.4.1", "postcss": "^8.4.33", "autoprefixer": "^10.4.17", "eslint": "^9.0.0", "eslint-config-next": "^16.0.0" }}
1234567module.exports = { plugins: { tailwindcss: {}, autoprefixer: {}, },}
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376import { create } from "zustand";import { Workflow, NodeData, EdgeData } from "@/types/workflow";import { Node, Edge } from "reactflow";import { workflowApi } from "@/lib/api";
interface WorkflowStore { workflows: Workflow[]; currentWorkflow: Workflow | null; nodes: Node[]; edges: Edge[]; selectedNode: Node | null; isRunning: boolean; isLoading: boolean; error: string | null; runLogs: Array<{ nodeId: string; nodeName: string; status: "success" | "error" | "running"; startTime: string; endTime?: string; payload?: any; error?: string; }>; // Actions fetchWorkflows: () => Promise<void>; fetchWorkflow: (id: string) => Promise<void>; createWorkflow: (workflow: Partial<Workflow>) => Promise<Workflow | null>; updateWorkflow: (id: string, workflow: Partial<Workflow>) => Promise<boolean>; deleteWorkflow: (id: string) => Promise<boolean>; setWorkflows: (workflows: Workflow[]) => void; setCurrentWorkflow: (workflow: Workflow | null) => void; setNodes: (nodes: Node[]) => void; setEdges: (edges: Edge[]) => void; addNode: (node: Node) => void; updateNode: (nodeId: string, data: Partial<NodeData["data"]>) => void; deleteNode: (nodeId: string) => void; setSelectedNode: (node: Node | null) => void; addEdge: (edge: Edge) => void; deleteEdge: (edgeId: string) => void; setIsRunning: (isRunning: boolean) => void; addRunLog: (log: WorkflowStore["runLogs"][0]) => void; clearRunLogs: () => void; saveWorkflow: (updates?: { name?: string; description?: string; isActive?: boolean }) => Promise<boolean>; setError: (error: string | null) => void;}
export const useWorkflowStore = create<WorkflowStore>((set, get) => ({ workflows: [], currentWorkflow: null, nodes: [], edges: [], selectedNode: null, isRunning: false, isLoading: false, error: null, runLogs: [],
// API Actions fetchWorkflows: async () => { set({ isLoading: true, error: null }); const response = await workflowApi.getAll(); if (response.error) { set({ error: response.error.message, isLoading: false }); return; } if (response.data) { set({ workflows: response.data, isLoading: false }); } },
fetchWorkflow: async (id: string) => { set({ isLoading: true, error: null, selectedNode: null }); const response = await workflowApi.getById(id); if (response.error) { set({ error: response.error.message, isLoading: false }); return; } if (response.data) { const workflow = response.data; // graphJson yoksa veya boşsa varsayılan değerler kullan const graphJson = workflow.graphJson || { nodes: [], edges: [] }; // Node'ları ve edge'leri normalize et const normalizedNodes = (graphJson.nodes || []).map((node: any) => ({ id: node.id, type: node.type || "custom", position: node.position || { x: 0, y: 0 }, data: { ...(node.data || {}), type: node.data?.type || node.type || "custom", label: node.data?.label || node.label || node.id, config: node.data?.config || {}, }, })) as Node[];
const normalizedEdges = (graphJson.edges || []).map((edge: any) => ({ id: edge.id, source: edge.source, target: edge.target, sourceHandle: edge.sourceHandle, targetHandle: edge.targetHandle, type: edge.type, })) as Edge[]; set({ currentWorkflow: workflow, nodes: normalizedNodes, edges: normalizedEdges, isLoading: false, }); } },
createWorkflow: async (workflow: Partial<Workflow>) => { set({ isLoading: true, error: null }); // graphJson yoksa varsayılan değer ekle const workflowData = { ...workflow, graphJson: workflow.graphJson || { nodes: [], edges: [] }, }; const response = await workflowApi.create(workflowData); if (response.error) { set({ error: response.error.message, isLoading: false }); return null; } if (response.data) { const newWorkflow = response.data; // graphJson'ı normalize et const normalizedWorkflow = { ...newWorkflow, graphJson: newWorkflow.graphJson || { nodes: [], edges: [] }, }; set((state) => ({ workflows: [...state.workflows, normalizedWorkflow], isLoading: false, })); return normalizedWorkflow; } return null; },
updateWorkflow: async (id: string, workflow: Partial<Workflow>) => { set({ isLoading: true, error: null }); const response = await workflowApi.update(id, workflow); if (response.error) { set({ error: response.error.message, isLoading: false }); return false; } if (response.data) { const updatedWorkflow = response.data; // graphJson'ı normalize et const normalizedWorkflow = { ...updatedWorkflow, graphJson: updatedWorkflow.graphJson || { nodes: [], edges: [] }, }; set((state) => ({ workflows: state.workflows.map((w) => w.id === id ? normalizedWorkflow : w ), currentWorkflow: state.currentWorkflow?.id === id ? normalizedWorkflow : state.currentWorkflow, isLoading: false, })); return true; } return false; },
deleteWorkflow: async (id: string) => { if (!id || !String(id).trim()) { set({ error: "Geçersiz workflow ID", isLoading: false }); return false; } set({ isLoading: true, error: null }); const response = await workflowApi.delete(id); if (response.error) { set({ error: response.error.message || "Workflow silinirken bir hata oluştu", isLoading: false }); return false; } set((state) => ({ workflows: state.workflows.filter((w) => w.id !== id), currentWorkflow: state.currentWorkflow?.id === id ? null : state.currentWorkflow, isLoading: false, })); return true; },
setWorkflows: (workflows) => set({ workflows }), setCurrentWorkflow: (workflow) => { if (workflow) { // graphJson yoksa veya boşsa mevcut nodes/edges'i koru const graphJson = workflow.graphJson || { nodes: [], edges: [] }; const currentState = get(); // Eğer graphJson'da node'lar varsa kullan, yoksa mevcut node'ları koru const newNodes = (graphJson.nodes && graphJson.nodes.length > 0) ? (graphJson.nodes || []) as Node[] : currentState.nodes; // Mevcut node'ları koru const newEdges = (graphJson.edges && graphJson.edges.length > 0) ? (graphJson.edges || []) as Edge[] : currentState.edges; // Mevcut edge'leri koru console.log("🔄 setCurrentWorkflow - workflow:", workflow); console.log("🔄 setCurrentWorkflow - graphJson.nodes:", graphJson.nodes?.length || 0); console.log("🔄 setCurrentWorkflow - Mevcut nodes:", currentState.nodes.length); console.log("🔄 setCurrentWorkflow - Yeni nodes:", newNodes.length); set({ currentWorkflow: workflow, nodes: newNodes, edges: newEdges, }); } else { set({ currentWorkflow: null, nodes: [], edges: [], selectedNode: null, }); } },
setNodes: (nodes) => { console.log("🔄 setNodes çağrıldı, yeni nodes:", nodes); set({ nodes }); }, setEdges: (edges) => { console.log("🔄 setEdges çağrıldı, yeni edges:", edges); set({ edges }); }, addNode: (node) => { console.log("➕ addNode çağrıldı, eklenen node:", node); set((state) => { const newNodes = [...state.nodes, node]; console.log("📊 Yeni nodes array:", newNodes); return { nodes: newNodes }; }); }, updateNode: (nodeId, data) => set((state) => ({ nodes: state.nodes.map((node) => node.id === nodeId ? { ...node, data: { ...node.data, ...data } } : node ), })), deleteNode: (nodeId) => set((state) => ({ nodes: state.nodes.filter((node) => node.id !== nodeId), edges: state.edges.filter( (edge) => edge.source !== nodeId && edge.target !== nodeId ), selectedNode: state.selectedNode?.id === nodeId ? null : state.selectedNode, })), setSelectedNode: (node) => set({ selectedNode: node }), addEdge: (edge) => set((state) => ({ edges: [...state.edges, edge] })), deleteEdge: (edgeId) => set((state) => ({ edges: state.edges.filter((edge) => edge.id !== edgeId) })), setIsRunning: (isRunning) => set({ isRunning }), addRunLog: (log) => set((state) => ({ runLogs: [...state.runLogs, log] })), clearRunLogs: () => set({ runLogs: [] }), saveWorkflow: async (updates) => { // get() ile en güncel state'i al - her zaman fresh state al const state = get(); const { currentWorkflow, nodes, edges } = state; if (!currentWorkflow) { set({ error: "Kaydedilecek workflow bulunamadı" }); return false; } console.log("💾 saveWorkflow çağrıldı"); console.log("📊 Store'daki nodes:", nodes); console.log("📊 Store'daki nodes sayısı:", nodes.length); console.log("📊 Store'daki edges:", edges); console.log("📊 Store'daki edges sayısı:", edges.length); console.log("📊 Current workflow:", currentWorkflow); console.log("📊 Updates:", updates); // Nodes ve edges'i temizle ve doğru formata dönüştür // Backend'e gönderirken: node.type = gerçek node type (start, ai_step, vs.) // ReactFlow'da: node.type = "custom", node.data.type = gerçek node type const cleanNodes = nodes.map((node) => { // Gerçek node type'ı data.type'dan al, yoksa node.type'dan al const realNodeType = node.data?.type || node.type || "custom"; return { id: node.id, type: realNodeType, // Backend için gerçek node type position: node.position, data: { ...node.data, type: realNodeType, // data.type'ı da set et // Eğer config yoksa boş obje ekle config: node.data?.config || {}, }, }; });
const cleanEdges = edges.map((edge) => ({ id: edge.id, source: edge.source, target: edge.target, sourceHandle: edge.sourceHandle, targetHandle: edge.targetHandle, type: edge.type, })); console.log("🧹 Temizlenmiş nodes:", cleanNodes); console.log("🧹 Temizlenmiş edges:", cleanEdges); console.log("🧹 Temizlenmiş nodes sayısı:", cleanNodes.length); console.log("🧹 Temizlenmiş edges sayısı:", cleanEdges.length); // Updates parametresi varsa onları kullan, yoksa currentWorkflow'dan al const updatedWorkflow: Partial<Workflow> = { name: updates?.name !== undefined ? updates.name : currentWorkflow.name, description: updates?.description !== undefined ? updates.description : currentWorkflow.description, isActive: updates?.isActive !== undefined ? updates.isActive : currentWorkflow.isActive, graphJson: { nodes: cleanNodes as NodeData[], edges: cleanEdges as EdgeData[], }, }; console.log("📤 Backend'e gönderilecek workflow:", JSON.stringify(updatedWorkflow, null, 2)); console.log("📤 graphJson.nodes length:", updatedWorkflow.graphJson?.nodes?.length); console.log("📤 graphJson.edges length:", updatedWorkflow.graphJson?.edges?.length); const success = await get().updateWorkflow(currentWorkflow.id, updatedWorkflow); console.log("✅ updateWorkflow sonucu:", success); if (success) { // Başarılı kayıt sonrası store'daki currentWorkflow'u güncelle const updated = get().currentWorkflow; if (updated) { set({ currentWorkflow: { ...updated, name: updatedWorkflow.name || updated.name, description: updatedWorkflow.description !== undefined ? updatedWorkflow.description : updated.description, isActive: updatedWorkflow.isActive !== undefined ? updatedWorkflow.isActive : updated.isActive, graphJson: { nodes: cleanNodes as NodeData[], edges: cleanEdges as EdgeData[], }, }, }); } } return success; },
setError: (error) => set({ error }),}));
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849import type { Config } from "tailwindcss";
const config = { content: [ "./pages/**/*.{js,ts,jsx,tsx,mdx}", "./components/**/*.{js,ts,jsx,tsx,mdx}", "./app/**/*.{js,ts,jsx,tsx,mdx}", ], theme: { extend: { colors: { background: "var(--background)", foreground: "var(--foreground)", primary: { 50: "#f0f9ff", 100: "#e0f2fe", 200: "#bae6fd", 300: "#7dd3fc", 400: "#38bdf8", 500: "#0ea5e9", 600: "#0284c7", 700: "#0369a1", 800: "#075985", 900: "#0c4a6e", }, dark: { 50: "#f8fafc", 100: "#f1f5f9", 200: "#e2e8f0", 300: "#cbd5e1", 400: "#94a3b8", 500: "#64748b", 600: "#475569", 700: "#334155", 800: "#1e293b", 900: "#0f172a", 950: "#020617", }, }, fontFamily: { sans: ["var(--font-inter)", "system-ui", "sans-serif"], }, }, }, plugins: [], darkMode: "class",};export default config;
1234567891011121314151617181920212223242526272829303132333435363738394041{ "compilerOptions": { "target": "ES2020", "lib": [ "dom", "dom.iterable", "esnext" ], "allowJs": true, "skipLibCheck": true, "strict": true, "noEmit": true, "esModuleInterop": true, "module": "esnext", "moduleResolution": "bundler", "resolveJsonModule": true, "isolatedModules": true, "jsx": "react-jsx", "incremental": true, "plugins": [ { "name": "next" } ], "paths": { "@/*": [ "./*" ] } }, "include": [ "next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts", ".next/dev/types/**/*.ts" ], "exclude": [ "node_modules" ]}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757// Node Kategorileriexport type NodeCategory = | "triggers" | "flow-logic" | "ai-nodes" | "integrations" | "data-utils" | "outputs";
// Node Tipleriexport type NodeType = // Triggers | "start" | "webhook_trigger" | "schedule_trigger" | "email_trigger" | "file_watch_trigger" // Flow & Logic | "decision" | "switch" | "delay" | "parallel_split" | "parallel_join" | "loop" | "merge" | "wait" // AI Nodes | "ai_step" | "ai_classify" | "ai_extract" | "ai_simulate" | "ai_embed" | "ai_summarize" | "ai_translate" // Integrations - HTTP & Webhooks | "http" | "webhook_call" | "rest_api" | "graphql" // Integrations - Database | "db_query" | "db_insert" | "db_update" | "db_delete" // Integrations - Google | "google_sheets" | "google_drive" | "google_calendar" | "google_gmail" | "google_analytics" | "google_cloud_storage" // Integrations - Communication | "slack" | "discord" | "telegram" | "whatsapp" | "sms" // Integrations - Cloud Storage | "aws_s3" | "azure_blob" | "dropbox" // Integrations - Productivity | "notion" | "airtable" | "trello" | "asana" | "jira" // Integrations - E-commerce | "shopify" | "woocommerce" | "stripe" | "paypal" // Integrations - Social Media | "twitter" | "facebook" | "instagram" | "linkedin" | "youtube" // Integrations - CRM | "salesforce" | "hubspot" | "zoho" // Data & Utils | "transform" | "filter" | "map_fields" | "log" | "set_variable" | "get_variable" | "json_parse" | "json_stringify" | "csv_parse" | "csv_generate" | "xml_parse" | "base64_encode" | "base64_decode" | "hash" | "encrypt" | "decrypt" // Outputs | "output" | "notify" | "email_send" | "file_write" | "file_download";
// Node Metadataexport interface NodeMetadata { type: NodeType; category: NodeCategory; label: string; description: string; icon: string; color: string; inputs: number | string[]; // Input port sayısı veya named inputs outputs: number | string[]; // Output port sayısı veya named outputs configSchema: NodeConfigSchema; phase?: 1 | 2 | 3; // Hangi fazda implement edilecek}
// Config Schemaexport interface NodeConfigSchema { [key: string]: { type: "string" | "number" | "boolean" | "object" | "array" | "select" | "textarea"; label: string; description?: string; required?: boolean; default?: any; options?: { value: string; label: string }[]; // select için placeholder?: string; min?: number; // number için max?: number; // number için step?: number; // number için rows?: number; // textarea için };}
// Node Config Typesexport interface StartConfig { name?: string; input_schema?: any;}
export interface WebhookTriggerConfig { path: string; method: "GET" | "POST" | "PUT" | "DELETE"; auth_required: boolean;}
export interface DecisionConfig { conditions: Array<{ label: string; expression: string; }>;}
export interface DelayConfig { duration_ms?: number; duration_human?: string; // "5 minutes", "1 hour" vs.}
export interface AIStepConfig { provider: "openai" | "hf" | "local"; model: string; system_prompt?: string; user_template: string; output_mode: "text" | "json" | "classification"; temperature: number; max_tokens: number;}
export interface AIClassifyConfig { labels: string[]; instruction: string;}
export interface AIExtractConfig { schema: any; // JSON Schema}
export interface HTTPConfig { method: "GET" | "POST" | "PUT" | "DELETE" | "PATCH"; url: string; headers?: Record<string, string>; body?: string; timeout_ms?: number; retry_policy?: any;}
export interface TransformConfig { script_type: "jsonata" | "js" | "jinja"; expression: string;}
export interface FilterConfig { expression: string; mode: "continue" | "stop" | "branch_error";}
export interface OutputConfig { payload_template: string;}
// Node Registry - Tüm node'ların metadata'sıexport const NODE_REGISTRY: Record<NodeType, NodeMetadata> = { // ========== TRIGGERS ========== start: { type: "start", category: "triggers", label: "Start", description: "Workflow başlangıç noktası", icon: "Play", color: "bg-green-600", inputs: 0, outputs: 1, phase: 1, configSchema: { name: { type: "string", label: "Name", description: "Opsiyonel başlangıç noktası adı", required: false, default: "Default Start", }, }, }, webhook_trigger: { type: "webhook_trigger", category: "triggers", label: "Webhook Trigger", description: "HTTP çağrısı ile workflow'u tetikler", icon: "Webhook", color: "bg-blue-600", inputs: 0, outputs: 1, phase: 2, configSchema: { path: { type: "string", label: "Path", description: "Webhook URL path", required: true, placeholder: "/webhooks/my-flow", }, method: { type: "select", label: "Method", required: true, default: "POST", options: [ { value: "GET", label: "GET" }, { value: "POST", label: "POST" }, { value: "PUT", label: "PUT" }, { value: "DELETE", label: "DELETE" }, ], }, auth_required: { type: "boolean", label: "Auth Required", required: false, default: false, }, }, }, schedule_trigger: { type: "schedule_trigger", category: "triggers", label: "Schedule", description: "Zamana bağlı tetikleme (Cron)", icon: "Clock", color: "bg-purple-600", inputs: 0, outputs: 1, phase: 2, configSchema: { cron: { type: "string", label: "Cron Expression", required: true, placeholder: "0 * * * *", }, timezone: { type: "string", label: "Timezone", required: false, default: "UTC", }, }, }, // ========== FLOW & LOGIC ========== decision: { type: "decision", category: "flow-logic", label: "Decision", description: "Koşullu dallanma (if/else)", icon: "GitBranch", color: "bg-yellow-600", inputs: 1, outputs: ["true", "false"], phase: 1, configSchema: { conditions: { type: "array", label: "Conditions", description: "Koşul listesi", required: true, default: [], }, }, }, switch: { type: "switch", category: "flow-logic", label: "Switch", description: "Multi-branch yönlendirme", icon: "GitBranch", color: "bg-yellow-500", inputs: 1, outputs: ["default"], phase: 2, configSchema: { expression: { type: "string", label: "Expression", required: true, placeholder: "{{ context.status }}", }, cases: { type: "array", label: "Cases", required: true, default: [], }, }, }, delay: { type: "delay", category: "flow-logic", label: "Delay", description: "Bekleme süresi", icon: "Clock", color: "bg-gray-600", inputs: 1, outputs: 1, phase: 1, configSchema: { duration_ms: { type: "number", label: "Duration (ms)", required: false, placeholder: "5000", }, duration_human: { type: "string", label: "Duration (Human)", required: false, placeholder: "5 minutes", }, }, }, parallel_split: { type: "parallel_split", category: "flow-logic", label: "Parallel Split", description: "Paralel branch'ler başlatma", icon: "GitBranch", color: "bg-indigo-600", inputs: 1, outputs: ["branch_1", "branch_2"], phase: 2, configSchema: {}, }, parallel_join: { type: "parallel_join", category: "flow-logic", label: "Parallel Join", description: "Paralel branch'leri birleştirme", icon: "GitMerge", color: "bg-indigo-500", inputs: ["branch_1", "branch_2"], outputs: 1, phase: 2, configSchema: {}, }, loop: { type: "loop", category: "flow-logic", label: "Loop", description: "Liste üzerinde dönme", icon: "Repeat", color: "bg-cyan-600", inputs: 1, outputs: 1, phase: 2, configSchema: { collection: { type: "string", label: "Collection", required: true, placeholder: "{{ context.items }}", }, }, }, // ========== AI NODES ========== ai_step: { type: "ai_step", category: "ai-nodes", label: "AI Step", description: "LLM Completion - Genel amaçlı AI node", icon: "Brain", color: "bg-purple-600", inputs: 1, outputs: 1, phase: 1, configSchema: { provider: { type: "select", label: "Provider", required: true, default: "openai", options: [ { value: "openai", label: "OpenAI (GPT-4, GPT-3.5)" }, { value: "anthropic", label: "Anthropic (Claude)" }, { value: "google", label: "Google (Gemini)" }, { value: "mistral", label: "Mistral AI" }, { value: "cohere", label: "Cohere" }, { value: "hf", label: "HuggingFace" }, { value: "azure_openai", label: "Azure OpenAI" }, { value: "aws_bedrock", label: "AWS Bedrock" }, { value: "local", label: "Local Model" }, ], }, model: { type: "string", label: "Model", required: true, placeholder: "gpt-4.1-mini", }, system_prompt: { type: "textarea", label: "System Prompt", required: false, placeholder: "You are a helpful assistant...", }, user_template: { type: "textarea", label: "User Template", required: true, placeholder: "Kullanıcının mesajı: {{input.text}}", }, output_mode: { type: "select", label: "Output Mode", required: true, default: "text", options: [ { value: "text", label: "Text" }, { value: "json", label: "JSON" }, { value: "classification", label: "Classification" }, ], }, temperature: { type: "number", label: "Temperature", required: false, default: 0.7, }, max_tokens: { type: "number", label: "Max Tokens", required: false, default: 1000, }, }, }, ai_classify: { type: "ai_classify", category: "ai-nodes", label: "AI Classify", description: "Metin sınıflandırma", icon: "Brain", color: "bg-purple-500", inputs: 1, outputs: 1, phase: 2, configSchema: { labels: { type: "array", label: "Labels", required: true, default: [], }, instruction: { type: "textarea", label: "Instruction", required: true, }, }, }, ai_extract: { type: "ai_extract", category: "ai-nodes", label: "AI Extract", description: "Structured data extraction", icon: "Brain", color: "bg-purple-400", inputs: 1, outputs: 1, phase: 2, configSchema: { schema: { type: "object", label: "Schema", required: true, }, }, }, ai_simulate: { type: "ai_simulate", category: "ai-nodes", label: "AI Simulate", description: "Flow simulator - akışı simüle eder", icon: "PlayCircle", color: "bg-pink-600", inputs: 1, outputs: 1, phase: 2, configSchema: { simulation_mode: { type: "select", label: "Simulation Mode", required: true, default: "dry-run", options: [ { value: "dry-run", label: "Dry Run" }, { value: "explain", label: "Explain" }, { value: "step-by-step", label: "Step by Step" }, ], }, }, }, // ========== INTEGRATIONS ========== http: { type: "http", category: "integrations", label: "HTTP Request", description: "API çağrısı yapma", icon: "Globe", color: "bg-blue-600", inputs: 1, outputs: 1, phase: 1, configSchema: { method: { type: "select", label: "Method", required: true, default: "GET", options: [ { value: "GET", label: "GET" }, { value: "POST", label: "POST" }, { value: "PUT", label: "PUT" }, { value: "DELETE", label: "DELETE" }, { value: "PATCH", label: "PATCH" }, ], }, url: { type: "string", label: "URL", required: true, placeholder: "https://api.example.com/users/{{userId}}", }, headers: { type: "object", label: "Headers", required: false, }, body: { type: "textarea", label: "Body", required: false, placeholder: "JSON veya string", }, timeout_ms: { type: "number", label: "Timeout (ms)", required: false, default: 30000, }, }, }, webhook_call: { type: "webhook_call", category: "integrations", label: "Webhook Call", description: "Dış sistemlere event gönderme", icon: "Webhook", color: "bg-blue-500", inputs: 1, outputs: 1, phase: 2, configSchema: { url: { type: "string", label: "URL", required: true, }, method: { type: "select", label: "Method", required: true, default: "POST", options: [ { value: "POST", label: "POST" }, { value: "PUT", label: "PUT" }, ], }, body: { type: "textarea", label: "Body", required: false, }, }, }, db_query: { type: "db_query", category: "integrations", label: "Database Query", description: "SQL query çalıştırma", icon: "Database", color: "bg-teal-600", inputs: 1, outputs: 1, phase: 2, configSchema: { connection: { type: "string", label: "Connection", required: true, }, query: { type: "textarea", label: "Query", required: true, placeholder: "SELECT * FROM users WHERE id = {{user_id}}", }, }, }, // ========== DATA & UTILS ========== transform: { type: "transform", category: "data-utils", label: "Transform", description: "Veri dönüşümü", icon: "Settings", color: "bg-indigo-600", inputs: 1, outputs: 1, phase: 1, configSchema: { script_type: { type: "select", label: "Script Type", required: true, default: "js", options: [ { value: "jsonata", label: "JSONata" }, { value: "js", label: "JavaScript" }, { value: "jinja", label: "Jinja" }, ], }, expression: { type: "textarea", label: "Expression", required: true, placeholder: "return { fullName: ctx.firstName + ' ' + ctx.lastName }", }, }, }, filter: { type: "filter", category: "data-utils", label: "Filter", description: "Şart kontrolü ve filtreleme", icon: "Filter", color: "bg-pink-600", inputs: 1, outputs: ["pass", "fail"], phase: 1, configSchema: { expression: { type: "string", label: "Expression", required: true, placeholder: "{{ context.amount > 1000 }}", }, mode: { type: "select", label: "Mode", required: true, default: "continue", options: [ { value: "continue", label: "Continue" }, { value: "stop", label: "Stop" }, { value: "branch_error", label: "Branch Error" }, ], }, }, }, map_fields: { type: "map_fields", category: "data-utils", label: "Map Fields", description: "Alan eşleştirme", icon: "ArrowRightLeft", color: "bg-orange-600", inputs: 1, outputs: 1, phase: 2, configSchema: { mappings: { type: "array", label: "Mappings", required: true, default: [], }, }, }, log: { type: "log", category: "data-utils", label: "Log", description: "Debug için loglama", icon: "FileText", color: "bg-gray-500", inputs: 1, outputs: 1, phase: 1, configSchema: { message_template: { type: "textarea", label: "Message Template", required: true, placeholder: "Current user: {{context.userId}}", }, }, }, // ========== OUTPUTS ========== output: { type: "output", category: "outputs", label: "Output", description: "Workflow çıktısı", icon: "FileOutput", color: "bg-orange-600", inputs: 1, outputs: 0, phase: 1, configSchema: { payload_template: { type: "textarea", label: "Payload Template", required: false, placeholder: "{{ context.result }}", }, }, }, notify: { type: "notify", category: "outputs", label: "Notify", description: "Bildirim gönderme", icon: "Bell", color: "bg-yellow-500", inputs: 1, outputs: 0, phase: 2, configSchema: { channel: { type: "select", label: "Channel", required: true, default: "email", options: [ { value: "email", label: "Email" }, { value: "webhook", label: "Webhook" }, { value: "slack", label: "Slack" }, ], }, target: { type: "string", label: "Target", required: true, placeholder: "email@example.com veya webhook URL", }, message_template: { type: "textarea", label: "Message Template", required: true, }, }, },
// ========== YENİ TRIGGERS ========== email_trigger: { type: "email_trigger", category: "triggers", label: "Email Trigger", description: "Gelen e-posta ile workflow'u tetikler", icon: "Mail", color: "bg-blue-500", inputs: 0, outputs: 1, phase: 2, configSchema: { email_address: { type: "string", label: "Email Address", required: true, placeholder: "trigger@example.com", }, filter_subject: { type: "string", label: "Subject Filter", required: false, placeholder: "Optional subject filter", }, }, },
file_watch_trigger: { type: "file_watch_trigger", category: "triggers", label: "File Watch", description: "Dosya değişikliklerini izler", icon: "File", color: "bg-indigo-500", inputs: 0, outputs: 1, phase: 2, configSchema: { watch_path: { type: "string", label: "Watch Path", required: true, placeholder: "/path/to/watch", }, file_pattern: { type: "string", label: "File Pattern", required: false, placeholder: "*.json", }, }, },
// ========== YENİ FLOW & LOGIC ========== merge: { type: "merge", category: "flow-logic", label: "Merge", description: "Birden fazla branch'i birleştirir", icon: "GitMerge", color: "bg-indigo-500", inputs: ["branch_1", "branch_2"], outputs: 1, phase: 2, configSchema: { merge_strategy: { type: "select", label: "Merge Strategy", required: true, default: "all", options: [ { value: "all", label: "Wait for All" }, { value: "first", label: "First to Complete" }, ], }, }, },
wait: { type: "wait", category: "flow-logic", label: "Wait", description: "Belirli bir koşul gerçekleşene kadar bekler", icon: "Clock", color: "bg-gray-500", inputs: 1, outputs: 1, phase: 2, configSchema: { wait_condition: { type: "string", label: "Wait Condition", required: true, placeholder: "{{ context.status === 'ready' }}", }, timeout_seconds: { type: "number", label: "Timeout (seconds)", required: false, default: 60, }, }, },
// ========== YENİ AI NODES ========== ai_embed: { type: "ai_embed", category: "ai-nodes", label: "AI Embed", description: "Metni vektör embedding'e dönüştürür", icon: "Brain", color: "bg-purple-400", inputs: 1, outputs: 1, phase: 2, configSchema: { provider: { type: "select", label: "Provider", required: true, default: "openai", options: [ { value: "openai", label: "OpenAI" }, { value: "cohere", label: "Cohere" }, { value: "hf", label: "HuggingFace" }, ], }, model: { type: "string", label: "Model", required: true, placeholder: "text-embedding-ada-002", }, }, },
ai_summarize: { type: "ai_summarize", category: "ai-nodes", label: "AI Summarize", description: "Metni özetler", icon: "Brain", color: "bg-purple-300", inputs: 1, outputs: 1, phase: 2, configSchema: { max_length: { type: "number", label: "Max Length", required: false, default: 200, }, style: { type: "select", label: "Style", required: false, default: "concise", options: [ { value: "concise", label: "Concise" }, { value: "detailed", label: "Detailed" }, { value: "bullet", label: "Bullet Points" }, ], }, }, },
ai_translate: { type: "ai_translate", category: "ai-nodes", label: "AI Translate", description: "Metni farklı dillere çevirir", icon: "Brain", color: "bg-purple-200", inputs: 1, outputs: 1, phase: 2, configSchema: { target_language: { type: "string", label: "Target Language", required: true, placeholder: "en, tr, de, fr", }, source_language: { type: "string", label: "Source Language (auto-detect if empty)", required: false, }, }, },
// ========== YENİ INTEGRATIONS - HTTP ========== rest_api: { type: "rest_api", category: "integrations", label: "REST API", description: "RESTful API çağrısı", icon: "Globe", color: "bg-blue-500", inputs: 1, outputs: 1, phase: 2, configSchema: { endpoint: { type: "string", label: "Endpoint", required: true, }, method: { type: "select", label: "Method", required: true, default: "GET", options: [ { value: "GET", label: "GET" }, { value: "POST", label: "POST" }, { value: "PUT", label: "PUT" }, { value: "DELETE", label: "DELETE" }, { value: "PATCH", label: "PATCH" }, ], }, authentication: { type: "select", label: "Authentication", required: false, default: "none", options: [ { value: "none", label: "None" }, { value: "bearer", label: "Bearer Token" }, { value: "basic", label: "Basic Auth" }, { value: "oauth2", label: "OAuth 2.0" }, ], }, }, },
graphql: { type: "graphql", category: "integrations", label: "GraphQL", description: "GraphQL query/mutation", icon: "Code", color: "bg-pink-600", inputs: 1, outputs: 1, phase: 2, configSchema: { endpoint: { type: "string", label: "GraphQL Endpoint", required: true, placeholder: "https://api.example.com/graphql", }, query: { type: "textarea", label: "Query/Mutation", required: true, rows: 8, }, variables: { type: "object", label: "Variables", required: false, }, }, },
// ========== YENİ INTEGRATIONS - DATABASE ========== db_insert: { type: "db_insert", category: "integrations", label: "DB Insert", description: "Veritabanına kayıt ekler", icon: "Database", color: "bg-teal-500", inputs: 1, outputs: 1, phase: 2, configSchema: { connection: { type: "string", label: "Connection", required: true, }, table: { type: "string", label: "Table", required: true, }, data: { type: "object", label: "Data", required: true, }, }, },
db_update: { type: "db_update", category: "integrations", label: "DB Update", description: "Veritabanı kaydını günceller", icon: "Database", color: "bg-teal-400", inputs: 1, outputs: 1, phase: 2, configSchema: { connection: { type: "string", label: "Connection", required: true, }, table: { type: "string", label: "Table", required: true, }, where: { type: "string", label: "WHERE Clause", required: true, placeholder: "id = {{ context.id }}", }, data: { type: "object", label: "Data", required: true, }, }, },
db_delete: { type: "db_delete", category: "integrations", label: "DB Delete", description: "Veritabanı kaydını siler", icon: "Database", color: "bg-red-600", inputs: 1, outputs: 1, phase: 2, configSchema: { connection: { type: "string", label: "Connection", required: true, }, table: { type: "string", label: "Table", required: true, }, where: { type: "string", label: "WHERE Clause", required: true, }, }, },
// ========== GOOGLE INTEGRATIONS ========== google_sheets: { type: "google_sheets", category: "integrations", label: "Google Sheets", description: "Google Sheets ile çalışır", icon: "FileSpreadsheet", color: "bg-green-600", inputs: 1, outputs: 1, phase: 2, configSchema: { action: { type: "select", label: "Action", required: true, default: "read", options: [ { value: "read", label: "Read Range" }, { value: "write", label: "Write Range" }, { value: "append", label: "Append Row" }, { value: "update", label: "Update Cell" }, ], }, spreadsheet_id: { type: "string", label: "Spreadsheet ID", required: true, }, range: { type: "string", label: "Range", required: true, placeholder: "Sheet1!A1:B10", }, credentials: { type: "string", label: "Credentials (JSON)", required: true, description: "Google Service Account JSON", }, }, },
google_drive: { type: "google_drive", category: "integrations", label: "Google Drive", description: "Google Drive dosya işlemleri", icon: "HardDrive", color: "bg-blue-500", inputs: 1, outputs: 1, phase: 2, configSchema: { action: { type: "select", label: "Action", required: true, default: "list", options: [ { value: "list", label: "List Files" }, { value: "download", label: "Download File" }, { value: "upload", label: "Upload File" }, { value: "delete", label: "Delete File" }, { value: "share", label: "Share File" }, ], }, file_id: { type: "string", label: "File ID", required: false, }, folder_id: { type: "string", label: "Folder ID", required: false, }, }, },
google_calendar: { type: "google_calendar", category: "integrations", label: "Google Calendar", description: "Google Calendar etkinlik yönetimi", icon: "Calendar", color: "bg-blue-400", inputs: 1, outputs: 1, phase: 2, configSchema: { action: { type: "select", label: "Action", required: true, default: "list", options: [ { value: "list", label: "List Events" }, { value: "create", label: "Create Event" }, { value: "update", label: "Update Event" }, { value: "delete", label: "Delete Event" }, ], }, calendar_id: { type: "string", label: "Calendar ID", required: false, default: "primary", }, }, },
google_gmail: { type: "google_gmail", category: "integrations", label: "Gmail", description: "Gmail e-posta işlemleri", icon: "Mail", color: "bg-red-500", inputs: 1, outputs: 1, phase: 2, configSchema: { action: { type: "select", label: "Action", required: true, default: "send", options: [ { value: "send", label: "Send Email" }, { value: "read", label: "Read Emails" }, { value: "search", label: "Search Emails" }, ], }, to: { type: "string", label: "To", required: false, }, subject: { type: "string", label: "Subject", required: false, }, body: { type: "textarea", label: "Body", required: false, }, }, },
google_analytics: { type: "google_analytics", category: "integrations", label: "Google Analytics", description: "Google Analytics veri çekme", icon: "BarChart", color: "bg-orange-500", inputs: 1, outputs: 1, phase: 2, configSchema: { property_id: { type: "string", label: "Property ID", required: true, }, date_range: { type: "string", label: "Date Range", required: false, default: "7daysAgo", }, metrics: { type: "array", label: "Metrics", required: true, default: ["sessions", "users"], }, }, },
google_cloud_storage: { type: "google_cloud_storage", category: "integrations", label: "Google Cloud Storage", description: "GCS bucket işlemleri", icon: "Cloud", color: "bg-blue-600", inputs: 1, outputs: 1, phase: 2, configSchema: { action: { type: "select", label: "Action", required: true, default: "upload", options: [ { value: "upload", label: "Upload" }, { value: "download", label: "Download" }, { value: "list", label: "List Objects" }, { value: "delete", label: "Delete" }, ], }, bucket: { type: "string", label: "Bucket Name", required: true, }, object_path: { type: "string", label: "Object Path", required: false, }, }, },
// ========== COMMUNICATION INTEGRATIONS ========== slack: { type: "slack", category: "integrations", label: "Slack", description: "Slack mesaj gönderme", icon: "MessageSquare", color: "bg-purple-600", inputs: 1, outputs: 1, phase: 2, configSchema: { action: { type: "select", label: "Action", required: true, default: "send_message", options: [ { value: "send_message", label: "Send Message" }, { value: "send_dm", label: "Send DM" }, { value: "create_channel", label: "Create Channel" }, ], }, channel: { type: "string", label: "Channel", required: true, placeholder: "#general", }, message: { type: "textarea", label: "Message", required: true, }, bot_token: { type: "string", label: "Bot Token", required: true, }, }, },
discord: { type: "discord", category: "integrations", label: "Discord", description: "Discord mesaj gönderme", icon: "MessageCircle", color: "bg-indigo-600", inputs: 1, outputs: 1, phase: 2, configSchema: { webhook_url: { type: "string", label: "Webhook URL", required: true, }, message: { type: "textarea", label: "Message", required: true, }, username: { type: "string", label: "Username", required: false, }, }, },
telegram: { type: "telegram", category: "integrations", label: "Telegram", description: "Telegram mesaj gönderme", icon: "Send", color: "bg-blue-500", inputs: 1, outputs: 1, phase: 2, configSchema: { bot_token: { type: "string", label: "Bot Token", required: true, }, chat_id: { type: "string", label: "Chat ID", required: true, }, message: { type: "textarea", label: "Message", required: true, }, }, },
whatsapp: { type: "whatsapp", category: "integrations", label: "WhatsApp", description: "WhatsApp mesaj gönderme", icon: "MessageSquare", color: "bg-green-500", inputs: 1, outputs: 1, phase: 2, configSchema: { phone_number: { type: "string", label: "Phone Number", required: true, placeholder: "+1234567890", }, message: { type: "textarea", label: "Message", required: true, }, api_key: { type: "string", label: "API Key", required: true, }, }, },
sms: { type: "sms", category: "integrations", label: "SMS", description: "SMS gönderme", icon: "Phone", color: "bg-green-600", inputs: 1, outputs: 1, phase: 2, configSchema: { provider: { type: "select", label: "Provider", required: true, default: "twilio", options: [ { value: "twilio", label: "Twilio" }, { value: "aws_sns", label: "AWS SNS" }, ], }, to: { type: "string", label: "To", required: true, }, message: { type: "string", label: "Message", required: true, }, }, },
// ========== CLOUD STORAGE ========== aws_s3: { type: "aws_s3", category: "integrations", label: "AWS S3", description: "Amazon S3 işlemleri", icon: "Cloud", color: "bg-orange-500", inputs: 1, outputs: 1, phase: 2, configSchema: { action: { type: "select", label: "Action", required: true, default: "upload", options: [ { value: "upload", label: "Upload" }, { value: "download", label: "Download" }, { value: "list", label: "List Objects" }, { value: "delete", label: "Delete" }, ], }, bucket: { type: "string", label: "Bucket", required: true, }, key: { type: "string", label: "Object Key", required: false, }, access_key: { type: "string", label: "Access Key", required: true, }, secret_key: { type: "string", label: "Secret Key", required: true, }, }, },
azure_blob: { type: "azure_blob", category: "integrations", label: "Azure Blob Storage", description: "Azure Blob Storage işlemleri", icon: "Cloud", color: "bg-blue-600", inputs: 1, outputs: 1, phase: 2, configSchema: { action: { type: "select", label: "Action", required: true, default: "upload", options: [ { value: "upload", label: "Upload" }, { value: "download", label: "Download" }, { value: "list", label: "List Blobs" }, ], }, container: { type: "string", label: "Container", required: true, }, blob_name: { type: "string", label: "Blob Name", required: false, }, connection_string: { type: "string", label: "Connection String", required: true, }, }, },
dropbox: { type: "dropbox", category: "integrations", label: "Dropbox", description: "Dropbox dosya işlemleri", icon: "Cloud", color: "bg-blue-500", inputs: 1, outputs: 1, phase: 2, configSchema: { action: { type: "select", label: "Action", required: true, default: "upload", options: [ { value: "upload", label: "Upload" }, { value: "download", label: "Download" }, { value: "list", label: "List Files" }, ], }, path: { type: "string", label: "Path", required: true, placeholder: "/folder/file.txt", }, access_token: { type: "string", label: "Access Token", required: true, }, }, },
// ========== PRODUCTIVITY ========== notion: { type: "notion", category: "integrations", label: "Notion", description: "Notion sayfa ve veritabanı işlemleri", icon: "FileText", color: "bg-gray-800", inputs: 1, outputs: 1, phase: 2, configSchema: { action: { type: "select", label: "Action", required: true, default: "create_page", options: [ { value: "create_page", label: "Create Page" }, { value: "update_page", label: "Update Page" }, { value: "query_database", label: "Query Database" }, ], }, database_id: { type: "string", label: "Database ID", required: false, }, api_key: { type: "string", label: "API Key", required: true, }, }, },
airtable: { type: "airtable", category: "integrations", label: "Airtable", description: "Airtable kayıt işlemleri", icon: "Table", color: "bg-blue-400", inputs: 1, outputs: 1, phase: 2, configSchema: { action: { type: "select", label: "Action", required: true, default: "create", options: [ { value: "create", label: "Create Record" }, { value: "read", label: "Read Records" }, { value: "update", label: "Update Record" }, { value: "delete", label: "Delete Record" }, ], }, base_id: { type: "string", label: "Base ID", required: true, }, table_name: { type: "string", label: "Table Name", required: true, }, api_key: { type: "string", label: "API Key", required: true, }, }, },
trello: { type: "trello", category: "integrations", label: "Trello", description: "Trello kart ve liste işlemleri", icon: "Grid", color: "bg-blue-500", inputs: 1, outputs: 1, phase: 2, configSchema: { action: { type: "select", label: "Action", required: true, default: "create_card", options: [ { value: "create_card", label: "Create Card" }, { value: "update_card", label: "Update Card" }, { value: "list_cards", label: "List Cards" }, ], }, board_id: { type: "string", label: "Board ID", required: true, }, list_id: { type: "string", label: "List ID", required: false, }, api_key: { type: "string", label: "API Key", required: true, }, token: { type: "string", label: "Token", required: true, }, }, },
asana: { type: "asana", category: "integrations", label: "Asana", description: "Asana görev yönetimi", icon: "CheckSquare", color: "bg-purple-500", inputs: 1, outputs: 1, phase: 2, configSchema: { action: { type: "select", label: "Action", required: true, default: "create_task", options: [ { value: "create_task", label: "Create Task" }, { value: "update_task", label: "Update Task" }, { value: "list_tasks", label: "List Tasks" }, ], }, project_id: { type: "string", label: "Project ID", required: false, }, access_token: { type: "string", label: "Access Token", required: true, }, }, },
jira: { type: "jira", category: "integrations", label: "Jira", description: "Jira issue yönetimi", icon: "Bug", color: "bg-blue-600", inputs: 1, outputs: 1, phase: 2, configSchema: { action: { type: "select", label: "Action", required: true, default: "create_issue", options: [ { value: "create_issue", label: "Create Issue" }, { value: "update_issue", label: "Update Issue" }, { value: "search_issues", label: "Search Issues" }, ], }, project_key: { type: "string", label: "Project Key", required: true, }, domain: { type: "string", label: "Jira Domain", required: true, placeholder: "yourcompany.atlassian.net", }, email: { type: "string", label: "Email", required: true, }, api_token: { type: "string", label: "API Token", required: true, }, }, },
// ========== E-COMMERCE ========== shopify: { type: "shopify", category: "integrations", label: "Shopify", description: "Shopify mağaza işlemleri", icon: "ShoppingCart", color: "bg-green-600", inputs: 1, outputs: 1, phase: 2, configSchema: { action: { type: "select", label: "Action", required: true, default: "get_products", options: [ { value: "get_products", label: "Get Products" }, { value: "create_product", label: "Create Product" }, { value: "get_orders", label: "Get Orders" }, { value: "update_order", label: "Update Order" }, ], }, shop_domain: { type: "string", label: "Shop Domain", required: true, placeholder: "your-shop.myshopify.com", }, access_token: { type: "string", label: "Access Token", required: true, }, }, },
woocommerce: { type: "woocommerce", category: "integrations", label: "WooCommerce", description: "WooCommerce mağaza işlemleri", icon: "ShoppingBag", color: "bg-purple-600", inputs: 1, outputs: 1, phase: 2, configSchema: { action: { type: "select", label: "Action", required: true, default: "get_products", options: [ { value: "get_products", label: "Get Products" }, { value: "create_order", label: "Create Order" }, { value: "get_orders", label: "Get Orders" }, ], }, store_url: { type: "string", label: "Store URL", required: true, }, consumer_key: { type: "string", label: "Consumer Key", required: true, }, consumer_secret: { type: "string", label: "Consumer Secret", required: true, }, }, },
stripe: { type: "stripe", category: "integrations", label: "Stripe", description: "Stripe ödeme işlemleri", icon: "CreditCard", color: "bg-indigo-600", inputs: 1, outputs: 1, phase: 2, configSchema: { action: { type: "select", label: "Action", required: true, default: "create_payment", options: [ { value: "create_payment", label: "Create Payment" }, { value: "create_customer", label: "Create Customer" }, { value: "list_charges", label: "List Charges" }, { value: "refund", label: "Refund" }, ], }, api_key: { type: "string", label: "API Key", required: true, }, amount: { type: "number", label: "Amount (cents)", required: false, }, currency: { type: "string", label: "Currency", required: false, default: "usd", }, }, },
paypal: { type: "paypal", category: "integrations", label: "PayPal", description: "PayPal ödeme işlemleri", icon: "CreditCard", color: "bg-blue-500", inputs: 1, outputs: 1, phase: 2, configSchema: { action: { type: "select", label: "Action", required: true, default: "create_order", options: [ { value: "create_order", label: "Create Order" }, { value: "capture_order", label: "Capture Order" }, ], }, client_id: { type: "string", label: "Client ID", required: true, }, client_secret: { type: "string", label: "Client Secret", required: true, }, mode: { type: "select", label: "Mode", required: true, default: "sandbox", options: [ { value: "sandbox", label: "Sandbox" }, { value: "live", label: "Live" }, ], }, }, },
// ========== SOCIAL MEDIA ========== twitter: { type: "twitter", category: "integrations", label: "Twitter / X", description: "Twitter/X tweet işlemleri", icon: "Twitter", color: "bg-black", inputs: 1, outputs: 1, phase: 2, configSchema: { action: { type: "select", label: "Action", required: true, default: "post_tweet", options: [ { value: "post_tweet", label: "Post Tweet" }, { value: "search_tweets", label: "Search Tweets" }, { value: "get_user_tweets", label: "Get User Tweets" }, ], }, text: { type: "textarea", label: "Tweet Text", required: false, }, bearer_token: { type: "string", label: "Bearer Token", required: true, }, }, },
facebook: { type: "facebook", category: "integrations", label: "Facebook", description: "Facebook post işlemleri", icon: "Facebook", color: "bg-blue-600", inputs: 1, outputs: 1, phase: 2, configSchema: { action: { type: "select", label: "Action", required: true, default: "post", options: [ { value: "post", label: "Create Post" }, { value: "get_posts", label: "Get Posts" }, ], }, page_id: { type: "string", label: "Page ID", required: true, }, access_token: { type: "string", label: "Access Token", required: true, }, }, },
instagram: { type: "instagram", category: "integrations", label: "Instagram", description: "Instagram post işlemleri", icon: "Instagram", color: "bg-pink-600", inputs: 1, outputs: 1, phase: 2, configSchema: { action: { type: "select", label: "Action", required: true, default: "post_photo", options: [ { value: "post_photo", label: "Post Photo" }, { value: "get_media", label: "Get Media" }, ], }, image_url: { type: "string", label: "Image URL", required: false, }, caption: { type: "string", label: "Caption", required: false, }, access_token: { type: "string", label: "Access Token", required: true, }, }, },
linkedin: { type: "linkedin", category: "integrations", label: "LinkedIn", description: "LinkedIn post işlemleri", icon: "Linkedin", color: "bg-blue-700", inputs: 1, outputs: 1, phase: 2, configSchema: { action: { type: "select", label: "Action", required: true, default: "post", options: [ { value: "post", label: "Create Post" }, { value: "get_posts", label: "Get Posts" }, ], }, text: { type: "textarea", label: "Post Text", required: false, }, access_token: { type: "string", label: "Access Token", required: true, }, }, },
youtube: { type: "youtube", category: "integrations", label: "YouTube", description: "YouTube video işlemleri", icon: "Youtube", color: "bg-red-600", inputs: 1, outputs: 1, phase: 2, configSchema: { action: { type: "select", label: "Action", required: true, default: "search", options: [ { value: "search", label: "Search Videos" }, { value: "get_video", label: "Get Video Details" }, { value: "get_comments", label: "Get Comments" }, ], }, query: { type: "string", label: "Search Query", required: false, }, api_key: { type: "string", label: "API Key", required: true, }, }, },
// ========== CRM ========== salesforce: { type: "salesforce", category: "integrations", label: "Salesforce", description: "Salesforce CRM işlemleri", icon: "TrendingUp", color: "bg-blue-500", inputs: 1, outputs: 1, phase: 2, configSchema: { action: { type: "select", label: "Action", required: true, default: "query", options: [ { value: "query", label: "SOQL Query" }, { value: "create", label: "Create Record" }, { value: "update", label: "Update Record" }, ], }, soql: { type: "textarea", label: "SOQL Query", required: false, placeholder: "SELECT Id, Name FROM Account", }, instance_url: { type: "string", label: "Instance URL", required: true, }, access_token: { type: "string", label: "Access Token", required: true, }, }, },
hubspot: { type: "hubspot", category: "integrations", label: "HubSpot", description: "HubSpot CRM işlemleri", icon: "TrendingUp", color: "bg-orange-500", inputs: 1, outputs: 1, phase: 2, configSchema: { action: { type: "select", label: "Action", required: true, default: "create_contact", options: [ { value: "create_contact", label: "Create Contact" }, { value: "update_contact", label: "Update Contact" }, { value: "get_contact", label: "Get Contact" }, ], }, api_key: { type: "string", label: "API Key", required: true, }, }, },
zoho: { type: "zoho", category: "integrations", label: "Zoho CRM", description: "Zoho CRM işlemleri", icon: "TrendingUp", color: "bg-red-500", inputs: 1, outputs: 1, phase: 2, configSchema: { action: { type: "select", label: "Action", required: true, default: "create_record", options: [ { value: "create_record", label: "Create Record" }, { value: "update_record", label: "Update Record" }, { value: "search_records", label: "Search Records" }, ], }, module: { type: "string", label: "Module", required: true, placeholder: "Leads, Contacts, Deals", }, access_token: { type: "string", label: "Access Token", required: true, }, }, },
// ========== YENİ DATA & UTILS ========== set_variable: { type: "set_variable", category: "data-utils", label: "Set Variable", description: "Değişken tanımlama", icon: "Variable", color: "bg-cyan-600", inputs: 1, outputs: 1, phase: 1, configSchema: { variable_name: { type: "string", label: "Variable Name", required: true, placeholder: "myVar", }, value: { type: "string", label: "Value", required: true, placeholder: "{{ context.data }}", }, }, },
get_variable: { type: "get_variable", category: "data-utils", label: "Get Variable", description: "Değişken okuma", icon: "Variable", color: "bg-cyan-500", inputs: 0, outputs: 1, phase: 1, configSchema: { variable_name: { type: "string", label: "Variable Name", required: true, }, }, },
json_parse: { type: "json_parse", category: "data-utils", label: "JSON Parse", description: "JSON string'i parse eder", icon: "Code", color: "bg-yellow-500", inputs: 1, outputs: 1, phase: 1, configSchema: { json_string: { type: "string", label: "JSON String", required: true, placeholder: "{{ context.jsonString }}", }, }, },
json_stringify: { type: "json_stringify", category: "data-utils", label: "JSON Stringify", description: "Obje'yi JSON string'e çevirir", icon: "Code", color: "bg-yellow-400", inputs: 1, outputs: 1, phase: 1, configSchema: { pretty: { type: "boolean", label: "Pretty Print", required: false, default: false, }, }, },
csv_parse: { type: "csv_parse", category: "data-utils", label: "CSV Parse", description: "CSV string'i parse eder", icon: "FileSpreadsheet", color: "bg-green-500", inputs: 1, outputs: 1, phase: 2, configSchema: { csv_string: { type: "string", label: "CSV String", required: true, }, delimiter: { type: "string", label: "Delimiter", required: false, default: ",", }, has_headers: { type: "boolean", label: "Has Headers", required: false, default: true, }, }, },
csv_generate: { type: "csv_generate", category: "data-utils", label: "CSV Generate", description: "Array'den CSV oluşturur", icon: "FileSpreadsheet", color: "bg-green-400", inputs: 1, outputs: 1, phase: 2, configSchema: { data: { type: "array", label: "Data Array", required: true, }, delimiter: { type: "string", label: "Delimiter", required: false, default: ",", }, }, },
xml_parse: { type: "xml_parse", category: "data-utils", label: "XML Parse", description: "XML string'i parse eder", icon: "FileCode", color: "bg-orange-500", inputs: 1, outputs: 1, phase: 2, configSchema: { xml_string: { type: "string", label: "XML String", required: true, }, }, },
base64_encode: { type: "base64_encode", category: "data-utils", label: "Base64 Encode", description: "String'i Base64'e encode eder", icon: "Lock", color: "bg-gray-600", inputs: 1, outputs: 1, phase: 1, configSchema: {}, },
base64_decode: { type: "base64_decode", category: "data-utils", label: "Base64 Decode", description: "Base64 string'i decode eder", icon: "Unlock", color: "bg-gray-500", inputs: 1, outputs: 1, phase: 1, configSchema: {}, },
hash: { type: "hash", category: "data-utils", label: "Hash", description: "String'i hash'ler", icon: "Lock", color: "bg-gray-700", inputs: 1, outputs: 1, phase: 2, configSchema: { algorithm: { type: "select", label: "Algorithm", required: true, default: "sha256", options: [ { value: "md5", label: "MD5" }, { value: "sha1", label: "SHA1" }, { value: "sha256", label: "SHA256" }, { value: "sha512", label: "SHA512" }, ], }, }, },
encrypt: { type: "encrypt", category: "data-utils", label: "Encrypt", description: "Veriyi şifreler", icon: "Lock", color: "bg-red-600", inputs: 1, outputs: 1, phase: 2, configSchema: { algorithm: { type: "select", label: "Algorithm", required: true, default: "aes-256-gcm", options: [ { value: "aes-256-gcm", label: "AES-256-GCM" }, { value: "aes-128-gcm", label: "AES-128-GCM" }, ], }, key: { type: "string", label: "Encryption Key", required: true, }, }, },
decrypt: { type: "decrypt", category: "data-utils", label: "Decrypt", description: "Şifrelenmiş veriyi çözer", icon: "Unlock", color: "bg-red-500", inputs: 1, outputs: 1, phase: 2, configSchema: { algorithm: { type: "select", label: "Algorithm", required: true, default: "aes-256-gcm", options: [ { value: "aes-256-gcm", label: "AES-256-GCM" }, { value: "aes-128-gcm", label: "AES-128-GCM" }, ], }, key: { type: "string", label: "Decryption Key", required: true, }, }, },
// ========== YENİ OUTPUTS ========== email_send: { type: "email_send", category: "outputs", label: "Send Email", description: "E-posta gönderir", icon: "Mail", color: "bg-blue-500", inputs: 1, outputs: 1, phase: 2, configSchema: { to: { type: "string", label: "To", required: true, }, subject: { type: "string", label: "Subject", required: true, }, body: { type: "textarea", label: "Body", required: true, }, from: { type: "string", label: "From", required: false, }, smtp_server: { type: "string", label: "SMTP Server", required: true, }, smtp_port: { type: "number", label: "SMTP Port", required: false, default: 587, }, }, },
file_write: { type: "file_write", category: "outputs", label: "Write File", description: "Dosyaya yazar", icon: "File", color: "bg-gray-600", inputs: 1, outputs: 1, phase: 2, configSchema: { file_path: { type: "string", label: "File Path", required: true, placeholder: "/path/to/file.txt", }, content: { type: "textarea", label: "Content", required: true, }, mode: { type: "select", label: "Mode", required: true, default: "write", options: [ { value: "write", label: "Write (Overwrite)" }, { value: "append", label: "Append" }, ], }, }, },
file_download: { type: "file_download", category: "outputs", label: "Download File", description: "Dosya indirir", icon: "Download", color: "bg-blue-600", inputs: 1, outputs: 1, phase: 2, configSchema: { url: { type: "string", label: "File URL", required: true, }, save_path: { type: "string", label: "Save Path", required: false, }, }, },};
// Kategori bilgileriexport const NODE_CATEGORIES: Record<NodeCategory, { label: string; description: string; icon: string }> = { triggers: { label: "Triggers", description: "Tetikleyiciler", icon: "Zap", }, "flow-logic": { label: "Flow & Logic", description: "Akış & Mantık", icon: "GitBranch", }, "ai-nodes": { label: "AI Nodes", description: "Yapay Zeka", icon: "Brain", }, integrations: { label: "Integrations", description: "Entegrasyonlar", icon: "Globe", }, "data-utils": { label: "Data & Utils", description: "Veri & Yardımcılar", icon: "Settings", }, outputs: { label: "Outputs", description: "Çıktı & Kullanıcıya Dönüş", icon: "FileOutput", },};
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960// NodeType artık nodes.ts'den import ediliyorimport type { NodeType } from "./nodes";export type { NodeType };
export interface NodeData { id: string; type: NodeType; label: string; position: { x: number; y: number }; data: { label: string; [key: string]: any; };}
export interface EdgeData { id: string; source: string; target: string; sourceHandle?: string; targetHandle?: string;}
export interface Workflow { id: string; name: string; description?: string; isActive: boolean; createdAt: string; updatedAt: string; graphJson: { nodes: NodeData[]; edges: EdgeData[]; };}
export interface NodeConfig { [key: string]: any;}
export interface AIStepConfig extends NodeConfig { model: string; prompt: string; temperature: number; maxTokens: number;}
export interface HTTPConfig extends NodeConfig { method: string; url: string; headers: Record<string, string>; body?: string;}
export interface DecisionConfig extends NodeConfig { condition: string; truePath: string; falsePath: string;}
.DS_StoreAdded
.gitattributesDeleted-2
.gitignoreAdded+1
README.md+362-2
app/globals.cssAdded+103
app/layout.tsxAdded+20
app/page.tsxAdded+182
app/workflow/[id]/page.tsxAdded+70
components/ui/Badge.tsxAdded+35
components/ui/Button.tsxAdded+39
components/ui/Card.tsxAdded+25
components/ui/Input.tsxAdded+29
components/ui/Textarea.tsxAdded+28
components/workflow/AIChatPanel.tsxAdded+191
components/workflow/NodePalette.tsxAdded+290
components/workflow/NodeSettingsPanel.tsxAdded+287
components/workflow/NodeTypes.tsxAdded+221
components/workflow/RunLogPanel.tsxAdded+129
components/workflow/WorkflowCanvas.tsxAdded+170
components/workflow/WorkflowMetaPanel.tsxAdded+213
lib/api.tsAdded+220
lib/utils.tsAdded+7
next-env.d.tsAdded+6
next.config.jsAdded+7
package-lock.jsonAdded
package.jsonAdded+33
postcss.config.jsAdded+7
store/workflowStore.tsAdded+376
tailwind.config.tsAdded+49
tsconfig.jsonAdded+41
tsconfig.tsbuildinfoAdded
types/nodes.tsAdded+2757
types/workflow.tsAdded+60