@wooksjs/http-body 0.6.2 → 0.6.3

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/dist/index.cjs CHANGED
@@ -42,6 +42,22 @@ function assertKey(k) {
42
42
 
43
43
  //#endregion
44
44
  //#region packages/http-body/src/body.ts
45
+ /**
46
+ * Composable that provides request body parsing utilities for various content types.
47
+ *
48
+ * @example
49
+ * ```ts
50
+ * app.post('/api/data', async () => {
51
+ * const { parseBody, isJson } = useBody()
52
+ * if (isJson()) {
53
+ * const data = await parseBody<{ name: string }>()
54
+ * return { received: data.name }
55
+ * }
56
+ * })
57
+ * ```
58
+ *
59
+ * @returns Object with content-type checkers (`isJson`, `isHtml`, `isXml`, `isText`, `isBinary`, `isFormData`, `isUrlencoded`), a `parseBody` function, and `rawBody` accessor.
60
+ */
45
61
  function useBody() {
46
62
  const { store } = (0, __wooksjs_event_http.useHttpContext)();
47
63
  const { init } = store("request");
package/dist/index.d.ts CHANGED
@@ -1,3 +1,19 @@
1
+ /**
2
+ * Composable that provides request body parsing utilities for various content types.
3
+ *
4
+ * @example
5
+ * ```ts
6
+ * app.post('/api/data', async () => {
7
+ * const { parseBody, isJson } = useBody()
8
+ * if (isJson()) {
9
+ * const data = await parseBody<{ name: string }>()
10
+ * return { received: data.name }
11
+ * }
12
+ * })
13
+ * ```
14
+ *
15
+ * @returns Object with content-type checkers (`isJson`, `isHtml`, `isXml`, `isText`, `isBinary`, `isFormData`, `isUrlencoded`), a `parseBody` function, and `rawBody` accessor.
16
+ */
1
17
  declare function useBody(): {
2
18
  isJson: () => boolean;
3
19
  isHtml: () => boolean;
package/dist/index.mjs CHANGED
@@ -19,6 +19,22 @@ function assertKey(k) {
19
19
 
20
20
  //#endregion
21
21
  //#region packages/http-body/src/body.ts
22
+ /**
23
+ * Composable that provides request body parsing utilities for various content types.
24
+ *
25
+ * @example
26
+ * ```ts
27
+ * app.post('/api/data', async () => {
28
+ * const { parseBody, isJson } = useBody()
29
+ * if (isJson()) {
30
+ * const data = await parseBody<{ name: string }>()
31
+ * return { received: data.name }
32
+ * }
33
+ * })
34
+ * ```
35
+ *
36
+ * @returns Object with content-type checkers (`isJson`, `isHtml`, `isXml`, `isText`, `isBinary`, `isFormData`, `isUrlencoded`), a `parseBody` function, and `rawBody` accessor.
37
+ */
22
38
  function useBody() {
23
39
  const { store } = useHttpContext();
24
40
  const { init } = store("request");
package/package.json CHANGED
@@ -1,50 +1,51 @@
1
1
  {
2
2
  "name": "@wooksjs/http-body",
3
- "version": "0.6.2",
3
+ "version": "0.6.3",
4
4
  "description": "@wooksjs/http-body",
5
- "main": "dist/index.cjs",
6
- "module": "dist/index.mjs",
7
- "types": "dist/index.d.ts",
8
- "files": [
9
- "dist"
10
- ],
11
- "exports": {
12
- "./package.json": "./package.json",
13
- ".": {
14
- "require": "./dist/index.cjs",
15
- "import": "./dist/index.mjs",
16
- "types": "./dist/index.d.ts"
17
- }
18
- },
19
- "repository": {
20
- "type": "git",
21
- "url": "git+https://github.com/wooksjs/wooksjs.git",
22
- "directory": "packages/http-body"
23
- },
24
5
  "keywords": [
25
- "http",
26
- "wooks",
6
+ "api",
7
+ "app",
27
8
  "composables",
28
- "web",
29
9
  "framework",
30
- "app",
31
- "api",
10
+ "http",
11
+ "prostojs",
32
12
  "rest",
33
13
  "restful",
34
- "prostojs"
14
+ "web",
15
+ "wooks"
35
16
  ],
36
- "author": "Artem Maltsev",
37
- "license": "MIT",
17
+ "homepage": "https://github.com/wooksjs/wooksjs/tree/main/packages/http-body#readme",
38
18
  "bugs": {
39
19
  "url": "https://github.com/wooksjs/wooksjs/issues"
40
20
  },
41
- "homepage": "https://github.com/wooksjs/wooksjs/tree/main/packages/http-body#readme",
42
- "peerDependencies": {
43
- "@wooksjs/event-http": "^0.6.2"
21
+ "license": "MIT",
22
+ "author": "Artem Maltsev",
23
+ "repository": {
24
+ "type": "git",
25
+ "url": "git+https://github.com/wooksjs/wooksjs.git",
26
+ "directory": "packages/http-body"
27
+ },
28
+ "files": [
29
+ "dist"
30
+ ],
31
+ "main": "dist/index.cjs",
32
+ "module": "dist/index.mjs",
33
+ "types": "dist/index.d.ts",
34
+ "exports": {
35
+ "./package.json": "./package.json",
36
+ ".": {
37
+ "types": "./dist/index.d.ts",
38
+ "require": "./dist/index.cjs",
39
+ "import": "./dist/index.mjs"
40
+ }
44
41
  },
45
42
  "devDependencies": {
46
- "typescript": "^5.8.3",
47
- "vitest": "^3.2.4"
43
+ "typescript": "^5.9.3",
44
+ "vitest": "^3.2.4",
45
+ "@wooksjs/event-http": "^0.6.3"
46
+ },
47
+ "peerDependencies": {
48
+ "@wooksjs/event-http": "^0.6.3"
48
49
  },
49
50
  "scripts": {
50
51
  "build": "rolldown -c ../../rolldown.config.mjs"