MVFM

fetch

Implementation of the WHATWG Fetch API. The plugin models request/response operations as explicit AST nodes.

Use this for deterministic HTTP interaction patterns, including status/header/body extraction.

import { fetch, wrapFetch, createFetchInterpreter } from "@mvfm/plugin-fetch";

// 1. Wrap the global fetch (or provide a custom implementation)
const client = wrapFetch(globalThis.fetch);

// 2. Build the interpreter
const fetchInterp = createFetchInterpreter(client);

// 3. Merge and run
const app = mvfm(prelude, fetch);
const baseInterp = defaults(app);
await fold(baseInterp, prog);