crate
weft_data
Data integrations for Weft apps.
Every integration builds plain Requests and parses Responses, so it's the same code in the browser (weft::web::fetch), on a server route (weft_api::send) and in tests. Parsers return template Values — lists of records ready for for … in.
| Module | Runs in | For |
|---|---|---|
supabase | browser | Postgres tables (PostgREST), RPC, auth, storage URLs |
contentful | browser | CMS entries with links resolved, rich text as Markdown |
wordpress | browser | Headless WordPress posts, pages and terms |
google | browser | Sheets, YouTube, Calendar, Places, Maps, OAuth |
mongodb | browser → your route | Collections, through a policy-checked API route |
halaxy | browser → your route | Practitioners and availability (FHIR), secret kept server-side |
Loading state for templates lives in Resource. source reads any src a component is given into a typed table: CSV, JSON, GraphQL, SDMX.
Modules
- contentful
Contentful: entries from the Content Delivery (or Preview) API, with linked entries and assets resolved and rich text turned into Markdown.
- google
Google APIs: Sheets, YouTube, Calendar, Places and Maps, with an API key (restrict it to your site's referrers in the Cloud console) or a user's OAuth access token (see
oauth_url/parse_oauth_redirect). - halaxy
Halaxy (practice management) through its FHIR R4 API. Credentials are a practice's API client id and secret, so requests go through a server route (generated by
weft add halaxy) that holds the secret, caches the access token and only passes on reads of the resources you allow — by default directory and availability data, never patient records. - html
Turning CMS HTML into Markdown (which templates render safely with
markdown(source: …)) or plain text. - http
- json
JSON → template values.
- mongodb
- relay
Sources the browser isn't allowed to read.
- source
Tabular data from a
src: where it comes from, how to ask for it, and how to read what comes back, from a CSV file to a statistics agency's API. - supabase
Supabase: tables through PostgREST, RPC, email/password auth and public storage URLs. The anon key is meant for browsers; row-level security decides what it can see.
- template
Sending templates' requests: a
load's data and the request commands (post,put…) in handlers. They go through the same loader as a chart'ssrc(source::send): fetch in the browser,public/files (or, withblocking, the network) during the build, a fake in tests. - wordpress
Headless WordPress through the REST API (
/wp-json/wp/v2): posts, pages, categories, tags and media. Content arrives as Markdown, ready formarkdown(source: post.body).
Structs
- Contentful
A Contentful space, read through its Content Delivery API (or the Preview API).
- Google
Google's APIs (Sheets, YouTube, Calendar, Places, Maps), with an API key or an OAuth access token.
- Halaxy
Server-side client: builds authorised requests.
- HalaxyProxy
Browser side: requests to your Halaxy route.
- Mongo
The browser side: builds commands for your API route.
- Request
An HTTP request, ready to send.
- Resource
Loading state for templates: bind it with [
Resource::bind] and fill it withweft::web::load(or [Resource::set]). - Response
An HTTP response.
- Supabase
A Supabase project: its tables (through PostgREST), RPC, auth and storage.
- WordPress
A WordPress site, read through its REST API (
/wp-json/wp/v2).