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
46 changes: 46 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,52 @@

All notable changes to `@monarcode/effetch`, newest first.

## 0.1.0-rc.0

### Added

- `client.endpoint(route, definition)` saves a call: a route such as
`"GET /users/:id"` with its `output`, `error` and `input` schemas, `headers`
and plugin overrides. It returns a function that takes one call's `params`,
`query`, `body`, `headers` and `plugins`, and sends what the equivalent
method would.
- The route is type-checked (an uppercase method, one space, then a path
starting with `/` or an absolute `http(s)://` URL), and editors suggest
the methods.
- With an `input` schema, `body` is required. `GET`, `HEAD`, `OPTIONS` and
`TRACE` endpoints reject `body` and `input`.
- A call's `headers` and plugin overrides are merged over the endpoint's,
and win. Plugin options given by both are merged.
- Each endpoint has `route`, `method` and `path` properties.
- The types `Endpoint`, `EndpointMethod`, `EndpointDefinition`,
`EndpointOptions`, `EndpointBody`, `EndpointArgs`, `EndpointRoute`,
`ValidRoute`, `RouteMethod` and `RoutePath`.
- Plugins see each call's route: its method and path before the params are
filled in, such as `"GET /users/:id"`, the same for a method call and an
endpoint. Hooks get it as `ctx.route` (`PluginContext.route`), and `wrap`
as a third argument, an `Effect` like `options`. It's `undefined` for
requests sent through `client.httpClient`.
- `logger` adds the route to its log annotations, as `route`.

### Changed

- `CallServices` and `CallEffect` accept `undefined` for the `input` schema
`I`, as they already did for `O`.

### Documentation

- The README is reorganized as a guide that reads top to bottom: why effetch
(with a side-by-side with `HttpClient`), getting started, then clients,
calls, errors, plugins and writing them, endpoints, structuring an app and
testing, with a two-level table of contents.
- The README's Endpoints section explains why endpoints exist, when to use
one rather than a method, and how to organize them: in one service for a
small app, in each module for a feature-sliced app, and with several
backends.
- New examples: `endpoints.ts`, `backends.ts`, and `app/`, a feature-sliced
app with shared clients and module-owned endpoints. `examples/README.md`
says what each example shows.

## 0.1.0-alpha.2

### Changed
Expand Down
Loading
Loading