[package]
name = "surrealdb"
publish = true
readme = "CARGO.md"
documentation = "https://docs.rs/surrealdb/"
edition.workspace = true
version.workspace = true
authors.workspace = true
description.workspace = true
repository.workspace = true
homepage.workspace = true
keywords.workspace = true
categories.workspace = true
license-file.workspace = true

[features]
# Public features
default = ["protocol-ws", "rustls"]
allocator = ["surrealdb-core/allocator"]
protocol-http = ["dep:reqwest"]
protocol-ws = ["dep:tokio-tungstenite", "tokio/time"]
kv-mem = ["surrealdb-core/kv-mem", "tokio/time"]
kv-indxdb = ["surrealdb-core/kv-indxdb"]
kv-rocksdb = ["surrealdb-core/kv-rocksdb", "tokio/time"]
kv-tikv = ["surrealdb-core/kv-tikv", "tokio/time"]
kv-surrealkv = ["surrealdb-core/kv-surrealkv", "tokio/time"]
scripting = ["surrealdb-core/scripting"]
http = ["surrealdb-core/http"]
native-tls = [
    "dep:native-tls",
    "reqwest?/native-tls",
    "tokio-tungstenite?/native-tls",
]
rustls = [
    "dep:rustls",
    "reqwest?/default-tls",
    "tokio-tungstenite?/rustls-tls-webpki-roots",
]
ml = ["surrealdb-core/ml"]
jwks = ["surrealdb-core/jwks"]
arbitrary = ["surrealdb-core/arbitrary"]
allocation-tracking = ["surrealdb-core/allocation-tracking"]

[package.metadata.docs.rs]
rustdoc-args = ["--cfg", "docsrs"]
features = [
    "protocol-ws",
    "protocol-http",
    "kv-mem",
    "kv-rocksdb",
    "rustls",
    "native-tls",
    "http",
    "scripting",
]
targets = []

[dependencies]
# workspace internal dependencies
surrealdb-core = { workspace = true, default-features = false }
surrealdb-types.workspace = true

# Other crates (anyhow used for import stream compat with core's execute_import)
anyhow.workspace = true
boxcar.workspace = true
async-channel.workspace = true
chrono = { workspace = true, features = ["serde"] }
futures.workspace = true
indexmap = { workspace = true, features = ["serde"] }
path-clean.workspace = true
semver = { workspace = true, features = ["serde"] }
serde = { workspace = true, features = ["derive"] }
serde_json.workspace = true
tracing.workspace = true
tokio-util = { workspace = true, features = ["compat"] }
url.workspace = true

# Optional crates
native-tls = { workspace = true, optional = true }
reqwest = { workspace = true, default-features = false, features = [
    "json",
    "multipart",
    "stream",
], optional = true }

[target.'cfg(target_family = "wasm")'.dependencies]
getrandom = { workspace = true, features = ["wasm_js"] }
js-sys = "0.3"
rustls = { workspace = true, optional = true, features = ["ring"] }
rustls-pki-types = { version = "1.14.0", features = ["web"] }
ring = { workspace = true, features = ["wasm32_unknown_unknown_js"] }
tokio = { workspace = true, default-features = false, features = [
    "rt",
    "sync",
] }
tokio-tungstenite-wasm.workspace = true
uuid = { workspace = true, features = ["serde", "js", "v4", "v7"] }
wasm-bindgen = "0.2"
wasm-bindgen-futures.workspace = true
wasmtimer = { workspace = true, default-features = false, features = ["tokio"] }
web-sys = { version = "0.3", features = ["Window", "Request", "RequestInit", "Response"] }

[target.'cfg(not(target_family = "wasm"))'.dependencies]
rustls = { workspace = true, optional = true, features = ["aws_lc_rs"] }
tokio = { workspace = true, default-features = false, features = [
    "macros",
    "io-util",
    "io-std",
    "fs",
    "rt-multi-thread",
    "time",
    "sync",
] }
tokio-tungstenite = { workspace = true, optional = true, features = ["url"] }
uuid = { workspace = true, features = ["serde", "v4", "v7"] }

[dev-dependencies]
ciborium.workspace = true
criterion = { workspace = true, features = ["async_tokio"] }
env_logger.workspace = true
flate2.workspace = true
parking_lot.workspace = true
pprof = { workspace = true, features = ["flamegraph", "criterion"] }
radix_trie.workspace = true
rand.workspace = true
rayon.workspace = true
regex.workspace = true
rstest.workspace = true
serial_test.workspace = true
temp-dir.workspace = true
test-log = { workspace = true, features = ["trace"] }
time = { workspace = true, features = ["serde"] }
tokio = { workspace = true, features = ["macros", "sync", "rt-multi-thread"] }
tracing-subscriber = { workspace = true, features = ["env-filter"] }
ulid = { workspace = true, features = ["serde"] }
wiremock.workspace = true

[lints]
workspace = true

[lib]
name = "surrealdb" # Needed for the nightly crate as we will be renaming it
bench = false

[[bench]]
name = "parser"
harness = false

[[bench]]
name = "processor"
harness = false

[[bench]]
name = "hash_trie_btree"
harness = false

[[bench]]
name = "index_hnsw"
harness = false

[[bench]]
name = "move_vs_clone"
harness = false

[[bench]]
name = "sdb"
harness = false

[[bench]]
name = "hashset_vs_vector"
harness = false

[[bench]]
name = "array_uniq"
harness = false

[[bench]]
name = "array_complement"
harness = false

[[bench]]
name = "array_difference"
harness = false

[[bench]]
name = "array_intersect"
harness = false
