@maiyunnet/kebab 9.15.5 → 9.16.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 +194 -104
- package/index.d.ts +1 -1
- package/index.js +1 -1
- package/lib/core.d.ts +27 -3
- package/lib/core.js +32 -4
- package/lib/text.d.ts +6 -0
- package/lib/text.js +24 -1
- package/lib/undici/request.d.ts +6 -1
- package/lib/undici/request.js +8 -0
- package/lib/undici/response.d.ts +1 -1
- package/lib/undici/response.js +2 -1
- package/lib/undici.d.ts +7 -3
- package/lib/undici.js +48 -8
- package/package.json +1 -1
- package/sys/child.js +15 -12
- package/sys/ctr.js +3 -3
- package/sys/master.js +41 -2
- package/sys/monitor/watchdog.js +9 -5
- package/sys/monitor.d.ts +8 -1
- package/sys/monitor.js +198 -81
- package/sys/route.d.ts +1 -1
- package/sys/route.js +14 -14
- package/www/example/ctr/test.d.ts +2 -0
- package/www/example/ctr/test.js +44 -3
package/doc/kebab-rag.md
CHANGED
|
@@ -1361,7 +1361,7 @@ index/variables/VER.md
|
|
|
1361
1361
|
|
|
1362
1362
|
# Variable: VER
|
|
1363
1363
|
|
|
1364
|
-
> `const` **VER**: `"9.
|
|
1364
|
+
> `const` **VER**: `"9.16.0"` = `'9.16.0'`
|
|
1365
1365
|
|
|
1366
1366
|
Defined in: [index.ts:10](https://github.com/maiyunnet/kebab/blob/master/index.ts#L10)
|
|
1367
1367
|
|
|
@@ -3351,7 +3351,7 @@ lib/core/functions/clone.md
|
|
|
3351
3351
|
|
|
3352
3352
|
> **clone**\<`T`\>(`obj`): `T`
|
|
3353
3353
|
|
|
3354
|
-
Defined in: [lib/core.ts:
|
|
3354
|
+
Defined in: [lib/core.ts:1350](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1350)
|
|
3355
3355
|
|
|
3356
3356
|
完整的克隆一份数组/对象
|
|
3357
3357
|
|
|
@@ -3415,7 +3415,7 @@ lib/core/functions/debug.md
|
|
|
3415
3415
|
|
|
3416
3416
|
> **debug**(`message?`, ...`optionalParams`): `void`
|
|
3417
3417
|
|
|
3418
|
-
Defined in: [lib/core.ts:
|
|
3418
|
+
Defined in: [lib/core.ts:1396](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1396)
|
|
3419
3419
|
|
|
3420
3420
|
打印调试信息,线上环境不会打印
|
|
3421
3421
|
|
|
@@ -3450,7 +3450,7 @@ lib/core/functions/display.md
|
|
|
3450
3450
|
|
|
3451
3451
|
> **display**(`message?`, ...`optionalParams`): `void`
|
|
3452
3452
|
|
|
3453
|
-
Defined in: [lib/core.ts:
|
|
3453
|
+
Defined in: [lib/core.ts:1409](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1409)
|
|
3454
3454
|
|
|
3455
3455
|
向控制台直接显示内容,一般情况下禁止使用
|
|
3456
3456
|
|
|
@@ -3538,6 +3538,13 @@ Defined in: [lib/core.ts:680](https://github.com/maiyunnet/kebab/blob/master/lib
|
|
|
3538
3538
|
|
|
3539
3539
|
`string`
|
|
3540
3540
|
|
|
3541
|
+
#### timeout?
|
|
3542
|
+
|
|
3543
|
+
`number`
|
|
3544
|
+
|
|
3545
|
+
命令超时毫秒数,超时后终止命令并以失败返回
|
|
3546
|
+
默认无超时限制:不传时命令可一直运行直至完成,与 cp.exec 默认行为一致
|
|
3547
|
+
|
|
3541
3548
|
## Returns
|
|
3542
3549
|
|
|
3543
3550
|
`Promise`\<`string` \| `false`\>
|
|
@@ -3555,7 +3562,7 @@ lib/core/functions/getLog.md
|
|
|
3555
3562
|
|
|
3556
3563
|
> **getLog**(`opt`): `Promise`\<`false` \| \{ `list`: `any`[] \| `string`[][]; `total`: `number`; \}\>
|
|
3557
3564
|
|
|
3558
|
-
Defined in: [lib/core.ts:
|
|
3565
|
+
Defined in: [lib/core.ts:1262](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1262)
|
|
3559
3566
|
|
|
3560
3567
|
获取日志内容为一个数组
|
|
3561
3568
|
|
|
@@ -3728,7 +3735,7 @@ lib/core/functions/loadEnv.md
|
|
|
3728
3735
|
|
|
3729
3736
|
> **loadEnv**(`dir`): `Promise`\<`void`\>
|
|
3730
3737
|
|
|
3731
|
-
Defined in: [lib/core.ts:
|
|
3738
|
+
Defined in: [lib/core.ts:1480](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1480)
|
|
3732
3739
|
|
|
3733
3740
|
加载 .env 文件到 process.env,若文件不存在则跳过
|
|
3734
3741
|
|
|
@@ -3757,7 +3764,7 @@ lib/core/functions/log.md
|
|
|
3757
3764
|
|
|
3758
3765
|
> **log**(`opt`, `msg`, `fend?`): `void`
|
|
3759
3766
|
|
|
3760
|
-
Defined in: [lib/core.ts:
|
|
3767
|
+
Defined in: [lib/core.ts:1149](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1149)
|
|
3761
3768
|
|
|
3762
3769
|
写入文件日志
|
|
3763
3770
|
|
|
@@ -3798,7 +3805,7 @@ lib/core/functions/ls.md
|
|
|
3798
3805
|
|
|
3799
3806
|
> **ls**(`opt`): `Promise`\<`object`[]\>
|
|
3800
3807
|
|
|
3801
|
-
Defined in: [lib/core.ts:
|
|
3808
|
+
Defined in: [lib/core.ts:1311](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1311)
|
|
3802
3809
|
|
|
3803
3810
|
获取目录内文件/文件夹列表
|
|
3804
3811
|
|
|
@@ -4168,7 +4175,7 @@ lib/core/functions/removeGlobal.md
|
|
|
4168
4175
|
|
|
4169
4176
|
> **removeGlobal**(`key`, `hosts?`): `Promise`\<`Record`\<`string`, \{ `result`: `boolean`; `return`: `string`; \}\>\>
|
|
4170
4177
|
|
|
4171
|
-
Defined in: [lib/core.ts:
|
|
4178
|
+
Defined in: [lib/core.ts:966](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L966)
|
|
4172
4179
|
|
|
4173
4180
|
移除某个跨线程/跨内网服务器全局变量
|
|
4174
4181
|
|
|
@@ -4203,7 +4210,7 @@ lib/core/functions/resolveEnvVars.md
|
|
|
4203
4210
|
|
|
4204
4211
|
> **resolveEnvVars**(`obj`): `void`
|
|
4205
4212
|
|
|
4206
|
-
Defined in: [lib/core.ts:
|
|
4213
|
+
Defined in: [lib/core.ts:1510](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1510)
|
|
4207
4214
|
|
|
4208
4215
|
将配置对象中的 ${ENV_VAR} 占位符替换为 process.env 的值
|
|
4209
4216
|
|
|
@@ -4232,7 +4239,7 @@ lib/core/functions/sendNpm.md
|
|
|
4232
4239
|
|
|
4233
4240
|
> **sendNpm**(`path`, `hosts?`): `Promise`\<`Record`\<`string`, \{ `result`: `boolean`; `return`: `string`; \}\>\>
|
|
4234
4241
|
|
|
4235
|
-
Defined in: [lib/core.ts:
|
|
4242
|
+
Defined in: [lib/core.ts:865](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L865)
|
|
4236
4243
|
|
|
4237
4244
|
向本机或局域网 RPC 发送 npm install 操作
|
|
4238
4245
|
|
|
@@ -4267,7 +4274,7 @@ lib/core/functions/sendPackage.md
|
|
|
4267
4274
|
|
|
4268
4275
|
> **sendPackage**(`content`, `hosts?`): `Promise`\<`Record`\<`string`, \{ `result`: `boolean`; `return`: `string`; \}\>\>
|
|
4269
4276
|
|
|
4270
|
-
Defined in: [lib/core.ts:
|
|
4277
|
+
Defined in: [lib/core.ts:1089](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1089)
|
|
4271
4278
|
|
|
4272
4279
|
向本机或局域网 RPC 发送 package.json 更新操作
|
|
4273
4280
|
|
|
@@ -4302,7 +4309,7 @@ lib/core/functions/sendPm2.md
|
|
|
4302
4309
|
|
|
4303
4310
|
> **sendPm2**(`name`, `action?`, `hosts?`): `Promise`\<`Record`\<`string`, \{ `result`: `boolean`; `return`: `string`; \}\>\>
|
|
4304
4311
|
|
|
4305
|
-
Defined in: [lib/core.ts:
|
|
4312
|
+
Defined in: [lib/core.ts:817](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L817)
|
|
4306
4313
|
|
|
4307
4314
|
向本机或局域网 RPC 发送 PM2 操作
|
|
4308
4315
|
|
|
@@ -4343,7 +4350,7 @@ lib/core/functions/sendProject.md
|
|
|
4343
4350
|
|
|
4344
4351
|
> **sendProject**(`path`, `key`, `value`, `hosts?`): `Promise`\<`Record`\<`string`, \{ `result`: `boolean`; `return`: `string`; \}\>\>
|
|
4345
4352
|
|
|
4346
|
-
Defined in: [lib/core.ts:
|
|
4353
|
+
Defined in: [lib/core.ts:1041](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1041)
|
|
4347
4354
|
|
|
4348
4355
|
向本机或局域网 RPC 发送项目配置更新操作
|
|
4349
4356
|
|
|
@@ -4390,7 +4397,7 @@ lib/core/functions/sendReload.md
|
|
|
4390
4397
|
|
|
4391
4398
|
> **sendReload**(`hosts?`): `Promise`\<`Record`\<`string`, \{ `result`: `boolean`; `return`: `string`; \}\>\>
|
|
4392
4399
|
|
|
4393
|
-
Defined in: [lib/core.ts:
|
|
4400
|
+
Defined in: [lib/core.ts:706](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L706)
|
|
4394
4401
|
|
|
4395
4402
|
向主进程(或局域网同代码机子)发送广播将进行 reload 操作,等待回传
|
|
4396
4403
|
主要作用除代码热更新以外的其他情况
|
|
@@ -4418,7 +4425,7 @@ lib/core/functions/sendRestart.md
|
|
|
4418
4425
|
|
|
4419
4426
|
> **sendRestart**(`hosts?`): `Promise`\<`Record`\<`string`, \{ `result`: `boolean`; `return`: `string`; \}\>\>
|
|
4420
4427
|
|
|
4421
|
-
Defined in: [lib/core.ts:
|
|
4428
|
+
Defined in: [lib/core.ts:759](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L759)
|
|
4422
4429
|
|
|
4423
4430
|
向主进程(或局域网同代码机子)发送广播将进行 restart 操作,停止监听并启动新进程,老进程在连接全部断开后自行销毁
|
|
4424
4431
|
主要用作不间断的代码热更新
|
|
@@ -4493,7 +4500,7 @@ lib/core/functions/setGlobal.md
|
|
|
4493
4500
|
|
|
4494
4501
|
> **setGlobal**(`key`, `data`, `hosts?`): `Promise`\<`Record`\<`string`, \{ `result`: `boolean`; `return`: `string`; \}\>\>
|
|
4495
4502
|
|
|
4496
|
-
Defined in: [lib/core.ts:
|
|
4503
|
+
Defined in: [lib/core.ts:916](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L916)
|
|
4497
4504
|
|
|
4498
4505
|
设置跨线程/指定的局域网主机的全局变量
|
|
4499
4506
|
|
|
@@ -4592,7 +4599,7 @@ lib/core/functions/updateCode.md
|
|
|
4592
4599
|
|
|
4593
4600
|
> **updateCode**(`sourcePath`, `path`, `hosts?`, `config?`, `strict?`): `Promise`\<`Record`\<`string`, \{ `result`: `boolean`; `return`: `string`; \}\>\>
|
|
4594
4601
|
|
|
4595
|
-
Defined in: [lib/core.ts:
|
|
4602
|
+
Defined in: [lib/core.ts:981](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L981)
|
|
4596
4603
|
|
|
4597
4604
|
上传并覆盖代码文件,config.json、kebab.json、.js.map、.ts, .gitignore 不会被覆盖和新创建
|
|
4598
4605
|
|
|
@@ -4645,7 +4652,13 @@ lib/core/functions/writeEventStreamHead.md
|
|
|
4645
4652
|
|
|
4646
4653
|
> **writeEventStreamHead**(`res`): `void`
|
|
4647
4654
|
|
|
4648
|
-
Defined in: [lib/core.ts:
|
|
4655
|
+
Defined in: [lib/core.ts:1450](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1450)
|
|
4656
|
+
|
|
4657
|
+
提交服务器发送事件(SSE)响应头
|
|
4658
|
+
|
|
4659
|
+
在发送第一条事件前调用一次,固定提交状态码 200、事件流内容类型和禁止缓存头部。
|
|
4660
|
+
SSE 的内容长度和结束时间未知,因此不设置 `content-length`;调用后响应头已经提交,
|
|
4661
|
+
不能再调用 `setHeader()`,后续应使用 `write()` 持续发送事件,并由调用方在结束时关闭响应。
|
|
4649
4662
|
|
|
4650
4663
|
## Parameters
|
|
4651
4664
|
|
|
@@ -4653,10 +4666,14 @@ Defined in: [lib/core.ts:1417](https://github.com/maiyunnet/kebab/blob/master/li
|
|
|
4653
4666
|
|
|
4654
4667
|
`Http2ServerResponse`\<`Http2ServerRequest`\> \| `ServerResponse`\<`IncomingMessage`\>
|
|
4655
4668
|
|
|
4669
|
+
响应对象
|
|
4670
|
+
|
|
4656
4671
|
## Returns
|
|
4657
4672
|
|
|
4658
4673
|
`void`
|
|
4659
4674
|
|
|
4675
|
+
无返回值
|
|
4676
|
+
|
|
4660
4677
|
lib/core/functions/writeHead.md
|
|
4661
4678
|
---
|
|
4662
4679
|
|
|
@@ -4670,9 +4687,16 @@ lib/core/functions/writeHead.md
|
|
|
4670
4687
|
|
|
4671
4688
|
> **writeHead**(`res`, `statusCode`, `headers?`): `void`
|
|
4672
4689
|
|
|
4673
|
-
Defined in: [lib/core.ts:
|
|
4690
|
+
Defined in: [lib/core.ts:1429](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1429)
|
|
4691
|
+
|
|
4692
|
+
提交 HTTP 响应状态和头部,兼容 HTTP/1.1 与 HTTP/2
|
|
4693
|
+
|
|
4694
|
+
`setHeader()` 只暂存或修改单个头部,不会发送响应头,也不能提交状态码;在响应头提交前可反复调用。
|
|
4695
|
+
本方法会立即提交状态码和此前设置的全部头部,必须在所有 `setHeader()` 调用之后、首次
|
|
4696
|
+
`write()`、`end()` 或 `pipe()` 之前调用。提交后再调用 `setHeader()` 会抛出 `ERR_HTTP_HEADERS_SENT`。
|
|
4674
4697
|
|
|
4675
|
-
|
|
4698
|
+
普通控制器应设置 `_httpCode`、调用 `_res.setHeader()` 并直接返回内容,由路由层统一提交响应头。
|
|
4699
|
+
仅框架内部或手动接管响应(错误、重定向、代理、流式输出等)时才应直接调用本方法。
|
|
4676
4700
|
|
|
4677
4701
|
## Parameters
|
|
4678
4702
|
|
|
@@ -4686,18 +4710,20 @@ Defined in: [lib/core.ts:1406](https://github.com/maiyunnet/kebab/blob/master/li
|
|
|
4686
4710
|
|
|
4687
4711
|
`number`
|
|
4688
4712
|
|
|
4689
|
-
状态码
|
|
4713
|
+
HTTP 状态码
|
|
4690
4714
|
|
|
4691
4715
|
### headers?
|
|
4692
4716
|
|
|
4693
4717
|
`OutgoingHttpHeaders`
|
|
4694
4718
|
|
|
4695
|
-
|
|
4719
|
+
随本次提交附加的头部;通常优先在提交前使用 `setHeader()`
|
|
4696
4720
|
|
|
4697
4721
|
## Returns
|
|
4698
4722
|
|
|
4699
4723
|
`void`
|
|
4700
4724
|
|
|
4725
|
+
无返回值
|
|
4726
|
+
|
|
4701
4727
|
lib/core/functions/write.md
|
|
4702
4728
|
---
|
|
4703
4729
|
|
|
@@ -4711,7 +4737,7 @@ lib/core/functions/write.md
|
|
|
4711
4737
|
|
|
4712
4738
|
> **write**(`res`, `data`): `void`
|
|
4713
4739
|
|
|
4714
|
-
Defined in: [lib/core.ts:
|
|
4740
|
+
Defined in: [lib/core.ts:1462](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1462)
|
|
4715
4741
|
|
|
4716
4742
|
向 res 发送数据
|
|
4717
4743
|
|
|
@@ -4886,7 +4912,7 @@ lib/core/interfaces/ILogOptions.md
|
|
|
4886
4912
|
|
|
4887
4913
|
# Interface: ILogOptions
|
|
4888
4914
|
|
|
4889
|
-
Defined in: [lib/core.ts:
|
|
4915
|
+
Defined in: [lib/core.ts:1132](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1132)
|
|
4890
4916
|
|
|
4891
4917
|
log 设置的选项
|
|
4892
4918
|
|
|
@@ -4896,7 +4922,7 @@ log 设置的选项
|
|
|
4896
4922
|
|
|
4897
4923
|
> `optional` **cookie?**: `Record`\<`string`, `string`\>
|
|
4898
4924
|
|
|
4899
|
-
Defined in: [lib/core.ts:
|
|
4925
|
+
Defined in: [lib/core.ts:1138](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1138)
|
|
4900
4926
|
|
|
4901
4927
|
***
|
|
4902
4928
|
|
|
@@ -4904,7 +4930,7 @@ Defined in: [lib/core.ts:1124](https://github.com/maiyunnet/kebab/blob/master/li
|
|
|
4904
4930
|
|
|
4905
4931
|
> `optional` **get?**: `Record`\<`string`, `any`\>
|
|
4906
4932
|
|
|
4907
|
-
Defined in: [lib/core.ts:
|
|
4933
|
+
Defined in: [lib/core.ts:1137](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1137)
|
|
4908
4934
|
|
|
4909
4935
|
***
|
|
4910
4936
|
|
|
@@ -4912,7 +4938,7 @@ Defined in: [lib/core.ts:1123](https://github.com/maiyunnet/kebab/blob/master/li
|
|
|
4912
4938
|
|
|
4913
4939
|
> `optional` **headers?**: `IncomingHttpHeaders`
|
|
4914
4940
|
|
|
4915
|
-
Defined in: [lib/core.ts:
|
|
4941
|
+
Defined in: [lib/core.ts:1140](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1140)
|
|
4916
4942
|
|
|
4917
4943
|
***
|
|
4918
4944
|
|
|
@@ -4920,7 +4946,7 @@ Defined in: [lib/core.ts:1126](https://github.com/maiyunnet/kebab/blob/master/li
|
|
|
4920
4946
|
|
|
4921
4947
|
> `optional` **hostname?**: `string`
|
|
4922
4948
|
|
|
4923
|
-
Defined in: [lib/core.ts:
|
|
4949
|
+
Defined in: [lib/core.ts:1135](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1135)
|
|
4924
4950
|
|
|
4925
4951
|
***
|
|
4926
4952
|
|
|
@@ -4928,7 +4954,7 @@ Defined in: [lib/core.ts:1121](https://github.com/maiyunnet/kebab/blob/master/li
|
|
|
4928
4954
|
|
|
4929
4955
|
> `optional` **path?**: `string`
|
|
4930
4956
|
|
|
4931
|
-
Defined in: [lib/core.ts:
|
|
4957
|
+
Defined in: [lib/core.ts:1133](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1133)
|
|
4932
4958
|
|
|
4933
4959
|
***
|
|
4934
4960
|
|
|
@@ -4936,7 +4962,7 @@ Defined in: [lib/core.ts:1119](https://github.com/maiyunnet/kebab/blob/master/li
|
|
|
4936
4962
|
|
|
4937
4963
|
> `optional` **req?**: `IncomingMessage` \| `Http2ServerRequest` \| `null`
|
|
4938
4964
|
|
|
4939
|
-
Defined in: [lib/core.ts:
|
|
4965
|
+
Defined in: [lib/core.ts:1136](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1136)
|
|
4940
4966
|
|
|
4941
4967
|
***
|
|
4942
4968
|
|
|
@@ -4944,7 +4970,7 @@ Defined in: [lib/core.ts:1122](https://github.com/maiyunnet/kebab/blob/master/li
|
|
|
4944
4970
|
|
|
4945
4971
|
> `optional` **session?**: `Record`\<`string`, `any`\>
|
|
4946
4972
|
|
|
4947
|
-
Defined in: [lib/core.ts:
|
|
4973
|
+
Defined in: [lib/core.ts:1139](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1139)
|
|
4948
4974
|
|
|
4949
4975
|
***
|
|
4950
4976
|
|
|
@@ -4952,7 +4978,7 @@ Defined in: [lib/core.ts:1125](https://github.com/maiyunnet/kebab/blob/master/li
|
|
|
4952
4978
|
|
|
4953
4979
|
> `optional` **urlFull?**: `string`
|
|
4954
4980
|
|
|
4955
|
-
Defined in: [lib/core.ts:
|
|
4981
|
+
Defined in: [lib/core.ts:1134](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1134)
|
|
4956
4982
|
|
|
4957
4983
|
lib/core/type-aliases/TPm2Action.md
|
|
4958
4984
|
---
|
|
@@ -4967,7 +4993,7 @@ lib/core/type-aliases/TPm2Action.md
|
|
|
4967
4993
|
|
|
4968
4994
|
> **TPm2Action** = `"start"` \| `"stop"` \| `"restart"`
|
|
4969
4995
|
|
|
4970
|
-
Defined in: [lib/core.ts:
|
|
4996
|
+
Defined in: [lib/core.ts:809](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L809)
|
|
4971
4997
|
|
|
4972
4998
|
PM2 操作类型
|
|
4973
4999
|
|
|
@@ -5041,7 +5067,7 @@ lib/core/variables/global.md
|
|
|
5041
5067
|
|
|
5042
5068
|
> `const` **global**: `Record`\<`string`, `any`\> = `{}`
|
|
5043
5069
|
|
|
5044
|
-
Defined in: [lib/core.ts:
|
|
5070
|
+
Defined in: [lib/core.ts:908](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L908)
|
|
5045
5071
|
|
|
5046
5072
|
跨进程全局变量
|
|
5047
5073
|
|
|
@@ -16543,7 +16569,7 @@ lib/text/functions/int2str.md
|
|
|
16543
16569
|
|
|
16544
16570
|
> **int2str**(`int`, `digits?`, `decimal?`): `string`
|
|
16545
16571
|
|
|
16546
|
-
Defined in: [lib/text.ts:
|
|
16572
|
+
Defined in: [lib/text.ts:825](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L825)
|
|
16547
16573
|
|
|
16548
16574
|
为解决精度问题,将整数转换为小数字符串
|
|
16549
16575
|
以下几个示例都是当 digits 为 3、decimal 为 2 时
|
|
@@ -16676,7 +16702,7 @@ lib/text/functions/isFalsy.md
|
|
|
16676
16702
|
|
|
16677
16703
|
> **isFalsy**(`val`): `val is TFalsy`
|
|
16678
16704
|
|
|
16679
|
-
Defined in: [lib/text.ts:
|
|
16705
|
+
Defined in: [lib/text.ts:776](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L776)
|
|
16680
16706
|
|
|
16681
16707
|
判断一个值是否是虚假的(为 null/undefined/空字符串/false/0)
|
|
16682
16708
|
|
|
@@ -16881,7 +16907,7 @@ lib/text/functions/isTruthy.md
|
|
|
16881
16907
|
|
|
16882
16908
|
> **isTruthy**\<`T`\>(`val`): `val is Exclude<T, TFalsy>`
|
|
16883
16909
|
|
|
16884
|
-
Defined in: [lib/text.ts:
|
|
16910
|
+
Defined in: [lib/text.ts:784](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L784)
|
|
16885
16911
|
|
|
16886
16912
|
判断一个值是否是真实的(不为 null/undefined/空字符串/false/0)
|
|
16887
16913
|
|
|
@@ -16916,7 +16942,7 @@ lib/text/functions/logicalOr.md
|
|
|
16916
16942
|
|
|
16917
16943
|
> **logicalOr**\<`T`, `T2`\>(`v1`, `v2`): `T` *extends* [`TFalsy`](../type-aliases/TFalsy.md) ? `T2` : `T`
|
|
16918
16944
|
|
|
16919
|
-
Defined in: [lib/text.ts:
|
|
16945
|
+
Defined in: [lib/text.ts:793](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L793)
|
|
16920
16946
|
|
|
16921
16947
|
类似 || 运算符的效果
|
|
16922
16948
|
|
|
@@ -17300,7 +17326,7 @@ lib/text/functions/str2int.md
|
|
|
17300
17326
|
|
|
17301
17327
|
> **str2int**(`str`, `digits?`): `number`
|
|
17302
17328
|
|
|
17303
|
-
Defined in: [lib/text.ts:
|
|
17329
|
+
Defined in: [lib/text.ts:807](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L807)
|
|
17304
17330
|
|
|
17305
17331
|
为解决精度问题,将字符串数字转换为整数显示
|
|
17306
17332
|
以下几个示例都是当 digits 为 2 时
|
|
@@ -17340,7 +17366,7 @@ lib/text/functions/stringifyBuffer.md
|
|
|
17340
17366
|
|
|
17341
17367
|
> **stringifyBuffer**(`buf`): `string`
|
|
17342
17368
|
|
|
17343
|
-
Defined in: [lib/text.ts:
|
|
17369
|
+
Defined in: [lib/text.ts:730](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L730)
|
|
17344
17370
|
|
|
17345
17371
|
输出文本格式的 buffer
|
|
17346
17372
|
|
|
@@ -17356,6 +17382,37 @@ Defined in: [lib/text.ts:706](https://github.com/maiyunnet/kebab/blob/master/lib
|
|
|
17356
17382
|
|
|
17357
17383
|
`string`
|
|
17358
17384
|
|
|
17385
|
+
lib/text/functions/stringifyError.md
|
|
17386
|
+
---
|
|
17387
|
+
|
|
17388
|
+
[**Documents for @maiyunnet/kebab**](../../../index.md)
|
|
17389
|
+
|
|
17390
|
+
***
|
|
17391
|
+
|
|
17392
|
+
[Documents for @maiyunnet/kebab](../../../index.md) / [lib/text](../index.md) / stringifyError
|
|
17393
|
+
|
|
17394
|
+
# Function: stringifyError()
|
|
17395
|
+
|
|
17396
|
+
> **stringifyError**(`error`): `string`
|
|
17397
|
+
|
|
17398
|
+
Defined in: [lib/text.ts:707](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L707)
|
|
17399
|
+
|
|
17400
|
+
将未知异常转换为适合单行日志的文本,Error 优先返回完整堆栈
|
|
17401
|
+
|
|
17402
|
+
## Parameters
|
|
17403
|
+
|
|
17404
|
+
### error
|
|
17405
|
+
|
|
17406
|
+
`unknown`
|
|
17407
|
+
|
|
17408
|
+
异常对象
|
|
17409
|
+
|
|
17410
|
+
## Returns
|
|
17411
|
+
|
|
17412
|
+
`string`
|
|
17413
|
+
|
|
17414
|
+
已转义的单行错误文本
|
|
17415
|
+
|
|
17359
17416
|
lib/text/functions/stringifyJson.md
|
|
17360
17417
|
---
|
|
17361
17418
|
|
|
@@ -17433,7 +17490,7 @@ lib/text/functions/trimJson.md
|
|
|
17433
17490
|
|
|
17434
17491
|
> **trimJson**(`json`): `any`
|
|
17435
17492
|
|
|
17436
|
-
Defined in: [lib/text.ts:
|
|
17493
|
+
Defined in: [lib/text.ts:738](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L738)
|
|
17437
17494
|
|
|
17438
17495
|
递归删除 json 中的字符串首尾空格,会返回一个新的对象
|
|
17439
17496
|
|
|
@@ -17573,6 +17630,7 @@ lib/text/index.md
|
|
|
17573
17630
|
- [sizeFormat](functions/sizeFormat.md)
|
|
17574
17631
|
- [str2int](functions/str2int.md)
|
|
17575
17632
|
- [stringifyBuffer](functions/stringifyBuffer.md)
|
|
17633
|
+
- [stringifyError](functions/stringifyError.md)
|
|
17576
17634
|
- [stringifyJson](functions/stringifyJson.md)
|
|
17577
17635
|
- [stringifyResult](functions/stringifyResult.md)
|
|
17578
17636
|
- [trimJson](functions/trimJson.md)
|
|
@@ -17639,7 +17697,7 @@ lib/text/type-aliases/TFalsy.md
|
|
|
17639
17697
|
|
|
17640
17698
|
> **TFalsy** = `false` \| `""` \| `0` \| `null` \| `undefined` \| *typeof* `NaN`
|
|
17641
17699
|
|
|
17642
|
-
Defined in: [lib/text.ts:
|
|
17700
|
+
Defined in: [lib/text.ts:770](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L770)
|
|
17643
17701
|
|
|
17644
17702
|
虚假值类型
|
|
17645
17703
|
|
|
@@ -18486,7 +18544,7 @@ lib/undici/functions/fetch.md
|
|
|
18486
18544
|
|
|
18487
18545
|
> **fetch**(`input`, `init?`): `Promise`\<`Response`\>
|
|
18488
18546
|
|
|
18489
|
-
Defined in: [lib/undici.ts:
|
|
18547
|
+
Defined in: [lib/undici.ts:243](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L243)
|
|
18490
18548
|
|
|
18491
18549
|
发起一个完全兼容 fetch 的请求
|
|
18492
18550
|
|
|
@@ -18521,7 +18579,7 @@ lib/undici/functions/filterHeaders.md
|
|
|
18521
18579
|
|
|
18522
18580
|
> **filterHeaders**(`headers`, `res?`, `filter?`): `Record`\<`string`, `string` \| `string`[]\>
|
|
18523
18581
|
|
|
18524
|
-
Defined in: [lib/undici.ts:
|
|
18582
|
+
Defined in: [lib/undici.ts:617](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L617)
|
|
18525
18583
|
|
|
18526
18584
|
剔除不代理的 header,返回新的 header
|
|
18527
18585
|
|
|
@@ -18562,7 +18620,7 @@ lib/undici/functions/getFormData.md
|
|
|
18562
18620
|
|
|
18563
18621
|
> **getFormData**(): [`FormData`](../formdata/classes/FormData.md)
|
|
18564
18622
|
|
|
18565
|
-
Defined in: [lib/undici.ts:
|
|
18623
|
+
Defined in: [lib/undici.ts:601](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L601)
|
|
18566
18624
|
|
|
18567
18625
|
创建 FormData 对象
|
|
18568
18626
|
|
|
@@ -18583,7 +18641,7 @@ lib/undici/functions/get.md
|
|
|
18583
18641
|
|
|
18584
18642
|
> **get**(`u`, `opt?`): `Promise`\<[`Response`](../response/classes/Response.md)\>
|
|
18585
18643
|
|
|
18586
|
-
Defined in: [lib/undici.ts:
|
|
18644
|
+
Defined in: [lib/undici.ts:123](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L123)
|
|
18587
18645
|
|
|
18588
18646
|
发起一个 get 请求
|
|
18589
18647
|
|
|
@@ -18645,7 +18703,7 @@ lib/undici/functions/getResponseJson.md
|
|
|
18645
18703
|
|
|
18646
18704
|
> **getResponseJson**(`u`, `opt?`): `Promise`\<`any`\>
|
|
18647
18705
|
|
|
18648
|
-
Defined in: [lib/undici.ts:
|
|
18706
|
+
Defined in: [lib/undici.ts:218](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L218)
|
|
18649
18707
|
|
|
18650
18708
|
发起 GET 请求并解析 JSON 响应
|
|
18651
18709
|
|
|
@@ -18682,7 +18740,7 @@ lib/undici/functions/mproxyData.md
|
|
|
18682
18740
|
|
|
18683
18741
|
> **mproxyData**(`ctr`): `any`
|
|
18684
18742
|
|
|
18685
|
-
Defined in: [lib/undici.ts:
|
|
18743
|
+
Defined in: [lib/undici.ts:719](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L719)
|
|
18686
18744
|
|
|
18687
18745
|
获取 mproxy 的附加数据
|
|
18688
18746
|
|
|
@@ -18711,7 +18769,7 @@ lib/undici/functions/mproxy.md
|
|
|
18711
18769
|
|
|
18712
18770
|
> **mproxy**(`ctr`, `auth`, `opt?`): `Promise`\<`number`\>
|
|
18713
18771
|
|
|
18714
|
-
Defined in: [lib/undici.ts:
|
|
18772
|
+
Defined in: [lib/undici.ts:657](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L657)
|
|
18715
18773
|
|
|
18716
18774
|
正向 mproxy 代理,注意提前处理不要自动处理 post 数据,读取 get 的 url 为实际请求地址
|
|
18717
18775
|
get: url, auth
|
|
@@ -18753,7 +18811,7 @@ lib/undici/functions/open.md
|
|
|
18753
18811
|
|
|
18754
18812
|
> **open**(`u`): [`Request`](../request/classes/Request.md)
|
|
18755
18813
|
|
|
18756
|
-
Defined in: [lib/undici.ts:
|
|
18814
|
+
Defined in: [lib/undici.ts:114](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L114)
|
|
18757
18815
|
|
|
18758
18816
|
创建一个请求对象
|
|
18759
18817
|
|
|
@@ -18780,7 +18838,7 @@ lib/undici/functions/postJson.md
|
|
|
18780
18838
|
|
|
18781
18839
|
> **postJson**(`u`, `data`, `opt?`): `Promise`\<[`Response`](../response/classes/Response.md)\>
|
|
18782
18840
|
|
|
18783
|
-
Defined in: [lib/undici.ts:
|
|
18841
|
+
Defined in: [lib/undici.ts:148](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L148)
|
|
18784
18842
|
|
|
18785
18843
|
发起 JSON 请求
|
|
18786
18844
|
|
|
@@ -18821,7 +18879,7 @@ lib/undici/functions/postJsonResponseJson.md
|
|
|
18821
18879
|
|
|
18822
18880
|
> **postJsonResponseJson**(`u`, `data`, `opt?`): `Promise`\<`any`\>
|
|
18823
18881
|
|
|
18824
|
-
Defined in: [lib/undici.ts:
|
|
18882
|
+
Defined in: [lib/undici.ts:164](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L164)
|
|
18825
18883
|
|
|
18826
18884
|
发起 JSON 请求并解析 JSON 响应,失败时返回 null
|
|
18827
18885
|
|
|
@@ -18862,7 +18920,7 @@ lib/undici/functions/post.md
|
|
|
18862
18920
|
|
|
18863
18921
|
> **post**(`u`, `data`, `opt?`): `Promise`\<[`Response`](../response/classes/Response.md)\>
|
|
18864
18922
|
|
|
18865
|
-
Defined in: [lib/undici.ts:
|
|
18923
|
+
Defined in: [lib/undici.ts:133](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L133)
|
|
18866
18924
|
|
|
18867
18925
|
发起一个 post 请求
|
|
18868
18926
|
|
|
@@ -18903,7 +18961,7 @@ lib/undici/functions/postResponseJson.md
|
|
|
18903
18961
|
|
|
18904
18962
|
> **postResponseJson**(`u`, `data`, `opt?`): `Promise`\<`any`\>
|
|
18905
18963
|
|
|
18906
|
-
Defined in: [lib/undici.ts:
|
|
18964
|
+
Defined in: [lib/undici.ts:192](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L192)
|
|
18907
18965
|
|
|
18908
18966
|
发起 POST 请求并解析 JSON 响应
|
|
18909
18967
|
|
|
@@ -18946,7 +19004,7 @@ lib/undici/functions/request.md
|
|
|
18946
19004
|
|
|
18947
19005
|
> **request**(`u`, `data?`, `opt?`): `Promise`\<[`Response`](../response/classes/Response.md)\>
|
|
18948
19006
|
|
|
18949
|
-
Defined in: [lib/undici.ts:
|
|
19007
|
+
Defined in: [lib/undici.ts:415](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L415)
|
|
18950
19008
|
|
|
18951
19009
|
发起一个请求
|
|
18952
19010
|
|
|
@@ -18983,7 +19041,7 @@ lib/undici/functions/rproxy.md
|
|
|
18983
19041
|
|
|
18984
19042
|
> **rproxy**(`ctr`, `route`, `opt?`): `Promise`\<`boolean`\>
|
|
18985
19043
|
|
|
18986
|
-
Defined in: [lib/undici.ts:
|
|
19044
|
+
Defined in: [lib/undici.ts:749](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L749)
|
|
18987
19045
|
|
|
18988
19046
|
反向代理,将本服务器的某个路由反代到其他网址
|
|
18989
19047
|
|
|
@@ -19072,7 +19130,7 @@ lib/undici/interfaces/IMproxyOptions.md
|
|
|
19072
19130
|
|
|
19073
19131
|
# Interface: IMproxyOptions
|
|
19074
19132
|
|
|
19075
|
-
Defined in: [lib/undici.ts:
|
|
19133
|
+
Defined in: [lib/undici.ts:870](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L870)
|
|
19076
19134
|
|
|
19077
19135
|
正向代理请求的传入参数选项
|
|
19078
19136
|
|
|
@@ -19082,7 +19140,7 @@ Defined in: [lib/undici.ts:820](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
19082
19140
|
|
|
19083
19141
|
> `optional` **filter?**: (`h`) => `boolean`
|
|
19084
19142
|
|
|
19085
|
-
Defined in: [lib/undici.ts:
|
|
19143
|
+
Defined in: [lib/undici.ts:879](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L879)
|
|
19086
19144
|
|
|
19087
19145
|
过滤 header,返回 true 则留下
|
|
19088
19146
|
|
|
@@ -19102,7 +19160,7 @@ Defined in: [lib/undici.ts:829](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
19102
19160
|
|
|
19103
19161
|
> `optional` **follow?**: `number`
|
|
19104
19162
|
|
|
19105
|
-
Defined in: [lib/undici.ts:
|
|
19163
|
+
Defined in: [lib/undici.ts:873](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L873)
|
|
19106
19164
|
|
|
19107
19165
|
***
|
|
19108
19166
|
|
|
@@ -19110,7 +19168,7 @@ Defined in: [lib/undici.ts:823](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
19110
19168
|
|
|
19111
19169
|
> `optional` **headers?**: [`THttpHeaders`](../type-aliases/THttpHeaders.md)
|
|
19112
19170
|
|
|
19113
|
-
Defined in: [lib/undici.ts:
|
|
19171
|
+
Defined in: [lib/undici.ts:877](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L877)
|
|
19114
19172
|
|
|
19115
19173
|
***
|
|
19116
19174
|
|
|
@@ -19118,7 +19176,7 @@ Defined in: [lib/undici.ts:827](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
19118
19176
|
|
|
19119
19177
|
> `optional` **hosts?**: `string` \| `Record`\<`string`, `string`\>
|
|
19120
19178
|
|
|
19121
|
-
Defined in: [lib/undici.ts:
|
|
19179
|
+
Defined in: [lib/undici.ts:875](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L875)
|
|
19122
19180
|
|
|
19123
19181
|
自定义 host 映射,如 {'www.maiyun.net': '127.0.0.1'},或全部映射到一个 host
|
|
19124
19182
|
|
|
@@ -19128,7 +19186,7 @@ Defined in: [lib/undici.ts:825](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
19128
19186
|
|
|
19129
19187
|
> `optional` **local?**: `string`
|
|
19130
19188
|
|
|
19131
|
-
Defined in: [lib/undici.ts:
|
|
19189
|
+
Defined in: [lib/undici.ts:876](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L876)
|
|
19132
19190
|
|
|
19133
19191
|
***
|
|
19134
19192
|
|
|
@@ -19136,7 +19194,7 @@ Defined in: [lib/undici.ts:826](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
19136
19194
|
|
|
19137
19195
|
> `optional` **reuse?**: `string` \| `Agent` \| `ProxyAgent`
|
|
19138
19196
|
|
|
19139
|
-
Defined in: [lib/undici.ts:
|
|
19197
|
+
Defined in: [lib/undici.ts:881](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L881)
|
|
19140
19198
|
|
|
19141
19199
|
默认为 default
|
|
19142
19200
|
|
|
@@ -19146,7 +19204,7 @@ Defined in: [lib/undici.ts:831](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
19146
19204
|
|
|
19147
19205
|
> `optional` **timeout?**: `number`
|
|
19148
19206
|
|
|
19149
|
-
Defined in: [lib/undici.ts:
|
|
19207
|
+
Defined in: [lib/undici.ts:872](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L872)
|
|
19150
19208
|
|
|
19151
19209
|
秒数,默认 300 秒
|
|
19152
19210
|
|
|
@@ -19161,7 +19219,7 @@ lib/undici/interfaces/IRequestOptions.md
|
|
|
19161
19219
|
|
|
19162
19220
|
# Interface: IRequestOptions
|
|
19163
19221
|
|
|
19164
|
-
Defined in: [lib/undici.ts:
|
|
19222
|
+
Defined in: [lib/undici.ts:835](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L835)
|
|
19165
19223
|
|
|
19166
19224
|
请求的传入参数选项
|
|
19167
19225
|
|
|
@@ -19171,7 +19229,7 @@ Defined in: [lib/undici.ts:787](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
19171
19229
|
|
|
19172
19230
|
> `optional` **cookie?**: `Record`\<`string`, [`ICookie`](../../cookie/interfaces/ICookie.md)\>
|
|
19173
19231
|
|
|
19174
|
-
Defined in: [lib/undici.ts:
|
|
19232
|
+
Defined in: [lib/undici.ts:862](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L862)
|
|
19175
19233
|
|
|
19176
19234
|
cookie 托管对象
|
|
19177
19235
|
|
|
@@ -19181,7 +19239,7 @@ cookie 托管对象
|
|
|
19181
19239
|
|
|
19182
19240
|
> `optional` **follow?**: `number`
|
|
19183
19241
|
|
|
19184
|
-
Defined in: [lib/undici.ts:
|
|
19242
|
+
Defined in: [lib/undici.ts:843](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L843)
|
|
19185
19243
|
|
|
19186
19244
|
追踪 location 次数,0 为不追踪,默认为 0
|
|
19187
19245
|
|
|
@@ -19191,7 +19249,7 @@ Defined in: [lib/undici.ts:793](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
19191
19249
|
|
|
19192
19250
|
> `optional` **headers?**: [`THttpHeaders`](../type-aliases/THttpHeaders.md)
|
|
19193
19251
|
|
|
19194
|
-
Defined in: [lib/undici.ts:
|
|
19252
|
+
Defined in: [lib/undici.ts:848](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L848)
|
|
19195
19253
|
|
|
19196
19254
|
***
|
|
19197
19255
|
|
|
@@ -19199,7 +19257,7 @@ Defined in: [lib/undici.ts:798](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
19199
19257
|
|
|
19200
19258
|
> `optional` **hosts?**: `string` \| `Record`\<`string`, `string`\>
|
|
19201
19259
|
|
|
19202
|
-
Defined in: [lib/undici.ts:
|
|
19260
|
+
Defined in: [lib/undici.ts:845](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L845)
|
|
19203
19261
|
|
|
19204
19262
|
自定义 host 映射,如 {'www.maiyun.net': '127.0.0.1'},或全部映射到一个 host
|
|
19205
19263
|
|
|
@@ -19209,7 +19267,7 @@ Defined in: [lib/undici.ts:795](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
19209
19267
|
|
|
19210
19268
|
> `optional` **keep?**: `boolean`
|
|
19211
19269
|
|
|
19212
|
-
Defined in: [lib/undici.ts:
|
|
19270
|
+
Defined in: [lib/undici.ts:858](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L858)
|
|
19213
19271
|
|
|
19214
19272
|
连接是否保持长连接(即是否允许复用),默认为 true
|
|
19215
19273
|
|
|
@@ -19219,7 +19277,7 @@ Defined in: [lib/undici.ts:808](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
19219
19277
|
|
|
19220
19278
|
> `optional` **local?**: `string`
|
|
19221
19279
|
|
|
19222
|
-
Defined in: [lib/undici.ts:
|
|
19280
|
+
Defined in: [lib/undici.ts:847](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L847)
|
|
19223
19281
|
|
|
19224
19282
|
***
|
|
19225
19283
|
|
|
@@ -19227,7 +19285,7 @@ Defined in: [lib/undici.ts:797](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
19227
19285
|
|
|
19228
19286
|
> `optional` **log?**: `boolean`
|
|
19229
19287
|
|
|
19230
|
-
Defined in: [lib/undici.ts:
|
|
19288
|
+
Defined in: [lib/undici.ts:864](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L864)
|
|
19231
19289
|
|
|
19232
19290
|
若有异常写入文件日志,默认为 true
|
|
19233
19291
|
|
|
@@ -19237,7 +19295,7 @@ Defined in: [lib/undici.ts:814](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
19237
19295
|
|
|
19238
19296
|
> `optional` **method?**: `"GET"` \| `"POST"` \| `"PUT"` \| `"DELETE"` \| `"OPTIONS"`
|
|
19239
19297
|
|
|
19240
|
-
Defined in: [lib/undici.ts:
|
|
19298
|
+
Defined in: [lib/undici.ts:836](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L836)
|
|
19241
19299
|
|
|
19242
19300
|
***
|
|
19243
19301
|
|
|
@@ -19245,7 +19303,7 @@ Defined in: [lib/undici.ts:788](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
19245
19303
|
|
|
19246
19304
|
> `optional` **mproxy?**: `object`
|
|
19247
19305
|
|
|
19248
|
-
Defined in: [lib/undici.ts:
|
|
19306
|
+
Defined in: [lib/undici.ts:850](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L850)
|
|
19249
19307
|
|
|
19250
19308
|
正向 mproxy 代理,url 如 https://xxx/abc
|
|
19251
19309
|
|
|
@@ -19269,11 +19327,21 @@ Defined in: [lib/undici.ts:800](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
19269
19327
|
|
|
19270
19328
|
***
|
|
19271
19329
|
|
|
19330
|
+
### retry?
|
|
19331
|
+
|
|
19332
|
+
> `optional` **retry?**: `number`
|
|
19333
|
+
|
|
19334
|
+
Defined in: [lib/undici.ts:841](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L841)
|
|
19335
|
+
|
|
19336
|
+
网络异常后的重试次数,默认 0;流式请求体不可重试,非幂等请求需由调用方保证安全
|
|
19337
|
+
|
|
19338
|
+
***
|
|
19339
|
+
|
|
19272
19340
|
### reuse?
|
|
19273
19341
|
|
|
19274
19342
|
> `optional` **reuse?**: `string` \| `Agent` \| `ProxyAgent`
|
|
19275
19343
|
|
|
19276
|
-
Defined in: [lib/undici.ts:
|
|
19344
|
+
Defined in: [lib/undici.ts:860](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L860)
|
|
19277
19345
|
|
|
19278
19346
|
复用池名/Agent,默认为 default
|
|
19279
19347
|
|
|
@@ -19283,7 +19351,7 @@ Defined in: [lib/undici.ts:810](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
19283
19351
|
|
|
19284
19352
|
> `optional` **save?**: `string`
|
|
19285
19353
|
|
|
19286
|
-
Defined in: [lib/undici.ts:
|
|
19354
|
+
Defined in: [lib/undici.ts:846](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L846)
|
|
19287
19355
|
|
|
19288
19356
|
***
|
|
19289
19357
|
|
|
@@ -19291,7 +19359,7 @@ Defined in: [lib/undici.ts:796](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
19291
19359
|
|
|
19292
19360
|
> `optional` **signal?**: `AbortSignal`
|
|
19293
19361
|
|
|
19294
|
-
Defined in: [lib/undici.ts:
|
|
19362
|
+
Defined in: [lib/undici.ts:866](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L866)
|
|
19295
19363
|
|
|
19296
19364
|
请求中止信号
|
|
19297
19365
|
|
|
@@ -19301,7 +19369,7 @@ Defined in: [lib/undici.ts:816](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
19301
19369
|
|
|
19302
19370
|
> `optional` **timeout?**: `number`
|
|
19303
19371
|
|
|
19304
|
-
Defined in: [lib/undici.ts:
|
|
19372
|
+
Defined in: [lib/undici.ts:839](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L839)
|
|
19305
19373
|
|
|
19306
19374
|
秒数,默认 300 秒
|
|
19307
19375
|
|
|
@@ -19311,7 +19379,7 @@ Defined in: [lib/undici.ts:791](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
19311
19379
|
|
|
19312
19380
|
> `optional` **type?**: `"form"` \| `"json"`
|
|
19313
19381
|
|
|
19314
|
-
Defined in: [lib/undici.ts:
|
|
19382
|
+
Defined in: [lib/undici.ts:837](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L837)
|
|
19315
19383
|
|
|
19316
19384
|
lib/undici/interfaces/IRproxyOptions.md
|
|
19317
19385
|
---
|
|
@@ -19324,7 +19392,7 @@ lib/undici/interfaces/IRproxyOptions.md
|
|
|
19324
19392
|
|
|
19325
19393
|
# Interface: IRproxyOptions
|
|
19326
19394
|
|
|
19327
|
-
Defined in: [lib/undici.ts:
|
|
19395
|
+
Defined in: [lib/undici.ts:885](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L885)
|
|
19328
19396
|
|
|
19329
19397
|
反向代理请求的传入参数选项
|
|
19330
19398
|
|
|
@@ -19334,7 +19402,7 @@ Defined in: [lib/undici.ts:835](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
19334
19402
|
|
|
19335
19403
|
> `optional` **body?**: `string` \| `Buffer`\<`ArrayBufferLike`\> \| `Readable`
|
|
19336
19404
|
|
|
19337
|
-
Defined in: [lib/undici.ts:
|
|
19405
|
+
Defined in: [lib/undici.ts:904](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L904)
|
|
19338
19406
|
|
|
19339
19407
|
手动传入请求体(优先于原始 req 流),用于 req 流已消费后仍需转发 body 的场景
|
|
19340
19408
|
|
|
@@ -19344,7 +19412,7 @@ Defined in: [lib/undici.ts:854](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
19344
19412
|
|
|
19345
19413
|
> `optional` **filter?**: (`h`) => `boolean`
|
|
19346
19414
|
|
|
19347
|
-
Defined in: [lib/undici.ts:
|
|
19415
|
+
Defined in: [lib/undici.ts:894](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L894)
|
|
19348
19416
|
|
|
19349
19417
|
过滤 header,返回 true 则留下
|
|
19350
19418
|
|
|
@@ -19364,7 +19432,7 @@ Defined in: [lib/undici.ts:844](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
19364
19432
|
|
|
19365
19433
|
> `optional` **follow?**: `number`
|
|
19366
19434
|
|
|
19367
|
-
Defined in: [lib/undici.ts:
|
|
19435
|
+
Defined in: [lib/undici.ts:888](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L888)
|
|
19368
19436
|
|
|
19369
19437
|
***
|
|
19370
19438
|
|
|
@@ -19372,7 +19440,7 @@ Defined in: [lib/undici.ts:838](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
19372
19440
|
|
|
19373
19441
|
> `optional` **headers?**: [`THttpHeaders`](../type-aliases/THttpHeaders.md)
|
|
19374
19442
|
|
|
19375
|
-
Defined in: [lib/undici.ts:
|
|
19443
|
+
Defined in: [lib/undici.ts:892](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L892)
|
|
19376
19444
|
|
|
19377
19445
|
***
|
|
19378
19446
|
|
|
@@ -19380,7 +19448,7 @@ Defined in: [lib/undici.ts:842](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
19380
19448
|
|
|
19381
19449
|
> `optional` **hosts?**: `string` \| `Record`\<`string`, `string`\>
|
|
19382
19450
|
|
|
19383
|
-
Defined in: [lib/undici.ts:
|
|
19451
|
+
Defined in: [lib/undici.ts:890](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L890)
|
|
19384
19452
|
|
|
19385
19453
|
自定义 host 映射,如 {'www.maiyun.net': '127.0.0.1'},或全部映射到一个 host
|
|
19386
19454
|
|
|
@@ -19390,7 +19458,7 @@ Defined in: [lib/undici.ts:840](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
19390
19458
|
|
|
19391
19459
|
> `optional` **local?**: `string`
|
|
19392
19460
|
|
|
19393
|
-
Defined in: [lib/undici.ts:
|
|
19461
|
+
Defined in: [lib/undici.ts:891](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L891)
|
|
19394
19462
|
|
|
19395
19463
|
***
|
|
19396
19464
|
|
|
@@ -19398,7 +19466,7 @@ Defined in: [lib/undici.ts:841](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
19398
19466
|
|
|
19399
19467
|
> `optional` **mproxy?**: `object`
|
|
19400
19468
|
|
|
19401
|
-
Defined in: [lib/undici.ts:
|
|
19469
|
+
Defined in: [lib/undici.ts:896](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L896)
|
|
19402
19470
|
|
|
19403
19471
|
正向 mproxy 代理,url 如 https://xxx/abc
|
|
19404
19472
|
|
|
@@ -19426,7 +19494,7 @@ Defined in: [lib/undici.ts:846](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
19426
19494
|
|
|
19427
19495
|
> `optional` **querys?**: `Record`\<`string`, `any`\>
|
|
19428
19496
|
|
|
19429
|
-
Defined in: [lib/undici.ts:
|
|
19497
|
+
Defined in: [lib/undici.ts:906](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L906)
|
|
19430
19498
|
|
|
19431
19499
|
自定义 GET 查询参数,传入后直接替换代理目标 URL 的整个 query string
|
|
19432
19500
|
|
|
@@ -19436,7 +19504,7 @@ Defined in: [lib/undici.ts:856](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
19436
19504
|
|
|
19437
19505
|
> `optional` **reuse?**: `string` \| `Agent` \| `ProxyAgent`
|
|
19438
19506
|
|
|
19439
|
-
Defined in: [lib/undici.ts:
|
|
19507
|
+
Defined in: [lib/undici.ts:908](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L908)
|
|
19440
19508
|
|
|
19441
19509
|
默认为 default
|
|
19442
19510
|
|
|
@@ -19446,7 +19514,7 @@ Defined in: [lib/undici.ts:858](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
19446
19514
|
|
|
19447
19515
|
> `optional` **timeout?**: `number`
|
|
19448
19516
|
|
|
19449
|
-
Defined in: [lib/undici.ts:
|
|
19517
|
+
Defined in: [lib/undici.ts:887](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L887)
|
|
19450
19518
|
|
|
19451
19519
|
秒数,默认 300 秒
|
|
19452
19520
|
|
|
@@ -19509,7 +19577,7 @@ Defined in: [lib/undici/request.ts:30](https://github.com/maiyunnet/kebab/blob/m
|
|
|
19509
19577
|
|
|
19510
19578
|
> **follow**(`follow?`): `this`
|
|
19511
19579
|
|
|
19512
|
-
Defined in: [lib/undici/request.ts:
|
|
19580
|
+
Defined in: [lib/undici/request.ts:96](https://github.com/maiyunnet/kebab/blob/master/lib/undici/request.ts#L96)
|
|
19513
19581
|
|
|
19514
19582
|
设置是否跟随请求方的 location,留空为跟随,不设置为不跟随
|
|
19515
19583
|
|
|
@@ -19543,7 +19611,7 @@ method get 方法别名
|
|
|
19543
19611
|
|
|
19544
19612
|
> **headers**(`headers`): `this`
|
|
19545
19613
|
|
|
19546
|
-
Defined in: [lib/undici/request.ts:
|
|
19614
|
+
Defined in: [lib/undici/request.ts:132](https://github.com/maiyunnet/kebab/blob/master/lib/undici/request.ts#L132)
|
|
19547
19615
|
|
|
19548
19616
|
批量设置提交的 headers
|
|
19549
19617
|
|
|
@@ -19563,7 +19631,7 @@ Defined in: [lib/undici/request.ts:123](https://github.com/maiyunnet/kebab/blob/
|
|
|
19563
19631
|
|
|
19564
19632
|
> **hosts**(`hosts`): `this`
|
|
19565
19633
|
|
|
19566
|
-
Defined in: [lib/undici/request.ts:
|
|
19634
|
+
Defined in: [lib/undici/request.ts:105](https://github.com/maiyunnet/kebab/blob/master/lib/undici/request.ts#L105)
|
|
19567
19635
|
|
|
19568
19636
|
设置域名 -> ip的对应键值,就像电脑里的 hosts 一样
|
|
19569
19637
|
|
|
@@ -19597,7 +19665,7 @@ type json 方法别名
|
|
|
19597
19665
|
|
|
19598
19666
|
> **local**(`addr`): `this`
|
|
19599
19667
|
|
|
19600
|
-
Defined in: [lib/undici/request.ts:
|
|
19668
|
+
Defined in: [lib/undici/request.ts:123](https://github.com/maiyunnet/kebab/blob/master/lib/undici/request.ts#L123)
|
|
19601
19669
|
|
|
19602
19670
|
设置使用的本地网卡 IP
|
|
19603
19671
|
|
|
@@ -19651,7 +19719,7 @@ method post 方法别名
|
|
|
19651
19719
|
|
|
19652
19720
|
> **request**(`cookie?`): `Promise`\<[`Response`](../../response/classes/Response.md)\>
|
|
19653
19721
|
|
|
19654
|
-
Defined in: [lib/undici/request.ts:
|
|
19722
|
+
Defined in: [lib/undici/request.ts:152](https://github.com/maiyunnet/kebab/blob/master/lib/undici/request.ts#L152)
|
|
19655
19723
|
|
|
19656
19724
|
发起请求
|
|
19657
19725
|
|
|
@@ -19667,11 +19735,33 @@ Defined in: [lib/undici/request.ts:143](https://github.com/maiyunnet/kebab/blob/
|
|
|
19667
19735
|
|
|
19668
19736
|
***
|
|
19669
19737
|
|
|
19738
|
+
### retry()
|
|
19739
|
+
|
|
19740
|
+
> **retry**(`retry?`): `this`
|
|
19741
|
+
|
|
19742
|
+
Defined in: [lib/undici/request.ts:87](https://github.com/maiyunnet/kebab/blob/master/lib/undici/request.ts#L87)
|
|
19743
|
+
|
|
19744
|
+
设置网络异常后的重试次数
|
|
19745
|
+
|
|
19746
|
+
#### Parameters
|
|
19747
|
+
|
|
19748
|
+
##### retry?
|
|
19749
|
+
|
|
19750
|
+
`number` = `1`
|
|
19751
|
+
|
|
19752
|
+
重试次数,默认为 1;非幂等请求需由调用方保证安全
|
|
19753
|
+
|
|
19754
|
+
#### Returns
|
|
19755
|
+
|
|
19756
|
+
`this`
|
|
19757
|
+
|
|
19758
|
+
***
|
|
19759
|
+
|
|
19670
19760
|
### save()
|
|
19671
19761
|
|
|
19672
19762
|
> **save**(`save`): `this`
|
|
19673
19763
|
|
|
19674
|
-
Defined in: [lib/undici/request.ts:
|
|
19764
|
+
Defined in: [lib/undici/request.ts:114](https://github.com/maiyunnet/kebab/blob/master/lib/undici/request.ts#L114)
|
|
19675
19765
|
|
|
19676
19766
|
设置后将直接保存到本地文件,不会返回,save 为本地实体路径
|
|
19677
19767
|
|
|
@@ -19691,7 +19781,7 @@ Defined in: [lib/undici/request.ts:105](https://github.com/maiyunnet/kebab/blob/
|
|
|
19691
19781
|
|
|
19692
19782
|
> **setHeader**(`name`, `val`): `this`
|
|
19693
19783
|
|
|
19694
|
-
Defined in: [lib/undici/request.ts:
|
|
19784
|
+
Defined in: [lib/undici/request.ts:142](https://github.com/maiyunnet/kebab/blob/master/lib/undici/request.ts#L142)
|
|
19695
19785
|
|
|
19696
19786
|
设置单条 header
|
|
19697
19787
|
|
|
@@ -19835,7 +19925,7 @@ Defined in: [lib/undici/response.ts:33](https://github.com/maiyunnet/kebab/blob/
|
|
|
19835
19925
|
|
|
19836
19926
|
> **getJson**(): `Promise`\<`any`\>
|
|
19837
19927
|
|
|
19838
|
-
Defined in: [lib/undici/response.ts:
|
|
19928
|
+
Defined in: [lib/undici/response.ts:67](https://github.com/maiyunnet/kebab/blob/master/lib/undici/response.ts#L67)
|
|
19839
19929
|
|
|
19840
19930
|
读取所有内容为 JSON,失败返回 null
|
|
19841
19931
|
|
|
@@ -19849,7 +19939,7 @@ Defined in: [lib/undici/response.ts:66](https://github.com/maiyunnet/kebab/blob/
|
|
|
19849
19939
|
|
|
19850
19940
|
> **getRawStream**(): `BodyReadable` & `BodyMixin` \| `null`
|
|
19851
19941
|
|
|
19852
|
-
Defined in: [lib/undici/response.ts:
|
|
19942
|
+
Defined in: [lib/undici/response.ts:127](https://github.com/maiyunnet/kebab/blob/master/lib/undici/response.ts#L127)
|
|
19853
19943
|
|
|
19854
19944
|
获取原生响应读取流对象
|
|
19855
19945
|
|
|
@@ -19863,7 +19953,7 @@ Defined in: [lib/undici/response.ts:126](https://github.com/maiyunnet/kebab/blob
|
|
|
19863
19953
|
|
|
19864
19954
|
> **getStream**(): `BrotliDecompress` \| `Gunzip` \| `Inflate` \| `BodyReadable` & `BodyMixin` \| `null`
|
|
19865
19955
|
|
|
19866
|
-
Defined in: [lib/undici/response.ts:
|
|
19956
|
+
Defined in: [lib/undici/response.ts:92](https://github.com/maiyunnet/kebab/blob/master/lib/undici/response.ts#L92)
|
|
19867
19957
|
|
|
19868
19958
|
获取响应读取流对象
|
|
19869
19959
|
|
|
@@ -19877,7 +19967,7 @@ Defined in: [lib/undici/response.ts:91](https://github.com/maiyunnet/kebab/blob/
|
|
|
19877
19967
|
|
|
19878
19968
|
> **getText**(): `Promise`\<`string` \| `null`\>
|
|
19879
19969
|
|
|
19880
|
-
Defined in: [lib/undici/response.ts:
|
|
19970
|
+
Defined in: [lib/undici/response.ts:52](https://github.com/maiyunnet/kebab/blob/master/lib/undici/response.ts#L52)
|
|
19881
19971
|
|
|
19882
19972
|
读取所有内容为文本
|
|
19883
19973
|
|
|
@@ -19891,7 +19981,7 @@ Defined in: [lib/undici/response.ts:51](https://github.com/maiyunnet/kebab/blob/
|
|
|
19891
19981
|
|
|
19892
19982
|
> **setContent**(`v`): `void`
|
|
19893
19983
|
|
|
19894
|
-
Defined in: [lib/undici/response.ts:
|
|
19984
|
+
Defined in: [lib/undici/response.ts:85](https://github.com/maiyunnet/kebab/blob/master/lib/undici/response.ts#L85)
|
|
19895
19985
|
|
|
19896
19986
|
用户自定义的 content 内容
|
|
19897
19987
|
|
|
@@ -19935,7 +20025,7 @@ lib/undici/type-aliases/THttpHeaders.md
|
|
|
19935
20025
|
|
|
19936
20026
|
> **THttpHeaders** = `http.IncomingHttpHeaders` & `object`
|
|
19937
20027
|
|
|
19938
|
-
Defined in: [lib/undici.ts:
|
|
20028
|
+
Defined in: [lib/undici.ts:913](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L913)
|
|
19939
20029
|
|
|
19940
20030
|
http headers
|
|
19941
20031
|
|