@molecule/app-http 1.5.0 → 1.5.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.
- package/README.md +22 -10
- package/package.json +3 -3
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-26T04:25:37.661Z
|
|
7
7
|
-->
|
|
8
8
|
|
|
9
9
|
# @molecule/app-http
|
|
@@ -615,7 +615,7 @@ function awaitAuthGate(request?: AuthGateRequest): Promise<void>
|
|
|
615
615
|
Whether `err` is an {@link HttpError} from this package.
|
|
616
616
|
|
|
617
617
|
```typescript
|
|
618
|
-
function isHttpError(err: unknown):
|
|
618
|
+
function isHttpError(err: unknown): err is HttpError
|
|
619
619
|
```
|
|
620
620
|
|
|
621
621
|
- `err` — Any thrown value.
|
|
@@ -751,7 +751,7 @@ be back); otherwise exponential backoff with full jitter.
|
|
|
751
751
|
function retryDelayMs(
|
|
752
752
|
retryAfter: string | undefined,
|
|
753
753
|
attempt: number,
|
|
754
|
-
options?:
|
|
754
|
+
options?: RetryOptions | false,
|
|
755
755
|
random?: () => number,
|
|
756
756
|
): number
|
|
757
757
|
```
|
|
@@ -792,7 +792,7 @@ raw JSON, or `response.data.items` for an `HttpResponse`. Passing that
|
|
|
792
792
|
array to `unwrapList` is also valid; passing the enclosing object is not.
|
|
793
793
|
|
|
794
794
|
```typescript
|
|
795
|
-
function unwrapList(res: unknown): T[]
|
|
795
|
+
function unwrapList<T>(res: unknown): T[]
|
|
796
796
|
```
|
|
797
797
|
|
|
798
798
|
- `res` — Raw response body OR an `HttpResponse` envelope from `@molecule/app-http`.
|
|
@@ -817,7 +817,7 @@ where the mock server returns `[]` for unmatched endpoints but the
|
|
|
817
817
|
caller expects a single resource.
|
|
818
818
|
|
|
819
819
|
```typescript
|
|
820
|
-
function unwrapSingle(res: unknown): T | null
|
|
820
|
+
function unwrapSingle<T>(res: unknown): T | null
|
|
821
821
|
```
|
|
822
822
|
|
|
823
823
|
- `res` — Raw response body (e.g. `HttpResponse.data` from `@molecule/app-http`).
|
|
@@ -896,7 +896,7 @@ function getClient(): HttpClient
|
|
|
896
896
|
Makes a GET request using the bonded HTTP client.
|
|
897
897
|
|
|
898
898
|
```typescript
|
|
899
|
-
function get(url: string, config?: RequestConfig): Promise<HttpResponse<T>>
|
|
899
|
+
function get<T = unknown>(url: string, config?: RequestConfig): Promise<HttpResponse<T>>
|
|
900
900
|
```
|
|
901
901
|
|
|
902
902
|
- `url` — The request URL (relative to baseURL if configured).
|
|
@@ -913,7 +913,11 @@ The body is `data` — the SECOND argument. `post(url, { data: body })` sends th
|
|
|
913
913
|
body directly (`post('/users', { user })`). The config is the THIRD argument.
|
|
914
914
|
|
|
915
915
|
```typescript
|
|
916
|
-
function post
|
|
916
|
+
function post<T = unknown>(
|
|
917
|
+
url: string,
|
|
918
|
+
data?: unknown,
|
|
919
|
+
config?: RequestConfig,
|
|
920
|
+
): Promise<HttpResponse<T>>
|
|
917
921
|
```
|
|
918
922
|
|
|
919
923
|
- `url` — The request URL.
|
|
@@ -927,7 +931,11 @@ function post(url: string, data?: unknown, config?: RequestConfig): Promise<Http
|
|
|
927
931
|
Makes a PUT request using the bonded HTTP client.
|
|
928
932
|
|
|
929
933
|
```typescript
|
|
930
|
-
function put
|
|
934
|
+
function put<T = unknown>(
|
|
935
|
+
url: string,
|
|
936
|
+
data?: unknown,
|
|
937
|
+
config?: RequestConfig,
|
|
938
|
+
): Promise<HttpResponse<T>>
|
|
931
939
|
```
|
|
932
940
|
|
|
933
941
|
- `url` — The request URL. The body is `data` — the SECOND argument, never `{ data: body }`.
|
|
@@ -941,7 +949,11 @@ function put(url: string, data?: unknown, config?: RequestConfig): Promise<HttpR
|
|
|
941
949
|
Makes a PATCH request using the bonded HTTP client.
|
|
942
950
|
|
|
943
951
|
```typescript
|
|
944
|
-
function patch
|
|
952
|
+
function patch<T = unknown>(
|
|
953
|
+
url: string,
|
|
954
|
+
data?: unknown,
|
|
955
|
+
config?: RequestConfig,
|
|
956
|
+
): Promise<HttpResponse<T>>
|
|
945
957
|
```
|
|
946
958
|
|
|
947
959
|
- `url` — The request URL. The body is `data` — the SECOND argument, never `{ data: body }`.
|
|
@@ -955,7 +967,7 @@ function patch(url: string, data?: unknown, config?: RequestConfig): Promise<Htt
|
|
|
955
967
|
Makes a DELETE request using the bonded HTTP client.
|
|
956
968
|
|
|
957
969
|
```typescript
|
|
958
|
-
function del(url: string, config?: RequestConfig): Promise<HttpResponse<T>>
|
|
970
|
+
function del<T = unknown>(url: string, config?: RequestConfig): Promise<HttpResponse<T>>
|
|
959
971
|
```
|
|
960
972
|
|
|
961
973
|
- `url` — The request URL.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@molecule/app-http",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.1",
|
|
4
4
|
"description": "Client HTTP interface for molecule.dev",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -33,8 +33,8 @@
|
|
|
33
33
|
"@molecule/app-logger": "^1.0.1"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
|
-
"@molecule/app-bond": "1.0.
|
|
37
|
-
"@molecule/app-i18n": "1.1.
|
|
36
|
+
"@molecule/app-bond": "1.0.4",
|
|
37
|
+
"@molecule/app-i18n": "1.1.1",
|
|
38
38
|
"@molecule/app-logger": "1.0.3",
|
|
39
39
|
"@types/node": "26.6.5",
|
|
40
40
|
"typescript": "6.0.3",
|