1mod include;
2mod stack;
3mod value;
4
5use std::{path::PathBuf, sync::Arc};
6
7pub use anyhow;
8pub use async_trait::async_trait;
9pub use include::IncludeAdaptor;
10pub use serde_json;
11pub use stack::Stack;
12pub use value::{SessionSearchResult, Vars, WildDocValue};
13
14pub use semilattice_database_session::{
15 search, Activity, CollectionRow, Condition, CustomOrderKey, CustomSort, DataOption, Depends,
16 FieldName, Order, Pend, SearchResult, Session, SessionCustomOrder, SessionDatabase,
17 SessionOrder, SessionOrderKey, SessionRecord, Term, Uuid,
18};
19
20use anyhow::Result;
21use parking_lot::Mutex;
22
23#[async_trait(?Send)]
24pub trait WildDocScript<I: IncludeAdaptor + Send> {
25 fn new(include_adaptor: Arc<Mutex<I>>, cache_dir: PathBuf, stack: &Stack) -> Result<Self>
26 where
27 Self: Sized;
28 async fn evaluate_module(&mut self, file_name: &str, src: &str, stack: &Stack) -> Result<()>;
29 async fn eval(&mut self, code: &str, stack: &Stack) -> Result<WildDocValue>;
30}