@longzai-intelligence-transport/http-preset-browser 0.1.1 → 0.1.2
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/dist/index.d.ts +8 -1
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -27,6 +27,13 @@ type StreamDownloadFunction<TRoute extends RouteDefinition> = InferRouteParams<T
|
|
|
27
27
|
* @typeParam TRoutes - 路由定义集合类型
|
|
28
28
|
*/
|
|
29
29
|
type BrowserApi<TRoutes extends Record<string, RouteDefinition>> = { [K in keyof TRoutes]: TRoutes[K] extends StreamResponseRoute ? StreamDownloadFunction<TRoutes[K]> : CreateApiFunction<TRoutes[K]> };
|
|
30
|
+
/**
|
|
31
|
+
* fetch 函数核心签名(仅请求调用,不含 preconnect 等扩展)
|
|
32
|
+
*
|
|
33
|
+
* 用于依赖注入,便于测试 mock。typeof fetch 含 preconnect 等扩展属性,
|
|
34
|
+
* 纯函数 mockFetch 无法完整实现,故用 FetchFn 核心签名。
|
|
35
|
+
*/
|
|
36
|
+
type FetchFn = (input: Request | string | URL, init?: RequestInit) => Promise<Response>;
|
|
30
37
|
/**
|
|
31
38
|
* 流式 fetch 配置
|
|
32
39
|
*
|
|
@@ -54,7 +61,7 @@ type StreamFetchConfig = {
|
|
|
54
61
|
*
|
|
55
62
|
* 省略时用全局 fetch。
|
|
56
63
|
*/
|
|
57
|
-
fetch?:
|
|
64
|
+
fetch?: FetchFn;
|
|
58
65
|
};
|
|
59
66
|
/**
|
|
60
67
|
* 创建流式下载函数
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@longzai-intelligence-transport/http-preset-browser",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"keywords": [
|
|
5
5
|
"browser",
|
|
6
6
|
"http",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"clean": "rimraf dist out .cache"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@longzai-intelligence-transport/http-core": "0.1.
|
|
39
|
+
"@longzai-intelligence-transport/http-core": "0.1.2"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
42
|
"zod": "^4.4.3"
|