Skip to content

A modern platform for visual, flexible, and extensible graph-based investigations. For cybersecurity analysts and investigators.

feat: single source of trust from api

dextmorgnb75d4b2548d9
diff --git a/flowsint-api/app/api/routes/sketches.py b/flowsint-api/app/api/routes/sketches.py
index 5295c831..1bac30d0 100644
--- a/flowsint-api/app/api/routes/sketches.py
+++ b/flowsint-api/app/api/routes/sketches.py
@@ -235,6 +235,70 @@ def add_edge(sketch_id: str, relation: RelationInput, current_user: Profile = De
class NodeDeleteInput(BaseModel):
nodeIds: List[str]
+class NodeEditInput(BaseModel):
+ nodeId: str
+ data: NodeData = Field(default_factory=NodeData, description="Updated data for the node")
+
[email protected]("/{sketch_id}/nodes/edit")
+def edit_node(
+ sketch_id: str,
+ node_edit: NodeEditInput,
+ db: Session = Depends(get_db),
+ current_user: Profile = Depends(get_current_user)
+):
+ # First verify the sketch exists and belongs to the user
+ sketch = db.query(Sketch).filter(Sketch.id == sketch_id).first()
+ if not sketch:
+ raise HTTPException(status_code=404, detail="Sketch not found")
+
+ node_data = node_edit.data.model_dump()
+ node_type = node_data.get("type", "Node")
+
+ # Prepare properties to update
+ properties = {
+ "type": node_type.lower(),
+ "caption": node_data.get("label", "Node"),
+ "label": node_data.get("label", "Node"),
+ }
+
+ # Add any additional data from the flattened node_data
+ if node_data:
+ flattened_data = flatten(node_data)
+ properties.update(flattened_data)
+
+ # Build the SET clause for the Cypher query
+ set_clause = ", ".join(f"n.{key} = ${key}" for key in properties.keys())
+
+ query = f"""
+ MATCH (n)
+ WHERE elementId(n) = $node_id AND n.sketch_id = $sketch_id
+ SET {set_clause}
+ RETURN n as node
+ """
+
+ params = {
+ "node_id": node_edit.nodeId,
+ "sketch_id": sketch_id,
+ **properties
+ }
+
+ try:
+ result = neo4j_connection.query(query, params)
+ except Exception as e:
+ print(f"Node update error: {e}")
+ raise HTTPException(status_code=500, detail="Failed to update node")
+
+ if not result:
+ raise HTTPException(status_code=404, detail="Node not found or not accessible")
+
+ updated_node = result[0]["node"]
+ updated_node["data"] = node_data
+
+ return {
+ "status": "node updated",
+ "node": updated_node,
+ }
+
@router.delete("/{sketch_id}/nodes")
def delete_nodes(
sketch_id: str,
diff --git a/flowsint-api/app/api/routes/transforms.py b/flowsint-api/app/api/routes/transforms.py
index f17971f7..fe79d924 100644
--- a/flowsint-api/app/api/routes/transforms.py
+++ b/flowsint-api/app/api/routes/transforms.py
@@ -3,7 +3,7 @@ from fastapi import APIRouter, HTTPException, Depends, status, Query
from typing import Dict, List, Any, Optional
from pydantic import BaseModel
from datetime import datetime
-from app.utils import extract_input_schema
+from app.utils import extract_input_schema_transform
from app.scanners.registry import ScannerRegistry
from app.core.celery import celery
from app.types.domain import Domain
@@ -63,7 +63,7 @@ def get_transforms(
# Returns the "raw_materials" for the transform editor
@router.get("/raw_materials")
-async def get_scans_list():
+async def get_material_list():
scanners = ScannerRegistry.list_by_category()
flattened_scanners = {
category: [
@@ -84,18 +84,18 @@ async def get_scans_list():
# Ajoute les types comme des "scanners" spéciaux de type 'type'
object_inputs = [
- extract_input_schema("Organization", Organization),
- extract_input_schema("Individual", Individual),
- extract_input_schema("Domain", Domain),
- extract_input_schema("Website", Website),
- extract_input_schema("Ip", Ip),
- extract_input_schema("ASN", ASN),
- extract_input_schema("CIDR", CIDR),
- extract_input_schema("SocialProfile", SocialProfile),
- extract_input_schema("Email", Email),
- extract_input_schema("CryptoWallet", CryptoWallet),
- extract_input_schema("CryptoTransaction", CryptoWalletTransaction),
- extract_input_schema("CryptoNFT", CryptoNFT)
+ extract_input_schema_transform(Organization),
+ extract_input_schema_transform(Individual),
+ extract_input_schema_transform(Domain),
+ extract_input_schema_transform(Website),
+ extract_input_schema_transform(Ip),
+ extract_input_schema_transform(ASN),
+ extract_input_schema_transform(CIDR),
+ extract_input_schema_transform(SocialProfile),
+ extract_input_schema_transform(Email),
+ extract_input_schema_transform(CryptoWallet),
+ extract_input_schema_transform(CryptoWalletTransaction),
+ extract_input_schema_transform(CryptoNFT)
]
flattened_scanners["types"] = object_inputs
diff --git a/flowsint-api/app/api/routes/types.py b/flowsint-api/app/api/routes/types.py
new file mode 100644
index 00000000..c3514b3f
--- /dev/null
+++ b/flowsint-api/app/api/routes/types.py
@@ -0,0 +1,121 @@
+from typing import Any, Dict, Type
+from uuid import UUID, uuid4
+from fastapi import APIRouter
+from pydantic import BaseModel, TypeAdapter
+from app.core.celery import celery
+from app.types.domain import Domain
+from app.types.ip import Ip
+from app.types.social import SocialProfile
+from app.types.organization import Organization
+from app.types.email import Email
+from app.types.asn import ASN
+from app.types.cidr import CIDR
+from app.types.wallet import CryptoWallet, CryptoWalletTransaction, CryptoNFT
+from app.types.website import Website
+from app.types.individual import Individual
+from app.types.phone import Phone
+
+router = APIRouter()
+
+# Returns the "types" for the sketches
+async def get_types_list():
+ types = [
+ {
+ "id": uuid4(),
+ "type": "person",
+ "key": "person_category",
+ "icon": "individual",
+ "label": "Person",
+ "fields": [],
+ "children": [
+ extract_input_schema(Individual, label_key="full_name"),
+ extract_input_schema(SocialProfile, label_key="username"),
+ ],
+ },
+ {
+ "id": uuid4(),
+ "type": "organization",
+ "key": "organization_category",
+ "icon": "organization",
+ "label": "Organization",
+ "fields": [],
+ "children": [
+ extract_input_schema(Organization, label_key="name"),
+ ],
+ },
+ {
+ "id": uuid4(),
+ "type": "contact_category",
+ "key": "contact",
+ "icon": "phone",
+ "label": "Contact",
+ "fields": [],
+ "children": [
+ extract_input_schema(Phone, label_key="number"),
+ extract_input_schema(Email, label_key="email"),
+ ],
+ }
+ ]
+
+ return types
+
+
+
+def extract_input_schema(model: Type[BaseModel], label_key:str) -> Dict[str, Any]:
+
+ adapter = TypeAdapter(model)
+ print(model.__name__)
+ schema = adapter.json_schema()
+ # Use the main schema properties, not the $defs
+ type_name = model.__name__
+ details = schema
+ return {
+ "id": uuid4(),
+ "type": type_name,
+ "key": type_name.lower(),
+ "label_key": label_key,
+ "icon": type_name.lower(),
+ "label": type_name,
+ "fields": [resolve_field(prop, details=info, schema=schema)
+ for prop, info in details.get("properties", {}).items()
+ ]
+ }
+
+
+def resolve_field(prop:str, details: dict, schema: dict = None) -> Dict:
+ """_summary_
+ The fields can sometimes contain nested complex objects, like:
+ - Organization having Individual[] as dirigeants, so we want to skip those.
+ Args:
+ details (dict): _description_
+ schema_context (dict, optional): _description_. Defaults to None.
+
+ Returns:
+ str: _description_
+ """
+ field = { "name": prop,"label": details["title"], "description": details["description"], "type":"text"}
+ if has_enum(details):
+ field["type"] = "select"
+ field["options"]= [
+ { "label": label, "value": label } for label in get_enum_values(details)
+ ]
+ field["required"] = is_required(details)
+
+ return field
+
+
+def has_enum(schema: dict) -> bool:
+ any_of = schema.get('anyOf', [])
+ return any(isinstance(entry, dict) and 'enum' in entry for entry in any_of)
+
+def is_required(schema: dict) -> bool:
+ any_of = schema.get('anyOf', [])
+ return not any(entry == {'type': 'null'} for entry in any_of)
+
+def get_enum_values(schema: dict) -> list:
+ enum_values = []
+ for entry in schema.get('anyOf', []):
+ if isinstance(entry, dict) and 'enum' in entry:
+ enum_values.extend(entry['enum'])
+ return enum_values
\ No newline at end of file
diff --git a/flowsint-api/app/main.py b/flowsint-api/app/main.py
index 06f39332..da138202 100644
--- a/flowsint-api/app/main.py
+++ b/flowsint-api/app/main.py
@@ -14,6 +14,8 @@ from app.api.routes import analysis
from app.api.routes import chat
from app.api.routes import scan
from app.api.routes import keys
+from app.api.routes import types
+
load_dotenv()
URI = os.getenv("NEO4J_URI_BOLT")
@@ -57,4 +59,5 @@ app.include_router(events.router, prefix="/api/events", tags=["events"])
app.include_router(analysis.router, prefix="/api/analyses", tags=["analyses"])
app.include_router(chat.router, prefix="/api/chat", tags=["chat"])
app.include_router(scan.router, prefix="/api/scans", tags=["scans"])
-app.include_router(keys.router, prefix="/api/third_party_keys", tags=["third_party_keys"])
\ No newline at end of file
+app.include_router(keys.router, prefix="/api/third_party_keys", tags=["third_party_keys"])
+app.include_router(types.router, prefix="/api/types", tags=["types"])
\ No newline at end of file
diff --git a/flowsint-api/app/types/address.py b/flowsint-api/app/types/address.py
index bde20016..6280652b 100644
--- a/flowsint-api/app/types/address.py
+++ b/flowsint-api/app/types/address.py
@@ -2,10 +2,10 @@ from pydantic import BaseModel, Field
from typing import Optional
class PhysicalAddress(BaseModel):
- address: str = Field(..., description="Street address")
- city: str = Field(..., description="City name")
- country: str = Field(..., description="Country name")
- zip: str = Field(..., description="ZIP or postal code")
- latitude: Optional[float] = Field(None, description="Latitude coordinate of the address")
- longitude: Optional[float] = Field(None, description="Longitude coordinate of the address")
+ address: str = Field(..., description="Street address", title="Street Address")
+ city: str = Field(..., description="City name", title="City")
+ country: str = Field(..., description="Country name", title="Country")
+ zip: str = Field(..., description="ZIP or postal code", title="ZIP/Postal Code")
+ latitude: Optional[float] = Field(None, description="Latitude coordinate of the address", title="Latitude")
+ longitude: Optional[float] = Field(None, description="Longitude coordinate of the address", title="Longitude")
diff --git a/flowsint-api/app/types/asn.py b/flowsint-api/app/types/asn.py
index 3c4c1a87..d7e10cee 100644
--- a/flowsint-api/app/types/asn.py
+++ b/flowsint-api/app/types/asn.py
@@ -3,10 +3,10 @@ from pydantic import BaseModel, Field
from .cidr import CIDR
class ASN(BaseModel):
- number: int = Field(..., description="Autonomous System Number (e.g., 15169)")
- name: Optional[str] = Field(None, description="Name of the organization owning the ASN")
- country: Optional[str] = Field(None, description="ISO 3166-1 alpha-2 country code")
- description: Optional[str] = Field(None, description="Additional information about the ASN")
- cidrs: List[CIDR] = Field(default_factory=list, description="List of announced CIDR blocks")
+ number: int = Field(..., description="Autonomous System Number (e.g., 15169)", title="ASN Number")
+ name: Optional[str] = Field(None, description="Name of the organization owning the ASN", title="Organization Name")
+ country: Optional[str] = Field(None, description="ISO 3166-1 alpha-2 country code", title="Country Code")
+ description: Optional[str] = Field(None, description="Additional information about the ASN", title="Description")
+ cidrs: List[CIDR] = Field(default_factory=list, description="List of announced CIDR blocks", title="CIDR Blocks")
ASN.model_rebuild()
diff --git a/flowsint-api/app/types/breach.py b/flowsint-api/app/types/breach.py
index 1c24ca64..b28458d0 100644
--- a/flowsint-api/app/types/breach.py
+++ b/flowsint-api/app/types/breach.py
@@ -2,22 +2,22 @@ from typing import List, Optional, Dict
from pydantic import BaseModel, Field
class Breach(BaseModel):
- name: str = Field(..., description="The name of the breach or service")
- title: Optional[str] = Field(None, description="Title of the breach")
- domain: Optional[str] = Field(None, description="Domain of the breached service")
- breachdate: Optional[str] = Field(None, description="Date of the breach")
- addeddate: Optional[str] = Field(None, description="Date breach was added to HIBP")
- modifieddate: Optional[str] = Field(None, description="Date breach was last modified")
- pwncount: Optional[int] = Field(None, description="Number of accounts affected")
- description: Optional[str] = Field(None, description="Description of the breach")
- logopath: Optional[str] = Field(None, description="Logo path for the breach")
- dataclasses: Optional[List[str]] = Field(None, description="Types of data compromised")
- isverified: Optional[bool] = Field(None, description="Whether the breach is verified")
- isfabricated: Optional[bool] = Field(None, description="Whether the breach is fabricated")
- issensitive: Optional[bool] = Field(None, description="Whether the breach is sensitive")
- isretired: Optional[bool] = Field(None, description="Whether the breach is retired")
- isspamlist: Optional[bool] = Field(None, description="Whether the breach is a spam list")
- ismalware: Optional[bool] = Field(None, description="Whether the breach is related to malware")
- isstealerlog: Optional[bool] = Field(None, description="Whether the breach is a stealer log")
- issubscriptionfree: Optional[bool] = Field(None, description="Whether the breach is subscription free")
- breach: Optional[Dict] = Field(None, description="Full breach data as returned by the API")
\ No newline at end of file
+ name: str = Field(..., description="The name of the breach or service", title="Breach Name")
+ title: Optional[str] = Field(None, description="Title of the breach", title="Breach Title")
+ domain: Optional[str] = Field(None, description="Domain of the breached service", title="Domain")
+ breachdate: Optional[str] = Field(None, description="Date of the breach", title="Breach Date")
+ addeddate: Optional[str] = Field(None, description="Date breach was added to HIBP", title="Added Date")
+ modifieddate: Optional[str] = Field(None, description="Date breach was last modified", title="Modified Date")
+ pwncount: Optional[int] = Field(None, description="Number of accounts affected", title="Affected Accounts")
+ description: Optional[str] = Field(None, description="Description of the breach", title="Description")
+ logopath: Optional[str] = Field(None, description="Logo path for the breach", title="Logo Path")
+ dataclasses: Optional[List[str]] = Field(None, description="Types of data compromised", title="Data Classes")
+ isverified: Optional[bool] = Field(None, description="Whether the breach is verified", title="Is Verified")
+ isfabricated: Optional[bool] = Field(None, description="Whether the breach is fabricated", title="Is Fabricated")
+ issensitive: Optional[bool] = Field(None, description="Whether the breach is sensitive", title="Is Sensitive")
+ isretired: Optional[bool] = Field(None, description="Whether the breach is retired", title="Is Retired")
+ isspamlist: Optional[bool] = Field(None, description="Whether the breach is a spam list", title="Is Spam List")
+ ismalware: Optional[bool] = Field(None, description="Whether the breach is related to malware", title="Is Malware")
+ isstealerlog: Optional[bool] = Field(None, description="Whether the breach is a stealer log", title="Is Stealer Log")
+ issubscriptionfree: Optional[bool] = Field(None, description="Whether the breach is subscription free", title="Is Subscription Free")
+ breach: Optional[Dict] = Field(None, description="Full breach data as returned by the API", title="Full Breach Data")
\ No newline at end of file
diff --git a/flowsint-api/app/types/cidr.py b/flowsint-api/app/types/cidr.py
index 2fd313b4..682eabdf 100644
--- a/flowsint-api/app/types/cidr.py
+++ b/flowsint-api/app/types/cidr.py
@@ -1,4 +1,4 @@
from pydantic import BaseModel, IPvAnyNetwork, Field
class CIDR(BaseModel):
- network: IPvAnyNetwork = Field(..., description="CIDR block (e.g., 8.8.8.0/24)")
+ network: IPvAnyNetwork = Field(..., description="CIDR block (e.g., 8.8.8.0/24)", title="Network Block")
diff --git a/flowsint-api/app/types/domain.py b/flowsint-api/app/types/domain.py
index 0ff3cee8..37a9bcc7 100644
--- a/flowsint-api/app/types/domain.py
+++ b/flowsint-api/app/types/domain.py
@@ -2,8 +2,8 @@ from typing import Optional
from pydantic import BaseModel, Field
class Domain(BaseModel):
- domain: str = Field(..., description="Domain name")
- root: Optional[bool]= Field(True, description="Is root or not")
+ domain: str = Field(..., description="Domain name", title="Domain Name")
+ root: Optional[bool]= Field(True, description="Is root or not", title="Is Root Domain")
Domain.model_rebuild()
diff --git a/flowsint-api/app/types/email.py b/flowsint-api/app/types/email.py
index 828c8ddc..617fadcb 100644
--- a/flowsint-api/app/types/email.py
+++ b/flowsint-api/app/types/email.py
@@ -1,7 +1,4 @@
-from typing import Optional
from pydantic import BaseModel, Field
-from app.types.gravatar import Gravatar
class Email(BaseModel):
- email: str = Field(..., description="Email address")
- gravatar: Optional[Gravatar] = Field(None, description="Gravatar")
+ email: str = Field(..., description="Email address", title="Email Address")
\ No newline at end of file
diff --git a/flowsint-api/app/types/gravatar.py b/flowsint-api/app/types/gravatar.py
index caa4ba5a..87e61526 100644
--- a/flowsint-api/app/types/gravatar.py
+++ b/flowsint-api/app/types/gravatar.py
@@ -2,16 +2,16 @@ from pydantic import BaseModel, Field, HttpUrl
from typing import Optional, List
class Gravatar(BaseModel):
- src: HttpUrl = Field(..., description="Gravatar image URL")
- hash: str = Field(..., description="Gravatar hash")
- size: Optional[int] = Field(None, description="Image size in pixels")
- rating: Optional[str] = Field(None, description="Content rating (g, pg, r, x)")
- default_image: Optional[str] = Field(None, description="Default image type when no gravatar exists")
- force_default: Optional[bool] = Field(None, description="Whether to force default image")
- exists: Optional[bool] = Field(None, description="Whether the gravatar exists")
- profile_url: Optional[HttpUrl] = Field(None, description="URL to the Gravatar profile page")
- display_name: Optional[str] = Field(None, description="Display name from Gravatar profile")
- location: Optional[str] = Field(None, description="Location from Gravatar profile")
- about_me: Optional[str] = Field(None, description="Bio/about me text from Gravatar profile")
- thumbnail_url: Optional[HttpUrl] = Field(None, description="Smaller version of the image")
- large_url: Optional[HttpUrl] = Field(None, description="Larger version of the image")
+ src: HttpUrl = Field(..., description="Gravatar image URL", title="Image URL")
+ hash: str = Field(..., description="Gravatar hash", title="Hash")
+ size: Optional[int] = Field(None, description="Image size in pixels", title="Image Size")
+ rating: Optional[str] = Field(None, description="Content rating (g, pg, r, x)", title="Content Rating")
+ default_image: Optional[str] = Field(None, description="Default image type when no gravatar exists", title="Default Image")
+ force_default: Optional[bool] = Field(None, description="Whether to force default image", title="Force Default")
+ exists: Optional[bool] = Field(None, description="Whether the gravatar exists", title="Exists")
+ profile_url: Optional[HttpUrl] = Field(None, description="URL to the Gravatar profile page", title="Profile URL")
+ display_name: Optional[str] = Field(None, description="Display name from Gravatar profile", title="Display Name")
+ location: Optional[str] = Field(None, description="Location from Gravatar profile", title="Location")
+ about_me: Optional[str] = Field(None, description="Bio/about me text from Gravatar profile", title="About Me")
+ thumbnail_url: Optional[HttpUrl] = Field(None, description="Smaller version of the image", title="Thumbnail URL")
+ large_url: Optional[HttpUrl] = Field(None, description="Larger version of the image", title="Large Image URL")
diff --git a/flowsint-api/app/types/individual.py b/flowsint-api/app/types/individual.py
index bc030d50..18adb2c4 100644
--- a/flowsint-api/app/types/individual.py
+++ b/flowsint-api/app/types/individual.py
@@ -1,9 +1,9 @@
from pydantic import BaseModel, Field
-from typing import Optional
+from typing import Optional, Literal
class Individual(BaseModel):
- first_name: str = Field(..., description="First name of the individual")
- last_name: str = Field(..., description="Last name of the individual")
- full_name: str = Field(..., description="Full name of the individual")
- birth_date: Optional[str] = Field(None, description="Date of birth")
- gender: Optional[str] = Field(None, description="Gender of the individual")
\ No newline at end of file
+ first_name: str = Field(..., description="First name of the individual", title="First Name")
+ last_name: str = Field(..., description="Last name of the individual", title="Last Name")
+ full_name: str = Field(..., description="Full name of the individual", title="Full Name")
+ birth_date: Optional[str] = Field(None, description="Date of birth", title="Date of Birth")
+ gender: Optional[Literal["male", "female", "other"]] = Field(None, description="Gender of the individual", title="Gender")
\ No newline at end of file
diff --git a/flowsint-api/app/types/ip.py b/flowsint-api/app/types/ip.py
index 5a91f004..ac32423b 100644
--- a/flowsint-api/app/types/ip.py
+++ b/flowsint-api/app/types/ip.py
@@ -2,9 +2,9 @@ from pydantic import BaseModel, Field
from typing import Optional
class Ip(BaseModel):
- address: str = Field(..., description="IP address")
- latitude: Optional[float] = Field(None, description="Latitude coordinate of the IP location")
- longitude: Optional[float] = Field(None, description="Longitude coordinate of the IP location")
- country: Optional[str] = Field(None, description="Country where the IP is located")
- city: Optional[str] = Field(None, description="City where the IP is located")
- isp: Optional[str] = Field(None, description="Internet Service Provider")
+ address: str = Field(..., description="IP address", title="IP Address")
+ latitude: Optional[float] = Field(None, description="Latitude coordinate of the IP location", title="Latitude")
+ longitude: Optional[float] = Field(None, description="Longitude coordinate of the IP location", title="Longitude")
+ country: Optional[str] = Field(None, description="Country where the IP is located", title="Country")
+ city: Optional[str] = Field(None, description="City where the IP is located", title="City")
+ isp: Optional[str] = Field(None, description="Internet Service Provider", title="ISP")
diff --git a/flowsint-api/app/types/leak.py b/flowsint-api/app/types/leak.py
index d7c9d1da..d6c40b52 100644
--- a/flowsint-api/app/types/leak.py
+++ b/flowsint-api/app/types/leak.py
@@ -2,5 +2,5 @@ from typing import List, Dict, Optional
from pydantic import BaseModel, Field
class Leak(BaseModel):
- name: str = Field(..., description= "The name of the leak or service brea")
- leak: Optional[List[Dict]] = Field(None, description="List of data leaks found")
+ name: str = Field(..., description= "The name of the leak or service brea", title="Leak Name")
+ leak: Optional[List[Dict]] = Field(None, description="List of data leaks found", title="Leak Data")
diff --git a/flowsint-api/app/types/organization.py b/flowsint-api/app/types/organization.py
index dab1ae09..19cf03cf 100644
--- a/flowsint-api/app/types/organization.py
+++ b/flowsint-api/app/types/organization.py
@@ -5,110 +5,110 @@ from .address import PhysicalAddress
class Organization(BaseModel):
# Basic information
- name: str = Field(..., description="Organization name")
- siren: Optional[str] = Field(None, description="SIREN number")
- nom_complet: Optional[str] = Field(None, description="Complete name")
- nom_raison_sociale: Optional[str] = Field(None, description="Company name")
- sigle: Optional[str] = Field(None, description="Acronym")
+ name: str = Field(..., description="Organization name", title="Organization Name")
+ siren: Optional[str] = Field(None, description="SIREN number", title="SIREN Number")
+ nom_complet: Optional[str] = Field(None, description="Complete name", title="Complete Name")
+ nom_raison_sociale: Optional[str] = Field(None, description="Company name", title="Company Name")
+ sigle: Optional[str] = Field(None, description="Acronym", title="Acronym")
# Establishment information
- nombre_etablissements: Optional[int] = Field(None, description="Number of establishments")
- nombre_etablissements_ouverts: Optional[int] = Field(None, description="Number of open establishments")
+ nombre_etablissements: Optional[int] = Field(None, description="Number of establishments", title="Number of Establishments")
+ nombre_etablissements_ouverts: Optional[int] = Field(None, description="Number of open establishments", title="Number of Open Establishments")
# Activity information
- activite_principale: Optional[str] = Field(None, description="Main activity code")
- section_activite_principale: Optional[str] = Field(None, description="Main activity section")
+ activite_principale: Optional[str] = Field(None, description="Main activity code", title="Main Activity Code")
+ section_activite_principale: Optional[str] = Field(None, description="Main activity section", title="Main Activity Section")
# Company category
- categorie_entreprise: Optional[str] = Field(None, description="Company category")
- annee_categorie_entreprise: Optional[str] = Field(None, description="Year of company category")
+ categorie_entreprise: Optional[str] = Field(None, description="Company category", title="Company Category")
+ annee_categorie_entreprise: Optional[str] = Field(None, description="Year of company category", title="Company Category Year")
# Employment information
- caractere_employeur: Optional[str] = Field(None, description="Employer character")
- tranche_effectif_salarie: Optional[str] = Field(None, description="Employee size range")
- annee_tranche_effectif_salarie: Optional[str] = Field(None, description="Year of employee size range")
+ caractere_employeur: Optional[str] = Field(None, description="Employer character", title="Employer Character")
+ tranche_effectif_salarie: Optional[str] = Field(None, description="Employee size range", title="Employee Size Range")
+ annee_tranche_effectif_salarie: Optional[str] = Field(None, description="Year of employee size range", title="Employee Size Range Year")
# Dates
- date_creation: Optional[str] = Field(None, description="Creation date")
- date_fermeture: Optional[str] = Field(None, description="Closing date")
- date_mise_a_jour: Optional[str] = Field(None, description="Update date")
- date_mise_a_jour_insee: Optional[str] = Field(None, description="INSEE update date")
- date_mise_a_jour_rne: Optional[str] = Field(None, description="RNE update date")
+ date_creation: Optional[str] = Field(None, description="Creation date", title="Creation Date")
+ date_fermeture: Optional[str] = Field(None, description="Closing date", title="Closing Date")
+ date_mise_a_jour: Optional[str] = Field(None, description="Update date", title="Update Date")
+ date_mise_a_jour_insee: Optional[str] = Field(None, description="INSEE update date", title="INSEE Update Date")
+ date_mise_a_jour_rne: Optional[str] = Field(None, description="RNE update date", title="RNE Update Date")
# Legal information
- nature_juridique: Optional[str] = Field(None, description="Legal nature")
- etat_administratif: Optional[str] = Field(None, description="Administrative status")
- statut_diffusion: Optional[str] = Field(None, description="Diffusion status")
+ nature_juridique: Optional[str] = Field(None, description="Legal nature", title="Legal Nature")
+ etat_administratif: Optional[str] = Field(None, description="Administrative status", title="Administrative Status")
+ statut_diffusion: Optional[str] = Field(None, description="Diffusion status", title="Diffusion Status")
# Siege (Headquarters) information
- siege_activite_principale: Optional[str] = Field(None, description="Siege main activity code")
- siege_activite_principale_registre_metier: Optional[str] = Field(None, description="Siege main activity in trade register")
- siege_annee_tranche_effectif_salarie: Optional[str] = Field(None, description="Siege year of employee size range")
- siege_adresse: Optional[str] = Field(None, description="Siege address")
- siege_caractere_employeur: Optional[str] = Field(None, description="Siege employer character")
- siege_cedex: Optional[str] = Field(None, description="Siege CEDEX code")
- siege_code_pays_etranger: Optional[str] = Field(None, description="Siege foreign country code")
- siege_code_postal: Optional[str] = Field(None, description="Siege postal code")
- siege_commune: Optional[str] = Field(None, description="Siege municipality code")
- siege_complement_adresse: Optional[str] = Field(None, description="Siege address complement")
- siege_coordonnees: Optional[str] = Field(None, description="Siege coordinates")
- siege_date_creation: Optional[str] = Field(None, description="Siege creation date")
- siege_date_debut_activite: Optional[str] = Field(None, description="Siege activity start date")
- siege_date_fermeture: Optional[str] = Field(None, description="Siege closing date")
- siege_date_mise_a_jour: Optional[str] = Field(None, description="Siege update date")
- siege_date_mise_a_jour_insee: Optional[str] = Field(None, description="Siege INSEE update date")
- siege_departement: Optional[str] = Field(None, description="Siege department code")
- siege_distribution_speciale: Optional[str] = Field(None, description="Siege special distribution")
- siege_epci: Optional[str] = Field(None, description="Siege EPCI code")
- siege_est_siege: Optional[bool] = Field(None, description="Siege is headquarters")
- siege_etat_administratif: Optional[str] = Field(None, description="Siege administrative status")
- siege_geo_adresse: Optional[PhysicalAddress] = Field(None, description="Siege geocoded address")
- siege_geo_id: Optional[str] = Field(None, description="Siege geographic ID")
- siege_indice_repetition: Optional[str] = Field(None, description="Siege repetition index")
- siege_latitude: Optional[str] = Field(None, description="Siege latitude")
- siege_libelle_cedex: Optional[str] = Field(None, description="Siege CEDEX label")
- siege_libelle_commune: Optional[str] = Field(None, description="Siege municipality label")
- siege_libelle_commune_etranger: Optional[str] = Field(None, description="Siege foreign municipality label")
- siege_libelle_pays_etranger: Optional[str] = Field(None, description="Siege foreign country label")
- siege_libelle_voie: Optional[str] = Field(None, description="Siege street label")
- siege_liste_enseignes: Optional[List[str]] = Field(None, description="Siege list of brands")
- siege_liste_finess: Optional[List[str]] = Field(None, description="Siege list of FINESS")
- siege_liste_id_bio: Optional[List[str]] = Field(None, description="Siege list of bio IDs")
- siege_liste_idcc: Optional[List[str]] = Field(None, description="Siege list of IDCC")
- siege_liste_id_organisme_formation: Optional[List[str]] = Field(None, description="Siege list of training organization IDs")
- siege_liste_rge: Optional[List[str]] = Field(None, description="Siege list of RGE")
- siege_liste_uai: Optional[List[str]] = Field(None, description="Siege list of UAI")
- siege_longitude: Optional[str] = Field(None, description="Siege longitude")
- siege_nom_commercial: Optional[str] = Field(None, description="Siege commercial name")
- siege_numero_voie: Optional[str] = Field(None, description="Siege street number")
- siege_region: Optional[str] = Field(None, description="Siege region code")
- siege_siret: Optional[str] = Field(None, description="Siege SIRET number")
- siege_statut_diffusion_etablissement: Optional[str] = Field(None, description="Siege establishment diffusion status")
- siege_tranche_effectif_salarie: Optional[str] = Field(None, description="Siege employee size range")
- siege_type_voie: Optional[str] = Field(None, description="Siege street type")
+ siege_activite_principale: Optional[str] = Field(None, description="Siege main activity code", title="Headquarters Main Activity")
+ siege_activite_principale_registre_metier: Optional[str] = Field(None, description="Siege main activity in trade register", title="Headquarters Trade Register Activity")
+ siege_annee_tranche_effectif_salarie: Optional[str] = Field(None, description="Siege year of employee size range", title="Headquarters Employee Size Year")
+ siege_adresse: Optional[str] = Field(None, description="Siege address", title="Headquarters Address")
+ siege_caractere_employeur: Optional[str] = Field(None, description="Siege employer character", title="Headquarters Employer Character")
+ siege_cedex: Optional[str] = Field(None, description="Siege CEDEX code", title="Headquarters CEDEX")
+ siege_code_pays_etranger: Optional[str] = Field(None, description="Siege foreign country code", title="Headquarters Foreign Country Code")
+ siege_code_postal: Optional[str] = Field(None, description="Siege postal code", title="Headquarters Postal Code")
+ siege_commune: Optional[str] = Field(None, description="Siege municipality code", title="Headquarters Municipality Code")
+ siege_complement_adresse: Optional[str] = Field(None, description="Siege address complement", title="Headquarters Address Complement")
+ siege_coordonnees: Optional[str] = Field(None, description="Siege coordinates", title="Headquarters Coordinates")
+ siege_date_creation: Optional[str] = Field(None, description="Siege creation date", title="Headquarters Creation Date")
+ siege_date_debut_activite: Optional[str] = Field(None, description="Siege activity start date", title="Headquarters Activity Start Date")
+ siege_date_fermeture: Optional[str] = Field(None, description="Siege closing date", title="Headquarters Closing Date")
+ siege_date_mise_a_jour: Optional[str] = Field(None, description="Siege update date", title="Headquarters Update Date")
+ siege_date_mise_a_jour_insee: Optional[str] = Field(None, description="Siege INSEE update date", title="Headquarters INSEE Update Date")
+ siege_departement: Optional[str] = Field(None, description="Siege department code", title="Headquarters Department")
+ siege_distribution_speciale: Optional[str] = Field(None, description="Siege special distribution", title="Headquarters Special Distribution")
+ siege_epci: Optional[str] = Field(None, description="Siege EPCI code", title="Headquarters EPCI Code")
+ siege_est_siege: Optional[bool] = Field(None, description="Siege is headquarters", title="Is Headquarters")
+ siege_etat_administratif: Optional[str] = Field(None, description="Siege administrative status", title="Headquarters Administrative Status")
+ siege_geo_adresse: Optional[PhysicalAddress] = Field(None, description="Siege geocoded address", title="Headquarters Geocoded Address")
+ siege_geo_id: Optional[str] = Field(None, description="Siege geographic ID", title="Headquarters Geographic ID")
+ siege_indice_repetition: Optional[str] = Field(None, description="Siege repetition index", title="Headquarters Repetition Index")
+ siege_latitude: Optional[str] = Field(None, description="Siege latitude", title="Headquarters Latitude")
+ siege_libelle_cedex: Optional[str] = Field(None, description="Siege CEDEX label", title="Headquarters CEDEX Label")
+ siege_libelle_commune: Optional[str] = Field(None, description="Siege municipality label", title="Headquarters Municipality Label")
+ siege_libelle_commune_etranger: Optional[str] = Field(None, description="Siege foreign municipality label", title="Headquarters Foreign Municipality Label")
+ siege_libelle_pays_etranger: Optional[str] = Field(None, description="Siege foreign country label", title="Headquarters Foreign Country Label")
+ siege_libelle_voie: Optional[str] = Field(None, description="Siege street label", title="Headquarters Street Label")
+ siege_liste_enseignes: Optional[List[str]] = Field(None, description="Siege list of brands", title="Headquarters Brands List")
+ siege_liste_finess: Optional[List[str]] = Field(None, description="Siege list of FINESS", title="Headquarters FINESS List")
+ siege_liste_id_bio: Optional[List[str]] = Field(None, description="Siege list of bio IDs", title="Headquarters Bio IDs List")
+ siege_liste_idcc: Optional[List[str]] = Field(None, description="Siege list of IDCC", title="Headquarters IDCC List")
+ siege_liste_id_organisme_formation: Optional[List[str]] = Field(None, description="Siege list of training organization IDs", title="Headquarters Training Organization IDs")
+ siege_liste_rge: Optional[List[str]] = Field(None, description="Siege list of RGE", title="Headquarters RGE List")
+ siege_liste_uai: Optional[List[str]] = Field(None, description="Siege list of UAI", title="Headquarters UAI List")
+ siege_longitude: Optional[str] = Field(None, description="Siege longitude", title="Headquarters Longitude")
+ siege_nom_commercial: Optional[str] = Field(None, description="Siege commercial name", title="Headquarters Commercial Name")
+ siege_numero_voie: Optional[str] = Field(None, description="Siege street number", title="Headquarters Street Number")
+ siege_region: Optional[str] = Field(None, description="Siege region code", title="Headquarters Region")
+ siege_siret: Optional[str] = Field(None, description="Siege SIRET number", title="Headquarters SIRET")
+ siege_statut_diffusion_etablissement: Optional[str] = Field(None, description="Siege establishment diffusion status", title="Headquarters Establishment Diffusion Status")
+ siege_tranche_effectif_salarie: Optional[str] = Field(None, description="Siege employee size range", title="Headquarters Employee Size Range")
+ siege_type_voie: Optional[str] = Field(None, description="Siege street type", title="Headquarters Street Type")
# Dirigeants (Leaders) - using Individual type
- dirigeants: Optional[List[Individual]] = Field(None, description="List of leaders")
+ dirigeants: Optional[List[Individual]] = Field(None, description="List of leaders", title="Leaders")
# Matching establishments
- matching_etablissements: Optional[List[dict]] = Field(None, description="Matching establishments")
+ matching_etablissements: Optional[List[dict]] = Field(None, description="Matching establishments", title="Matching Establishments")
# Financial information
- finances: Optional[dict] = Field(None, description="Financial information")
+ finances: Optional[dict] = Field(None, description="Financial information", title="Financial Information")
# Complements (Additional information)
- complements_collectivite_territoriale: Optional[str] = Field(None, description="Complements territorial community")
- complements_convention_collective_renseignee: Optional[bool] = Field(None, description="Complements collective agreement informed")
- complements_liste_idcc: Optional[List[str]] = Field(None, description="Complements list of IDCC")
- complements_egapro_renseignee: Optional[bool] = Field(None, description="Complements Egapro informed")
- complements_est_achats_responsables: Optional[bool] = Field(None, description="Complements is responsible purchases")
- complements_est_alim_confiance: Optional[bool] = Field(None, description="Complements is food trust")
- complements_est_association: Optional[bool] = Field(None, description="Complements is association")
- complements_est_bio: Optional[bool] = Field(None, description="Complements is bio")
- complements_est_entrepreneur_individuel: Optional[bool] = Field(None, description="Complements is individual entrepreneur")
- complements_est_entrepreneur_spectacle: Optional[bool] = Field(None, description="Complements is show entrepreneur")
- complements_est_ess: Optional[bool] = Field(None, description="Complements is ESS")
- complements_est_finess: Optional[bool] = Field(None, description="Complements is FINESS")
- complements_est_organisme_formation: Optional[bool] = Field(None, description="Complements is training organization")
- complements_est_qualiopi: Optional[bool] = Field(None, description="Complements is Qualiopi")
- complements_liste_id_organisme_formation: Optional[List[str]] = Field(None, description="Complements list of training organization IDs")
- complements_est_rge: Optional[bool] = Field(None, description="Complements is RGE")
- complements_est_service_public: Optional[bool] = Field(None, description="Complements is public service")
- complements_est_l100_3: Optional[bool] = Field(None, description="Complements is L100-3")
- complements_est_siae: Optional[bool] = Field(None, description="Complements is SIAE")
- complements_est_societe_mission: Optional[bool] = Field(None, description="Complements is mission company")
- complements_est_uai: Optional[bool] = Field(None, description="Complements is UAI")
- complements_est_patrimoine_vivant: Optional[bool] = Field(None, description="Complements is living heritage")
- complements_bilan_ges_renseigne: Optional[bool] = Field(None, description="Complements GES balance informed")
- complements_identifiant_association: Optional[str] = Field(None, description="Complements association identifier")
- complements_statut_entrepreneur_spectacle: Optional[str] = Field(None, description="Complements show entrepreneur status")
- complements_type_siae: Optional[str] = Field(None, description="Complements SIAE type")
\ No newline at end of file
+ complements_collectivite_territoriale: Optional[str] = Field(None, description="Complements territorial community", title="Territorial Community")
+ complements_convention_collective_renseignee: Optional[bool] = Field(None, description="Complements collective agreement informed", title="Collective Agreement Informed")
+ complements_liste_idcc: Optional[List[str]] = Field(None, description="Complements list of IDCC", title="IDCC List")
+ complements_egapro_renseignee: Optional[bool] = Field(None, description="Complements Egapro informed", title="Egapro Informed")
+ complements_est_achats_responsables: Optional[bool] = Field(None, description="Complements is responsible purchases", title="Is Responsible Purchases")
+ complements_est_alim_confiance: Optional[bool] = Field(None, description="Complements is food trust", title="Is Food Trust")
+ complements_est_association: Optional[bool] = Field(None, description="Complements is association", title="Is Association")
+ complements_est_bio: Optional[bool] = Field(None, description="Complements is bio", title="Is Bio")
+ complements_est_entrepreneur_individuel: Optional[bool] = Field(None, description="Complements is individual entrepreneur", title="Is Individual Entrepreneur")
+ complements_est_entrepreneur_spectacle: Optional[bool] = Field(None, description="Complements is show entrepreneur", title="Is Show Entrepreneur")
+ complements_est_ess: Optional[bool] = Field(None, description="Complements is ESS", title="Is ESS")
+ complements_est_finess: Optional[bool] = Field(None, description="Complements is FINESS", title="Is FINESS")
+ complements_est_organisme_formation: Optional[bool] = Field(None, description="Complements is training organization", title="Is Training Organization")
+ complements_est_qualiopi: Optional[bool] = Field(None, description="Complements is Qualiopi", title="Is Qualiopi")
+ complements_liste_id_organisme_formation: Optional[List[str]] = Field(None, description="Complements list of training organization IDs", title="Training Organization IDs")
+ complements_est_rge: Optional[bool] = Field(None, description="Complements is RGE", title="Is RGE")
+ complements_est_service_public: Optional[bool] = Field(None, description="Complements is public service", title="Is Public Service")
+ complements_est_l100_3: Optional[bool] = Field(None, description="Complements is L100-3", title="Is L100-3")
+ complements_est_siae: Optional[bool] = Field(None, description="Complements is SIAE", title="Is SIAE")
+ complements_est_societe_mission: Optional[bool] = Field(None, description="Complements is mission company", title="Is Mission Company")
+ complements_est_uai: Optional[bool] = Field(None, description="Complements is UAI", title="Is UAI")
+ complements_est_patrimoine_vivant: Optional[bool] = Field(None, description="Complements is living heritage", title="Is Living Heritage")
+ complements_bilan_ges_renseigne: Optional[bool] = Field(None, description="Complements GES balance informed", title="GES Balance Informed")
+ complements_identifiant_association: Optional[str] = Field(None, description="Complements association identifier", title="Association Identifier")
+ complements_statut_entrepreneur_spectacle: Optional[str] = Field(None, description="Complements show entrepreneur status", title="Show Entrepreneur Status")
+ complements_type_siae: Optional[str] = Field(None, description="Complements SIAE type", title="SIAE Type")
\ No newline at end of file
diff --git a/flowsint-api/app/types/phone.py b/flowsint-api/app/types/phone.py
index f03df887..7086b342 100644
--- a/flowsint-api/app/types/phone.py
+++ b/flowsint-api/app/types/phone.py
@@ -2,6 +2,6 @@ from pydantic import BaseModel, Field
from typing import Optional
class Phone(BaseModel):
- number: str = Field(..., description="Phone number")
- country: Optional[str] = Field(None, description="Country code (ISO 3166-1 alpha-2)")
- carrier: Optional[str] = Field(None, description="Mobile carrier or service provider")
\ No newline at end of file
+ number: str = Field(..., description="Phone number", title="Phone Number")
+ country: Optional[str] = Field(None, description="Country code (ISO 3166-1 alpha-2)", title="Country Code")
+ carrier: Optional[str] = Field(None, description="Mobile carrier or service provider", title="Carrier")
\ No newline at end of file
diff --git a/flowsint-api/app/types/social.py b/flowsint-api/app/types/social.py
index 5b188d3b..27621c75 100644
--- a/flowsint-api/app/types/social.py
+++ b/flowsint-api/app/types/social.py
@@ -2,12 +2,12 @@ from pydantic import BaseModel, Field
from typing import Optional
class SocialProfile(BaseModel):
- username: Optional[str] = Field(None, description="Username on the social platform")
- profile_url: Optional[str] = Field(None, description="URL to the user's profile page")
- platform: Optional[str] = Field(None, description="Name of the social media platform")
- profile_picture_url: Optional[str] = Field(None, description="URL to the user's profile picture")
- bio: Optional[str] = Field(None, description="User's biography or description")
- followers_count: Optional[int] = Field(None, description="Number of followers")
- following_count: Optional[int] = Field(None, description="Number of users being followed")
- posts_count: Optional[int] = Field(None, description="Number of posts made by the user")
+ username: str = Field(..., description="Username on the social platform", title="Username")
+ profile_url: Optional[str] = Field(None, description="URL to the user's profile page", title="Profile URL")
+ platform: Optional[str] = Field(None, description="Name of the social media platform", title="Platform")
+ profile_picture_url: Optional[str] = Field(None, description="URL to the user's profile picture", title="Profile Picture")
+ bio: Optional[str] = Field(None, description="User's biography or description", title="Bio")
+ followers_count: Optional[int] = Field(None, description="Number of followers", title="Followers Count")
+ following_count: Optional[int] = Field(None, description="Number of users being followed", title="Following Count")
+ posts_count: Optional[int] = Field(None, description="Number of posts made by the user", title="Posts Count")
\ No newline at end of file
diff --git a/flowsint-api/app/types/transform.py b/flowsint-api/app/types/transform.py
index 8d206170..11a9a92b 100644
--- a/flowsint-api/app/types/transform.py
+++ b/flowsint-api/app/types/transform.py
@@ -2,29 +2,29 @@ from pydantic import BaseModel, Field
from typing import Dict, List, Any, Optional, Literal
class Node(BaseModel):
- id: str = Field(..., description="Unique identifier for the node")
- data: Dict[str, Any] = Field(..., description="Data payload associated with the node")
- position: Optional[Dict[str, float]] = Field(None, description="X and Y coordinates for node positioning")
- type: Optional[str] = Field(None, description="Type of node (e.g., input, output, process)")
+ id: str = Field(..., description="Unique identifier for the node", title="Node ID")
+ data: Dict[str, Any] = Field(..., description="Data payload associated with the node", title="Node Data")
+ position: Optional[Dict[str, float]] = Field(None, description="X and Y coordinates for node positioning", title="Position")
+ type: Optional[str] = Field(None, description="Type of node (e.g., input, output, process)", title="Node Type")
class Edge(BaseModel):
- id: str = Field(..., description="Unique identifier for the edge")
- data: Optional[Dict[str, Any]] = Field(None, description="Data payload associated with the edge")
- source: str = Field(..., description="ID of the source node")
- target: str = Field(..., description="ID of the target node")
- sourceHandle: Optional[str] = Field(None, description="Handle ID on the source node")
- targetHandle: Optional[str] = Field(None, description="Handle ID on the target node")
+ id: str = Field(..., description="Unique identifier for the edge", title="Edge ID")
+ data: Optional[Dict[str, Any]] = Field(None, description="Data payload associated with the edge", title="Edge Data")
+ source: str = Field(..., description="ID of the source node", title="Source Node")
+ target: str = Field(..., description="ID of the target node", title="Target Node")
+ sourceHandle: Optional[str] = Field(None, description="Handle ID on the source node", title="Source Handle")
+ targetHandle: Optional[str] = Field(None, description="Handle ID on the target node", title="Target Handle")
class FlowStep(BaseModel):
- nodeId: str = Field(..., description="ID of the associated node")
- type: Literal["type", "scanner"] = Field(..., description="Type of step - either type transformation or scanner")
- inputs: Dict[str, Any] = Field(..., description="Input data for this step")
- outputs: Dict[str, Any] = Field(..., description="Output data from this step")
- status: Literal["pending", "processing", "completed", "error"] = Field(..., description="Current execution status of the step")
- branchId: str = Field(..., description="ID of the branch this step belongs to")
- depth: int = Field(..., description="Depth level of this step in the flow")
+ nodeId: str = Field(..., description="ID of the associated node", title="Node ID")
+ type: Literal["type", "scanner"] = Field(..., description="Type of step - either type transformation or scanner", title="Step Type")
+ inputs: Dict[str, Any] = Field(..., description="Input data for this step", title="Inputs")
+ outputs: Dict[str, Any] = Field(..., description="Output data from this step", title="Outputs")
+ status: Literal["pending", "processing", "completed", "error"] = Field(..., description="Current execution status of the step", title="Status")
+ branchId: str = Field(..., description="ID of the branch this step belongs to", title="Branch ID")
+ depth: int = Field(..., description="Depth level of this step in the flow", title="Depth")
class FlowBranch(BaseModel):
- id: str = Field(..., description="Unique identifier for the branch")
- name: str = Field(..., description="Human-readable name of the branch")
- steps: List[FlowStep] = Field(..., description="List of steps in this branch")
\ No newline at end of file
+ id: str = Field(..., description="Unique identifier for the branch", title="Branch ID")
+ name: str = Field(..., description="Human-readable name of the branch", title="Branch Name")
+ steps: List[FlowStep] = Field(..., description="List of steps in this branch", title="Steps")
\ No newline at end of file
diff --git a/flowsint-api/app/types/wallet.py b/flowsint-api/app/types/wallet.py
index a2467589..09f1f3fc 100644
--- a/flowsint-api/app/types/wallet.py
+++ b/flowsint-api/app/types/wallet.py
@@ -3,52 +3,52 @@ from pydantic import BaseModel, Field, HttpUrl
class CryptoWallet(BaseModel):
"""Represents a cryptocurrency wallet."""
- address: str = Field(..., description="Wallet address")
- node_id: Optional[str] = Field(None, description="Wallet Explorer node ID")
+ address: str = Field(..., description="Wallet address", title="Wallet Address")
+ node_id: Optional[str] = Field(None, description="Wallet Explorer node ID", title="Node ID")
class CryptoWalletTransaction(BaseModel):
"""Represents a cryptocurrency transaction."""
- source: CryptoWallet = Field(..., description="Source wallet")
- target: Optional[CryptoWallet] = Field(None, description="Target wallet")
- hash: Optional[str] = Field(None, description="Transaction hash")
- value: Optional[float] = Field(None, description="Transaction value in cryptocurrency")
- amount: Optional[float] = Field(None, description="Transaction amount in cryptocurrency")
- amount_usd: Optional[float] = Field(None, description="Transaction amount in USD")
- date: Optional[str] = Field(None, description="Transaction date")
- hop: Optional[int] = Field(None, description="Hop distance from original wallet")
- timestamp: Optional[str] = Field(None, alias="timeStamp", description="Transaction timestamp (unix epoch)")
- block_number: Optional[int] = Field(None, alias="blockNumber", description="Block number")
- block_hash: Optional[str] = Field(None, alias="blockHash", description="Block hash")
- nonce: Optional[int] = Field(None, description="Transaction nonce")
- transaction_index: Optional[int] = Field(None, alias="transactionIndex", description="Transaction index in block")
- gas: Optional[int] = Field(None, description="Gas provided")
- gas_price: Optional[int] = Field(None, alias="gasPrice", description="Gas price in wei")
- gas_used: Optional[int] = Field(None, alias="gasUsed", description="Gas used")
- cumulative_gas_used: Optional[int] = Field(None, alias="cumulativeGasUsed", description="Cumulative gas used")
- input: Optional[str] = Field(None, description="Input data")
- contract_address: Optional[str] = Field(None, alias="contractAddress", description="Contract address")
- method_id: Optional[str] = Field(None, alias="methodId", description="Method ID")
- function_name: Optional[str] = Field(None, alias="functionName", description="Function name")
- confirmations: Optional[int] = Field(None, description="Number of confirmations")
- is_error: Optional[bool] = Field(None, alias="isError", description="Whether the transaction resulted in an error")
- txreceipt_status: Optional[str] = Field(None, alias="txreceipt_status", description="Transaction receipt status")
- error_message: Optional[str] = Field(None, description="Error message if transaction failed")
+ source: CryptoWallet = Field(..., description="Source wallet", title="Source Wallet")
+ target: Optional[CryptoWallet] = Field(None, description="Target wallet", title="Target Wallet")
+ hash: Optional[str] = Field(None, description="Transaction hash", title="Transaction Hash")
+ value: Optional[float] = Field(None, description="Transaction value in cryptocurrency", title="Value")
+ amount: Optional[float] = Field(None, description="Transaction amount in cryptocurrency", title="Amount")
+ amount_usd: Optional[float] = Field(None, description="Transaction amount in USD", title="Amount USD")
+ date: Optional[str] = Field(None, description="Transaction date", title="Date")
+ hop: Optional[int] = Field(None, description="Hop distance from original wallet", title="Hop Distance")
+ timestamp: Optional[str] = Field(None, description="Transaction timestamp (unix epoch)", title="Timestamp")
+ block_number: Optional[int] = Field(None, description="Block number", title="Block Number")
+ block_hash: Optional[str] = Field(None, description="Block hash", title="Block Hash")
+ nonce: Optional[int] = Field(None, description="Transaction nonce", title="Nonce")
+ transaction_index: Optional[int] = Field(None, description="Transaction index in block", title="Transaction Index")
+ gas: Optional[int] = Field(None, description="Gas provided", title="Gas")
+ gas_price: Optional[int] = Field(None, description="Gas price in wei", title="Gas Price")
+ gas_used: Optional[int] = Field(None, description="Gas used", title="Gas Used")
+ cumulative_gas_used: Optional[int] = Field(None, description="Cumulative gas used", title="Cumulative Gas Used")
+ input: Optional[str] = Field(None, description="Input data", title="Input Data")
+ contract_address: Optional[str] = Field(None, description="Contract address", title="Contract Address")
+ method_id: Optional[str] = Field(None, description="Method ID", title="Method ID")
+ function_name: Optional[str] = Field(None, description="Function name", title="Function Name")
+ confirmations: Optional[int] = Field(None, description="Number of confirmations", title="Confirmations")
+ is_error: Optional[bool] = Field(None, description="Whether the transaction resulted in an error", title="Is Error")
+ txreceipt_status: Optional[str] = Field(None, description="Transaction receipt status", title="Transaction Receipt Status")
+ error_message: Optional[str] = Field(None, description="Error message if transaction failed", title="Error Message")
class CryptoNFT(BaseModel):
"""Represents a Non-Fungible Token (NFT) held or minted by a wallet."""
- wallet: CryptoWallet = Field(..., description="Source wallet")
- contract_address: str = Field(..., description="Address of the NFT smart contract (ERC-721/1155)")
- token_id: str = Field(..., description="Unique token ID of the NFT within the contract")
- collection_name: Optional[str] = Field(None, description="Name of the NFT collection")
- metadata_url: Optional[HttpUrl] = Field(None, description="URL to the metadata JSON or IPFS resource")
- image_url: Optional[HttpUrl] = Field(None, description="URL to the image or media representing the NFT")
- name: Optional[str] = Field(None, description="Name or title of the NFT")
- description: Optional[str] = Field(None, description="Text description of the NFT")
- owner_address: Optional[str] = Field(None, description="Current owner of the NFT")
- creator_address: Optional[str] = Field(None, description="Original minter or creator address")
- last_transfer_date: Optional[str] = Field(None, description="Date of last transfer or update (ISO format)")
- node_id: Optional[str] = Field(None, description="NFT node ID in the Explorer graph")
+ wallet: CryptoWallet = Field(..., description="Source wallet", title="Wallet")
+ contract_address: str = Field(..., description="Address of the NFT smart contract (ERC-721/1155)", title="Contract Address")
+ token_id: str = Field(..., description="Unique token ID of the NFT within the contract", title="Token ID")
+ collection_name: Optional[str] = Field(None, description="Name of the NFT collection", title="Collection Name")
+ metadata_url: Optional[HttpUrl] = Field(None, description="URL to the metadata JSON or IPFS resource", title="Metadata URL")
+ image_url: Optional[HttpUrl] = Field(None, description="URL to the image or media representing the NFT", title="Image URL")
+ name: Optional[str] = Field(None, description="Name or title of the NFT", title="NFT Name")
+ description: Optional[str] = Field(None, description="Text description of the NFT", title="Description")
+ owner_address: Optional[str] = Field(None, description="Current owner of the NFT", title="Owner Address")
+ creator_address: Optional[str] = Field(None, description="Original minter or creator address", title="Creator Address")
+ last_transfer_date: Optional[str] = Field(None, description="Date of last transfer or update (ISO format)", title="Last Transfer Date")
+ node_id: Optional[str] = Field(None, description="NFT node ID in the Explorer graph", title="Node ID")
@property
def uid(self):
diff --git a/flowsint-api/app/types/website.py b/flowsint-api/app/types/website.py
index 0377e13c..5669975f 100644
--- a/flowsint-api/app/types/website.py
+++ b/flowsint-api/app/types/website.py
@@ -3,7 +3,7 @@ from pydantic import BaseModel, Field, HttpUrl
from app.types.domain import Domain
class Website(BaseModel):
- url: HttpUrl = Field(..., description="Full URL of the website")
- redirects: Optional[List[HttpUrl]] = Field([], description="List of redirects from the website")
- domain: Optional[Domain] = Field(None, description="Domain information for the website")
- active: Optional[bool] = Field(False, description="Whether the website is active")
\ No newline at end of file
+ url: HttpUrl = Field(..., description="Full URL of the website", title="Website URL")
+ redirects: Optional[List[HttpUrl]] = Field([], description="List of redirects from the website", title="Redirects")
+ domain: Optional[Domain] = Field(None, description="Domain information for the website", title="Domain")
+ active: Optional[bool] = Field(False, description="Whether the website is active", title="Is Active")
\ No newline at end of file
diff --git a/flowsint-api/app/types/whois.py b/flowsint-api/app/types/whois.py
index 42cdd15b..142e47f0 100644
--- a/flowsint-api/app/types/whois.py
+++ b/flowsint-api/app/types/whois.py
@@ -3,10 +3,10 @@ from pydantic import BaseModel, Field
from app.types.email import Email
class Whois(BaseModel):
- registrar: Optional[str] = Field(None, description="Domain registrar name")
- org: Optional[str] = Field(None, description="Organization name associated with the domain")
- city: Optional[str] = Field(None, description="City where the domain is registered")
- country: Optional[str] = Field(None, description="Country where the domain is registered")
- email: Optional[Email] = Field(None, description="Contact email for the domain")
- creation_date: Optional[str] = Field(None, description="Date when the domain was created")
- expiration_date: Optional[str] = Field(None, description="Date when the domain expires")
+ registrar: Optional[str] = Field(None, description="Domain registrar name", title="Registrar")
+ org: Optional[str] = Field(None, description="Organization name associated with the domain", title="Organization")
+ city: Optional[str] = Field(None, description="City where the domain is registered", title="City")
+ country: Optional[str] = Field(None, description="Country where the domain is registered", title="Country")
+ email: Optional[Email] = Field(None, description="Contact email for the domain", title="Contact Email")
+ creation_date: Optional[str] = Field(None, description="Date when the domain was created", title="Creation Date")
+ expiration_date: Optional[str] = Field(None, description="Date when the domain expires", title="Expiration Date")
diff --git a/flowsint-api/app/utils.py b/flowsint-api/app/utils.py
index f8073c02..559271e1 100644
--- a/flowsint-api/app/utils.py
+++ b/flowsint-api/app/utils.py
@@ -136,17 +136,17 @@ def resolve_type(details: dict, schema_context: dict = None) -> str:
return "any"
-def extract_input_schema(name: str, model: Type[BaseModel]) -> Dict[str, Any]:
+def extract_input_schema_transform(model: Type[BaseModel]) -> Dict[str, Any]:
adapter = TypeAdapter(model)
schema = adapter.json_schema()
# Use the main schema properties, not the $defs
- type_name = name
+ type_name = model.__name__
details = schema
return {
- "class_name": name,
- "name": name,
+ "class_name": model.__name__,
+ "name": model.__name__,
"module": model.__module__,
"doc": model.__doc__ or "",
"outputs": {
@@ -164,8 +164,7 @@ def extract_input_schema(name: str, model: Type[BaseModel]) -> Dict[str, Any]:
"properties": []
},
"type": "type",
- "category": name,
-
+ "category": model.__name__,
}
diff --git a/flowsint-api/requirements.txt b/flowsint-api/requirements.txt
index df627d31..a9f811f7 100644
--- a/flowsint-api/requirements.txt
+++ b/flowsint-api/requirements.txt
@@ -1,35 +1,32 @@
-fastapi
+fastapi==0.104.1
redis==5.0.1
celery==5.3.6
-redis==5.0.1
-holehe
-dotenv
-uvicorn
-sherlock_project
-python-jose[cryptography]
-python-dotenv
-requests
+holehe==0.1.7
+python-dotenv==1.0.0
+uvicorn==0.24.0
+sherlock-project==1.4.0
+python-jose[cryptography]==3.3.0
+requests==2.31.0
git+https://github.com/soxoj/maigret
-python-whois
-pydig
-ghunt
-ignorant
-hibpwned
-phonenumbers
-pydantic[email]
-fastapi[all]
-neo4j
-faker
-sqlalchemy
-psycopg2-binary
-alembic
-passlib[bcrypt]
-sse-starlette
-networkx
-pydantic_neo4j
-mistralai
-beautifulsoup4
-lxml
-requests-random-user-agent
-spacy
-docker
\ No newline at end of file
+python-whois==0.8.0
+pydig==0.1.0
+ghunt==1.0.0
+ignorant==0.1.0
+hibpwned==0.1.0
+phonenumbers==8.13.27
+pydantic[email]==2.5.0
+neo4j==5.15.0
+faker==20.1.0
+sqlalchemy==2.0.23
+psycopg2-binary==2.9.9
+alembic==1.13.0
+passlib[bcrypt]==1.7.4
+sse-starlette==1.8.2
+networkx==3.2.1
+pydantic-neo4j==0.0.1
+mistralai==0.0.12
+beautifulsoup4==4.12.2
+lxml==4.9.3
+requests-random-user-agent==0.0.1
+spacy==3.7.2
+docker==6.1.3
\ No newline at end of file
diff --git a/flowsint-app/src/renderer/src/api/sketch-service.ts b/flowsint-app/src/renderer/src/api/sketch-service.ts
index 2b877c88..6cee3dc6 100644
--- a/flowsint-app/src/renderer/src/api/sketch-service.ts
+++ b/flowsint-app/src/renderer/src/api/sketch-service.ts
@@ -46,4 +46,15 @@ export const sketchService = {
body: body
});
},
+ updateNode: async (sketchId: string, body: BodyInit): Promise<any> => {
+ return fetchWithAuth(`/api/sketches/${sketchId}/nodes/edit`, {
+ method: 'PUT',
+ body: body
+ });
+ },
+ types: async (): Promise<any> => {
+ return fetchWithAuth(`/api/types`, {
+ method: 'GET'
+ });
+ },
};
\ No newline at end of file
diff --git a/flowsint-app/src/renderer/src/components/graphs/draggable-item.tsx b/flowsint-app/src/renderer/src/components/graphs/draggable-item.tsx
index c307c245..0639ae0b 100644
--- a/flowsint-app/src/renderer/src/components/graphs/draggable-item.tsx
+++ b/flowsint-app/src/renderer/src/components/graphs/draggable-item.tsx
@@ -6,6 +6,8 @@ import { useGraphStore } from "@/stores/graph-store"
import { cn } from "@/lib/utils"
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "@/components/ui/tooltip"
import { useNodesDisplaySettings } from "@/stores/node-display-settings"
+import { useActionItems } from "@/hooks/use-action-items"
+import { findActionItemByKey } from "@/lib/action-items"
interface DraggableItemProps {
label: string
@@ -27,6 +29,7 @@ export const DraggableItem = memo(function DraggableItem({
description,
}: DraggableItemProps) {
const handleOpenFormModal = useGraphStore((s) => s.handleOpenFormModal)
+ const { actionItems } = useActionItems()
const [isDragging, setIsDragging] = useState(false)
const colors = useNodesDisplaySettings((s) => s.colors)
const colorStr = colors[icon as string] || color
@@ -44,7 +47,7 @@ export const DraggableItem = memo(function DraggableItem({
const onClick = () => {
if (disabled) return
- handleOpenFormModal(itemKey)
+ handleOpenFormModal(findActionItemByKey(itemKey, actionItems))
}
return (
diff --git a/flowsint-app/src/renderer/src/components/graphs/dynamic-form.tsx b/flowsint-app/src/renderer/src/components/graphs/dynamic-form.tsx
index 3f2dfc6f..dee21883 100644
--- a/flowsint-app/src/renderer/src/components/graphs/dynamic-form.tsx
+++ b/flowsint-app/src/renderer/src/components/graphs/dynamic-form.tsx
@@ -31,7 +31,6 @@ interface DynamicFormProps {
export function DynamicForm({ currentNodeType, initialData = {}, onSubmit, isForm = true, loading = false }: DynamicFormProps) {
const [isSubmitting, setIsSubmitting] = useState(false)
-
const dynamicSchema = useMemo(() => {
const createDynamicSchema = () => {
const schemaMap: Record<string, z.ZodType<any>> = {}
@@ -320,21 +319,23 @@ export function DynamicForm({ currentNodeType, initialData = {}, onSubmit, isFor
return (
<Popover>
<PopoverTrigger asChild>
- <Button
- ref={ref}
- type="button"
- variant="outline"
- className={cn(
- "w-full justify-start text-left font-normal",
- !isValidDate && "text-muted-foreground",
- errors[field.name] && "border-destructive",
- )}
- >
- <CalendarIcon className="mr-2 h-4 w-4" />
- {isValidDate
- ? format(dateValue as Date, "PPP", { locale: fr })
- : field.placeholder || `Sélectionner une date`}
- </Button>
+ <div>
+ <Button
+ ref={ref}
+ type="button"
+ variant="outline"
+ className={cn(
+ "w-full justify-start text-left font-normal",
+ !isValidDate && "text-muted-foreground",
+ errors[field.name] && "border-destructive",
+ )}
+ >
+ <CalendarIcon className="mr-2 h-4 w-4" />
+ {isValidDate
+ ? format(dateValue as Date, "PPP", { locale: fr })
+ : field.placeholder || `Sélectionner une date`}
+ </Button>
+ </div>
</PopoverTrigger>
<PopoverContent className="w-auto p-0" align="start">
<Calendar
@@ -412,10 +413,9 @@ export function DynamicForm({ currentNodeType, initialData = {}, onSubmit, isFor
return <div className="space-y-4">{currentNodeType.fields.map(renderField)}</div>
}
return (
- <form onSubmit={handleSubmit(handleFormSubmit)} className="space-y-4">
+ <form onSubmit={handleSubmit(handleFormSubmit)} className="space-y-4 p-1">
<div className="space-y-4">{currentNodeType.fields.map(renderField)}</div>
-
- <div className="flex justify-end space-x-2 pt-2">
+ <div className="flex sticky translate-y-1 p-1 bottom-0 bg-card items-center justify-end space-x-2">
<Button type="submit" disabled={isSubmitting || loading}>
{isSubmitting || loading ? (
<>
diff --git a/flowsint-app/src/renderer/src/components/graphs/graph-panel.tsx b/flowsint-app/src/renderer/src/components/graphs/graph-panel.tsx
index 81ecfca3..476f880b 100644
--- a/flowsint-app/src/renderer/src/components/graphs/graph-panel.tsx
+++ b/flowsint-app/src/renderer/src/components/graphs/graph-panel.tsx
@@ -9,7 +9,7 @@ import GraphLoader from './graph-loader'
import Loader from '../loader'
import WallEditor from './wall/wall'
import { useGraphControls } from '@/stores/graph-controls-store'
-import { NodeEditorModal } from './wall/node-editor-modal'
+import { NodeEditorModal } from './node-editor-modal'
import NodesTable from '../table'
const GraphReactForce = lazy(() => import('./graph-react-force'))
const Graph = lazy(() => import('./graph'))
@@ -53,7 +53,7 @@ const GraphPanel = ({ graphData, isLoading, isRefetching }: GraphPanelProps) =>
updateGraphData(graphData.nds, graphData.rls)
setLoading(false)
}
- }, [graphData, setLoading])
+ }, [graphData?.nds, graphData?.rls, setLoading])
const handleDragOver = (e: React.DragEvent<HTMLDivElement>) => {
e.preventDefault()
@@ -118,7 +118,7 @@ const GraphPanel = ({ graphData, isLoading, isRefetching }: GraphPanelProps) =>
</div>
}>
{/* <Graph /> */}
- {nodes?.length > 500? (
+ {nodes?.length > 500 ? (
<>{view === "table" ? <NodesTable /> : <Graph />}</>
) : (<>
{view === "force" && <GraphReactForce />}
diff --git a/flowsint-app/src/renderer/src/components/graphs/items-panel.tsx b/flowsint-app/src/renderer/src/components/graphs/items-panel.tsx
index 03acda34..a5c2221a 100644
--- a/flowsint-app/src/renderer/src/components/graphs/items-panel.tsx
+++ b/flowsint-app/src/renderer/src/components/graphs/items-panel.tsx
@@ -3,10 +3,12 @@
import { Button } from "@/components/ui/button"
import { PlusIcon, Search } from "lucide-react"
import { memo, useCallback, useState } from "react"
-import { type ActionItem, actionItems } from "@/lib/action-items"
+import { type ActionItem } from "@/lib/action-items"
import { DraggableItem } from "./draggable-item"
import { Input } from "@/components/ui/input"
import NewActions from "@/components/graphs/new-actions"
+import { useActionItems } from "@/hooks/use-action-items"
+import { SkeletonList } from "../shared/skeleton-list"
export const ItemsPanel = memo(function LeftPanel() {
const [searchQuery, setSearchQuery] = useState<string>("")
@@ -15,6 +17,8 @@ export const ItemsPanel = memo(function LeftPanel() {
setSearchQuery(e.target.value)
}, [])
+ const { actionItems, isLoading } = useActionItems()
+
return (
<div className="bg-card p-4 h-full w-full overflow-y-auto flex flex-col">
<div className="flex items-center gap-2 mb-3">
@@ -41,46 +45,47 @@ export const ItemsPanel = memo(function LeftPanel() {
</div>
</div>
<div className="grid grid-cols-1 gap-3">
- {actionItems.map((item: ActionItem) => {
- if (item.children && item.children.length > 0) {
- return (
- <div key={item.id} className="@container">
- <div className="py-1 text-sm text-muted-foreground">
- <div className="flex items-center gap-2">
- <span>{item.label} ({item.children.length})</span>
- {item.comingSoon && <span className="ml-1 text-xs text-muted-foreground">(Soon)</span>}
+ {isLoading ? <SkeletonList rowCount={8} /> :
+ actionItems?.map((item: ActionItem) => {
+ if (item.children && item.children.length > 0) {
+ return (
+ <div key={item.id} className="@container">
+ <div className="py-1 text-sm text-muted-foreground">
+ <div className="flex items-center gap-2">
+ <span>{item.label} ({item.children.length})</span>
+ {item.comingSoon && <span className="ml-1 text-xs text-muted-foreground">(Soon)</span>}
+ </div>
+ </div>
+ <div className="grid grid-cols-2 @xs:grid-cols-3 @sm:grid-cols-4 @md:grid-cols-5 gap-2">
+ {item.children.map((childItem) => (
+ <DraggableItem
+ key={childItem.id}
+ itemKey={childItem.key}
+ label={childItem.label}
+ icon={childItem.icon}
+ type={childItem.type}
+ color={childItem.color}
+ disabled={childItem.disabled}
+ description={childItem.fields.map((n) => n.name).join(", ")}
+ />
+ ))}
</div>
</div>
- <div className="grid grid-cols-2 @xs:grid-cols-3 @sm:grid-cols-4 @md:grid-cols-5 gap-2">
- {item.children.map((childItem) => (
- <DraggableItem
- key={childItem.id}
- itemKey={childItem.key}
- label={childItem.label}
- icon={childItem.icon}
- type={childItem.type}
- color={childItem.color}
- disabled={childItem.disabled}
- description={childItem.fields.map((n) => n.name).join(", ")}
- />
- ))}
- </div>
- </div>
+ )
+ }
+ return (
+ <DraggableItem
+ key={item.id}
+ label={item.label}
+ itemKey={item.key}
+ icon={item.icon}
+ type={item.type}
+ color={item.color}
+ disabled={item.disabled}
+ description={item.fields.map((n) => n.name).join(", ")}
+ />
)
- }
- return (
- <DraggableItem
- key={item.id}
- label={item.label}
- itemKey={item.key}
- icon={item.icon}
- type={item.type}
- color={item.color}
- disabled={item.disabled}
- description={item.fields.map((n) => n.name).join(", ")}
- />
- )
- })}
+ })}
</div>
</div>
)
diff --git a/flowsint-app/src/renderer/src/components/graphs/map.tsx b/flowsint-app/src/renderer/src/components/graphs/map.tsx
index 21371737..addd58a5 100644
--- a/flowsint-app/src/renderer/src/components/graphs/map.tsx
+++ b/flowsint-app/src/renderer/src/components/graphs/map.tsx
@@ -4,19 +4,33 @@ import L from "leaflet";
import "leaflet/dist/leaflet.css";
type MapFromAddressProps = {
- address: string;
+ address?: string;
+ lat?: number;
+ lon?: number;
height?: string;
zoom?: number;
};
export const MapFromAddress: React.FC<MapFromAddressProps> = ({
address,
+ lat,
+ lon,
height = "400px",
zoom = 15,
}) => {
const { data, isLoading, isError } = useQuery({
queryKey: ["geocode", address],
queryFn: async () => {
+ // If lat and lon are provided, use them directly
+ if (lat !== undefined && lon !== undefined) {
+ return { lat, lon };
+ }
+
+ // Otherwise, geocode the address
+ if (!address) {
+ throw new Error("Either address or lat/lon coordinates must be provided");
+ }
+
const res = await fetch(
`https://nominatim.openstreetmap.org/search?format=json&q=${encodeURIComponent(address)}`
);
@@ -27,28 +41,49 @@ export const MapFromAddress: React.FC<MapFromAddressProps> = ({
lon: parseFloat(json[0].lon),
};
},
+ enabled: !(lat !== undefined && lon !== undefined), // Skip query if lat/lon are provided
});
- const mapId = `leaflet-map-${btoa(address).replace(/[^a-zA-Z0-9]/g, "")}`;
+ // Use provided coordinates or geocoded data
+ const coordinates = lat !== undefined && lon !== undefined
+ ? { lat, lon }
+ : data;
+
+ const mapId = `leaflet-map-${btoa(address || `${lat},${lon}`).replace(/[^a-zA-Z0-9]/g, "")}`;
React.useEffect(() => {
- if (!data) return;
+ if (!coordinates) return;
- const map = L.map(mapId).setView([data.lat, data.lon], zoom);
+ const map = L.map(mapId).setView([coordinates.lat, coordinates.lon], zoom);
L.tileLayer("https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png", {
attribution: "© OpenStreetMap",
}).addTo(map);
- L.marker([data.lat, data.lon]).addTo(map).bindPopup(address).openPopup();
+ const marker = L.marker([coordinates.lat, coordinates.lon]).addTo(map);
+
+ // Bind popup with address if available, otherwise show coordinates
+ const popupText = address || `${coordinates.lat.toFixed(6)}, ${coordinates.lon.toFixed(6)}`;
+ marker.bindPopup(popupText).openPopup();
return () => {
map.remove(); // cleanup
};
- }, [data, mapId, address, zoom]);
+ }, [coordinates, mapId, address, zoom]);
+
+ // Show loading only when geocoding is needed
+ if (isLoading && !(lat !== undefined && lon !== undefined)) {
+ return <div className="p-3"><p>Loading map…</p></div>;
+ }
+
+ if (isError && !(lat !== undefined && lon !== undefined)) {
+ return <div className="p-3"><p>Could not find the address.</p></div>;
+ }
- if (isLoading) return <div className="p-3"><p>Loading map…</p></div>;
- if (isError) return <div className="p-3"><p>Could not find the address.</p></div>;
+ // Don't render if we don't have coordinates
+ if (!coordinates) {
+ return <div className="p-3"><p>No coordinates provided.</p></div>;
+ }
return <div id={mapId} style={{ height }} />;
};
diff --git a/flowsint-app/src/renderer/src/components/graphs/new-actions.tsx b/flowsint-app/src/renderer/src/components/graphs/new-actions.tsx
index c9ee3a8e..d652234d 100644
--- a/flowsint-app/src/renderer/src/components/graphs/new-actions.tsx
+++ b/flowsint-app/src/renderer/src/components/graphs/new-actions.tsx
@@ -7,7 +7,7 @@ import { ArrowLeft, ArrowRight } from 'lucide-react'
import { toast } from "sonner"
import { cn, flattenObj } from "@/lib/utils"
import { Dialog, DialogContent, DialogDescription, DialogTitle } from "@/components/ui/dialog"
-import { actionItems, type ActionItem, type FormField } from "@/lib/action-items"
+import { type ActionItem, type FormField, findActionItemByKey } from "@/lib/action-items"
import { Card, CardContent } from "@/components/ui/card"
import { AnimatePresence, motion } from "framer-motion"
import { DynamicForm } from "@/components/graphs/dynamic-form"
@@ -18,6 +18,7 @@ import { sketchService } from "@/api/sketch-service"
import { useParams } from "@tanstack/react-router"
import { useIcon } from "@/hooks/use-icon"
import { useLayoutStore } from "@/stores/layout-store"
+import { useActionItems } from "@/hooks/use-action-items"
interface ActionDialogProps {
children: React.ReactNode
@@ -34,6 +35,7 @@ export default function ActionDialog({ children, setCurrentNode }: ActionDialogP
const addNode = useGraphStore(state => state.addNode)
const setActiveTab = useLayoutStore(state => state.setActiveTab)
const { id } = useParams({ strict: false })
+ const { actionItems, isLoading } = useActionItems()
const [currentParent, setCurrentParent] = useState<ActionItem | null>(null)
const [navigationHistory, setNavigationHistory] = useState<ActionItem[]>([])
@@ -89,6 +91,16 @@ export default function ActionDialog({ children, setCurrentNode }: ActionDialogP
const renderActionCards = () => {
const items = currentParent ? currentParent.children || [] : actionItems
+ if (!items || items.length === 0) {
+ return (
+ <div className="flex items-center justify-center h-32">
+ <div className="text-center">
+ <p className="text-sm text-muted-foreground">No action items available</p>
+ </div>
+ </div>
+ )
+ }
+
return (
<AnimatePresence mode="wait">
<motion.div
@@ -103,7 +115,7 @@ export default function ActionDialog({ children, setCurrentNode }: ActionDialogP
<ActionCard
key={item.id}
item={item}
- onSelect={item.children ? () => navigateToSubItems(item) : () => handleOpenFormModal(item.key)}
+ onSelect={item.children ? () => navigateToSubItems(item) : () => handleOpenFormModal(findActionItemByKey(item.key, actionItems))}
/>
))}
</motion.div>
@@ -114,7 +126,7 @@ export default function ActionDialog({ children, setCurrentNode }: ActionDialogP
return (
<>
<Dialog open={openMainDialog} onOpenChange={setOpenMainDialog}>
- <DialogTrigger asChild>{children}</DialogTrigger>
+ <DialogTrigger disabled={isLoading} asChild>{children}</DialogTrigger>
<DialogContent className="sm:max-w-[700px] h-[80vh] overflow-hidden flex flex-col">
<DialogTitle className="flex items-center">
{currentParent && (
@@ -130,11 +142,27 @@ export default function ActionDialog({ children, setCurrentNode }: ActionDialogP
: "Choose an item to insert to the graph."}
</DialogDescription>
- <div className="overflow-y-auto overflow-x-hidden pr-1 -mr-1 flex-grow">{renderActionCards()}</div>
+ <div className="overflow-y-auto overflow-x-hidden pr-1 -mr-1 flex-grow">
+ {isLoading ? (
+ <div className="grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 gap-3 p-1 pb-2">
+ {Array.from({ length: 6 }).map((_, index) => (
+ <Card key={index} className="h-full">
+ <CardContent className="p-2 relative flex flex-col items-center text-center h-full">
+ <div className="w-8 h-8 rounded-full bg-muted animate-pulse mb-3 mt-2"></div>
+ <div className="h-4 bg-muted rounded animate-pulse w-20 mb-2"></div>
+ <div className="h-3 bg-muted rounded animate-pulse w-32"></div>
+ </CardContent>
+ </Card>
+ ))}
+ </div>
+ ) : (
+ renderActionCards()
+ )}
+ </div>
</DialogContent>
</Dialog>
<Dialog open={openFormDialog} onOpenChange={setOpenFormDialog}>
- <DialogContent>
+ <DialogContent className="max-h-[95vh] flex flex-col">
<DialogTitle>
{currentNodeType && (
<>Add {currentNodeType.label.toLowerCase()}</>
@@ -142,11 +170,13 @@ export default function ActionDialog({ children, setCurrentNode }: ActionDialogP
</DialogTitle>
<DialogDescription>Fill the required data.</DialogDescription>
{currentNodeType && (
- <DynamicForm
- currentNodeType={currentNodeType}
- isForm={true}
- onSubmit={handleAddNode}
- />
+ <div className="grow overflow-y-auto">
+ <DynamicForm
+ currentNodeType={currentNodeType}
+ isForm={true}
+ onSubmit={handleAddNode}
+ />
+ </div>
)}
</DialogContent >
</Dialog>
@@ -178,7 +208,7 @@ function ActionCard({ item, onSelect }: ActionCardProps) {
<IconComponent style={{ color: item.color }} className={cn("h-12 w-12", item.color ? "" : "text-primary")} />
</div>
<div className="font-medium text-sm">{item.label}</div>
- <div className="text-sm mt-2 opacity-60">{item.fields.map((n) => n.name).join(", ")}</div>
+ {!item.children && <div className="text-sm mt-2 opacity-60">{item.fields.length} fields</div>}
{item.disabled && (
<Badge variant="outline" className="mt-2 absolute top-2 left-2">
Soon
diff --git a/flowsint-app/src/renderer/src/components/graphs/wall/node-editor-modal.tsx b/flowsint-app/src/renderer/src/components/graphs/node-editor-modal.tsx
similarity index 87%
rename from flowsint-app/src/renderer/src/components/graphs/wall/node-editor-modal.tsx
rename to flowsint-app/src/renderer/src/components/graphs/node-editor-modal.tsx
index 04bc9e61..49dbf63a 100644
--- a/flowsint-app/src/renderer/src/components/graphs/wall/node-editor-modal.tsx
+++ b/flowsint-app/src/renderer/src/components/graphs/node-editor-modal.tsx
@@ -6,10 +6,13 @@ import { Label } from "@/components/ui/label"
import { Textarea } from "@/components/ui/textarea"
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"
import { Badge } from "@/components/ui/badge"
-import { Edit3, Save, X, Hash, Type, FileText, Tag, Check } from "lucide-react"
+import { Edit3, Save, X, Hash, Type, FileText, Tag, Check, Loader2 } from "lucide-react"
import type { NodeData } from "@/types"
import { useGraphStore } from "@/stores/graph-store"
-import { MapFromAddress } from "../map"
+import { MapFromAddress } from "./map"
+import { sketchService } from "@/api/sketch-service"
+import { useParams } from "@tanstack/react-router"
+import { toast } from "sonner"
export const NodeEditorModal: React.FC = () => {
const currentNode = useGraphStore(state => state.currentNode)
@@ -17,6 +20,7 @@ export const NodeEditorModal: React.FC = () => {
const setOpenNodeEditorModal = useGraphStore(state => state.setOpenNodeEditorModal)
const updateNode = useGraphStore(state => state.updateNode)
const setCurrentNode = useGraphStore(state => state.setCurrentNode)
+ const { id: sketchId } = useParams({ strict: false })
const [formData, setFormData] = useState<Partial<NodeData>>({
label: "",
@@ -24,6 +28,8 @@ export const NodeEditorModal: React.FC = () => {
type: ""
});
+ const [isSaving, setIsSaving] = useState(false);
+
// Update form data when currentNode changes
useEffect(() => {
if (currentNode) {
@@ -36,17 +42,42 @@ export const NodeEditorModal: React.FC = () => {
}
}, [currentNode]);
- const handleSave = () => {
- if (currentNode) {
- updateNode(currentNode.id, formData);
- setCurrentNode({
- ...currentNode,
- data: {
- ...currentNode.data,
- ...formData
- }
- });
- setOpenNodeEditorModal(false);
+ const handleSave = async () => {
+ if (!currentNode || !sketchId) return;
+
+ setIsSaving(true);
+
+ try {
+ // Prepare the data for the API
+ const updateData = {
+ nodeId: currentNode.id,
+ data: formData
+ };
+
+ // Call the API to update the node
+ const result = await sketchService.updateNode(sketchId, JSON.stringify(updateData));
+
+ if (result.status === "node updated") {
+ // Update the local store
+ updateNode(currentNode.id, formData);
+ setCurrentNode({
+ ...currentNode,
+ data: {
+ ...currentNode.data,
+ ...formData
+ }
+ });
+
+ toast.success("Node updated successfully");
+ setOpenNodeEditorModal(false);
+ } else {
+ toast.error("Failed to update node");
+ }
+ } catch (error) {
+ console.error("Error updating node:", error);
+ toast.error("Failed to update node. Please try again.");
+ } finally {
+ setIsSaving(false);
}
};
@@ -60,6 +91,7 @@ export const NodeEditorModal: React.FC = () => {
[field]: value
}));
};
+ const isLocation = formData.type === "location" || (formData.latitude && formData.longitude)
if (!currentNode) return null;
@@ -269,15 +301,15 @@ export const NodeEditorModal: React.FC = () => {
</CardContent>
</Card>
- {formData.type === "location" && <Card className="border bg-muted/30">
+ {isLocation && <Card className="border bg-muted/30">
<CardHeader className="pb-3">
<CardTitle className="text-base font-medium">
- Location
+ Location {formData.type === "location" ? <>({formData.label})</> : <>(lat:{formData.latitude} - lon:{formData.longitude})</>}
</CardTitle>
</CardHeader>
<CardContent>
<div className="overflow-hidden rounded-lg bg-background border">
- <MapFromAddress address={formData.label as string} />
+ <MapFromAddress lat={formData.latitude} lon={formData.longitude} address={formData.label as string} />
</div>
</CardContent>
</Card>}
@@ -301,10 +333,15 @@ export const NodeEditorModal: React.FC = () => {
</Button>
<Button
onClick={handleSave}
+ disabled={isSaving}
className="gap-2"
>
- <Save className="h-4 w-4" />
- Save Changes
+ {isSaving ? (
+ <Loader2 className="h-4 w-4 animate-spin" />
+ ) : (
+ <Save className="h-4 w-4" />
+ )}
+ {isSaving ? "Saving..." : "Save Changes"}
</Button>
</div>
</div>
diff --git a/flowsint-app/src/renderer/src/components/graphs/nodes-panel.tsx b/flowsint-app/src/renderer/src/components/graphs/nodes-panel.tsx
index c9da563b..9c7c7119 100644
--- a/flowsint-app/src/renderer/src/components/graphs/nodes-panel.tsx
+++ b/flowsint-app/src/renderer/src/components/graphs/nodes-panel.tsx
@@ -7,7 +7,7 @@ import { Badge } from "@/components/ui/badge"
import { TypeBadge } from "@/components/type-badge"
import { Search, FilterIcon, XIcon } from "lucide-react"
import { Input } from "@/components/ui/input"
-import { actionItems } from "@/lib/action-items"
+import { useActionItems } from "@/hooks/use-action-items"
import { cn } from "@/lib/utils"
import {
DropdownMenu,
@@ -24,7 +24,7 @@ import { Checkbox } from "@/components/ui/checkbox"
const ITEM_HEIGHT = 40
// Function to extract all leaf-level node types from actionItems
-const getAllNodeTypes = () => {
+const getAllNodeTypes = (actionItems: any[]) => {
const types: string[] = []
actionItems.forEach(item => {
if (item.children) {
@@ -109,6 +109,7 @@ const NodesPanel = memo(({ nodes, isLoading }: { nodes: GraphNode[]; isLoading?:
const selectedNodes = useGraphStore((state) => state.selectedNodes || [])
const [searchQuery, setSearchQuery] = useState<string>("")
const [filters, setFilters] = useState<null | string[]>(null)
+ const { actionItems } = useActionItems()
// Ref pour le conteneur parent du virtualizer
const parentRef = useRef<HTMLDivElement>(null)
@@ -244,7 +245,7 @@ const NodesPanel = memo(({ nodes, isLoading }: { nodes: GraphNode[]; isLoading?:
<DropdownMenuItem className={cn(filters == null && "bg-primary")} onClick={() => toggleFilter(null)}>
All
</DropdownMenuItem>
- {getAllNodeTypes().map((type) => (
+ {getAllNodeTypes(actionItems || []).map((type) => (
<DropdownMenuItem
className={cn(filters?.includes(type) && "bg-primary/30")}
key={type}
diff --git a/flowsint-app/src/renderer/src/components/graphs/toolbar.tsx b/flowsint-app/src/renderer/src/components/graphs/toolbar.tsx
index 223e0b92..b7a7c318 100644
--- a/flowsint-app/src/renderer/src/components/graphs/toolbar.tsx
+++ b/flowsint-app/src/renderer/src/components/graphs/toolbar.tsx
@@ -166,12 +166,6 @@ export const Toolbar = memo(function Toolbar({ isLoading }: { isLoading: boolean
tooltip="Fit to View"
onClick={zoomToFit}
/>
- <ToolbarButton
- icon={<GitFork className="h-4 w-4 opacity-70 rotate-180" />}
- tooltip={isGraphOnly ? "Graph is too large to render in hierarchy layout" : `Hierarchy (${isMac ? '⌘' : 'ctrl'}+Y)`}
- onClick={handleDagreLayoutTB}
- disabled={isGraphOnly}
- />
</>}
<ToolbarButton
icon={<GitFork className="h-4 w-4 opacity-70 rotate-90" />}
@@ -179,6 +173,12 @@ export const Toolbar = memo(function Toolbar({ isLoading }: { isLoading: boolean
onClick={handleDagreLayoutLR}
disabled={isGraphOnly}
/>
+ <ToolbarButton
+ icon={<GitFork className="h-4 w-4 opacity-70 rotate-180" />}
+ tooltip={isGraphOnly ? "Graph is too large to render in hierarchy layout" : `Hierarchy (${isMac ? '⌘' : 'ctrl'}+Y)`}
+ onClick={handleDagreLayoutTB}
+ disabled={isGraphOnly}
+ />
<ToolbarButton
icon={<Waypoints className="h-4 w-4 opacity-70" />}
tooltip={"Graph view"}
diff --git a/flowsint-app/src/renderer/src/components/graphs/wall/custom/custom-node.tsx b/flowsint-app/src/renderer/src/components/graphs/wall/custom/custom-node.tsx
index e1298b98..16ae8210 100644
--- a/flowsint-app/src/renderer/src/components/graphs/wall/custom/custom-node.tsx
+++ b/flowsint-app/src/renderer/src/components/graphs/wall/custom/custom-node.tsx
@@ -14,31 +14,11 @@ export const CustomNode = memo(({ data, selected, id }: NodeProps) => {
return (
- <div className="xy-node -z-[5000] relative p-1 flex flex-col justify-center items-center !rounded-full h-20">
- <Handle
- type="target"
- position={Position.Top}
- id="top"
- className="opacity-0"
- />
- <Handle
- type="source"
- position={Position.Bottom}
- id="bottom"
- className="opacity-0"
- />
- <Handle
- type="source"
- position={Position.Left}
- id="left"
- className="opacity-0"
- />
- <Handle
- type="target"
- position={Position.Right}
- id="right"
- className="opacity-0"
- />
+ <div className="xy-node -z-[5000] relative p-1 group flex flex-col justify-center items-center !rounded-full h-20">
+ <Handle type="target" position={Position.Top} id="a" className="opacity-0 group-hover:opacity-100" />
+ <Handle type="target" position={Position.Right} id="b" className="opacity-0 group-hover:opacity-100" />
+ <Handle type="source" position={Position.Bottom} id="c" className="opacity-0 group-hover:opacity-100" />
+ <Handle type="source" position={Position.Left} id="d" className="opacity-0 group-hover:opacity-100" />
<div style={{ width: size, height: size, borderColor: (selected || isCurrent(id)) ? "#f97316" : color }} className="!rounded-full gap-0 flex items-center justify-center border-primary/70 p-1 overflow-hidden">
<IconComponent
size={size}
@@ -51,7 +31,7 @@ export const CustomNode = memo(({ data, selected, id }: NodeProps) => {
/>
</div>
<div
- className="text-nowrap text-center max-w-[160px] truncate text-ellipsis truncate text-ellipsis"
+ className="text-nowrap text-center max-w-[60px] text-ellipsis truncate"
style={{
fontSize: 11,
color: (selected || isCurrent(id)) ? "#f97316" : "#94a3b8",
diff --git a/flowsint-app/src/renderer/src/components/graphs/wall/custom/floating-edge.tsx b/flowsint-app/src/renderer/src/components/graphs/wall/custom/floating-edge.tsx
index e71dc06e..a1701b07 100644
--- a/flowsint-app/src/renderer/src/components/graphs/wall/custom/floating-edge.tsx
+++ b/flowsint-app/src/renderer/src/components/graphs/wall/custom/floating-edge.tsx
@@ -1,16 +1,8 @@
-import { getStraightPath, useInternalNode } from '@xyflow/react';
-import { getEdgeParams } from '@/lib/utils';
-import { memo } from 'react';
+import { getBezierPath, useInternalNode } from '@xyflow/react';
-interface FloatingEdgeProps {
- id: string;
- source: string;
- target: string;
- markerEnd?: string;
- style?: React.CSSProperties;
-}
+import { getEdgeParams } from '@/lib/utils';
-const FloatingEdge = memo(function FloatingEdge({ id, source, target, markerEnd, style }: FloatingEdgeProps) {
+function SimpleFloatingEdge({ id, source, target, markerEnd, style }) {
const sourceNode = useInternalNode(source);
const targetNode = useInternalNode(target);
@@ -18,15 +10,28 @@ const FloatingEdge = memo(function FloatingEdge({ id, source, target, markerEnd,
return null;
}
- const { sx, sy, tx, ty } = getEdgeParams(
- //@ts-ignore
- sourceNode,
- targetNode,
+ const { sx, sy, tx, ty, sourcePos, targetPos } = getEdgeParams(
+ {
+ ...sourceNode,
+ measured: {
+ width: sourceNode.measured?.width ?? 150,
+ height: sourceNode.measured?.height ?? 40,
+ },
+ },
+ {
+ ...targetNode,
+ measured: {
+ width: targetNode.measured?.width ?? 150,
+ height: targetNode.measured?.height ?? 40,
+ },
+ },
);
- const [edgePath] = getStraightPath({
+ const [edgePath] = getBezierPath({
sourceX: sx,
sourceY: sy,
+ sourcePosition: sourcePos,
+ targetPosition: targetPos,
targetX: tx,
targetY: ty,
});
@@ -36,10 +41,11 @@ const FloatingEdge = memo(function FloatingEdge({ id, source, target, markerEnd,
id={id}
className="react-flow__edge-path"
d={edgePath}
+ strokeWidth={5}
markerEnd={markerEnd}
style={style}
/>
);
-});
+}
-export default FloatingEdge;
\ No newline at end of file
+export default SimpleFloatingEdge;
\ No newline at end of file
diff --git a/flowsint-app/src/renderer/src/components/graphs/wall/wall.tsx b/flowsint-app/src/renderer/src/components/graphs/wall/wall.tsx
index f364d918..81720ef5 100644
--- a/flowsint-app/src/renderer/src/components/graphs/wall/wall.tsx
+++ b/flowsint-app/src/renderer/src/components/graphs/wall/wall.tsx
@@ -14,6 +14,8 @@ import {
BackgroundVariant,
// EdgeTypes,
MarkerType,
+ EdgeTypes,
+ ConnectionMode,
} from "@xyflow/react"
import "@xyflow/react/dist/style.css"
import { getDagreLayoutedElements, getForceLayoutedElements } from "@/lib/utils"
@@ -27,15 +29,15 @@ import { useGraphControls } from "@/stores/graph-controls-store"
import { useNodesDisplaySettings } from "@/stores/node-display-settings"
import ContextMenu from './custom/context-menu';
import { useLayoutStore } from "@/stores/layout-store"
-
+import SimpleFloatingEdge from './custom/floating-edge';
const nodeTypes = {
custom: CustomNode,
};
-// const edgeTypes = {
-// custom: FloatingEdge,
-// };
+const edgeTypes = {
+ custom: SimpleFloatingEdge,
+};
const Wall = memo(({ theme, edges }: { theme: ColorMode, edges: GraphEdge[] }) => {
const { fitView, zoomIn, zoomOut, setCenter } = useReactFlow()
@@ -123,6 +125,7 @@ const Wall = memo(({ theme, edges }: { theme: ColorMode, edges: GraphEdge[] }) =
type: newNodeData.type,
caption: newNodeData.caption,
label: newNodeData.label,
+ created_at: new Date().toISOString(),
},
}
addNode(newNode)
@@ -268,7 +271,7 @@ const Wall = memo(({ theme, edges }: { theme: ColorMode, edges: GraphEdge[] }) =
nodes: visibleNodes,
edges: visibleEdges,
nodeTypes,
- // edgeTypes: edgeTypes as EdgeTypes,
+ edgeTypes: edgeTypes as EdgeTypes,
onInit: setReactFlowInstance,
onNodeContextMenu,
onDrop,
@@ -284,6 +287,7 @@ const Wall = memo(({ theme, edges }: { theme: ColorMode, edges: GraphEdge[] }) =
proOptions: { hideAttribution: true },
colorMode: theme,
onlyRenderVisibleElements: nodes.length > 500,
+ connectionMode: ConnectionMode.Loose
}), [
visibleNodes,
visibleEdges,
diff --git a/flowsint-app/src/renderer/src/hooks/use-action-items.ts b/flowsint-app/src/renderer/src/hooks/use-action-items.ts
new file mode 100644
index 00000000..7d9e7d92
--- /dev/null
+++ b/flowsint-app/src/renderer/src/hooks/use-action-items.ts
@@ -0,0 +1,18 @@
+import { sketchService } from "@/api/sketch-service"
+import { ActionItem } from "@/lib/action-items"
+import { useQuery } from "@tanstack/react-query"
+
+export const useActionItems = () => {
+ const { data: actionItems, isLoading } = useQuery<ActionItem[]>({
+ queryKey: ["actionItems"],
+ queryFn: () => sketchService.types(),
+ staleTime: 5 * 60 * 1000, // 5 minutes - data is considered fresh for 5 minutes
+ gcTime: 10 * 60 * 1000, // 10 minutes - keep in cache for 10 minutes
+ refetchOnWindowFocus: false, // Prevent refetch on window focus
+ refetchOnMount: false, // Prevent refetch on component mount if data exists
+ })
+ return {
+ actionItems,
+ isLoading
+ }
+}
\ No newline at end of file
diff --git a/flowsint-app/src/renderer/src/hooks/use-drag-drop.ts b/flowsint-app/src/renderer/src/hooks/use-drag-drop.ts
index 8b4c885e..953ddc34 100644
--- a/flowsint-app/src/renderer/src/hooks/use-drag-drop.ts
+++ b/flowsint-app/src/renderer/src/hooks/use-drag-drop.ts
@@ -1,8 +1,11 @@
import { useCallback, useRef, useState } from 'react'
import { useGraphStore } from '@/stores/graph-store'
+import { findActionItemByKey } from '@/lib/action-items'
+import { useActionItems } from './use-action-items'
export const useDragAndDrop = () => {
const [isDraggingOver, setIsDraggingOver] = useState(false)
+ const { actionItems } = useActionItems()
const handleOpenFormModal = useGraphStore(s => s.handleOpenFormModal)
const dragLeaveTimeoutRef = useRef<number | null>(null)
@@ -42,12 +45,12 @@ export const useDragAndDrop = () => {
try {
const parsedData = JSON.parse(data)
if (parsedData?.itemKey) {
- handleOpenFormModal(parsedData.itemKey)
+ handleOpenFormModal(findActionItemByKey(parsedData.itemKey, actionItems))
}
} catch (error) {
console.warn('Failed to parse dropped data:', error)
}
- }, [handleOpenFormModal])
+ }, [handleOpenFormModal, actionItems])
return {
isDraggingOver,
diff --git a/flowsint-app/src/renderer/src/hooks/use-platform-icons.tsx b/flowsint-app/src/renderer/src/hooks/use-platform-icons.tsx
index 1c9af9b3..b9b70626 100644
--- a/flowsint-app/src/renderer/src/hooks/use-platform-icons.tsx
+++ b/flowsint-app/src/renderer/src/hooks/use-platform-icons.tsx
@@ -1,9 +1,14 @@
import { type JSX, useMemo } from "react";
-import { actionItems, type ActionItem } from "@/lib/action-items"
+import { type ActionItem } from "@/lib/action-items"
import { useIcon } from "@/hooks/use-icon"
+import { useActionItems } from "./use-action-items"
export const usePlatformIcons = () => {
+ const { actionItems } = useActionItems()
+
return useMemo(() => {
+ if (!actionItems) return {}
+
const socials = actionItems.find((item) => item.type === "Socials")?.children
if (!socials)
return {};
@@ -16,6 +21,6 @@ export const usePlatformIcons = () => {
};
return acc;
}, {} as Record<string, { icon: JSX.Element, color: string }>);
- }, []);
+ }, [actionItems]);
};
diff --git a/flowsint-app/src/renderer/src/lib/action-items.ts b/flowsint-app/src/renderer/src/lib/action-items.ts
index 04ad1fe7..9206c1f6 100644
--- a/flowsint-app/src/renderer/src/lib/action-items.ts
+++ b/flowsint-app/src/renderer/src/lib/action-items.ts
@@ -17,7 +17,6 @@ export interface FormField {
export interface ActionItem {
id: number
type: string
- table: string
key: string
icon: string
label: string
@@ -43,7 +42,6 @@ export const actionItems: ActionItem[] = [
{
id: 100,
type: "person",
- table: "",
key: "person",
icon: "individual",
label: "Person",
@@ -53,7 +51,6 @@ export const actionItems: ActionItem[] = [
{
id: 1,
type: "Individual",
- table: "individuals",
key: "individual",
label_key: "full_name",
icon: "individual",
@@ -79,7 +76,6 @@ export const actionItems: ActionItem[] = [
{
id: 512932,
type: "Username",
- table: "usernames",
key: "username",
icon: "username",
label: "Username",
@@ -92,7 +88,6 @@ export const actionItems: ActionItem[] = [
{
id: 101,
type: "organization",
- table: "",
key: "organization_category",
icon: "organization",
label: "Organization",
@@ -102,7 +97,6 @@ export const actionItems: ActionItem[] = [
{
id: 24,
type: "Organization",
- table: "organizations",
key: "organization",
icon: "organization",
label: "Organization",
@@ -132,7 +126,6 @@ export const actionItems: ActionItem[] = [
{
id: 102,
type: "contact",
- table: "",
key: "contact",
icon: "phone",
label: "Contact",
@@ -142,7 +135,6 @@ export const actionItems: ActionItem[] = [
{
id: 2,
type: "Phone",
- table: "phones",
key: "phone",
label_key: "number",
icon: "phone",
@@ -162,7 +154,6 @@ export const actionItems: ActionItem[] = [
{
id: 4,
type: "Email",
- table: "emails",
key: "email",
icon: "email",
label_key: "email",
@@ -175,7 +166,6 @@ export const actionItems: ActionItem[] = [
{
id: 103,
type: "digital",
- table: "",
key: "digital",
icon: "website",
label: "Digital",
@@ -185,7 +175,6 @@ export const actionItems: ActionItem[] = [
{
id: 25,
type: "Website",
- table: "websites",
key: "website",
label_key: "url",
icon: "website",
@@ -201,7 +190,6 @@ export const actionItems: ActionItem[] = [
{
id: 259,
type: "Domain",
- table: "domains",
key: "domain",
icon: "domain",
label_key: "domain",
@@ -212,7 +200,6 @@ export const actionItems: ActionItem[] = [
{
id: 2588,
type: "Subdomain",
- table: "subdomains",
key: "subdomain",
label_key: "subomain",
icon: "subdomain",
@@ -223,7 +210,6 @@ export const actionItems: ActionItem[] = [
{
id: 5,
type: "Ip",
- table: "ips",
key: "ip",
icon: "ip",
label: "IP address",
@@ -236,7 +222,6 @@ export const actionItems: ActionItem[] = [
{
id: 104,
type: "finance",
- table: "",
key: "finance",
icon: "cryptowallet",
label: "Finance",
@@ -246,7 +231,6 @@ export const actionItems: ActionItem[] = [
{
id: 215,
type: "CryptoWallet",
- table: "wallets",
key: "wallet",
label_key: "wallet",
icon: "cryptowallet",
@@ -271,7 +255,6 @@ export const actionItems: ActionItem[] = [
{
id: 105,
type: "location",
- table: "",
key: "location",
icon: "location",
label: "Location",
@@ -281,7 +264,6 @@ export const actionItems: ActionItem[] = [
{
id: 3,
type: "Location",
- table: "addresses",
label_key: "address",
key: "address",
icon: "location",
@@ -302,7 +284,6 @@ export const actionItems: ActionItem[] = [
id: 6,
type: "Socials",
size: "h-5 w-5",
- table: "",
key: "social_profile",
icon: "social_profile",
label: "Social account",
@@ -312,7 +293,6 @@ export const actionItems: ActionItem[] = [
{
id: 7,
type: "SocialProfile",
- table: "social_profiles",
key: "social_profiles_facebook",
label_key: "username",
icon: "facebook",
@@ -328,7 +308,6 @@ export const actionItems: ActionItem[] = [
{
id: 8,
type: "SocialProfile",
- table: "social_profiles",
key: "social_profiles_instagram",
label_key: "username",
icon: "instagram",
@@ -344,7 +323,6 @@ export const actionItems: ActionItem[] = [
{
id: 9,
type: "SocialProfile",
- table: "social_profiles",
key: "social_profiles_telegram",
label_key: "username",
icon: "telegram",
@@ -360,7 +338,6 @@ export const actionItems: ActionItem[] = [
{
id: 10,
type: "SocialProfile",
- table: "social_profiles",
key: "social_profiles_signal",
label_key: "username",
icon: "signal",
@@ -376,7 +353,6 @@ export const actionItems: ActionItem[] = [
{
id: 11,
type: "SocialProfile",
- table: "social_profiles",
key: "social_profiles_snapchat",
label_key: "username",
color: "#FEFC00",
@@ -392,7 +368,6 @@ export const actionItems: ActionItem[] = [
{
id: 12,
type: "SocialProfile",
- table: "social_profiles",
key: "social_profiles_github",
label_key: "username",
color: "#B8B8BD",
@@ -405,27 +380,9 @@ export const actionItems: ActionItem[] = [
],
size: "h-5 w-5",
},
- // {
- // id: 13,
- // type: "SocialProfile",
- // table: "social_profiles",
- // key: "social_profiles_coco",
- // label_key: "username",
- // icon: "social_profile",
- // label: "Coco",
- // fields: [
- // { name: "profile_url", label: "Profile URL", type: "url", required: true },
- // { name: "username", label: "Username", type: "text", required: false },
- // { name: "platform", label: "Platform", type: "hidden", required: true },
- // ],
- // disabled: true,
- // comingSoon: true,
- // size: "h-5 w-5",
- // },
{
id: 18,
type: "SocialProfile",
- table: "social_profiles",
key: "social_profiles_linkedin",
label_key: "username",
color: "#007EBB",
@@ -441,7 +398,6 @@ export const actionItems: ActionItem[] = [
{
id: 19,
type: "SocialProfile",
- table: "social_profiles",
key: "social_profiles_twitter",
label_key: "username",
icon: "x",
@@ -457,7 +413,6 @@ export const actionItems: ActionItem[] = [
{
id: 20,
type: "SocialProfile",
- table: "social_profiles",
key: "social_profiles_tiktok",
label_key: "username",
color: "#6C2B53",
@@ -473,7 +428,6 @@ export const actionItems: ActionItem[] = [
{
id: 21,
type: "SocialProfile",
- table: "social_profiles",
key: "social_profiles_reddit",
label_key: "username",
icon: "reddit",
@@ -489,7 +443,6 @@ export const actionItems: ActionItem[] = [
{
id: 22,
type: "SocialProfile",
- table: "social_profiles",
key: "social_profiles_discord",
label_key: "username",
icon: "discord",
@@ -505,7 +458,6 @@ export const actionItems: ActionItem[] = [
{
id: 2343,
type: "SocialProfile",
- table: "social_profiles",
key: "social_profiles_twitch",
label_key: "username",
icon: "twitch",
@@ -523,7 +475,6 @@ export const actionItems: ActionItem[] = [
{
id: 14,
type: "Vehicle",
- table: "",
icon: "car",
label: "Vehicle",
label_key: "plate",
@@ -533,7 +484,6 @@ export const actionItems: ActionItem[] = [
{
id: 15,
type: "Car",
- table: "vehicles",
key: "vehicles_car",
icon: "car",
label: "Car",
@@ -550,7 +500,6 @@ export const actionItems: ActionItem[] = [
{
id: 16,
type: "motorcycle",
- table: "vehicles",
key: "vehicles_motorcycle",
label_key: "plate",
icon: "motorcycle",
@@ -567,7 +516,6 @@ export const actionItems: ActionItem[] = [
{
id: 17,
type: "boat",
- table: "vehicles",
key: "vehicles_boat",
label_key: "plate",
icon: "boat",
@@ -584,7 +532,6 @@ export const actionItems: ActionItem[] = [
{
id: 23,
type: "plane",
- table: "vehicles",
key: "vehicles_aircraft",
icon: "plane",
label_key: "plate",
@@ -602,7 +549,8 @@ export const actionItems: ActionItem[] = [
},
]
-export function findActionItemByKey(key: string): ActionItem | undefined {
+export function findActionItemByKey(key: string, actionItems: ActionItem[] | undefined): ActionItem | undefined {
+ if (!actionItems) return
for (const item of actionItems) {
if (item.key === key) return item
if (item.children) {
diff --git a/flowsint-app/src/renderer/src/lib/utils.ts b/flowsint-app/src/renderer/src/lib/utils.ts
index fb396c4c..71f89255 100644
--- a/flowsint-app/src/renderer/src/lib/utils.ts
+++ b/flowsint-app/src/renderer/src/lib/utils.ts
@@ -129,8 +129,8 @@ export const getForceLayoutedElements = (
edges: Edge[],
options: LayoutOptions = {
direction: "LR",
- strength: -300,
- distance: 100,
+ strength: -30,
+ distance: 10,
iterations: 300,
},
) => {
@@ -202,7 +202,7 @@ export const getDagreLayoutedElements = (nodes: Node[],
options: LayoutOptions = {
direction: "TB",
strength: -300,
- distance: 100,
+ distance: 10,
iterations: 300,
},) => {
@@ -265,13 +265,12 @@ function convertFieldToSimpleFormat(field: FormField): string {
}
export function generateNodeTypes() {
- const nodeTypes: Record<string, { table: string; type: string; fields: string[] }> = {}
+ const nodeTypes: Record<string, { type: string; fields: string[] }> = {}
function processItems(items: ActionItem[]) {
items.forEach((item) => {
- if (item.table && !item.disabled) {
+ if (!item.disabled) {
nodeTypes[item.key] = {
- table: item.table,
type: item.type,
fields: item.fields.map(convertFieldToSimpleFormat),
}
@@ -368,4 +367,7 @@ export function hexToRgba(hex: string, alpha: number) {
export function capitalizeFirstLetter(string: string) {
return string.charAt(0).toUpperCase() + string.slice(1)
-}
\ No newline at end of file
+}
+
+
+
diff --git a/flowsint-app/src/renderer/src/stores/graph-store.ts b/flowsint-app/src/renderer/src/stores/graph-store.ts
index 6cadb192..d97a5a1d 100644
--- a/flowsint-app/src/renderer/src/stores/graph-store.ts
+++ b/flowsint-app/src/renderer/src/stores/graph-store.ts
@@ -10,7 +10,7 @@ import {
applyNodeChanges,
applyEdgeChanges
} from "@xyflow/react"
-import { type ActionItem, findActionItemByKey } from "@/lib/action-items"
+import { type ActionItem } from "@/lib/action-items"
export type GraphNode = Node<NodeData> & {
collapsed?: boolean;
@@ -59,7 +59,7 @@ interface GraphState {
// === Action Type for Form ===
currentNodeType: ActionItem | null
setCurrentNodeType: (nodeType: ActionItem | null) => void
- handleOpenFormModal: (key: string) => void
+ handleOpenFormModal: (selectedItem: ActionItem | undefined) => void
// === Action Type for Edit form ===
handleEdit: (node: GraphNode) => void
@@ -200,8 +200,7 @@ export const useGraphStore = create<GraphState>()((set, get) => ({
// === Action Type for Form ===
currentNodeType: null,
setCurrentNodeType: (nodeType) => set({ currentNodeType: nodeType }),
- handleOpenFormModal: (key) => {
- const selectedItem = findActionItemByKey(key)
+ handleOpenFormModal: (selectedItem) => {
if (!selectedItem) return
set({
currentNodeType: selectedItem,
diff --git a/flowsint-app/src/renderer/src/styles.css b/flowsint-app/src/renderer/src/styles.css
index fff6a190..e286b087 100644
--- a/flowsint-app/src/renderer/src/styles.css
+++ b/flowsint-app/src/renderer/src/styles.css
@@ -853,4 +853,32 @@ th,
*:hover>.resizer {
opacity: 1;
}
+}
+
+.simple-floatingedges {
+ flex-direction: column;
+ display: flex;
+ flex-grow: 1;
+ height: 100%;
+}
+
+.simple-floatingedges .react-flow__handle {
+ width: 8px;
+ height: 8px;
+}
+
+.simple-floatingedges .react-flow__handle-top {
+ top: -15px;
+}
+
+.simple-floatingedges .react-flow__handle-bottom {
+ bottom: -15px;
+}
+
+.simple-floatingedges .react-flow__handle-left {
+ left: -15px;
+}
+
+.simple-floatingedges .react-flow__handle-right {
+ right: -15px;
}
\ No newline at end of file