feat(wfe-deno): Deno bindings for the WFE workflow engine

This commit is contained in:
2026-04-05 22:06:07 +01:00
parent afb91c66bd
commit 9a08882e28
14 changed files with 1934 additions and 1 deletions

22
wfe-deno/src/ops/event.rs Normal file
View File

@@ -0,0 +1,22 @@
use deno_core::op2;
use deno_core::OpState;
use crate::state::WfeState;
/// Publish an event to the workflow host for matching subscriptions.
#[op2]
pub async fn op_publish_event(
state: std::rc::Rc<std::cell::RefCell<OpState>>,
#[string] event_name: String,
#[string] event_key: String,
#[serde] data: serde_json::Value,
) -> Result<(), deno_error::JsErrorBox> {
let host = {
let s = state.borrow();
let wfe = s.borrow::<WfeState>();
wfe.host()?.clone()
};
host.publish_event(&event_name, &event_key, data)
.await
.map_err(|e| deno_error::JsErrorBox::generic(format!("publish_event failed: {e}")))
}