@forinda/kickjs-client 0.0.0
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 +31 -0
- package/package.json +57 -0
package/README.md
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# @forinda/kickjs-client
|
|
2
|
+
|
|
3
|
+
Typed fetch client for [KickJS](https://kickjs.app/) APIs — end-to-end response
|
|
4
|
+
types powered by `kick typegen`'s `KickRoutes.Api` map.
|
|
5
|
+
|
|
6
|
+
```bash
|
|
7
|
+
pnpm add @forinda/kickjs-client
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
```ts
|
|
11
|
+
import { createClient } from '@forinda/kickjs-client'
|
|
12
|
+
|
|
13
|
+
const api = createClient<KickRoutes.Api>({ baseUrl: 'https://api.example.com/api/v1' })
|
|
14
|
+
|
|
15
|
+
const task = await api.get('/tasks/:id', { params: { id: '42' } })
|
|
16
|
+
// ^ the handler's actual response type — inferred, not declared
|
|
17
|
+
|
|
18
|
+
const created = await api.post('/tasks', { body: { title: 'Ship it' } })
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
- **Paths + params + body typed** from the generated `KickRoutes.Api`; response
|
|
22
|
+
types flow from your controller handlers (return-value style) via
|
|
23
|
+
`InferHandlerResponse`.
|
|
24
|
+
- **Runtime-neutral**: fetch/URL/Headers only — browsers, node ≥ 20, Bun, Deno,
|
|
25
|
+
edge workers. Zero dependencies.
|
|
26
|
+
- **Typed errors**: non-2xx throws `KickClientError` carrying the parsed body
|
|
27
|
+
(RFC 9457 problem details when the server used `ctx.problem`).
|
|
28
|
+
- **Injectable fetch**: pass `{ fetch: app.fetch }` from `@forinda/kickjs/web`
|
|
29
|
+
for network-free integration tests.
|
|
30
|
+
|
|
31
|
+
Docs: [kickjs.app/guide/typed-client](https://kickjs.app/guide/typed-client.html)
|
package/package.json
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@forinda/kickjs-client",
|
|
3
|
+
"version": "0.0.0",
|
|
4
|
+
"description": "Typed fetch client for KickJS APIs — end-to-end response types from the kick typegen KickRoutes augmentation",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"kickjs",
|
|
7
|
+
"typed-client",
|
|
8
|
+
"fetch",
|
|
9
|
+
"typescript",
|
|
10
|
+
"rpc",
|
|
11
|
+
"api-client"
|
|
12
|
+
],
|
|
13
|
+
"type": "module",
|
|
14
|
+
"main": "dist/index.mjs",
|
|
15
|
+
"types": "dist/index.d.mts",
|
|
16
|
+
"exports": {
|
|
17
|
+
".": {
|
|
18
|
+
"import": "./dist/index.mjs",
|
|
19
|
+
"types": "./dist/index.d.mts"
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
"files": [
|
|
23
|
+
"dist",
|
|
24
|
+
"README.md"
|
|
25
|
+
],
|
|
26
|
+
"scripts": {
|
|
27
|
+
"build": "tsdown",
|
|
28
|
+
"dev": "tsdown --watch",
|
|
29
|
+
"test": "vitest run --passWithNoTests",
|
|
30
|
+
"typecheck": "tsgo --noEmit",
|
|
31
|
+
"clean": "rm -rf dist .wireit"
|
|
32
|
+
},
|
|
33
|
+
"devDependencies": {
|
|
34
|
+
"@forinda/kickjs": "workspace:*",
|
|
35
|
+
"h3-v2": "npm:h3@2.0.1-rc.22",
|
|
36
|
+
"reflect-metadata": "^0.2.2",
|
|
37
|
+
"typescript": "^6.0.3",
|
|
38
|
+
"vitest": "^4.1.8"
|
|
39
|
+
},
|
|
40
|
+
"publishConfig": {
|
|
41
|
+
"access": "public"
|
|
42
|
+
},
|
|
43
|
+
"license": "MIT",
|
|
44
|
+
"author": "Felix Orinda",
|
|
45
|
+
"engines": {
|
|
46
|
+
"node": ">=20.0"
|
|
47
|
+
},
|
|
48
|
+
"homepage": "https://kickjs.app/",
|
|
49
|
+
"repository": {
|
|
50
|
+
"type": "git",
|
|
51
|
+
"url": "https://github.com/forinda/kick-js.git",
|
|
52
|
+
"directory": "packages/client"
|
|
53
|
+
},
|
|
54
|
+
"bugs": {
|
|
55
|
+
"url": "https://github.com/forinda/kick-js/issues"
|
|
56
|
+
}
|
|
57
|
+
}
|