Runtime evaluation, batch execution, two-tier (L1 + L2) cache orchestration,
and deterministic test stubbing for JevDSL contract modules.
Every module that invokes use JevDSL automatically receives evaluate/3,
evaluate!/3, evaluate_many/3, available?/2, and cache_key/2 delegated
to JevDSL.Runner.
Telemetry Events
JevDSL.Runner emits :telemetry.span/3 events:
[:jev_dsl, :evaluate, :start | :stop | :exception]— Metadata:%{module: module(), contract: atom() | String.t(), status: :ok | :error}.[:jev_dsl, :evaluate_many, :start | :stop | :exception]— Metadata:%{module: module(), contract: atom() | String.t(), count: non_neg_integer()}.
Summary
Functions
Resolves the trimmed TYPESAFE_API_KEY from opts, application config, or environment.
Returns true if the contract module can execute evaluations — either via an injected
1-arity test function (:eval_fn or :eval_fn_key), an explicit %SystemOneSDK.Client{} (:client),
a configured TYPESAFE_API_KEY, or an enabled Tier-2 cache (:tier2_cache).
Evaluates a single state map against contract_key defined in contract_mod.
Evaluates a single state map against contract_key or raises JevDSL.Error / SystemOneSDK.Error.
Evaluates a list of states concurrently against contract_key using SystemOneSDK.evaluate_many/4.
Resolves L1 and L2 cache hits first and only dispatches uncached misses over the network,
returning results in the exact order of states.
Returns true if a non-empty TYPESAFE_API_KEY is available.
Functions
Resolves the trimmed TYPESAFE_API_KEY from opts, application config, or environment.
Returns true if the contract module can execute evaluations — either via an injected
1-arity test function (:eval_fn or :eval_fn_key), an explicit %SystemOneSDK.Client{} (:client),
a configured TYPESAFE_API_KEY, or an enabled Tier-2 cache (:tier2_cache).
@spec evaluate(module(), atom() | String.t(), map(), keyword()) :: {:ok, SystemOneSDK.SystemOneResponse.t() | map()} | {:error, term()}
Evaluates a single state map against contract_key defined in contract_mod.
Options
:cache?- Enables L1/L2 caching (default:true).:cache- L1 cache module implementingJevDSL.Cache(default: module's configured:cacheorJevDSL.Cache.ETS).:tier2_cache- Optional L2 durable cache module implementingJevDSL.Cache.:use_tier2_cache- Allows serving L2 cache hits even whenTYPESAFE_API_KEYis unset (default:true).:persist_tier2- Persists new live evaluations and backfills L1 hits into L2 (default:true).:cache_only- Whentrue, resolves only from L1/L2 caches without making live network calls, returning{:error, :cache_miss}on misses.:eval_fn- A 1-arity mock functionfn state -> {:ok, resp} endfor deterministic unit testing.:eval_fn_key- Custom option key holding a 1-arity mock function (default::eval_fn).:eval_fn_state- Custom state map passed to the mockeval_fnwhen test assertions inspect extra fields.:client- Pre-configured%SystemOneSDK.Client{}(includingSystemOneSDK.Test.client()).:typesafe_api_key/:api_key- Explicit API key override.:base_url/:model/:timeout/:timeout_ms/:retry- Forwarded toSystemOneSDK.
@spec evaluate!(module(), atom() | String.t(), map(), keyword()) :: SystemOneSDK.SystemOneResponse.t() | map()
Evaluates a single state map against contract_key or raises JevDSL.Error / SystemOneSDK.Error.
@spec evaluate_many(module(), atom() | String.t(), [map()], keyword()) :: [ ok: SystemOneSDK.SystemOneResponse.t() | map(), error: term() ]
Evaluates a list of states concurrently against contract_key using SystemOneSDK.evaluate_many/4.
Resolves L1 and L2 cache hits first and only dispatches uncached misses over the network,
returning results in the exact order of states.
Returns true if a non-empty TYPESAFE_API_KEY is available.