kayto_ts 0.1.7 → 0.1.9

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.
Files changed (2) hide show
  1. package/README.md +11 -2
  2. package/package.json +19 -13
package/README.md CHANGED
@@ -228,7 +228,7 @@ const clientWithHooks = clientApi<CatsEndpoints>({
228
228
 
229
229
  All requests return a discriminated union:
230
230
 
231
- - success: `{ ok: true, result, response }`
231
+ - success: `{ ok: true, responses, response }`
232
232
  - failure: `{ ok: false, error, response? }`
233
233
 
234
234
  `error.kind` values:
@@ -246,6 +246,15 @@ You can also handle them generically via `message` / `status` / `cause` without
246
246
  ```ts
247
247
  const result = await client.get("/api/cats");
248
248
 
249
+ if (result.ok) {
250
+ const success = result.responses[200];
251
+ console.log(success);
252
+ }
253
+ ```
254
+
255
+ ```ts
256
+ const result = await client.get("/api/cats");
257
+
249
258
  if (!result.ok) {
250
259
  console.error("Request failed:", result.error.message);
251
260
 
@@ -291,5 +300,5 @@ Client parses response body automatically by `content-type`:
291
300
  ## Notes
292
301
 
293
302
  - Runtime shape validation is not built in yet (current typing is compile-time only).
294
- - If you need runtime validation, validate `result.result` in consumer code (ArkType/Zod/etc.).
303
+ - If you need runtime validation, validate `result.responses[statusCode]` in consumer code (ArkType/Zod/etc.).
295
304
  - Current entrypoint is `src/index.ts`.
package/package.json CHANGED
@@ -1,34 +1,40 @@
1
1
  {
2
2
  "name": "kayto_ts",
3
- "version": "0.1.7",
4
- "repository": "https://github.com/vladislav-yemelyanov/kayto_ts",
5
- "main": "./dist/index.js",
6
- "module": "./dist/index.js",
7
- "devDependencies": {
8
- "@types/bun": "latest",
9
- "typescript": "^5.9.3"
3
+ "version": "0.1.9",
4
+ "description": "Type-safe HTTP client for working with kayto-generated endpoint schemas.",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "git+https://github.com/vladislav-yemelyanov/kayto_ts.git"
10
8
  },
11
- "peerDependencies": {
12
- "typescript": "^5"
9
+ "bugs": {
10
+ "url": "https://github.com/vladislav-yemelyanov/kayto_ts/issues"
13
11
  },
12
+ "homepage": "https://www.npmjs.com/package/kayto_ts",
13
+ "type": "module",
14
+ "main": "./dist/index.js",
15
+ "module": "./dist/index.js",
16
+ "types": "./dist/index.d.ts",
14
17
  "exports": {
15
18
  ".": {
16
19
  "types": "./dist/index.d.ts",
17
20
  "import": "./dist/index.js"
18
21
  }
19
22
  },
20
- "description": "Type-safe HTTP client for working with kayto-generated endpoint schemas.",
21
23
  "files": [
22
24
  "dist",
23
25
  "README.md",
24
26
  "LICENSE"
25
27
  ],
26
- "homepage": "https://www.npmjs.com/package/kayto_ts",
27
28
  "scripts": {
28
29
  "build": "tsc -p tsconfig.build.json",
29
30
  "prepublishOnly": "npm run build",
30
31
  "test": "bun test"
31
32
  },
32
- "type": "module",
33
- "types": "./dist/index.d.ts"
33
+ "devDependencies": {
34
+ "@types/bun": "latest",
35
+ "typescript": "^5.9.3"
36
+ },
37
+ "peerDependencies": {
38
+ "typescript": "^5"
39
+ }
34
40
  }