@maiyunnet/kebab 9.23.0 → 9.25.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-vhost.d.ts +2 -0
- package/abox/master-vhost.js +97 -0
- package/abox/request.d.ts +2 -0
- package/abox/request.js +79 -0
- package/doc/kebab-rag.md +156 -96
- package/index.d.ts +10 -6
- package/index.js +1 -1
- package/lib/core.d.ts +10 -0
- package/lib/core.js +35 -0
- package/lib/undici/response.d.ts +1 -1
- package/package.json +1 -1
- package/sys/child.js +0 -6
- package/sys/master.js +33 -0
- package/sys/route.js +15 -5
- package/www/example/ctr/test.d.ts +3 -0
- package/www/example/ctr/test.js +66 -37
- package/www/example/ws/handler.js +7 -1
- package/www/example/ws/mproxy.js +5 -1
- package/www/example/ws/rproxy.js +7 -1
package/doc/kebab-rag.md
CHANGED
|
@@ -33,6 +33,25 @@ quick-start.md
|
|
|
33
33
|
- `view/`: 视图目录,存放 ejs 文件
|
|
34
34
|
- `ws/`: WebSocket 目录
|
|
35
35
|
|
|
36
|
+
## 全量更新虚拟主机配置
|
|
37
|
+
|
|
38
|
+
`lCore.sendVhost(files, hosts?)` 全量替换目标节点的 `conf/vhost/`,未提交的旧文件及子目录会被移除。`files` 是文件名到 JSON 原文的非空集合,仅接受直接 `.json` 文件名,不允许路径及大小写重名;每份 JSON 为 `IVhost` 或 `IVhost[]`。文件原文会被保留。
|
|
39
|
+
|
|
40
|
+
```ts
|
|
41
|
+
import * as lCore from '@maiyunnet/kebab/lib/core.js';
|
|
42
|
+
|
|
43
|
+
const results = await lCore.sendVhost({
|
|
44
|
+
'default.json': '{"domains":["*"],"root":"default/"}',
|
|
45
|
+
'sites.json': '[{"domains":["example.com"],"root":"example.com/"}]',
|
|
46
|
+
}, 'config');
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
省略 `hosts` 或传入空列表时更新本机;传入 `'config'` 使用全局 `hosts`,也可指定节点列表。各节点独立返回 `{ result, return }`,失败节点可单独重试。接收端复用 RPC 鉴权,通过 POST body 接收配置(上限为现有 POST 解析的 50 MiB),不传输证书或全局配置。
|
|
50
|
+
|
|
51
|
+
同一节点串行执行替换。全部文件校验、写入临时目录成功后,才备份旧目录并切换;切换失败会恢复旧目录。若恢复也失败,返回信息会给出保留的备份目录,需人工恢复;目标 `vhost` 本身是软链接或普通文件时拒绝更新。替换包含两次目录重命名,过程中不要同时执行 reload 或手动修改该目录。
|
|
52
|
+
|
|
53
|
+
此方法不自动 reload,成功仅表示磁盘目录替换完成。确认各节点结果后,自行调用 `sendReload()`;部分节点失败时只向成功节点发送 reload。现有 reload 返回成功表示通知已发送,不代表所有 worker 已加载完成。
|
|
54
|
+
|
|
36
55
|
## 请求主机与完整 URL
|
|
37
56
|
|
|
38
57
|
控制器通过 `this._config.const.hostCanonical` 获取用于 URL 的主机地址:HTTPS 的 443 和 HTTP 的 80 端口会省略,其余端口及 IPv6 方括号保留。`host`、`hostname` 和 `hostport` 保留原有含义。`urlOrigin`、`urlFull` 和 `urlStcFull` 使用 `hostCanonical` 生成,SSR 注入的 `_urlFull`、默认 `_staticPathFull` 同步省略默认端口。
|
|
@@ -508,7 +527,7 @@ Defined in: [index.ts:183](https://github.com/maiyunnet/kebab/blob/master/index.
|
|
|
508
527
|
|
|
509
528
|
> **ctrPath**: `string`
|
|
510
529
|
|
|
511
|
-
Defined in: [index.ts:
|
|
530
|
+
Defined in: [index.ts:219](https://github.com/maiyunnet/kebab/blob/master/index.ts#L219)
|
|
512
531
|
|
|
513
532
|
***
|
|
514
533
|
|
|
@@ -516,7 +535,7 @@ Defined in: [index.ts:215](https://github.com/maiyunnet/kebab/blob/master/index.
|
|
|
516
535
|
|
|
517
536
|
> **dataPath**: `string`
|
|
518
537
|
|
|
519
|
-
Defined in: [index.ts:
|
|
538
|
+
Defined in: [index.ts:221](https://github.com/maiyunnet/kebab/blob/master/index.ts#L221)
|
|
520
539
|
|
|
521
540
|
***
|
|
522
541
|
|
|
@@ -524,9 +543,9 @@ Defined in: [index.ts:217](https://github.com/maiyunnet/kebab/blob/master/index.
|
|
|
524
543
|
|
|
525
544
|
> **host**: `string`
|
|
526
545
|
|
|
527
|
-
Defined in: [index.ts:
|
|
546
|
+
Defined in: [index.ts:201](https://github.com/maiyunnet/kebab/blob/master/index.ts#L201)
|
|
528
547
|
|
|
529
|
-
|
|
548
|
+
请求头中的主机地址,如 example.com、example.com:8443 或 [::1]:8080;不额外补端口
|
|
530
549
|
|
|
531
550
|
***
|
|
532
551
|
|
|
@@ -534,9 +553,9 @@ Defined in: [index.ts:200](https://github.com/maiyunnet/kebab/blob/master/index.
|
|
|
534
553
|
|
|
535
554
|
> **hostCanonical**: `string`
|
|
536
555
|
|
|
537
|
-
Defined in: [index.ts:
|
|
556
|
+
Defined in: [index.ts:207](https://github.com/maiyunnet/kebab/blob/master/index.ts#L207)
|
|
538
557
|
|
|
539
|
-
|
|
558
|
+
用于生成网址的主机地址,仅省略 HTTPS 的 443 和 HTTP 的 80 端口,如 example.com:443 → example.com;保留其他端口和 IPv6 方括号
|
|
540
559
|
|
|
541
560
|
***
|
|
542
561
|
|
|
@@ -544,9 +563,9 @@ Defined in: [index.ts:206](https://github.com/maiyunnet/kebab/blob/master/index.
|
|
|
544
563
|
|
|
545
564
|
> **hostname**: `string`
|
|
546
565
|
|
|
547
|
-
Defined in: [index.ts:
|
|
566
|
+
Defined in: [index.ts:203](https://github.com/maiyunnet/kebab/blob/master/index.ts#L203)
|
|
548
567
|
|
|
549
|
-
|
|
568
|
+
主机名,如 example.com 或 ::1,不含端口或 IPv6 方括号
|
|
550
569
|
|
|
551
570
|
***
|
|
552
571
|
|
|
@@ -554,9 +573,9 @@ Defined in: [index.ts:202](https://github.com/maiyunnet/kebab/blob/master/index.
|
|
|
554
573
|
|
|
555
574
|
> **hostport**: `number`
|
|
556
575
|
|
|
557
|
-
Defined in: [index.ts:
|
|
576
|
+
Defined in: [index.ts:205](https://github.com/maiyunnet/kebab/blob/master/index.ts#L205)
|
|
558
577
|
|
|
559
|
-
|
|
578
|
+
请求地址中的端口,如 8443;未指定时 HTTPS 为 443、HTTP 为 80,不取本机监听端口
|
|
560
579
|
|
|
561
580
|
***
|
|
562
581
|
|
|
@@ -564,7 +583,9 @@ Defined in: [index.ts:204](https://github.com/maiyunnet/kebab/blob/master/index.
|
|
|
564
583
|
|
|
565
584
|
> **https**: `boolean`
|
|
566
585
|
|
|
567
|
-
Defined in: [index.ts:
|
|
586
|
+
Defined in: [index.ts:199](https://github.com/maiyunnet/kebab/blob/master/index.ts#L199)
|
|
587
|
+
|
|
588
|
+
请求到达 Kebab 时是否使用 HTTPS;通过 HTTP 回源时为 false
|
|
568
589
|
|
|
569
590
|
***
|
|
570
591
|
|
|
@@ -588,7 +609,7 @@ Defined in: [index.ts:195](https://github.com/maiyunnet/kebab/blob/master/index.
|
|
|
588
609
|
|
|
589
610
|
> **modPath**: `string`
|
|
590
611
|
|
|
591
|
-
Defined in: [index.ts:
|
|
612
|
+
Defined in: [index.ts:218](https://github.com/maiyunnet/kebab/blob/master/index.ts#L218)
|
|
592
613
|
|
|
593
614
|
***
|
|
594
615
|
|
|
@@ -626,7 +647,7 @@ Defined in: [index.ts:189](https://github.com/maiyunnet/kebab/blob/master/index.
|
|
|
626
647
|
|
|
627
648
|
> **rootPath**: `string`
|
|
628
649
|
|
|
629
|
-
Defined in: [index.ts:
|
|
650
|
+
Defined in: [index.ts:217](https://github.com/maiyunnet/kebab/blob/master/index.ts#L217)
|
|
630
651
|
|
|
631
652
|
***
|
|
632
653
|
|
|
@@ -650,7 +671,7 @@ Defined in: [index.ts:190](https://github.com/maiyunnet/kebab/blob/master/index.
|
|
|
650
671
|
|
|
651
672
|
> **uri**: [`IUrlParse`](IUrlParse.md)
|
|
652
673
|
|
|
653
|
-
Defined in: [index.ts:
|
|
674
|
+
Defined in: [index.ts:213](https://github.com/maiyunnet/kebab/blob/master/index.ts#L213)
|
|
654
675
|
|
|
655
676
|
***
|
|
656
677
|
|
|
@@ -658,7 +679,7 @@ Defined in: [index.ts:209](https://github.com/maiyunnet/kebab/blob/master/index.
|
|
|
658
679
|
|
|
659
680
|
> **urlBase**: `string`
|
|
660
681
|
|
|
661
|
-
Defined in: [index.ts:
|
|
682
|
+
Defined in: [index.ts:226](https://github.com/maiyunnet/kebab/blob/master/index.ts#L226)
|
|
662
683
|
|
|
663
684
|
***
|
|
664
685
|
|
|
@@ -666,7 +687,7 @@ Defined in: [index.ts:222](https://github.com/maiyunnet/kebab/blob/master/index.
|
|
|
666
687
|
|
|
667
688
|
> **urlFull**: `string`
|
|
668
689
|
|
|
669
|
-
Defined in: [index.ts:
|
|
690
|
+
Defined in: [index.ts:228](https://github.com/maiyunnet/kebab/blob/master/index.ts#L228)
|
|
670
691
|
|
|
671
692
|
***
|
|
672
693
|
|
|
@@ -674,9 +695,10 @@ Defined in: [index.ts:224](https://github.com/maiyunnet/kebab/blob/master/index.
|
|
|
674
695
|
|
|
675
696
|
> **urlOrigin**: `string`
|
|
676
697
|
|
|
677
|
-
Defined in: [index.ts:
|
|
698
|
+
Defined in: [index.ts:212](https://github.com/maiyunnet/kebab/blob/master/index.ts#L212)
|
|
678
699
|
|
|
679
|
-
|
|
700
|
+
网址的协议与 hostCanonical,如 https://example.com:8443
|
|
701
|
+
协议可能取自转发头,不能用它判断请求到达 Kebab 时是否使用 HTTPS。
|
|
680
702
|
|
|
681
703
|
***
|
|
682
704
|
|
|
@@ -684,7 +706,7 @@ Defined in: [index.ts:208](https://github.com/maiyunnet/kebab/blob/master/index.
|
|
|
684
706
|
|
|
685
707
|
> **urlStc**: `string`
|
|
686
708
|
|
|
687
|
-
Defined in: [index.ts:
|
|
709
|
+
Defined in: [index.ts:227](https://github.com/maiyunnet/kebab/blob/master/index.ts#L227)
|
|
688
710
|
|
|
689
711
|
***
|
|
690
712
|
|
|
@@ -692,7 +714,7 @@ Defined in: [index.ts:223](https://github.com/maiyunnet/kebab/blob/master/index.
|
|
|
692
714
|
|
|
693
715
|
> **urlStcFull**: `string`
|
|
694
716
|
|
|
695
|
-
Defined in: [index.ts:
|
|
717
|
+
Defined in: [index.ts:229](https://github.com/maiyunnet/kebab/blob/master/index.ts#L229)
|
|
696
718
|
|
|
697
719
|
***
|
|
698
720
|
|
|
@@ -700,7 +722,7 @@ Defined in: [index.ts:225](https://github.com/maiyunnet/kebab/blob/master/index.
|
|
|
700
722
|
|
|
701
723
|
> **viewPath**: `string`
|
|
702
724
|
|
|
703
|
-
Defined in: [index.ts:
|
|
725
|
+
Defined in: [index.ts:220](https://github.com/maiyunnet/kebab/blob/master/index.ts#L220)
|
|
704
726
|
|
|
705
727
|
***
|
|
706
728
|
|
|
@@ -716,7 +738,7 @@ Defined in: [index.ts:196](https://github.com/maiyunnet/kebab/blob/master/index.
|
|
|
716
738
|
|
|
717
739
|
> **wsPath**: `string`
|
|
718
740
|
|
|
719
|
-
Defined in: [index.ts:
|
|
741
|
+
Defined in: [index.ts:222](https://github.com/maiyunnet/kebab/blob/master/index.ts#L222)
|
|
720
742
|
|
|
721
743
|
index/interfaces/IConfigDb.md
|
|
722
744
|
---
|
|
@@ -1276,7 +1298,7 @@ index/interfaces/IPostFile.md
|
|
|
1276
1298
|
|
|
1277
1299
|
# Interface: IPostFile
|
|
1278
1300
|
|
|
1279
|
-
Defined in: [index.ts:
|
|
1301
|
+
Defined in: [index.ts:241](https://github.com/maiyunnet/kebab/blob/master/index.ts#L241)
|
|
1280
1302
|
|
|
1281
1303
|
上传的文件信息对象
|
|
1282
1304
|
|
|
@@ -1286,7 +1308,7 @@ Defined in: [index.ts:237](https://github.com/maiyunnet/kebab/blob/master/index.
|
|
|
1286
1308
|
|
|
1287
1309
|
> `readonly` **name**: `string`
|
|
1288
1310
|
|
|
1289
|
-
Defined in: [index.ts:
|
|
1311
|
+
Defined in: [index.ts:242](https://github.com/maiyunnet/kebab/blob/master/index.ts#L242)
|
|
1290
1312
|
|
|
1291
1313
|
***
|
|
1292
1314
|
|
|
@@ -1294,7 +1316,7 @@ Defined in: [index.ts:238](https://github.com/maiyunnet/kebab/blob/master/index.
|
|
|
1294
1316
|
|
|
1295
1317
|
> `readonly` **origin**: `string`
|
|
1296
1318
|
|
|
1297
|
-
Defined in: [index.ts:
|
|
1319
|
+
Defined in: [index.ts:243](https://github.com/maiyunnet/kebab/blob/master/index.ts#L243)
|
|
1298
1320
|
|
|
1299
1321
|
***
|
|
1300
1322
|
|
|
@@ -1302,7 +1324,7 @@ Defined in: [index.ts:239](https://github.com/maiyunnet/kebab/blob/master/index.
|
|
|
1302
1324
|
|
|
1303
1325
|
> `readonly` **path**: `string`
|
|
1304
1326
|
|
|
1305
|
-
Defined in: [index.ts:
|
|
1327
|
+
Defined in: [index.ts:245](https://github.com/maiyunnet/kebab/blob/master/index.ts#L245)
|
|
1306
1328
|
|
|
1307
1329
|
***
|
|
1308
1330
|
|
|
@@ -1310,7 +1332,7 @@ Defined in: [index.ts:241](https://github.com/maiyunnet/kebab/blob/master/index.
|
|
|
1310
1332
|
|
|
1311
1333
|
> `readonly` **size**: `number`
|
|
1312
1334
|
|
|
1313
|
-
Defined in: [index.ts:
|
|
1335
|
+
Defined in: [index.ts:244](https://github.com/maiyunnet/kebab/blob/master/index.ts#L244)
|
|
1314
1336
|
|
|
1315
1337
|
index/interfaces/IUrlParse.md
|
|
1316
1338
|
---
|
|
@@ -1424,7 +1446,7 @@ index/interfaces/IVhost.md
|
|
|
1424
1446
|
|
|
1425
1447
|
# Interface: IVhost
|
|
1426
1448
|
|
|
1427
|
-
Defined in: [index.ts:
|
|
1449
|
+
Defined in: [index.ts:233](https://github.com/maiyunnet/kebab/blob/master/index.ts#L233)
|
|
1428
1450
|
|
|
1429
1451
|
虚拟机配置对象
|
|
1430
1452
|
|
|
@@ -1434,7 +1456,7 @@ Defined in: [index.ts:229](https://github.com/maiyunnet/kebab/blob/master/index.
|
|
|
1434
1456
|
|
|
1435
1457
|
> `readonly` **domains**: `string`[]
|
|
1436
1458
|
|
|
1437
|
-
Defined in: [index.ts:
|
|
1459
|
+
Defined in: [index.ts:235](https://github.com/maiyunnet/kebab/blob/master/index.ts#L235)
|
|
1438
1460
|
|
|
1439
1461
|
***
|
|
1440
1462
|
|
|
@@ -1442,7 +1464,7 @@ Defined in: [index.ts:231](https://github.com/maiyunnet/kebab/blob/master/index.
|
|
|
1442
1464
|
|
|
1443
1465
|
> `readonly` `optional` **name?**: `string`
|
|
1444
1466
|
|
|
1445
|
-
Defined in: [index.ts:
|
|
1467
|
+
Defined in: [index.ts:234](https://github.com/maiyunnet/kebab/blob/master/index.ts#L234)
|
|
1446
1468
|
|
|
1447
1469
|
***
|
|
1448
1470
|
|
|
@@ -1450,7 +1472,7 @@ Defined in: [index.ts:230](https://github.com/maiyunnet/kebab/blob/master/index.
|
|
|
1450
1472
|
|
|
1451
1473
|
> `readonly` `optional` **remark?**: `string`
|
|
1452
1474
|
|
|
1453
|
-
Defined in: [index.ts:
|
|
1475
|
+
Defined in: [index.ts:237](https://github.com/maiyunnet/kebab/blob/master/index.ts#L237)
|
|
1454
1476
|
|
|
1455
1477
|
***
|
|
1456
1478
|
|
|
@@ -1458,7 +1480,7 @@ Defined in: [index.ts:233](https://github.com/maiyunnet/kebab/blob/master/index.
|
|
|
1458
1480
|
|
|
1459
1481
|
> `readonly` **root**: `string`
|
|
1460
1482
|
|
|
1461
|
-
Defined in: [index.ts:
|
|
1483
|
+
Defined in: [index.ts:236](https://github.com/maiyunnet/kebab/blob/master/index.ts#L236)
|
|
1462
1484
|
|
|
1463
1485
|
index.md
|
|
1464
1486
|
---
|
|
@@ -1737,7 +1759,7 @@ index/variables/VER.md
|
|
|
1737
1759
|
|
|
1738
1760
|
# Variable: VER
|
|
1739
1761
|
|
|
1740
|
-
> `const` **VER**: `"9.
|
|
1762
|
+
> `const` **VER**: `"9.25.0"` = `'9.25.0'`
|
|
1741
1763
|
|
|
1742
1764
|
Defined in: [index.ts:10](https://github.com/maiyunnet/kebab/blob/master/index.ts#L10)
|
|
1743
1765
|
|
|
@@ -3727,7 +3749,7 @@ lib/core/functions/clone.md
|
|
|
3727
3749
|
|
|
3728
3750
|
> **clone**\<`T`\>(`obj`): `T`
|
|
3729
3751
|
|
|
3730
|
-
Defined in: [lib/core.ts:
|
|
3752
|
+
Defined in: [lib/core.ts:1509](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1509)
|
|
3731
3753
|
|
|
3732
3754
|
完整的克隆一份数组/对象
|
|
3733
3755
|
|
|
@@ -3791,7 +3813,7 @@ lib/core/functions/debug.md
|
|
|
3791
3813
|
|
|
3792
3814
|
> **debug**(`message?`, ...`optionalParams`): `void`
|
|
3793
3815
|
|
|
3794
|
-
Defined in: [lib/core.ts:
|
|
3816
|
+
Defined in: [lib/core.ts:1555](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1555)
|
|
3795
3817
|
|
|
3796
3818
|
打印调试信息,线上环境不会打印
|
|
3797
3819
|
|
|
@@ -3826,7 +3848,7 @@ lib/core/functions/display.md
|
|
|
3826
3848
|
|
|
3827
3849
|
> **display**(`message?`, ...`optionalParams`): `void`
|
|
3828
3850
|
|
|
3829
|
-
Defined in: [lib/core.ts:
|
|
3851
|
+
Defined in: [lib/core.ts:1568](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1568)
|
|
3830
3852
|
|
|
3831
3853
|
向控制台直接显示内容,一般情况下禁止使用
|
|
3832
3854
|
|
|
@@ -3938,7 +3960,7 @@ lib/core/functions/getLog.md
|
|
|
3938
3960
|
|
|
3939
3961
|
> **getLog**(`opt`): `Promise`\<`false` \| \{ `list`: `any`[] \| `string`[][]; `total`: `number`; \}\>
|
|
3940
3962
|
|
|
3941
|
-
Defined in: [lib/core.ts:
|
|
3963
|
+
Defined in: [lib/core.ts:1289](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1289)
|
|
3942
3964
|
|
|
3943
3965
|
获取日志内容为一个数组
|
|
3944
3966
|
|
|
@@ -4007,7 +4029,7 @@ lib/core/functions/getMonitorEvent.md
|
|
|
4007
4029
|
|
|
4008
4030
|
> **getMonitorEvent**(`opt`): `Promise`\<`false` \| [`IMonitorEvent`](../interfaces/IMonitorEvent.md) \| `null`\>
|
|
4009
4031
|
|
|
4010
|
-
Defined in: [lib/core.ts:
|
|
4032
|
+
Defined in: [lib/core.ts:1425](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1425)
|
|
4011
4033
|
|
|
4012
4034
|
读取事件详情和文件清单;只解析事件记录,不解析 Profile 或堆快照
|
|
4013
4035
|
|
|
@@ -4044,7 +4066,7 @@ lib/core/functions/getMonitorEvents.md
|
|
|
4044
4066
|
|
|
4045
4067
|
> **getMonitorEvents**(`opt?`): `Promise`\<`false` \| \{ `list`: [`IMonitorEventSummary`](../interfaces/IMonitorEventSummary.md)[]; `total`: `number`; \}\>
|
|
4046
4068
|
|
|
4047
|
-
Defined in: [lib/core.ts:
|
|
4069
|
+
Defined in: [lib/core.ts:1398](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1398)
|
|
4048
4070
|
|
|
4049
4071
|
获取某天已保存的监控事件,按目录时间倒序分页
|
|
4050
4072
|
|
|
@@ -4091,7 +4113,7 @@ lib/core/functions/getMonitorFile.md
|
|
|
4091
4113
|
|
|
4092
4114
|
> **getMonitorFile**(`opt`): `Promise`\<`false` \| [`Response`](../../undici/response/classes/Response.md) \| `null`\>
|
|
4093
4115
|
|
|
4094
|
-
Defined in: [lib/core.ts:
|
|
4116
|
+
Defined in: [lib/core.ts:1449](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1449)
|
|
4095
4117
|
|
|
4096
4118
|
获取监控原始文件的响应,可使用 getStream() 下载;小文件可用 getText()/getJson() 预览
|
|
4097
4119
|
|
|
@@ -4236,7 +4258,7 @@ lib/core/functions/loadEnv.md
|
|
|
4236
4258
|
|
|
4237
4259
|
> **loadEnv**(`dir`): `Promise`\<`void`\>
|
|
4238
4260
|
|
|
4239
|
-
Defined in: [lib/core.ts:
|
|
4261
|
+
Defined in: [lib/core.ts:1639](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1639)
|
|
4240
4262
|
|
|
4241
4263
|
加载 .env 文件到 process.env,若文件不存在则跳过
|
|
4242
4264
|
|
|
@@ -4265,7 +4287,7 @@ lib/core/functions/log.md
|
|
|
4265
4287
|
|
|
4266
4288
|
> **log**(`opt`, `msg`, `fend?`): `void`
|
|
4267
4289
|
|
|
4268
|
-
Defined in: [lib/core.ts:
|
|
4290
|
+
Defined in: [lib/core.ts:1176](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1176)
|
|
4269
4291
|
|
|
4270
4292
|
写入文件日志
|
|
4271
4293
|
|
|
@@ -4306,7 +4328,7 @@ lib/core/functions/ls.md
|
|
|
4306
4328
|
|
|
4307
4329
|
> **ls**(`opt`): `Promise`\<`object`[]\>
|
|
4308
4330
|
|
|
4309
|
-
Defined in: [lib/core.ts:
|
|
4331
|
+
Defined in: [lib/core.ts:1470](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1470)
|
|
4310
4332
|
|
|
4311
4333
|
获取目录内文件/文件夹列表
|
|
4312
4334
|
|
|
@@ -4711,7 +4733,7 @@ lib/core/functions/resolveEnvVars.md
|
|
|
4711
4733
|
|
|
4712
4734
|
> **resolveEnvVars**(`obj`): `void`
|
|
4713
4735
|
|
|
4714
|
-
Defined in: [lib/core.ts:
|
|
4736
|
+
Defined in: [lib/core.ts:1669](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1669)
|
|
4715
4737
|
|
|
4716
4738
|
将配置对象中的 ${ENV_VAR} 占位符替换为 process.env 的值
|
|
4717
4739
|
|
|
@@ -4974,6 +4996,43 @@ Defined in: [lib/core.ts:799](https://github.com/maiyunnet/kebab/blob/master/lib
|
|
|
4974
4996
|
|
|
4975
4997
|
各主机发送结果
|
|
4976
4998
|
|
|
4999
|
+
lib/core/functions/sendVhost.md
|
|
5000
|
+
---
|
|
5001
|
+
|
|
5002
|
+
[**Documents for @maiyunnet/kebab**](../../../index.md)
|
|
5003
|
+
|
|
5004
|
+
***
|
|
5005
|
+
|
|
5006
|
+
[Documents for @maiyunnet/kebab](../../../index.md) / [lib/core](../index.md) / sendVhost
|
|
5007
|
+
|
|
5008
|
+
# Function: sendVhost()
|
|
5009
|
+
|
|
5010
|
+
> **sendVhost**(`files`, `hosts?`): `Promise`\<`Record`\<`string`, \{ `result`: `boolean`; `return`: `string`; \}\>\>
|
|
5011
|
+
|
|
5012
|
+
Defined in: [lib/core.ts:1123](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1123)
|
|
5013
|
+
|
|
5014
|
+
全量替换各节点 conf/vhost/ 中的文件,不自动 reload
|
|
5015
|
+
|
|
5016
|
+
## Parameters
|
|
5017
|
+
|
|
5018
|
+
### files
|
|
5019
|
+
|
|
5020
|
+
`Record`\<`string`, `string`\>
|
|
5021
|
+
|
|
5022
|
+
文件名与 JSON 原文的非空集合;仅允许直接 .json 文件名,内容为 IVhost 或 IVhost[]
|
|
5023
|
+
|
|
5024
|
+
### hosts?
|
|
5025
|
+
|
|
5026
|
+
`string`[] \| `"config"`
|
|
5027
|
+
|
|
5028
|
+
节点列表,config 使用全局 hosts;省略或列表为空时更新本机
|
|
5029
|
+
|
|
5030
|
+
## Returns
|
|
5031
|
+
|
|
5032
|
+
`Promise`\<`Record`\<`string`, \{ `result`: `boolean`; `return`: `string`; \}\>\>
|
|
5033
|
+
|
|
5034
|
+
各节点的写入结果;成功表示目录替换完成,需自行调用 sendReload 生效
|
|
5035
|
+
|
|
4977
5036
|
lib/core/functions/setCookie.md
|
|
4978
5037
|
---
|
|
4979
5038
|
|
|
@@ -5186,7 +5245,7 @@ lib/core/functions/writeEventStreamHead.md
|
|
|
5186
5245
|
|
|
5187
5246
|
> **writeEventStreamHead**(`res`): `void`
|
|
5188
5247
|
|
|
5189
|
-
Defined in: [lib/core.ts:
|
|
5248
|
+
Defined in: [lib/core.ts:1609](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1609)
|
|
5190
5249
|
|
|
5191
5250
|
提交服务器发送事件(SSE)响应头
|
|
5192
5251
|
|
|
@@ -5221,7 +5280,7 @@ lib/core/functions/writeHead.md
|
|
|
5221
5280
|
|
|
5222
5281
|
> **writeHead**(`res`, `statusCode`, `headers?`): `void`
|
|
5223
5282
|
|
|
5224
|
-
Defined in: [lib/core.ts:
|
|
5283
|
+
Defined in: [lib/core.ts:1588](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1588)
|
|
5225
5284
|
|
|
5226
5285
|
提交 HTTP 响应状态和头部,兼容 HTTP/1.1 与 HTTP/2
|
|
5227
5286
|
|
|
@@ -5271,7 +5330,7 @@ lib/core/functions/write.md
|
|
|
5271
5330
|
|
|
5272
5331
|
> **write**(`res`, `data`): `void`
|
|
5273
5332
|
|
|
5274
|
-
Defined in: [lib/core.ts:
|
|
5333
|
+
Defined in: [lib/core.ts:1621](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1621)
|
|
5275
5334
|
|
|
5276
5335
|
向 res 发送数据
|
|
5277
5336
|
|
|
@@ -5374,6 +5433,7 @@ lib/core/index.md
|
|
|
5374
5433
|
- [sendReload](functions/sendReload.md)
|
|
5375
5434
|
- [sendRestart](functions/sendRestart.md)
|
|
5376
5435
|
- [sendStop](functions/sendStop.md)
|
|
5436
|
+
- [sendVhost](functions/sendVhost.md)
|
|
5377
5437
|
- [setCookie](functions/setCookie.md)
|
|
5378
5438
|
- [setGlobal](functions/setGlobal.md)
|
|
5379
5439
|
- [sleep](functions/sleep.md)
|
|
@@ -5457,7 +5517,7 @@ lib/core/interfaces/ILogOptions.md
|
|
|
5457
5517
|
|
|
5458
5518
|
# Interface: ILogOptions
|
|
5459
5519
|
|
|
5460
|
-
Defined in: [lib/core.ts:
|
|
5520
|
+
Defined in: [lib/core.ts:1159](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1159)
|
|
5461
5521
|
|
|
5462
5522
|
log 设置的选项
|
|
5463
5523
|
|
|
@@ -5467,7 +5527,7 @@ log 设置的选项
|
|
|
5467
5527
|
|
|
5468
5528
|
> `optional` **cookie?**: `Record`\<`string`, `string`\>
|
|
5469
5529
|
|
|
5470
|
-
Defined in: [lib/core.ts:
|
|
5530
|
+
Defined in: [lib/core.ts:1165](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1165)
|
|
5471
5531
|
|
|
5472
5532
|
***
|
|
5473
5533
|
|
|
@@ -5475,7 +5535,7 @@ Defined in: [lib/core.ts:1124](https://github.com/maiyunnet/kebab/blob/master/li
|
|
|
5475
5535
|
|
|
5476
5536
|
> `optional` **get?**: `Record`\<`string`, `any`\>
|
|
5477
5537
|
|
|
5478
|
-
Defined in: [lib/core.ts:
|
|
5538
|
+
Defined in: [lib/core.ts:1164](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1164)
|
|
5479
5539
|
|
|
5480
5540
|
***
|
|
5481
5541
|
|
|
@@ -5483,7 +5543,7 @@ Defined in: [lib/core.ts:1123](https://github.com/maiyunnet/kebab/blob/master/li
|
|
|
5483
5543
|
|
|
5484
5544
|
> `optional` **headers?**: `IncomingHttpHeaders`
|
|
5485
5545
|
|
|
5486
|
-
Defined in: [lib/core.ts:
|
|
5546
|
+
Defined in: [lib/core.ts:1167](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1167)
|
|
5487
5547
|
|
|
5488
5548
|
***
|
|
5489
5549
|
|
|
@@ -5491,7 +5551,7 @@ Defined in: [lib/core.ts:1126](https://github.com/maiyunnet/kebab/blob/master/li
|
|
|
5491
5551
|
|
|
5492
5552
|
> `optional` **hostname?**: `string`
|
|
5493
5553
|
|
|
5494
|
-
Defined in: [lib/core.ts:
|
|
5554
|
+
Defined in: [lib/core.ts:1162](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1162)
|
|
5495
5555
|
|
|
5496
5556
|
***
|
|
5497
5557
|
|
|
@@ -5499,7 +5559,7 @@ Defined in: [lib/core.ts:1121](https://github.com/maiyunnet/kebab/blob/master/li
|
|
|
5499
5559
|
|
|
5500
5560
|
> `optional` **path?**: `string`
|
|
5501
5561
|
|
|
5502
|
-
Defined in: [lib/core.ts:
|
|
5562
|
+
Defined in: [lib/core.ts:1160](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1160)
|
|
5503
5563
|
|
|
5504
5564
|
***
|
|
5505
5565
|
|
|
@@ -5507,7 +5567,7 @@ Defined in: [lib/core.ts:1119](https://github.com/maiyunnet/kebab/blob/master/li
|
|
|
5507
5567
|
|
|
5508
5568
|
> `optional` **req?**: `IncomingMessage` \| `Http2ServerRequest` \| `null`
|
|
5509
5569
|
|
|
5510
|
-
Defined in: [lib/core.ts:
|
|
5570
|
+
Defined in: [lib/core.ts:1163](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1163)
|
|
5511
5571
|
|
|
5512
5572
|
***
|
|
5513
5573
|
|
|
@@ -5515,7 +5575,7 @@ Defined in: [lib/core.ts:1122](https://github.com/maiyunnet/kebab/blob/master/li
|
|
|
5515
5575
|
|
|
5516
5576
|
> `optional` **session?**: `Record`\<`string`, `any`\>
|
|
5517
5577
|
|
|
5518
|
-
Defined in: [lib/core.ts:
|
|
5578
|
+
Defined in: [lib/core.ts:1166](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1166)
|
|
5519
5579
|
|
|
5520
5580
|
***
|
|
5521
5581
|
|
|
@@ -5523,7 +5583,7 @@ Defined in: [lib/core.ts:1125](https://github.com/maiyunnet/kebab/blob/master/li
|
|
|
5523
5583
|
|
|
5524
5584
|
> `optional` **urlFull?**: `string`
|
|
5525
5585
|
|
|
5526
|
-
Defined in: [lib/core.ts:
|
|
5586
|
+
Defined in: [lib/core.ts:1161](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1161)
|
|
5527
5587
|
|
|
5528
5588
|
lib/core/interfaces/IMonitorEvent.md
|
|
5529
5589
|
---
|
|
@@ -5536,7 +5596,7 @@ lib/core/interfaces/IMonitorEvent.md
|
|
|
5536
5596
|
|
|
5537
5597
|
# Interface: IMonitorEvent
|
|
5538
5598
|
|
|
5539
|
-
Defined in: [lib/core.ts:
|
|
5599
|
+
Defined in: [lib/core.ts:1355](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1355)
|
|
5540
5600
|
|
|
5541
5601
|
事件原始数据与可读取的文件;data 为 null 时可下载原始记录复盘
|
|
5542
5602
|
|
|
@@ -5546,7 +5606,7 @@ Defined in: [lib/core.ts:1314](https://github.com/maiyunnet/kebab/blob/master/li
|
|
|
5546
5606
|
|
|
5547
5607
|
> **data**: `Record`\<`string`, `unknown`\> \| `null`
|
|
5548
5608
|
|
|
5549
|
-
Defined in: [lib/core.ts:
|
|
5609
|
+
Defined in: [lib/core.ts:1357](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1357)
|
|
5550
5610
|
|
|
5551
5611
|
***
|
|
5552
5612
|
|
|
@@ -5554,7 +5614,7 @@ Defined in: [lib/core.ts:1316](https://github.com/maiyunnet/kebab/blob/master/li
|
|
|
5554
5614
|
|
|
5555
5615
|
> **files**: [`IMonitorFile`](IMonitorFile.md)[]
|
|
5556
5616
|
|
|
5557
|
-
Defined in: [lib/core.ts:
|
|
5617
|
+
Defined in: [lib/core.ts:1359](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1359)
|
|
5558
5618
|
|
|
5559
5619
|
***
|
|
5560
5620
|
|
|
@@ -5562,7 +5622,7 @@ Defined in: [lib/core.ts:1318](https://github.com/maiyunnet/kebab/blob/master/li
|
|
|
5562
5622
|
|
|
5563
5623
|
> **recordStatus**: `"loaded"` \| `"invalid"` \| `"missing"` \| `"too-large"` \| `"unreadable"`
|
|
5564
5624
|
|
|
5565
|
-
Defined in: [lib/core.ts:
|
|
5625
|
+
Defined in: [lib/core.ts:1358](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1358)
|
|
5566
5626
|
|
|
5567
5627
|
***
|
|
5568
5628
|
|
|
@@ -5570,7 +5630,7 @@ Defined in: [lib/core.ts:1317](https://github.com/maiyunnet/kebab/blob/master/li
|
|
|
5570
5630
|
|
|
5571
5631
|
> **summary**: [`IMonitorEventSummary`](IMonitorEventSummary.md)
|
|
5572
5632
|
|
|
5573
|
-
Defined in: [lib/core.ts:
|
|
5633
|
+
Defined in: [lib/core.ts:1356](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1356)
|
|
5574
5634
|
|
|
5575
5635
|
lib/core/interfaces/IMonitorEventSummary.md
|
|
5576
5636
|
---
|
|
@@ -5583,7 +5643,7 @@ lib/core/interfaces/IMonitorEventSummary.md
|
|
|
5583
5643
|
|
|
5584
5644
|
# Interface: IMonitorEventSummary
|
|
5585
5645
|
|
|
5586
|
-
Defined in: [lib/core.ts:
|
|
5646
|
+
Defined in: [lib/core.ts:1335](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1335)
|
|
5587
5647
|
|
|
5588
5648
|
已保存监控事件的简短摘要,path 相对于 log/monitor/
|
|
5589
5649
|
|
|
@@ -5593,7 +5653,7 @@ Defined in: [lib/core.ts:1294](https://github.com/maiyunnet/kebab/blob/master/li
|
|
|
5593
5653
|
|
|
5594
5654
|
> **path**: `string`
|
|
5595
5655
|
|
|
5596
|
-
Defined in: [lib/core.ts:
|
|
5656
|
+
Defined in: [lib/core.ts:1336](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1336)
|
|
5597
5657
|
|
|
5598
5658
|
***
|
|
5599
5659
|
|
|
@@ -5601,7 +5661,7 @@ Defined in: [lib/core.ts:1295](https://github.com/maiyunnet/kebab/blob/master/li
|
|
|
5601
5661
|
|
|
5602
5662
|
> **pid**: `number`
|
|
5603
5663
|
|
|
5604
|
-
Defined in: [lib/core.ts:
|
|
5664
|
+
Defined in: [lib/core.ts:1337](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1337)
|
|
5605
5665
|
|
|
5606
5666
|
***
|
|
5607
5667
|
|
|
@@ -5609,7 +5669,7 @@ Defined in: [lib/core.ts:1296](https://github.com/maiyunnet/kebab/blob/master/li
|
|
|
5609
5669
|
|
|
5610
5670
|
> **reasons**: `string`[]
|
|
5611
5671
|
|
|
5612
|
-
Defined in: [lib/core.ts:
|
|
5672
|
+
Defined in: [lib/core.ts:1341](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1341)
|
|
5613
5673
|
|
|
5614
5674
|
***
|
|
5615
5675
|
|
|
@@ -5617,7 +5677,7 @@ Defined in: [lib/core.ts:1300](https://github.com/maiyunnet/kebab/blob/master/li
|
|
|
5617
5677
|
|
|
5618
5678
|
> **source**: `"main"` \| `"watchdog"`
|
|
5619
5679
|
|
|
5620
|
-
Defined in: [lib/core.ts:
|
|
5680
|
+
Defined in: [lib/core.ts:1339](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1339)
|
|
5621
5681
|
|
|
5622
5682
|
***
|
|
5623
5683
|
|
|
@@ -5625,7 +5685,7 @@ Defined in: [lib/core.ts:1298](https://github.com/maiyunnet/kebab/blob/master/li
|
|
|
5625
5685
|
|
|
5626
5686
|
> **status**: `string`
|
|
5627
5687
|
|
|
5628
|
-
Defined in: [lib/core.ts:
|
|
5688
|
+
Defined in: [lib/core.ts:1340](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1340)
|
|
5629
5689
|
|
|
5630
5690
|
***
|
|
5631
5691
|
|
|
@@ -5633,7 +5693,7 @@ Defined in: [lib/core.ts:1299](https://github.com/maiyunnet/kebab/blob/master/li
|
|
|
5633
5693
|
|
|
5634
5694
|
> **time**: `number`
|
|
5635
5695
|
|
|
5636
|
-
Defined in: [lib/core.ts:
|
|
5696
|
+
Defined in: [lib/core.ts:1338](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1338)
|
|
5637
5697
|
|
|
5638
5698
|
lib/core/interfaces/IMonitorFile.md
|
|
5639
5699
|
---
|
|
@@ -5646,7 +5706,7 @@ lib/core/interfaces/IMonitorFile.md
|
|
|
5646
5706
|
|
|
5647
5707
|
# Interface: IMonitorFile
|
|
5648
5708
|
|
|
5649
|
-
Defined in: [lib/core.ts:
|
|
5709
|
+
Defined in: [lib/core.ts:1345](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1345)
|
|
5650
5710
|
|
|
5651
5711
|
监控文件元数据;复杂格式或超过 1 MiB 的文件不提供预览
|
|
5652
5712
|
|
|
@@ -5656,7 +5716,7 @@ Defined in: [lib/core.ts:1304](https://github.com/maiyunnet/kebab/blob/master/li
|
|
|
5656
5716
|
|
|
5657
5717
|
> **mtime**: `number`
|
|
5658
5718
|
|
|
5659
|
-
Defined in: [lib/core.ts:
|
|
5719
|
+
Defined in: [lib/core.ts:1350](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1350)
|
|
5660
5720
|
|
|
5661
5721
|
最后修改时间,单位 ms
|
|
5662
5722
|
|
|
@@ -5666,7 +5726,7 @@ Defined in: [lib/core.ts:1309](https://github.com/maiyunnet/kebab/blob/master/li
|
|
|
5666
5726
|
|
|
5667
5727
|
> **name**: `string`
|
|
5668
5728
|
|
|
5669
|
-
Defined in: [lib/core.ts:
|
|
5729
|
+
Defined in: [lib/core.ts:1347](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1347)
|
|
5670
5730
|
|
|
5671
5731
|
***
|
|
5672
5732
|
|
|
@@ -5674,7 +5734,7 @@ Defined in: [lib/core.ts:1306](https://github.com/maiyunnet/kebab/blob/master/li
|
|
|
5674
5734
|
|
|
5675
5735
|
> **path**: `string`
|
|
5676
5736
|
|
|
5677
|
-
Defined in: [lib/core.ts:
|
|
5737
|
+
Defined in: [lib/core.ts:1346](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1346)
|
|
5678
5738
|
|
|
5679
5739
|
***
|
|
5680
5740
|
|
|
@@ -5682,7 +5742,7 @@ Defined in: [lib/core.ts:1305](https://github.com/maiyunnet/kebab/blob/master/li
|
|
|
5682
5742
|
|
|
5683
5743
|
> **preview**: `"text"` \| `"json"` \| `null`
|
|
5684
5744
|
|
|
5685
|
-
Defined in: [lib/core.ts:
|
|
5745
|
+
Defined in: [lib/core.ts:1351](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1351)
|
|
5686
5746
|
|
|
5687
5747
|
***
|
|
5688
5748
|
|
|
@@ -5690,7 +5750,7 @@ Defined in: [lib/core.ts:1310](https://github.com/maiyunnet/kebab/blob/master/li
|
|
|
5690
5750
|
|
|
5691
5751
|
> **size**: `number`
|
|
5692
5752
|
|
|
5693
|
-
Defined in: [lib/core.ts:
|
|
5753
|
+
Defined in: [lib/core.ts:1348](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1348)
|
|
5694
5754
|
|
|
5695
5755
|
lib/core/namespaces/v/classes/ValiError.md
|
|
5696
5756
|
---
|
|
@@ -138115,7 +138175,7 @@ sys/route/functions/clearKebabConfigs.md
|
|
|
138115
138175
|
|
|
138116
138176
|
> **clearKebabConfigs**(): `void`
|
|
138117
138177
|
|
|
138118
|
-
Defined in: [sys/route.ts:
|
|
138178
|
+
Defined in: [sys/route.ts:40](https://github.com/maiyunnet/kebab/blob/master/sys/route.ts#L40)
|
|
138119
138179
|
|
|
138120
138180
|
清空缓存的项目配置,下次请求时重新读取文件
|
|
138121
138181
|
|
|
@@ -138136,7 +138196,7 @@ sys/route/functions/getFormData.md
|
|
|
138136
138196
|
|
|
138137
138197
|
> **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)\>; \}\>
|
|
138138
138198
|
|
|
138139
|
-
Defined in: [sys/route.ts:
|
|
138199
|
+
Defined in: [sys/route.ts:1105](https://github.com/maiyunnet/kebab/blob/master/sys/route.ts#L1105)
|
|
138140
138200
|
|
|
138141
138201
|
获取 formdata 的 post
|
|
138142
138202
|
|
|
@@ -138179,7 +138239,7 @@ sys/route/functions/getPost.md
|
|
|
138179
138239
|
|
|
138180
138240
|
> **getPost**(`req`): `Promise`\<`false` \| \{ `input`: `string`; `post`: `Record`\<`string`, `any`\>; `raw`: `Record`\<`string`, `any`\>; \}\>
|
|
138181
138241
|
|
|
138182
|
-
Defined in: [sys/route.ts:
|
|
138242
|
+
Defined in: [sys/route.ts:940](https://github.com/maiyunnet/kebab/blob/master/sys/route.ts#L940)
|
|
138183
138243
|
|
|
138184
138244
|
获取 post 对象(通常已自动获取),如果是文件上传(formdata)的情况则不获取
|
|
138185
138245
|
|
|
@@ -138210,7 +138270,7 @@ sys/route/functions/run.md
|
|
|
138210
138270
|
|
|
138211
138271
|
> **run**(`data`): `Promise`\<`boolean`\>
|
|
138212
138272
|
|
|
138213
|
-
Defined in: [sys/route.ts:
|
|
138273
|
+
Defined in: [sys/route.ts:111](https://github.com/maiyunnet/kebab/blob/master/sys/route.ts#L111)
|
|
138214
138274
|
|
|
138215
138275
|
若为动态路径则执行此函数,此函数不进行判断 kebab.json 是否存在
|
|
138216
138276
|
|
|
@@ -138297,7 +138357,7 @@ sys/route/functions/unlinkUploadFiles.md
|
|
|
138297
138357
|
|
|
138298
138358
|
> **unlinkUploadFiles**(`cctr`): `Promise`\<`void`\>
|
|
138299
138359
|
|
|
138300
|
-
Defined in: [sys/route.ts:
|
|
138360
|
+
Defined in: [sys/route.ts:898](https://github.com/maiyunnet/kebab/blob/master/sys/route.ts#L898)
|
|
138301
138361
|
|
|
138302
138362
|
删除本次请求所有已上传的临时文件
|
|
138303
138363
|
|
|
@@ -138326,7 +138386,7 @@ sys/route/functions/waitCtr.md
|
|
|
138326
138386
|
|
|
138327
138387
|
> **waitCtr**(`cctr`): `Promise`\<`void`\>
|
|
138328
138388
|
|
|
138329
|
-
Defined in: [sys/route.ts:
|
|
138389
|
+
Defined in: [sys/route.ts:918](https://github.com/maiyunnet/kebab/blob/master/sys/route.ts#L918)
|
|
138330
138390
|
|
|
138331
138391
|
等待异步任务结束,并删除临时文件,如果结束后还有事务没关闭,则会在本函数中打印控制台并且写入 log 文件
|
|
138332
138392
|
此时其实已经给客户端返回了,此处等待不消耗客户端的等待时间
|
|
@@ -138380,7 +138440,7 @@ sys/route/interfaces/IFormDataError.md
|
|
|
138380
138440
|
|
|
138381
138441
|
# Interface: IFormDataError
|
|
138382
138442
|
|
|
138383
|
-
Defined in: [sys/route.ts:
|
|
138443
|
+
Defined in: [sys/route.ts:1060](https://github.com/maiyunnet/kebab/blob/master/sys/route.ts#L1060)
|
|
138384
138444
|
|
|
138385
138445
|
解析上传数据时的失败原因,只提供错误码和限制值,不带临时路径或异常对象
|
|
138386
138446
|
|
|
@@ -138390,7 +138450,7 @@ Defined in: [sys/route.ts:1047](https://github.com/maiyunnet/kebab/blob/master/s
|
|
|
138390
138450
|
|
|
138391
138451
|
> **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"`
|
|
138392
138452
|
|
|
138393
|
-
Defined in: [sys/route.ts:
|
|
138453
|
+
Defined in: [sys/route.ts:1061](https://github.com/maiyunnet/kebab/blob/master/sys/route.ts#L1061)
|
|
138394
138454
|
|
|
138395
138455
|
***
|
|
138396
138456
|
|
|
@@ -138398,7 +138458,7 @@ Defined in: [sys/route.ts:1048](https://github.com/maiyunnet/kebab/blob/master/s
|
|
|
138398
138458
|
|
|
138399
138459
|
> `optional` **limit?**: `number`
|
|
138400
138460
|
|
|
138401
|
-
Defined in: [sys/route.ts:
|
|
138461
|
+
Defined in: [sys/route.ts:1065](https://github.com/maiyunnet/kebab/blob/master/sys/route.ts#L1065)
|
|
138402
138462
|
|
|
138403
138463
|
超出的限制值:大小用字节,超时用毫秒,字段和文件数量用个
|
|
138404
138464
|
|
|
@@ -138413,7 +138473,7 @@ sys/route/interfaces/IFormDataEvents.md
|
|
|
138413
138473
|
|
|
138414
138474
|
# Interface: IFormDataEvents
|
|
138415
138475
|
|
|
138416
|
-
Defined in: [sys/route.ts:
|
|
138476
|
+
Defined in: [sys/route.ts:1069](https://github.com/maiyunnet/kebab/blob/master/sys/route.ts#L1069)
|
|
138417
138477
|
|
|
138418
138478
|
multipart 文件处理及失败通知
|
|
138419
138479
|
|
|
@@ -138423,7 +138483,7 @@ multipart 文件处理及失败通知
|
|
|
138423
138483
|
|
|
138424
138484
|
> `optional` **onerror?**: (`error`) => `void`
|
|
138425
138485
|
|
|
138426
|
-
Defined in: [sys/route.ts:
|
|
138486
|
+
Defined in: [sys/route.ts:1077](https://github.com/maiyunnet/kebab/blob/master/sys/route.ts#L1077)
|
|
138427
138487
|
|
|
138428
138488
|
首次失败时调用一次,getFormData 返回 false;若连接已断开,可能无法回复客户端
|
|
138429
138489
|
|
|
@@ -138443,7 +138503,7 @@ Defined in: [sys/route.ts:1064](https://github.com/maiyunnet/kebab/blob/master/s
|
|
|
138443
138503
|
|
|
138444
138504
|
> `optional` **onfiledata?**: (`chunk`) => `void`
|
|
138445
138505
|
|
|
138446
|
-
Defined in: [sys/route.ts:
|
|
138506
|
+
Defined in: [sys/route.ts:1073](https://github.com/maiyunnet/kebab/blob/master/sys/route.ts#L1073)
|
|
138447
138507
|
|
|
138448
138508
|
文件上传时触发,仅 start 返回 true 时触发
|
|
138449
138509
|
|
|
@@ -138463,7 +138523,7 @@ Defined in: [sys/route.ts:1060](https://github.com/maiyunnet/kebab/blob/master/s
|
|
|
138463
138523
|
|
|
138464
138524
|
> `optional` **onfileend?**: () => `void`
|
|
138465
138525
|
|
|
138466
|
-
Defined in: [sys/route.ts:
|
|
138526
|
+
Defined in: [sys/route.ts:1075](https://github.com/maiyunnet/kebab/blob/master/sys/route.ts#L1075)
|
|
138467
138527
|
|
|
138468
138528
|
文件上传结束时触发,仅 start 返回 true 时触发
|
|
138469
138529
|
|
|
@@ -138477,7 +138537,7 @@ Defined in: [sys/route.ts:1062](https://github.com/maiyunnet/kebab/blob/master/s
|
|
|
138477
138537
|
|
|
138478
138538
|
> `optional` **onfilestart?**: (`name`) => `boolean` \| `undefined`
|
|
138479
138539
|
|
|
138480
|
-
Defined in: [sys/route.ts:
|
|
138540
|
+
Defined in: [sys/route.ts:1071](https://github.com/maiyunnet/kebab/blob/master/sys/route.ts#L1071)
|
|
138481
138541
|
|
|
138482
138542
|
文件开始上传时触发,返回 true 则跳过该文件的保存
|
|
138483
138543
|
|
|
@@ -138502,7 +138562,7 @@ sys/route/interfaces/IFormDataLimits.md
|
|
|
138502
138562
|
|
|
138503
138563
|
# Interface: IFormDataLimits
|
|
138504
138564
|
|
|
138505
|
-
Defined in: [sys/route.ts:
|
|
138565
|
+
Defined in: [sys/route.ts:1081](https://github.com/maiyunnet/kebab/blob/master/sys/route.ts#L1081)
|
|
138506
138566
|
|
|
138507
138567
|
multipart 上传限制
|
|
138508
138568
|
|
|
@@ -138512,7 +138572,7 @@ multipart 上传限制
|
|
|
138512
138572
|
|
|
138513
138573
|
> `optional` **allowedExts?**: `string`[]
|
|
138514
138574
|
|
|
138515
|
-
Defined in: [sys/route.ts:
|
|
138575
|
+
Defined in: [sys/route.ts:1085](https://github.com/maiyunnet/kebab/blob/master/sys/route.ts#L1085)
|
|
138516
138576
|
|
|
138517
138577
|
允许的文件扩展名(含点号),如 ['.jpg', '.png', '.pdf']
|
|
138518
138578
|
|
|
@@ -138522,7 +138582,7 @@ Defined in: [sys/route.ts:1072](https://github.com/maiyunnet/kebab/blob/master/s
|
|
|
138522
138582
|
|
|
138523
138583
|
> `optional` **maxFieldSize?**: `number`
|
|
138524
138584
|
|
|
138525
|
-
Defined in: [sys/route.ts:
|
|
138585
|
+
Defined in: [sys/route.ts:1087](https://github.com/maiyunnet/kebab/blob/master/sys/route.ts#L1087)
|
|
138526
138586
|
|
|
138527
138587
|
单个字段(非文件)最大字节数,默认 1 MB
|
|
138528
138588
|
|
|
@@ -138532,7 +138592,7 @@ Defined in: [sys/route.ts:1074](https://github.com/maiyunnet/kebab/blob/master/s
|
|
|
138532
138592
|
|
|
138533
138593
|
> `optional` **maxFileSize?**: `number`
|
|
138534
138594
|
|
|
138535
|
-
Defined in: [sys/route.ts:
|
|
138595
|
+
Defined in: [sys/route.ts:1083](https://github.com/maiyunnet/kebab/blob/master/sys/route.ts#L1083)
|
|
138536
138596
|
|
|
138537
138597
|
单个文件最大字节数
|
|
138538
138598
|
|
|
@@ -138542,7 +138602,7 @@ Defined in: [sys/route.ts:1070](https://github.com/maiyunnet/kebab/blob/master/s
|
|
|
138542
138602
|
|
|
138543
138603
|
> `optional` **maxHeaderSize?**: `number`
|
|
138544
138604
|
|
|
138545
|
-
Defined in: [sys/route.ts:
|
|
138605
|
+
Defined in: [sys/route.ts:1091](https://github.com/maiyunnet/kebab/blob/master/sys/route.ts#L1091)
|
|
138546
138606
|
|
|
138547
138607
|
每个字段或文件的 multipart 头部最多多少字节,默认 16 KB
|
|
138548
138608
|
|
|
@@ -138552,7 +138612,7 @@ Defined in: [sys/route.ts:1078](https://github.com/maiyunnet/kebab/blob/master/s
|
|
|
138552
138612
|
|
|
138553
138613
|
> `optional` **maxParts?**: `number`
|
|
138554
138614
|
|
|
138555
|
-
Defined in: [sys/route.ts:
|
|
138615
|
+
Defined in: [sys/route.ts:1093](https://github.com/maiyunnet/kebab/blob/master/sys/route.ts#L1093)
|
|
138556
138616
|
|
|
138557
138617
|
multipart 字段与文件总数量,默认 1000
|
|
138558
138618
|
|
|
@@ -138562,7 +138622,7 @@ multipart 字段与文件总数量,默认 1000
|
|
|
138562
138622
|
|
|
138563
138623
|
> `optional` **maxTotalSize?**: `number`
|
|
138564
138624
|
|
|
138565
|
-
Defined in: [sys/route.ts:
|
|
138625
|
+
Defined in: [sys/route.ts:1089](https://github.com/maiyunnet/kebab/blob/master/sys/route.ts#L1089)
|
|
138566
138626
|
|
|
138567
138627
|
整体请求最大字节数,不设置或设为 0 则不限制
|
|
138568
138628
|
|
|
@@ -138572,6 +138632,6 @@ Defined in: [sys/route.ts:1076](https://github.com/maiyunnet/kebab/blob/master/s
|
|
|
138572
138632
|
|
|
138573
138633
|
> `optional` **timeout?**: `number`
|
|
138574
138634
|
|
|
138575
|
-
Defined in: [sys/route.ts:
|
|
138635
|
+
Defined in: [sys/route.ts:1095](https://github.com/maiyunnet/kebab/blob/master/sys/route.ts#L1095)
|
|
138576
138636
|
|
|
138577
138637
|
整体请求超时时间(毫秒),默认 5 分钟,设为 0 禁用超时
|