[package]
name = "endpoint-libs"
version = "1.7.2"
edition = "2024"
authors = ["Veon <dveonloch@protonmail.com>"]
description = "Common dependencies to be used with Pathscale projects, projects that use [endpoint-gen](https://github.com/pathscale/endpoint-gen), and projects that use honey_id-types."
repository = "https://github.com/pathscale/endpoint-libs"
readme = "README.md"
license = "MIT"

[features]
default = ["types"]
full = [
    "types",
    "ws",
    "database",
    "signal",
    "scheduler",
    "log_reader",
    "error_aggregation",
    "log_throttling",
    "ws-http1",
    "ws-tls12",
]
types = []
ws = [
    # Features ws depends on
    "types",
    "signal",
    # Feature dependencies
    "dep:tokio-tungstenite",
    "dep:tokio-rustls",
    "dep:rustls",
    "dep:rustls-pemfile",
    "dep:parking_lot",
    "dep:dashmap",
    "dep:reqwest",
    "dep:async-trait",
    "dep:hyper",
    "dep:hyper-util",
    "dep:http-body-util",
    "dep:httpdate",
    "dep:webpki-roots",
    # "dep:",
]
database = [
    # Feature dependencies
    "dep:tokio-postgres",
    "dep:dashmap",
    "dep:secrecy",
    "dep:postgres-from-row",
    "dep:deadpool-postgres",
    # "dep:",
]
signal = [
    # Feature dependencies
    "dep:tokio-util",
    "dep:lazy_static",
    # "dep:",
]
scheduler = [
    # Feature dependencies
    "dep:tokio-cron-scheduler",
    # "dep:",
]
log_reader = [
    # Feature dependencies
    "dep:tempfile",
    "dep:regex",
    "dep:rev_lines",
    "dep:lazy_static",
    # "dep:",
]
error_aggregation = [
    # Feature dependencies
    "dep:regex",
    "dep:lazy_static",
    # "dep:",
]
log_throttling = ["dep:tracing-throttle"]
s3-sync = ["cert-provider/s3-sync"]
ws-http1 = ["hyper/http1"]
ws-tls12 = ["rustls/tls12", "tokio-rustls/tls12"]

[dependencies]
serde = { version = "1.0", features = ["derive"] }
serde_json = { version = "1.0", features = ["raw_value"] }
eyre = "0.6"
convert_case = "0.6"
itertools = "0.12"
clap = { version = "4.5", features = ["derive", "env"] }
futures = "0.3"
tracing = "0.1"
tracing-subscriber = { version = "0.3", features = [
    "env-filter",
    "std",
    "fmt",
] }
bytes = "1.7"
chrono = "0.4"
urlencoding = "2.1"
hex = "0.4"
rust_decimal = "1.36"
tracing-appender = "0.2"
serde_path_to_error = "0.1"
alloy-primitives = { version = "1.3.0", features = [
    "std",
], default-features = false }

# Optional dependencies
tokio-tungstenite = { version = "0.29.0", default-features = false, features = [
    "rustls-tls-webpki-roots",
    "connect",
], optional = true }
tokio-rustls = { version = "0.26", optional = true, default-features = false, features = ["ring", "logging"] }
rustls-pemfile = { version = "2.1", optional = true }
rustls = { version = "0.23", optional = true, default-features = false, features = ["ring", "logging", "std"] }
tokio = { version = "1.39", features = ["full"] }
tokio-util = { version = "0.7", optional = true }
tokio-cron-scheduler = { version = "0.11", optional = true }
tokio-postgres = { version = "0.7", optional = true }
postgres-from-row = { version = "0.5", optional = true }
deadpool-postgres = { version = "0.14", features = ["serde"], optional = true }
parking_lot = { version = "0.12", optional = true }
dashmap = { version = "6.0", optional = true }
reqwest = { version = "0.12", default-features = false, features = [
    "rustls-tls-webpki-roots",
    "charset",
    "http2",
    "system-proxy",
], optional = true }
secrecy = { version = "0.8", features = ["serde"], optional = true }
tempfile = { version = "3.19", optional = true }
regex = { version = "1.5", optional = true }
rev_lines = { version = "0.3", optional = true }
lazy_static = { version = "1.5", optional = true }
async-trait = { version = "0.1", optional = true }
hyper = { version = "1", features = ["http2", "server", "client"], optional = true }
hyper-util = { version = "0.1", features = ["tokio", "server-auto"], optional = true }
http-body-util = { version = "0.1", optional = true }
httpdate = { version = "1.0", optional = true }
tracing-throttle = { version = "0.4", features = ["async"], optional = true }
webpki-roots = { version = "1.0.7", optional = true }
# Force bundled CA roots for hyper-rustls (used by instant-acme inside cert-provider)
hyper-rustls = { version = "0.27.9", default-features = false, features = ["webpki-tokio"] }

# OpenTelemetry dependencies (default feature)
opentelemetry = { version = "0.31", features = ["logs"] }
opentelemetry_sdk = { version = "0.31", features = ["rt-tokio", "logs"] }
opentelemetry-otlp = { version = "0.31", features = ["trace", "logs", "http-proto"] }
opentelemetry-semantic-conventions = "0.31"
tracing-opentelemetry = "0.32"
opentelemetry-appender-tracing = "0.31"
# Direct deps for header configuration
tonic = "0.14"

[dev-dependencies]
tempfile = "3.19"
tokio = { version = "1.39", features = ["full", "test-util"] }
tracing-throttle = { version = "0.4", features = ["async", "test-helpers"] }
uuid = { version = "1", features = ["v4", "serde"] }
cert-provider = {git = "https://github.com/dVeon-loch/cert-provider.git", features = ["dns01"]}

[[example]]
name = "ws_echo_rustls"
required-features = ["ws"]

[[example]]
name = "ws_echo_ws_client"
required-features = ["ws"]

[[example]]
name = "ws_echo_server"
path = "examples/ws-echo/main.rs"
required-features = ["ws"]

[package.metadata.cargo-all-features]

# Always include these features in combinations.
# These features should not be included in `skip_feature_sets` or `denylist`, they get
# added in later
always_include_features = ["types"]

# Exclude certain features from the build matrix
denylist = [
    "full",           # full is redundant to include in the matrix
    "log_throttling", # log_throttling is currently not working
]

# Features "foo" and "bar" are incompatible, so skip permutations including them
# skip_feature_sets = [
#     ["foo", "bar"],
# ]

# If your crate has a large number of optional dependencies, skip them for speed
# skip_optional_dependencies = true

# Add back certain optional dependencies that you want to include in the permutations
# extra_features = [
#     "log",
# ]

# The maximum number of features to try at once. Does not count features from `always_include_features`.
# This is useful for reducing the number of combinations run for a crate with a large amount of features,
# since in most cases a bug just needs a small set of 2-3 features to reproduce.
# max_combination_size = 4

# Only include certain features in the build matrix
#(incompatible with `denylist`, `skip_optional_dependencies`, and `extra_features`)
# allowlist = ["foo", "bar"]

# Disable the entire package from being tested (useful in a workspace)
# skip_package = true
