@maiyunnet/kebab 9.3.3 → 9.3.5

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 CHANGED
@@ -1360,7 +1360,7 @@ index/variables/VER.md
1360
1360
 
1361
1361
  # Variable: VER
1362
1362
 
1363
- > `const` **VER**: `"9.3.3"` = `'9.3.3'`
1363
+ > `const` **VER**: `"9.3.5"` = `'9.3.5'`
1364
1364
 
1365
1365
  Defined in: [index.ts:10](https://github.com/maiyunnet/kebab/blob/master/index.ts#L10)
1366
1366
 
@@ -3258,7 +3258,7 @@ lib/core/functions/clone.md
3258
3258
 
3259
3259
  > **clone**\<`T`\>(`obj`): `T`
3260
3260
 
3261
- Defined in: [lib/core.ts:1006](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1006)
3261
+ Defined in: [lib/core.ts:1048](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1048)
3262
3262
 
3263
3263
  完整的克隆一份数组/对象
3264
3264
 
@@ -3322,7 +3322,7 @@ lib/core/functions/debug.md
3322
3322
 
3323
3323
  > **debug**(`message?`, ...`optionalParams`): `void`
3324
3324
 
3325
- Defined in: [lib/core.ts:1040](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1040)
3325
+ Defined in: [lib/core.ts:1082](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1082)
3326
3326
 
3327
3327
  打印调试信息,线上环境不会打印
3328
3328
 
@@ -3357,7 +3357,7 @@ lib/core/functions/display.md
3357
3357
 
3358
3358
  > **display**(`message?`, ...`optionalParams`): `void`
3359
3359
 
3360
- Defined in: [lib/core.ts:1053](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1053)
3360
+ Defined in: [lib/core.ts:1095](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1095)
3361
3361
 
3362
3362
  向控制台直接显示内容,一般情况下禁止使用
3363
3363
 
@@ -3462,7 +3462,7 @@ lib/core/functions/getLog.md
3462
3462
 
3463
3463
  > **getLog**(`opt`): `Promise`\<`false` \| `string`[][] \| `null`\>
3464
3464
 
3465
- Defined in: [lib/core.ts:913](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L913)
3465
+ Defined in: [lib/core.ts:955](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L955)
3466
3466
 
3467
3467
  获取日志内容为一个数组
3468
3468
 
@@ -3568,7 +3568,7 @@ lib/core/functions/loadEnv.md
3568
3568
 
3569
3569
  > **loadEnv**(`dir`): `Promise`\<`void`\>
3570
3570
 
3571
- Defined in: [lib/core.ts:1105](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1105)
3571
+ Defined in: [lib/core.ts:1147](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1147)
3572
3572
 
3573
3573
  加载 .env 文件到 process.env,若文件不存在则跳过
3574
3574
 
@@ -3597,7 +3597,7 @@ lib/core/functions/log.md
3597
3597
 
3598
3598
  > **log**(`opt`, `msg`, `fend?`): `void`
3599
3599
 
3600
- Defined in: [lib/core.ts:807](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L807)
3600
+ Defined in: [lib/core.ts:849](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L849)
3601
3601
 
3602
3602
  写入文件日志
3603
3603
 
@@ -3638,7 +3638,7 @@ lib/core/functions/ls.md
3638
3638
 
3639
3639
  > **ls**(`opt`): `Promise`\<`object`[]\>
3640
3640
 
3641
- Defined in: [lib/core.ts:967](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L967)
3641
+ Defined in: [lib/core.ts:1009](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1009)
3642
3642
 
3643
3643
  获取目录内文件/文件夹列表
3644
3644
 
@@ -3999,7 +3999,7 @@ lib/core/functions/resolveEnvVars.md
3999
3999
 
4000
4000
  > **resolveEnvVars**(`obj`): `void`
4001
4001
 
4002
- Defined in: [lib/core.ts:1135](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1135)
4002
+ Defined in: [lib/core.ts:1177](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1177)
4003
4003
 
4004
4004
  将配置对象中的 ${ENV_VAR} 占位符替换为 process.env 的值
4005
4005
 
@@ -4091,6 +4091,53 @@ PM2 操作类型
4091
4091
 
4092
4092
  `Promise`\<`string`[]\>
4093
4093
 
4094
+ lib/core/functions/sendProject.md
4095
+ ---
4096
+
4097
+ [**Documents for @maiyunnet/kebab**](../../../index.md)
4098
+
4099
+ ***
4100
+
4101
+ [Documents for @maiyunnet/kebab](../../../index.md) / [lib/core](../index.md) / sendProject
4102
+
4103
+ # Function: sendProject()
4104
+
4105
+ > **sendProject**(`path`, `key`, `value`, `hosts?`): `Promise`\<`string`[]\>
4106
+
4107
+ Defined in: [lib/core.ts:796](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L796)
4108
+
4109
+ 向本机或局域网 RPC 发送项目配置更新操作
4110
+
4111
+ ## Parameters
4112
+
4113
+ ### path
4114
+
4115
+ `string`
4116
+
4117
+ 项目路径,相对 Kebab 根
4118
+
4119
+ ### key
4120
+
4121
+ `string`
4122
+
4123
+ 要更新的键名(目前仅支持 staticVer)
4124
+
4125
+ ### value
4126
+
4127
+ `string`
4128
+
4129
+ 要更新的值
4130
+
4131
+ ### hosts?
4132
+
4133
+ `string`[] \| `"config"`
4134
+
4135
+ 局域网列表
4136
+
4137
+ ## Returns
4138
+
4139
+ `Promise`\<`string`[]\>
4140
+
4094
4141
  lib/core/functions/sendReload.md
4095
4142
  ---
4096
4143
 
@@ -4359,7 +4406,7 @@ lib/core/functions/writeEventStreamHead.md
4359
4406
 
4360
4407
  > **writeEventStreamHead**(`res`): `void`
4361
4408
 
4362
- Defined in: [lib/core.ts:1075](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1075)
4409
+ Defined in: [lib/core.ts:1117](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1117)
4363
4410
 
4364
4411
  ## Parameters
4365
4412
 
@@ -4384,7 +4431,7 @@ lib/core/functions/writeHead.md
4384
4431
 
4385
4432
  > **writeHead**(`res`, `statusCode`, `headers?`): `void`
4386
4433
 
4387
- Defined in: [lib/core.ts:1064](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1064)
4434
+ Defined in: [lib/core.ts:1106](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1106)
4388
4435
 
4389
4436
  让 res 发送头部(前提是头部没有被发送才能调用本方法
4390
4437
 
@@ -4425,7 +4472,7 @@ lib/core/functions/write.md
4425
4472
 
4426
4473
  > **write**(`res`, `data`): `void`
4427
4474
 
4428
- Defined in: [lib/core.ts:1087](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1087)
4475
+ Defined in: [lib/core.ts:1129](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1129)
4429
4476
 
4430
4477
  向 res 发送数据
4431
4478
 
@@ -4509,6 +4556,7 @@ lib/core/index.md
4509
4556
  - [resolveEnvVars](functions/resolveEnvVars.md)
4510
4557
  - [sendNpm](functions/sendNpm.md)
4511
4558
  - [sendPm2](functions/sendPm2.md)
4559
+ - [sendProject](functions/sendProject.md)
4512
4560
  - [sendReload](functions/sendReload.md)
4513
4561
  - [sendRestart](functions/sendRestart.md)
4514
4562
  - [setCookie](functions/setCookie.md)
@@ -4594,7 +4642,7 @@ lib/core/interfaces/ILogOptions.md
4594
4642
 
4595
4643
  # Interface: ILogOptions
4596
4644
 
4597
- Defined in: [lib/core.ts:790](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L790)
4645
+ Defined in: [lib/core.ts:832](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L832)
4598
4646
 
4599
4647
  log 设置的选项
4600
4648
 
@@ -4604,7 +4652,7 @@ log 设置的选项
4604
4652
 
4605
4653
  > `optional` **cookie?**: `Record`\<`string`, `string`\>
4606
4654
 
4607
- Defined in: [lib/core.ts:796](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L796)
4655
+ Defined in: [lib/core.ts:838](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L838)
4608
4656
 
4609
4657
  ***
4610
4658
 
@@ -4612,7 +4660,7 @@ Defined in: [lib/core.ts:796](https://github.com/maiyunnet/kebab/blob/master/lib
4612
4660
 
4613
4661
  > `optional` **get?**: `Record`\<`string`, `any`\>
4614
4662
 
4615
- Defined in: [lib/core.ts:795](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L795)
4663
+ Defined in: [lib/core.ts:837](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L837)
4616
4664
 
4617
4665
  ***
4618
4666
 
@@ -4620,7 +4668,7 @@ Defined in: [lib/core.ts:795](https://github.com/maiyunnet/kebab/blob/master/lib
4620
4668
 
4621
4669
  > `optional` **headers?**: `IncomingHttpHeaders`
4622
4670
 
4623
- Defined in: [lib/core.ts:798](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L798)
4671
+ Defined in: [lib/core.ts:840](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L840)
4624
4672
 
4625
4673
  ***
4626
4674
 
@@ -4628,7 +4676,7 @@ Defined in: [lib/core.ts:798](https://github.com/maiyunnet/kebab/blob/master/lib
4628
4676
 
4629
4677
  > `optional` **hostname?**: `string`
4630
4678
 
4631
- Defined in: [lib/core.ts:793](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L793)
4679
+ Defined in: [lib/core.ts:835](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L835)
4632
4680
 
4633
4681
  ***
4634
4682
 
@@ -4636,7 +4684,7 @@ Defined in: [lib/core.ts:793](https://github.com/maiyunnet/kebab/blob/master/lib
4636
4684
 
4637
4685
  > `optional` **path?**: `string`
4638
4686
 
4639
- Defined in: [lib/core.ts:791](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L791)
4687
+ Defined in: [lib/core.ts:833](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L833)
4640
4688
 
4641
4689
  ***
4642
4690
 
@@ -4644,7 +4692,7 @@ Defined in: [lib/core.ts:791](https://github.com/maiyunnet/kebab/blob/master/lib
4644
4692
 
4645
4693
  > `optional` **req?**: `IncomingMessage` \| `Http2ServerRequest` \| `null`
4646
4694
 
4647
- Defined in: [lib/core.ts:794](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L794)
4695
+ Defined in: [lib/core.ts:836](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L836)
4648
4696
 
4649
4697
  ***
4650
4698
 
@@ -4652,7 +4700,7 @@ Defined in: [lib/core.ts:794](https://github.com/maiyunnet/kebab/blob/master/lib
4652
4700
 
4653
4701
  > `optional` **session?**: `Record`\<`string`, `any`\>
4654
4702
 
4655
- Defined in: [lib/core.ts:797](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L797)
4703
+ Defined in: [lib/core.ts:839](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L839)
4656
4704
 
4657
4705
  ***
4658
4706
 
@@ -4660,7 +4708,7 @@ Defined in: [lib/core.ts:797](https://github.com/maiyunnet/kebab/blob/master/lib
4660
4708
 
4661
4709
  > `optional` **urlFull?**: `string`
4662
4710
 
4663
- Defined in: [lib/core.ts:792](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L792)
4711
+ Defined in: [lib/core.ts:834](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L834)
4664
4712
 
4665
4713
  lib/core/type-aliases/TPm2Action.md
4666
4714
  ---
@@ -15745,7 +15793,7 @@ lib/text/functions/getFileExt.md
15745
15793
 
15746
15794
  > **getFileExt**(`path`): `string`
15747
15795
 
15748
- Defined in: [lib/text.ts:527](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L527)
15796
+ Defined in: [lib/text.ts:533](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L533)
15749
15797
 
15750
15798
  获取文件后缀
15751
15799
 
@@ -15774,7 +15822,7 @@ lib/text/functions/getFileNameExt.md
15774
15822
 
15775
15823
  > **getFileNameExt**(`path`): `object`
15776
15824
 
15777
- Defined in: [lib/text.ts:540](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L540)
15825
+ Defined in: [lib/text.ts:546](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L546)
15778
15826
 
15779
15827
  获取文件名和后缀
15780
15828
 
@@ -15811,7 +15859,7 @@ lib/text/functions/getFilename.md
15811
15859
 
15812
15860
  > **getFilename**(`path`, `ext?`): `string`
15813
15861
 
15814
- Defined in: [lib/text.ts:507](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L507)
15862
+ Defined in: [lib/text.ts:513](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L513)
15815
15863
 
15816
15864
  获取文件名
15817
15865
 
@@ -15846,7 +15894,7 @@ lib/text/functions/htmlescape.md
15846
15894
 
15847
15895
  > **htmlescape**(`html`): `string`
15848
15896
 
15849
- Defined in: [lib/text.ts:482](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L482)
15897
+ Defined in: [lib/text.ts:488](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L488)
15850
15898
 
15851
15899
  HTML 特殊字符转换为实体字符
15852
15900
 
@@ -15875,7 +15923,7 @@ lib/text/functions/int2str.md
15875
15923
 
15876
15924
  > **int2str**(`int`, `digits?`, `decimal?`): `string`
15877
15925
 
15878
- Defined in: [lib/text.ts:740](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L740)
15926
+ Defined in: [lib/text.ts:746](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L746)
15879
15927
 
15880
15928
  为解决精度问题,将整数转换为小数字符串
15881
15929
  以下几个示例都是当 digits 为 3、decimal 为 2 时
@@ -16008,7 +16056,7 @@ lib/text/functions/isFalsy.md
16008
16056
 
16009
16057
  > **isFalsy**(`val`): `val is TFalsy`
16010
16058
 
16011
- Defined in: [lib/text.ts:691](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L691)
16059
+ Defined in: [lib/text.ts:697](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L697)
16012
16060
 
16013
16061
  判断一个值是否是虚假的(为 null/undefined/空字符串/false/0)
16014
16062
 
@@ -16149,7 +16197,7 @@ lib/text/functions/isRealPath.md
16149
16197
 
16150
16198
  > **isRealPath**(`path`): `boolean`
16151
16199
 
16152
- Defined in: [lib/text.ts:494](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L494)
16200
+ Defined in: [lib/text.ts:500](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L500)
16153
16201
 
16154
16202
  判断是否是绝对路径,是返回 true,相对路径返回 false
16155
16203
 
@@ -16178,7 +16226,7 @@ lib/text/functions/isTruthy.md
16178
16226
 
16179
16227
  > **isTruthy**\<`T`\>(`val`): `val is Exclude<T, TFalsy>`
16180
16228
 
16181
- Defined in: [lib/text.ts:699](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L699)
16229
+ Defined in: [lib/text.ts:705](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L705)
16182
16230
 
16183
16231
  判断一个值是否是真实的(不为 null/undefined/空字符串/false/0)
16184
16232
 
@@ -16213,7 +16261,7 @@ lib/text/functions/logicalOr.md
16213
16261
 
16214
16262
  > **logicalOr**\<`T`, `T2`\>(`v1`, `v2`): `T` *extends* [`TFalsy`](../type-aliases/TFalsy.md) ? `T2` : `T`
16215
16263
 
16216
- Defined in: [lib/text.ts:708](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L708)
16264
+ Defined in: [lib/text.ts:714](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L714)
16217
16265
 
16218
16266
  类似 || 运算符的效果
16219
16267
 
@@ -16398,7 +16446,7 @@ lib/text/functions/parseJson.md
16398
16446
 
16399
16447
  > **parseJson**\<`T`\>(`str`): `false` \| `T`
16400
16448
 
16401
- Defined in: [lib/text.ts:602](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L602)
16449
+ Defined in: [lib/text.ts:608](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L608)
16402
16450
 
16403
16451
  将字符串解析为对象,返回 false 代表解析失败,支持 BigInt
16404
16452
 
@@ -16597,7 +16645,7 @@ lib/text/functions/str2int.md
16597
16645
 
16598
16646
  > **str2int**(`str`, `digits?`): `number`
16599
16647
 
16600
- Defined in: [lib/text.ts:722](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L722)
16648
+ Defined in: [lib/text.ts:728](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L728)
16601
16649
 
16602
16650
  为解决精度问题,将字符串数字转换为整数显示
16603
16651
  以下几个示例都是当 digits 为 2 时
@@ -16637,7 +16685,7 @@ lib/text/functions/stringifyBuffer.md
16637
16685
 
16638
16686
  > **stringifyBuffer**(`buf`): `string`
16639
16687
 
16640
- Defined in: [lib/text.ts:645](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L645)
16688
+ Defined in: [lib/text.ts:651](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L651)
16641
16689
 
16642
16690
  输出文本格式的 buffer
16643
16691
 
@@ -16666,7 +16714,7 @@ lib/text/functions/stringifyJson.md
16666
16714
 
16667
16715
  > **stringifyJson**(`obj`, `space?`): `string`
16668
16716
 
16669
- Defined in: [lib/text.ts:632](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L632)
16717
+ Defined in: [lib/text.ts:638](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L638)
16670
16718
 
16671
16719
  将对象转换为 json 字符串,返回 false 代表解析失败,支持 BigInt
16672
16720
 
@@ -16701,7 +16749,7 @@ lib/text/functions/stringifyResult.md
16701
16749
 
16702
16750
  > **stringifyResult**(`rtn`): `string`
16703
16751
 
16704
- Defined in: [lib/text.ts:562](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L562)
16752
+ Defined in: [lib/text.ts:568](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L568)
16705
16753
 
16706
16754
  将普通的返回 JSON 对象序列化为字符串
16707
16755
 
@@ -16730,7 +16778,7 @@ lib/text/functions/trimJson.md
16730
16778
 
16731
16779
  > **trimJson**(`json`): `any`
16732
16780
 
16733
- Defined in: [lib/text.ts:653](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L653)
16781
+ Defined in: [lib/text.ts:659](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L659)
16734
16782
 
16735
16783
  递归删除 json 中的字符串首尾空格,会返回一个新的对象
16736
16784
 
@@ -16930,7 +16978,7 @@ lib/text/type-aliases/TFalsy.md
16930
16978
 
16931
16979
  > **TFalsy** = `false` \| `""` \| `0` \| `null` \| `undefined` \| *typeof* `NaN`
16932
16980
 
16933
- Defined in: [lib/text.ts:685](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L685)
16981
+ Defined in: [lib/text.ts:691](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L691)
16934
16982
 
16935
16983
  虚假值类型
16936
16984
 
@@ -17807,7 +17855,7 @@ lib/undici/functions/fetch.md
17807
17855
 
17808
17856
  > **fetch**(`input`, `init?`): `Promise`\<`Response`\>
17809
17857
 
17810
- Defined in: [lib/undici.ts:175](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L175)
17858
+ Defined in: [lib/undici.ts:174](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L174)
17811
17859
 
17812
17860
  发起一个完全兼容 fetch 的请求
17813
17861
 
@@ -17842,7 +17890,7 @@ lib/undici/functions/filterHeaders.md
17842
17890
 
17843
17891
  > **filterHeaders**(`headers`, `res?`, `filter?`): `Record`\<`string`, `string` \| `string`[]\>
17844
17892
 
17845
- Defined in: [lib/undici.ts:530](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L530)
17893
+ Defined in: [lib/undici.ts:529](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L529)
17846
17894
 
17847
17895
  剔除不代理的 header,返回新的 header
17848
17896
 
@@ -17883,7 +17931,7 @@ lib/undici/functions/getFormData.md
17883
17931
 
17884
17932
  > **getFormData**(): [`FormData`](../formdata/classes/FormData.md)
17885
17933
 
17886
- Defined in: [lib/undici.ts:514](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L514)
17934
+ Defined in: [lib/undici.ts:513](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L513)
17887
17935
 
17888
17936
  创建 FormData 对象
17889
17937
 
@@ -17966,7 +18014,7 @@ lib/undici/functions/getResponseJson.md
17966
18014
 
17967
18015
  > **getResponseJson**(`u`, `opt?`): `Promise`\<`any`\>
17968
18016
 
17969
- Defined in: [lib/undici.ts:154](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L154)
18017
+ Defined in: [lib/undici.ts:153](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L153)
17970
18018
 
17971
18019
  发起 GET 请求并解析 JSON 响应
17972
18020
 
@@ -18003,7 +18051,7 @@ lib/undici/functions/mproxyData.md
18003
18051
 
18004
18052
  > **mproxyData**(`ctr`): `any`
18005
18053
 
18006
- Defined in: [lib/undici.ts:619](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L619)
18054
+ Defined in: [lib/undici.ts:618](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L618)
18007
18055
 
18008
18056
  获取 mproxy 的附加数据
18009
18057
 
@@ -18032,7 +18080,7 @@ lib/undici/functions/mproxy.md
18032
18080
 
18033
18081
  > **mproxy**(`ctr`, `auth`, `opt?`): `Promise`\<`number`\>
18034
18082
 
18035
- Defined in: [lib/undici.ts:566](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L566)
18083
+ Defined in: [lib/undici.ts:565](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L565)
18036
18084
 
18037
18085
  正向 mproxy 代理,注意提前处理不要自动处理 post 数据,读取 get 的 url 为实际请求地址
18038
18086
  get: url, auth
@@ -18142,9 +18190,9 @@ lib/undici/functions/postJsonResponseJson.md
18142
18190
 
18143
18191
  > **postJsonResponseJson**(`u`, `data`, `opt?`): `Promise`\<`any`\>
18144
18192
 
18145
- Defined in: [lib/undici.ts:131](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L131)
18193
+ Defined in: [lib/undici.ts:130](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L130)
18146
18194
 
18147
- 发起 JSON 请求并解析 JSON 响应
18195
+ 发起 JSON 请求并解析 JSON 响应,失败时返回 null
18148
18196
 
18149
18197
  ## Parameters
18150
18198
 
@@ -18170,8 +18218,6 @@ Defined in: [lib/undici.ts:131](https://github.com/maiyunnet/kebab/blob/master/l
18170
18218
 
18171
18219
  `Promise`\<`any`\>
18172
18220
 
18173
- JSON 数据,失败时返回 null
18174
-
18175
18221
  lib/undici/functions/post.md
18176
18222
  ---
18177
18223
 
@@ -18226,7 +18272,7 @@ lib/undici/functions/request.md
18226
18272
 
18227
18273
  > **request**(`u`, `data?`, `opt?`): `Promise`\<[`Response`](../response/classes/Response.md)\>
18228
18274
 
18229
- Defined in: [lib/undici.ts:344](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L344)
18275
+ Defined in: [lib/undici.ts:343](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L343)
18230
18276
 
18231
18277
  发起一个请求
18232
18278
 
@@ -18263,7 +18309,7 @@ lib/undici/functions/rproxy.md
18263
18309
 
18264
18310
  > **rproxy**(`ctr`, `route`, `opt?`): `Promise`\<`boolean`\>
18265
18311
 
18266
- Defined in: [lib/undici.ts:637](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L637)
18312
+ Defined in: [lib/undici.ts:636](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L636)
18267
18313
 
18268
18314
  反向代理,注意提前处理不要自动处理 post 数据,将本服务器的某个路由反代到其他网址
18269
18315
 
@@ -18340,7 +18386,7 @@ lib/undici/interfaces/IMproxyOptions.md
18340
18386
 
18341
18387
  # Interface: IMproxyOptions
18342
18388
 
18343
- Defined in: [lib/undici.ts:721](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L721)
18389
+ Defined in: [lib/undici.ts:720](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L720)
18344
18390
 
18345
18391
  正向代理请求的传入参数选项
18346
18392
 
@@ -18350,7 +18396,7 @@ Defined in: [lib/undici.ts:721](https://github.com/maiyunnet/kebab/blob/master/l
18350
18396
 
18351
18397
  > `optional` **filter?**: (`h`) => `boolean`
18352
18398
 
18353
- Defined in: [lib/undici.ts:730](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L730)
18399
+ Defined in: [lib/undici.ts:729](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L729)
18354
18400
 
18355
18401
  过滤 header,返回 true 则留下
18356
18402
 
@@ -18370,7 +18416,7 @@ Defined in: [lib/undici.ts:730](https://github.com/maiyunnet/kebab/blob/master/l
18370
18416
 
18371
18417
  > `optional` **follow?**: `number`
18372
18418
 
18373
- Defined in: [lib/undici.ts:724](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L724)
18419
+ Defined in: [lib/undici.ts:723](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L723)
18374
18420
 
18375
18421
  ***
18376
18422
 
@@ -18378,7 +18424,7 @@ Defined in: [lib/undici.ts:724](https://github.com/maiyunnet/kebab/blob/master/l
18378
18424
 
18379
18425
  > `optional` **headers?**: [`THttpHeaders`](../type-aliases/THttpHeaders.md)
18380
18426
 
18381
- Defined in: [lib/undici.ts:728](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L728)
18427
+ Defined in: [lib/undici.ts:727](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L727)
18382
18428
 
18383
18429
  ***
18384
18430
 
@@ -18386,7 +18432,7 @@ Defined in: [lib/undici.ts:728](https://github.com/maiyunnet/kebab/blob/master/l
18386
18432
 
18387
18433
  > `optional` **hosts?**: `string` \| `Record`\<`string`, `string`\>
18388
18434
 
18389
- Defined in: [lib/undici.ts:726](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L726)
18435
+ Defined in: [lib/undici.ts:725](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L725)
18390
18436
 
18391
18437
  自定义 host 映射,如 {'www.maiyun.net': '127.0.0.1'},或全部映射到一个 host
18392
18438
 
@@ -18396,7 +18442,7 @@ Defined in: [lib/undici.ts:726](https://github.com/maiyunnet/kebab/blob/master/l
18396
18442
 
18397
18443
  > `optional` **local?**: `string`
18398
18444
 
18399
- Defined in: [lib/undici.ts:727](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L727)
18445
+ Defined in: [lib/undici.ts:726](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L726)
18400
18446
 
18401
18447
  ***
18402
18448
 
@@ -18404,7 +18450,7 @@ Defined in: [lib/undici.ts:727](https://github.com/maiyunnet/kebab/blob/master/l
18404
18450
 
18405
18451
  > `optional` **reuse?**: `string` \| `Agent` \| `ProxyAgent`
18406
18452
 
18407
- Defined in: [lib/undici.ts:732](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L732)
18453
+ Defined in: [lib/undici.ts:731](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L731)
18408
18454
 
18409
18455
  默认为 default
18410
18456
 
@@ -18414,7 +18460,7 @@ Defined in: [lib/undici.ts:732](https://github.com/maiyunnet/kebab/blob/master/l
18414
18460
 
18415
18461
  > `optional` **timeout?**: `number`
18416
18462
 
18417
- Defined in: [lib/undici.ts:723](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L723)
18463
+ Defined in: [lib/undici.ts:722](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L722)
18418
18464
 
18419
18465
  秒数
18420
18466
 
@@ -18429,7 +18475,7 @@ lib/undici/interfaces/IRequestOptions.md
18429
18475
 
18430
18476
  # Interface: IRequestOptions
18431
18477
 
18432
- Defined in: [lib/undici.ts:690](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L690)
18478
+ Defined in: [lib/undici.ts:689](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L689)
18433
18479
 
18434
18480
  请求的传入参数选项
18435
18481
 
@@ -18439,7 +18485,7 @@ Defined in: [lib/undici.ts:690](https://github.com/maiyunnet/kebab/blob/master/l
18439
18485
 
18440
18486
  > `optional` **cookie?**: `Record`\<`string`, [`ICookie`](../../cookie/interfaces/ICookie.md)\>
18441
18487
 
18442
- Defined in: [lib/undici.ts:715](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L715)
18488
+ Defined in: [lib/undici.ts:714](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L714)
18443
18489
 
18444
18490
  cookie 托管对象
18445
18491
 
@@ -18449,7 +18495,7 @@ cookie 托管对象
18449
18495
 
18450
18496
  > `optional` **follow?**: `number`
18451
18497
 
18452
- Defined in: [lib/undici.ts:696](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L696)
18498
+ Defined in: [lib/undici.ts:695](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L695)
18453
18499
 
18454
18500
  追踪 location 次数,0 为不追踪,默认为 0
18455
18501
 
@@ -18459,7 +18505,7 @@ Defined in: [lib/undici.ts:696](https://github.com/maiyunnet/kebab/blob/master/l
18459
18505
 
18460
18506
  > `optional` **headers?**: [`THttpHeaders`](../type-aliases/THttpHeaders.md)
18461
18507
 
18462
- Defined in: [lib/undici.ts:701](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L701)
18508
+ Defined in: [lib/undici.ts:700](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L700)
18463
18509
 
18464
18510
  ***
18465
18511
 
@@ -18467,7 +18513,7 @@ Defined in: [lib/undici.ts:701](https://github.com/maiyunnet/kebab/blob/master/l
18467
18513
 
18468
18514
  > `optional` **hosts?**: `string` \| `Record`\<`string`, `string`\>
18469
18515
 
18470
- Defined in: [lib/undici.ts:698](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L698)
18516
+ Defined in: [lib/undici.ts:697](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L697)
18471
18517
 
18472
18518
  自定义 host 映射,如 {'www.maiyun.net': '127.0.0.1'},或全部映射到一个 host
18473
18519
 
@@ -18477,7 +18523,7 @@ Defined in: [lib/undici.ts:698](https://github.com/maiyunnet/kebab/blob/master/l
18477
18523
 
18478
18524
  > `optional` **keep?**: `boolean`
18479
18525
 
18480
- Defined in: [lib/undici.ts:711](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L711)
18526
+ Defined in: [lib/undici.ts:710](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L710)
18481
18527
 
18482
18528
  连接是否保持长连接(即是否允许复用),默认为 true
18483
18529
 
@@ -18487,7 +18533,7 @@ Defined in: [lib/undici.ts:711](https://github.com/maiyunnet/kebab/blob/master/l
18487
18533
 
18488
18534
  > `optional` **local?**: `string`
18489
18535
 
18490
- Defined in: [lib/undici.ts:700](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L700)
18536
+ Defined in: [lib/undici.ts:699](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L699)
18491
18537
 
18492
18538
  ***
18493
18539
 
@@ -18495,7 +18541,7 @@ Defined in: [lib/undici.ts:700](https://github.com/maiyunnet/kebab/blob/master/l
18495
18541
 
18496
18542
  > `optional` **log?**: `boolean`
18497
18543
 
18498
- Defined in: [lib/undici.ts:717](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L717)
18544
+ Defined in: [lib/undici.ts:716](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L716)
18499
18545
 
18500
18546
  若有异常写入文件日志,默认为 true
18501
18547
 
@@ -18505,7 +18551,7 @@ Defined in: [lib/undici.ts:717](https://github.com/maiyunnet/kebab/blob/master/l
18505
18551
 
18506
18552
  > `optional` **method?**: `"GET"` \| `"POST"` \| `"PUT"` \| `"DELETE"` \| `"OPTIONS"`
18507
18553
 
18508
- Defined in: [lib/undici.ts:691](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L691)
18554
+ Defined in: [lib/undici.ts:690](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L690)
18509
18555
 
18510
18556
  ***
18511
18557
 
@@ -18513,7 +18559,7 @@ Defined in: [lib/undici.ts:691](https://github.com/maiyunnet/kebab/blob/master/l
18513
18559
 
18514
18560
  > `optional` **mproxy?**: `object`
18515
18561
 
18516
- Defined in: [lib/undici.ts:703](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L703)
18562
+ Defined in: [lib/undici.ts:702](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L702)
18517
18563
 
18518
18564
  正向 mproxy 代理,url 如 https://xxx/abc
18519
18565
 
@@ -18541,7 +18587,7 @@ Defined in: [lib/undici.ts:703](https://github.com/maiyunnet/kebab/blob/master/l
18541
18587
 
18542
18588
  > `optional` **reuse?**: `string` \| `Agent` \| `ProxyAgent`
18543
18589
 
18544
- Defined in: [lib/undici.ts:713](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L713)
18590
+ Defined in: [lib/undici.ts:712](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L712)
18545
18591
 
18546
18592
  复用池名/Agent,默认为 default
18547
18593
 
@@ -18551,7 +18597,7 @@ Defined in: [lib/undici.ts:713](https://github.com/maiyunnet/kebab/blob/master/l
18551
18597
 
18552
18598
  > `optional` **save?**: `string`
18553
18599
 
18554
- Defined in: [lib/undici.ts:699](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L699)
18600
+ Defined in: [lib/undici.ts:698](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L698)
18555
18601
 
18556
18602
  ***
18557
18603
 
@@ -18559,7 +18605,7 @@ Defined in: [lib/undici.ts:699](https://github.com/maiyunnet/kebab/blob/master/l
18559
18605
 
18560
18606
  > `optional` **timeout?**: `number`
18561
18607
 
18562
- Defined in: [lib/undici.ts:694](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L694)
18608
+ Defined in: [lib/undici.ts:693](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L693)
18563
18609
 
18564
18610
  秒数,默认 10 秒
18565
18611
 
@@ -18569,7 +18615,7 @@ Defined in: [lib/undici.ts:694](https://github.com/maiyunnet/kebab/blob/master/l
18569
18615
 
18570
18616
  > `optional` **type?**: `"form"` \| `"json"`
18571
18617
 
18572
- Defined in: [lib/undici.ts:692](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L692)
18618
+ Defined in: [lib/undici.ts:691](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L691)
18573
18619
 
18574
18620
  lib/undici/interfaces/IRproxyOptions.md
18575
18621
  ---
@@ -18582,7 +18628,7 @@ lib/undici/interfaces/IRproxyOptions.md
18582
18628
 
18583
18629
  # Interface: IRproxyOptions
18584
18630
 
18585
- Defined in: [lib/undici.ts:736](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L736)
18631
+ Defined in: [lib/undici.ts:735](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L735)
18586
18632
 
18587
18633
  反向代理请求的传入参数选项
18588
18634
 
@@ -18592,7 +18638,7 @@ Defined in: [lib/undici.ts:736](https://github.com/maiyunnet/kebab/blob/master/l
18592
18638
 
18593
18639
  > `optional` **filter?**: (`h`) => `boolean`
18594
18640
 
18595
- Defined in: [lib/undici.ts:745](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L745)
18641
+ Defined in: [lib/undici.ts:744](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L744)
18596
18642
 
18597
18643
  过滤 header,返回 true 则留下
18598
18644
 
@@ -18612,7 +18658,7 @@ Defined in: [lib/undici.ts:745](https://github.com/maiyunnet/kebab/blob/master/l
18612
18658
 
18613
18659
  > `optional` **follow?**: `number`
18614
18660
 
18615
- Defined in: [lib/undici.ts:739](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L739)
18661
+ Defined in: [lib/undici.ts:738](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L738)
18616
18662
 
18617
18663
  ***
18618
18664
 
@@ -18620,7 +18666,7 @@ Defined in: [lib/undici.ts:739](https://github.com/maiyunnet/kebab/blob/master/l
18620
18666
 
18621
18667
  > `optional` **headers?**: [`THttpHeaders`](../type-aliases/THttpHeaders.md)
18622
18668
 
18623
- Defined in: [lib/undici.ts:743](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L743)
18669
+ Defined in: [lib/undici.ts:742](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L742)
18624
18670
 
18625
18671
  ***
18626
18672
 
@@ -18628,7 +18674,7 @@ Defined in: [lib/undici.ts:743](https://github.com/maiyunnet/kebab/blob/master/l
18628
18674
 
18629
18675
  > `optional` **hosts?**: `string` \| `Record`\<`string`, `string`\>
18630
18676
 
18631
- Defined in: [lib/undici.ts:741](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L741)
18677
+ Defined in: [lib/undici.ts:740](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L740)
18632
18678
 
18633
18679
  自定义 host 映射,如 {'www.maiyun.net': '127.0.0.1'},或全部映射到一个 host
18634
18680
 
@@ -18638,7 +18684,7 @@ Defined in: [lib/undici.ts:741](https://github.com/maiyunnet/kebab/blob/master/l
18638
18684
 
18639
18685
  > `optional` **local?**: `string`
18640
18686
 
18641
- Defined in: [lib/undici.ts:742](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L742)
18687
+ Defined in: [lib/undici.ts:741](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L741)
18642
18688
 
18643
18689
  ***
18644
18690
 
@@ -18646,7 +18692,7 @@ Defined in: [lib/undici.ts:742](https://github.com/maiyunnet/kebab/blob/master/l
18646
18692
 
18647
18693
  > `optional` **mproxy?**: `object`
18648
18694
 
18649
- Defined in: [lib/undici.ts:747](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L747)
18695
+ Defined in: [lib/undici.ts:746](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L746)
18650
18696
 
18651
18697
  正向 mproxy 代理,url 如 https://xxx/abc
18652
18698
 
@@ -18674,7 +18720,7 @@ Defined in: [lib/undici.ts:747](https://github.com/maiyunnet/kebab/blob/master/l
18674
18720
 
18675
18721
  > `optional` **reuse?**: `string` \| `Agent` \| `ProxyAgent`
18676
18722
 
18677
- Defined in: [lib/undici.ts:755](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L755)
18723
+ Defined in: [lib/undici.ts:754](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L754)
18678
18724
 
18679
18725
  默认为 default
18680
18726
 
@@ -18684,7 +18730,7 @@ Defined in: [lib/undici.ts:755](https://github.com/maiyunnet/kebab/blob/master/l
18684
18730
 
18685
18731
  > `optional` **timeout?**: `number`
18686
18732
 
18687
- Defined in: [lib/undici.ts:738](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L738)
18733
+ Defined in: [lib/undici.ts:737](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L737)
18688
18734
 
18689
18735
  秒数
18690
18736
 
@@ -19075,7 +19121,7 @@ Defined in: [lib/undici/response.ts:32](https://github.com/maiyunnet/kebab/blob/
19075
19121
 
19076
19122
  Defined in: [lib/undici/response.ts:63](https://github.com/maiyunnet/kebab/blob/master/lib/undici/response.ts#L63)
19077
19123
 
19078
- 读取所有内容为 JSON
19124
+ 读取所有内容为 JSON,失败返回 null
19079
19125
 
19080
19126
  #### Returns
19081
19127
 
@@ -19173,7 +19219,7 @@ lib/undici/type-aliases/THttpHeaders.md
19173
19219
 
19174
19220
  > **THttpHeaders** = `http.IncomingHttpHeaders` & `object`
19175
19221
 
19176
- Defined in: [lib/undici.ts:760](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L760)
19222
+ Defined in: [lib/undici.ts:759](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L759)
19177
19223
 
19178
19224
  http headers
19179
19225
 
@@ -21918,7 +21964,7 @@ Defined in: [sys/ctr.ts:50](https://github.com/maiyunnet/kebab/blob/master/sys/c
21918
21964
 
21919
21965
  Defined in: [sys/ctr.ts:80](https://github.com/maiyunnet/kebab/blob/master/sys/ctr.ts#L80)
21920
21966
 
21921
- 页面浏览器客户端缓存
21967
+ 页面浏览器客户端缓存(单位:秒)
21922
21968
 
21923
21969
  ***
21924
21970
 
package/index.d.ts CHANGED
@@ -5,7 +5,7 @@
5
5
  * --- 本文件用来定义每个目录实体地址的常量 ---
6
6
  */
7
7
  /** --- 当前系统版本号 --- */
8
- export declare const VER = "9.3.3";
8
+ export declare const VER = "9.3.5";
9
9
  /** --- 框架根目录,以 / 结尾 --- */
10
10
  export declare const ROOT_PATH: string;
11
11
  /** --- 框架的 LIB,以 / 结尾 --- */
package/index.js CHANGED
@@ -6,7 +6,7 @@
6
6
  * --- 本文件用来定义每个目录实体地址的常量 ---
7
7
  */
8
8
  /** --- 当前系统版本号 --- */
9
- export const VER = '9.3.3';
9
+ export const VER = '9.3.5';
10
10
  // --- 服务端用的路径 ---
11
11
  const imu = decodeURIComponent(import.meta.url).replace('file://', '').replace(/^\/(\w:)/, '$1');
12
12
  /** --- /xxx/xxx --- */
package/lib/core.d.ts CHANGED
@@ -210,6 +210,14 @@ export declare function updateCode(sourcePath: string, path: string, hosts?: str
210
210
  'result': boolean;
211
211
  'return': string;
212
212
  }>>;
213
+ /**
214
+ * --- 向本机或局域网 RPC 发送项目配置更新操作 ---
215
+ * @param path 项目路径,相对 Kebab 根
216
+ * @param key 要更新的键名(目前仅支持 staticVer)
217
+ * @param value 要更新的值
218
+ * @param hosts 局域网列表
219
+ */
220
+ export declare function sendProject(path: string, key: string, value: string, hosts?: string[] | 'config'): Promise<string[]>;
213
221
  /** --- log 设置的选项 --- */
214
222
  export interface ILogOptions {
215
223
  'path'?: string;
package/lib/core.js CHANGED
@@ -692,6 +692,45 @@ export async function updateCode(sourcePath, path, hosts, config = true, strict
692
692
  }
693
693
  return rtn;
694
694
  }
695
+ /**
696
+ * --- 向本机或局域网 RPC 发送项目配置更新操作 ---
697
+ * @param path 项目路径,相对 Kebab 根
698
+ * @param key 要更新的键名(目前仅支持 staticVer)
699
+ * @param value 要更新的值
700
+ * @param hosts 局域网列表
701
+ */
702
+ export async function sendProject(path, key, value, hosts) {
703
+ if (hosts === 'config') {
704
+ hosts = globalConfig.hosts;
705
+ }
706
+ hosts ??= ['127.0.0.1'];
707
+ // --- 局域网模式 ---
708
+ const time = lTime.stamp();
709
+ /** --- 返回成功的 host --- */
710
+ const rtn = [];
711
+ for (const host of hosts) {
712
+ const res = await lUndici.get('http://' + host + ':' + globalConfig.rpcPort.toString() + '/' + lCrypto.aesEncrypt(lText.stringifyJson({
713
+ 'action': 'project',
714
+ 'time': time,
715
+ 'path': path,
716
+ [key]: value
717
+ }), globalConfig.rpcSecret), {
718
+ 'timeout': 2
719
+ });
720
+ const content = await res.getContent();
721
+ if (!content) {
722
+ continue;
723
+ }
724
+ const str = content.toString();
725
+ if (str === 'Done') {
726
+ rtn.push(host);
727
+ }
728
+ else {
729
+ debug('[CORE][sendProject] rpc server content error:', str);
730
+ }
731
+ }
732
+ return rtn;
733
+ }
695
734
  /**
696
735
  * --- 写入文件日志 ---
697
736
  * @param opt 选项
package/lib/text.js CHANGED
@@ -393,7 +393,13 @@ export function queryParse(query) {
393
393
  continue;
394
394
  }
395
395
  const pos = i.indexOf('=');
396
- const key = decodeURIComponent(pos === -1 ? i : i.slice(0, pos));
396
+ let key;
397
+ try {
398
+ key = decodeURIComponent(pos === -1 ? i : i.slice(0, pos));
399
+ }
400
+ catch {
401
+ key = pos === -1 ? i : i.slice(0, pos);
402
+ }
397
403
  let value = '';
398
404
  try {
399
405
  value = pos === -1 ? '' : decodeURIComponent(i.slice(pos + 1));
@@ -21,7 +21,7 @@ export declare class Response {
21
21
  getContent(): Promise<Buffer | null>;
22
22
  /** --- 读取所有内容为文本 --- */
23
23
  getText(): Promise<string | null>;
24
- /** --- 读取所有内容为 JSON --- */
24
+ /** --- 读取所有内容为 JSON,失败返回 null --- */
25
25
  getJson(): Promise<any>;
26
26
  /**
27
27
  * --- 用户自定义的 content 内容 ---
@@ -43,7 +43,7 @@ export class Response {
43
43
  return null;
44
44
  }
45
45
  }
46
- /** --- 读取所有内容为 JSON --- */
46
+ /** --- 读取所有内容为 JSON,失败返回 null --- */
47
47
  async getJson() {
48
48
  try {
49
49
  const text = await this.getText();
package/lib/undici.d.ts CHANGED
@@ -36,11 +36,10 @@ export declare function post(u: string, data: Record<string, kebab.Json> | Buffe
36
36
  */
37
37
  export declare function postJson(u: string, data: kebab.Json[] | Record<string, kebab.Json>, opt?: IRequestOptions): Promise<lResponse.Response>;
38
38
  /**
39
- * --- 发起 JSON 请求并解析 JSON 响应 ---
39
+ * --- 发起 JSON 请求并解析 JSON 响应,失败时返回 null ---
40
40
  * @param u 网址
41
41
  * @param data 数据
42
42
  * @param opt 选项
43
- * @returns JSON 数据,失败时返回 null
44
43
  */
45
44
  export declare function postJsonResponseJson(u: string, data: kebab.Json[] | Record<string, kebab.Json>, opt?: IRequestOptions): Promise<kebab.Json | null>;
46
45
  /**
package/lib/undici.js CHANGED
@@ -95,11 +95,10 @@ export async function postJson(u, data, opt = {}) {
95
95
  return request(u, data, opt);
96
96
  }
97
97
  /**
98
- * --- 发起 JSON 请求并解析 JSON 响应 ---
98
+ * --- 发起 JSON 请求并解析 JSON 响应,失败时返回 null ---
99
99
  * @param u 网址
100
100
  * @param data 数据
101
101
  * @param opt 选项
102
- * @returns JSON 数据,失败时返回 null
103
102
  */
104
103
  export async function postJsonResponseJson(u, data, opt = {}) {
105
104
  opt.method = 'POST';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@maiyunnet/kebab",
3
- "version": "9.3.3",
3
+ "version": "9.3.5",
4
4
  "description": "Simple, easy-to-use, and fully-featured Node.js framework that is ready-to-use out of the box.",
5
5
  "type": "module",
6
6
  "keywords": [
@@ -22,8 +22,8 @@
22
22
  "#kebab/*": "./*"
23
23
  },
24
24
  "dependencies": {
25
- "@aws-sdk/client-s3": "^3.1034.0",
26
- "@aws-sdk/lib-storage": "^3.1034.0",
25
+ "@aws-sdk/client-s3": "^3.1045.0",
26
+ "@aws-sdk/lib-storage": "^3.1045.0",
27
27
  "@litert/http-client": "^1.1.2",
28
28
  "@litert/mime": "^0.1.3",
29
29
  "@litert/redis": "^3.2.1",
@@ -32,33 +32,33 @@
32
32
  "@radix-ui/react-label": "^2.1.8",
33
33
  "@radix-ui/react-slot": "^1.2.4",
34
34
  "@radix-ui/react-switch": "^1.2.6",
35
- "@tailwindcss/cli": "^4.2.4",
35
+ "@tailwindcss/cli": "^4.3.0",
36
36
  "@types/ssh2": "^1.15.5",
37
- "@zilliz/milvus2-sdk-node": "^2.6.13",
38
- "ajv": "^8.18.0",
37
+ "@zilliz/milvus2-sdk-node": "^3.0.0",
38
+ "ajv": "^8.20.0",
39
39
  "ajv-formats": "^3.0.1",
40
40
  "class-variance-authority": "^0.7.1",
41
41
  "clsx": "^2.1.1",
42
42
  "ejs": "^5.0.2",
43
43
  "esbuild": "^0.28.0",
44
44
  "jszip": "^3.10.1",
45
- "mysql2": "^3.22.2",
45
+ "mysql2": "^3.22.3",
46
46
  "node-cron": "^4.2.1",
47
- "openai": "^6.34.0",
47
+ "openai": "^6.37.0",
48
48
  "pg": "^8.20.0",
49
- "react": "^19.2.5",
50
- "react-dom": "^19.2.5",
51
- "react-router-dom": "^7.14.2",
49
+ "react": "^19.2.6",
50
+ "react-dom": "^19.2.6",
51
+ "react-router-dom": "^7.15.0",
52
52
  "ssh2": "^1.17.0",
53
53
  "svg-captcha": "^1.4.0",
54
54
  "tailwind-merge": "^3.5.0",
55
- "tencentcloud-sdk-nodejs": "^4.1.219",
56
- "undici": "^8.1.0"
55
+ "tencentcloud-sdk-nodejs": "^4.1.227",
56
+ "undici": "^8.2.0"
57
57
  },
58
58
  "devDependencies": {
59
59
  "@litert/eslint-plugin-rules": "^0.3.1",
60
60
  "@types/ejs": "^3.1.5",
61
- "@types/node": "^25.6.0",
61
+ "@types/node": "^25.6.2",
62
62
  "@types/pg": "^8.20.0",
63
63
  "@types/react": "^19.2.14",
64
64
  "@types/react-dom": "^19.2.3",
package/sys/ctr.d.ts CHANGED
@@ -32,7 +32,7 @@ export declare class Ctr {
32
32
  protected _session: Record<string, any>;
33
33
  /** --- Session --- 对象 */
34
34
  protected _sess: lSession.Session | null;
35
- /** --- 页面浏览器客户端缓存 --- */
35
+ /** --- 页面浏览器客户端缓存(单位:秒) --- */
36
36
  protected _cacheTTL: number;
37
37
  /** --- XSRF TOKEN 值 --- */
38
38
  protected _xsrf: string;
package/sys/ctr.js CHANGED
@@ -47,7 +47,7 @@ export class Ctr {
47
47
  _session = {};
48
48
  /** --- Session --- 对象 */
49
49
  _sess = null;
50
- /** --- 页面浏览器客户端缓存 --- */
50
+ /** --- 页面浏览器客户端缓存(单位:秒) --- */
51
51
  _cacheTTL;
52
52
  /** --- XSRF TOKEN 值 --- */
53
53
  _xsrf = '';
package/sys/master.js CHANGED
@@ -195,6 +195,63 @@ function createRpcListener() {
195
195
  }
196
196
  break;
197
197
  }
198
+ case 'project': {
199
+ // --- 更新项目 kebab.json ---
200
+ if (!msg.path || typeof msg.path !== 'string') {
201
+ res.end('Invalid path');
202
+ return;
203
+ }
204
+ // --- 参数校验前置,避免无效 IO ---
205
+ if (!msg.staticVer || typeof msg.staticVer !== 'string') {
206
+ res.end('Invalid staticVer');
207
+ return;
208
+ }
209
+ let path = msg.path;
210
+ if (path.startsWith('/')) {
211
+ path = path.slice(1);
212
+ }
213
+ if (path.endsWith('/')) {
214
+ path = path.slice(0, -1);
215
+ }
216
+ // --- 拒绝路径穿越,防止跳出 ROOT_CWD ---
217
+ if (path.includes('..')) {
218
+ res.end('Invalid path');
219
+ return;
220
+ }
221
+ /** --- 最终的项目根目录,以 / 结尾,但用户传入的无所谓 --- */
222
+ let to = kebab.ROOT_CWD + path;
223
+ if (!to.endsWith('/')) {
224
+ to += '/';
225
+ }
226
+ if (!await lFs.isDir(to)) {
227
+ res.end('Path not found: ' + to);
228
+ return;
229
+ }
230
+ const projectFile = to + 'kebab.json';
231
+ if (!await lFs.isFile(projectFile)) {
232
+ res.end('kebab.json not found in project path');
233
+ return;
234
+ }
235
+ const projectContent = await lFs.getContent(projectFile, 'utf8');
236
+ if (!projectContent) {
237
+ res.end('Failed to read kebab.json');
238
+ return;
239
+ }
240
+ const projectJson = lText.parseJson(projectContent);
241
+ if (!projectJson) {
242
+ res.end('Invalid kebab.json');
243
+ return;
244
+ }
245
+ // --- 只允许更新 set.staticVer 字段 ---
246
+ projectJson.set ??= {};
247
+ projectJson.set.staticVer = msg.staticVer;
248
+ const wrtn = await lFs.putContent(projectFile, lText.stringifyJson(projectJson, 4));
249
+ if (!wrtn) {
250
+ res.end('Failed to write kebab.json');
251
+ return;
252
+ }
253
+ break;
254
+ }
198
255
  case 'code': {
199
256
  // --- 更新 code 代码包 ---
200
257
  const rtn = await sRoute.getFormData(req);
@@ -221,9 +278,12 @@ function createRpcListener() {
221
278
  to += '/';
222
279
  }
223
280
  if (!await lFs.isDir(to)) {
224
- res.end('Path not found: ' + to);
225
- await sRoute.unlinkUploadFiles(rtn.files);
226
- return;
281
+ if (rtn.post['strict'] === '1') {
282
+ res.end('Path not found: ' + to);
283
+ await sRoute.unlinkUploadFiles(rtn.files);
284
+ return;
285
+ }
286
+ await lFs.mkdir(to);
227
287
  }
228
288
  const buf = await lFs.getContent(file.path);
229
289
  if (!buf) {
@@ -238,14 +298,39 @@ function createRpcListener() {
238
298
  return;
239
299
  }
240
300
  const ls = await zip.getList();
301
+ // --- 预扫描:收集 .cga 锁定目录和 kebab 子项目目录 ---
302
+ /** --- .cga 锁定的目录集合,key 格式为"父路径/目录名/"(不含开头/,含尾部/),例如 "www/pika/" --- */
303
+ const cgaLockedDirs = new Set();
304
+ /** --- 含有 kebab.json 的目录路径集合(不含开头/,含尾部/,根目录为空字符串) --- */
305
+ const kebabProjectDirs = new Set();
306
+ for (const scanPath in ls) {
307
+ /** --- 带 / 开头的 zip 中文件完整路径,例如 "/www/pika/stc/index.ts" --- */
308
+ const scanFpath = scanPath.startsWith('/') ? scanPath : '/' + scanPath;
309
+ /** --- 纯路径中最后一个 / 的位置索引 --- */
310
+ const scanLio = scanFpath.lastIndexOf('/');
311
+ /** --- 纯路径,不以 / 开头,以 / 结尾,若是根路径就是空字符串,例如 "www/pika/" --- */
312
+ const scanPat = scanFpath.slice(1, scanLio + 1);
313
+ /** --- 纯文件名,例如 "index.ts" 或 "pika.cga" --- */
314
+ const scanFname = scanFpath.slice(scanLio + 1);
315
+ if (scanFname.endsWith('.cga')) {
316
+ // --- 记录 .cga 锁定的同级目录(去掉 .cga 后缀的名字即为被锁定的目录名)---
317
+ cgaLockedDirs.add(scanPat + scanFname.slice(0, -4) + '/');
318
+ }
319
+ if (scanFname === 'kebab.json') {
320
+ // --- 记录含有 kebab.json 的目录(即 kebab 子项目根目录)---
321
+ kebabProjectDirs.add(scanPat);
322
+ }
323
+ }
324
+ /** --- kebab 子项目中仅允许部署的子文件夹名集合 --- */
325
+ const KEBAB_ALLOWED_DIRS = new Set(['ctr', 'data', 'stc', 'view', 'lib']);
241
326
  for (const path in ls) {
242
- /** --- 带 / 开头的 zip 中文件完整路径 --- */
327
+ /** --- 带 / 开头的 zip 中文件完整路径,例如 "/www/pika/ctr/api.js" --- */
243
328
  const fpath = path.startsWith('/') ? path : '/' + path;
244
- /** --- 最后一个 / 的所在位置 --- */
329
+ /** --- 纯路径中最后一个 / 的位置索引 --- */
245
330
  const lio = fpath.lastIndexOf('/');
246
- /** --- 纯路径,不以 / 开头,以 / 结尾,若是根路径就是空字符串 --- */
331
+ /** --- 纯路径,不以 / 开头,以 / 结尾,若是根路径就是空字符串,例如 "www/pika/ctr/" --- */
247
332
  const pat = fpath.slice(1, lio + 1);
248
- /** --- 纯文件名 --- */
333
+ /** --- 纯文件名,例如 "api.js" --- */
249
334
  const fname = fpath.slice(lio + 1);
250
335
  if ((pat === 'conf/' && fname === 'config.json') || fname === 'kebab.json') {
251
336
  // --- 特殊文件不能覆盖 ---
@@ -255,6 +340,52 @@ function createRpcListener() {
255
340
  // --- 测试或开发文件不覆盖 ---
256
341
  continue;
257
342
  }
343
+ // --- 规则 1:若同级目录存在 xxx.cga,则 xxx 目录下所有内容不部署 ---
344
+ if (pat) {
345
+ /** --- 是否被 .cga 文件锁定阻止 --- */
346
+ let cgaBlocked = false;
347
+ /** --- 累积路径,逐级拼接,用于逐级检查是否命中 cgaLockedDirs,例如 "a/" -> "a/b/" -> "a/b/c/" --- */
348
+ let accumulated = '';
349
+ for (const seg of pat.split('/').filter(Boolean)) {
350
+ accumulated += seg + '/';
351
+ if (cgaLockedDirs.has(accumulated)) {
352
+ cgaBlocked = true;
353
+ break;
354
+ }
355
+ }
356
+ if (cgaBlocked) {
357
+ continue;
358
+ }
359
+ }
360
+ // --- 规则 2:kebab 子项目目录中,仅允许部署 ctr/data/stc/view/lib 子文件夹内的内容 ---
361
+ // --- 快速跳过:zip 中没有 kebab.json 时整个规则无需执行 ---
362
+ if (kebabProjectDirs.size > 0) {
363
+ // --- 找最浅(最外层)匹配的 kebab 项目目录 ---
364
+ // --- 以最浅匹配为准,确保根层 kebab 规则优先于嵌套项目 ---
365
+ // --- 例如 backup/ 自身也有 kebab.json,longestMatch 会选 backup/,使其根文件通过 ---
366
+ // --- 改用 shortestMatch 则选根 "",backup 的第一段不在白名单中,正确排除 ---
367
+ /** --- 当前文件所属的最浅 kebab 子项目目录;无匹配则为 null --- */
368
+ let shortestMatch = null;
369
+ for (const kdir of kebabProjectDirs) {
370
+ /** --- 当前 kdir 是否比已有的 shortestMatch 更浅(路径更短)--- */
371
+ const isShallower = shortestMatch === null || kdir.length < shortestMatch.length;
372
+ if (pat.startsWith(kdir) && isShallower) {
373
+ shortestMatch = kdir;
374
+ }
375
+ }
376
+ if (shortestMatch !== null) {
377
+ // --- 取相对于 kebab 项目目录的路径,检查第一级子目录 ---
378
+ /** --- 相对路径,例如若 pat 为 "www/pika/ctr/" 且 shortestMatch 为 "www/pika/",则 relPath 为 "ctr/" --- */
379
+ const relPath = pat.slice(shortestMatch.length);
380
+ if (relPath) {
381
+ /** --- 路径的第一级子目录名,例如 "ctr" 或 "data",用于判断是否在允许列表中 --- */
382
+ const firstSeg = relPath.split('/')[0];
383
+ if (!KEBAB_ALLOWED_DIRS.has(firstSeg)) {
384
+ continue;
385
+ }
386
+ }
387
+ }
388
+ }
258
389
  // --- 看文件夹是否存在 ---
259
390
  if (pat && !await lFs.isDir(to + pat)) {
260
391
  if (rtn.post['strict'] === '1') {