@molecule/app-http 1.1.3 → 1.1.4
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 +42 -16
- package/dist/client.d.ts +9 -4
- package/dist/client.d.ts.map +1 -1
- package/dist/index.d.ts +14 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +14 -1
- package/dist/index.js.map +1 -1
- package/dist/types.d.ts +6 -2
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/dist/utilities.d.ts +14 -6
- package/dist/utilities.d.ts.map +1 -1
- package/dist/utilities.js +14 -6
- package/dist/utilities.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -3,7 +3,7 @@ AUTO-GENERATED — DO NOT EDIT THIS FILE.
|
|
|
3
3
|
Generated by `mlcl sync-docs` from the package's src/index.ts JSDoc + mlcl/registry.json.
|
|
4
4
|
Edits here are overwritten on the next commit (molecule's pre-commit hook regenerates).
|
|
5
5
|
To change this document, edit the module-level JSDoc in src/index.ts.
|
|
6
|
-
Generated: 2026-10-
|
|
6
|
+
Generated: 2026-10-17T07:08:43.988Z
|
|
7
7
|
-->
|
|
8
8
|
|
|
9
9
|
# @molecule/app-http
|
|
@@ -13,6 +13,16 @@ Client HTTP interface for molecule.dev.
|
|
|
13
13
|
Provides a unified HTTP client API that works across different
|
|
14
14
|
HTTP libraries (fetch, axios, ky, etc.).
|
|
15
15
|
|
|
16
|
+
**The body is the SECOND argument: `post(url, data, config?)` — likewise `put` and `patch`,
|
|
17
|
+
and the response is `HttpResponse<T>` (read `.data` for the body).** `data` IS the request
|
|
18
|
+
body; a plain object is serialized as the JSON body. Passing `{ data: body }` there is NOT a
|
|
19
|
+
config object — it makes the wire body `{"data":{…}}`, so the API sees an object whose only
|
|
20
|
+
key is `data`, finds none of the fields it validates, and answers
|
|
21
|
+
`422 {"errors":{"username":["can't be blank"],…}}`. Write `post('/users', { user })`, never
|
|
22
|
+
`post('/users', { data: { user } })`. The config object (headers, params, timeout,
|
|
23
|
+
`skipAuthGate`) is the THIRD argument. Only `request({ method, url, data, … })` takes `data`
|
|
24
|
+
inside an options object, because there that object IS the config.
|
|
25
|
+
|
|
16
26
|
> **Auto-generated, AI-first package reference** for the [molecule.dev](https://molecule.dev) ecosystem.
|
|
17
27
|
> It is written to be read by coding agents as much as by people, and is generated from this
|
|
18
28
|
> package's source — edit `src/index.ts` JSDoc, not this file.
|
|
@@ -31,7 +41,10 @@ function Plants() {
|
|
|
31
41
|
const res = await http.get<Plant[]>('/plants') // baseURL ('/api') is prepended
|
|
32
42
|
setPlants(res.data)
|
|
33
43
|
}
|
|
34
|
-
//
|
|
44
|
+
// Body-carrying verbs take the body as the SECOND argument:
|
|
45
|
+
// http.post('/plants', plant) — wire body is `plant`
|
|
46
|
+
// http.post('/plants', { data: plant }) — WRONG: wire body is `{"data": plant}`
|
|
47
|
+
// http.put(url, body), http.patch(url, body) and http.delete(url) are also available.
|
|
35
48
|
}
|
|
36
49
|
```
|
|
37
50
|
|
|
@@ -68,7 +81,8 @@ interface HttpClient {
|
|
|
68
81
|
defaultHeaders: Record<string, string>
|
|
69
82
|
|
|
70
83
|
/**
|
|
71
|
-
* Makes a generic HTTP request.
|
|
84
|
+
* Makes a generic HTTP request. `data` is a field of THIS config object — the same body
|
|
85
|
+
* `post(url, data, config)` takes as its second argument.
|
|
72
86
|
*/
|
|
73
87
|
request<T = unknown>(config: FullRequestConfig): Promise<HttpResponse<T>>
|
|
74
88
|
|
|
@@ -78,17 +92,21 @@ interface HttpClient {
|
|
|
78
92
|
get<T = unknown>(url: string, config?: RequestConfig): Promise<HttpResponse<T>>
|
|
79
93
|
|
|
80
94
|
/**
|
|
81
|
-
* Makes a POST request.
|
|
95
|
+
* Makes a POST request. `data` is the request BODY, not a config object: the wire body is
|
|
96
|
+
* `data` itself, so `post(url, { data: body })` sends `{"data":body}` — pass `body` directly.
|
|
97
|
+
* A config (headers, params) is the THIRD argument.
|
|
82
98
|
*/
|
|
83
99
|
post<T = unknown>(url: string, data?: unknown, config?: RequestConfig): Promise<HttpResponse<T>>
|
|
84
100
|
|
|
85
101
|
/**
|
|
86
|
-
* Makes a PUT request.
|
|
102
|
+
* Makes a PUT request. `data` is the request BODY (second argument) — never `{ data: body }`,
|
|
103
|
+
* which sends `{"data":body}`; a config is the THIRD argument.
|
|
87
104
|
*/
|
|
88
105
|
put<T = unknown>(url: string, data?: unknown, config?: RequestConfig): Promise<HttpResponse<T>>
|
|
89
106
|
|
|
90
107
|
/**
|
|
91
|
-
* Makes a PATCH request.
|
|
108
|
+
* Makes a PATCH request. `data` is the request BODY (second argument) — never `{ data: body }`,
|
|
109
|
+
* which sends `{"data":body}`; a config is the THIRD argument.
|
|
92
110
|
*/
|
|
93
111
|
patch<T = unknown>(url: string, data?: unknown, config?: RequestConfig): Promise<HttpResponse<T>>
|
|
94
112
|
|
|
@@ -229,7 +247,11 @@ interface RequestConfig {
|
|
|
229
247
|
signal?: AbortSignal
|
|
230
248
|
|
|
231
249
|
/**
|
|
232
|
-
* Request body data
|
|
250
|
+
* Request body data, as a field of THIS config object — the `request({ method, url, data })`
|
|
251
|
+
* form. The verb methods take the body as their SECOND argument: `post(url, data, config)`,
|
|
252
|
+
* `put(url, data, config)`, `patch(url, data, config)`. Never wrap it there as
|
|
253
|
+
* `{ data: body }`: that object is the body, so the wire sends `{"data":body}` and the API
|
|
254
|
+
* sees none of the fields at its top level.
|
|
233
255
|
*/
|
|
234
256
|
data?: unknown
|
|
235
257
|
|
|
@@ -286,7 +308,7 @@ interface FullRequestConfig extends RequestConfig {
|
|
|
286
308
|
url: string
|
|
287
309
|
|
|
288
310
|
/**
|
|
289
|
-
* Request body data.
|
|
311
|
+
* Request body data — a field of this config object, never a second argument here.
|
|
290
312
|
*/
|
|
291
313
|
data?: unknown
|
|
292
314
|
}
|
|
@@ -541,13 +563,17 @@ function get(url: string, config?: RequestConfig): Promise<HttpResponse<T>>
|
|
|
541
563
|
|
|
542
564
|
Makes a POST request using the bonded HTTP client.
|
|
543
565
|
|
|
566
|
+
The body is `data` — the SECOND argument. `post(url, { data: body })` sends the JSON body
|
|
567
|
+
`{"data":body}`, not `body`, so the API finds none of its fields at the top level; pass the
|
|
568
|
+
body directly (`post('/users', { user })`). The config is the THIRD argument.
|
|
569
|
+
|
|
544
570
|
```typescript
|
|
545
571
|
function post(url: string, data?: unknown, config?: RequestConfig): Promise<HttpResponse<T>>
|
|
546
572
|
```
|
|
547
573
|
|
|
548
574
|
- `url` — The request URL.
|
|
549
|
-
- `data` — The request body.
|
|
550
|
-
- `config` — Optional request configuration.
|
|
575
|
+
- `data` — The request body itself (never `{ data: body }`).
|
|
576
|
+
- `config` — Optional request configuration (headers, params, timeout).
|
|
551
577
|
|
|
552
578
|
**Returns:** The HTTP response with typed data.
|
|
553
579
|
|
|
@@ -559,9 +585,9 @@ Makes a PUT request using the bonded HTTP client.
|
|
|
559
585
|
function put(url: string, data?: unknown, config?: RequestConfig): Promise<HttpResponse<T>>
|
|
560
586
|
```
|
|
561
587
|
|
|
562
|
-
- `url` — The request URL.
|
|
563
|
-
- `data` — The request body.
|
|
564
|
-
- `config` — Optional request configuration.
|
|
588
|
+
- `url` — The request URL. The body is `data` — the SECOND argument, never `{ data: body }`.
|
|
589
|
+
- `data` — The request body itself.
|
|
590
|
+
- `config` — Optional request configuration (the third argument).
|
|
565
591
|
|
|
566
592
|
**Returns:** The HTTP response with typed data.
|
|
567
593
|
|
|
@@ -573,9 +599,9 @@ Makes a PATCH request using the bonded HTTP client.
|
|
|
573
599
|
function patch(url: string, data?: unknown, config?: RequestConfig): Promise<HttpResponse<T>>
|
|
574
600
|
```
|
|
575
601
|
|
|
576
|
-
- `url` — The request URL.
|
|
577
|
-
- `data` — The request body (partial update).
|
|
578
|
-
- `config` — Optional request configuration.
|
|
602
|
+
- `url` — The request URL. The body is `data` — the SECOND argument, never `{ data: body }`.
|
|
603
|
+
- `data` — The request body itself (the partial update).
|
|
604
|
+
- `config` — Optional request configuration (the third argument).
|
|
579
605
|
|
|
580
606
|
**Returns:** The HTTP response with typed data.
|
|
581
607
|
|
package/dist/client.d.ts
CHANGED
|
@@ -22,7 +22,8 @@ export interface HttpClient {
|
|
|
22
22
|
*/
|
|
23
23
|
defaultHeaders: Record<string, string>;
|
|
24
24
|
/**
|
|
25
|
-
* Makes a generic HTTP request.
|
|
25
|
+
* Makes a generic HTTP request. `data` is a field of THIS config object — the same body
|
|
26
|
+
* `post(url, data, config)` takes as its second argument.
|
|
26
27
|
*/
|
|
27
28
|
request<T = unknown>(config: FullRequestConfig): Promise<HttpResponse<T>>;
|
|
28
29
|
/**
|
|
@@ -30,15 +31,19 @@ export interface HttpClient {
|
|
|
30
31
|
*/
|
|
31
32
|
get<T = unknown>(url: string, config?: RequestConfig): Promise<HttpResponse<T>>;
|
|
32
33
|
/**
|
|
33
|
-
* Makes a POST request.
|
|
34
|
+
* Makes a POST request. `data` is the request BODY, not a config object: the wire body is
|
|
35
|
+
* `data` itself, so `post(url, { data: body })` sends `{"data":body}` — pass `body` directly.
|
|
36
|
+
* A config (headers, params) is the THIRD argument.
|
|
34
37
|
*/
|
|
35
38
|
post<T = unknown>(url: string, data?: unknown, config?: RequestConfig): Promise<HttpResponse<T>>;
|
|
36
39
|
/**
|
|
37
|
-
* Makes a PUT request.
|
|
40
|
+
* Makes a PUT request. `data` is the request BODY (second argument) — never `{ data: body }`,
|
|
41
|
+
* which sends `{"data":body}`; a config is the THIRD argument.
|
|
38
42
|
*/
|
|
39
43
|
put<T = unknown>(url: string, data?: unknown, config?: RequestConfig): Promise<HttpResponse<T>>;
|
|
40
44
|
/**
|
|
41
|
-
* Makes a PATCH request.
|
|
45
|
+
* Makes a PATCH request. `data` is the request BODY (second argument) — never `{ data: body }`,
|
|
46
|
+
* which sends `{"data":body}`; a config is the THIRD argument.
|
|
42
47
|
*/
|
|
43
48
|
patch<T = unknown>(url: string, data?: unknown, config?: RequestConfig): Promise<HttpResponse<T>>;
|
|
44
49
|
/**
|
package/dist/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAA;AAClG,OAAO,KAAK,EAAE,iBAAiB,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAEhF;;;;GAIG;AACH,MAAM,WAAW,UAAU;IACzB;;OAEG;IACH,OAAO,EAAE,MAAM,CAAA;IAEf;;OAEG;IACH,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAEtC
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAA;AAClG,OAAO,KAAK,EAAE,iBAAiB,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAEhF;;;;GAIG;AACH,MAAM,WAAW,UAAU;IACzB;;OAEG;IACH,OAAO,EAAE,MAAM,CAAA;IAEf;;OAEG;IACH,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAEtC;;;OAGG;IACH,OAAO,CAAC,CAAC,GAAG,OAAO,EAAE,MAAM,EAAE,iBAAiB,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAAA;IAEzE;;OAEG;IACH,GAAG,CAAC,CAAC,GAAG,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,aAAa,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAAA;IAE/E;;;;OAIG;IACH,IAAI,CAAC,CAAC,GAAG,OAAO,EA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ACH,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAEvC;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAA;IAEhB;;OAEG;IACH,eAAe,CAAC,EAAE,OAAO,CAAA;IAEzB;;;;;;;OAOG;IACH,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB"}
|
package/dist/index.d.ts
CHANGED
|
@@ -4,6 +4,16 @@
|
|
|
4
4
|
* Provides a unified HTTP client API that works across different
|
|
5
5
|
* HTTP libraries (fetch, axios, ky, etc.).
|
|
6
6
|
*
|
|
7
|
+
* **The body is the SECOND argument: `post(url, data, config?)` — likewise `put` and `patch`,
|
|
8
|
+
* and the response is `HttpResponse<T>` (read `.data` for the body).** `data` IS the request
|
|
9
|
+
* body; a plain object is serialized as the JSON body. Passing `{ data: body }` there is NOT a
|
|
10
|
+
* config object — it makes the wire body `{"data":{…}}`, so the API sees an object whose only
|
|
11
|
+
* key is `data`, finds none of the fields it validates, and answers
|
|
12
|
+
* `422 {"errors":{"username":["can't be blank"],…}}`. Write `post('/users', { user })`, never
|
|
13
|
+
* `post('/users', { data: { user } })`. The config object (headers, params, timeout,
|
|
14
|
+
* `skipAuthGate`) is the THIRD argument. Only `request({ method, url, data, … })` takes `data`
|
|
15
|
+
* inside an options object, because there that object IS the config.
|
|
16
|
+
*
|
|
7
17
|
* @example
|
|
8
18
|
* ```tsx
|
|
9
19
|
* // In a React component, get the configured client from context and call it.
|
|
@@ -17,7 +27,10 @@
|
|
|
17
27
|
* const res = await http.get<Plant[]>('/plants') // baseURL ('/api') is prepended
|
|
18
28
|
* setPlants(res.data)
|
|
19
29
|
* }
|
|
20
|
-
* //
|
|
30
|
+
* // Body-carrying verbs take the body as the SECOND argument:
|
|
31
|
+
* // http.post('/plants', plant) — wire body is `plant`
|
|
32
|
+
* // http.post('/plants', { data: plant }) — WRONG: wire body is `{"data": plant}`
|
|
33
|
+
* // http.put(url, body), http.patch(url, body) and http.delete(url) are also available.
|
|
21
34
|
* }
|
|
22
35
|
* ```
|
|
23
36
|
*
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+EG;AAEH,cAAc,gBAAgB,CAAA;AAC9B,cAAc,aAAa,CAAA;AAC3B,cAAc,mBAAmB,CAAA;AACjC,cAAc,eAAe,CAAA;AAC7B,cAAc,YAAY,CAAA;AAC1B,cAAc,aAAa,CAAA;AAC3B,cAAc,gBAAgB,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -4,6 +4,16 @@
|
|
|
4
4
|
* Provides a unified HTTP client API that works across different
|
|
5
5
|
* HTTP libraries (fetch, axios, ky, etc.).
|
|
6
6
|
*
|
|
7
|
+
* **The body is the SECOND argument: `post(url, data, config?)` — likewise `put` and `patch`,
|
|
8
|
+
* and the response is `HttpResponse<T>` (read `.data` for the body).** `data` IS the request
|
|
9
|
+
* body; a plain object is serialized as the JSON body. Passing `{ data: body }` there is NOT a
|
|
10
|
+
* config object — it makes the wire body `{"data":{…}}`, so the API sees an object whose only
|
|
11
|
+
* key is `data`, finds none of the fields it validates, and answers
|
|
12
|
+
* `422 {"errors":{"username":["can't be blank"],…}}`. Write `post('/users', { user })`, never
|
|
13
|
+
* `post('/users', { data: { user } })`. The config object (headers, params, timeout,
|
|
14
|
+
* `skipAuthGate`) is the THIRD argument. Only `request({ method, url, data, … })` takes `data`
|
|
15
|
+
* inside an options object, because there that object IS the config.
|
|
16
|
+
*
|
|
7
17
|
* @example
|
|
8
18
|
* ```tsx
|
|
9
19
|
* // In a React component, get the configured client from context and call it.
|
|
@@ -17,7 +27,10 @@
|
|
|
17
27
|
* const res = await http.get<Plant[]>('/plants') // baseURL ('/api') is prepended
|
|
18
28
|
* setPlants(res.data)
|
|
19
29
|
* }
|
|
20
|
-
* //
|
|
30
|
+
* // Body-carrying verbs take the body as the SECOND argument:
|
|
31
|
+
* // http.post('/plants', plant) — wire body is `plant`
|
|
32
|
+
* // http.post('/plants', { data: plant }) — WRONG: wire body is `{"data": plant}`
|
|
33
|
+
* // http.put(url, body), http.patch(url, body) and http.delete(url) are also available.
|
|
21
34
|
* }
|
|
22
35
|
* ```
|
|
23
36
|
*
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+EG;AAEH,cAAc,gBAAgB,CAAA;AAC9B,cAAc,aAAa,CAAA;AAC3B,cAAc,mBAAmB,CAAA;AACjC,cAAc,eAAe,CAAA;AAC7B,cAAc,YAAY,CAAA;AAC1B,cAAc,aAAa,CAAA;AAC3B,cAAc,gBAAgB,CAAA"}
|
package/dist/types.d.ts
CHANGED
|
@@ -55,7 +55,11 @@ export interface RequestConfig {
|
|
|
55
55
|
*/
|
|
56
56
|
signal?: AbortSignal;
|
|
57
57
|
/**
|
|
58
|
-
* Request body data
|
|
58
|
+
* Request body data, as a field of THIS config object — the `request({ method, url, data })`
|
|
59
|
+
* form. The verb methods take the body as their SECOND argument: `post(url, data, config)`,
|
|
60
|
+
* `put(url, data, config)`, `patch(url, data, config)`. Never wrap it there as
|
|
61
|
+
* `{ data: body }`: that object is the body, so the wire sends `{"data":body}` and the API
|
|
62
|
+
* sees none of the fields at its top level.
|
|
59
63
|
*/
|
|
60
64
|
data?: unknown;
|
|
61
65
|
/**
|
|
@@ -99,7 +103,7 @@ export interface FullRequestConfig extends RequestConfig {
|
|
|
99
103
|
*/
|
|
100
104
|
url: string;
|
|
101
105
|
/**
|
|
102
|
-
* Request body data.
|
|
106
|
+
* Request body data — a field of this config object, never a second argument here.
|
|
103
107
|
*/
|
|
104
108
|
data?: unknown;
|
|
105
109
|
}
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG,KAAK,GAAG,MAAM,GAAG,KAAK,GAAG,OAAO,GAAG,QAAQ,GAAG,MAAM,GAAG,SAAS,CAAA;AAEzF;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAEhC;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC,CAAA;IAE9D;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAA;IAEhB;;OAEG;IACH,eAAe,CAAC,EAAE,OAAO,CAAA;IAEzB;;;;;;;;;;;;;;;;;OAiBG;IACH,YAAY,CAAC,EAAE,OAAO,CAAA;IAEtB;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,aAAa,CAAA;IAEvD;;OAEG;IACH,MAAM,CAAC,EAAE,WAAW,CAAA;IAEpB
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG,KAAK,GAAG,MAAM,GAAG,KAAK,GAAG,OAAO,GAAG,QAAQ,GAAG,MA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IACH,UAAU,EAAE,MAAM,CAAA;IAElB;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAE/B;;OAEG;IACH,MAAM,EAAE,iBAAiB,CAAA;CAC1B;AAED;;GAEG;AACH,qBAAa,SAAU,SAAQ,KAAK;IAGzB,MAAM,EAAE,MAAM;IACd,QAAQ,CAAC,EAAE,YAAY;IACvB,MAAM,CAAC,EAAE,iBAAiB;IAC1B,QAAQ,CAAC,EAAE,MAAM;gBAJxB,OAAO,EAAE,MAAM,EACR,MAAM,EAAE,MAAM,EACd,QAAQ,CAAC,EAAE,YAAY,YAAA,EACvB,MAAM,CAAC,EAAE,iBAAiB,YAAA,EAC1B,QAAQ,CAAC,EAAE,MAAM,YAAA;CAK3B"}
|
package/dist/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAwJH;;GAEG;AACH,MAAM,OAAO,SAAU,SAAQ,KAAK;IAGzB;IACA;IACA;IACA;IALT,YACE,OAAe,EACR,MAAc,EACd,QAAuB,EACvB,MAA0B,EAC1B,QAAiB;QAExB,KAAK,CAAC,OAAO,CAAC,CAAA;QALP,WAAM,GAAN,MAAM,CAAQ;QACd,aAAQ,GAAR,QAAQ,CAAe;QACvB,WAAM,GAAN,MAAM,CAAoB;QAC1B,aAAQ,GAAR,QAAQ,CAAS;QAGxB,IAAI,CAAC,IAAI,GAAG,WAAW,CAAA;IACzB,CAAC;CACF"}
|
package/dist/utilities.d.ts
CHANGED
|
@@ -39,9 +39,13 @@ export declare const get: <T = unknown>(url: string, config?: RequestConfig) =>
|
|
|
39
39
|
/**
|
|
40
40
|
* Makes a POST request using the bonded HTTP client.
|
|
41
41
|
*
|
|
42
|
+
* The body is `data` — the SECOND argument. `post(url, { data: body })` sends the JSON body
|
|
43
|
+
* `{"data":body}`, not `body`, so the API finds none of its fields at the top level; pass the
|
|
44
|
+
* body directly (`post('/users', { user })`). The config is the THIRD argument.
|
|
45
|
+
*
|
|
42
46
|
* @param url - The request URL.
|
|
43
|
-
* @param data - The request body.
|
|
44
|
-
* @param config - Optional request configuration.
|
|
47
|
+
* @param data - The request body itself (never `{ data: body }`).
|
|
48
|
+
* @param config - Optional request configuration (headers, params, timeout).
|
|
45
49
|
* @returns The HTTP response with typed data.
|
|
46
50
|
*/
|
|
47
51
|
export declare const post: <T = unknown>(url: string, data?: unknown, config?: RequestConfig) => Promise<HttpResponse<T>>;
|
|
@@ -49,8 +53,10 @@ export declare const post: <T = unknown>(url: string, data?: unknown, config?: R
|
|
|
49
53
|
* Makes a PUT request using the bonded HTTP client.
|
|
50
54
|
*
|
|
51
55
|
* @param url - The request URL.
|
|
52
|
-
*
|
|
53
|
-
*
|
|
56
|
+
* The body is `data` — the SECOND argument, never `{ data: body }`.
|
|
57
|
+
*
|
|
58
|
+
* @param data - The request body itself.
|
|
59
|
+
* @param config - Optional request configuration (the third argument).
|
|
54
60
|
* @returns The HTTP response with typed data.
|
|
55
61
|
*/
|
|
56
62
|
export declare const put: <T = unknown>(url: string, data?: unknown, config?: RequestConfig) => Promise<HttpResponse<T>>;
|
|
@@ -58,8 +64,10 @@ export declare const put: <T = unknown>(url: string, data?: unknown, config?: Re
|
|
|
58
64
|
* Makes a PATCH request using the bonded HTTP client.
|
|
59
65
|
*
|
|
60
66
|
* @param url - The request URL.
|
|
61
|
-
*
|
|
62
|
-
*
|
|
67
|
+
* The body is `data` — the SECOND argument, never `{ data: body }`.
|
|
68
|
+
*
|
|
69
|
+
* @param data - The request body itself (the partial update).
|
|
70
|
+
* @param config - Optional request configuration (the third argument).
|
|
63
71
|
* @returns The HTTP response with typed data.
|
|
64
72
|
*/
|
|
65
73
|
export declare const patch: <T = unknown>(url: string, data?: unknown, config?: RequestConfig) => Promise<HttpResponse<T>>;
|
package/dist/utilities.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utilities.d.ts","sourceRoot":"","sources":["../src/utilities.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAE7C,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAI7D;;;;;;;;;;GAUG;AACH,eAAO,MAAM,SAAS,GAAI,QAAQ,UAAU,KAAG,IAE9C,CAAA;AAED;;;;;GAKG;AACH,eAAO,MAAM,SAAS,QAAO,UAM5B,CAAA;AAED;;;;;;GAMG;AACH,eAAO,MAAM,GAAG,GAAI,CAAC,GAAG,OAAO,EAAE,KAAK,MAAM,EAAE,SAAS,aAAa,KAAG,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC,CAC7D,CAAA;AAEjC
|
|
1
|
+
{"version":3,"file":"utilities.d.ts","sourceRoot":"","sources":["../src/utilities.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAE7C,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAI7D;;;;;;;;;;GAUG;AACH,eAAO,MAAM,SAAS,GAAI,QAAQ,UAAU,KAAG,IAE9C,CAAA;AAED;;;;;GAKG;AACH,eAAO,MAAM,SAAS,QAAO,UAM5B,CAAA;AAED;;;;;;GAMG;AACH,eAAO,MAAM,GAAG,GAAI,CAAC,GAAG,OAAO,EAAE,KAAK,MAAM,EAAE,SAAS,aAAa,KAAG,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC,CAC7D,CAAA;AAEjC;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,IAAI,GAAI,CAAC,GAAG,OAAO,EAC9B,KAAK,MAAM,EACX,OAAO,OAAO,EACd,SAAS,aAAa,KACrB,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC,CAA2C,CAAA;AAErE;;;;;;;;;GASG;AACH,eAAO,MAAM,GAAG,GAAI,CAAC,GAAG,OAAO,EAC7B,KAAK,MAAM,EACX,OAAO,OAAO,EACd,SAAS,aAAa,KACrB,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC,CAA0C,CAAA;AAEpE;;;;;;;;;GASG;AACH,eAAO,MAAM,KAAK,GAAI,CAAC,GAAG,OAAO,EAC/B,KAAK,MAAM,EACX,OAAO,OAAO,EACd,SAAS,aAAa,KACrB,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC,CAA4C,CAAA;AAEtE;;;;;;GAMG;AACH,eAAO,MAAM,GAAG,GAAI,CAAC,GAAG,OAAO,EAAE,KAAK,MAAM,EAAE,SAAS,aAAa,KAAG,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC,CAC1D,CAAA;AAEpC;;;GAGG;AACH,eAAO,MAAM,WAAW,mBAA4D,CAAA"}
|
package/dist/utilities.js
CHANGED
|
@@ -49,9 +49,13 @@ export const get = (url, config) => getClient().get(url, config);
|
|
|
49
49
|
/**
|
|
50
50
|
* Makes a POST request using the bonded HTTP client.
|
|
51
51
|
*
|
|
52
|
+
* The body is `data` — the SECOND argument. `post(url, { data: body })` sends the JSON body
|
|
53
|
+
* `{"data":body}`, not `body`, so the API finds none of its fields at the top level; pass the
|
|
54
|
+
* body directly (`post('/users', { user })`). The config is the THIRD argument.
|
|
55
|
+
*
|
|
52
56
|
* @param url - The request URL.
|
|
53
|
-
* @param data - The request body.
|
|
54
|
-
* @param config - Optional request configuration.
|
|
57
|
+
* @param data - The request body itself (never `{ data: body }`).
|
|
58
|
+
* @param config - Optional request configuration (headers, params, timeout).
|
|
55
59
|
* @returns The HTTP response with typed data.
|
|
56
60
|
*/
|
|
57
61
|
export const post = (url, data, config) => getClient().post(url, data, config);
|
|
@@ -59,8 +63,10 @@ export const post = (url, data, config) => getClient().post(url, data, config);
|
|
|
59
63
|
* Makes a PUT request using the bonded HTTP client.
|
|
60
64
|
*
|
|
61
65
|
* @param url - The request URL.
|
|
62
|
-
*
|
|
63
|
-
*
|
|
66
|
+
* The body is `data` — the SECOND argument, never `{ data: body }`.
|
|
67
|
+
*
|
|
68
|
+
* @param data - The request body itself.
|
|
69
|
+
* @param config - Optional request configuration (the third argument).
|
|
64
70
|
* @returns The HTTP response with typed data.
|
|
65
71
|
*/
|
|
66
72
|
export const put = (url, data, config) => getClient().put(url, data, config);
|
|
@@ -68,8 +74,10 @@ export const put = (url, data, config) => getClient().put(url, data, config);
|
|
|
68
74
|
* Makes a PATCH request using the bonded HTTP client.
|
|
69
75
|
*
|
|
70
76
|
* @param url - The request URL.
|
|
71
|
-
*
|
|
72
|
-
*
|
|
77
|
+
* The body is `data` — the SECOND argument, never `{ data: body }`.
|
|
78
|
+
*
|
|
79
|
+
* @param data - The request body itself (the partial update).
|
|
80
|
+
* @param config - Optional request configuration (the third argument).
|
|
73
81
|
* @returns The HTTP response with typed data.
|
|
74
82
|
*/
|
|
75
83
|
export const patch = (url, data, config) => getClient().patch(url, data, config);
|
package/dist/utilities.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utilities.js","sourceRoot":"","sources":["../src/utilities.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,IAAI,EAAE,GAAG,IAAI,OAAO,EAAE,MAAM,oBAAoB,CAAA;AAGzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAA;AAGjD,MAAM,SAAS,GAAG,aAAa,CAAA;AAE/B;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,MAAkB,EAAQ,EAAE;IACpD,IAAI,CAAC,SAAS,EAAE,MAAM,CAAC,CAAA;AACzB,CAAC,CAAA;AAED;;;;;GAKG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,GAAe,EAAE;IACxC,MAA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