@ahoo-wang/fetcher-decorator 3.15.2 → 3.15.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 +4 -5
- package/README.zh-CN.md +4 -4
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -264,8 +264,7 @@ parameter name.
|
|
|
264
264
|
#### `@request()`
|
|
265
265
|
|
|
266
266
|
Defines a request parameter that will be used as the base request object. This allows you to pass a complete
|
|
267
|
-
|
|
268
|
-
object to customize the request configuration.
|
|
267
|
+
`ParameterRequest` object (containing method, path, query, headers, body, timeout, etc.) to customize the request configuration.
|
|
269
268
|
|
|
270
269
|
**Example:**
|
|
271
270
|
|
|
@@ -281,7 +280,7 @@ class UserService {
|
|
|
281
280
|
}
|
|
282
281
|
|
|
283
282
|
@post('/users')
|
|
284
|
-
createUsers(@request() request:
|
|
283
|
+
createUsers(@request() request: ParameterRequest): Promise<Response> {
|
|
285
284
|
throw autoGeneratedError(request);
|
|
286
285
|
}
|
|
287
286
|
|
|
@@ -479,8 +478,8 @@ They allow you to customize how the response from an HTTP request is processed a
|
|
|
479
478
|
- **ResponseResultExtractor**: Returns the response object from FetchExchange
|
|
480
479
|
- **JsonResultExtractor**: Parses the response content as JSON format (default)
|
|
481
480
|
- **TextResultExtractor**: Parses the response content as text format
|
|
482
|
-
- **EventStreamResultExtractor**: Extracts server-sent event stream from FetchExchange
|
|
483
|
-
- **JsonEventStreamResultExtractor**: Extracts JSON server-sent event stream from FetchExchange
|
|
481
|
+
- **EventStreamResultExtractor**: Extracts server-sent event stream from FetchExchange (from `@ahoo-wang/fetcher-eventstream`)
|
|
482
|
+
- **JsonEventStreamResultExtractor**: Extracts JSON server-sent event stream from FetchExchange (from `@ahoo-wang/fetcher-eventstream`)
|
|
484
483
|
|
|
485
484
|
#### Using Result Extractors
|
|
486
485
|
|
package/README.zh-CN.md
CHANGED
|
@@ -260,7 +260,7 @@ class UserService {
|
|
|
260
260
|
|
|
261
261
|
#### `@request()`
|
|
262
262
|
|
|
263
|
-
定义请求参数,将用作基础请求对象。这允许您传递一个完整的
|
|
263
|
+
定义请求参数,将用作基础请求对象。这允许您传递一个完整的 `ParameterRequest` 对象(包含 method、path、query、headers、body、timeout 等)来自定义请求配置。
|
|
264
264
|
|
|
265
265
|
**示例:**
|
|
266
266
|
|
|
@@ -276,7 +276,7 @@ class UserService {
|
|
|
276
276
|
}
|
|
277
277
|
|
|
278
278
|
@post('/users')
|
|
279
|
-
createUsers(@request() request:
|
|
279
|
+
createUsers(@request() request: ParameterRequest): Promise<Response> {
|
|
280
280
|
throw autoGeneratedError(request);
|
|
281
281
|
}
|
|
282
282
|
|
|
@@ -473,8 +473,8 @@ userService.fetcher = customFetcher; // 将使用此 fetcher
|
|
|
473
473
|
- **ResponseResultExtractor**: 返回 FetchExchange 中的响应对象
|
|
474
474
|
- **JsonResultExtractor**: 将响应内容解析为 JSON 格式(默认)
|
|
475
475
|
- **TextResultExtractor**: 将响应内容解析为文本格式
|
|
476
|
-
- **EventStreamResultExtractor**: 从 FetchExchange
|
|
477
|
-
- **JsonEventStreamResultExtractor**: 从 FetchExchange 中提取 JSON
|
|
476
|
+
- **EventStreamResultExtractor**: 从 FetchExchange 中提取服务器发送事件流(来自 `@ahoo-wang/fetcher-eventstream`)
|
|
477
|
+
- **JsonEventStreamResultExtractor**: 从 FetchExchange 中提取 JSON 服务器发送事件流(来自 `@ahoo-wang/fetcher-eventstream`)
|
|
478
478
|
|
|
479
479
|
#### 使用结果提取器
|
|
480
480
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ahoo-wang/fetcher-decorator",
|
|
3
|
-
"version": "3.15.
|
|
3
|
+
"version": "3.15.4",
|
|
4
4
|
"description": "TypeScript decorators for clean, declarative API service definitions with Fetcher HTTP client. Enables automatic parameter binding, method mapping, and type-safe API interactions.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"fetch",
|
|
@@ -49,10 +49,10 @@
|
|
|
49
49
|
"@vitest/coverage-v8": "^4.1.4",
|
|
50
50
|
"@vitest/ui": "^4.1.4",
|
|
51
51
|
"eslint": "^9.39.4",
|
|
52
|
-
"globals": "^17.
|
|
52
|
+
"globals": "^17.5.0",
|
|
53
53
|
"prettier": "^3.8.1",
|
|
54
54
|
"typescript": "^6.0.2",
|
|
55
|
-
"typescript-eslint": "^8.58.
|
|
55
|
+
"typescript-eslint": "^8.58.2",
|
|
56
56
|
"unplugin-dts": "1.0.0-beta.6",
|
|
57
57
|
"vite": "^8.0.8",
|
|
58
58
|
"vite-bundle-analyzer": "^1.3.7",
|