ff_script/lib.rs
1//! Typed FCALL wrappers and Lua library loader for FlowFabric Valkey Functions.
2
3// Issue #171: modules that reach into `ferriskey::` are gated behind the
4// `valkey-client` feature (default-on). Without the feature, ff-script is
5// a pure Lua-source loader + typed error enum and re-exports for ff-core's
6// `EngineError` classification — sufficient for `ff-sdk
7// --no-default-features` consumers that do NOT want the Valkey transport.
8#[cfg(feature = "valkey-client")]
9#[macro_use]
10pub mod macros;
11pub mod engine_error_ext;
12pub mod error;
13#[cfg(feature = "valkey-client")]
14pub mod result;
15#[cfg(feature = "valkey-client")]
16pub mod loader;
17#[cfg(feature = "valkey-client")]
18pub mod retry;
19#[cfg(feature = "valkey-client")]
20pub mod functions;
21#[cfg(feature = "valkey-client")]
22pub mod stream_tail;
23
24pub use error::ScriptError;
25#[cfg(feature = "valkey-client")]
26pub use retry::{is_retryable_kind, kind_to_stable_str};
27
28/// The compiled FlowFabric Lua library source.
29///
30/// Generated from `lua/*.lua` by `scripts/gen-ff-script-lua.sh` and checked
31/// into the crate as `flowfabric.lua` so it ships inside the published
32/// tarball. CI (`matrix.yml`) fails if this file drifts from what the
33/// script would produce.
34pub const LIBRARY_SOURCE: &str = include_str!("flowfabric.lua");
35
36/// Expected library version. Must match `FCALL ff_version 0` return.
37///
38/// **Single source of truth is `lua/version.lua`.** The gen script
39/// extracts the `return 'X'` literal and writes it to
40/// `flowfabric_lua_version`. Bump `lua/version.lua` whenever any Lua
41/// function's KEYS or ARGV arity changes, or a new function is added.
42pub const LIBRARY_VERSION: &str = include_str!("flowfabric_lua_version");
43
44// Re-export the trait so callers can use it without reaching into result.
45#[cfg(feature = "valkey-client")]
46pub use result::FromFcallResult;