Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,6 @@ coverage
routeTree.gen.ts
.tanstack
site/.impeccable

# Cloudflare's local Pages server
.wrangler
12 changes: 12 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,18 @@ to static files. It's a package in the pnpm workspace and isn't published.
`/llms.txt` and `/llms-full.txt` list the current line's pages. Link
between pages with root-relative paths, which the Markdown turns into
full URLs.
- Each docs page, and the landing page, has a link-preview image, drawn
with Takumi by `site/src/lib/og-image.tsx` and served at `/og/docs/<page>.png`
and `/og/home.png`. `vite.config.ts` lists them for the prerender, which
saves responses as text, so it asks for each image as base64 and writes
the bytes back. In dev, open an image's URL to see it.
- Pages prerender to flat files (`docs/calls/body.html`), which Cloudflare
Pages serves at the URL every link uses, `/docs/calls/body`. A page's
head comes from `pageHead` in `site/src/lib/shared.ts`: its canonical URL,
link preview, Markdown alternate and structured data. `robots.txt` and
`sitemap.xml` are routes too, and the sitemap lists the landing page and
the current line's pages. `npx wrangler pages dev site/dist/client`
serves a build the way Cloudflare does, redirects and headers included.
- The live docs deploy from the `site` branch, which the Release workflow
moves to each released commit; `main` and pull requests deploy as
previews. Don't push `site` yourself.
Expand Down
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,18 @@ All notable changes to `@monarcode/effetch`, newest first.
entries name, such as "Upgrading from 0.1.0-rc.3" and "Uploading files",
are now [Upgrade from 0.1.0-rc.3](https://effetch.pages.dev/docs/upgrading)
and [Upload files](https://effetch.pages.dev/docs/calls/uploads).
- Error messages for an endpoint passed to the wrong place no longer name
the client `client` (as in `client.bind`). They say "bind" or "your
client's endpoint or bind method", so they read the same whatever you
name your client.

### Fixed

- The documented TypeScript requirement is 5.7 or newer, not 5.4. Effetch's
declarations use typed arrays with a type argument, such as
`Uint8Array<ArrayBuffer>`, which TypeScript 5.6 and older reject. With
`skipLibCheck: true`, an older TypeScript compiles a project that uses
Effetch, but some of its types become `any`.

## 0.1.0-rc.4

Expand Down
18 changes: 10 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,10 @@ export const getTodo = (id: number) =>
// NetworkError | DecodeError | HttpError.With<unknown>, Api>
```

> **Release candidate.** Effetch is close to its first stable release
> (`0.1.0-rc.N`). The API is settled: release candidates add small, opt-in
> features and fixes, and the [changelog](./CHANGELOG.md) lists anything
> that needs a change in your code.
> **Release candidate.** Effetch is in release candidates (`0.1.0-rc.N`)
> on the way to `0.1.0`. A release candidate can still change the API, and
> when one does, the [changelog](./CHANGELOG.md) says what to change in your
> code.

## Documentation

Expand All @@ -77,8 +77,10 @@ You'll need:

- `effect` 4.x, which is a peer dependency;
- an ESM project, since the package is ESM only;
- TypeScript 5.4 or newer. With `skipLibCheck: false`, Effect's own
declarations need TypeScript 5.7 or newer.
- TypeScript 5.7 or newer.

[Compatibility](https://effetch.pages.dev/docs/reference/compatibility)
lists the runtimes Effetch is built for, and which of them CI tests.

## Quick start

Expand Down Expand Up @@ -139,10 +141,10 @@ Calling an API from a web page on another origin? Read
responses.
- [Errors](https://effetch.pages.dev/docs/errors): what a call can fail with, and how to
catch and type each error.
- [Plugins](https://effetch.pages.dev/docs/plugins): auth, retries, timeouts and logging, and
writing your own.
- [Endpoints](https://effetch.pages.dev/docs/endpoints): save routes with their schemas and
share them as a service.
- [Plugins](https://effetch.pages.dev/docs/plugins): auth, retries, timeouts and logging, and
writing your own.
- [Streaming responses](https://effetch.pages.dev/docs/streaming) and
[Pagination](https://effetch.pages.dev/docs/pagination).
- [Structure an app](https://effetch.pages.dev/docs/structuring-an-app).
Expand Down
3 changes: 2 additions & 1 deletion examples/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# Examples

Complete programs using Effetch. They're typechecked with the package
(`pnpm run typecheck`), so they always match the current API.
(`pnpm run typecheck`), so they match the API on the branch you're reading,
which on `main` can be ahead of the latest release.

| Example | What it shows |
| -------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------ |
Expand Down
6 changes: 3 additions & 3 deletions examples/backends.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ const session: { accessToken: string | undefined } = {
// Plugins are plain values, so both clients can share one token source.
const auth = bearer({ token: () => session.accessToken });

// `ctx.route` is a method and path, with no host: both backends could have a
// `GET /health`. A plugin shared across backends takes the backend's name,
// and each client gets its own instance.
// `ctx.route` is a method and path, without the base URL: both backends
// could have a `GET /health`. A plugin shared across backends takes the
// backend's name, and each client gets its own instance.
const reportErrors = (backend: string) =>
Fetch.plugin({
name: "reportErrors",
Expand Down
Loading
Loading