@maiyunnet/kebab 9.22.5 → 9.23.0
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/doc/kebab-rag.md +60 -60
- package/index.d.ts +1 -1
- package/index.js +1 -1
- package/lib/undici/response.d.ts +1 -1
- package/lib/undici.d.ts +5 -5
- package/lib/undici.js +7 -6
- package/package.json +1 -1
package/doc/kebab-rag.md
CHANGED
|
@@ -1737,7 +1737,7 @@ index/variables/VER.md
|
|
|
1737
1737
|
|
|
1738
1738
|
# Variable: VER
|
|
1739
1739
|
|
|
1740
|
-
> `const` **VER**: `"9.
|
|
1740
|
+
> `const` **VER**: `"9.23.0"` = `'9.23.0'`
|
|
1741
1741
|
|
|
1742
1742
|
Defined in: [index.ts:10](https://github.com/maiyunnet/kebab/blob/master/index.ts#L10)
|
|
1743
1743
|
|
|
@@ -128699,7 +128699,7 @@ lib/undici/functions/fetch.md
|
|
|
128699
128699
|
|
|
128700
128700
|
> **fetch**(`input`, `init?`): `Promise`\<`Response`\>
|
|
128701
128701
|
|
|
128702
|
-
Defined in: [lib/undici.ts:
|
|
128702
|
+
Defined in: [lib/undici.ts:293](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L293)
|
|
128703
128703
|
|
|
128704
128704
|
发起一个完全兼容 fetch 的请求
|
|
128705
128705
|
|
|
@@ -128734,7 +128734,7 @@ lib/undici/functions/filterHeaders.md
|
|
|
128734
128734
|
|
|
128735
128735
|
> **filterHeaders**(`headers`, `res?`, `filter?`): `Record`\<`string`, `string` \| `string`[]\>
|
|
128736
128736
|
|
|
128737
|
-
Defined in: [lib/undici.ts:
|
|
128737
|
+
Defined in: [lib/undici.ts:673](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L673)
|
|
128738
128738
|
|
|
128739
128739
|
剔除不代理的 header,返回新的 header
|
|
128740
128740
|
|
|
@@ -128775,7 +128775,7 @@ lib/undici/functions/getFormData.md
|
|
|
128775
128775
|
|
|
128776
128776
|
> **getFormData**(): [`FormData`](../formdata/classes/FormData.md)
|
|
128777
128777
|
|
|
128778
|
-
Defined in: [lib/undici.ts:
|
|
128778
|
+
Defined in: [lib/undici.ts:657](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L657)
|
|
128779
128779
|
|
|
128780
128780
|
创建 FormData 对象
|
|
128781
128781
|
|
|
@@ -128858,7 +128858,7 @@ lib/undici/functions/getResponseJson.md
|
|
|
128858
128858
|
|
|
128859
128859
|
> **getResponseJson**(`u`, `opt?`): `Promise`\<`any`\>
|
|
128860
128860
|
|
|
128861
|
-
Defined in: [lib/undici.ts:
|
|
128861
|
+
Defined in: [lib/undici.ts:281](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L281)
|
|
128862
128862
|
|
|
128863
128863
|
发起 GET 请求并解析 JSON 响应
|
|
128864
128864
|
|
|
@@ -128880,7 +128880,7 @@ Defined in: [lib/undici.ts:280](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
128880
128880
|
|
|
128881
128881
|
`Promise`\<`any`\>
|
|
128882
128882
|
|
|
128883
|
-
JSON
|
|
128883
|
+
最后一次响应的 JSON 数据,重试验证未通过也保留;请求或读取失败返回 null;JSON 解析失败返回 false
|
|
128884
128884
|
|
|
128885
128885
|
lib/undici/functions/mproxyData.md
|
|
128886
128886
|
---
|
|
@@ -128895,7 +128895,7 @@ lib/undici/functions/mproxyData.md
|
|
|
128895
128895
|
|
|
128896
128896
|
> **mproxyData**(`ctr`): `any`
|
|
128897
128897
|
|
|
128898
|
-
Defined in: [lib/undici.ts:
|
|
128898
|
+
Defined in: [lib/undici.ts:779](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L779)
|
|
128899
128899
|
|
|
128900
128900
|
获取 mproxy 的附加数据
|
|
128901
128901
|
|
|
@@ -128924,7 +128924,7 @@ lib/undici/functions/mproxy.md
|
|
|
128924
128924
|
|
|
128925
128925
|
> **mproxy**(`ctr`, `auth`, `opt?`): `Promise`\<`number`\>
|
|
128926
128926
|
|
|
128927
|
-
Defined in: [lib/undici.ts:
|
|
128927
|
+
Defined in: [lib/undici.ts:713](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L713)
|
|
128928
128928
|
|
|
128929
128929
|
正向 mproxy 代理,注意提前处理不要自动处理 post 数据,读取 get 的 url 为实际请求地址
|
|
128930
128930
|
get: url, auth
|
|
@@ -129034,7 +129034,7 @@ lib/undici/functions/postJsonResponseJson.md
|
|
|
129034
129034
|
|
|
129035
129035
|
> **postJsonResponseJson**(`u`, `data`, `opt?`): `Promise`\<`any`\>
|
|
129036
129036
|
|
|
129037
|
-
Defined in: [lib/undici.ts:
|
|
129037
|
+
Defined in: [lib/undici.ts:253](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L253)
|
|
129038
129038
|
|
|
129039
129039
|
发起 JSON 请求并解析 JSON 响应
|
|
129040
129040
|
|
|
@@ -129062,7 +129062,7 @@ Defined in: [lib/undici.ts:252](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
129062
129062
|
|
|
129063
129063
|
`Promise`\<`any`\>
|
|
129064
129064
|
|
|
129065
|
-
JSON
|
|
129065
|
+
最后一次响应的 JSON 数据,重试验证未通过也保留;请求或读取失败返回 null;JSON 解析失败返回 false
|
|
129066
129066
|
|
|
129067
129067
|
lib/undici/functions/post.md
|
|
129068
129068
|
---
|
|
@@ -129118,7 +129118,7 @@ lib/undici/functions/postResponseJson.md
|
|
|
129118
129118
|
|
|
129119
129119
|
> **postResponseJson**(`u`, `data`, `opt?`): `Promise`\<`any`\>
|
|
129120
129120
|
|
|
129121
|
-
Defined in: [lib/undici.ts:
|
|
129121
|
+
Defined in: [lib/undici.ts:268](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L268)
|
|
129122
129122
|
|
|
129123
129123
|
发起 POST 请求并解析 JSON 响应
|
|
129124
129124
|
|
|
@@ -129146,7 +129146,7 @@ Defined in: [lib/undici.ts:267](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
129146
129146
|
|
|
129147
129147
|
`Promise`\<`any`\>
|
|
129148
129148
|
|
|
129149
|
-
JSON
|
|
129149
|
+
最后一次响应的 JSON 数据,重试验证未通过也保留;请求或读取失败返回 null;JSON 解析失败返回 false
|
|
129150
129150
|
|
|
129151
129151
|
lib/undici/functions/request.md
|
|
129152
129152
|
---
|
|
@@ -129161,7 +129161,7 @@ lib/undici/functions/request.md
|
|
|
129161
129161
|
|
|
129162
129162
|
> **request**(`u`, `data?`, `opt?`): `Promise`\<[`Response`](../response/classes/Response.md)\>
|
|
129163
129163
|
|
|
129164
|
-
Defined in: [lib/undici.ts:
|
|
129164
|
+
Defined in: [lib/undici.ts:471](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L471)
|
|
129165
129165
|
|
|
129166
129166
|
发起一个请求
|
|
129167
129167
|
|
|
@@ -129198,7 +129198,7 @@ lib/undici/functions/rproxy.md
|
|
|
129198
129198
|
|
|
129199
129199
|
> **rproxy**(`ctr`, `route`, `opt?`): `Promise`\<`boolean`\>
|
|
129200
129200
|
|
|
129201
|
-
Defined in: [lib/undici.ts:
|
|
129201
|
+
Defined in: [lib/undici.ts:809](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L809)
|
|
129202
129202
|
|
|
129203
129203
|
反向代理,将本服务器的某个路由反代到其他网址
|
|
129204
129204
|
|
|
@@ -129287,7 +129287,7 @@ lib/undici/interfaces/IMproxyOptions.md
|
|
|
129287
129287
|
|
|
129288
129288
|
# Interface: IMproxyOptions
|
|
129289
129289
|
|
|
129290
|
-
Defined in: [lib/undici.ts:
|
|
129290
|
+
Defined in: [lib/undici.ts:944](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L944)
|
|
129291
129291
|
|
|
129292
129292
|
正向代理请求的传入参数选项
|
|
129293
129293
|
|
|
@@ -129297,7 +129297,7 @@ Defined in: [lib/undici.ts:943](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
129297
129297
|
|
|
129298
129298
|
> `optional` **filter?**: (`h`) => `boolean`
|
|
129299
129299
|
|
|
129300
|
-
Defined in: [lib/undici.ts:
|
|
129300
|
+
Defined in: [lib/undici.ts:957](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L957)
|
|
129301
129301
|
|
|
129302
129302
|
过滤 header,返回 true 则留下
|
|
129303
129303
|
|
|
@@ -129317,7 +129317,7 @@ Defined in: [lib/undici.ts:956](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
129317
129317
|
|
|
129318
129318
|
> `optional` **follow?**: `number`
|
|
129319
129319
|
|
|
129320
|
-
Defined in: [lib/undici.ts:
|
|
129320
|
+
Defined in: [lib/undici.ts:947](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L947)
|
|
129321
129321
|
|
|
129322
129322
|
***
|
|
129323
129323
|
|
|
@@ -129325,7 +129325,7 @@ Defined in: [lib/undici.ts:946](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
129325
129325
|
|
|
129326
129326
|
> `optional` **headers?**: [`THttpHeaders`](../type-aliases/THttpHeaders.md)
|
|
129327
129327
|
|
|
129328
|
-
Defined in: [lib/undici.ts:
|
|
129328
|
+
Defined in: [lib/undici.ts:951](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L951)
|
|
129329
129329
|
|
|
129330
129330
|
***
|
|
129331
129331
|
|
|
@@ -129333,7 +129333,7 @@ Defined in: [lib/undici.ts:950](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
129333
129333
|
|
|
129334
129334
|
> `optional` **hosts?**: `string` \| `Record`\<`string`, `string`\>
|
|
129335
129335
|
|
|
129336
|
-
Defined in: [lib/undici.ts:
|
|
129336
|
+
Defined in: [lib/undici.ts:949](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L949)
|
|
129337
129337
|
|
|
129338
129338
|
自定义 host 映射,如 {'www.maiyun.net': '127.0.0.1'},或全部映射到一个 host
|
|
129339
129339
|
|
|
@@ -129343,7 +129343,7 @@ Defined in: [lib/undici.ts:948](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
129343
129343
|
|
|
129344
129344
|
> `optional` **keepAliveTimeout?**: `number`
|
|
129345
129345
|
|
|
129346
|
-
Defined in: [lib/undici.ts:
|
|
129346
|
+
Defined in: [lib/undici.ts:953](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L953)
|
|
129347
129347
|
|
|
129348
129348
|
空闲连接允许复用的最长秒数;非正数或无效值按未设置处理;默认无服务端提示时为 4 秒,有提示时采用提示值减 2 秒且最多 600 秒
|
|
129349
129349
|
|
|
@@ -129353,7 +129353,7 @@ Defined in: [lib/undici.ts:952](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
129353
129353
|
|
|
129354
129354
|
> `optional` **local?**: `string`
|
|
129355
129355
|
|
|
129356
|
-
Defined in: [lib/undici.ts:
|
|
129356
|
+
Defined in: [lib/undici.ts:950](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L950)
|
|
129357
129357
|
|
|
129358
129358
|
***
|
|
129359
129359
|
|
|
@@ -129361,7 +129361,7 @@ Defined in: [lib/undici.ts:949](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
129361
129361
|
|
|
129362
129362
|
> `optional` **reuse?**: `string` \| `Agent` \| `ProxyAgent`
|
|
129363
129363
|
|
|
129364
|
-
Defined in: [lib/undici.ts:
|
|
129364
|
+
Defined in: [lib/undici.ts:959](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L959)
|
|
129365
129365
|
|
|
129366
129366
|
默认为 default
|
|
129367
129367
|
|
|
@@ -129371,7 +129371,7 @@ Defined in: [lib/undici.ts:958](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
129371
129371
|
|
|
129372
129372
|
> `optional` **reuseTimeout?**: `number`
|
|
129373
129373
|
|
|
129374
|
-
Defined in: [lib/undici.ts:
|
|
129374
|
+
Defined in: [lib/undici.ts:955](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L955)
|
|
129375
129375
|
|
|
129376
129376
|
连接建立后允许承接新请求的最长秒数;非正数或无效值按未设置处理;达到后不再复用但不会中断在途请求,默认不限制
|
|
129377
129377
|
|
|
@@ -129381,7 +129381,7 @@ Defined in: [lib/undici.ts:954](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
129381
129381
|
|
|
129382
129382
|
> `optional` **timeout?**: `number`
|
|
129383
129383
|
|
|
129384
|
-
Defined in: [lib/undici.ts:
|
|
129384
|
+
Defined in: [lib/undici.ts:946](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L946)
|
|
129385
129385
|
|
|
129386
129386
|
秒数,默认 300 秒
|
|
129387
129387
|
|
|
@@ -129396,7 +129396,7 @@ lib/undici/interfaces/IRequestOptions.md
|
|
|
129396
129396
|
|
|
129397
129397
|
# Interface: IRequestOptions
|
|
129398
129398
|
|
|
129399
|
-
Defined in: [lib/undici.ts:
|
|
129399
|
+
Defined in: [lib/undici.ts:901](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L901)
|
|
129400
129400
|
|
|
129401
129401
|
请求的传入参数选项
|
|
129402
129402
|
|
|
@@ -129406,7 +129406,7 @@ Defined in: [lib/undici.ts:900](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
129406
129406
|
|
|
129407
129407
|
> `optional` **cookie?**: `Record`\<`string`, [`ICookie`](../../cookie/interfaces/ICookie.md)\>
|
|
129408
129408
|
|
|
129409
|
-
Defined in: [lib/undici.ts:
|
|
129409
|
+
Defined in: [lib/undici.ts:936](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L936)
|
|
129410
129410
|
|
|
129411
129411
|
cookie 托管对象
|
|
129412
129412
|
|
|
@@ -129416,7 +129416,7 @@ cookie 托管对象
|
|
|
129416
129416
|
|
|
129417
129417
|
> `optional` **follow?**: `number`
|
|
129418
129418
|
|
|
129419
|
-
Defined in: [lib/undici.ts:
|
|
129419
|
+
Defined in: [lib/undici.ts:913](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L913)
|
|
129420
129420
|
|
|
129421
129421
|
追踪 location 次数,0 为不追踪,默认为 0
|
|
129422
129422
|
|
|
@@ -129426,7 +129426,7 @@ Defined in: [lib/undici.ts:912](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
129426
129426
|
|
|
129427
129427
|
> `optional` **headers?**: [`THttpHeaders`](../type-aliases/THttpHeaders.md)
|
|
129428
129428
|
|
|
129429
|
-
Defined in: [lib/undici.ts:
|
|
129429
|
+
Defined in: [lib/undici.ts:918](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L918)
|
|
129430
129430
|
|
|
129431
129431
|
***
|
|
129432
129432
|
|
|
@@ -129434,7 +129434,7 @@ Defined in: [lib/undici.ts:917](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
129434
129434
|
|
|
129435
129435
|
> `optional` **hosts?**: `string` \| `Record`\<`string`, `string`\>
|
|
129436
129436
|
|
|
129437
|
-
Defined in: [lib/undici.ts:
|
|
129437
|
+
Defined in: [lib/undici.ts:915](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L915)
|
|
129438
129438
|
|
|
129439
129439
|
自定义 host 映射,如 {'www.maiyun.net': '127.0.0.1'},或全部映射到一个 host
|
|
129440
129440
|
|
|
@@ -129444,7 +129444,7 @@ Defined in: [lib/undici.ts:914](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
129444
129444
|
|
|
129445
129445
|
> `optional` **keep?**: `boolean`
|
|
129446
129446
|
|
|
129447
|
-
Defined in: [lib/undici.ts:
|
|
129447
|
+
Defined in: [lib/undici.ts:928](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L928)
|
|
129448
129448
|
|
|
129449
129449
|
连接是否保持长连接(即是否允许复用),默认为 true
|
|
129450
129450
|
|
|
@@ -129454,7 +129454,7 @@ Defined in: [lib/undici.ts:927](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
129454
129454
|
|
|
129455
129455
|
> `optional` **keepAliveTimeout?**: `number`
|
|
129456
129456
|
|
|
129457
|
-
Defined in: [lib/undici.ts:
|
|
129457
|
+
Defined in: [lib/undici.ts:930](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L930)
|
|
129458
129458
|
|
|
129459
129459
|
空闲连接允许复用的最长秒数;非正数或无效值按未设置处理;默认无服务端提示时为 4 秒,有提示时采用提示值减 2 秒且最多 600 秒;自定义 Agent 由其自身配置
|
|
129460
129460
|
|
|
@@ -129464,7 +129464,7 @@ Defined in: [lib/undici.ts:929](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
129464
129464
|
|
|
129465
129465
|
> `optional` **local?**: `string`
|
|
129466
129466
|
|
|
129467
|
-
Defined in: [lib/undici.ts:
|
|
129467
|
+
Defined in: [lib/undici.ts:917](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L917)
|
|
129468
129468
|
|
|
129469
129469
|
***
|
|
129470
129470
|
|
|
@@ -129472,7 +129472,7 @@ Defined in: [lib/undici.ts:916](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
129472
129472
|
|
|
129473
129473
|
> `optional` **log?**: `boolean`
|
|
129474
129474
|
|
|
129475
|
-
Defined in: [lib/undici.ts:
|
|
129475
|
+
Defined in: [lib/undici.ts:938](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L938)
|
|
129476
129476
|
|
|
129477
129477
|
若有异常写入文件日志,默认为 true
|
|
129478
129478
|
|
|
@@ -129482,7 +129482,7 @@ Defined in: [lib/undici.ts:937](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
129482
129482
|
|
|
129483
129483
|
> `optional` **method?**: `"GET"` \| `"POST"` \| `"PUT"` \| `"DELETE"` \| `"OPTIONS"`
|
|
129484
129484
|
|
|
129485
|
-
Defined in: [lib/undici.ts:
|
|
129485
|
+
Defined in: [lib/undici.ts:902](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L902)
|
|
129486
129486
|
|
|
129487
129487
|
***
|
|
129488
129488
|
|
|
@@ -129490,7 +129490,7 @@ Defined in: [lib/undici.ts:901](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
129490
129490
|
|
|
129491
129491
|
> `optional` **mproxy?**: `object`
|
|
129492
129492
|
|
|
129493
|
-
Defined in: [lib/undici.ts:
|
|
129493
|
+
Defined in: [lib/undici.ts:920](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L920)
|
|
129494
129494
|
|
|
129495
129495
|
正向 mproxy 代理,url 如 https://xxx/abc
|
|
129496
129496
|
|
|
@@ -129518,7 +129518,7 @@ Defined in: [lib/undici.ts:919](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
129518
129518
|
|
|
129519
129519
|
> `optional` **retry?**: `number`
|
|
129520
129520
|
|
|
129521
|
-
Defined in: [lib/undici.ts:
|
|
129521
|
+
Defined in: [lib/undici.ts:907](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L907)
|
|
129522
129522
|
|
|
129523
129523
|
网络异常后的重试次数,默认 0;流式请求体不可重试,非幂等请求需由调用方保证安全
|
|
129524
129524
|
|
|
@@ -129528,9 +129528,9 @@ Defined in: [lib/undici.ts:906](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
129528
129528
|
|
|
129529
129529
|
> `optional` **retryJson?**: `number`
|
|
129530
129530
|
|
|
129531
|
-
Defined in: [lib/undici.ts:
|
|
129531
|
+
Defined in: [lib/undici.ts:909](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L909)
|
|
129532
129532
|
|
|
129533
|
-
JSON
|
|
129533
|
+
JSON 解析失败或重试验证未通过后的重试次数,默认 0;仅适用于 ResponseJson 快捷方法,非幂等请求需由调用方保证安全
|
|
129534
129534
|
|
|
129535
129535
|
***
|
|
129536
129536
|
|
|
@@ -129538,9 +129538,9 @@ JSON 解析失败后的重试次数,默认 0;仅适用于 ResponseJson 快
|
|
|
129538
129538
|
|
|
129539
129539
|
> `optional` **retryJsonHandler?**: (`json`) => `boolean`
|
|
129540
129540
|
|
|
129541
|
-
Defined in: [lib/undici.ts:
|
|
129541
|
+
Defined in: [lib/undici.ts:911](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L911)
|
|
129542
129542
|
|
|
129543
|
-
JSON 重试验证方法;返回 false 时按 retryJson
|
|
129543
|
+
JSON 重试验证方法;返回 false 时按 retryJson 的设置重试,耗尽后仍返回最后一次解析结果,业务结果由调用方判断;仅适用于 ResponseJson 快捷方法
|
|
129544
129544
|
|
|
129545
129545
|
#### Parameters
|
|
129546
129546
|
|
|
@@ -129558,7 +129558,7 @@ JSON 重试验证方法;返回 false 时按 retryJson 的设置重试,仅适
|
|
|
129558
129558
|
|
|
129559
129559
|
> `optional` **reuse?**: `string` \| `Agent` \| `ProxyAgent`
|
|
129560
129560
|
|
|
129561
|
-
Defined in: [lib/undici.ts:
|
|
129561
|
+
Defined in: [lib/undici.ts:934](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L934)
|
|
129562
129562
|
|
|
129563
129563
|
复用池名/Agent,默认为 default
|
|
129564
129564
|
|
|
@@ -129568,7 +129568,7 @@ Defined in: [lib/undici.ts:933](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
129568
129568
|
|
|
129569
129569
|
> `optional` **reuseTimeout?**: `number`
|
|
129570
129570
|
|
|
129571
|
-
Defined in: [lib/undici.ts:
|
|
129571
|
+
Defined in: [lib/undici.ts:932](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L932)
|
|
129572
129572
|
|
|
129573
129573
|
连接建立后允许承接新请求的最长秒数;非正数或无效值按未设置处理;达到后不再复用但不会中断在途请求,默认不限制;自定义 Agent 由其自身配置
|
|
129574
129574
|
|
|
@@ -129578,7 +129578,7 @@ Defined in: [lib/undici.ts:931](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
129578
129578
|
|
|
129579
129579
|
> `optional` **save?**: `string`
|
|
129580
129580
|
|
|
129581
|
-
Defined in: [lib/undici.ts:
|
|
129581
|
+
Defined in: [lib/undici.ts:916](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L916)
|
|
129582
129582
|
|
|
129583
129583
|
***
|
|
129584
129584
|
|
|
@@ -129586,7 +129586,7 @@ Defined in: [lib/undici.ts:915](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
129586
129586
|
|
|
129587
129587
|
> `optional` **signal?**: `AbortSignal`
|
|
129588
129588
|
|
|
129589
|
-
Defined in: [lib/undici.ts:
|
|
129589
|
+
Defined in: [lib/undici.ts:940](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L940)
|
|
129590
129590
|
|
|
129591
129591
|
请求中止信号
|
|
129592
129592
|
|
|
@@ -129596,7 +129596,7 @@ Defined in: [lib/undici.ts:939](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
129596
129596
|
|
|
129597
129597
|
> `optional` **timeout?**: `number`
|
|
129598
129598
|
|
|
129599
|
-
Defined in: [lib/undici.ts:
|
|
129599
|
+
Defined in: [lib/undici.ts:905](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L905)
|
|
129600
129600
|
|
|
129601
129601
|
秒数,默认 300 秒
|
|
129602
129602
|
|
|
@@ -129606,7 +129606,7 @@ Defined in: [lib/undici.ts:904](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
129606
129606
|
|
|
129607
129607
|
> `optional` **type?**: `"form"` \| `"json"`
|
|
129608
129608
|
|
|
129609
|
-
Defined in: [lib/undici.ts:
|
|
129609
|
+
Defined in: [lib/undici.ts:903](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L903)
|
|
129610
129610
|
|
|
129611
129611
|
lib/undici/interfaces/IRproxyOptions.md
|
|
129612
129612
|
---
|
|
@@ -129619,7 +129619,7 @@ lib/undici/interfaces/IRproxyOptions.md
|
|
|
129619
129619
|
|
|
129620
129620
|
# Interface: IRproxyOptions
|
|
129621
129621
|
|
|
129622
|
-
Defined in: [lib/undici.ts:
|
|
129622
|
+
Defined in: [lib/undici.ts:963](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L963)
|
|
129623
129623
|
|
|
129624
129624
|
反向代理请求的传入参数选项
|
|
129625
129625
|
|
|
@@ -129629,7 +129629,7 @@ Defined in: [lib/undici.ts:962](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
129629
129629
|
|
|
129630
129630
|
> `optional` **body?**: `string` \| `Buffer`\<`ArrayBufferLike`\> \| `Readable`
|
|
129631
129631
|
|
|
129632
|
-
Defined in: [lib/undici.ts:
|
|
129632
|
+
Defined in: [lib/undici.ts:986](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L986)
|
|
129633
129633
|
|
|
129634
129634
|
手动传入请求体(优先于原始 req 流),用于 req 流已消费后仍需转发 body 的场景
|
|
129635
129635
|
|
|
@@ -129639,7 +129639,7 @@ Defined in: [lib/undici.ts:985](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
129639
129639
|
|
|
129640
129640
|
> `optional` **filter?**: (`h`) => `boolean`
|
|
129641
129641
|
|
|
129642
|
-
Defined in: [lib/undici.ts:
|
|
129642
|
+
Defined in: [lib/undici.ts:976](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L976)
|
|
129643
129643
|
|
|
129644
129644
|
过滤 header,返回 true 则留下
|
|
129645
129645
|
|
|
@@ -129659,7 +129659,7 @@ Defined in: [lib/undici.ts:975](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
129659
129659
|
|
|
129660
129660
|
> `optional` **follow?**: `number`
|
|
129661
129661
|
|
|
129662
|
-
Defined in: [lib/undici.ts:
|
|
129662
|
+
Defined in: [lib/undici.ts:966](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L966)
|
|
129663
129663
|
|
|
129664
129664
|
***
|
|
129665
129665
|
|
|
@@ -129667,7 +129667,7 @@ Defined in: [lib/undici.ts:965](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
129667
129667
|
|
|
129668
129668
|
> `optional` **headers?**: [`THttpHeaders`](../type-aliases/THttpHeaders.md)
|
|
129669
129669
|
|
|
129670
|
-
Defined in: [lib/undici.ts:
|
|
129670
|
+
Defined in: [lib/undici.ts:970](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L970)
|
|
129671
129671
|
|
|
129672
129672
|
***
|
|
129673
129673
|
|
|
@@ -129675,7 +129675,7 @@ Defined in: [lib/undici.ts:969](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
129675
129675
|
|
|
129676
129676
|
> `optional` **hosts?**: `string` \| `Record`\<`string`, `string`\>
|
|
129677
129677
|
|
|
129678
|
-
Defined in: [lib/undici.ts:
|
|
129678
|
+
Defined in: [lib/undici.ts:968](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L968)
|
|
129679
129679
|
|
|
129680
129680
|
自定义 host 映射,如 {'www.maiyun.net': '127.0.0.1'},或全部映射到一个 host
|
|
129681
129681
|
|
|
@@ -129685,7 +129685,7 @@ Defined in: [lib/undici.ts:967](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
129685
129685
|
|
|
129686
129686
|
> `optional` **keepAliveTimeout?**: `number`
|
|
129687
129687
|
|
|
129688
|
-
Defined in: [lib/undici.ts:
|
|
129688
|
+
Defined in: [lib/undici.ts:972](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L972)
|
|
129689
129689
|
|
|
129690
129690
|
空闲连接允许复用的最长秒数;非正数或无效值按未设置处理;默认无服务端提示时为 4 秒,有提示时采用提示值减 2 秒且最多 600 秒
|
|
129691
129691
|
|
|
@@ -129695,7 +129695,7 @@ Defined in: [lib/undici.ts:971](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
129695
129695
|
|
|
129696
129696
|
> `optional` **local?**: `string`
|
|
129697
129697
|
|
|
129698
|
-
Defined in: [lib/undici.ts:
|
|
129698
|
+
Defined in: [lib/undici.ts:969](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L969)
|
|
129699
129699
|
|
|
129700
129700
|
***
|
|
129701
129701
|
|
|
@@ -129703,7 +129703,7 @@ Defined in: [lib/undici.ts:968](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
129703
129703
|
|
|
129704
129704
|
> `optional` **mproxy?**: `object`
|
|
129705
129705
|
|
|
129706
|
-
Defined in: [lib/undici.ts:
|
|
129706
|
+
Defined in: [lib/undici.ts:978](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L978)
|
|
129707
129707
|
|
|
129708
129708
|
正向 mproxy 代理,url 如 https://xxx/abc
|
|
129709
129709
|
|
|
@@ -129731,7 +129731,7 @@ Defined in: [lib/undici.ts:977](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
129731
129731
|
|
|
129732
129732
|
> `optional` **querys?**: `Record`\<`string`, `any`\>
|
|
129733
129733
|
|
|
129734
|
-
Defined in: [lib/undici.ts:
|
|
129734
|
+
Defined in: [lib/undici.ts:988](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L988)
|
|
129735
129735
|
|
|
129736
129736
|
自定义 GET 查询参数,传入后直接替换代理目标 URL 的整个 query string
|
|
129737
129737
|
|
|
@@ -129741,7 +129741,7 @@ Defined in: [lib/undici.ts:987](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
129741
129741
|
|
|
129742
129742
|
> `optional` **reuse?**: `string` \| `Agent` \| `ProxyAgent`
|
|
129743
129743
|
|
|
129744
|
-
Defined in: [lib/undici.ts:
|
|
129744
|
+
Defined in: [lib/undici.ts:990](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L990)
|
|
129745
129745
|
|
|
129746
129746
|
默认为 default
|
|
129747
129747
|
|
|
@@ -129751,7 +129751,7 @@ Defined in: [lib/undici.ts:989](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
129751
129751
|
|
|
129752
129752
|
> `optional` **reuseTimeout?**: `number`
|
|
129753
129753
|
|
|
129754
|
-
Defined in: [lib/undici.ts:
|
|
129754
|
+
Defined in: [lib/undici.ts:974](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L974)
|
|
129755
129755
|
|
|
129756
129756
|
连接建立后允许承接新请求的最长秒数;非正数或无效值按未设置处理;达到后不再复用但不会中断在途请求,默认不限制
|
|
129757
129757
|
|
|
@@ -129761,7 +129761,7 @@ Defined in: [lib/undici.ts:973](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
129761
129761
|
|
|
129762
129762
|
> `optional` **timeout?**: `number`
|
|
129763
129763
|
|
|
129764
|
-
Defined in: [lib/undici.ts:
|
|
129764
|
+
Defined in: [lib/undici.ts:965](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L965)
|
|
129765
129765
|
|
|
129766
129766
|
秒数,默认 300 秒
|
|
129767
129767
|
|
|
@@ -130316,7 +130316,7 @@ lib/undici/type-aliases/THttpHeaders.md
|
|
|
130316
130316
|
|
|
130317
130317
|
> **THttpHeaders** = `http.IncomingHttpHeaders` & `object`
|
|
130318
130318
|
|
|
130319
|
-
Defined in: [lib/undici.ts:
|
|
130319
|
+
Defined in: [lib/undici.ts:995](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L995)
|
|
130320
130320
|
|
|
130321
130321
|
http headers
|
|
130322
130322
|
|
package/index.d.ts
CHANGED
package/index.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* --- 本文件用来定义每个目录实体地址的常量 ---
|
|
7
7
|
*/
|
|
8
8
|
/** --- 当前系统版本号 --- */
|
|
9
|
-
export const VER = '9.
|
|
9
|
+
export const VER = '9.23.0';
|
|
10
10
|
// --- 服务端用的路径 ---
|
|
11
11
|
const imu = decodeURIComponent(import.meta.url).replace('file://', '').replace(/^\/(\w:)/, '$1');
|
|
12
12
|
/** --- /xxx/xxx --- */
|
package/lib/undici/response.d.ts
CHANGED
|
@@ -31,7 +31,7 @@ export declare class Response {
|
|
|
31
31
|
/**
|
|
32
32
|
* --- 获取响应读取流对象 ---
|
|
33
33
|
*/
|
|
34
|
-
getStream(): (import("undici/types/readable").default & undici.Dispatcher.BodyMixin) |
|
|
34
|
+
getStream(): zlib.BrotliDecompress | zlib.Gunzip | zlib.Inflate | (import("undici/types/readable").default & undici.Dispatcher.BodyMixin) | null;
|
|
35
35
|
/**
|
|
36
36
|
* --- 获取原生响应读取流对象 ---
|
|
37
37
|
*/
|
package/lib/undici.d.ts
CHANGED
|
@@ -40,7 +40,7 @@ export declare function postJson(u: string, data: kebab.Json[] | Record<string,
|
|
|
40
40
|
* @param u 网址
|
|
41
41
|
* @param data 数据
|
|
42
42
|
* @param opt 选项
|
|
43
|
-
* @returns JSON
|
|
43
|
+
* @returns 最后一次响应的 JSON 数据,重试验证未通过也保留;请求或读取失败返回 null;JSON 解析失败返回 false
|
|
44
44
|
*/
|
|
45
45
|
export declare function postJsonResponseJson(u: string, data: kebab.Json[] | Record<string, kebab.Json>, opt?: IRequestOptions): Promise<kebab.Json | null | false>;
|
|
46
46
|
/**
|
|
@@ -48,14 +48,14 @@ export declare function postJsonResponseJson(u: string, data: kebab.Json[] | Rec
|
|
|
48
48
|
* @param u 网址
|
|
49
49
|
* @param data 数据
|
|
50
50
|
* @param opt 选项
|
|
51
|
-
* @returns JSON
|
|
51
|
+
* @returns 最后一次响应的 JSON 数据,重试验证未通过也保留;请求或读取失败返回 null;JSON 解析失败返回 false
|
|
52
52
|
*/
|
|
53
53
|
export declare function postResponseJson(u: string, data: Record<string, kebab.Json>, opt?: IRequestOptions): Promise<kebab.Json | null | false>;
|
|
54
54
|
/**
|
|
55
55
|
* --- 发起 GET 请求并解析 JSON 响应 ---
|
|
56
56
|
* @param u 网址
|
|
57
57
|
* @param opt 选项
|
|
58
|
-
* @returns JSON
|
|
58
|
+
* @returns 最后一次响应的 JSON 数据,重试验证未通过也保留;请求或读取失败返回 null;JSON 解析失败返回 false
|
|
59
59
|
*/
|
|
60
60
|
export declare function getResponseJson(u: string, opt?: IRequestOptions): Promise<kebab.Json | null | false>;
|
|
61
61
|
/**
|
|
@@ -135,9 +135,9 @@ export interface IRequestOptions {
|
|
|
135
135
|
'timeout'?: number;
|
|
136
136
|
/** --- 网络异常后的重试次数,默认 0;流式请求体不可重试,非幂等请求需由调用方保证安全 --- */
|
|
137
137
|
'retry'?: number;
|
|
138
|
-
/** --- JSON
|
|
138
|
+
/** --- JSON 解析失败或重试验证未通过后的重试次数,默认 0;仅适用于 ResponseJson 快捷方法,非幂等请求需由调用方保证安全 --- */
|
|
139
139
|
'retryJson'?: number;
|
|
140
|
-
/** --- JSON 重试验证方法;返回 false 时按 retryJson
|
|
140
|
+
/** --- JSON 重试验证方法;返回 false 时按 retryJson 的设置重试,耗尽后仍返回最后一次解析结果,业务结果由调用方判断;仅适用于 ResponseJson 快捷方法 --- */
|
|
141
141
|
'retryJsonHandler'?: (json: kebab.Json) => boolean;
|
|
142
142
|
/** --- 追踪 location 次数,0 为不追踪,默认为 0 --- */
|
|
143
143
|
'follow'?: number;
|
package/lib/undici.js
CHANGED
|
@@ -165,12 +165,12 @@ export async function postJson(u, data, opt = {}) {
|
|
|
165
165
|
return request(u, data, opt);
|
|
166
166
|
}
|
|
167
167
|
/**
|
|
168
|
-
* --- 发起请求并解析 JSON
|
|
168
|
+
* --- 发起请求并解析 JSON 响应,解析失败或重试验证未通过时重新请求 ---
|
|
169
169
|
* @param u 网址
|
|
170
170
|
* @param data 请求数据
|
|
171
171
|
* @param opt 请求选项
|
|
172
172
|
* @param action 日志动作名
|
|
173
|
-
* @returns JSON
|
|
173
|
+
* @returns 最后一次响应的 JSON 数据,重试验证未通过也保留;请求或读取失败返回 null;JSON 解析失败返回 false
|
|
174
174
|
*/
|
|
175
175
|
async function requestResponseJson(u, data, opt, action) {
|
|
176
176
|
const retryJson = normalizeRetry(opt.retryJson);
|
|
@@ -195,7 +195,8 @@ async function requestResponseJson(u, data, opt, action) {
|
|
|
195
195
|
const reason = json ? 'retry json handler returned false' : 'parse json failed';
|
|
196
196
|
lCore.log({}, `[UNDICI][${action}] ${reason}, url: ${u}${requestData}, content: ${rtnStr}`, '-neterror');
|
|
197
197
|
}
|
|
198
|
-
|
|
198
|
+
// --- 重试耗尽仍保留本次解析结果,交给调用方判断业务错误 ---
|
|
199
|
+
return json;
|
|
199
200
|
}
|
|
200
201
|
return false;
|
|
201
202
|
}
|
|
@@ -204,7 +205,7 @@ async function requestResponseJson(u, data, opt, action) {
|
|
|
204
205
|
* @param u 网址
|
|
205
206
|
* @param data 数据
|
|
206
207
|
* @param opt 选项
|
|
207
|
-
* @returns JSON
|
|
208
|
+
* @returns 最后一次响应的 JSON 数据,重试验证未通过也保留;请求或读取失败返回 null;JSON 解析失败返回 false
|
|
208
209
|
*/
|
|
209
210
|
export async function postJsonResponseJson(u, data, opt = {}) {
|
|
210
211
|
opt.method = 'POST';
|
|
@@ -216,7 +217,7 @@ export async function postJsonResponseJson(u, data, opt = {}) {
|
|
|
216
217
|
* @param u 网址
|
|
217
218
|
* @param data 数据
|
|
218
219
|
* @param opt 选项
|
|
219
|
-
* @returns JSON
|
|
220
|
+
* @returns 最后一次响应的 JSON 数据,重试验证未通过也保留;请求或读取失败返回 null;JSON 解析失败返回 false
|
|
220
221
|
*/
|
|
221
222
|
export async function postResponseJson(u, data, opt = {}) {
|
|
222
223
|
opt.method = 'POST';
|
|
@@ -226,7 +227,7 @@ export async function postResponseJson(u, data, opt = {}) {
|
|
|
226
227
|
* --- 发起 GET 请求并解析 JSON 响应 ---
|
|
227
228
|
* @param u 网址
|
|
228
229
|
* @param opt 选项
|
|
229
|
-
* @returns JSON
|
|
230
|
+
* @returns 最后一次响应的 JSON 数据,重试验证未通过也保留;请求或读取失败返回 null;JSON 解析失败返回 false
|
|
230
231
|
*/
|
|
231
232
|
export async function getResponseJson(u, opt = {}) {
|
|
232
233
|
return requestResponseJson(u, undefined, opt, 'GETRESPONSEJSON');
|