@vertz/fetch 0.2.32 → 0.2.34
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 +11 -11
- package/package.json +14 -14
package/README.md
CHANGED
|
@@ -65,13 +65,13 @@ new FetchClient(config: FetchClientConfig)
|
|
|
65
65
|
interface FetchClientConfig {
|
|
66
66
|
/** Base URL for all requests (e.g., 'https://api.example.com') */
|
|
67
67
|
baseURL?: string;
|
|
68
|
-
|
|
68
|
+
|
|
69
69
|
/** Default headers added to every request */
|
|
70
70
|
headers?: Record<string, string>;
|
|
71
|
-
|
|
71
|
+
|
|
72
72
|
/** Request timeout in milliseconds */
|
|
73
73
|
timeoutMs?: number;
|
|
74
|
-
|
|
74
|
+
|
|
75
75
|
/** Retry configuration */
|
|
76
76
|
retry?: {
|
|
77
77
|
retries: number;
|
|
@@ -80,7 +80,7 @@ interface FetchClientConfig {
|
|
|
80
80
|
retryOn: number[]; // Status codes to retry (default: [429, 500, 502, 503, 504])
|
|
81
81
|
retryOnError?: (error: Error) => boolean;
|
|
82
82
|
};
|
|
83
|
-
|
|
83
|
+
|
|
84
84
|
/** Lifecycle hooks */
|
|
85
85
|
hooks?: {
|
|
86
86
|
beforeRequest?: (request: Request) => void | Promise<void>;
|
|
@@ -91,13 +91,13 @@ interface FetchClientConfig {
|
|
|
91
91
|
onStreamChunk?: (chunk: unknown) => void;
|
|
92
92
|
onStreamEnd?: () => void;
|
|
93
93
|
};
|
|
94
|
-
|
|
94
|
+
|
|
95
95
|
/** Authentication strategies (applied in order) */
|
|
96
96
|
authStrategies?: AuthStrategy[];
|
|
97
|
-
|
|
97
|
+
|
|
98
98
|
/** Custom fetch implementation (default: globalThis.fetch) */
|
|
99
99
|
fetch?: typeof fetch;
|
|
100
|
-
|
|
100
|
+
|
|
101
101
|
/** Credentials mode */
|
|
102
102
|
credentials?: RequestCredentials;
|
|
103
103
|
}
|
|
@@ -358,10 +358,10 @@ const client = new FetchClient({
|
|
|
358
358
|
},
|
|
359
359
|
});
|
|
360
360
|
|
|
361
|
-
for await (const event of client.requestStream({
|
|
362
|
-
method: 'GET',
|
|
363
|
-
path: '/events',
|
|
364
|
-
format: 'sse'
|
|
361
|
+
for await (const event of client.requestStream({
|
|
362
|
+
method: 'GET',
|
|
363
|
+
path: '/events',
|
|
364
|
+
format: 'sse',
|
|
365
365
|
})) {
|
|
366
366
|
// Process event
|
|
367
367
|
}
|
package/package.json
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vertz/fetch",
|
|
3
|
-
"version": "0.2.
|
|
4
|
-
"type": "module",
|
|
5
|
-
"license": "MIT",
|
|
3
|
+
"version": "0.2.34",
|
|
6
4
|
"description": "Type-safe HTTP client for Vertz",
|
|
5
|
+
"license": "MIT",
|
|
7
6
|
"repository": {
|
|
8
7
|
"type": "git",
|
|
9
8
|
"url": "https://github.com/vertz-dev/vertz.git",
|
|
10
9
|
"directory": "packages/fetch"
|
|
11
10
|
},
|
|
12
|
-
"
|
|
13
|
-
"
|
|
14
|
-
|
|
15
|
-
|
|
11
|
+
"files": [
|
|
12
|
+
"dist"
|
|
13
|
+
],
|
|
14
|
+
"type": "module",
|
|
15
|
+
"sideEffects": false,
|
|
16
16
|
"main": "dist/index.js",
|
|
17
17
|
"types": "dist/index.d.ts",
|
|
18
18
|
"exports": {
|
|
@@ -21,17 +21,18 @@
|
|
|
21
21
|
"types": "./dist/index.d.ts"
|
|
22
22
|
}
|
|
23
23
|
},
|
|
24
|
-
"
|
|
25
|
-
"
|
|
26
|
-
|
|
27
|
-
"dependencies": {
|
|
28
|
-
"@vertz/errors": "^0.2.30"
|
|
24
|
+
"publishConfig": {
|
|
25
|
+
"access": "public",
|
|
26
|
+
"provenance": true
|
|
29
27
|
},
|
|
30
28
|
"scripts": {
|
|
31
29
|
"build": "bunup",
|
|
32
30
|
"test": "bun test",
|
|
33
31
|
"typecheck": "tsc --noEmit"
|
|
34
32
|
},
|
|
33
|
+
"dependencies": {
|
|
34
|
+
"@vertz/errors": "^0.2.31"
|
|
35
|
+
},
|
|
35
36
|
"devDependencies": {
|
|
36
37
|
"@types/node": "^25.3.1",
|
|
37
38
|
"bunup": "^0.16.31",
|
|
@@ -39,6 +40,5 @@
|
|
|
39
40
|
},
|
|
40
41
|
"engines": {
|
|
41
42
|
"node": ">=22"
|
|
42
|
-
}
|
|
43
|
-
"sideEffects": false
|
|
43
|
+
}
|
|
44
44
|
}
|