forgex 0.10.2

CLI and runtime for the Forge full-stack framework
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// Context API: ctx.step("name", || async { ... }), ctx.sleep(duration), ctx.wait_for_event(...).
// Step names are cache keys. Renaming breaks resume — bump the workflow version instead.

use forge::prelude::*;

#[forge::workflow(version = "v1", active, timeout = "1h")]
pub async fn {{name}}(ctx: &WorkflowContext, input: serde_json::Value) -> Result<serde_json::Value> {
    let stage1 = ctx
        .step("stage_one", || async {
            // TODO: real work
            Ok::<_, ForgeError>(serde_json::json!({ "stage": 1 }))
        })
        .run()
        .await?
        .expect("required step always returns Some");

    Ok(serde_json::json!({ "input": input, "stage1": stage1 }))
}