Jint.Workflows
0.2.0
dotnet add package Jint.Workflows --version 0.2.0
NuGet\Install-Package Jint.Workflows -Version 0.2.0
<PackageReference Include="Jint.Workflows" Version="0.2.0" />
<PackageVersion Include="Jint.Workflows" Version="0.2.0" />
<PackageReference Include="Jint.Workflows" />
paket add Jint.Workflows --version 0.2.0
#r "nuget: Jint.Workflows, 0.2.0"
#:package Jint.Workflows@0.2.0
#addin nuget:?package=Jint.Workflows&version=0.2.0
#tool nuget:?package=Jint.Workflows&version=0.2.0
Jint.Workflows
Durable JavaScript workflows for .NET using Jint. Write long-running orchestration logic as async JavaScript, suspend execution at any await, serialize the state, and resume later β potentially days later, in a different process. Uses deterministic replay on top of Jint's public API, with zero engine modifications.
Influenced by Vercel's Workflow SDK, adapted for the .NET / Jint environment.
β¨ Features
- πΎ Tiny, portable state β serialized state is a compact JSON journal of results; store it anywhere
- β³ Suspend for days β pause at any
await, persist, resume in a different process - π Deterministic replay β
Date.now(),new Date(),Math.random()overridden for stable replays - π‘οΈ Journaled side effects β step functions execute once and replay from cache
- π©Ή Policy-based retries β attach Foundatio.Resilience policies for in-process retry, or throw
RetryableStepExceptionfor durable cross-restart retries - π Browser-compatible
fetchβ opt-in WHATWGfetchwith.json(),.text(),.clone() - π£ Named external events β
waitForEvent('name')single or multi-event, with timeout support - π Fan-out/fan-in β
Promise.allandPromise.raceover steps and suspends - βΎοΈ Continue As New β restart with a fresh journal to avoid unbounded growth
- π οΈ Journal compatibility check β script drift fails fast with a clear diagnostic
π Get Started
dotnet add package Jint.Workflows
using Jint.Workflows;
var workflow = new WorkflowEngine();
workflow.RegisterSuspendFunction("sleep", args => DurationParser.Parse(args[0]));
workflow.RegisterStepFunction("fetchOrder", args => orderService.GetOrder((string)args[0]!));
workflow.RegisterSuspendFunction("getApproval");
var script = """
async function processOrder(orderId) {
const order = await fetchOrder(orderId);
await sleep('3d');
const approved = await getApproval('manager', orderId);
return approved ? 'shipped' : 'cancelled';
}
""";
var result = workflow.RunWorkflow(script, "processOrder", "ORD-001");
// result.Status == Suspended, result.Suspension.ResumeAt β 3 days from now
var json = result.State!.Serialize(); // persist anywhere
// ... 3 days later, in a different process
var resumed = workflow.ResumeWorkflow(script, json);
π Getting Started Guide β step-by-step setup, step functions, suspend functions, and replay.
π¦ CI Packages (Feedz)
Want the latest CI build before it hits NuGet? Add the Feedz source (read-only public) and install the pre-release version:
dotnet nuget add source https://f.feedz.io/foundatio/foundatio/nuget -n foundatio-feedz
dotnet add package Jint.Workflows --prerelease
Or add to your NuGet.config:
<configuration>
<packageSources>
<add key="foundatio-feedz" value="https://f.feedz.io/foundatio/foundatio/nuget" />
</packageSources>
<packageSourceMapping>
<packageSource key="foundatio-feedz">
<package pattern="Foundatio.*" />
<package pattern="Jint.Workflows" />
</packageSource>
</packageSourceMapping>
</configuration>
π€ Contributing
Contributions are welcome! See the documentation for how the engine works and what edits are safe across versions.
π Related Projects
- Jint β the JavaScript interpreter this library is built on
- Vercel Workflow SDK β the primary source of inspiration for the replay-based durable workflow model
- Azure Durable Functions β canonical .NET implementation of the deterministic replay pattern
- Temporal / Restate β full workflow runtimes with the same replay model at a larger scope
π License
Apache-2.0 License
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.