evenframe_core 0.3.2

Core functionality for Evenframe - TypeScript type generation and database schema synchronization
Documentation
[package]
name = "evenframe_core"
version = "0.3.2"
edition = "2024"
authors = ["Jakob Lochinski"]
license = "MIT"
description = "Core functionality for Evenframe - TypeScript type generation and database schema synchronization"
repository = "https://github.com/rymskip/evenframe"
documentation = "https://docs.rs/evenframe_core"
readme = "../README.md"
keywords = ["typescript", "codegen", "surrealdb", "schema", "types"]
categories = ["development-tools", "database"]

[features]
# By default, no optional features are enabled. This compiles only the minimal
# core needed for derive macros: types, config, validators, wrappers, and the
# schemasync data types (DefineConfig, EdgeConfig, etc.). This is the fastest
# possible compile and is what evenframe_derive depends on.
default = []

# Enables file-based debug logging via the `evenframe_log!` macro.
# Writes .log and .surql files to $ABSOLUTE_PATH_TO_EVENFRAME/evenframe/logs/
# (the system temp directory when the variable is unset).
# Not intended for production use.
dev-mode = []

# ---------------------------------------------------------------------------
# Type synchronization (TypeScript / schema generation)
# ---------------------------------------------------------------------------

# Enables the core typesync module for generating TypeScript types from Rust
# structs. Includes ArkType and Effect-TS generators, file grouping, import
# resolution, and doc-comment support. The typesync config types are always
# compiled (used by EvenframeConfig), but the generators require this feature.
typesync = []

# Enables Protocol Buffers (.proto) schema generation from Rust types.
# Pulls in the `protox` parser and `prost-types` for proto file handling.
# Implies: typesync
protobuf = ["typesync", "dep:protox", "dep:prost-types"]

# Enables FlatBuffers (.fbs) schema generation from Rust types.
# Pulls in the `logos` lexer generator for FlatBuffers parsing.
# Implies: typesync
flatbuffers = ["typesync", "dep:logos"]

# Enables Macroforge template-based TypeScript generation with JSDoc annotations.
# Pulls in the `macroforge_ts` template engine.
# Implies: typesync
macroforge = ["typesync", "dep:macroforge_ts"]

# Enables all typesync generators: ArkType, Effect-TS, Protocol Buffers,
# FlatBuffers, and Macroforge.
typesync-all = ["typesync", "protobuf", "flatbuffers", "macroforge"]

# ---------------------------------------------------------------------------
# Schema synchronization (database operations)
# ---------------------------------------------------------------------------

# Enables the schemasync engine for comparing and synchronizing Rust struct
# definitions against a live SurrealDB database. Includes schema comparison,
# DEFINE statement generation, mock data field value generators, and the
# database execution pipeline.
# Implies: surrealdb
schemasync = ["surrealdb", "tempfile"]

# Enables full timezone support for mock data generation via the `chrono-tz`
# crate, providing access to the complete IANA timezone database. Without this
# feature, timezone fields fall back to a small hardcoded set (UTC, America/
# New_York, Europe/London, Asia/Tokyo).
# Implies: schemasync
mockmake = ["schemasync", "dep:chrono-tz"]

# Enables WASM plugin support for custom mock data generation logic.
# Pulls in the wasmtime runtime. Users opt in explicitly.
# Implies: schemasync
wasm-plugins = ["schemasync", "dep:wasmtime"]

# Enables the complete schemasync pipeline with full mock data generation
# capabilities including timezone support.
schemasync-full = ["schemasync", "mockmake"]

# ---------------------------------------------------------------------------
# Database providers
# ---------------------------------------------------------------------------

# Enables SurrealDB as a database backend. Pulls in the full surrealdb client
# with in-memory (kv-mem) and HTTP protocol support. This is the heaviest
# single dependency in the tree (~200+ transitive crates).
surrealdb = ["dep:surrealdb"]

# Enables the SQL database abstraction layer via sqlx. This is the base
# feature required by all SQL providers (postgres, mysql, sqlite). Includes
# the tokio runtime and rustls TLS support.
sql = ["dep:sqlx"]

# Enables PostgreSQL as a database backend via sqlx.
# Implies: sql
postgres = ["sql", "sqlx?/postgres"]

# Enables MySQL/MariaDB as a database backend via sqlx.
# Implies: sql
mysql = ["sql", "sqlx?/mysql"]

# Enables SQLite as a database backend via sqlx.
# Implies: sql
sqlite = ["sql", "sqlx?/sqlite"]

# Enables all SQL database backends (PostgreSQL, MySQL, SQLite).
sql-all = ["postgres", "mysql", "sqlite"]

# Enables every database provider (SurrealDB + all SQL backends).
all-providers = ["surrealdb", "sql-all"]

# ---------------------------------------------------------------------------
# Convenience bundles
# ---------------------------------------------------------------------------

# Enables every feature: all generators, full schemasync with mock data,
# and all database providers. Use this for CI or when you need everything.
full = ["schemasync-full", "typesync-all", "all-providers"]

# The feature set used by the evenframe CLI binary. Enables full schemasync
# with mock data, all type generators, and SurrealDB (the primary provider
# for the CLI workflow). Does not include SQL providers.
cli = ["schemasync-full", "typesync-all", "surrealdb"]

[dependencies]
# workspace dependencies
serde_json = { workspace = true }
regex = { workspace = true }
try_from_expr = { workspace = true }
syn = { workspace = true }
tracing = { workspace = true }
convert_case = { workspace = true }
tokio = { workspace = true }
toml = { workspace = true }

# Database providers (optional based on features)
surrealdb = { version = "3.2.4", features = ["kv-mem", "protocol-http"], optional = true }
sqlx = { version = "0.9", features = ["runtime-tokio", "tls-rustls"], optional = true }
tempfile = { version = "3.27", optional = true }

# Always compiled (core)
async-trait = "0.1"
dotenvy = "0.15.7"
proc-macro2 = "1.0.107"
quote = "1.0.47"
serde = { version = "1.0.229", features = ["derive"] }
heck = "0.5.0"
chrono = "0.4.45"
derive_more = { version = "2.1.1", features = ["from"] }
petgraph = "0.8.3"
futures = "0.3.34"
serde-value = "0.7.0"
thiserror = "2.0.20"
ordered-float = { version = "5.5.0", features = ["serde"] }
derive-syn-parse = "0.2.0"
linkme = "0.3.37"
once_cell = "1.21.4"
ignore = "0.4.33"
rayon = "1.12"
blake3 = "1.8"

# Always compiled (used in type definitions throughout)
bon = "3.10.1"
rand = "0.10.2"
rand_distr = "0.6.0"
uuid = { version = "1.26", features = ["v4", "serde"] }

# Optional: mockmake runtime dependencies
chrono-tz = { version = "0.10.4", optional = true }

# Optional: WASM plugin runtime
wasmtime = { version = "48", optional = true }

# Optional: typesync parser dependencies
logos = { version = "0.16", optional = true }
protox = { version = "0.9", optional = true }
prost-types = { version = "0.14", optional = true }
macroforge_ts = { version = "0.1.84", optional = true }
strum = { version = "0.28.0", features = ["derive"] }

[dev-dependencies]
proptest = "1.11"
mockall = "0.15"
temp-env = "0.3"
tempfile = "3.27"
pretty_assertions = "1.4"
insta = { workspace = true }
serde_json = { workspace = true }
tests_macros = { path = "../tests_macros" }