use crate::pipeline::NodeDefinition;
pub mod ai;
pub mod auth;
pub mod browser;
pub mod concept;
pub mod crypto;
pub mod fs;
pub mod function;
pub mod geo;
pub mod http;
pub mod input;
pub mod kv;
pub mod logic;
pub mod mail;
pub mod ms;
pub mod pg;
pub mod script;
pub mod sekejap;
pub mod sqlite;
pub mod table;
pub mod trigger;
pub mod web;
pub mod ws;
fn family_definitions() -> Vec<NodeDefinition> {
let mut items = Vec::new();
items.extend(ai::definitions());
items.extend(auth::definitions());
items.extend(browser::definitions());
items.extend(concept::definitions());
items.extend(crypto::definitions());
items.extend(fs::definitions());
items.extend(function::definitions());
items.extend(geo::definitions());
items.extend(http::definitions());
items.extend(input::definitions());
items.extend(kv::definitions());
items.extend(logic::definitions());
items.extend(mail::definitions());
items.extend(ms::definitions());
items.extend(pg::definitions());
items.extend(script::definitions());
items.extend(sekejap::definitions());
items.extend(sqlite::definitions());
items.extend(table::definitions());
items.extend(trigger::definitions());
items.extend(web::definitions());
items.extend(ws::definitions());
items
}
pub fn builtin_node_definitions() -> Vec<NodeDefinition> {
let mut items = family_definitions();
let common_flags = crate::pipeline::model::engine_common_dsl_flags();
let common_fields = crate::pipeline::model::engine_common_fields();
for def in &mut items {
for flag in &common_flags {
if !def
.dsl_flags
.iter()
.any(|f| f.config_key == flag.config_key || f.flag == flag.flag)
{
def.dsl_flags.push(flag.clone());
}
}
for field in &common_fields {
if !def.fields.iter().any(|f| f.name == field.name) {
def.fields.push(field.clone());
}
}
}
for def in &mut items {
if !def.ui_category.is_empty() {
continue;
}
let (cat, label) = ui_category_for_kind(&def.kind);
def.ui_category = cat.to_string();
def.ui_category_label = label.to_string();
}
items.sort_by(|a, b| a.kind.cmp(&b.kind));
items
}
fn ui_category_for_kind(kind: &str) -> (&'static str, &'static str) {
if kind.starts_with("n.trigger.") {
return ("trigger", "");
}
if kind.starts_with(input::KIND_PREFIX) {
return ("input", "");
}
if kind.starts_with("n.sekejap.") {
return ("data.sekejap", "Sekejap");
}
if kind.starts_with("n.sqlite.") {
return ("data.sqlite", "SQLite");
}
if kind.starts_with("n.pg.") {
return ("data.postgres", "Postgres");
}
if kind.starts_with("n.kv.") {
return ("data.kv", "KV Store");
}
if kind.starts_with("n.table.") {
return ("data.table", "Table");
}
if kind.starts_with("n.geo.") {
return ("data.geo", "Geo");
}
if kind.starts_with("n.ms.") {
return ("data.mapserver", "MapServer");
}
if kind.starts_with("n.ai.") {
return ("logic.ai", "AI");
}
if kind.starts_with("n.logic.") || kind.starts_with("n.function.") || kind == "n.script" || kind == "n.concept" {
return ("logic", "");
}
if kind.starts_with("n.browser.") {
return ("web.browser", "Browser");
}
if kind.starts_with("n.ws.") {
return ("web.websocket", "WebSocket");
}
if kind.starts_with("n.http.") || kind.starts_with("n.web.") {
return ("web", "");
}
if kind.starts_with("n.mail.") {
return ("communication.mail", "Mail");
}
if kind.starts_with("n.auth.") || kind == "n.crypto" {
return ("security", "");
}
if kind.starts_with("n.fs.") {
return ("files.fs", "File System");
}
if kind.starts_with(crate::contracts::kinds::INSTALLED_NODE_KIND_PREFIX) {
return ("installed", "Installed");
}
("other", "")
}