@mestra-dev/contract 0.0.13 → 0.0.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -1
- package/dist/index.d.ts +860 -48
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -27,9 +27,18 @@ import { hc } from 'hono/client'
|
|
|
27
27
|
const client = hc<AppType>('https://api.mestra.chat/')
|
|
28
28
|
|
|
29
29
|
const res = await client.auth.me.$get()
|
|
30
|
-
|
|
30
|
+
|
|
31
|
+
if (res.ok) {
|
|
32
|
+
const data = await res.json()
|
|
33
|
+
} else if (res.status === 403) {
|
|
34
|
+
const err = await res.json() // { success: false, error: string }
|
|
35
|
+
} else if (res.status === 404) {
|
|
36
|
+
const err = await res.json()
|
|
37
|
+
}
|
|
31
38
|
```
|
|
32
39
|
|
|
40
|
+
`AppType` includes per-route error bodies (400/403/404/…) plus global middleware errors (JWT, workspace access, rate limit → 400/401/403/404/429/500).
|
|
41
|
+
|
|
33
42
|
Always use `import type` so the bundler never pulls server code.
|
|
34
43
|
|
|
35
44
|
## Build (maintainers)
|