@maiyunnet/kebab 9.15.6 → 9.16.1
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 +216 -121
- package/index.d.ts +1 -1
- package/index.js +1 -1
- package/lib/core.d.ts +22 -3
- package/lib/core.js +23 -4
- package/lib/db/conn.js +13 -3
- package/lib/db/pool.js +21 -11
- 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 +2 -2
- package/lib/undici/response.js +2 -1
- package/lib/undici.d.ts +13 -6
- package/lib/undici.js +83 -35
- package/package.json +1 -1
- package/sys/child.js +15 -12
- package/sys/ctr.js +3 -3
- 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.1"` = `'9.16.1'`
|
|
1365
1365
|
|
|
1366
1366
|
Defined in: [index.ts:10](https://github.com/maiyunnet/kebab/blob/master/index.ts#L10)
|
|
1367
1367
|
|
|
@@ -3735,7 +3735,7 @@ lib/core/functions/loadEnv.md
|
|
|
3735
3735
|
|
|
3736
3736
|
> **loadEnv**(`dir`): `Promise`\<`void`\>
|
|
3737
3737
|
|
|
3738
|
-
Defined in: [lib/core.ts:
|
|
3738
|
+
Defined in: [lib/core.ts:1480](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1480)
|
|
3739
3739
|
|
|
3740
3740
|
加载 .env 文件到 process.env,若文件不存在则跳过
|
|
3741
3741
|
|
|
@@ -4210,7 +4210,7 @@ lib/core/functions/resolveEnvVars.md
|
|
|
4210
4210
|
|
|
4211
4211
|
> **resolveEnvVars**(`obj`): `void`
|
|
4212
4212
|
|
|
4213
|
-
Defined in: [lib/core.ts:
|
|
4213
|
+
Defined in: [lib/core.ts:1510](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1510)
|
|
4214
4214
|
|
|
4215
4215
|
将配置对象中的 ${ENV_VAR} 占位符替换为 process.env 的值
|
|
4216
4216
|
|
|
@@ -4652,7 +4652,13 @@ lib/core/functions/writeEventStreamHead.md
|
|
|
4652
4652
|
|
|
4653
4653
|
> **writeEventStreamHead**(`res`): `void`
|
|
4654
4654
|
|
|
4655
|
-
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()` 持续发送事件,并由调用方在结束时关闭响应。
|
|
4656
4662
|
|
|
4657
4663
|
## Parameters
|
|
4658
4664
|
|
|
@@ -4660,10 +4666,14 @@ Defined in: [lib/core.ts:1431](https://github.com/maiyunnet/kebab/blob/master/li
|
|
|
4660
4666
|
|
|
4661
4667
|
`Http2ServerResponse`\<`Http2ServerRequest`\> \| `ServerResponse`\<`IncomingMessage`\>
|
|
4662
4668
|
|
|
4669
|
+
响应对象
|
|
4670
|
+
|
|
4663
4671
|
## Returns
|
|
4664
4672
|
|
|
4665
4673
|
`void`
|
|
4666
4674
|
|
|
4675
|
+
无返回值
|
|
4676
|
+
|
|
4667
4677
|
lib/core/functions/writeHead.md
|
|
4668
4678
|
---
|
|
4669
4679
|
|
|
@@ -4677,9 +4687,16 @@ lib/core/functions/writeHead.md
|
|
|
4677
4687
|
|
|
4678
4688
|
> **writeHead**(`res`, `statusCode`, `headers?`): `void`
|
|
4679
4689
|
|
|
4680
|
-
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
|
|
4681
4693
|
|
|
4682
|
-
|
|
4694
|
+
`setHeader()` 只暂存或修改单个头部,不会发送响应头,也不能提交状态码;在响应头提交前可反复调用。
|
|
4695
|
+
本方法会立即提交状态码和此前设置的全部头部,必须在所有 `setHeader()` 调用之后、首次
|
|
4696
|
+
`write()`、`end()` 或 `pipe()` 之前调用。提交后再调用 `setHeader()` 会抛出 `ERR_HTTP_HEADERS_SENT`。
|
|
4697
|
+
|
|
4698
|
+
普通控制器应设置 `_httpCode`、调用 `_res.setHeader()` 并直接返回内容,由路由层统一提交响应头。
|
|
4699
|
+
仅框架内部或手动接管响应(错误、重定向、代理、流式输出等)时才应直接调用本方法。
|
|
4683
4700
|
|
|
4684
4701
|
## Parameters
|
|
4685
4702
|
|
|
@@ -4693,18 +4710,20 @@ Defined in: [lib/core.ts:1420](https://github.com/maiyunnet/kebab/blob/master/li
|
|
|
4693
4710
|
|
|
4694
4711
|
`number`
|
|
4695
4712
|
|
|
4696
|
-
状态码
|
|
4713
|
+
HTTP 状态码
|
|
4697
4714
|
|
|
4698
4715
|
### headers?
|
|
4699
4716
|
|
|
4700
4717
|
`OutgoingHttpHeaders`
|
|
4701
4718
|
|
|
4702
|
-
|
|
4719
|
+
随本次提交附加的头部;通常优先在提交前使用 `setHeader()`
|
|
4703
4720
|
|
|
4704
4721
|
## Returns
|
|
4705
4722
|
|
|
4706
4723
|
`void`
|
|
4707
4724
|
|
|
4725
|
+
无返回值
|
|
4726
|
+
|
|
4708
4727
|
lib/core/functions/write.md
|
|
4709
4728
|
---
|
|
4710
4729
|
|
|
@@ -4718,7 +4737,7 @@ lib/core/functions/write.md
|
|
|
4718
4737
|
|
|
4719
4738
|
> **write**(`res`, `data`): `void`
|
|
4720
4739
|
|
|
4721
|
-
Defined in: [lib/core.ts:
|
|
4740
|
+
Defined in: [lib/core.ts:1462](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1462)
|
|
4722
4741
|
|
|
4723
4742
|
向 res 发送数据
|
|
4724
4743
|
|
|
@@ -6939,7 +6958,7 @@ lib/db/conn/classes/Connection.md
|
|
|
6939
6958
|
|
|
6940
6959
|
# Class: Connection
|
|
6941
6960
|
|
|
6942
|
-
Defined in: [lib/db/conn.ts:
|
|
6961
|
+
Defined in: [lib/db/conn.ts:39](https://github.com/maiyunnet/kebab/blob/master/lib/db/conn.ts#L39)
|
|
6943
6962
|
|
|
6944
6963
|
数据库连接对象
|
|
6945
6964
|
|
|
@@ -6949,7 +6968,7 @@ Defined in: [lib/db/conn.ts:38](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
6949
6968
|
|
|
6950
6969
|
> **new Connection**(`etc`, `link`): `Connection`
|
|
6951
6970
|
|
|
6952
|
-
Defined in: [lib/db/conn.ts:
|
|
6971
|
+
Defined in: [lib/db/conn.ts:64](https://github.com/maiyunnet/kebab/blob/master/lib/db/conn.ts#L64)
|
|
6953
6972
|
|
|
6954
6973
|
#### Parameters
|
|
6955
6974
|
|
|
@@ -6971,7 +6990,7 @@ Defined in: [lib/db/conn.ts:63](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
6971
6990
|
|
|
6972
6991
|
> **beginTransaction**(): `Promise`\<`boolean`\>
|
|
6973
6992
|
|
|
6974
|
-
Defined in: [lib/db/conn.ts:
|
|
6993
|
+
Defined in: [lib/db/conn.ts:326](https://github.com/maiyunnet/kebab/blob/master/lib/db/conn.ts#L326)
|
|
6975
6994
|
|
|
6976
6995
|
#### Returns
|
|
6977
6996
|
|
|
@@ -6983,7 +7002,7 @@ Defined in: [lib/db/conn.ts:325](https://github.com/maiyunnet/kebab/blob/master/
|
|
|
6983
7002
|
|
|
6984
7003
|
> **commit**(): `Promise`\<`boolean`\>
|
|
6985
7004
|
|
|
6986
|
-
Defined in: [lib/db/conn.ts:
|
|
7005
|
+
Defined in: [lib/db/conn.ts:352](https://github.com/maiyunnet/kebab/blob/master/lib/db/conn.ts#L352)
|
|
6987
7006
|
|
|
6988
7007
|
#### Returns
|
|
6989
7008
|
|
|
@@ -6995,7 +7014,7 @@ Defined in: [lib/db/conn.ts:346](https://github.com/maiyunnet/kebab/blob/master/
|
|
|
6995
7014
|
|
|
6996
7015
|
> **end**(): `Promise`\<`boolean`\>
|
|
6997
7016
|
|
|
6998
|
-
Defined in: [lib/db/conn.ts:
|
|
7017
|
+
Defined in: [lib/db/conn.ts:315](https://github.com/maiyunnet/kebab/blob/master/lib/db/conn.ts#L315)
|
|
6999
7018
|
|
|
7000
7019
|
关闭连接,一般情况下不使用
|
|
7001
7020
|
|
|
@@ -7009,7 +7028,7 @@ Defined in: [lib/db/conn.ts:314](https://github.com/maiyunnet/kebab/blob/master/
|
|
|
7009
7028
|
|
|
7010
7029
|
> **execute**(`sql`, `values?`): `Promise`\<[`IPacket`](../../interfaces/IPacket.md)\>
|
|
7011
7030
|
|
|
7012
|
-
Defined in: [lib/db/conn.ts:
|
|
7031
|
+
Defined in: [lib/db/conn.ts:241](https://github.com/maiyunnet/kebab/blob/master/lib/db/conn.ts#L241)
|
|
7013
7032
|
|
|
7014
7033
|
执行一条 SQL 并获得影响行数对象 packet
|
|
7015
7034
|
|
|
@@ -7037,7 +7056,7 @@ Defined in: [lib/db/conn.ts:240](https://github.com/maiyunnet/kebab/blob/master/
|
|
|
7037
7056
|
|
|
7038
7057
|
> **getEtc**(): [`IConfigDb`](../../../../index/interfaces/IConfigDb.md)
|
|
7039
7058
|
|
|
7040
|
-
Defined in: [lib/db/conn.ts:
|
|
7059
|
+
Defined in: [lib/db/conn.ts:73](https://github.com/maiyunnet/kebab/blob/master/lib/db/conn.ts#L73)
|
|
7041
7060
|
|
|
7042
7061
|
获取连接 etc 信息
|
|
7043
7062
|
|
|
@@ -7051,7 +7070,7 @@ Defined in: [lib/db/conn.ts:72](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
7051
7070
|
|
|
7052
7071
|
> **getLast**(): `number`
|
|
7053
7072
|
|
|
7054
|
-
Defined in: [lib/db/conn.ts:
|
|
7073
|
+
Defined in: [lib/db/conn.ts:85](https://github.com/maiyunnet/kebab/blob/master/lib/db/conn.ts#L85)
|
|
7055
7074
|
|
|
7056
7075
|
获取最后一次获取连接的时间
|
|
7057
7076
|
|
|
@@ -7065,7 +7084,7 @@ Defined in: [lib/db/conn.ts:84](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
7065
7084
|
|
|
7066
7085
|
> **getLastSql**(): `object`[]
|
|
7067
7086
|
|
|
7068
|
-
Defined in: [lib/db/conn.ts:
|
|
7087
|
+
Defined in: [lib/db/conn.ts:92](https://github.com/maiyunnet/kebab/blob/master/lib/db/conn.ts#L92)
|
|
7069
7088
|
|
|
7070
7089
|
获取最后两次执行的 sql 字符串
|
|
7071
7090
|
|
|
@@ -7079,7 +7098,7 @@ Defined in: [lib/db/conn.ts:91](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
7079
7098
|
|
|
7080
7099
|
> **getService**(): [`ESERVICE`](../../enumerations/ESERVICE.md)
|
|
7081
7100
|
|
|
7082
|
-
Defined in: [lib/db/conn.ts:
|
|
7101
|
+
Defined in: [lib/db/conn.ts:78](https://github.com/maiyunnet/kebab/blob/master/lib/db/conn.ts#L78)
|
|
7083
7102
|
|
|
7084
7103
|
获取数据库服务类型
|
|
7085
7104
|
|
|
@@ -7093,7 +7112,7 @@ Defined in: [lib/db/conn.ts:77](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
7093
7112
|
|
|
7094
7113
|
> **isAvailable**(`last?`): `Promise`\<`boolean`\>
|
|
7095
7114
|
|
|
7096
|
-
Defined in: [lib/db/conn.ts:
|
|
7115
|
+
Defined in: [lib/db/conn.ts:159](https://github.com/maiyunnet/kebab/blob/master/lib/db/conn.ts#L159)
|
|
7097
7116
|
|
|
7098
7117
|
通过执行一条语句判断当前连接是否可用
|
|
7099
7118
|
|
|
@@ -7115,7 +7134,7 @@ Defined in: [lib/db/conn.ts:158](https://github.com/maiyunnet/kebab/blob/master/
|
|
|
7115
7134
|
|
|
7116
7135
|
> **isLost**(): `boolean`
|
|
7117
7136
|
|
|
7118
|
-
Defined in: [lib/db/conn.ts:
|
|
7137
|
+
Defined in: [lib/db/conn.ts:109](https://github.com/maiyunnet/kebab/blob/master/lib/db/conn.ts#L109)
|
|
7119
7138
|
|
|
7120
7139
|
是否已经丢失
|
|
7121
7140
|
|
|
@@ -7129,7 +7148,7 @@ Defined in: [lib/db/conn.ts:108](https://github.com/maiyunnet/kebab/blob/master/
|
|
|
7129
7148
|
|
|
7130
7149
|
> **isTransaction**(): `boolean`
|
|
7131
7150
|
|
|
7132
|
-
Defined in: [lib/db/conn.ts:
|
|
7151
|
+
Defined in: [lib/db/conn.ts:116](https://github.com/maiyunnet/kebab/blob/master/lib/db/conn.ts#L116)
|
|
7133
7152
|
|
|
7134
7153
|
是否是开启事务状态
|
|
7135
7154
|
|
|
@@ -7143,7 +7162,7 @@ Defined in: [lib/db/conn.ts:115](https://github.com/maiyunnet/kebab/blob/master/
|
|
|
7143
7162
|
|
|
7144
7163
|
> **isUsing**(): `boolean`
|
|
7145
7164
|
|
|
7146
|
-
Defined in: [lib/db/conn.ts:
|
|
7165
|
+
Defined in: [lib/db/conn.ts:123](https://github.com/maiyunnet/kebab/blob/master/lib/db/conn.ts#L123)
|
|
7147
7166
|
|
|
7148
7167
|
获取当前状态是否正在被使用中
|
|
7149
7168
|
|
|
@@ -7157,7 +7176,7 @@ Defined in: [lib/db/conn.ts:122](https://github.com/maiyunnet/kebab/blob/master/
|
|
|
7157
7176
|
|
|
7158
7177
|
> **query**(`sql`, `values?`): `Promise`\<[`IData`](../../interfaces/IData.md)\>
|
|
7159
7178
|
|
|
7160
|
-
Defined in: [lib/db/conn.ts:
|
|
7179
|
+
Defined in: [lib/db/conn.ts:182](https://github.com/maiyunnet/kebab/blob/master/lib/db/conn.ts#L182)
|
|
7161
7180
|
|
|
7162
7181
|
执行一条 SQL 并获得返回数据
|
|
7163
7182
|
|
|
@@ -7185,7 +7204,7 @@ Defined in: [lib/db/conn.ts:181](https://github.com/maiyunnet/kebab/blob/master/
|
|
|
7185
7204
|
|
|
7186
7205
|
> **refreshLast**(): `void`
|
|
7187
7206
|
|
|
7188
|
-
Defined in: [lib/db/conn.ts:
|
|
7207
|
+
Defined in: [lib/db/conn.ts:151](https://github.com/maiyunnet/kebab/blob/master/lib/db/conn.ts#L151)
|
|
7189
7208
|
|
|
7190
7209
|
设定最后使用时间
|
|
7191
7210
|
|
|
@@ -7199,7 +7218,7 @@ Defined in: [lib/db/conn.ts:150](https://github.com/maiyunnet/kebab/blob/master/
|
|
|
7199
7218
|
|
|
7200
7219
|
> **rollback**(): `Promise`\<`boolean`\>
|
|
7201
7220
|
|
|
7202
|
-
Defined in: [lib/db/conn.ts:
|
|
7221
|
+
Defined in: [lib/db/conn.ts:372](https://github.com/maiyunnet/kebab/blob/master/lib/db/conn.ts#L372)
|
|
7203
7222
|
|
|
7204
7223
|
#### Returns
|
|
7205
7224
|
|
|
@@ -7211,7 +7230,7 @@ Defined in: [lib/db/conn.ts:364](https://github.com/maiyunnet/kebab/blob/master/
|
|
|
7211
7230
|
|
|
7212
7231
|
> **setLost**(): `void`
|
|
7213
7232
|
|
|
7214
|
-
Defined in: [lib/db/conn.ts:
|
|
7233
|
+
Defined in: [lib/db/conn.ts:102](https://github.com/maiyunnet/kebab/blob/master/lib/db/conn.ts#L102)
|
|
7215
7234
|
|
|
7216
7235
|
将本条连接设置为不可用
|
|
7217
7236
|
|
|
@@ -7225,7 +7244,7 @@ Defined in: [lib/db/conn.ts:101](https://github.com/maiyunnet/kebab/blob/master/
|
|
|
7225
7244
|
|
|
7226
7245
|
> **used**(): `void`
|
|
7227
7246
|
|
|
7228
|
-
Defined in: [lib/db/conn.ts:
|
|
7247
|
+
Defined in: [lib/db/conn.ts:144](https://github.com/maiyunnet/kebab/blob/master/lib/db/conn.ts#L144)
|
|
7229
7248
|
|
|
7230
7249
|
取消占用
|
|
7231
7250
|
|
|
@@ -7239,7 +7258,7 @@ Defined in: [lib/db/conn.ts:143](https://github.com/maiyunnet/kebab/blob/master/
|
|
|
7239
7258
|
|
|
7240
7259
|
> **using**(): `boolean`
|
|
7241
7260
|
|
|
7242
|
-
Defined in: [lib/db/conn.ts:
|
|
7261
|
+
Defined in: [lib/db/conn.ts:130](https://github.com/maiyunnet/kebab/blob/master/lib/db/conn.ts#L130)
|
|
7243
7262
|
|
|
7244
7263
|
判断是否可用(丢失的也算不可用),返回 true 代表获取成功并自动刷新最后时间
|
|
7245
7264
|
|
|
@@ -7549,7 +7568,7 @@ lib/db/pool/classes/Pool.md
|
|
|
7549
7568
|
|
|
7550
7569
|
# Class: Pool
|
|
7551
7570
|
|
|
7552
|
-
Defined in: [lib/db/pool.ts:
|
|
7571
|
+
Defined in: [lib/db/pool.ts:122](https://github.com/maiyunnet/kebab/blob/master/lib/db/pool.ts#L122)
|
|
7553
7572
|
|
|
7554
7573
|
数据库连接池对象
|
|
7555
7574
|
|
|
@@ -7559,7 +7578,7 @@ Defined in: [lib/db/pool.ts:116](https://github.com/maiyunnet/kebab/blob/master/
|
|
|
7559
7578
|
|
|
7560
7579
|
> **new Pool**(`etc`, `opt`): `Pool`
|
|
7561
7580
|
|
|
7562
|
-
Defined in: [lib/db/pool.ts:
|
|
7581
|
+
Defined in: [lib/db/pool.ts:133](https://github.com/maiyunnet/kebab/blob/master/lib/db/pool.ts#L133)
|
|
7563
7582
|
|
|
7564
7583
|
#### Parameters
|
|
7565
7584
|
|
|
@@ -7585,7 +7604,7 @@ Defined in: [lib/db/pool.ts:127](https://github.com/maiyunnet/kebab/blob/master/
|
|
|
7585
7604
|
|
|
7586
7605
|
> **beginTransaction**(`ctr`): `Promise`\<[`Transaction`](../../tran/classes/Transaction.md) \| `null`\>
|
|
7587
7606
|
|
|
7588
|
-
Defined in: [lib/db/pool.ts:
|
|
7607
|
+
Defined in: [lib/db/pool.ts:201](https://github.com/maiyunnet/kebab/blob/master/lib/db/pool.ts#L201)
|
|
7589
7608
|
|
|
7590
7609
|
开启事务,返回事务对象并锁定连接,别人任何人不可用,有 ctr 的话必传 this,独立执行时可传 null
|
|
7591
7610
|
|
|
@@ -7605,7 +7624,7 @@ Defined in: [lib/db/pool.ts:195](https://github.com/maiyunnet/kebab/blob/master/
|
|
|
7605
7624
|
|
|
7606
7625
|
> **execute**(`sql`, `values?`): `Promise`\<[`IPacket`](../../interfaces/IPacket.md)\>
|
|
7607
7626
|
|
|
7608
|
-
Defined in: [lib/db/pool.ts:
|
|
7627
|
+
Defined in: [lib/db/pool.ts:181](https://github.com/maiyunnet/kebab/blob/master/lib/db/pool.ts#L181)
|
|
7609
7628
|
|
|
7610
7629
|
执行一条 SQL 并获得影响行数对象 packet,连接失败抛出错误
|
|
7611
7630
|
|
|
@@ -7633,7 +7652,7 @@ Defined in: [lib/db/pool.ts:175](https://github.com/maiyunnet/kebab/blob/master/
|
|
|
7633
7652
|
|
|
7634
7653
|
> **getName**(): `string`
|
|
7635
7654
|
|
|
7636
|
-
Defined in: [lib/db/pool.ts:
|
|
7655
|
+
Defined in: [lib/db/pool.ts:147](https://github.com/maiyunnet/kebab/blob/master/lib/db/pool.ts#L147)
|
|
7637
7656
|
|
|
7638
7657
|
获取当前连接的数据库名称
|
|
7639
7658
|
|
|
@@ -7647,7 +7666,7 @@ Defined in: [lib/db/pool.ts:141](https://github.com/maiyunnet/kebab/blob/master/
|
|
|
7647
7666
|
|
|
7648
7667
|
> **getQueries**(): `number`
|
|
7649
7668
|
|
|
7650
|
-
Defined in: [lib/db/pool.ts:
|
|
7669
|
+
Defined in: [lib/db/pool.ts:339](https://github.com/maiyunnet/kebab/blob/master/lib/db/pool.ts#L339)
|
|
7651
7670
|
|
|
7652
7671
|
获取 SQL 执行次数
|
|
7653
7672
|
|
|
@@ -7661,7 +7680,7 @@ Defined in: [lib/db/pool.ts:327](https://github.com/maiyunnet/kebab/blob/master/
|
|
|
7661
7680
|
|
|
7662
7681
|
> **getService**(): [`ESERVICE`](../../enumerations/ESERVICE.md)
|
|
7663
7682
|
|
|
7664
|
-
Defined in: [lib/db/pool.ts:
|
|
7683
|
+
Defined in: [lib/db/pool.ts:142](https://github.com/maiyunnet/kebab/blob/master/lib/db/pool.ts#L142)
|
|
7665
7684
|
|
|
7666
7685
|
获取当前连接的服务商
|
|
7667
7686
|
|
|
@@ -7675,7 +7694,7 @@ Defined in: [lib/db/pool.ts:136](https://github.com/maiyunnet/kebab/blob/master/
|
|
|
7675
7694
|
|
|
7676
7695
|
> **query**(`sql`, `values?`): `Promise`\<[`IData`](../../interfaces/IData.md)\>
|
|
7677
7696
|
|
|
7678
|
-
Defined in: [lib/db/pool.ts:
|
|
7697
|
+
Defined in: [lib/db/pool.ts:157](https://github.com/maiyunnet/kebab/blob/master/lib/db/pool.ts#L157)
|
|
7679
7698
|
|
|
7680
7699
|
执行一条 SQL,无视顺序和相同连接,随用随取
|
|
7681
7700
|
|
|
@@ -7712,7 +7731,7 @@ lib/db/pool/functions/getConnectionList.md
|
|
|
7712
7731
|
|
|
7713
7732
|
> **getConnectionList**(): [`IConnectionInfo`](../interfaces/IConnectionInfo.md)[]
|
|
7714
7733
|
|
|
7715
|
-
Defined in: [lib/db/pool.ts:
|
|
7734
|
+
Defined in: [lib/db/pool.ts:41](https://github.com/maiyunnet/kebab/blob/master/lib/db/pool.ts#L41)
|
|
7716
7735
|
|
|
7717
7736
|
获取当前连接池中所有连接的信息
|
|
7718
7737
|
|
|
@@ -7754,7 +7773,7 @@ lib/db/pool/interfaces/IConnectionInfo.md
|
|
|
7754
7773
|
|
|
7755
7774
|
# Interface: IConnectionInfo
|
|
7756
7775
|
|
|
7757
|
-
Defined in: [lib/db/pool.ts:
|
|
7776
|
+
Defined in: [lib/db/pool.ts:24](https://github.com/maiyunnet/kebab/blob/master/lib/db/pool.ts#L24)
|
|
7758
7777
|
|
|
7759
7778
|
连接信息
|
|
7760
7779
|
|
|
@@ -7764,7 +7783,7 @@ Defined in: [lib/db/pool.ts:18](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
7764
7783
|
|
|
7765
7784
|
> **host**: `string`
|
|
7766
7785
|
|
|
7767
|
-
Defined in: [lib/db/pool.ts:
|
|
7786
|
+
Defined in: [lib/db/pool.ts:28](https://github.com/maiyunnet/kebab/blob/master/lib/db/pool.ts#L28)
|
|
7768
7787
|
|
|
7769
7788
|
***
|
|
7770
7789
|
|
|
@@ -7772,7 +7791,7 @@ Defined in: [lib/db/pool.ts:22](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
7772
7791
|
|
|
7773
7792
|
> **id**: `number`
|
|
7774
7793
|
|
|
7775
|
-
Defined in: [lib/db/pool.ts:
|
|
7794
|
+
Defined in: [lib/db/pool.ts:25](https://github.com/maiyunnet/kebab/blob/master/lib/db/pool.ts#L25)
|
|
7776
7795
|
|
|
7777
7796
|
***
|
|
7778
7797
|
|
|
@@ -7780,7 +7799,7 @@ Defined in: [lib/db/pool.ts:19](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
7780
7799
|
|
|
7781
7800
|
> **last**: `number`
|
|
7782
7801
|
|
|
7783
|
-
Defined in: [lib/db/pool.ts:
|
|
7802
|
+
Defined in: [lib/db/pool.ts:27](https://github.com/maiyunnet/kebab/blob/master/lib/db/pool.ts#L27)
|
|
7784
7803
|
|
|
7785
7804
|
***
|
|
7786
7805
|
|
|
@@ -7788,7 +7807,7 @@ Defined in: [lib/db/pool.ts:21](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
7788
7807
|
|
|
7789
7808
|
> **lost**: `boolean`
|
|
7790
7809
|
|
|
7791
|
-
Defined in: [lib/db/pool.ts:
|
|
7810
|
+
Defined in: [lib/db/pool.ts:33](https://github.com/maiyunnet/kebab/blob/master/lib/db/pool.ts#L33)
|
|
7792
7811
|
|
|
7793
7812
|
***
|
|
7794
7813
|
|
|
@@ -7796,7 +7815,7 @@ Defined in: [lib/db/pool.ts:27](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
7796
7815
|
|
|
7797
7816
|
> `optional` **name?**: `string`
|
|
7798
7817
|
|
|
7799
|
-
Defined in: [lib/db/pool.ts:
|
|
7818
|
+
Defined in: [lib/db/pool.ts:30](https://github.com/maiyunnet/kebab/blob/master/lib/db/pool.ts#L30)
|
|
7800
7819
|
|
|
7801
7820
|
***
|
|
7802
7821
|
|
|
@@ -7804,7 +7823,7 @@ Defined in: [lib/db/pool.ts:24](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
7804
7823
|
|
|
7805
7824
|
> **port**: `number`
|
|
7806
7825
|
|
|
7807
|
-
Defined in: [lib/db/pool.ts:
|
|
7826
|
+
Defined in: [lib/db/pool.ts:29](https://github.com/maiyunnet/kebab/blob/master/lib/db/pool.ts#L29)
|
|
7808
7827
|
|
|
7809
7828
|
***
|
|
7810
7829
|
|
|
@@ -7812,7 +7831,7 @@ Defined in: [lib/db/pool.ts:23](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
7812
7831
|
|
|
7813
7832
|
> **service**: [`ESERVICE`](../../enumerations/ESERVICE.md)
|
|
7814
7833
|
|
|
7815
|
-
Defined in: [lib/db/pool.ts:
|
|
7834
|
+
Defined in: [lib/db/pool.ts:26](https://github.com/maiyunnet/kebab/blob/master/lib/db/pool.ts#L26)
|
|
7816
7835
|
|
|
7817
7836
|
***
|
|
7818
7837
|
|
|
@@ -7820,7 +7839,7 @@ Defined in: [lib/db/pool.ts:20](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
7820
7839
|
|
|
7821
7840
|
> **transaction**: `boolean`
|
|
7822
7841
|
|
|
7823
|
-
Defined in: [lib/db/pool.ts:
|
|
7842
|
+
Defined in: [lib/db/pool.ts:35](https://github.com/maiyunnet/kebab/blob/master/lib/db/pool.ts#L35)
|
|
7824
7843
|
|
|
7825
7844
|
***
|
|
7826
7845
|
|
|
@@ -7828,7 +7847,7 @@ Defined in: [lib/db/pool.ts:29](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
7828
7847
|
|
|
7829
7848
|
> **user**: `string`
|
|
7830
7849
|
|
|
7831
|
-
Defined in: [lib/db/pool.ts:
|
|
7850
|
+
Defined in: [lib/db/pool.ts:31](https://github.com/maiyunnet/kebab/blob/master/lib/db/pool.ts#L31)
|
|
7832
7851
|
|
|
7833
7852
|
***
|
|
7834
7853
|
|
|
@@ -7836,7 +7855,7 @@ Defined in: [lib/db/pool.ts:25](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
7836
7855
|
|
|
7837
7856
|
> **using**: `boolean`
|
|
7838
7857
|
|
|
7839
|
-
Defined in: [lib/db/pool.ts:
|
|
7858
|
+
Defined in: [lib/db/pool.ts:34](https://github.com/maiyunnet/kebab/blob/master/lib/db/pool.ts#L34)
|
|
7840
7859
|
|
|
7841
7860
|
lib/db/tran/classes/Transaction.md
|
|
7842
7861
|
---
|
|
@@ -16550,7 +16569,7 @@ lib/text/functions/int2str.md
|
|
|
16550
16569
|
|
|
16551
16570
|
> **int2str**(`int`, `digits?`, `decimal?`): `string`
|
|
16552
16571
|
|
|
16553
|
-
Defined in: [lib/text.ts:
|
|
16572
|
+
Defined in: [lib/text.ts:825](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L825)
|
|
16554
16573
|
|
|
16555
16574
|
为解决精度问题,将整数转换为小数字符串
|
|
16556
16575
|
以下几个示例都是当 digits 为 3、decimal 为 2 时
|
|
@@ -16683,7 +16702,7 @@ lib/text/functions/isFalsy.md
|
|
|
16683
16702
|
|
|
16684
16703
|
> **isFalsy**(`val`): `val is TFalsy`
|
|
16685
16704
|
|
|
16686
|
-
Defined in: [lib/text.ts:
|
|
16705
|
+
Defined in: [lib/text.ts:776](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L776)
|
|
16687
16706
|
|
|
16688
16707
|
判断一个值是否是虚假的(为 null/undefined/空字符串/false/0)
|
|
16689
16708
|
|
|
@@ -16888,7 +16907,7 @@ lib/text/functions/isTruthy.md
|
|
|
16888
16907
|
|
|
16889
16908
|
> **isTruthy**\<`T`\>(`val`): `val is Exclude<T, TFalsy>`
|
|
16890
16909
|
|
|
16891
|
-
Defined in: [lib/text.ts:
|
|
16910
|
+
Defined in: [lib/text.ts:784](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L784)
|
|
16892
16911
|
|
|
16893
16912
|
判断一个值是否是真实的(不为 null/undefined/空字符串/false/0)
|
|
16894
16913
|
|
|
@@ -16923,7 +16942,7 @@ lib/text/functions/logicalOr.md
|
|
|
16923
16942
|
|
|
16924
16943
|
> **logicalOr**\<`T`, `T2`\>(`v1`, `v2`): `T` *extends* [`TFalsy`](../type-aliases/TFalsy.md) ? `T2` : `T`
|
|
16925
16944
|
|
|
16926
|
-
Defined in: [lib/text.ts:
|
|
16945
|
+
Defined in: [lib/text.ts:793](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L793)
|
|
16927
16946
|
|
|
16928
16947
|
类似 || 运算符的效果
|
|
16929
16948
|
|
|
@@ -17307,7 +17326,7 @@ lib/text/functions/str2int.md
|
|
|
17307
17326
|
|
|
17308
17327
|
> **str2int**(`str`, `digits?`): `number`
|
|
17309
17328
|
|
|
17310
|
-
Defined in: [lib/text.ts:
|
|
17329
|
+
Defined in: [lib/text.ts:807](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L807)
|
|
17311
17330
|
|
|
17312
17331
|
为解决精度问题,将字符串数字转换为整数显示
|
|
17313
17332
|
以下几个示例都是当 digits 为 2 时
|
|
@@ -17347,7 +17366,7 @@ lib/text/functions/stringifyBuffer.md
|
|
|
17347
17366
|
|
|
17348
17367
|
> **stringifyBuffer**(`buf`): `string`
|
|
17349
17368
|
|
|
17350
|
-
Defined in: [lib/text.ts:
|
|
17369
|
+
Defined in: [lib/text.ts:730](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L730)
|
|
17351
17370
|
|
|
17352
17371
|
输出文本格式的 buffer
|
|
17353
17372
|
|
|
@@ -17363,6 +17382,37 @@ Defined in: [lib/text.ts:706](https://github.com/maiyunnet/kebab/blob/master/lib
|
|
|
17363
17382
|
|
|
17364
17383
|
`string`
|
|
17365
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
|
+
|
|
17366
17416
|
lib/text/functions/stringifyJson.md
|
|
17367
17417
|
---
|
|
17368
17418
|
|
|
@@ -17440,7 +17490,7 @@ lib/text/functions/trimJson.md
|
|
|
17440
17490
|
|
|
17441
17491
|
> **trimJson**(`json`): `any`
|
|
17442
17492
|
|
|
17443
|
-
Defined in: [lib/text.ts:
|
|
17493
|
+
Defined in: [lib/text.ts:738](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L738)
|
|
17444
17494
|
|
|
17445
17495
|
递归删除 json 中的字符串首尾空格,会返回一个新的对象
|
|
17446
17496
|
|
|
@@ -17580,6 +17630,7 @@ lib/text/index.md
|
|
|
17580
17630
|
- [sizeFormat](functions/sizeFormat.md)
|
|
17581
17631
|
- [str2int](functions/str2int.md)
|
|
17582
17632
|
- [stringifyBuffer](functions/stringifyBuffer.md)
|
|
17633
|
+
- [stringifyError](functions/stringifyError.md)
|
|
17583
17634
|
- [stringifyJson](functions/stringifyJson.md)
|
|
17584
17635
|
- [stringifyResult](functions/stringifyResult.md)
|
|
17585
17636
|
- [trimJson](functions/trimJson.md)
|
|
@@ -17646,7 +17697,7 @@ lib/text/type-aliases/TFalsy.md
|
|
|
17646
17697
|
|
|
17647
17698
|
> **TFalsy** = `false` \| `""` \| `0` \| `null` \| `undefined` \| *typeof* `NaN`
|
|
17648
17699
|
|
|
17649
|
-
Defined in: [lib/text.ts:
|
|
17700
|
+
Defined in: [lib/text.ts:770](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L770)
|
|
17650
17701
|
|
|
17651
17702
|
虚假值类型
|
|
17652
17703
|
|
|
@@ -18493,7 +18544,7 @@ lib/undici/functions/fetch.md
|
|
|
18493
18544
|
|
|
18494
18545
|
> **fetch**(`input`, `init?`): `Promise`\<`Response`\>
|
|
18495
18546
|
|
|
18496
|
-
Defined in: [lib/undici.ts:
|
|
18547
|
+
Defined in: [lib/undici.ts:260](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L260)
|
|
18497
18548
|
|
|
18498
18549
|
发起一个完全兼容 fetch 的请求
|
|
18499
18550
|
|
|
@@ -18528,7 +18579,7 @@ lib/undici/functions/filterHeaders.md
|
|
|
18528
18579
|
|
|
18529
18580
|
> **filterHeaders**(`headers`, `res?`, `filter?`): `Record`\<`string`, `string` \| `string`[]\>
|
|
18530
18581
|
|
|
18531
|
-
Defined in: [lib/undici.ts:
|
|
18582
|
+
Defined in: [lib/undici.ts:634](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L634)
|
|
18532
18583
|
|
|
18533
18584
|
剔除不代理的 header,返回新的 header
|
|
18534
18585
|
|
|
@@ -18569,7 +18620,7 @@ lib/undici/functions/getFormData.md
|
|
|
18569
18620
|
|
|
18570
18621
|
> **getFormData**(): [`FormData`](../formdata/classes/FormData.md)
|
|
18571
18622
|
|
|
18572
|
-
Defined in: [lib/undici.ts:
|
|
18623
|
+
Defined in: [lib/undici.ts:618](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L618)
|
|
18573
18624
|
|
|
18574
18625
|
创建 FormData 对象
|
|
18575
18626
|
|
|
@@ -18590,7 +18641,7 @@ lib/undici/functions/get.md
|
|
|
18590
18641
|
|
|
18591
18642
|
> **get**(`u`, `opt?`): `Promise`\<[`Response`](../response/classes/Response.md)\>
|
|
18592
18643
|
|
|
18593
|
-
Defined in: [lib/undici.ts:
|
|
18644
|
+
Defined in: [lib/undici.ts:138](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L138)
|
|
18594
18645
|
|
|
18595
18646
|
发起一个 get 请求
|
|
18596
18647
|
|
|
@@ -18652,7 +18703,7 @@ lib/undici/functions/getResponseJson.md
|
|
|
18652
18703
|
|
|
18653
18704
|
> **getResponseJson**(`u`, `opt?`): `Promise`\<`any`\>
|
|
18654
18705
|
|
|
18655
|
-
Defined in: [lib/undici.ts:
|
|
18706
|
+
Defined in: [lib/undici.ts:248](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L248)
|
|
18656
18707
|
|
|
18657
18708
|
发起 GET 请求并解析 JSON 响应
|
|
18658
18709
|
|
|
@@ -18674,7 +18725,7 @@ Defined in: [lib/undici.ts:177](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
18674
18725
|
|
|
18675
18726
|
`Promise`\<`any`\>
|
|
18676
18727
|
|
|
18677
|
-
JSON
|
|
18728
|
+
JSON 数据;请求失败返回 null;JSON 解析失败返回 false
|
|
18678
18729
|
|
|
18679
18730
|
lib/undici/functions/mproxyData.md
|
|
18680
18731
|
---
|
|
@@ -18689,7 +18740,7 @@ lib/undici/functions/mproxyData.md
|
|
|
18689
18740
|
|
|
18690
18741
|
> **mproxyData**(`ctr`): `any`
|
|
18691
18742
|
|
|
18692
|
-
Defined in: [lib/undici.ts:
|
|
18743
|
+
Defined in: [lib/undici.ts:736](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L736)
|
|
18693
18744
|
|
|
18694
18745
|
获取 mproxy 的附加数据
|
|
18695
18746
|
|
|
@@ -18718,7 +18769,7 @@ lib/undici/functions/mproxy.md
|
|
|
18718
18769
|
|
|
18719
18770
|
> **mproxy**(`ctr`, `auth`, `opt?`): `Promise`\<`number`\>
|
|
18720
18771
|
|
|
18721
|
-
Defined in: [lib/undici.ts:
|
|
18772
|
+
Defined in: [lib/undici.ts:674](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L674)
|
|
18722
18773
|
|
|
18723
18774
|
正向 mproxy 代理,注意提前处理不要自动处理 post 数据,读取 get 的 url 为实际请求地址
|
|
18724
18775
|
get: url, auth
|
|
@@ -18760,7 +18811,7 @@ lib/undici/functions/open.md
|
|
|
18760
18811
|
|
|
18761
18812
|
> **open**(`u`): [`Request`](../request/classes/Request.md)
|
|
18762
18813
|
|
|
18763
|
-
Defined in: [lib/undici.ts:
|
|
18814
|
+
Defined in: [lib/undici.ts:129](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L129)
|
|
18764
18815
|
|
|
18765
18816
|
创建一个请求对象
|
|
18766
18817
|
|
|
@@ -18787,7 +18838,7 @@ lib/undici/functions/postJson.md
|
|
|
18787
18838
|
|
|
18788
18839
|
> **postJson**(`u`, `data`, `opt?`): `Promise`\<[`Response`](../response/classes/Response.md)\>
|
|
18789
18840
|
|
|
18790
|
-
Defined in: [lib/undici.ts:
|
|
18841
|
+
Defined in: [lib/undici.ts:163](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L163)
|
|
18791
18842
|
|
|
18792
18843
|
发起 JSON 请求
|
|
18793
18844
|
|
|
@@ -18828,9 +18879,9 @@ lib/undici/functions/postJsonResponseJson.md
|
|
|
18828
18879
|
|
|
18829
18880
|
> **postJsonResponseJson**(`u`, `data`, `opt?`): `Promise`\<`any`\>
|
|
18830
18881
|
|
|
18831
|
-
Defined in: [lib/undici.ts:
|
|
18882
|
+
Defined in: [lib/undici.ts:220](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L220)
|
|
18832
18883
|
|
|
18833
|
-
发起 JSON 请求并解析 JSON
|
|
18884
|
+
发起 JSON 请求并解析 JSON 响应
|
|
18834
18885
|
|
|
18835
18886
|
## Parameters
|
|
18836
18887
|
|
|
@@ -18856,6 +18907,8 @@ Defined in: [lib/undici.ts:131](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
18856
18907
|
|
|
18857
18908
|
`Promise`\<`any`\>
|
|
18858
18909
|
|
|
18910
|
+
JSON 数据;请求失败返回 null;JSON 解析失败返回 false
|
|
18911
|
+
|
|
18859
18912
|
lib/undici/functions/post.md
|
|
18860
18913
|
---
|
|
18861
18914
|
|
|
@@ -18869,7 +18922,7 @@ lib/undici/functions/post.md
|
|
|
18869
18922
|
|
|
18870
18923
|
> **post**(`u`, `data`, `opt?`): `Promise`\<[`Response`](../response/classes/Response.md)\>
|
|
18871
18924
|
|
|
18872
|
-
Defined in: [lib/undici.ts:
|
|
18925
|
+
Defined in: [lib/undici.ts:148](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L148)
|
|
18873
18926
|
|
|
18874
18927
|
发起一个 post 请求
|
|
18875
18928
|
|
|
@@ -18910,7 +18963,7 @@ lib/undici/functions/postResponseJson.md
|
|
|
18910
18963
|
|
|
18911
18964
|
> **postResponseJson**(`u`, `data`, `opt?`): `Promise`\<`any`\>
|
|
18912
18965
|
|
|
18913
|
-
Defined in: [lib/undici.ts:
|
|
18966
|
+
Defined in: [lib/undici.ts:235](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L235)
|
|
18914
18967
|
|
|
18915
18968
|
发起 POST 请求并解析 JSON 响应
|
|
18916
18969
|
|
|
@@ -18938,7 +18991,7 @@ Defined in: [lib/undici.ts:155](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
18938
18991
|
|
|
18939
18992
|
`Promise`\<`any`\>
|
|
18940
18993
|
|
|
18941
|
-
JSON
|
|
18994
|
+
JSON 数据;请求失败返回 null;JSON 解析失败返回 false
|
|
18942
18995
|
|
|
18943
18996
|
lib/undici/functions/request.md
|
|
18944
18997
|
---
|
|
@@ -18953,7 +19006,7 @@ lib/undici/functions/request.md
|
|
|
18953
19006
|
|
|
18954
19007
|
> **request**(`u`, `data?`, `opt?`): `Promise`\<[`Response`](../response/classes/Response.md)\>
|
|
18955
19008
|
|
|
18956
|
-
Defined in: [lib/undici.ts:
|
|
19009
|
+
Defined in: [lib/undici.ts:432](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L432)
|
|
18957
19010
|
|
|
18958
19011
|
发起一个请求
|
|
18959
19012
|
|
|
@@ -18990,7 +19043,7 @@ lib/undici/functions/rproxy.md
|
|
|
18990
19043
|
|
|
18991
19044
|
> **rproxy**(`ctr`, `route`, `opt?`): `Promise`\<`boolean`\>
|
|
18992
19045
|
|
|
18993
|
-
Defined in: [lib/undici.ts:
|
|
19046
|
+
Defined in: [lib/undici.ts:766](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L766)
|
|
18994
19047
|
|
|
18995
19048
|
反向代理,将本服务器的某个路由反代到其他网址
|
|
18996
19049
|
|
|
@@ -19079,7 +19132,7 @@ lib/undici/interfaces/IMproxyOptions.md
|
|
|
19079
19132
|
|
|
19080
19133
|
# Interface: IMproxyOptions
|
|
19081
19134
|
|
|
19082
|
-
Defined in: [lib/undici.ts:
|
|
19135
|
+
Defined in: [lib/undici.ts:889](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L889)
|
|
19083
19136
|
|
|
19084
19137
|
正向代理请求的传入参数选项
|
|
19085
19138
|
|
|
@@ -19089,7 +19142,7 @@ Defined in: [lib/undici.ts:820](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
19089
19142
|
|
|
19090
19143
|
> `optional` **filter?**: (`h`) => `boolean`
|
|
19091
19144
|
|
|
19092
|
-
Defined in: [lib/undici.ts:
|
|
19145
|
+
Defined in: [lib/undici.ts:898](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L898)
|
|
19093
19146
|
|
|
19094
19147
|
过滤 header,返回 true 则留下
|
|
19095
19148
|
|
|
@@ -19109,7 +19162,7 @@ Defined in: [lib/undici.ts:829](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
19109
19162
|
|
|
19110
19163
|
> `optional` **follow?**: `number`
|
|
19111
19164
|
|
|
19112
|
-
Defined in: [lib/undici.ts:
|
|
19165
|
+
Defined in: [lib/undici.ts:892](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L892)
|
|
19113
19166
|
|
|
19114
19167
|
***
|
|
19115
19168
|
|
|
@@ -19117,7 +19170,7 @@ Defined in: [lib/undici.ts:823](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
19117
19170
|
|
|
19118
19171
|
> `optional` **headers?**: [`THttpHeaders`](../type-aliases/THttpHeaders.md)
|
|
19119
19172
|
|
|
19120
|
-
Defined in: [lib/undici.ts:
|
|
19173
|
+
Defined in: [lib/undici.ts:896](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L896)
|
|
19121
19174
|
|
|
19122
19175
|
***
|
|
19123
19176
|
|
|
@@ -19125,7 +19178,7 @@ Defined in: [lib/undici.ts:827](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
19125
19178
|
|
|
19126
19179
|
> `optional` **hosts?**: `string` \| `Record`\<`string`, `string`\>
|
|
19127
19180
|
|
|
19128
|
-
Defined in: [lib/undici.ts:
|
|
19181
|
+
Defined in: [lib/undici.ts:894](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L894)
|
|
19129
19182
|
|
|
19130
19183
|
自定义 host 映射,如 {'www.maiyun.net': '127.0.0.1'},或全部映射到一个 host
|
|
19131
19184
|
|
|
@@ -19135,7 +19188,7 @@ Defined in: [lib/undici.ts:825](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
19135
19188
|
|
|
19136
19189
|
> `optional` **local?**: `string`
|
|
19137
19190
|
|
|
19138
|
-
Defined in: [lib/undici.ts:
|
|
19191
|
+
Defined in: [lib/undici.ts:895](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L895)
|
|
19139
19192
|
|
|
19140
19193
|
***
|
|
19141
19194
|
|
|
@@ -19143,7 +19196,7 @@ Defined in: [lib/undici.ts:826](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
19143
19196
|
|
|
19144
19197
|
> `optional` **reuse?**: `string` \| `Agent` \| `ProxyAgent`
|
|
19145
19198
|
|
|
19146
|
-
Defined in: [lib/undici.ts:
|
|
19199
|
+
Defined in: [lib/undici.ts:900](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L900)
|
|
19147
19200
|
|
|
19148
19201
|
默认为 default
|
|
19149
19202
|
|
|
@@ -19153,7 +19206,7 @@ Defined in: [lib/undici.ts:831](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
19153
19206
|
|
|
19154
19207
|
> `optional` **timeout?**: `number`
|
|
19155
19208
|
|
|
19156
|
-
Defined in: [lib/undici.ts:
|
|
19209
|
+
Defined in: [lib/undici.ts:891](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L891)
|
|
19157
19210
|
|
|
19158
19211
|
秒数,默认 300 秒
|
|
19159
19212
|
|
|
@@ -19168,7 +19221,7 @@ lib/undici/interfaces/IRequestOptions.md
|
|
|
19168
19221
|
|
|
19169
19222
|
# Interface: IRequestOptions
|
|
19170
19223
|
|
|
19171
|
-
Defined in: [lib/undici.ts:
|
|
19224
|
+
Defined in: [lib/undici.ts:852](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L852)
|
|
19172
19225
|
|
|
19173
19226
|
请求的传入参数选项
|
|
19174
19227
|
|
|
@@ -19178,7 +19231,7 @@ Defined in: [lib/undici.ts:787](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
19178
19231
|
|
|
19179
19232
|
> `optional` **cookie?**: `Record`\<`string`, [`ICookie`](../../cookie/interfaces/ICookie.md)\>
|
|
19180
19233
|
|
|
19181
|
-
Defined in: [lib/undici.ts:
|
|
19234
|
+
Defined in: [lib/undici.ts:881](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L881)
|
|
19182
19235
|
|
|
19183
19236
|
cookie 托管对象
|
|
19184
19237
|
|
|
@@ -19188,7 +19241,7 @@ cookie 托管对象
|
|
|
19188
19241
|
|
|
19189
19242
|
> `optional` **follow?**: `number`
|
|
19190
19243
|
|
|
19191
|
-
Defined in: [lib/undici.ts:
|
|
19244
|
+
Defined in: [lib/undici.ts:862](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L862)
|
|
19192
19245
|
|
|
19193
19246
|
追踪 location 次数,0 为不追踪,默认为 0
|
|
19194
19247
|
|
|
@@ -19198,7 +19251,7 @@ Defined in: [lib/undici.ts:793](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
19198
19251
|
|
|
19199
19252
|
> `optional` **headers?**: [`THttpHeaders`](../type-aliases/THttpHeaders.md)
|
|
19200
19253
|
|
|
19201
|
-
Defined in: [lib/undici.ts:
|
|
19254
|
+
Defined in: [lib/undici.ts:867](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L867)
|
|
19202
19255
|
|
|
19203
19256
|
***
|
|
19204
19257
|
|
|
@@ -19206,7 +19259,7 @@ Defined in: [lib/undici.ts:798](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
19206
19259
|
|
|
19207
19260
|
> `optional` **hosts?**: `string` \| `Record`\<`string`, `string`\>
|
|
19208
19261
|
|
|
19209
|
-
Defined in: [lib/undici.ts:
|
|
19262
|
+
Defined in: [lib/undici.ts:864](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L864)
|
|
19210
19263
|
|
|
19211
19264
|
自定义 host 映射,如 {'www.maiyun.net': '127.0.0.1'},或全部映射到一个 host
|
|
19212
19265
|
|
|
@@ -19216,7 +19269,7 @@ Defined in: [lib/undici.ts:795](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
19216
19269
|
|
|
19217
19270
|
> `optional` **keep?**: `boolean`
|
|
19218
19271
|
|
|
19219
|
-
Defined in: [lib/undici.ts:
|
|
19272
|
+
Defined in: [lib/undici.ts:877](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L877)
|
|
19220
19273
|
|
|
19221
19274
|
连接是否保持长连接(即是否允许复用),默认为 true
|
|
19222
19275
|
|
|
@@ -19226,7 +19279,7 @@ Defined in: [lib/undici.ts:808](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
19226
19279
|
|
|
19227
19280
|
> `optional` **local?**: `string`
|
|
19228
19281
|
|
|
19229
|
-
Defined in: [lib/undici.ts:
|
|
19282
|
+
Defined in: [lib/undici.ts:866](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L866)
|
|
19230
19283
|
|
|
19231
19284
|
***
|
|
19232
19285
|
|
|
@@ -19234,7 +19287,7 @@ Defined in: [lib/undici.ts:797](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
19234
19287
|
|
|
19235
19288
|
> `optional` **log?**: `boolean`
|
|
19236
19289
|
|
|
19237
|
-
Defined in: [lib/undici.ts:
|
|
19290
|
+
Defined in: [lib/undici.ts:883](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L883)
|
|
19238
19291
|
|
|
19239
19292
|
若有异常写入文件日志,默认为 true
|
|
19240
19293
|
|
|
@@ -19244,7 +19297,7 @@ Defined in: [lib/undici.ts:814](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
19244
19297
|
|
|
19245
19298
|
> `optional` **method?**: `"GET"` \| `"POST"` \| `"PUT"` \| `"DELETE"` \| `"OPTIONS"`
|
|
19246
19299
|
|
|
19247
|
-
Defined in: [lib/undici.ts:
|
|
19300
|
+
Defined in: [lib/undici.ts:853](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L853)
|
|
19248
19301
|
|
|
19249
19302
|
***
|
|
19250
19303
|
|
|
@@ -19252,7 +19305,7 @@ Defined in: [lib/undici.ts:788](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
19252
19305
|
|
|
19253
19306
|
> `optional` **mproxy?**: `object`
|
|
19254
19307
|
|
|
19255
|
-
Defined in: [lib/undici.ts:
|
|
19308
|
+
Defined in: [lib/undici.ts:869](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L869)
|
|
19256
19309
|
|
|
19257
19310
|
正向 mproxy 代理,url 如 https://xxx/abc
|
|
19258
19311
|
|
|
@@ -19276,11 +19329,31 @@ Defined in: [lib/undici.ts:800](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
19276
19329
|
|
|
19277
19330
|
***
|
|
19278
19331
|
|
|
19332
|
+
### retry?
|
|
19333
|
+
|
|
19334
|
+
> `optional` **retry?**: `number`
|
|
19335
|
+
|
|
19336
|
+
Defined in: [lib/undici.ts:858](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L858)
|
|
19337
|
+
|
|
19338
|
+
网络异常后的重试次数,默认 0;流式请求体不可重试,非幂等请求需由调用方保证安全
|
|
19339
|
+
|
|
19340
|
+
***
|
|
19341
|
+
|
|
19342
|
+
### retryJson?
|
|
19343
|
+
|
|
19344
|
+
> `optional` **retryJson?**: `number`
|
|
19345
|
+
|
|
19346
|
+
Defined in: [lib/undici.ts:860](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L860)
|
|
19347
|
+
|
|
19348
|
+
JSON 解析失败后的重试次数,默认 0;仅适用于 ResponseJson 快捷方法,非幂等请求需由调用方保证安全
|
|
19349
|
+
|
|
19350
|
+
***
|
|
19351
|
+
|
|
19279
19352
|
### reuse?
|
|
19280
19353
|
|
|
19281
19354
|
> `optional` **reuse?**: `string` \| `Agent` \| `ProxyAgent`
|
|
19282
19355
|
|
|
19283
|
-
Defined in: [lib/undici.ts:
|
|
19356
|
+
Defined in: [lib/undici.ts:879](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L879)
|
|
19284
19357
|
|
|
19285
19358
|
复用池名/Agent,默认为 default
|
|
19286
19359
|
|
|
@@ -19290,7 +19363,7 @@ Defined in: [lib/undici.ts:810](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
19290
19363
|
|
|
19291
19364
|
> `optional` **save?**: `string`
|
|
19292
19365
|
|
|
19293
|
-
Defined in: [lib/undici.ts:
|
|
19366
|
+
Defined in: [lib/undici.ts:865](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L865)
|
|
19294
19367
|
|
|
19295
19368
|
***
|
|
19296
19369
|
|
|
@@ -19298,7 +19371,7 @@ Defined in: [lib/undici.ts:796](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
19298
19371
|
|
|
19299
19372
|
> `optional` **signal?**: `AbortSignal`
|
|
19300
19373
|
|
|
19301
|
-
Defined in: [lib/undici.ts:
|
|
19374
|
+
Defined in: [lib/undici.ts:885](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L885)
|
|
19302
19375
|
|
|
19303
19376
|
请求中止信号
|
|
19304
19377
|
|
|
@@ -19308,7 +19381,7 @@ Defined in: [lib/undici.ts:816](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
19308
19381
|
|
|
19309
19382
|
> `optional` **timeout?**: `number`
|
|
19310
19383
|
|
|
19311
|
-
Defined in: [lib/undici.ts:
|
|
19384
|
+
Defined in: [lib/undici.ts:856](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L856)
|
|
19312
19385
|
|
|
19313
19386
|
秒数,默认 300 秒
|
|
19314
19387
|
|
|
@@ -19318,7 +19391,7 @@ Defined in: [lib/undici.ts:791](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
19318
19391
|
|
|
19319
19392
|
> `optional` **type?**: `"form"` \| `"json"`
|
|
19320
19393
|
|
|
19321
|
-
Defined in: [lib/undici.ts:
|
|
19394
|
+
Defined in: [lib/undici.ts:854](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L854)
|
|
19322
19395
|
|
|
19323
19396
|
lib/undici/interfaces/IRproxyOptions.md
|
|
19324
19397
|
---
|
|
@@ -19331,7 +19404,7 @@ lib/undici/interfaces/IRproxyOptions.md
|
|
|
19331
19404
|
|
|
19332
19405
|
# Interface: IRproxyOptions
|
|
19333
19406
|
|
|
19334
|
-
Defined in: [lib/undici.ts:
|
|
19407
|
+
Defined in: [lib/undici.ts:904](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L904)
|
|
19335
19408
|
|
|
19336
19409
|
反向代理请求的传入参数选项
|
|
19337
19410
|
|
|
@@ -19341,7 +19414,7 @@ Defined in: [lib/undici.ts:835](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
19341
19414
|
|
|
19342
19415
|
> `optional` **body?**: `string` \| `Buffer`\<`ArrayBufferLike`\> \| `Readable`
|
|
19343
19416
|
|
|
19344
|
-
Defined in: [lib/undici.ts:
|
|
19417
|
+
Defined in: [lib/undici.ts:923](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L923)
|
|
19345
19418
|
|
|
19346
19419
|
手动传入请求体(优先于原始 req 流),用于 req 流已消费后仍需转发 body 的场景
|
|
19347
19420
|
|
|
@@ -19351,7 +19424,7 @@ Defined in: [lib/undici.ts:854](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
19351
19424
|
|
|
19352
19425
|
> `optional` **filter?**: (`h`) => `boolean`
|
|
19353
19426
|
|
|
19354
|
-
Defined in: [lib/undici.ts:
|
|
19427
|
+
Defined in: [lib/undici.ts:913](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L913)
|
|
19355
19428
|
|
|
19356
19429
|
过滤 header,返回 true 则留下
|
|
19357
19430
|
|
|
@@ -19371,7 +19444,7 @@ Defined in: [lib/undici.ts:844](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
19371
19444
|
|
|
19372
19445
|
> `optional` **follow?**: `number`
|
|
19373
19446
|
|
|
19374
|
-
Defined in: [lib/undici.ts:
|
|
19447
|
+
Defined in: [lib/undici.ts:907](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L907)
|
|
19375
19448
|
|
|
19376
19449
|
***
|
|
19377
19450
|
|
|
@@ -19379,7 +19452,7 @@ Defined in: [lib/undici.ts:838](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
19379
19452
|
|
|
19380
19453
|
> `optional` **headers?**: [`THttpHeaders`](../type-aliases/THttpHeaders.md)
|
|
19381
19454
|
|
|
19382
|
-
Defined in: [lib/undici.ts:
|
|
19455
|
+
Defined in: [lib/undici.ts:911](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L911)
|
|
19383
19456
|
|
|
19384
19457
|
***
|
|
19385
19458
|
|
|
@@ -19387,7 +19460,7 @@ Defined in: [lib/undici.ts:842](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
19387
19460
|
|
|
19388
19461
|
> `optional` **hosts?**: `string` \| `Record`\<`string`, `string`\>
|
|
19389
19462
|
|
|
19390
|
-
Defined in: [lib/undici.ts:
|
|
19463
|
+
Defined in: [lib/undici.ts:909](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L909)
|
|
19391
19464
|
|
|
19392
19465
|
自定义 host 映射,如 {'www.maiyun.net': '127.0.0.1'},或全部映射到一个 host
|
|
19393
19466
|
|
|
@@ -19397,7 +19470,7 @@ Defined in: [lib/undici.ts:840](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
19397
19470
|
|
|
19398
19471
|
> `optional` **local?**: `string`
|
|
19399
19472
|
|
|
19400
|
-
Defined in: [lib/undici.ts:
|
|
19473
|
+
Defined in: [lib/undici.ts:910](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L910)
|
|
19401
19474
|
|
|
19402
19475
|
***
|
|
19403
19476
|
|
|
@@ -19405,7 +19478,7 @@ Defined in: [lib/undici.ts:841](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
19405
19478
|
|
|
19406
19479
|
> `optional` **mproxy?**: `object`
|
|
19407
19480
|
|
|
19408
|
-
Defined in: [lib/undici.ts:
|
|
19481
|
+
Defined in: [lib/undici.ts:915](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L915)
|
|
19409
19482
|
|
|
19410
19483
|
正向 mproxy 代理,url 如 https://xxx/abc
|
|
19411
19484
|
|
|
@@ -19433,7 +19506,7 @@ Defined in: [lib/undici.ts:846](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
19433
19506
|
|
|
19434
19507
|
> `optional` **querys?**: `Record`\<`string`, `any`\>
|
|
19435
19508
|
|
|
19436
|
-
Defined in: [lib/undici.ts:
|
|
19509
|
+
Defined in: [lib/undici.ts:925](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L925)
|
|
19437
19510
|
|
|
19438
19511
|
自定义 GET 查询参数,传入后直接替换代理目标 URL 的整个 query string
|
|
19439
19512
|
|
|
@@ -19443,7 +19516,7 @@ Defined in: [lib/undici.ts:856](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
19443
19516
|
|
|
19444
19517
|
> `optional` **reuse?**: `string` \| `Agent` \| `ProxyAgent`
|
|
19445
19518
|
|
|
19446
|
-
Defined in: [lib/undici.ts:
|
|
19519
|
+
Defined in: [lib/undici.ts:927](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L927)
|
|
19447
19520
|
|
|
19448
19521
|
默认为 default
|
|
19449
19522
|
|
|
@@ -19453,7 +19526,7 @@ Defined in: [lib/undici.ts:858](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
19453
19526
|
|
|
19454
19527
|
> `optional` **timeout?**: `number`
|
|
19455
19528
|
|
|
19456
|
-
Defined in: [lib/undici.ts:
|
|
19529
|
+
Defined in: [lib/undici.ts:906](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L906)
|
|
19457
19530
|
|
|
19458
19531
|
秒数,默认 300 秒
|
|
19459
19532
|
|
|
@@ -19516,7 +19589,7 @@ Defined in: [lib/undici/request.ts:30](https://github.com/maiyunnet/kebab/blob/m
|
|
|
19516
19589
|
|
|
19517
19590
|
> **follow**(`follow?`): `this`
|
|
19518
19591
|
|
|
19519
|
-
Defined in: [lib/undici/request.ts:
|
|
19592
|
+
Defined in: [lib/undici/request.ts:96](https://github.com/maiyunnet/kebab/blob/master/lib/undici/request.ts#L96)
|
|
19520
19593
|
|
|
19521
19594
|
设置是否跟随请求方的 location,留空为跟随,不设置为不跟随
|
|
19522
19595
|
|
|
@@ -19550,7 +19623,7 @@ method get 方法别名
|
|
|
19550
19623
|
|
|
19551
19624
|
> **headers**(`headers`): `this`
|
|
19552
19625
|
|
|
19553
|
-
Defined in: [lib/undici/request.ts:
|
|
19626
|
+
Defined in: [lib/undici/request.ts:132](https://github.com/maiyunnet/kebab/blob/master/lib/undici/request.ts#L132)
|
|
19554
19627
|
|
|
19555
19628
|
批量设置提交的 headers
|
|
19556
19629
|
|
|
@@ -19570,7 +19643,7 @@ Defined in: [lib/undici/request.ts:123](https://github.com/maiyunnet/kebab/blob/
|
|
|
19570
19643
|
|
|
19571
19644
|
> **hosts**(`hosts`): `this`
|
|
19572
19645
|
|
|
19573
|
-
Defined in: [lib/undici/request.ts:
|
|
19646
|
+
Defined in: [lib/undici/request.ts:105](https://github.com/maiyunnet/kebab/blob/master/lib/undici/request.ts#L105)
|
|
19574
19647
|
|
|
19575
19648
|
设置域名 -> ip的对应键值,就像电脑里的 hosts 一样
|
|
19576
19649
|
|
|
@@ -19604,7 +19677,7 @@ type json 方法别名
|
|
|
19604
19677
|
|
|
19605
19678
|
> **local**(`addr`): `this`
|
|
19606
19679
|
|
|
19607
|
-
Defined in: [lib/undici/request.ts:
|
|
19680
|
+
Defined in: [lib/undici/request.ts:123](https://github.com/maiyunnet/kebab/blob/master/lib/undici/request.ts#L123)
|
|
19608
19681
|
|
|
19609
19682
|
设置使用的本地网卡 IP
|
|
19610
19683
|
|
|
@@ -19658,7 +19731,7 @@ method post 方法别名
|
|
|
19658
19731
|
|
|
19659
19732
|
> **request**(`cookie?`): `Promise`\<[`Response`](../../response/classes/Response.md)\>
|
|
19660
19733
|
|
|
19661
|
-
Defined in: [lib/undici/request.ts:
|
|
19734
|
+
Defined in: [lib/undici/request.ts:152](https://github.com/maiyunnet/kebab/blob/master/lib/undici/request.ts#L152)
|
|
19662
19735
|
|
|
19663
19736
|
发起请求
|
|
19664
19737
|
|
|
@@ -19674,11 +19747,33 @@ Defined in: [lib/undici/request.ts:143](https://github.com/maiyunnet/kebab/blob/
|
|
|
19674
19747
|
|
|
19675
19748
|
***
|
|
19676
19749
|
|
|
19750
|
+
### retry()
|
|
19751
|
+
|
|
19752
|
+
> **retry**(`retry?`): `this`
|
|
19753
|
+
|
|
19754
|
+
Defined in: [lib/undici/request.ts:87](https://github.com/maiyunnet/kebab/blob/master/lib/undici/request.ts#L87)
|
|
19755
|
+
|
|
19756
|
+
设置网络异常后的重试次数
|
|
19757
|
+
|
|
19758
|
+
#### Parameters
|
|
19759
|
+
|
|
19760
|
+
##### retry?
|
|
19761
|
+
|
|
19762
|
+
`number` = `1`
|
|
19763
|
+
|
|
19764
|
+
重试次数,默认为 1;非幂等请求需由调用方保证安全
|
|
19765
|
+
|
|
19766
|
+
#### Returns
|
|
19767
|
+
|
|
19768
|
+
`this`
|
|
19769
|
+
|
|
19770
|
+
***
|
|
19771
|
+
|
|
19677
19772
|
### save()
|
|
19678
19773
|
|
|
19679
19774
|
> **save**(`save`): `this`
|
|
19680
19775
|
|
|
19681
|
-
Defined in: [lib/undici/request.ts:
|
|
19776
|
+
Defined in: [lib/undici/request.ts:114](https://github.com/maiyunnet/kebab/blob/master/lib/undici/request.ts#L114)
|
|
19682
19777
|
|
|
19683
19778
|
设置后将直接保存到本地文件,不会返回,save 为本地实体路径
|
|
19684
19779
|
|
|
@@ -19698,7 +19793,7 @@ Defined in: [lib/undici/request.ts:105](https://github.com/maiyunnet/kebab/blob/
|
|
|
19698
19793
|
|
|
19699
19794
|
> **setHeader**(`name`, `val`): `this`
|
|
19700
19795
|
|
|
19701
|
-
Defined in: [lib/undici/request.ts:
|
|
19796
|
+
Defined in: [lib/undici/request.ts:142](https://github.com/maiyunnet/kebab/blob/master/lib/undici/request.ts#L142)
|
|
19702
19797
|
|
|
19703
19798
|
设置单条 header
|
|
19704
19799
|
|
|
@@ -19842,7 +19937,7 @@ Defined in: [lib/undici/response.ts:33](https://github.com/maiyunnet/kebab/blob/
|
|
|
19842
19937
|
|
|
19843
19938
|
> **getJson**(): `Promise`\<`any`\>
|
|
19844
19939
|
|
|
19845
|
-
Defined in: [lib/undici/response.ts:
|
|
19940
|
+
Defined in: [lib/undici/response.ts:67](https://github.com/maiyunnet/kebab/blob/master/lib/undici/response.ts#L67)
|
|
19846
19941
|
|
|
19847
19942
|
读取所有内容为 JSON,失败返回 null
|
|
19848
19943
|
|
|
@@ -19856,7 +19951,7 @@ Defined in: [lib/undici/response.ts:66](https://github.com/maiyunnet/kebab/blob/
|
|
|
19856
19951
|
|
|
19857
19952
|
> **getRawStream**(): `BodyReadable` & `BodyMixin` \| `null`
|
|
19858
19953
|
|
|
19859
|
-
Defined in: [lib/undici/response.ts:
|
|
19954
|
+
Defined in: [lib/undici/response.ts:127](https://github.com/maiyunnet/kebab/blob/master/lib/undici/response.ts#L127)
|
|
19860
19955
|
|
|
19861
19956
|
获取原生响应读取流对象
|
|
19862
19957
|
|
|
@@ -19870,7 +19965,7 @@ Defined in: [lib/undici/response.ts:126](https://github.com/maiyunnet/kebab/blob
|
|
|
19870
19965
|
|
|
19871
19966
|
> **getStream**(): `BrotliDecompress` \| `Gunzip` \| `Inflate` \| `BodyReadable` & `BodyMixin` \| `null`
|
|
19872
19967
|
|
|
19873
|
-
Defined in: [lib/undici/response.ts:
|
|
19968
|
+
Defined in: [lib/undici/response.ts:92](https://github.com/maiyunnet/kebab/blob/master/lib/undici/response.ts#L92)
|
|
19874
19969
|
|
|
19875
19970
|
获取响应读取流对象
|
|
19876
19971
|
|
|
@@ -19884,7 +19979,7 @@ Defined in: [lib/undici/response.ts:91](https://github.com/maiyunnet/kebab/blob/
|
|
|
19884
19979
|
|
|
19885
19980
|
> **getText**(): `Promise`\<`string` \| `null`\>
|
|
19886
19981
|
|
|
19887
|
-
Defined in: [lib/undici/response.ts:
|
|
19982
|
+
Defined in: [lib/undici/response.ts:52](https://github.com/maiyunnet/kebab/blob/master/lib/undici/response.ts#L52)
|
|
19888
19983
|
|
|
19889
19984
|
读取所有内容为文本
|
|
19890
19985
|
|
|
@@ -19898,7 +19993,7 @@ Defined in: [lib/undici/response.ts:51](https://github.com/maiyunnet/kebab/blob/
|
|
|
19898
19993
|
|
|
19899
19994
|
> **setContent**(`v`): `void`
|
|
19900
19995
|
|
|
19901
|
-
Defined in: [lib/undici/response.ts:
|
|
19996
|
+
Defined in: [lib/undici/response.ts:85](https://github.com/maiyunnet/kebab/blob/master/lib/undici/response.ts#L85)
|
|
19902
19997
|
|
|
19903
19998
|
用户自定义的 content 内容
|
|
19904
19999
|
|
|
@@ -19942,7 +20037,7 @@ lib/undici/type-aliases/THttpHeaders.md
|
|
|
19942
20037
|
|
|
19943
20038
|
> **THttpHeaders** = `http.IncomingHttpHeaders` & `object`
|
|
19944
20039
|
|
|
19945
|
-
Defined in: [lib/undici.ts:
|
|
20040
|
+
Defined in: [lib/undici.ts:932](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L932)
|
|
19946
20041
|
|
|
19947
20042
|
http headers
|
|
19948
20043
|
|