@happy-ts/fetch-t 1.0.10 → 1.0.11
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/docs/functions/fetchT.md
CHANGED
|
@@ -43,7 +43,7 @@ A `FetchTask` representing the operation with a `string` response.
|
|
|
43
43
|
|
|
44
44
|
### Defined in
|
|
45
45
|
|
|
46
|
-
[
|
|
46
|
+
[fetch.ts:14](https://github.com/JiangJie/fetch-t/blob/e5aa635435bb73b90ba7373357fa4cc6928da1b3/src/fetch/fetch.ts#L14)
|
|
47
47
|
|
|
48
48
|
## fetchT(url, init)
|
|
49
49
|
|
|
@@ -68,7 +68,7 @@ A `FetchTask` representing the operation with an `ArrayBuffer` response.
|
|
|
68
68
|
|
|
69
69
|
### Defined in
|
|
70
70
|
|
|
71
|
-
[
|
|
71
|
+
[fetch.ts:26](https://github.com/JiangJie/fetch-t/blob/e5aa635435bb73b90ba7373357fa4cc6928da1b3/src/fetch/fetch.ts#L26)
|
|
72
72
|
|
|
73
73
|
## fetchT(url, init)
|
|
74
74
|
|
|
@@ -93,7 +93,7 @@ A `FetchTask` representing the operation with a `Blob` response.
|
|
|
93
93
|
|
|
94
94
|
### Defined in
|
|
95
95
|
|
|
96
|
-
[
|
|
96
|
+
[fetch.ts:38](https://github.com/JiangJie/fetch-t/blob/e5aa635435bb73b90ba7373357fa4cc6928da1b3/src/fetch/fetch.ts#L38)
|
|
97
97
|
|
|
98
98
|
## fetchT(url, init)
|
|
99
99
|
|
|
@@ -124,7 +124,7 @@ A `FetchTask` representing the operation with a response parsed as JSON.
|
|
|
124
124
|
|
|
125
125
|
### Defined in
|
|
126
126
|
|
|
127
|
-
[
|
|
127
|
+
[fetch.ts:51](https://github.com/JiangJie/fetch-t/blob/e5aa635435bb73b90ba7373357fa4cc6928da1b3/src/fetch/fetch.ts#L51)
|
|
128
128
|
|
|
129
129
|
## fetchT(url, init)
|
|
130
130
|
|
|
@@ -149,7 +149,7 @@ A `FetchResponse` representing the operation with a `string` response.
|
|
|
149
149
|
|
|
150
150
|
### Defined in
|
|
151
151
|
|
|
152
|
-
[
|
|
152
|
+
[fetch.ts:63](https://github.com/JiangJie/fetch-t/blob/e5aa635435bb73b90ba7373357fa4cc6928da1b3/src/fetch/fetch.ts#L63)
|
|
153
153
|
|
|
154
154
|
## fetchT(url, init)
|
|
155
155
|
|
|
@@ -174,7 +174,7 @@ A `FetchResponse` representing the operation with an `ArrayBuffer` response.
|
|
|
174
174
|
|
|
175
175
|
### Defined in
|
|
176
176
|
|
|
177
|
-
[
|
|
177
|
+
[fetch.ts:74](https://github.com/JiangJie/fetch-t/blob/e5aa635435bb73b90ba7373357fa4cc6928da1b3/src/fetch/fetch.ts#L74)
|
|
178
178
|
|
|
179
179
|
## fetchT(url, init)
|
|
180
180
|
|
|
@@ -199,7 +199,7 @@ A `FetchResponse` representing the operation with a `Blob` response.
|
|
|
199
199
|
|
|
200
200
|
### Defined in
|
|
201
201
|
|
|
202
|
-
[
|
|
202
|
+
[fetch.ts:85](https://github.com/JiangJie/fetch-t/blob/e5aa635435bb73b90ba7373357fa4cc6928da1b3/src/fetch/fetch.ts#L85)
|
|
203
203
|
|
|
204
204
|
## fetchT(url, init)
|
|
205
205
|
|
|
@@ -230,7 +230,7 @@ A `FetchResponse` representing the operation with a response parsed as JSON.
|
|
|
230
230
|
|
|
231
231
|
### Defined in
|
|
232
232
|
|
|
233
|
-
[
|
|
233
|
+
[fetch.ts:97](https://github.com/JiangJie/fetch-t/blob/e5aa635435bb73b90ba7373357fa4cc6928da1b3/src/fetch/fetch.ts#L97)
|
|
234
234
|
|
|
235
235
|
## fetchT(url, init)
|
|
236
236
|
|
|
@@ -255,7 +255,7 @@ A `FetchTask` representing the operation with a generic `Response`.
|
|
|
255
255
|
|
|
256
256
|
### Defined in
|
|
257
257
|
|
|
258
|
-
[
|
|
258
|
+
[fetch.ts:108](https://github.com/JiangJie/fetch-t/blob/e5aa635435bb73b90ba7373357fa4cc6928da1b3/src/fetch/fetch.ts#L108)
|
|
259
259
|
|
|
260
260
|
## fetchT(url, init)
|
|
261
261
|
|
|
@@ -280,7 +280,7 @@ A `FetchResponse` representing the operation with a generic `Response`.
|
|
|
280
280
|
|
|
281
281
|
### Defined in
|
|
282
282
|
|
|
283
|
-
[
|
|
283
|
+
[fetch.ts:119](https://github.com/JiangJie/fetch-t/blob/e5aa635435bb73b90ba7373357fa4cc6928da1b3/src/fetch/fetch.ts#L119)
|
|
284
284
|
|
|
285
285
|
## fetchT(url, init)
|
|
286
286
|
|
|
@@ -311,7 +311,7 @@ A `FetchResponse` or `FetchTask` depending on the `abortable` option in `init`.
|
|
|
311
311
|
|
|
312
312
|
### Defined in
|
|
313
313
|
|
|
314
|
-
[
|
|
314
|
+
[fetch.ts:131](https://github.com/JiangJie/fetch-t/blob/e5aa635435bb73b90ba7373357fa4cc6928da1b3/src/fetch/fetch.ts#L131)
|
|
315
315
|
|
|
316
316
|
## fetchT(url, init)
|
|
317
317
|
|
|
@@ -336,4 +336,4 @@ A `FetchResponse` representing the operation with a `Response` object.
|
|
|
336
336
|
|
|
337
337
|
### Defined in
|
|
338
338
|
|
|
339
|
-
[
|
|
339
|
+
[fetch.ts:140](https://github.com/JiangJie/fetch-t/blob/e5aa635435bb73b90ba7373357fa4cc6928da1b3/src/fetch/fetch.ts#L140)
|
|
@@ -14,21 +14,7 @@ Extends the standard `RequestInit` interface from the Fetch API to include addit
|
|
|
14
14
|
|
|
15
15
|
## Properties
|
|
16
16
|
|
|
17
|
-
| Property | Type | Description |
|
|
18
|
-
| ------ | ------ | ------ | ------ |
|
|
19
|
-
| `abortable?` | `boolean` | Indicates whether the fetch request should be abortable. |
|
|
20
|
-
| `
|
|
21
|
-
| `cache?` | `RequestCache` | A string indicating how the request will interact with the browser's cache to set request's cache. | `RequestInit.cache` | node\_modules/.deno/typescript@5.5.3/node\_modules/typescript/lib/lib.dom.d.ts:1695 |
|
|
22
|
-
| `credentials?` | `RequestCredentials` | A string indicating whether credentials will be sent with the request always, never, or only when sent to a same-origin URL. Sets request's credentials. | `RequestInit.credentials` | node\_modules/.deno/typescript@5.5.3/node\_modules/typescript/lib/lib.dom.d.ts:1697 |
|
|
23
|
-
| `headers?` | `HeadersInit` | A Headers object, an object literal, or an array of two-item arrays to set request's headers. | `RequestInit.headers` | node\_modules/.deno/typescript@5.5.3/node\_modules/typescript/lib/lib.dom.d.ts:1699 |
|
|
24
|
-
| `integrity?` | `string` | A cryptographic hash of the resource to be fetched by request. Sets request's integrity. | `RequestInit.integrity` | node\_modules/.deno/typescript@5.5.3/node\_modules/typescript/lib/lib.dom.d.ts:1701 |
|
|
25
|
-
| `keepalive?` | `boolean` | A boolean to set request's keepalive. | `RequestInit.keepalive` | node\_modules/.deno/typescript@5.5.3/node\_modules/typescript/lib/lib.dom.d.ts:1703 |
|
|
26
|
-
| `method?` | `string` | A string to set request's method. | `RequestInit.method` | node\_modules/.deno/typescript@5.5.3/node\_modules/typescript/lib/lib.dom.d.ts:1705 |
|
|
27
|
-
| `mode?` | `RequestMode` | A string to indicate whether the request will use CORS, or will be restricted to same-origin URLs. Sets request's mode. | `RequestInit.mode` | node\_modules/.deno/typescript@5.5.3/node\_modules/typescript/lib/lib.dom.d.ts:1707 |
|
|
28
|
-
| `priority?` | `RequestPriority` | - | `RequestInit.priority` | node\_modules/.deno/typescript@5.5.3/node\_modules/typescript/lib/lib.dom.d.ts:1708 |
|
|
29
|
-
| `redirect?` | `RequestRedirect` | A string indicating whether request follows redirects, results in an error upon encountering a redirect, or returns the redirect (in an opaque fashion). Sets request's redirect. | `RequestInit.redirect` | node\_modules/.deno/typescript@5.5.3/node\_modules/typescript/lib/lib.dom.d.ts:1710 |
|
|
30
|
-
| `referrer?` | `string` | A string whose value is a same-origin URL, "about:client", or the empty string, to set request's referrer. | `RequestInit.referrer` | node\_modules/.deno/typescript@5.5.3/node\_modules/typescript/lib/lib.dom.d.ts:1712 |
|
|
31
|
-
| `referrerPolicy?` | `ReferrerPolicy` | A referrer policy to set request's referrerPolicy. | `RequestInit.referrerPolicy` | node\_modules/.deno/typescript@5.5.3/node\_modules/typescript/lib/lib.dom.d.ts:1714 |
|
|
32
|
-
| `responseType?` | `"text"` \| `"arraybuffer"` \| `"blob"` \| `"json"` | Specifies the expected response type of the fetch request. | - | [src/fetch/defines.ts:47](https://github.com/JiangJie/fetch-t/blob/9e5c4ce034f7bf6add07f55044bccbb16a68960c/src/fetch/defines.ts#L47) |
|
|
33
|
-
| `signal?` | `null` \| `AbortSignal` | An AbortSignal to set request's signal. | `RequestInit.signal` | node\_modules/.deno/typescript@5.5.3/node\_modules/typescript/lib/lib.dom.d.ts:1716 |
|
|
34
|
-
| `window?` | `null` | Can only be null. Used to disassociate request from any Window. | `RequestInit.window` | node\_modules/.deno/typescript@5.5.3/node\_modules/typescript/lib/lib.dom.d.ts:1718 |
|
|
17
|
+
| Property | Type | Description | Defined in |
|
|
18
|
+
| ------ | ------ | ------ | ------ |
|
|
19
|
+
| `abortable?` | `boolean` | Indicates whether the fetch request should be abortable. | [defines.ts:42](https://github.com/JiangJie/fetch-t/blob/e5aa635435bb73b90ba7373357fa4cc6928da1b3/src/fetch/defines.ts#L42) |
|
|
20
|
+
| `responseType?` | `"text"` \| `"arraybuffer"` \| `"blob"` \| `"json"` | Specifies the expected response type of the fetch request. | [defines.ts:47](https://github.com/JiangJie/fetch-t/blob/e5aa635435bb73b90ba7373357fa4cc6928da1b3/src/fetch/defines.ts#L47) |
|
|
@@ -18,8 +18,8 @@ Defines the structure and behavior of a fetch task, including the ability to abo
|
|
|
18
18
|
|
|
19
19
|
| Property | Type | Description | Defined in |
|
|
20
20
|
| ------ | ------ | ------ | ------ |
|
|
21
|
-
| `aborted` | `boolean` | Indicates whether the fetch task has been aborted. | [
|
|
22
|
-
| `response` | [`FetchResponse`](../type-aliases/FetchResponse.md)\<`T`\> | The response of the fetch task, represented as an `AsyncResult`. | [
|
|
21
|
+
| `aborted` | `boolean` | Indicates whether the fetch task has been aborted. | [defines.ts:27](https://github.com/JiangJie/fetch-t/blob/e5aa635435bb73b90ba7373357fa4cc6928da1b3/src/fetch/defines.ts#L27) |
|
|
22
|
+
| `response` | [`FetchResponse`](../type-aliases/FetchResponse.md)\<`T`\> | The response of the fetch task, represented as an `AsyncResult`. | [defines.ts:32](https://github.com/JiangJie/fetch-t/blob/e5aa635435bb73b90ba7373357fa4cc6928da1b3/src/fetch/defines.ts#L32) |
|
|
23
23
|
|
|
24
24
|
## Methods
|
|
25
25
|
|
|
@@ -43,4 +43,4 @@ Aborts the fetch task, optionally with a reason for the abortion.
|
|
|
43
43
|
|
|
44
44
|
#### Defined in
|
|
45
45
|
|
|
46
|
-
[
|
|
46
|
+
[defines.ts:22](https://github.com/JiangJie/fetch-t/blob/e5aa635435bb73b90ba7373357fa4cc6928da1b3/src/fetch/defines.ts#L22)
|
|
@@ -20,4 +20,4 @@ Represents the response of a fetch operation, encapsulating the result data or a
|
|
|
20
20
|
|
|
21
21
|
## Defined in
|
|
22
22
|
|
|
23
|
-
[
|
|
23
|
+
[defines.ts:9](https://github.com/JiangJie/fetch-t/blob/e5aa635435bb73b90ba7373357fa4cc6928da1b3/src/fetch/defines.ts#L9)
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"description": "Abortable fetch wrapper with the ability to specify the return type.",
|
|
4
4
|
"author": "jiang115jie@gmail.com",
|
|
5
5
|
"license": "GPL-3.0",
|
|
6
|
-
"version": "1.0.
|
|
6
|
+
"version": "1.0.11",
|
|
7
7
|
"type": "module",
|
|
8
8
|
"source": "src/mod.ts",
|
|
9
9
|
"main": "dist/main.cjs",
|
|
@@ -43,8 +43,8 @@
|
|
|
43
43
|
"responseType"
|
|
44
44
|
],
|
|
45
45
|
"devDependencies": {
|
|
46
|
-
"@typescript-eslint/eslint-plugin": "^7.16.
|
|
47
|
-
"@typescript-eslint/parser": "^7.16.
|
|
46
|
+
"@typescript-eslint/eslint-plugin": "^7.16.1",
|
|
47
|
+
"@typescript-eslint/parser": "^7.16.1",
|
|
48
48
|
"eslint": "^8.57.0",
|
|
49
49
|
"rollup": "^4.18.1",
|
|
50
50
|
"rollup-plugin-dts": "^6.1.1",
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"typescript": "^5.5.3"
|
|
55
55
|
},
|
|
56
56
|
"dependencies": {
|
|
57
|
-
"happy-rusty": "^1.1.
|
|
57
|
+
"happy-rusty": "^1.1.2",
|
|
58
58
|
"tiny-invariant": "^1.3.3"
|
|
59
59
|
},
|
|
60
60
|
"packageManager": "pnpm@9.5.0"
|