@xapi-js/adaptor-hono 1.4.0 → 1.4.1

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 +20 -4
  2. package/package.json +2 -2
package/README.md CHANGED
@@ -1,6 +1,14 @@
1
1
  # @xapi-js/adaptor-hono
2
2
 
3
- Typed X-API handlers for Hono.
3
+ Schema-typed X-API handlers for Hono.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ pnpm add @xapi-js/core @xapi-js/adaptor-hono hono
9
+ ```
10
+
11
+ ## Usage
4
12
 
5
13
  ```ts
6
14
  import { xapi } from '@xapi-js/core';
@@ -15,16 +23,24 @@ const search = xapi.operation({
15
23
  }),
16
24
  response: xapi.root({
17
25
  datasets: {
18
- output: xapi.dataset({ id: xapi.int(), name: xapi.string() }),
26
+ users: xapi.dataset({ id: xapi.int(), name: xapi.string() }),
19
27
  },
20
28
  }),
21
29
  });
22
30
 
23
31
  const app = new Hono();
24
- app.post('/xapi', xapiHono(search, async request => ({
32
+ app.post('/xapi', xapiHono(search, request => ({
25
33
  parameters: {},
26
34
  datasets: {
27
- output: request.datasets.input.map(({ id }) => ({ id, name: `user-${id}` })),
35
+ users: request.datasets.input.map(({ id }) => ({ id, name: `user-${id}` })),
28
36
  },
29
37
  })));
30
38
  ```
39
+
40
+ The handler request and response are inferred from the operation and converted
41
+ to and from X-API XML automatically.
42
+
43
+ ---
44
+
45
+ Hono 핸들러의 요청과 응답 타입은 operation schema에서 자동 추론되며 X-API
46
+ XML 변환도 어댑터가 처리합니다.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@xapi-js/adaptor-hono",
3
3
  "type": "module",
4
- "version": "1.4.0",
4
+ "version": "1.4.1",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.js",
7
7
  "types": "./dist/index.d.ts",
@@ -31,7 +31,7 @@
31
31
  "author": "Clickin <josh87786@gmail.com>",
32
32
  "license": "MIT",
33
33
  "dependencies": {
34
- "@xapi-js/core": "1.4.0"
34
+ "@xapi-js/core": "1.4.1"
35
35
  },
36
36
  "peerDependencies": {
37
37
  "hono": "^4.0.0"