@maiyunnet/kebab 9.22.4 → 9.23.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/abox/master-log.d.ts +1 -0
- package/abox/master-log.js +26 -0
- package/abox/text.d.ts +2 -0
- package/abox/text.js +21 -0
- package/doc/kebab-rag.md +186 -162
- package/index.d.ts +7 -2
- package/index.js +1 -1
- package/lib/text.d.ts +6 -4
- package/lib/text.js +11 -34
- package/lib/undici/response.d.ts +1 -1
- package/lib/undici.d.ts +5 -5
- package/lib/undici.js +7 -6
- package/package.json +3 -2
- package/sys/master.js +185 -279
- package/sys/route.d.ts +5 -5
- package/sys/route.js +33 -20
package/doc/kebab-rag.md
CHANGED
|
@@ -33,6 +33,10 @@ quick-start.md
|
|
|
33
33
|
- `view/`: 视图目录,存放 ejs 文件
|
|
34
34
|
- `ws/`: WebSocket 目录
|
|
35
35
|
|
|
36
|
+
## 请求主机与完整 URL
|
|
37
|
+
|
|
38
|
+
控制器通过 `this._config.const.hostCanonical` 获取用于 URL 的主机地址:HTTPS 的 443 和 HTTP 的 80 端口会省略,其余端口及 IPv6 方括号保留。`host`、`hostname` 和 `hostport` 保留原有含义。`urlOrigin`、`urlFull` 和 `urlStcFull` 使用 `hostCanonical` 生成,SSR 注入的 `_urlFull`、默认 `_staticPathFull` 同步省略默认端口。
|
|
39
|
+
|
|
36
40
|
## 集成 JSON Schema
|
|
37
41
|
|
|
38
42
|
控制器的 `_checkInput` 方法已集成 JSON Schema(ajv、ajv-formats),可通过 `schema` 参数使用,例如:
|
|
@@ -504,7 +508,7 @@ Defined in: [index.ts:183](https://github.com/maiyunnet/kebab/blob/master/index.
|
|
|
504
508
|
|
|
505
509
|
> **ctrPath**: `string`
|
|
506
510
|
|
|
507
|
-
Defined in: [index.ts:
|
|
511
|
+
Defined in: [index.ts:215](https://github.com/maiyunnet/kebab/blob/master/index.ts#L215)
|
|
508
512
|
|
|
509
513
|
***
|
|
510
514
|
|
|
@@ -512,7 +516,7 @@ Defined in: [index.ts:210](https://github.com/maiyunnet/kebab/blob/master/index.
|
|
|
512
516
|
|
|
513
517
|
> **dataPath**: `string`
|
|
514
518
|
|
|
515
|
-
Defined in: [index.ts:
|
|
519
|
+
Defined in: [index.ts:217](https://github.com/maiyunnet/kebab/blob/master/index.ts#L217)
|
|
516
520
|
|
|
517
521
|
***
|
|
518
522
|
|
|
@@ -520,7 +524,19 @@ Defined in: [index.ts:212](https://github.com/maiyunnet/kebab/blob/master/index.
|
|
|
520
524
|
|
|
521
525
|
> **host**: `string`
|
|
522
526
|
|
|
523
|
-
Defined in: [index.ts:
|
|
527
|
+
Defined in: [index.ts:200](https://github.com/maiyunnet/kebab/blob/master/index.ts#L200)
|
|
528
|
+
|
|
529
|
+
原始主机地址,保留端口
|
|
530
|
+
|
|
531
|
+
***
|
|
532
|
+
|
|
533
|
+
### hostCanonical
|
|
534
|
+
|
|
535
|
+
> **hostCanonical**: `string`
|
|
536
|
+
|
|
537
|
+
Defined in: [index.ts:206](https://github.com/maiyunnet/kebab/blob/master/index.ts#L206)
|
|
538
|
+
|
|
539
|
+
用于 URL 的主机地址,仅省略 HTTPS 的 443 和 HTTP 的 80 端口,保留 IPv6 方括号
|
|
524
540
|
|
|
525
541
|
***
|
|
526
542
|
|
|
@@ -528,7 +544,9 @@ Defined in: [index.ts:199](https://github.com/maiyunnet/kebab/blob/master/index.
|
|
|
528
544
|
|
|
529
545
|
> **hostname**: `string`
|
|
530
546
|
|
|
531
|
-
Defined in: [index.ts:
|
|
547
|
+
Defined in: [index.ts:202](https://github.com/maiyunnet/kebab/blob/master/index.ts#L202)
|
|
548
|
+
|
|
549
|
+
主机名,不含端口或 IPv6 方括号
|
|
532
550
|
|
|
533
551
|
***
|
|
534
552
|
|
|
@@ -536,7 +554,9 @@ Defined in: [index.ts:200](https://github.com/maiyunnet/kebab/blob/master/index.
|
|
|
536
554
|
|
|
537
555
|
> **hostport**: `number`
|
|
538
556
|
|
|
539
|
-
Defined in: [index.ts:
|
|
557
|
+
Defined in: [index.ts:204](https://github.com/maiyunnet/kebab/blob/master/index.ts#L204)
|
|
558
|
+
|
|
559
|
+
请求端口
|
|
540
560
|
|
|
541
561
|
***
|
|
542
562
|
|
|
@@ -568,7 +588,7 @@ Defined in: [index.ts:195](https://github.com/maiyunnet/kebab/blob/master/index.
|
|
|
568
588
|
|
|
569
589
|
> **modPath**: `string`
|
|
570
590
|
|
|
571
|
-
Defined in: [index.ts:
|
|
591
|
+
Defined in: [index.ts:214](https://github.com/maiyunnet/kebab/blob/master/index.ts#L214)
|
|
572
592
|
|
|
573
593
|
***
|
|
574
594
|
|
|
@@ -606,7 +626,7 @@ Defined in: [index.ts:189](https://github.com/maiyunnet/kebab/blob/master/index.
|
|
|
606
626
|
|
|
607
627
|
> **rootPath**: `string`
|
|
608
628
|
|
|
609
|
-
Defined in: [index.ts:
|
|
629
|
+
Defined in: [index.ts:213](https://github.com/maiyunnet/kebab/blob/master/index.ts#L213)
|
|
610
630
|
|
|
611
631
|
***
|
|
612
632
|
|
|
@@ -630,7 +650,7 @@ Defined in: [index.ts:190](https://github.com/maiyunnet/kebab/blob/master/index.
|
|
|
630
650
|
|
|
631
651
|
> **uri**: [`IUrlParse`](IUrlParse.md)
|
|
632
652
|
|
|
633
|
-
Defined in: [index.ts:
|
|
653
|
+
Defined in: [index.ts:209](https://github.com/maiyunnet/kebab/blob/master/index.ts#L209)
|
|
634
654
|
|
|
635
655
|
***
|
|
636
656
|
|
|
@@ -638,7 +658,7 @@ Defined in: [index.ts:204](https://github.com/maiyunnet/kebab/blob/master/index.
|
|
|
638
658
|
|
|
639
659
|
> **urlBase**: `string`
|
|
640
660
|
|
|
641
|
-
Defined in: [index.ts:
|
|
661
|
+
Defined in: [index.ts:222](https://github.com/maiyunnet/kebab/blob/master/index.ts#L222)
|
|
642
662
|
|
|
643
663
|
***
|
|
644
664
|
|
|
@@ -646,7 +666,7 @@ Defined in: [index.ts:217](https://github.com/maiyunnet/kebab/blob/master/index.
|
|
|
646
666
|
|
|
647
667
|
> **urlFull**: `string`
|
|
648
668
|
|
|
649
|
-
Defined in: [index.ts:
|
|
669
|
+
Defined in: [index.ts:224](https://github.com/maiyunnet/kebab/blob/master/index.ts#L224)
|
|
650
670
|
|
|
651
671
|
***
|
|
652
672
|
|
|
@@ -654,9 +674,9 @@ Defined in: [index.ts:219](https://github.com/maiyunnet/kebab/blob/master/index.
|
|
|
654
674
|
|
|
655
675
|
> **urlOrigin**: `string`
|
|
656
676
|
|
|
657
|
-
Defined in: [index.ts:
|
|
677
|
+
Defined in: [index.ts:208](https://github.com/maiyunnet/kebab/blob/master/index.ts#L208)
|
|
658
678
|
|
|
659
|
-
协议与
|
|
679
|
+
协议与 hostCanonical,如 https://example.com:8443
|
|
660
680
|
|
|
661
681
|
***
|
|
662
682
|
|
|
@@ -664,7 +684,7 @@ Defined in: [index.ts:203](https://github.com/maiyunnet/kebab/blob/master/index.
|
|
|
664
684
|
|
|
665
685
|
> **urlStc**: `string`
|
|
666
686
|
|
|
667
|
-
Defined in: [index.ts:
|
|
687
|
+
Defined in: [index.ts:223](https://github.com/maiyunnet/kebab/blob/master/index.ts#L223)
|
|
668
688
|
|
|
669
689
|
***
|
|
670
690
|
|
|
@@ -672,7 +692,7 @@ Defined in: [index.ts:218](https://github.com/maiyunnet/kebab/blob/master/index.
|
|
|
672
692
|
|
|
673
693
|
> **urlStcFull**: `string`
|
|
674
694
|
|
|
675
|
-
Defined in: [index.ts:
|
|
695
|
+
Defined in: [index.ts:225](https://github.com/maiyunnet/kebab/blob/master/index.ts#L225)
|
|
676
696
|
|
|
677
697
|
***
|
|
678
698
|
|
|
@@ -680,7 +700,7 @@ Defined in: [index.ts:220](https://github.com/maiyunnet/kebab/blob/master/index.
|
|
|
680
700
|
|
|
681
701
|
> **viewPath**: `string`
|
|
682
702
|
|
|
683
|
-
Defined in: [index.ts:
|
|
703
|
+
Defined in: [index.ts:216](https://github.com/maiyunnet/kebab/blob/master/index.ts#L216)
|
|
684
704
|
|
|
685
705
|
***
|
|
686
706
|
|
|
@@ -696,7 +716,7 @@ Defined in: [index.ts:196](https://github.com/maiyunnet/kebab/blob/master/index.
|
|
|
696
716
|
|
|
697
717
|
> **wsPath**: `string`
|
|
698
718
|
|
|
699
|
-
Defined in: [index.ts:
|
|
719
|
+
Defined in: [index.ts:218](https://github.com/maiyunnet/kebab/blob/master/index.ts#L218)
|
|
700
720
|
|
|
701
721
|
index/interfaces/IConfigDb.md
|
|
702
722
|
---
|
|
@@ -1256,7 +1276,7 @@ index/interfaces/IPostFile.md
|
|
|
1256
1276
|
|
|
1257
1277
|
# Interface: IPostFile
|
|
1258
1278
|
|
|
1259
|
-
Defined in: [index.ts:
|
|
1279
|
+
Defined in: [index.ts:237](https://github.com/maiyunnet/kebab/blob/master/index.ts#L237)
|
|
1260
1280
|
|
|
1261
1281
|
上传的文件信息对象
|
|
1262
1282
|
|
|
@@ -1266,7 +1286,7 @@ Defined in: [index.ts:232](https://github.com/maiyunnet/kebab/blob/master/index.
|
|
|
1266
1286
|
|
|
1267
1287
|
> `readonly` **name**: `string`
|
|
1268
1288
|
|
|
1269
|
-
Defined in: [index.ts:
|
|
1289
|
+
Defined in: [index.ts:238](https://github.com/maiyunnet/kebab/blob/master/index.ts#L238)
|
|
1270
1290
|
|
|
1271
1291
|
***
|
|
1272
1292
|
|
|
@@ -1274,7 +1294,7 @@ Defined in: [index.ts:233](https://github.com/maiyunnet/kebab/blob/master/index.
|
|
|
1274
1294
|
|
|
1275
1295
|
> `readonly` **origin**: `string`
|
|
1276
1296
|
|
|
1277
|
-
Defined in: [index.ts:
|
|
1297
|
+
Defined in: [index.ts:239](https://github.com/maiyunnet/kebab/blob/master/index.ts#L239)
|
|
1278
1298
|
|
|
1279
1299
|
***
|
|
1280
1300
|
|
|
@@ -1282,7 +1302,7 @@ Defined in: [index.ts:234](https://github.com/maiyunnet/kebab/blob/master/index.
|
|
|
1282
1302
|
|
|
1283
1303
|
> `readonly` **path**: `string`
|
|
1284
1304
|
|
|
1285
|
-
Defined in: [index.ts:
|
|
1305
|
+
Defined in: [index.ts:241](https://github.com/maiyunnet/kebab/blob/master/index.ts#L241)
|
|
1286
1306
|
|
|
1287
1307
|
***
|
|
1288
1308
|
|
|
@@ -1290,7 +1310,7 @@ Defined in: [index.ts:236](https://github.com/maiyunnet/kebab/blob/master/index.
|
|
|
1290
1310
|
|
|
1291
1311
|
> `readonly` **size**: `number`
|
|
1292
1312
|
|
|
1293
|
-
Defined in: [index.ts:
|
|
1313
|
+
Defined in: [index.ts:240](https://github.com/maiyunnet/kebab/blob/master/index.ts#L240)
|
|
1294
1314
|
|
|
1295
1315
|
index/interfaces/IUrlParse.md
|
|
1296
1316
|
---
|
|
@@ -1404,7 +1424,7 @@ index/interfaces/IVhost.md
|
|
|
1404
1424
|
|
|
1405
1425
|
# Interface: IVhost
|
|
1406
1426
|
|
|
1407
|
-
Defined in: [index.ts:
|
|
1427
|
+
Defined in: [index.ts:229](https://github.com/maiyunnet/kebab/blob/master/index.ts#L229)
|
|
1408
1428
|
|
|
1409
1429
|
虚拟机配置对象
|
|
1410
1430
|
|
|
@@ -1414,7 +1434,7 @@ Defined in: [index.ts:224](https://github.com/maiyunnet/kebab/blob/master/index.
|
|
|
1414
1434
|
|
|
1415
1435
|
> `readonly` **domains**: `string`[]
|
|
1416
1436
|
|
|
1417
|
-
Defined in: [index.ts:
|
|
1437
|
+
Defined in: [index.ts:231](https://github.com/maiyunnet/kebab/blob/master/index.ts#L231)
|
|
1418
1438
|
|
|
1419
1439
|
***
|
|
1420
1440
|
|
|
@@ -1422,7 +1442,7 @@ Defined in: [index.ts:226](https://github.com/maiyunnet/kebab/blob/master/index.
|
|
|
1422
1442
|
|
|
1423
1443
|
> `readonly` `optional` **name?**: `string`
|
|
1424
1444
|
|
|
1425
|
-
Defined in: [index.ts:
|
|
1445
|
+
Defined in: [index.ts:230](https://github.com/maiyunnet/kebab/blob/master/index.ts#L230)
|
|
1426
1446
|
|
|
1427
1447
|
***
|
|
1428
1448
|
|
|
@@ -1430,7 +1450,7 @@ Defined in: [index.ts:225](https://github.com/maiyunnet/kebab/blob/master/index.
|
|
|
1430
1450
|
|
|
1431
1451
|
> `readonly` `optional` **remark?**: `string`
|
|
1432
1452
|
|
|
1433
|
-
Defined in: [index.ts:
|
|
1453
|
+
Defined in: [index.ts:233](https://github.com/maiyunnet/kebab/blob/master/index.ts#L233)
|
|
1434
1454
|
|
|
1435
1455
|
***
|
|
1436
1456
|
|
|
@@ -1438,7 +1458,7 @@ Defined in: [index.ts:228](https://github.com/maiyunnet/kebab/blob/master/index.
|
|
|
1438
1458
|
|
|
1439
1459
|
> `readonly` **root**: `string`
|
|
1440
1460
|
|
|
1441
|
-
Defined in: [index.ts:
|
|
1461
|
+
Defined in: [index.ts:232](https://github.com/maiyunnet/kebab/blob/master/index.ts#L232)
|
|
1442
1462
|
|
|
1443
1463
|
index.md
|
|
1444
1464
|
---
|
|
@@ -1717,7 +1737,7 @@ index/variables/VER.md
|
|
|
1717
1737
|
|
|
1718
1738
|
# Variable: VER
|
|
1719
1739
|
|
|
1720
|
-
> `const` **VER**: `"9.
|
|
1740
|
+
> `const` **VER**: `"9.23.0"` = `'9.23.0'`
|
|
1721
1741
|
|
|
1722
1742
|
Defined in: [index.ts:10](https://github.com/maiyunnet/kebab/blob/master/index.ts#L10)
|
|
1723
1743
|
|
|
@@ -126473,7 +126493,7 @@ lib/text/functions/compareVersion.md
|
|
|
126473
126493
|
|
|
126474
126494
|
> **compareVersion**(`version`, `target`): `0` \| `1` \| `-1` \| `null`
|
|
126475
126495
|
|
|
126476
|
-
Defined in: [lib/text.ts:
|
|
126496
|
+
Defined in: [lib/text.ts:36](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L36)
|
|
126477
126497
|
|
|
126478
126498
|
逐段比较三段正式发行版本 X.Y.Z,不按字符串或浮点数比较
|
|
126479
126499
|
|
|
@@ -126510,7 +126530,7 @@ lib/text/functions/csvescape.md
|
|
|
126510
126530
|
|
|
126511
126531
|
> **csvescape**(`str`): `string`
|
|
126512
126532
|
|
|
126513
|
-
Defined in: [lib/text.ts:
|
|
126533
|
+
Defined in: [lib/text.ts:586](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L586)
|
|
126514
126534
|
|
|
126515
126535
|
CSV 特殊字符转换为实体字符
|
|
126516
126536
|
|
|
@@ -126537,7 +126557,7 @@ lib/text/functions/getFileExt.md
|
|
|
126537
126557
|
|
|
126538
126558
|
> **getFileExt**(`path`): `string`
|
|
126539
126559
|
|
|
126540
|
-
Defined in: [lib/text.ts:
|
|
126560
|
+
Defined in: [lib/text.ts:627](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L627)
|
|
126541
126561
|
|
|
126542
126562
|
获取文件后缀
|
|
126543
126563
|
|
|
@@ -126566,7 +126586,7 @@ lib/text/functions/getFileNameExt.md
|
|
|
126566
126586
|
|
|
126567
126587
|
> **getFileNameExt**(`path`): `object`
|
|
126568
126588
|
|
|
126569
|
-
Defined in: [lib/text.ts:
|
|
126589
|
+
Defined in: [lib/text.ts:640](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L640)
|
|
126570
126590
|
|
|
126571
126591
|
获取文件名和后缀
|
|
126572
126592
|
|
|
@@ -126603,7 +126623,7 @@ lib/text/functions/getFilename.md
|
|
|
126603
126623
|
|
|
126604
126624
|
> **getFilename**(`path`, `ext?`): `string`
|
|
126605
126625
|
|
|
126606
|
-
Defined in: [lib/text.ts:
|
|
126626
|
+
Defined in: [lib/text.ts:607](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L607)
|
|
126607
126627
|
|
|
126608
126628
|
获取文件名
|
|
126609
126629
|
|
|
@@ -126638,7 +126658,7 @@ lib/text/functions/htmlescape.md
|
|
|
126638
126658
|
|
|
126639
126659
|
> **htmlescape**(`html`): `string`
|
|
126640
126660
|
|
|
126641
|
-
Defined in: [lib/text.ts:
|
|
126661
|
+
Defined in: [lib/text.ts:572](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L572)
|
|
126642
126662
|
|
|
126643
126663
|
HTML 特殊字符转换为实体字符
|
|
126644
126664
|
|
|
@@ -126667,7 +126687,7 @@ lib/text/functions/int2str.md
|
|
|
126667
126687
|
|
|
126668
126688
|
> **int2str**(`int`, `digits?`, `decimal?`): `string`
|
|
126669
126689
|
|
|
126670
|
-
Defined in: [lib/text.ts:
|
|
126690
|
+
Defined in: [lib/text.ts:840](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L840)
|
|
126671
126691
|
|
|
126672
126692
|
为解决精度问题,将整数转换为小数字符串
|
|
126673
126693
|
以下几个示例都是当 digits 为 3、decimal 为 2 时
|
|
@@ -126713,7 +126733,7 @@ lib/text/functions/isAscii.md
|
|
|
126713
126733
|
|
|
126714
126734
|
> **isAscii**(`text`): `boolean`
|
|
126715
126735
|
|
|
126716
|
-
Defined in: [lib/text.ts:
|
|
126736
|
+
Defined in: [lib/text.ts:330](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L330)
|
|
126717
126737
|
|
|
126718
126738
|
判断是否在 ascii 字符集内,仅可输入部分
|
|
126719
126739
|
|
|
@@ -126742,7 +126762,7 @@ lib/text/functions/isDomain.md
|
|
|
126742
126762
|
|
|
126743
126763
|
> **isDomain**(`domain`): `boolean`
|
|
126744
126764
|
|
|
126745
|
-
Defined in: [lib/text.ts:
|
|
126765
|
+
Defined in: [lib/text.ts:319](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L319)
|
|
126746
126766
|
|
|
126747
126767
|
判断是否是域名
|
|
126748
126768
|
|
|
@@ -126773,7 +126793,7 @@ lib/text/functions/isEMail.md
|
|
|
126773
126793
|
|
|
126774
126794
|
> **isEMail**(`email`): `boolean`
|
|
126775
126795
|
|
|
126776
|
-
Defined in: [lib/text.ts:
|
|
126796
|
+
Defined in: [lib/text.ts:292](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L292)
|
|
126777
126797
|
|
|
126778
126798
|
是否是邮件地址
|
|
126779
126799
|
|
|
@@ -126800,7 +126820,7 @@ lib/text/functions/isFalsy.md
|
|
|
126800
126820
|
|
|
126801
126821
|
> **isFalsy**(`val`): `val is TFalsy`
|
|
126802
126822
|
|
|
126803
|
-
Defined in: [lib/text.ts:
|
|
126823
|
+
Defined in: [lib/text.ts:791](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L791)
|
|
126804
126824
|
|
|
126805
126825
|
判断一个值是否是虚假的(为 null/undefined/空字符串/false/0)
|
|
126806
126826
|
|
|
@@ -126829,7 +126849,7 @@ lib/text/functions/isIdCardCN.md
|
|
|
126829
126849
|
|
|
126830
126850
|
> **isIdCardCN**(`idcard`): `boolean`
|
|
126831
126851
|
|
|
126832
|
-
Defined in: [lib/text.ts:
|
|
126852
|
+
Defined in: [lib/text.ts:442](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L442)
|
|
126833
126853
|
|
|
126834
126854
|
是否是中国大陆身份证号码
|
|
126835
126855
|
|
|
@@ -126858,9 +126878,9 @@ lib/text/functions/isIPv4.md
|
|
|
126858
126878
|
|
|
126859
126879
|
> **isIPv4**(`ip`): `boolean`
|
|
126860
126880
|
|
|
126861
|
-
Defined in: [lib/text.ts:
|
|
126881
|
+
Defined in: [lib/text.ts:300](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L300)
|
|
126862
126882
|
|
|
126863
|
-
是否是 IPv4(基于 Node 原生 net.
|
|
126883
|
+
是否是 IPv4(基于 Node 原生 net.isIPv4,严格校验)
|
|
126864
126884
|
|
|
126865
126885
|
## Parameters
|
|
126866
126886
|
|
|
@@ -126885,9 +126905,9 @@ lib/text/functions/isIPv6.md
|
|
|
126885
126905
|
|
|
126886
126906
|
> **isIPv6**(`ip`): `boolean`
|
|
126887
126907
|
|
|
126888
|
-
Defined in: [lib/text.ts:
|
|
126908
|
+
Defined in: [lib/text.ts:308](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L308)
|
|
126889
126909
|
|
|
126890
|
-
是否是 IPv6(基于 Node 原生 net.
|
|
126910
|
+
是否是 IPv6(基于 Node 原生 net.isIPv6,严格校验)
|
|
126891
126911
|
|
|
126892
126912
|
## Parameters
|
|
126893
126913
|
|
|
@@ -126912,7 +126932,7 @@ lib/text/functions/isPhoneCN.md
|
|
|
126912
126932
|
|
|
126913
126933
|
> **isPhoneCN**(`p`): `boolean`
|
|
126914
126934
|
|
|
126915
|
-
Defined in: [lib/text.ts:
|
|
126935
|
+
Defined in: [lib/text.ts:434](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L434)
|
|
126916
126936
|
|
|
126917
126937
|
判断手机号是否是 11 位,不做真实性校验
|
|
126918
126938
|
|
|
@@ -126941,7 +126961,7 @@ lib/text/functions/isRealPath.md
|
|
|
126941
126961
|
|
|
126942
126962
|
> **isRealPath**(`path`): `boolean`
|
|
126943
126963
|
|
|
126944
|
-
Defined in: [lib/text.ts:
|
|
126964
|
+
Defined in: [lib/text.ts:594](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L594)
|
|
126945
126965
|
|
|
126946
126966
|
判断是否是绝对路径,是返回 true,相对路径返回 false
|
|
126947
126967
|
|
|
@@ -126970,7 +126990,7 @@ lib/text/functions/isSameOrigin.md
|
|
|
126970
126990
|
|
|
126971
126991
|
> **isSameOrigin**(`from`, `to`): `boolean`
|
|
126972
126992
|
|
|
126973
|
-
Defined in: [lib/text.ts:
|
|
126993
|
+
Defined in: [lib/text.ts:173](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L173)
|
|
126974
126994
|
|
|
126975
126995
|
判断两个 URL 是否属于同源地址
|
|
126976
126996
|
|
|
@@ -127005,7 +127025,7 @@ lib/text/functions/isTruthy.md
|
|
|
127005
127025
|
|
|
127006
127026
|
> **isTruthy**\<`T`\>(`val`): `val is Exclude<T, TFalsy>`
|
|
127007
127027
|
|
|
127008
|
-
Defined in: [lib/text.ts:
|
|
127028
|
+
Defined in: [lib/text.ts:799](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L799)
|
|
127009
127029
|
|
|
127010
127030
|
判断一个值是否是真实的(不为 null/undefined/空字符串/false/0)
|
|
127011
127031
|
|
|
@@ -127040,7 +127060,7 @@ lib/text/functions/logicalOr.md
|
|
|
127040
127060
|
|
|
127041
127061
|
> **logicalOr**\<`T`, `T2`\>(`v1`, `v2`): `T` *extends* [`TFalsy`](../type-aliases/TFalsy.md) ? `T2` : `T`
|
|
127042
127062
|
|
|
127043
|
-
Defined in: [lib/text.ts:
|
|
127063
|
+
Defined in: [lib/text.ts:808](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L808)
|
|
127044
127064
|
|
|
127045
127065
|
类似 || 运算符的效果
|
|
127046
127066
|
|
|
@@ -127085,7 +127105,7 @@ lib/text/functions/match.md
|
|
|
127085
127105
|
|
|
127086
127106
|
> **match**(`str`, `regs`): `boolean`
|
|
127087
127107
|
|
|
127088
|
-
Defined in: [lib/text.ts:
|
|
127108
|
+
Defined in: [lib/text.ts:419](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L419)
|
|
127089
127109
|
|
|
127090
127110
|
传入正则进行匹配 str 是否有一项满足
|
|
127091
127111
|
|
|
@@ -127120,7 +127140,7 @@ lib/text/functions/nlReplace.md
|
|
|
127120
127140
|
|
|
127121
127141
|
> **nlReplace**(`str`, `to?`): `string`
|
|
127122
127142
|
|
|
127123
|
-
Defined in: [lib/text.ts:
|
|
127143
|
+
Defined in: [lib/text.ts:339](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L339)
|
|
127124
127144
|
|
|
127125
127145
|
换行替换为别的
|
|
127126
127146
|
|
|
@@ -127155,7 +127175,7 @@ lib/text/functions/parseDomain.md
|
|
|
127155
127175
|
|
|
127156
127176
|
> **parseDomain**(`domain`): `Promise`\<[`IDomain`](../interfaces/IDomain.md)\>
|
|
127157
127177
|
|
|
127158
|
-
Defined in: [lib/text.ts:
|
|
127178
|
+
Defined in: [lib/text.ts:362](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L362)
|
|
127159
127179
|
|
|
127160
127180
|
解析域名并获取 tld/sld/domain/sub
|
|
127161
127181
|
|
|
@@ -127184,7 +127204,7 @@ lib/text/functions/parseHost.md
|
|
|
127184
127204
|
|
|
127185
127205
|
> **parseHost**(`host`): `object`
|
|
127186
127206
|
|
|
127187
|
-
Defined in: [lib/text.ts:
|
|
127207
|
+
Defined in: [lib/text.ts:69](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L69)
|
|
127188
127208
|
|
|
127189
127209
|
解析主机名和端口号
|
|
127190
127210
|
|
|
@@ -127225,9 +127245,9 @@ lib/text/functions/parseJson.md
|
|
|
127225
127245
|
|
|
127226
127246
|
> **parseJson**\<`T`\>(`str`): `false` \| `T`
|
|
127227
127247
|
|
|
127228
|
-
Defined in: [lib/text.ts:
|
|
127248
|
+
Defined in: [lib/text.ts:703](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L703)
|
|
127229
127249
|
|
|
127230
|
-
|
|
127250
|
+
解析 JSON,超出安全整数范围的整数字面量转换为 BigInt
|
|
127231
127251
|
|
|
127232
127252
|
## Type Parameters
|
|
127233
127253
|
|
|
@@ -127247,6 +127267,8 @@ Defined in: [lib/text.ts:701](https://github.com/maiyunnet/kebab/blob/master/lib
|
|
|
127247
127267
|
|
|
127248
127268
|
`false` \| `T`
|
|
127249
127269
|
|
|
127270
|
+
解析结果,无效 JSON 返回 false;小数及指数形式仍为 number
|
|
127271
|
+
|
|
127250
127272
|
lib/text/functions/parseUrl.md
|
|
127251
127273
|
---
|
|
127252
127274
|
|
|
@@ -127260,7 +127282,7 @@ lib/text/functions/parseUrl.md
|
|
|
127260
127282
|
|
|
127261
127283
|
> **parseUrl**(`url`): [`IUrlParse`](../../../index/interfaces/IUrlParse.md)
|
|
127262
127284
|
|
|
127263
|
-
Defined in: [lib/text.ts:
|
|
127285
|
+
Defined in: [lib/text.ts:95](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L95)
|
|
127264
127286
|
|
|
127265
127287
|
格式化一段 URL
|
|
127266
127288
|
|
|
@@ -127287,7 +127309,7 @@ lib/text/functions/parseVersion.md
|
|
|
127287
127309
|
|
|
127288
127310
|
> **parseVersion**(`value`): \[`number`, `number`, `number`\] \| `null`
|
|
127289
127311
|
|
|
127290
|
-
Defined in: [lib/text.ts:
|
|
127312
|
+
Defined in: [lib/text.ts:17](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L17)
|
|
127291
127313
|
|
|
127292
127314
|
解析三段正式发行版本 X.Y.Z,不接受前导零、预发行和构建后缀
|
|
127293
127315
|
|
|
@@ -127318,7 +127340,7 @@ lib/text/functions/queryParse.md
|
|
|
127318
127340
|
|
|
127319
127341
|
> **queryParse**(`query`): `Record`\<`string`, `string` \| `string`[]\>
|
|
127320
127342
|
|
|
127321
|
-
Defined in: [lib/text.ts:
|
|
127343
|
+
Defined in: [lib/text.ts:519](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L519)
|
|
127322
127344
|
|
|
127323
127345
|
将 query string 转换为对象
|
|
127324
127346
|
|
|
@@ -127349,7 +127371,7 @@ lib/text/functions/queryStringify.md
|
|
|
127349
127371
|
|
|
127350
127372
|
> **queryStringify**(`query`, `encode?`): `string`
|
|
127351
127373
|
|
|
127352
|
-
Defined in: [lib/text.ts:
|
|
127374
|
+
Defined in: [lib/text.ts:470](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L470)
|
|
127353
127375
|
|
|
127354
127376
|
将对象转换为 query string
|
|
127355
127377
|
|
|
@@ -127375,7 +127397,7 @@ Defined in: [lib/text.ts:469](https://github.com/maiyunnet/kebab/blob/master/lib
|
|
|
127375
127397
|
|
|
127376
127398
|
> **queryStringify**(`query`, `options`): `string`
|
|
127377
127399
|
|
|
127378
|
-
Defined in: [lib/text.ts:
|
|
127400
|
+
Defined in: [lib/text.ts:476](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L476)
|
|
127379
127401
|
|
|
127380
127402
|
将对象转换为 query string
|
|
127381
127403
|
|
|
@@ -127420,7 +127442,7 @@ lib/text/functions/sizeFormat.md
|
|
|
127420
127442
|
|
|
127421
127443
|
> **sizeFormat**(`size`, `spliter?`): `string`
|
|
127422
127444
|
|
|
127423
|
-
Defined in: [lib/text.ts:
|
|
127445
|
+
Defined in: [lib/text.ts:55](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L55)
|
|
127424
127446
|
|
|
127425
127447
|
将文件大小格式化为带单位的字符串
|
|
127426
127448
|
|
|
@@ -127455,7 +127477,7 @@ lib/text/functions/str2int.md
|
|
|
127455
127477
|
|
|
127456
127478
|
> **str2int**(`str`, `digits?`): `number`
|
|
127457
127479
|
|
|
127458
|
-
Defined in: [lib/text.ts:
|
|
127480
|
+
Defined in: [lib/text.ts:822](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L822)
|
|
127459
127481
|
|
|
127460
127482
|
为解决精度问题,将字符串数字转换为整数显示
|
|
127461
127483
|
以下几个示例都是当 digits 为 2 时
|
|
@@ -127495,7 +127517,7 @@ lib/text/functions/stringifyBuffer.md
|
|
|
127495
127517
|
|
|
127496
127518
|
> **stringifyBuffer**(`buf`): `string`
|
|
127497
127519
|
|
|
127498
|
-
Defined in: [lib/text.ts:
|
|
127520
|
+
Defined in: [lib/text.ts:745](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L745)
|
|
127499
127521
|
|
|
127500
127522
|
输出文本格式的 buffer
|
|
127501
127523
|
|
|
@@ -127524,7 +127546,7 @@ lib/text/functions/stringifyError.md
|
|
|
127524
127546
|
|
|
127525
127547
|
> **stringifyError**(`error`): `string`
|
|
127526
127548
|
|
|
127527
|
-
Defined in: [lib/text.ts:
|
|
127549
|
+
Defined in: [lib/text.ts:722](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L722)
|
|
127528
127550
|
|
|
127529
127551
|
将未知异常转换为适合单行日志的文本,Error 优先返回完整堆栈
|
|
127530
127552
|
|
|
@@ -127555,9 +127577,9 @@ lib/text/functions/stringifyJson.md
|
|
|
127555
127577
|
|
|
127556
127578
|
> **stringifyJson**(`obj`, `space?`): `string`
|
|
127557
127579
|
|
|
127558
|
-
Defined in: [lib/text.ts:
|
|
127580
|
+
Defined in: [lib/text.ts:713](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L713)
|
|
127559
127581
|
|
|
127560
|
-
将对象转换为
|
|
127582
|
+
将对象转换为 JSON 字符串,BigInt 输出为整数字面量
|
|
127561
127583
|
|
|
127562
127584
|
## Parameters
|
|
127563
127585
|
|
|
@@ -127577,6 +127599,8 @@ Defined in: [lib/text.ts:731](https://github.com/maiyunnet/kebab/blob/master/lib
|
|
|
127577
127599
|
|
|
127578
127600
|
`string`
|
|
127579
127601
|
|
|
127602
|
+
JSON 字符串,循环引用等序列化错误沿用 JSON.stringify 异常
|
|
127603
|
+
|
|
127580
127604
|
lib/text/functions/stringifyResult.md
|
|
127581
127605
|
---
|
|
127582
127606
|
|
|
@@ -127590,7 +127614,7 @@ lib/text/functions/stringifyResult.md
|
|
|
127590
127614
|
|
|
127591
127615
|
> **stringifyResult**(`rtn`): `string`
|
|
127592
127616
|
|
|
127593
|
-
Defined in: [lib/text.ts:
|
|
127617
|
+
Defined in: [lib/text.ts:662](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L662)
|
|
127594
127618
|
|
|
127595
127619
|
将普通的返回 JSON 对象序列化为字符串
|
|
127596
127620
|
|
|
@@ -127619,7 +127643,7 @@ lib/text/functions/trimJson.md
|
|
|
127619
127643
|
|
|
127620
127644
|
> **trimJson**(`json`): `any`
|
|
127621
127645
|
|
|
127622
|
-
Defined in: [lib/text.ts:
|
|
127646
|
+
Defined in: [lib/text.ts:753](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L753)
|
|
127623
127647
|
|
|
127624
127648
|
递归删除 json 中的字符串首尾空格,会返回一个新的对象
|
|
127625
127649
|
|
|
@@ -127646,7 +127670,7 @@ lib/text/functions/urlAtom.md
|
|
|
127646
127670
|
|
|
127647
127671
|
> **urlAtom**(`url`): `string`
|
|
127648
127672
|
|
|
127649
|
-
Defined in: [lib/text.ts:
|
|
127673
|
+
Defined in: [lib/text.ts:273](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L273)
|
|
127650
127674
|
|
|
127651
127675
|
将路径中的 ../ ./ 都按规范妥善处理
|
|
127652
127676
|
|
|
@@ -127675,7 +127699,7 @@ lib/text/functions/urlResolve.md
|
|
|
127675
127699
|
|
|
127676
127700
|
> **urlResolve**(`from`, `to`, `limit?`): `string`
|
|
127677
127701
|
|
|
127678
|
-
Defined in: [lib/text.ts:
|
|
127702
|
+
Defined in: [lib/text.ts:207](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L207)
|
|
127679
127703
|
|
|
127680
127704
|
将相对路径根据基准路径进行转换
|
|
127681
127705
|
|
|
@@ -127779,7 +127803,7 @@ lib/text/interfaces/IDomain.md
|
|
|
127779
127803
|
|
|
127780
127804
|
# Interface: IDomain
|
|
127781
127805
|
|
|
127782
|
-
Defined in: [lib/text.ts:
|
|
127806
|
+
Defined in: [lib/text.ts:351](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L351)
|
|
127783
127807
|
|
|
127784
127808
|
解析后的 domain
|
|
127785
127809
|
|
|
@@ -127789,7 +127813,7 @@ Defined in: [lib/text.ts:350](https://github.com/maiyunnet/kebab/blob/master/lib
|
|
|
127789
127813
|
|
|
127790
127814
|
> **domain**: `string` \| `null`
|
|
127791
127815
|
|
|
127792
|
-
Defined in: [lib/text.ts:
|
|
127816
|
+
Defined in: [lib/text.ts:354](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L354)
|
|
127793
127817
|
|
|
127794
127818
|
***
|
|
127795
127819
|
|
|
@@ -127797,7 +127821,7 @@ Defined in: [lib/text.ts:353](https://github.com/maiyunnet/kebab/blob/master/lib
|
|
|
127797
127821
|
|
|
127798
127822
|
> **sld**: `string` \| `null`
|
|
127799
127823
|
|
|
127800
|
-
Defined in: [lib/text.ts:
|
|
127824
|
+
Defined in: [lib/text.ts:353](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L353)
|
|
127801
127825
|
|
|
127802
127826
|
***
|
|
127803
127827
|
|
|
@@ -127805,7 +127829,7 @@ Defined in: [lib/text.ts:352](https://github.com/maiyunnet/kebab/blob/master/lib
|
|
|
127805
127829
|
|
|
127806
127830
|
> **sub**: `string` \| `null`
|
|
127807
127831
|
|
|
127808
|
-
Defined in: [lib/text.ts:
|
|
127832
|
+
Defined in: [lib/text.ts:355](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L355)
|
|
127809
127833
|
|
|
127810
127834
|
***
|
|
127811
127835
|
|
|
@@ -127813,7 +127837,7 @@ Defined in: [lib/text.ts:354](https://github.com/maiyunnet/kebab/blob/master/lib
|
|
|
127813
127837
|
|
|
127814
127838
|
> **tld**: `string` \| `null`
|
|
127815
127839
|
|
|
127816
|
-
Defined in: [lib/text.ts:
|
|
127840
|
+
Defined in: [lib/text.ts:352](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L352)
|
|
127817
127841
|
|
|
127818
127842
|
lib/text/type-aliases/TFalsy.md
|
|
127819
127843
|
---
|
|
@@ -127828,7 +127852,7 @@ lib/text/type-aliases/TFalsy.md
|
|
|
127828
127852
|
|
|
127829
127853
|
> **TFalsy** = `false` \| `""` \| `0` \| `null` \| `undefined` \| *typeof* `NaN`
|
|
127830
127854
|
|
|
127831
|
-
Defined in: [lib/text.ts:
|
|
127855
|
+
Defined in: [lib/text.ts:785](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L785)
|
|
127832
127856
|
|
|
127833
127857
|
虚假值类型
|
|
127834
127858
|
|
|
@@ -127845,7 +127869,7 @@ lib/text/variables/REGEXP_ASCII.md
|
|
|
127845
127869
|
|
|
127846
127870
|
> `const` **REGEXP\_ASCII**: `RegExp`
|
|
127847
127871
|
|
|
127848
|
-
Defined in: [lib/text.ts:
|
|
127872
|
+
Defined in: [lib/text.ts:324](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L324)
|
|
127849
127873
|
|
|
127850
127874
|
可打印的 ascii 字符集
|
|
127851
127875
|
|
|
@@ -127862,7 +127886,7 @@ lib/text/variables/REGEXP_DOMAIN.md
|
|
|
127862
127886
|
|
|
127863
127887
|
> `const` **REGEXP\_DOMAIN**: `RegExp`
|
|
127864
127888
|
|
|
127865
|
-
Defined in: [lib/text.ts:
|
|
127889
|
+
Defined in: [lib/text.ts:312](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L312)
|
|
127866
127890
|
|
|
127867
127891
|
lib/text/variables/REGEXP_EMAIL.md
|
|
127868
127892
|
---
|
|
@@ -127877,7 +127901,7 @@ lib/text/variables/REGEXP_EMAIL.md
|
|
|
127877
127901
|
|
|
127878
127902
|
> `const` **REGEXP\_EMAIL**: `RegExp`
|
|
127879
127903
|
|
|
127880
|
-
Defined in: [lib/text.ts:
|
|
127904
|
+
Defined in: [lib/text.ts:286](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L286)
|
|
127881
127905
|
|
|
127882
127906
|
lib/time/classes/Time.md
|
|
127883
127907
|
---
|
|
@@ -128675,7 +128699,7 @@ lib/undici/functions/fetch.md
|
|
|
128675
128699
|
|
|
128676
128700
|
> **fetch**(`input`, `init?`): `Promise`\<`Response`\>
|
|
128677
128701
|
|
|
128678
|
-
Defined in: [lib/undici.ts:
|
|
128702
|
+
Defined in: [lib/undici.ts:293](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L293)
|
|
128679
128703
|
|
|
128680
128704
|
发起一个完全兼容 fetch 的请求
|
|
128681
128705
|
|
|
@@ -128710,7 +128734,7 @@ lib/undici/functions/filterHeaders.md
|
|
|
128710
128734
|
|
|
128711
128735
|
> **filterHeaders**(`headers`, `res?`, `filter?`): `Record`\<`string`, `string` \| `string`[]\>
|
|
128712
128736
|
|
|
128713
|
-
Defined in: [lib/undici.ts:
|
|
128737
|
+
Defined in: [lib/undici.ts:673](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L673)
|
|
128714
128738
|
|
|
128715
128739
|
剔除不代理的 header,返回新的 header
|
|
128716
128740
|
|
|
@@ -128751,7 +128775,7 @@ lib/undici/functions/getFormData.md
|
|
|
128751
128775
|
|
|
128752
128776
|
> **getFormData**(): [`FormData`](../formdata/classes/FormData.md)
|
|
128753
128777
|
|
|
128754
|
-
Defined in: [lib/undici.ts:
|
|
128778
|
+
Defined in: [lib/undici.ts:657](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L657)
|
|
128755
128779
|
|
|
128756
128780
|
创建 FormData 对象
|
|
128757
128781
|
|
|
@@ -128834,7 +128858,7 @@ lib/undici/functions/getResponseJson.md
|
|
|
128834
128858
|
|
|
128835
128859
|
> **getResponseJson**(`u`, `opt?`): `Promise`\<`any`\>
|
|
128836
128860
|
|
|
128837
|
-
Defined in: [lib/undici.ts:
|
|
128861
|
+
Defined in: [lib/undici.ts:281](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L281)
|
|
128838
128862
|
|
|
128839
128863
|
发起 GET 请求并解析 JSON 响应
|
|
128840
128864
|
|
|
@@ -128856,7 +128880,7 @@ Defined in: [lib/undici.ts:280](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
128856
128880
|
|
|
128857
128881
|
`Promise`\<`any`\>
|
|
128858
128882
|
|
|
128859
|
-
JSON
|
|
128883
|
+
最后一次响应的 JSON 数据,重试验证未通过也保留;请求或读取失败返回 null;JSON 解析失败返回 false
|
|
128860
128884
|
|
|
128861
128885
|
lib/undici/functions/mproxyData.md
|
|
128862
128886
|
---
|
|
@@ -128871,7 +128895,7 @@ lib/undici/functions/mproxyData.md
|
|
|
128871
128895
|
|
|
128872
128896
|
> **mproxyData**(`ctr`): `any`
|
|
128873
128897
|
|
|
128874
|
-
Defined in: [lib/undici.ts:
|
|
128898
|
+
Defined in: [lib/undici.ts:779](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L779)
|
|
128875
128899
|
|
|
128876
128900
|
获取 mproxy 的附加数据
|
|
128877
128901
|
|
|
@@ -128900,7 +128924,7 @@ lib/undici/functions/mproxy.md
|
|
|
128900
128924
|
|
|
128901
128925
|
> **mproxy**(`ctr`, `auth`, `opt?`): `Promise`\<`number`\>
|
|
128902
128926
|
|
|
128903
|
-
Defined in: [lib/undici.ts:
|
|
128927
|
+
Defined in: [lib/undici.ts:713](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L713)
|
|
128904
128928
|
|
|
128905
128929
|
正向 mproxy 代理,注意提前处理不要自动处理 post 数据,读取 get 的 url 为实际请求地址
|
|
128906
128930
|
get: url, auth
|
|
@@ -129010,7 +129034,7 @@ lib/undici/functions/postJsonResponseJson.md
|
|
|
129010
129034
|
|
|
129011
129035
|
> **postJsonResponseJson**(`u`, `data`, `opt?`): `Promise`\<`any`\>
|
|
129012
129036
|
|
|
129013
|
-
Defined in: [lib/undici.ts:
|
|
129037
|
+
Defined in: [lib/undici.ts:253](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L253)
|
|
129014
129038
|
|
|
129015
129039
|
发起 JSON 请求并解析 JSON 响应
|
|
129016
129040
|
|
|
@@ -129038,7 +129062,7 @@ Defined in: [lib/undici.ts:252](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
129038
129062
|
|
|
129039
129063
|
`Promise`\<`any`\>
|
|
129040
129064
|
|
|
129041
|
-
JSON
|
|
129065
|
+
最后一次响应的 JSON 数据,重试验证未通过也保留;请求或读取失败返回 null;JSON 解析失败返回 false
|
|
129042
129066
|
|
|
129043
129067
|
lib/undici/functions/post.md
|
|
129044
129068
|
---
|
|
@@ -129094,7 +129118,7 @@ lib/undici/functions/postResponseJson.md
|
|
|
129094
129118
|
|
|
129095
129119
|
> **postResponseJson**(`u`, `data`, `opt?`): `Promise`\<`any`\>
|
|
129096
129120
|
|
|
129097
|
-
Defined in: [lib/undici.ts:
|
|
129121
|
+
Defined in: [lib/undici.ts:268](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L268)
|
|
129098
129122
|
|
|
129099
129123
|
发起 POST 请求并解析 JSON 响应
|
|
129100
129124
|
|
|
@@ -129122,7 +129146,7 @@ Defined in: [lib/undici.ts:267](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
129122
129146
|
|
|
129123
129147
|
`Promise`\<`any`\>
|
|
129124
129148
|
|
|
129125
|
-
JSON
|
|
129149
|
+
最后一次响应的 JSON 数据,重试验证未通过也保留;请求或读取失败返回 null;JSON 解析失败返回 false
|
|
129126
129150
|
|
|
129127
129151
|
lib/undici/functions/request.md
|
|
129128
129152
|
---
|
|
@@ -129137,7 +129161,7 @@ lib/undici/functions/request.md
|
|
|
129137
129161
|
|
|
129138
129162
|
> **request**(`u`, `data?`, `opt?`): `Promise`\<[`Response`](../response/classes/Response.md)\>
|
|
129139
129163
|
|
|
129140
|
-
Defined in: [lib/undici.ts:
|
|
129164
|
+
Defined in: [lib/undici.ts:471](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L471)
|
|
129141
129165
|
|
|
129142
129166
|
发起一个请求
|
|
129143
129167
|
|
|
@@ -129174,7 +129198,7 @@ lib/undici/functions/rproxy.md
|
|
|
129174
129198
|
|
|
129175
129199
|
> **rproxy**(`ctr`, `route`, `opt?`): `Promise`\<`boolean`\>
|
|
129176
129200
|
|
|
129177
|
-
Defined in: [lib/undici.ts:
|
|
129201
|
+
Defined in: [lib/undici.ts:809](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L809)
|
|
129178
129202
|
|
|
129179
129203
|
反向代理,将本服务器的某个路由反代到其他网址
|
|
129180
129204
|
|
|
@@ -129263,7 +129287,7 @@ lib/undici/interfaces/IMproxyOptions.md
|
|
|
129263
129287
|
|
|
129264
129288
|
# Interface: IMproxyOptions
|
|
129265
129289
|
|
|
129266
|
-
Defined in: [lib/undici.ts:
|
|
129290
|
+
Defined in: [lib/undici.ts:944](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L944)
|
|
129267
129291
|
|
|
129268
129292
|
正向代理请求的传入参数选项
|
|
129269
129293
|
|
|
@@ -129273,7 +129297,7 @@ Defined in: [lib/undici.ts:943](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
129273
129297
|
|
|
129274
129298
|
> `optional` **filter?**: (`h`) => `boolean`
|
|
129275
129299
|
|
|
129276
|
-
Defined in: [lib/undici.ts:
|
|
129300
|
+
Defined in: [lib/undici.ts:957](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L957)
|
|
129277
129301
|
|
|
129278
129302
|
过滤 header,返回 true 则留下
|
|
129279
129303
|
|
|
@@ -129293,7 +129317,7 @@ Defined in: [lib/undici.ts:956](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
129293
129317
|
|
|
129294
129318
|
> `optional` **follow?**: `number`
|
|
129295
129319
|
|
|
129296
|
-
Defined in: [lib/undici.ts:
|
|
129320
|
+
Defined in: [lib/undici.ts:947](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L947)
|
|
129297
129321
|
|
|
129298
129322
|
***
|
|
129299
129323
|
|
|
@@ -129301,7 +129325,7 @@ Defined in: [lib/undici.ts:946](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
129301
129325
|
|
|
129302
129326
|
> `optional` **headers?**: [`THttpHeaders`](../type-aliases/THttpHeaders.md)
|
|
129303
129327
|
|
|
129304
|
-
Defined in: [lib/undici.ts:
|
|
129328
|
+
Defined in: [lib/undici.ts:951](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L951)
|
|
129305
129329
|
|
|
129306
129330
|
***
|
|
129307
129331
|
|
|
@@ -129309,7 +129333,7 @@ Defined in: [lib/undici.ts:950](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
129309
129333
|
|
|
129310
129334
|
> `optional` **hosts?**: `string` \| `Record`\<`string`, `string`\>
|
|
129311
129335
|
|
|
129312
|
-
Defined in: [lib/undici.ts:
|
|
129336
|
+
Defined in: [lib/undici.ts:949](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L949)
|
|
129313
129337
|
|
|
129314
129338
|
自定义 host 映射,如 {'www.maiyun.net': '127.0.0.1'},或全部映射到一个 host
|
|
129315
129339
|
|
|
@@ -129319,7 +129343,7 @@ Defined in: [lib/undici.ts:948](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
129319
129343
|
|
|
129320
129344
|
> `optional` **keepAliveTimeout?**: `number`
|
|
129321
129345
|
|
|
129322
|
-
Defined in: [lib/undici.ts:
|
|
129346
|
+
Defined in: [lib/undici.ts:953](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L953)
|
|
129323
129347
|
|
|
129324
129348
|
空闲连接允许复用的最长秒数;非正数或无效值按未设置处理;默认无服务端提示时为 4 秒,有提示时采用提示值减 2 秒且最多 600 秒
|
|
129325
129349
|
|
|
@@ -129329,7 +129353,7 @@ Defined in: [lib/undici.ts:952](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
129329
129353
|
|
|
129330
129354
|
> `optional` **local?**: `string`
|
|
129331
129355
|
|
|
129332
|
-
Defined in: [lib/undici.ts:
|
|
129356
|
+
Defined in: [lib/undici.ts:950](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L950)
|
|
129333
129357
|
|
|
129334
129358
|
***
|
|
129335
129359
|
|
|
@@ -129337,7 +129361,7 @@ Defined in: [lib/undici.ts:949](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
129337
129361
|
|
|
129338
129362
|
> `optional` **reuse?**: `string` \| `Agent` \| `ProxyAgent`
|
|
129339
129363
|
|
|
129340
|
-
Defined in: [lib/undici.ts:
|
|
129364
|
+
Defined in: [lib/undici.ts:959](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L959)
|
|
129341
129365
|
|
|
129342
129366
|
默认为 default
|
|
129343
129367
|
|
|
@@ -129347,7 +129371,7 @@ Defined in: [lib/undici.ts:958](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
129347
129371
|
|
|
129348
129372
|
> `optional` **reuseTimeout?**: `number`
|
|
129349
129373
|
|
|
129350
|
-
Defined in: [lib/undici.ts:
|
|
129374
|
+
Defined in: [lib/undici.ts:955](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L955)
|
|
129351
129375
|
|
|
129352
129376
|
连接建立后允许承接新请求的最长秒数;非正数或无效值按未设置处理;达到后不再复用但不会中断在途请求,默认不限制
|
|
129353
129377
|
|
|
@@ -129357,7 +129381,7 @@ Defined in: [lib/undici.ts:954](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
129357
129381
|
|
|
129358
129382
|
> `optional` **timeout?**: `number`
|
|
129359
129383
|
|
|
129360
|
-
Defined in: [lib/undici.ts:
|
|
129384
|
+
Defined in: [lib/undici.ts:946](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L946)
|
|
129361
129385
|
|
|
129362
129386
|
秒数,默认 300 秒
|
|
129363
129387
|
|
|
@@ -129372,7 +129396,7 @@ lib/undici/interfaces/IRequestOptions.md
|
|
|
129372
129396
|
|
|
129373
129397
|
# Interface: IRequestOptions
|
|
129374
129398
|
|
|
129375
|
-
Defined in: [lib/undici.ts:
|
|
129399
|
+
Defined in: [lib/undici.ts:901](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L901)
|
|
129376
129400
|
|
|
129377
129401
|
请求的传入参数选项
|
|
129378
129402
|
|
|
@@ -129382,7 +129406,7 @@ Defined in: [lib/undici.ts:900](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
129382
129406
|
|
|
129383
129407
|
> `optional` **cookie?**: `Record`\<`string`, [`ICookie`](../../cookie/interfaces/ICookie.md)\>
|
|
129384
129408
|
|
|
129385
|
-
Defined in: [lib/undici.ts:
|
|
129409
|
+
Defined in: [lib/undici.ts:936](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L936)
|
|
129386
129410
|
|
|
129387
129411
|
cookie 托管对象
|
|
129388
129412
|
|
|
@@ -129392,7 +129416,7 @@ cookie 托管对象
|
|
|
129392
129416
|
|
|
129393
129417
|
> `optional` **follow?**: `number`
|
|
129394
129418
|
|
|
129395
|
-
Defined in: [lib/undici.ts:
|
|
129419
|
+
Defined in: [lib/undici.ts:913](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L913)
|
|
129396
129420
|
|
|
129397
129421
|
追踪 location 次数,0 为不追踪,默认为 0
|
|
129398
129422
|
|
|
@@ -129402,7 +129426,7 @@ Defined in: [lib/undici.ts:912](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
129402
129426
|
|
|
129403
129427
|
> `optional` **headers?**: [`THttpHeaders`](../type-aliases/THttpHeaders.md)
|
|
129404
129428
|
|
|
129405
|
-
Defined in: [lib/undici.ts:
|
|
129429
|
+
Defined in: [lib/undici.ts:918](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L918)
|
|
129406
129430
|
|
|
129407
129431
|
***
|
|
129408
129432
|
|
|
@@ -129410,7 +129434,7 @@ Defined in: [lib/undici.ts:917](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
129410
129434
|
|
|
129411
129435
|
> `optional` **hosts?**: `string` \| `Record`\<`string`, `string`\>
|
|
129412
129436
|
|
|
129413
|
-
Defined in: [lib/undici.ts:
|
|
129437
|
+
Defined in: [lib/undici.ts:915](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L915)
|
|
129414
129438
|
|
|
129415
129439
|
自定义 host 映射,如 {'www.maiyun.net': '127.0.0.1'},或全部映射到一个 host
|
|
129416
129440
|
|
|
@@ -129420,7 +129444,7 @@ Defined in: [lib/undici.ts:914](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
129420
129444
|
|
|
129421
129445
|
> `optional` **keep?**: `boolean`
|
|
129422
129446
|
|
|
129423
|
-
Defined in: [lib/undici.ts:
|
|
129447
|
+
Defined in: [lib/undici.ts:928](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L928)
|
|
129424
129448
|
|
|
129425
129449
|
连接是否保持长连接(即是否允许复用),默认为 true
|
|
129426
129450
|
|
|
@@ -129430,7 +129454,7 @@ Defined in: [lib/undici.ts:927](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
129430
129454
|
|
|
129431
129455
|
> `optional` **keepAliveTimeout?**: `number`
|
|
129432
129456
|
|
|
129433
|
-
Defined in: [lib/undici.ts:
|
|
129457
|
+
Defined in: [lib/undici.ts:930](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L930)
|
|
129434
129458
|
|
|
129435
129459
|
空闲连接允许复用的最长秒数;非正数或无效值按未设置处理;默认无服务端提示时为 4 秒,有提示时采用提示值减 2 秒且最多 600 秒;自定义 Agent 由其自身配置
|
|
129436
129460
|
|
|
@@ -129440,7 +129464,7 @@ Defined in: [lib/undici.ts:929](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
129440
129464
|
|
|
129441
129465
|
> `optional` **local?**: `string`
|
|
129442
129466
|
|
|
129443
|
-
Defined in: [lib/undici.ts:
|
|
129467
|
+
Defined in: [lib/undici.ts:917](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L917)
|
|
129444
129468
|
|
|
129445
129469
|
***
|
|
129446
129470
|
|
|
@@ -129448,7 +129472,7 @@ Defined in: [lib/undici.ts:916](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
129448
129472
|
|
|
129449
129473
|
> `optional` **log?**: `boolean`
|
|
129450
129474
|
|
|
129451
|
-
Defined in: [lib/undici.ts:
|
|
129475
|
+
Defined in: [lib/undici.ts:938](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L938)
|
|
129452
129476
|
|
|
129453
129477
|
若有异常写入文件日志,默认为 true
|
|
129454
129478
|
|
|
@@ -129458,7 +129482,7 @@ Defined in: [lib/undici.ts:937](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
129458
129482
|
|
|
129459
129483
|
> `optional` **method?**: `"GET"` \| `"POST"` \| `"PUT"` \| `"DELETE"` \| `"OPTIONS"`
|
|
129460
129484
|
|
|
129461
|
-
Defined in: [lib/undici.ts:
|
|
129485
|
+
Defined in: [lib/undici.ts:902](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L902)
|
|
129462
129486
|
|
|
129463
129487
|
***
|
|
129464
129488
|
|
|
@@ -129466,7 +129490,7 @@ Defined in: [lib/undici.ts:901](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
129466
129490
|
|
|
129467
129491
|
> `optional` **mproxy?**: `object`
|
|
129468
129492
|
|
|
129469
|
-
Defined in: [lib/undici.ts:
|
|
129493
|
+
Defined in: [lib/undici.ts:920](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L920)
|
|
129470
129494
|
|
|
129471
129495
|
正向 mproxy 代理,url 如 https://xxx/abc
|
|
129472
129496
|
|
|
@@ -129494,7 +129518,7 @@ Defined in: [lib/undici.ts:919](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
129494
129518
|
|
|
129495
129519
|
> `optional` **retry?**: `number`
|
|
129496
129520
|
|
|
129497
|
-
Defined in: [lib/undici.ts:
|
|
129521
|
+
Defined in: [lib/undici.ts:907](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L907)
|
|
129498
129522
|
|
|
129499
129523
|
网络异常后的重试次数,默认 0;流式请求体不可重试,非幂等请求需由调用方保证安全
|
|
129500
129524
|
|
|
@@ -129504,9 +129528,9 @@ Defined in: [lib/undici.ts:906](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
129504
129528
|
|
|
129505
129529
|
> `optional` **retryJson?**: `number`
|
|
129506
129530
|
|
|
129507
|
-
Defined in: [lib/undici.ts:
|
|
129531
|
+
Defined in: [lib/undici.ts:909](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L909)
|
|
129508
129532
|
|
|
129509
|
-
JSON
|
|
129533
|
+
JSON 解析失败或重试验证未通过后的重试次数,默认 0;仅适用于 ResponseJson 快捷方法,非幂等请求需由调用方保证安全
|
|
129510
129534
|
|
|
129511
129535
|
***
|
|
129512
129536
|
|
|
@@ -129514,9 +129538,9 @@ JSON 解析失败后的重试次数,默认 0;仅适用于 ResponseJson 快
|
|
|
129514
129538
|
|
|
129515
129539
|
> `optional` **retryJsonHandler?**: (`json`) => `boolean`
|
|
129516
129540
|
|
|
129517
|
-
Defined in: [lib/undici.ts:
|
|
129541
|
+
Defined in: [lib/undici.ts:911](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L911)
|
|
129518
129542
|
|
|
129519
|
-
JSON 重试验证方法;返回 false 时按 retryJson
|
|
129543
|
+
JSON 重试验证方法;返回 false 时按 retryJson 的设置重试,耗尽后仍返回最后一次解析结果,业务结果由调用方判断;仅适用于 ResponseJson 快捷方法
|
|
129520
129544
|
|
|
129521
129545
|
#### Parameters
|
|
129522
129546
|
|
|
@@ -129534,7 +129558,7 @@ JSON 重试验证方法;返回 false 时按 retryJson 的设置重试,仅适
|
|
|
129534
129558
|
|
|
129535
129559
|
> `optional` **reuse?**: `string` \| `Agent` \| `ProxyAgent`
|
|
129536
129560
|
|
|
129537
|
-
Defined in: [lib/undici.ts:
|
|
129561
|
+
Defined in: [lib/undici.ts:934](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L934)
|
|
129538
129562
|
|
|
129539
129563
|
复用池名/Agent,默认为 default
|
|
129540
129564
|
|
|
@@ -129544,7 +129568,7 @@ Defined in: [lib/undici.ts:933](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
129544
129568
|
|
|
129545
129569
|
> `optional` **reuseTimeout?**: `number`
|
|
129546
129570
|
|
|
129547
|
-
Defined in: [lib/undici.ts:
|
|
129571
|
+
Defined in: [lib/undici.ts:932](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L932)
|
|
129548
129572
|
|
|
129549
129573
|
连接建立后允许承接新请求的最长秒数;非正数或无效值按未设置处理;达到后不再复用但不会中断在途请求,默认不限制;自定义 Agent 由其自身配置
|
|
129550
129574
|
|
|
@@ -129554,7 +129578,7 @@ Defined in: [lib/undici.ts:931](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
129554
129578
|
|
|
129555
129579
|
> `optional` **save?**: `string`
|
|
129556
129580
|
|
|
129557
|
-
Defined in: [lib/undici.ts:
|
|
129581
|
+
Defined in: [lib/undici.ts:916](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L916)
|
|
129558
129582
|
|
|
129559
129583
|
***
|
|
129560
129584
|
|
|
@@ -129562,7 +129586,7 @@ Defined in: [lib/undici.ts:915](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
129562
129586
|
|
|
129563
129587
|
> `optional` **signal?**: `AbortSignal`
|
|
129564
129588
|
|
|
129565
|
-
Defined in: [lib/undici.ts:
|
|
129589
|
+
Defined in: [lib/undici.ts:940](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L940)
|
|
129566
129590
|
|
|
129567
129591
|
请求中止信号
|
|
129568
129592
|
|
|
@@ -129572,7 +129596,7 @@ Defined in: [lib/undici.ts:939](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
129572
129596
|
|
|
129573
129597
|
> `optional` **timeout?**: `number`
|
|
129574
129598
|
|
|
129575
|
-
Defined in: [lib/undici.ts:
|
|
129599
|
+
Defined in: [lib/undici.ts:905](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L905)
|
|
129576
129600
|
|
|
129577
129601
|
秒数,默认 300 秒
|
|
129578
129602
|
|
|
@@ -129582,7 +129606,7 @@ Defined in: [lib/undici.ts:904](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
129582
129606
|
|
|
129583
129607
|
> `optional` **type?**: `"form"` \| `"json"`
|
|
129584
129608
|
|
|
129585
|
-
Defined in: [lib/undici.ts:
|
|
129609
|
+
Defined in: [lib/undici.ts:903](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L903)
|
|
129586
129610
|
|
|
129587
129611
|
lib/undici/interfaces/IRproxyOptions.md
|
|
129588
129612
|
---
|
|
@@ -129595,7 +129619,7 @@ lib/undici/interfaces/IRproxyOptions.md
|
|
|
129595
129619
|
|
|
129596
129620
|
# Interface: IRproxyOptions
|
|
129597
129621
|
|
|
129598
|
-
Defined in: [lib/undici.ts:
|
|
129622
|
+
Defined in: [lib/undici.ts:963](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L963)
|
|
129599
129623
|
|
|
129600
129624
|
反向代理请求的传入参数选项
|
|
129601
129625
|
|
|
@@ -129605,7 +129629,7 @@ Defined in: [lib/undici.ts:962](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
129605
129629
|
|
|
129606
129630
|
> `optional` **body?**: `string` \| `Buffer`\<`ArrayBufferLike`\> \| `Readable`
|
|
129607
129631
|
|
|
129608
|
-
Defined in: [lib/undici.ts:
|
|
129632
|
+
Defined in: [lib/undici.ts:986](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L986)
|
|
129609
129633
|
|
|
129610
129634
|
手动传入请求体(优先于原始 req 流),用于 req 流已消费后仍需转发 body 的场景
|
|
129611
129635
|
|
|
@@ -129615,7 +129639,7 @@ Defined in: [lib/undici.ts:985](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
129615
129639
|
|
|
129616
129640
|
> `optional` **filter?**: (`h`) => `boolean`
|
|
129617
129641
|
|
|
129618
|
-
Defined in: [lib/undici.ts:
|
|
129642
|
+
Defined in: [lib/undici.ts:976](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L976)
|
|
129619
129643
|
|
|
129620
129644
|
过滤 header,返回 true 则留下
|
|
129621
129645
|
|
|
@@ -129635,7 +129659,7 @@ Defined in: [lib/undici.ts:975](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
129635
129659
|
|
|
129636
129660
|
> `optional` **follow?**: `number`
|
|
129637
129661
|
|
|
129638
|
-
Defined in: [lib/undici.ts:
|
|
129662
|
+
Defined in: [lib/undici.ts:966](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L966)
|
|
129639
129663
|
|
|
129640
129664
|
***
|
|
129641
129665
|
|
|
@@ -129643,7 +129667,7 @@ Defined in: [lib/undici.ts:965](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
129643
129667
|
|
|
129644
129668
|
> `optional` **headers?**: [`THttpHeaders`](../type-aliases/THttpHeaders.md)
|
|
129645
129669
|
|
|
129646
|
-
Defined in: [lib/undici.ts:
|
|
129670
|
+
Defined in: [lib/undici.ts:970](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L970)
|
|
129647
129671
|
|
|
129648
129672
|
***
|
|
129649
129673
|
|
|
@@ -129651,7 +129675,7 @@ Defined in: [lib/undici.ts:969](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
129651
129675
|
|
|
129652
129676
|
> `optional` **hosts?**: `string` \| `Record`\<`string`, `string`\>
|
|
129653
129677
|
|
|
129654
|
-
Defined in: [lib/undici.ts:
|
|
129678
|
+
Defined in: [lib/undici.ts:968](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L968)
|
|
129655
129679
|
|
|
129656
129680
|
自定义 host 映射,如 {'www.maiyun.net': '127.0.0.1'},或全部映射到一个 host
|
|
129657
129681
|
|
|
@@ -129661,7 +129685,7 @@ Defined in: [lib/undici.ts:967](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
129661
129685
|
|
|
129662
129686
|
> `optional` **keepAliveTimeout?**: `number`
|
|
129663
129687
|
|
|
129664
|
-
Defined in: [lib/undici.ts:
|
|
129688
|
+
Defined in: [lib/undici.ts:972](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L972)
|
|
129665
129689
|
|
|
129666
129690
|
空闲连接允许复用的最长秒数;非正数或无效值按未设置处理;默认无服务端提示时为 4 秒,有提示时采用提示值减 2 秒且最多 600 秒
|
|
129667
129691
|
|
|
@@ -129671,7 +129695,7 @@ Defined in: [lib/undici.ts:971](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
129671
129695
|
|
|
129672
129696
|
> `optional` **local?**: `string`
|
|
129673
129697
|
|
|
129674
|
-
Defined in: [lib/undici.ts:
|
|
129698
|
+
Defined in: [lib/undici.ts:969](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L969)
|
|
129675
129699
|
|
|
129676
129700
|
***
|
|
129677
129701
|
|
|
@@ -129679,7 +129703,7 @@ Defined in: [lib/undici.ts:968](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
129679
129703
|
|
|
129680
129704
|
> `optional` **mproxy?**: `object`
|
|
129681
129705
|
|
|
129682
|
-
Defined in: [lib/undici.ts:
|
|
129706
|
+
Defined in: [lib/undici.ts:978](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L978)
|
|
129683
129707
|
|
|
129684
129708
|
正向 mproxy 代理,url 如 https://xxx/abc
|
|
129685
129709
|
|
|
@@ -129707,7 +129731,7 @@ Defined in: [lib/undici.ts:977](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
129707
129731
|
|
|
129708
129732
|
> `optional` **querys?**: `Record`\<`string`, `any`\>
|
|
129709
129733
|
|
|
129710
|
-
Defined in: [lib/undici.ts:
|
|
129734
|
+
Defined in: [lib/undici.ts:988](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L988)
|
|
129711
129735
|
|
|
129712
129736
|
自定义 GET 查询参数,传入后直接替换代理目标 URL 的整个 query string
|
|
129713
129737
|
|
|
@@ -129717,7 +129741,7 @@ Defined in: [lib/undici.ts:987](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
129717
129741
|
|
|
129718
129742
|
> `optional` **reuse?**: `string` \| `Agent` \| `ProxyAgent`
|
|
129719
129743
|
|
|
129720
|
-
Defined in: [lib/undici.ts:
|
|
129744
|
+
Defined in: [lib/undici.ts:990](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L990)
|
|
129721
129745
|
|
|
129722
129746
|
默认为 default
|
|
129723
129747
|
|
|
@@ -129727,7 +129751,7 @@ Defined in: [lib/undici.ts:989](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
129727
129751
|
|
|
129728
129752
|
> `optional` **reuseTimeout?**: `number`
|
|
129729
129753
|
|
|
129730
|
-
Defined in: [lib/undici.ts:
|
|
129754
|
+
Defined in: [lib/undici.ts:974](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L974)
|
|
129731
129755
|
|
|
129732
129756
|
连接建立后允许承接新请求的最长秒数;非正数或无效值按未设置处理;达到后不再复用但不会中断在途请求,默认不限制
|
|
129733
129757
|
|
|
@@ -129737,7 +129761,7 @@ Defined in: [lib/undici.ts:973](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
129737
129761
|
|
|
129738
129762
|
> `optional` **timeout?**: `number`
|
|
129739
129763
|
|
|
129740
|
-
Defined in: [lib/undici.ts:
|
|
129764
|
+
Defined in: [lib/undici.ts:965](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L965)
|
|
129741
129765
|
|
|
129742
129766
|
秒数,默认 300 秒
|
|
129743
129767
|
|
|
@@ -130292,7 +130316,7 @@ lib/undici/type-aliases/THttpHeaders.md
|
|
|
130292
130316
|
|
|
130293
130317
|
> **THttpHeaders** = `http.IncomingHttpHeaders` & `object`
|
|
130294
130318
|
|
|
130295
|
-
Defined in: [lib/undici.ts:
|
|
130319
|
+
Defined in: [lib/undici.ts:995](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L995)
|
|
130296
130320
|
|
|
130297
130321
|
http headers
|
|
130298
130322
|
|
|
@@ -138093,7 +138117,7 @@ sys/route/functions/clearKebabConfigs.md
|
|
|
138093
138117
|
|
|
138094
138118
|
Defined in: [sys/route.ts:29](https://github.com/maiyunnet/kebab/blob/master/sys/route.ts#L29)
|
|
138095
138119
|
|
|
138096
|
-
|
|
138120
|
+
清空缓存的项目配置,下次请求时重新读取文件
|
|
138097
138121
|
|
|
138098
138122
|
## Returns
|
|
138099
138123
|
|
|
@@ -138112,7 +138136,7 @@ sys/route/functions/getFormData.md
|
|
|
138112
138136
|
|
|
138113
138137
|
> **getFormData**(`req`, `events?`, `limits?`): `Promise`\<`false` \| \{ `files`: `Record`\<`string`, [`IPostFile`](../../../index/interfaces/IPostFile.md) \| [`IPostFile`](../../../index/interfaces/IPostFile.md)[]\>; `post`: `Record`\<`string`, [`Json`](../../../index/type-aliases/Json.md)\>; \}\>
|
|
138114
138138
|
|
|
138115
|
-
Defined in: [sys/route.ts:
|
|
138139
|
+
Defined in: [sys/route.ts:1092](https://github.com/maiyunnet/kebab/blob/master/sys/route.ts#L1092)
|
|
138116
138140
|
|
|
138117
138141
|
获取 formdata 的 post
|
|
138118
138142
|
|
|
@@ -138155,7 +138179,7 @@ sys/route/functions/getPost.md
|
|
|
138155
138179
|
|
|
138156
138180
|
> **getPost**(`req`): `Promise`\<`false` \| \{ `input`: `string`; `post`: `Record`\<`string`, `any`\>; `raw`: `Record`\<`string`, `any`\>; \}\>
|
|
138157
138181
|
|
|
138158
|
-
Defined in: [sys/route.ts:
|
|
138182
|
+
Defined in: [sys/route.ts:927](https://github.com/maiyunnet/kebab/blob/master/sys/route.ts#L927)
|
|
138159
138183
|
|
|
138160
138184
|
获取 post 对象(通常已自动获取),如果是文件上传(formdata)的情况则不获取
|
|
138161
138185
|
|
|
@@ -138273,7 +138297,7 @@ sys/route/functions/unlinkUploadFiles.md
|
|
|
138273
138297
|
|
|
138274
138298
|
> **unlinkUploadFiles**(`cctr`): `Promise`\<`void`\>
|
|
138275
138299
|
|
|
138276
|
-
Defined in: [sys/route.ts:
|
|
138300
|
+
Defined in: [sys/route.ts:885](https://github.com/maiyunnet/kebab/blob/master/sys/route.ts#L885)
|
|
138277
138301
|
|
|
138278
138302
|
删除本次请求所有已上传的临时文件
|
|
138279
138303
|
|
|
@@ -138302,7 +138326,7 @@ sys/route/functions/waitCtr.md
|
|
|
138302
138326
|
|
|
138303
138327
|
> **waitCtr**(`cctr`): `Promise`\<`void`\>
|
|
138304
138328
|
|
|
138305
|
-
Defined in: [sys/route.ts:
|
|
138329
|
+
Defined in: [sys/route.ts:905](https://github.com/maiyunnet/kebab/blob/master/sys/route.ts#L905)
|
|
138306
138330
|
|
|
138307
138331
|
等待异步任务结束,并删除临时文件,如果结束后还有事务没关闭,则会在本函数中打印控制台并且写入 log 文件
|
|
138308
138332
|
此时其实已经给客户端返回了,此处等待不消耗客户端的等待时间
|
|
@@ -138356,9 +138380,9 @@ sys/route/interfaces/IFormDataError.md
|
|
|
138356
138380
|
|
|
138357
138381
|
# Interface: IFormDataError
|
|
138358
138382
|
|
|
138359
|
-
Defined in: [sys/route.ts:
|
|
138383
|
+
Defined in: [sys/route.ts:1047](https://github.com/maiyunnet/kebab/blob/master/sys/route.ts#L1047)
|
|
138360
138384
|
|
|
138361
|
-
|
|
138385
|
+
解析上传数据时的失败原因,只提供错误码和限制值,不带临时路径或异常对象
|
|
138362
138386
|
|
|
138363
138387
|
## Properties
|
|
138364
138388
|
|
|
@@ -138366,7 +138390,7 @@ multipart 解析首次失败的安全诊断,不包含临时路径或异常对
|
|
|
138366
138390
|
|
|
138367
138391
|
> **code**: `"INVALID_BOUNDARY"` \| `"FILE_TOO_LARGE"` \| `"TOTAL_TOO_LARGE"` \| `"FIELD_TOO_LARGE"` \| `"HEADER_TOO_LARGE"` \| `"TOO_MANY_PARTS"` \| `"FILE_TYPE"` \| `"TIMEOUT"` \| `"TEMP_FILE_ERROR"` \| `"REQUEST_ERROR"` \| `"REQUEST_ABORTED"`
|
|
138368
138392
|
|
|
138369
|
-
Defined in: [sys/route.ts:
|
|
138393
|
+
Defined in: [sys/route.ts:1048](https://github.com/maiyunnet/kebab/blob/master/sys/route.ts#L1048)
|
|
138370
138394
|
|
|
138371
138395
|
***
|
|
138372
138396
|
|
|
@@ -138374,9 +138398,9 @@ Defined in: [sys/route.ts:1035](https://github.com/maiyunnet/kebab/blob/master/s
|
|
|
138374
138398
|
|
|
138375
138399
|
> `optional` **limit?**: `number`
|
|
138376
138400
|
|
|
138377
|
-
Defined in: [sys/route.ts:
|
|
138401
|
+
Defined in: [sys/route.ts:1052](https://github.com/maiyunnet/kebab/blob/master/sys/route.ts#L1052)
|
|
138378
138402
|
|
|
138379
|
-
|
|
138403
|
+
超出的限制值:大小用字节,超时用毫秒,字段和文件数量用个
|
|
138380
138404
|
|
|
138381
138405
|
sys/route/interfaces/IFormDataEvents.md
|
|
138382
138406
|
---
|
|
@@ -138389,7 +138413,7 @@ sys/route/interfaces/IFormDataEvents.md
|
|
|
138389
138413
|
|
|
138390
138414
|
# Interface: IFormDataEvents
|
|
138391
138415
|
|
|
138392
|
-
Defined in: [sys/route.ts:
|
|
138416
|
+
Defined in: [sys/route.ts:1056](https://github.com/maiyunnet/kebab/blob/master/sys/route.ts#L1056)
|
|
138393
138417
|
|
|
138394
138418
|
multipart 文件处理及失败通知
|
|
138395
138419
|
|
|
@@ -138399,9 +138423,9 @@ multipart 文件处理及失败通知
|
|
|
138399
138423
|
|
|
138400
138424
|
> `optional` **onerror?**: (`error`) => `void`
|
|
138401
138425
|
|
|
138402
|
-
Defined in: [sys/route.ts:
|
|
138426
|
+
Defined in: [sys/route.ts:1064](https://github.com/maiyunnet/kebab/blob/master/sys/route.ts#L1064)
|
|
138403
138427
|
|
|
138404
|
-
|
|
138428
|
+
首次失败时调用一次,getFormData 返回 false;若连接已断开,可能无法回复客户端
|
|
138405
138429
|
|
|
138406
138430
|
#### Parameters
|
|
138407
138431
|
|
|
@@ -138419,7 +138443,7 @@ Defined in: [sys/route.ts:1051](https://github.com/maiyunnet/kebab/blob/master/s
|
|
|
138419
138443
|
|
|
138420
138444
|
> `optional` **onfiledata?**: (`chunk`) => `void`
|
|
138421
138445
|
|
|
138422
|
-
Defined in: [sys/route.ts:
|
|
138446
|
+
Defined in: [sys/route.ts:1060](https://github.com/maiyunnet/kebab/blob/master/sys/route.ts#L1060)
|
|
138423
138447
|
|
|
138424
138448
|
文件上传时触发,仅 start 返回 true 时触发
|
|
138425
138449
|
|
|
@@ -138439,7 +138463,7 @@ Defined in: [sys/route.ts:1047](https://github.com/maiyunnet/kebab/blob/master/s
|
|
|
138439
138463
|
|
|
138440
138464
|
> `optional` **onfileend?**: () => `void`
|
|
138441
138465
|
|
|
138442
|
-
Defined in: [sys/route.ts:
|
|
138466
|
+
Defined in: [sys/route.ts:1062](https://github.com/maiyunnet/kebab/blob/master/sys/route.ts#L1062)
|
|
138443
138467
|
|
|
138444
138468
|
文件上传结束时触发,仅 start 返回 true 时触发
|
|
138445
138469
|
|
|
@@ -138453,7 +138477,7 @@ Defined in: [sys/route.ts:1049](https://github.com/maiyunnet/kebab/blob/master/s
|
|
|
138453
138477
|
|
|
138454
138478
|
> `optional` **onfilestart?**: (`name`) => `boolean` \| `undefined`
|
|
138455
138479
|
|
|
138456
|
-
Defined in: [sys/route.ts:
|
|
138480
|
+
Defined in: [sys/route.ts:1058](https://github.com/maiyunnet/kebab/blob/master/sys/route.ts#L1058)
|
|
138457
138481
|
|
|
138458
138482
|
文件开始上传时触发,返回 true 则跳过该文件的保存
|
|
138459
138483
|
|
|
@@ -138478,7 +138502,7 @@ sys/route/interfaces/IFormDataLimits.md
|
|
|
138478
138502
|
|
|
138479
138503
|
# Interface: IFormDataLimits
|
|
138480
138504
|
|
|
138481
|
-
Defined in: [sys/route.ts:
|
|
138505
|
+
Defined in: [sys/route.ts:1068](https://github.com/maiyunnet/kebab/blob/master/sys/route.ts#L1068)
|
|
138482
138506
|
|
|
138483
138507
|
multipart 上传限制
|
|
138484
138508
|
|
|
@@ -138488,7 +138512,7 @@ multipart 上传限制
|
|
|
138488
138512
|
|
|
138489
138513
|
> `optional` **allowedExts?**: `string`[]
|
|
138490
138514
|
|
|
138491
|
-
Defined in: [sys/route.ts:
|
|
138515
|
+
Defined in: [sys/route.ts:1072](https://github.com/maiyunnet/kebab/blob/master/sys/route.ts#L1072)
|
|
138492
138516
|
|
|
138493
138517
|
允许的文件扩展名(含点号),如 ['.jpg', '.png', '.pdf']
|
|
138494
138518
|
|
|
@@ -138498,7 +138522,7 @@ Defined in: [sys/route.ts:1059](https://github.com/maiyunnet/kebab/blob/master/s
|
|
|
138498
138522
|
|
|
138499
138523
|
> `optional` **maxFieldSize?**: `number`
|
|
138500
138524
|
|
|
138501
|
-
Defined in: [sys/route.ts:
|
|
138525
|
+
Defined in: [sys/route.ts:1074](https://github.com/maiyunnet/kebab/blob/master/sys/route.ts#L1074)
|
|
138502
138526
|
|
|
138503
138527
|
单个字段(非文件)最大字节数,默认 1 MB
|
|
138504
138528
|
|
|
@@ -138508,7 +138532,7 @@ Defined in: [sys/route.ts:1061](https://github.com/maiyunnet/kebab/blob/master/s
|
|
|
138508
138532
|
|
|
138509
138533
|
> `optional` **maxFileSize?**: `number`
|
|
138510
138534
|
|
|
138511
|
-
Defined in: [sys/route.ts:
|
|
138535
|
+
Defined in: [sys/route.ts:1070](https://github.com/maiyunnet/kebab/blob/master/sys/route.ts#L1070)
|
|
138512
138536
|
|
|
138513
138537
|
单个文件最大字节数
|
|
138514
138538
|
|
|
@@ -138518,9 +138542,9 @@ Defined in: [sys/route.ts:1057](https://github.com/maiyunnet/kebab/blob/master/s
|
|
|
138518
138542
|
|
|
138519
138543
|
> `optional` **maxHeaderSize?**: `number`
|
|
138520
138544
|
|
|
138521
|
-
Defined in: [sys/route.ts:
|
|
138545
|
+
Defined in: [sys/route.ts:1078](https://github.com/maiyunnet/kebab/blob/master/sys/route.ts#L1078)
|
|
138522
138546
|
|
|
138523
|
-
|
|
138547
|
+
每个字段或文件的 multipart 头部最多多少字节,默认 16 KB
|
|
138524
138548
|
|
|
138525
138549
|
***
|
|
138526
138550
|
|
|
@@ -138528,7 +138552,7 @@ Defined in: [sys/route.ts:1065](https://github.com/maiyunnet/kebab/blob/master/s
|
|
|
138528
138552
|
|
|
138529
138553
|
> `optional` **maxParts?**: `number`
|
|
138530
138554
|
|
|
138531
|
-
Defined in: [sys/route.ts:
|
|
138555
|
+
Defined in: [sys/route.ts:1080](https://github.com/maiyunnet/kebab/blob/master/sys/route.ts#L1080)
|
|
138532
138556
|
|
|
138533
138557
|
multipart 字段与文件总数量,默认 1000
|
|
138534
138558
|
|
|
@@ -138538,7 +138562,7 @@ multipart 字段与文件总数量,默认 1000
|
|
|
138538
138562
|
|
|
138539
138563
|
> `optional` **maxTotalSize?**: `number`
|
|
138540
138564
|
|
|
138541
|
-
Defined in: [sys/route.ts:
|
|
138565
|
+
Defined in: [sys/route.ts:1076](https://github.com/maiyunnet/kebab/blob/master/sys/route.ts#L1076)
|
|
138542
138566
|
|
|
138543
138567
|
整体请求最大字节数,不设置或设为 0 则不限制
|
|
138544
138568
|
|
|
@@ -138548,6 +138572,6 @@ Defined in: [sys/route.ts:1063](https://github.com/maiyunnet/kebab/blob/master/s
|
|
|
138548
138572
|
|
|
138549
138573
|
> `optional` **timeout?**: `number`
|
|
138550
138574
|
|
|
138551
|
-
Defined in: [sys/route.ts:
|
|
138575
|
+
Defined in: [sys/route.ts:1082](https://github.com/maiyunnet/kebab/blob/master/sys/route.ts#L1082)
|
|
138552
138576
|
|
|
138553
138577
|
整体请求超时时间(毫秒),默认 5 分钟,设为 0 禁用超时
|