Current collected state Current
Observed since 20 Oct, 21:56 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
@01edu/api-client
Type-safe HTTP API Client
Tiny, type-safe HTTP API client meant to be used alongside the @01edu/api
router (see @01edu/api/router). It
builds a strongly-typed client from your server route definitions.
deno add jsr:@01edu/api-clientcreateClient for end-to-end typing.import { route } from '@01edu/api/router'
import { STR } from '@01edu/api/validator'
export const routes = {
'GET/hello': route({
input: { name: STR() },
output: { message: STR() },
fn: (_, { name }) => ({ message: `Hello, ${name}!` }),
}),
}
export type RoutesDefinitions = typeof routes
import { createClient } from '@01edu/api-client'
import type { RoutesDefinitions } from '/api/routes.ts' // types-only import from your backend
const api = createClient<RoutesDefinitions>('/api')
// One-shot call
const res = await api['GET/hello'].fetch({ name: 'Ada' })
// Reactive usage
const hello = api['GET/hello'].signal()
hello.fetch({ name: 'Ada' })
hello.$.subscribe((v) => console.log(v.pending, v.data, v.error))
Download counts and popularity will appear here as the collector receives them.
| Package / target | Requirement | Relationship |
|---|---|---|
picocolorsEnvironment{
"local_name": "picocolors",
"alias": false,
"peer_metadata": null
} | ^1.0.0 | development |
@preact/signalsEnvironment{
"local_name": "@preact/signals",
"alias": false,
"peer_metadata": null
} | ^2.5.1 | peer |
Source distribution
{
"shasum": "a45ebfa11aa865587b1ccb1eca0ccdfd18a30cfa",
"tarball": "https://registry.npmjs.org/@01edu/api-client/-/api-client-0.1.7.tgz",
"fileCount": 7,
"integrity": "sha512-4Ngu4ZIQwvumwP9NGCZNLpn1qlbPfAlUoWccgd8F68iZBx6H7Fx9wZ0Tyf8iVrfFwk9VABtD4TR0oxyYQfYsOQ==",
"signatures": [
{
"sig": "MEYCIQDMipUmHPslwfx9vZ15io9fD+XOPDoZW8kbmFwd5Vt69wIhAJu/MlsgFowlciw3BLbBa2UXgbBpUgcWPAAr7o00W2nf",
"keyid": "SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"
}
],
"attestations": {
"url": "https://registry.npmjs.org/-/npm/v1/attestations/@01edu%2fapi-client@0.1.7",
"provenance": {
"predicateType": "https://slsa.dev/provenance/v1"
}
},
"unpackedSize": 17518
}Observed since 20 Oct, 21:56 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
package_version:8babfe5edf4e6d75e5441f4665cc8b9a7948921eefe10fd3f1add80d3c4c3e82