@maiyunnet/kebab 9.13.7 → 9.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/doc/kebab-rag.md +107 -59
- package/index.d.ts +2 -2
- package/index.js +2 -2
- package/lib/crypto.d.ts +26 -26
- package/lib/crypto.js +1 -1
- package/lib/db/conn.js +5 -2
- package/lib/sql.d.ts +1 -1
- package/package.json +23 -23
- package/sys/child.js +21 -2
- package/sys/master.js +57 -31
- package/sys/mod.d.ts +1 -1
- package/sys/route.js +18 -8
- package/www/example/stc/lib/ui/checkbox.d.ts +1 -1
- package/www/example/stc/lib/ui/input.d.ts +1 -1
- package/www/example/stc/lib/ui/label.d.ts +1 -1
- package/www/example/stc/lib/ui/switch.d.ts +1 -1
- package/www/example/stc/view/react-router.page.d.ts +1 -1
- package/www/example/stc/view/react.page.d.ts +1 -1
package/doc/kebab-rag.md
CHANGED
|
@@ -1360,7 +1360,7 @@ index/variables/VER.md
|
|
|
1360
1360
|
|
|
1361
1361
|
# Variable: VER
|
|
1362
1362
|
|
|
1363
|
-
> `const` **VER**: `"9.
|
|
1363
|
+
> `const` **VER**: `"9.14.0"` = `'9.14.0'`
|
|
1364
1364
|
|
|
1365
1365
|
Defined in: [index.ts:10](https://github.com/maiyunnet/kebab/blob/master/index.ts#L10)
|
|
1366
1366
|
|
|
@@ -5420,7 +5420,7 @@ AES 解密
|
|
|
5420
5420
|
|
|
5421
5421
|
#### key
|
|
5422
5422
|
|
|
5423
|
-
`
|
|
5423
|
+
`KeyLike`
|
|
5424
5424
|
|
|
5425
5425
|
密钥 32 个英文字母和数字
|
|
5426
5426
|
|
|
@@ -5462,7 +5462,7 @@ AES 解密
|
|
|
5462
5462
|
|
|
5463
5463
|
#### key
|
|
5464
5464
|
|
|
5465
|
-
`
|
|
5465
|
+
`KeyLike`
|
|
5466
5466
|
|
|
5467
5467
|
密钥 32 个英文字母和数字
|
|
5468
5468
|
|
|
@@ -5515,7 +5515,7 @@ AES 加密
|
|
|
5515
5515
|
|
|
5516
5516
|
#### key
|
|
5517
5517
|
|
|
5518
|
-
`
|
|
5518
|
+
`KeyLike`
|
|
5519
5519
|
|
|
5520
5520
|
密钥尽量 32 个英文字母和数字,不是 32 个系统会自动处理
|
|
5521
5521
|
|
|
@@ -5559,7 +5559,7 @@ AES 加密
|
|
|
5559
5559
|
|
|
5560
5560
|
#### key
|
|
5561
5561
|
|
|
5562
|
-
`
|
|
5562
|
+
`KeyLike`
|
|
5563
5563
|
|
|
5564
5564
|
密钥尽量 32 个英文字母和数字,不是 32 个系统会自动处理
|
|
5565
5565
|
|
|
@@ -5704,7 +5704,7 @@ cipher 解密
|
|
|
5704
5704
|
|
|
5705
5705
|
### key
|
|
5706
5706
|
|
|
5707
|
-
`
|
|
5707
|
+
`KeyLike`
|
|
5708
5708
|
|
|
5709
5709
|
密钥 32 个英文字母和数字
|
|
5710
5710
|
|
|
@@ -5757,7 +5757,7 @@ cipher 加密,强烈不建议使用 AES_256_ECB
|
|
|
5757
5757
|
|
|
5758
5758
|
### key
|
|
5759
5759
|
|
|
5760
|
-
`
|
|
5760
|
+
`KeyLike`
|
|
5761
5761
|
|
|
5762
5762
|
密钥 32 个英文字母和数字
|
|
5763
5763
|
|
|
@@ -5812,7 +5812,7 @@ AES 解密
|
|
|
5812
5812
|
|
|
5813
5813
|
#### key
|
|
5814
5814
|
|
|
5815
|
-
`
|
|
5815
|
+
`KeyLike`
|
|
5816
5816
|
|
|
5817
5817
|
密钥 32 个英文字母和数字
|
|
5818
5818
|
|
|
@@ -5844,7 +5844,7 @@ AES 解密
|
|
|
5844
5844
|
|
|
5845
5845
|
#### key
|
|
5846
5846
|
|
|
5847
|
-
`
|
|
5847
|
+
`KeyLike`
|
|
5848
5848
|
|
|
5849
5849
|
密钥 32 个英文字母和数字
|
|
5850
5850
|
|
|
@@ -5887,7 +5887,7 @@ AES GCM 托管加密
|
|
|
5887
5887
|
|
|
5888
5888
|
#### key
|
|
5889
5889
|
|
|
5890
|
-
`
|
|
5890
|
+
`KeyLike`
|
|
5891
5891
|
|
|
5892
5892
|
密钥尽量 32 个英文字母和数字,不是 32 个系统会自动处理
|
|
5893
5893
|
|
|
@@ -5919,7 +5919,7 @@ AES GCM 托管加密
|
|
|
5919
5919
|
|
|
5920
5920
|
#### key
|
|
5921
5921
|
|
|
5922
|
-
`
|
|
5922
|
+
`KeyLike`
|
|
5923
5923
|
|
|
5924
5924
|
密钥尽量 32 个英文字母和数字,不是 32 个系统会自动处理
|
|
5925
5925
|
|
|
@@ -6033,7 +6033,7 @@ hash 或 hmac 加密文件
|
|
|
6033
6033
|
|
|
6034
6034
|
#### key?
|
|
6035
6035
|
|
|
6036
|
-
`
|
|
6036
|
+
`KeyLike`
|
|
6037
6037
|
|
|
6038
6038
|
设置则采用 hmac 加密
|
|
6039
6039
|
|
|
@@ -6069,7 +6069,7 @@ hash 或 hmac 加密文件
|
|
|
6069
6069
|
|
|
6070
6070
|
#### key
|
|
6071
6071
|
|
|
6072
|
-
`
|
|
6072
|
+
`KeyLike`
|
|
6073
6073
|
|
|
6074
6074
|
设置则采用 hmac 加密
|
|
6075
6075
|
|
|
@@ -6116,7 +6116,7 @@ hash 或 hmac 加密
|
|
|
6116
6116
|
|
|
6117
6117
|
#### key?
|
|
6118
6118
|
|
|
6119
|
-
`
|
|
6119
|
+
`KeyLike`
|
|
6120
6120
|
|
|
6121
6121
|
设置则采用 hmac 加密
|
|
6122
6122
|
|
|
@@ -6152,7 +6152,7 @@ hash 或 hmac 加密
|
|
|
6152
6152
|
|
|
6153
6153
|
#### key
|
|
6154
6154
|
|
|
6155
|
-
`
|
|
6155
|
+
`KeyLike` \| `undefined`
|
|
6156
6156
|
|
|
6157
6157
|
设置则采用 hmac 加密
|
|
6158
6158
|
|
|
@@ -6185,7 +6185,7 @@ Defined in: [lib/crypto.ts:136](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
6185
6185
|
|
|
6186
6186
|
### key
|
|
6187
6187
|
|
|
6188
|
-
`KeyLike` \| `
|
|
6188
|
+
`KeyLike` \| `PrivateKeyInput`
|
|
6189
6189
|
|
|
6190
6190
|
私钥
|
|
6191
6191
|
|
|
@@ -6220,7 +6220,7 @@ Defined in: [lib/crypto.ts:114](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
6220
6220
|
|
|
6221
6221
|
### key
|
|
6222
6222
|
|
|
6223
|
-
`KeyLike` \| `
|
|
6223
|
+
`KeyLike` \| `PrivateKeyInput`
|
|
6224
6224
|
|
|
6225
6225
|
私钥
|
|
6226
6226
|
|
|
@@ -6255,7 +6255,7 @@ Defined in: [lib/crypto.ts:125](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
6255
6255
|
|
|
6256
6256
|
### key
|
|
6257
6257
|
|
|
6258
|
-
`KeyLike` \| `
|
|
6258
|
+
`KeyLike` \| `PrivateKeyInput` \| `PublicKeyInput`
|
|
6259
6259
|
|
|
6260
6260
|
公钥
|
|
6261
6261
|
|
|
@@ -6290,7 +6290,7 @@ Defined in: [lib/crypto.ts:103](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
6290
6290
|
|
|
6291
6291
|
### key
|
|
6292
6292
|
|
|
6293
|
-
`KeyLike` \| `
|
|
6293
|
+
`KeyLike` \| `PrivateKeyInput` \| `PublicKeyInput`
|
|
6294
6294
|
|
|
6295
6295
|
公钥
|
|
6296
6296
|
|
|
@@ -6327,7 +6327,7 @@ Defined in: [lib/crypto.ts:69](https://github.com/maiyunnet/kebab/blob/master/li
|
|
|
6327
6327
|
|
|
6328
6328
|
#### data
|
|
6329
6329
|
|
|
6330
|
-
`
|
|
6330
|
+
`string` \| `ArrayBufferView`\<`ArrayBufferLike`\>
|
|
6331
6331
|
|
|
6332
6332
|
数据
|
|
6333
6333
|
|
|
@@ -6365,7 +6365,7 @@ Defined in: [lib/crypto.ts:72](https://github.com/maiyunnet/kebab/blob/master/li
|
|
|
6365
6365
|
|
|
6366
6366
|
#### data
|
|
6367
6367
|
|
|
6368
|
-
`
|
|
6368
|
+
`string` \| `ArrayBufferView`\<`ArrayBufferLike`\>
|
|
6369
6369
|
|
|
6370
6370
|
数据
|
|
6371
6371
|
|
|
@@ -6420,7 +6420,7 @@ SM4 解密
|
|
|
6420
6420
|
|
|
6421
6421
|
#### key
|
|
6422
6422
|
|
|
6423
|
-
`
|
|
6423
|
+
`KeyLike`
|
|
6424
6424
|
|
|
6425
6425
|
密钥 32 个英文字母和数字
|
|
6426
6426
|
|
|
@@ -6462,7 +6462,7 @@ SM4 解密
|
|
|
6462
6462
|
|
|
6463
6463
|
#### key
|
|
6464
6464
|
|
|
6465
|
-
`
|
|
6465
|
+
`KeyLike`
|
|
6466
6466
|
|
|
6467
6467
|
密钥 32 个英文字母和数字
|
|
6468
6468
|
|
|
@@ -6515,7 +6515,7 @@ SM4 加密
|
|
|
6515
6515
|
|
|
6516
6516
|
#### key
|
|
6517
6517
|
|
|
6518
|
-
`
|
|
6518
|
+
`KeyLike`
|
|
6519
6519
|
|
|
6520
6520
|
密钥 32 个英文字母和数字
|
|
6521
6521
|
|
|
@@ -6557,7 +6557,7 @@ SM4 加密
|
|
|
6557
6557
|
|
|
6558
6558
|
#### key
|
|
6559
6559
|
|
|
6560
|
-
`
|
|
6560
|
+
`KeyLike`
|
|
6561
6561
|
|
|
6562
6562
|
密钥 32 个英文字母和数字
|
|
6563
6563
|
|
|
@@ -6631,7 +6631,7 @@ Defined in: [lib/crypto.ts:90](https://github.com/maiyunnet/kebab/blob/master/li
|
|
|
6631
6631
|
|
|
6632
6632
|
### data
|
|
6633
6633
|
|
|
6634
|
-
`
|
|
6634
|
+
`string` \| `ArrayBufferView`\<`ArrayBufferLike`\>
|
|
6635
6635
|
|
|
6636
6636
|
数据
|
|
6637
6637
|
|
|
@@ -6829,7 +6829,7 @@ lib/db/conn/classes/Connection.md
|
|
|
6829
6829
|
|
|
6830
6830
|
# Class: Connection
|
|
6831
6831
|
|
|
6832
|
-
Defined in: [lib/db/conn.ts:
|
|
6832
|
+
Defined in: [lib/db/conn.ts:37](https://github.com/maiyunnet/kebab/blob/master/lib/db/conn.ts#L37)
|
|
6833
6833
|
|
|
6834
6834
|
数据库连接对象
|
|
6835
6835
|
|
|
@@ -6839,7 +6839,7 @@ Defined in: [lib/db/conn.ts:34](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
6839
6839
|
|
|
6840
6840
|
> **new Connection**(`etc`, `link`): `Connection`
|
|
6841
6841
|
|
|
6842
|
-
Defined in: [lib/db/conn.ts:
|
|
6842
|
+
Defined in: [lib/db/conn.ts:62](https://github.com/maiyunnet/kebab/blob/master/lib/db/conn.ts#L62)
|
|
6843
6843
|
|
|
6844
6844
|
#### Parameters
|
|
6845
6845
|
|
|
@@ -6861,7 +6861,7 @@ Defined in: [lib/db/conn.ts:59](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
6861
6861
|
|
|
6862
6862
|
> **beginTransaction**(): `Promise`\<`boolean`\>
|
|
6863
6863
|
|
|
6864
|
-
Defined in: [lib/db/conn.ts:
|
|
6864
|
+
Defined in: [lib/db/conn.ts:322](https://github.com/maiyunnet/kebab/blob/master/lib/db/conn.ts#L322)
|
|
6865
6865
|
|
|
6866
6866
|
#### Returns
|
|
6867
6867
|
|
|
@@ -6873,7 +6873,7 @@ Defined in: [lib/db/conn.ts:319](https://github.com/maiyunnet/kebab/blob/master/
|
|
|
6873
6873
|
|
|
6874
6874
|
> **commit**(): `Promise`\<`boolean`\>
|
|
6875
6875
|
|
|
6876
|
-
Defined in: [lib/db/conn.ts:
|
|
6876
|
+
Defined in: [lib/db/conn.ts:343](https://github.com/maiyunnet/kebab/blob/master/lib/db/conn.ts#L343)
|
|
6877
6877
|
|
|
6878
6878
|
#### Returns
|
|
6879
6879
|
|
|
@@ -6885,7 +6885,7 @@ Defined in: [lib/db/conn.ts:340](https://github.com/maiyunnet/kebab/blob/master/
|
|
|
6885
6885
|
|
|
6886
6886
|
> **end**(): `Promise`\<`boolean`\>
|
|
6887
6887
|
|
|
6888
|
-
Defined in: [lib/db/conn.ts:
|
|
6888
|
+
Defined in: [lib/db/conn.ts:311](https://github.com/maiyunnet/kebab/blob/master/lib/db/conn.ts#L311)
|
|
6889
6889
|
|
|
6890
6890
|
关闭连接,一般情况下不使用
|
|
6891
6891
|
|
|
@@ -6899,7 +6899,7 @@ Defined in: [lib/db/conn.ts:308](https://github.com/maiyunnet/kebab/blob/master/
|
|
|
6899
6899
|
|
|
6900
6900
|
> **execute**(`sql`, `values?`): `Promise`\<[`IPacket`](../../interfaces/IPacket.md)\>
|
|
6901
6901
|
|
|
6902
|
-
Defined in: [lib/db/conn.ts:
|
|
6902
|
+
Defined in: [lib/db/conn.ts:238](https://github.com/maiyunnet/kebab/blob/master/lib/db/conn.ts#L238)
|
|
6903
6903
|
|
|
6904
6904
|
执行一条 SQL 并获得影响行数对象 packet
|
|
6905
6905
|
|
|
@@ -6927,7 +6927,7 @@ Defined in: [lib/db/conn.ts:235](https://github.com/maiyunnet/kebab/blob/master/
|
|
|
6927
6927
|
|
|
6928
6928
|
> **getEtc**(): [`IConfigDb`](../../../../index/interfaces/IConfigDb.md)
|
|
6929
6929
|
|
|
6930
|
-
Defined in: [lib/db/conn.ts:
|
|
6930
|
+
Defined in: [lib/db/conn.ts:71](https://github.com/maiyunnet/kebab/blob/master/lib/db/conn.ts#L71)
|
|
6931
6931
|
|
|
6932
6932
|
获取连接 etc 信息
|
|
6933
6933
|
|
|
@@ -6941,7 +6941,7 @@ Defined in: [lib/db/conn.ts:68](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
6941
6941
|
|
|
6942
6942
|
> **getLast**(): `number`
|
|
6943
6943
|
|
|
6944
|
-
Defined in: [lib/db/conn.ts:
|
|
6944
|
+
Defined in: [lib/db/conn.ts:83](https://github.com/maiyunnet/kebab/blob/master/lib/db/conn.ts#L83)
|
|
6945
6945
|
|
|
6946
6946
|
获取最后一次获取连接的时间
|
|
6947
6947
|
|
|
@@ -6955,7 +6955,7 @@ Defined in: [lib/db/conn.ts:80](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
6955
6955
|
|
|
6956
6956
|
> **getLastSql**(): `object`[]
|
|
6957
6957
|
|
|
6958
|
-
Defined in: [lib/db/conn.ts:
|
|
6958
|
+
Defined in: [lib/db/conn.ts:90](https://github.com/maiyunnet/kebab/blob/master/lib/db/conn.ts#L90)
|
|
6959
6959
|
|
|
6960
6960
|
获取最后两次执行的 sql 字符串
|
|
6961
6961
|
|
|
@@ -6969,7 +6969,7 @@ Defined in: [lib/db/conn.ts:87](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
6969
6969
|
|
|
6970
6970
|
> **getService**(): [`ESERVICE`](../../enumerations/ESERVICE.md)
|
|
6971
6971
|
|
|
6972
|
-
Defined in: [lib/db/conn.ts:
|
|
6972
|
+
Defined in: [lib/db/conn.ts:76](https://github.com/maiyunnet/kebab/blob/master/lib/db/conn.ts#L76)
|
|
6973
6973
|
|
|
6974
6974
|
获取数据库服务类型
|
|
6975
6975
|
|
|
@@ -6983,7 +6983,7 @@ Defined in: [lib/db/conn.ts:73](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
6983
6983
|
|
|
6984
6984
|
> **isAvailable**(`last?`): `Promise`\<`boolean`\>
|
|
6985
6985
|
|
|
6986
|
-
Defined in: [lib/db/conn.ts:
|
|
6986
|
+
Defined in: [lib/db/conn.ts:157](https://github.com/maiyunnet/kebab/blob/master/lib/db/conn.ts#L157)
|
|
6987
6987
|
|
|
6988
6988
|
通过执行一条语句判断当前连接是否可用
|
|
6989
6989
|
|
|
@@ -7005,7 +7005,7 @@ Defined in: [lib/db/conn.ts:154](https://github.com/maiyunnet/kebab/blob/master/
|
|
|
7005
7005
|
|
|
7006
7006
|
> **isLost**(): `boolean`
|
|
7007
7007
|
|
|
7008
|
-
Defined in: [lib/db/conn.ts:
|
|
7008
|
+
Defined in: [lib/db/conn.ts:107](https://github.com/maiyunnet/kebab/blob/master/lib/db/conn.ts#L107)
|
|
7009
7009
|
|
|
7010
7010
|
是否已经丢失
|
|
7011
7011
|
|
|
@@ -7019,7 +7019,7 @@ Defined in: [lib/db/conn.ts:104](https://github.com/maiyunnet/kebab/blob/master/
|
|
|
7019
7019
|
|
|
7020
7020
|
> **isTransaction**(): `boolean`
|
|
7021
7021
|
|
|
7022
|
-
Defined in: [lib/db/conn.ts:
|
|
7022
|
+
Defined in: [lib/db/conn.ts:114](https://github.com/maiyunnet/kebab/blob/master/lib/db/conn.ts#L114)
|
|
7023
7023
|
|
|
7024
7024
|
是否是开启事务状态
|
|
7025
7025
|
|
|
@@ -7033,7 +7033,7 @@ Defined in: [lib/db/conn.ts:111](https://github.com/maiyunnet/kebab/blob/master/
|
|
|
7033
7033
|
|
|
7034
7034
|
> **isUsing**(): `boolean`
|
|
7035
7035
|
|
|
7036
|
-
Defined in: [lib/db/conn.ts:
|
|
7036
|
+
Defined in: [lib/db/conn.ts:121](https://github.com/maiyunnet/kebab/blob/master/lib/db/conn.ts#L121)
|
|
7037
7037
|
|
|
7038
7038
|
获取当前状态是否正在被使用中
|
|
7039
7039
|
|
|
@@ -7047,7 +7047,7 @@ Defined in: [lib/db/conn.ts:118](https://github.com/maiyunnet/kebab/blob/master/
|
|
|
7047
7047
|
|
|
7048
7048
|
> **query**(`sql`, `values?`): `Promise`\<[`IData`](../../interfaces/IData.md)\>
|
|
7049
7049
|
|
|
7050
|
-
Defined in: [lib/db/conn.ts:
|
|
7050
|
+
Defined in: [lib/db/conn.ts:180](https://github.com/maiyunnet/kebab/blob/master/lib/db/conn.ts#L180)
|
|
7051
7051
|
|
|
7052
7052
|
执行一条 SQL 并获得返回数据
|
|
7053
7053
|
|
|
@@ -7075,7 +7075,7 @@ Defined in: [lib/db/conn.ts:177](https://github.com/maiyunnet/kebab/blob/master/
|
|
|
7075
7075
|
|
|
7076
7076
|
> **refreshLast**(): `void`
|
|
7077
7077
|
|
|
7078
|
-
Defined in: [lib/db/conn.ts:
|
|
7078
|
+
Defined in: [lib/db/conn.ts:149](https://github.com/maiyunnet/kebab/blob/master/lib/db/conn.ts#L149)
|
|
7079
7079
|
|
|
7080
7080
|
设定最后使用时间
|
|
7081
7081
|
|
|
@@ -7089,7 +7089,7 @@ Defined in: [lib/db/conn.ts:146](https://github.com/maiyunnet/kebab/blob/master/
|
|
|
7089
7089
|
|
|
7090
7090
|
> **rollback**(): `Promise`\<`boolean`\>
|
|
7091
7091
|
|
|
7092
|
-
Defined in: [lib/db/conn.ts:
|
|
7092
|
+
Defined in: [lib/db/conn.ts:361](https://github.com/maiyunnet/kebab/blob/master/lib/db/conn.ts#L361)
|
|
7093
7093
|
|
|
7094
7094
|
#### Returns
|
|
7095
7095
|
|
|
@@ -7101,7 +7101,7 @@ Defined in: [lib/db/conn.ts:358](https://github.com/maiyunnet/kebab/blob/master/
|
|
|
7101
7101
|
|
|
7102
7102
|
> **setLost**(): `void`
|
|
7103
7103
|
|
|
7104
|
-
Defined in: [lib/db/conn.ts:
|
|
7104
|
+
Defined in: [lib/db/conn.ts:100](https://github.com/maiyunnet/kebab/blob/master/lib/db/conn.ts#L100)
|
|
7105
7105
|
|
|
7106
7106
|
将本条连接设置为不可用
|
|
7107
7107
|
|
|
@@ -7115,7 +7115,7 @@ Defined in: [lib/db/conn.ts:97](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
7115
7115
|
|
|
7116
7116
|
> **used**(): `void`
|
|
7117
7117
|
|
|
7118
|
-
Defined in: [lib/db/conn.ts:
|
|
7118
|
+
Defined in: [lib/db/conn.ts:142](https://github.com/maiyunnet/kebab/blob/master/lib/db/conn.ts#L142)
|
|
7119
7119
|
|
|
7120
7120
|
取消占用
|
|
7121
7121
|
|
|
@@ -7129,7 +7129,7 @@ Defined in: [lib/db/conn.ts:139](https://github.com/maiyunnet/kebab/blob/master/
|
|
|
7129
7129
|
|
|
7130
7130
|
> **using**(): `boolean`
|
|
7131
7131
|
|
|
7132
|
-
Defined in: [lib/db/conn.ts:
|
|
7132
|
+
Defined in: [lib/db/conn.ts:128](https://github.com/maiyunnet/kebab/blob/master/lib/db/conn.ts#L128)
|
|
7133
7133
|
|
|
7134
7134
|
判断是否可用(丢失的也算不可用),返回 true 代表获取成功并自动刷新最后时间
|
|
7135
7135
|
|
|
@@ -8623,10 +8623,14 @@ lib/fs/functions/getContent.md
|
|
|
8623
8623
|
|
|
8624
8624
|
## Param
|
|
8625
8625
|
|
|
8626
|
+
**path**
|
|
8627
|
+
|
|
8626
8628
|
文件路径
|
|
8627
8629
|
|
|
8628
8630
|
## Param
|
|
8629
8631
|
|
|
8632
|
+
**options**
|
|
8633
|
+
|
|
8630
8634
|
编码或选项
|
|
8631
8635
|
|
|
8632
8636
|
## Call Signature
|
|
@@ -10720,7 +10724,7 @@ Defined in: [lib/net/formdata.ts:37](https://github.com/maiyunnet/kebab/blob/mas
|
|
|
10720
10724
|
|
|
10721
10725
|
> **new FormData**(`options?`): `FormData`
|
|
10722
10726
|
|
|
10723
|
-
Defined in: node\_modules/@types/node/stream.d.ts:
|
|
10727
|
+
Defined in: node\_modules/@types/node/stream.d.ts:81
|
|
10724
10728
|
|
|
10725
10729
|
#### Parameters
|
|
10726
10730
|
|
|
@@ -15063,23 +15067,29 @@ lib/sql/functions/json.md
|
|
|
15063
15067
|
|
|
15064
15068
|
# Function: json()
|
|
15065
15069
|
|
|
15066
|
-
> **json
|
|
15070
|
+
> **json**\<`T`\>(`obj`): `T`
|
|
15067
15071
|
|
|
15068
15072
|
Defined in: [lib/sql.ts:1461](https://github.com/maiyunnet/kebab/blob/master/lib/sql.ts#L1461)
|
|
15069
15073
|
|
|
15070
15074
|
将对象转换为 JSON 字符串并避开类型检查,用于适配 PostgreSQL 的 jsonb 字段
|
|
15071
15075
|
|
|
15076
|
+
## Type Parameters
|
|
15077
|
+
|
|
15078
|
+
### T
|
|
15079
|
+
|
|
15080
|
+
`T`
|
|
15081
|
+
|
|
15072
15082
|
## Parameters
|
|
15073
15083
|
|
|
15074
15084
|
### obj
|
|
15075
15085
|
|
|
15076
|
-
`
|
|
15086
|
+
`T`
|
|
15077
15087
|
|
|
15078
15088
|
要转换的 JSON 对象
|
|
15079
15089
|
|
|
15080
15090
|
## Returns
|
|
15081
15091
|
|
|
15082
|
-
`
|
|
15092
|
+
`T`
|
|
15083
15093
|
|
|
15084
15094
|
lib/sql/functions/value.md
|
|
15085
15095
|
---
|
|
@@ -15562,10 +15572,14 @@ Defined in: [lib/ssh/sftp.ts:442](https://github.com/maiyunnet/kebab/blob/master
|
|
|
15562
15572
|
|
|
15563
15573
|
#### Param
|
|
15564
15574
|
|
|
15575
|
+
**path**
|
|
15576
|
+
|
|
15565
15577
|
文件路径
|
|
15566
15578
|
|
|
15567
15579
|
#### Param
|
|
15568
15580
|
|
|
15581
|
+
**options**
|
|
15582
|
+
|
|
15569
15583
|
编码或选项
|
|
15570
15584
|
|
|
15571
15585
|
#### Call Signature
|
|
@@ -18027,7 +18041,7 @@ Defined in: [lib/undici/formdata.ts:37](https://github.com/maiyunnet/kebab/blob/
|
|
|
18027
18041
|
|
|
18028
18042
|
> **new FormData**(`options?`): `FormData`
|
|
18029
18043
|
|
|
18030
|
-
Defined in: node\_modules/@types/node/stream.d.ts:
|
|
18044
|
+
Defined in: node\_modules/@types/node/stream.d.ts:81
|
|
18031
18045
|
|
|
18032
18046
|
#### Parameters
|
|
18033
18047
|
|
|
@@ -21155,10 +21169,14 @@ Defined in: [lib/zip.ts:350](https://github.com/maiyunnet/kebab/blob/master/lib/
|
|
|
21155
21169
|
|
|
21156
21170
|
#### Param
|
|
21157
21171
|
|
|
21172
|
+
**path**
|
|
21173
|
+
|
|
21158
21174
|
文件路径
|
|
21159
21175
|
|
|
21160
21176
|
#### Param
|
|
21161
21177
|
|
|
21178
|
+
**type**
|
|
21179
|
+
|
|
21162
21180
|
返回类型
|
|
21163
21181
|
|
|
21164
21182
|
#### Call Signature
|
|
@@ -21335,10 +21353,14 @@ string
|
|
|
21335
21353
|
|
|
21336
21354
|
#### Param
|
|
21337
21355
|
|
|
21356
|
+
**path**
|
|
21357
|
+
|
|
21338
21358
|
文件夹路径
|
|
21339
21359
|
|
|
21340
21360
|
#### Param
|
|
21341
21361
|
|
|
21362
|
+
**opt**
|
|
21363
|
+
|
|
21342
21364
|
选项
|
|
21343
21365
|
|
|
21344
21366
|
#### Call Signature
|
|
@@ -24152,6 +24174,8 @@ Defined in: [sys/mod.ts:1797](https://github.com/maiyunnet/kebab/blob/master/sys
|
|
|
24152
24174
|
|
|
24153
24175
|
#### Param
|
|
24154
24176
|
|
|
24177
|
+
**key**
|
|
24178
|
+
|
|
24155
24179
|
是否以某个字段为主键
|
|
24156
24180
|
|
|
24157
24181
|
#### Call Signature
|
|
@@ -24188,6 +24212,8 @@ Defined in: [sys/mod.ts:1140](https://github.com/maiyunnet/kebab/blob/master/sys
|
|
|
24188
24212
|
|
|
24189
24213
|
#### Param
|
|
24190
24214
|
|
|
24215
|
+
**key**
|
|
24216
|
+
|
|
24191
24217
|
是否以某个字段为主键
|
|
24192
24218
|
|
|
24193
24219
|
#### Call Signature
|
|
@@ -24384,6 +24410,8 @@ ON 信息
|
|
|
24384
24410
|
|
|
24385
24411
|
#### Param
|
|
24386
24412
|
|
|
24413
|
+
**all**
|
|
24414
|
+
|
|
24387
24415
|
是否获取完全的情况,默认不获取,只返回扫描情况
|
|
24388
24416
|
|
|
24389
24417
|
#### Call Signature
|
|
@@ -24448,10 +24476,14 @@ Defined in: [sys/mod.ts:1640](https://github.com/maiyunnet/kebab/blob/master/sys
|
|
|
24448
24476
|
|
|
24449
24477
|
#### Param
|
|
24450
24478
|
|
|
24479
|
+
**lock**
|
|
24480
|
+
|
|
24451
24481
|
是否加锁
|
|
24452
24482
|
|
|
24453
24483
|
#### Param
|
|
24454
24484
|
|
|
24485
|
+
**array**
|
|
24486
|
+
|
|
24455
24487
|
是否返回原生对象
|
|
24456
24488
|
|
|
24457
24489
|
#### Call Signature
|
|
@@ -24992,10 +25024,14 @@ Defined in: [sys/mod.ts:973](https://github.com/maiyunnet/kebab/blob/master/sys/
|
|
|
24992
25024
|
|
|
24993
25025
|
#### Param
|
|
24994
25026
|
|
|
25027
|
+
**n**
|
|
25028
|
+
|
|
24995
25029
|
字符串或键/值
|
|
24996
25030
|
|
|
24997
25031
|
#### Param
|
|
24998
25032
|
|
|
25033
|
+
**v**
|
|
25034
|
+
|
|
24999
25035
|
可能是数字
|
|
25000
25036
|
|
|
25001
25037
|
#### Call Signature
|
|
@@ -25464,21 +25500,27 @@ Defined in: [sys/mod.ts:264](https://github.com/maiyunnet/kebab/blob/master/sys/
|
|
|
25464
25500
|
|
|
25465
25501
|
### json()
|
|
25466
25502
|
|
|
25467
|
-
> `static` **json
|
|
25503
|
+
> `static` **json**\<`T`\>(`obj`): `T`
|
|
25468
25504
|
|
|
25469
25505
|
Defined in: [sys/mod.ts:193](https://github.com/maiyunnet/kebab/blob/master/sys/mod.ts#L193)
|
|
25470
25506
|
|
|
25471
25507
|
创建 JSON 字符串对象,用于 PGSQL 的 jsonb 字段
|
|
25472
25508
|
|
|
25509
|
+
#### Type Parameters
|
|
25510
|
+
|
|
25511
|
+
##### T
|
|
25512
|
+
|
|
25513
|
+
`T`
|
|
25514
|
+
|
|
25473
25515
|
#### Parameters
|
|
25474
25516
|
|
|
25475
25517
|
##### obj
|
|
25476
25518
|
|
|
25477
|
-
`
|
|
25519
|
+
`T`
|
|
25478
25520
|
|
|
25479
25521
|
#### Returns
|
|
25480
25522
|
|
|
25481
|
-
`
|
|
25523
|
+
`T`
|
|
25482
25524
|
|
|
25483
25525
|
***
|
|
25484
25526
|
|
|
@@ -25488,14 +25530,20 @@ Defined in: [sys/mod.ts:193](https://github.com/maiyunnet/kebab/blob/master/sys/
|
|
|
25488
25530
|
|
|
25489
25531
|
#### Param
|
|
25490
25532
|
|
|
25533
|
+
**db**
|
|
25534
|
+
|
|
25491
25535
|
数据库对象
|
|
25492
25536
|
|
|
25493
25537
|
#### Param
|
|
25494
25538
|
|
|
25539
|
+
**s**
|
|
25540
|
+
|
|
25495
25541
|
筛选条件数组或字符串
|
|
25496
25542
|
|
|
25497
25543
|
#### Param
|
|
25498
25544
|
|
|
25545
|
+
**opt**
|
|
25546
|
+
|
|
25499
25547
|
选项(opt.pre: MySQL 表前缀/PostgreSQL Schema 名;lock 需确保 where 条件命中索引,否则可能退化为表锁)
|
|
25500
25548
|
|
|
25501
25549
|
#### Call Signature
|
|
@@ -26510,7 +26558,7 @@ sys/route/functions/getFormData.md
|
|
|
26510
26558
|
|
|
26511
26559
|
> **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)\>; \}\>
|
|
26512
26560
|
|
|
26513
|
-
Defined in: [sys/route.ts:
|
|
26561
|
+
Defined in: [sys/route.ts:980](https://github.com/maiyunnet/kebab/blob/master/sys/route.ts#L980)
|
|
26514
26562
|
|
|
26515
26563
|
获取 formdata 的 post
|
|
26516
26564
|
|
|
@@ -26577,7 +26625,7 @@ sys/route/functions/getPost.md
|
|
|
26577
26625
|
|
|
26578
26626
|
> **getPost**(`req`): `Promise`\<\{ `input`: `string`; `post`: `Record`\<`string`, `any`\>; `raw`: `Record`\<`string`, `any`\>; \}\>
|
|
26579
26627
|
|
|
26580
|
-
Defined in: [sys/route.ts:
|
|
26628
|
+
Defined in: [sys/route.ts:894](https://github.com/maiyunnet/kebab/blob/master/sys/route.ts#L894)
|
|
26581
26629
|
|
|
26582
26630
|
获取 post 对象(通常已自动获取),如果是文件上传(formdata)的情况则不获取
|
|
26583
26631
|
|
|
@@ -26606,7 +26654,7 @@ sys/route/functions/run.md
|
|
|
26606
26654
|
|
|
26607
26655
|
> **run**(`data`): `Promise`\<`boolean`\>
|
|
26608
26656
|
|
|
26609
|
-
Defined in: [sys/route.ts:
|
|
26657
|
+
Defined in: [sys/route.ts:87](https://github.com/maiyunnet/kebab/blob/master/sys/route.ts#L87)
|
|
26610
26658
|
|
|
26611
26659
|
若为动态路径则执行此函数,此函数不进行判断 kebab.json 是否存在
|
|
26612
26660
|
|
|
@@ -26693,7 +26741,7 @@ sys/route/functions/unlinkUploadFiles.md
|
|
|
26693
26741
|
|
|
26694
26742
|
> **unlinkUploadFiles**(`cctr`): `Promise`\<`void`\>
|
|
26695
26743
|
|
|
26696
|
-
Defined in: [sys/route.ts:
|
|
26744
|
+
Defined in: [sys/route.ts:853](https://github.com/maiyunnet/kebab/blob/master/sys/route.ts#L853)
|
|
26697
26745
|
|
|
26698
26746
|
删除本次请求所有已上传的临时文件
|
|
26699
26747
|
|
|
@@ -26722,7 +26770,7 @@ sys/route/functions/waitCtr.md
|
|
|
26722
26770
|
|
|
26723
26771
|
> **waitCtr**(`cctr`): `Promise`\<`void`\>
|
|
26724
26772
|
|
|
26725
|
-
Defined in: [sys/route.ts:
|
|
26773
|
+
Defined in: [sys/route.ts:873](https://github.com/maiyunnet/kebab/blob/master/sys/route.ts#L873)
|
|
26726
26774
|
|
|
26727
26775
|
等待异步任务结束,并删除临时文件,如果结束后还有事务没关闭,则会在本函数中打印控制台并且写入 log 文件
|
|
26728
26776
|
此时其实已经给客户端返回了,此处等待不消耗客户端的等待时间
|
package/index.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Project: Kebab, User: JianSuoQiYue
|
|
3
3
|
* Date: 2019-3-30 12:46:41
|
|
4
|
-
* Last: 2020-3-8 21:04:24, 2022-07-22 14:20:34, 2023-5-24 01:34:57, 2025-6-13 14:49:27, 2025-10-1 10:11:54
|
|
4
|
+
* Last: 2020-3-8 21:04:24, 2022-07-22 14:20:34, 2023-5-24 01:34:57, 2025-6-13 14:49:27, 2025-10-1 10:11:54, 2026-07-14 17:40:00
|
|
5
5
|
* --- 本文件用来定义每个目录实体地址的常量 ---
|
|
6
6
|
*/
|
|
7
7
|
/** --- 当前系统版本号 --- */
|
|
8
|
-
export declare const VER = "9.
|
|
8
|
+
export declare const VER = "9.14.0";
|
|
9
9
|
/** --- 框架根目录,以 / 结尾 --- */
|
|
10
10
|
export declare const ROOT_PATH: string;
|
|
11
11
|
/** --- 框架的 LIB,以 / 结尾 --- */
|
package/index.js
CHANGED
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* Project: Kebab, User: JianSuoQiYue
|
|
4
4
|
* Date: 2019-3-30 12:46:41
|
|
5
|
-
* Last: 2020-3-8 21:04:24, 2022-07-22 14:20:34, 2023-5-24 01:34:57, 2025-6-13 14:49:27, 2025-10-1 10:11:54
|
|
5
|
+
* Last: 2020-3-8 21:04:24, 2022-07-22 14:20:34, 2023-5-24 01:34:57, 2025-6-13 14:49:27, 2025-10-1 10:11:54, 2026-07-14 17:40:00
|
|
6
6
|
* --- 本文件用来定义每个目录实体地址的常量 ---
|
|
7
7
|
*/
|
|
8
8
|
/** --- 当前系统版本号 --- */
|
|
9
|
-
export const VER = '9.
|
|
9
|
+
export const VER = '9.14.0';
|
|
10
10
|
// --- 服务端用的路径 ---
|
|
11
11
|
const imu = decodeURIComponent(import.meta.url).replace('file://', '').replace(/^\/(\w:)/, '$1');
|
|
12
12
|
/** --- /xxx/xxx --- */
|
package/lib/crypto.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Project: Kebab, User: JianSuoQiYue
|
|
3
3
|
* Date: 2019-4-2 14:01:06
|
|
4
|
-
* Last: 2020-3-12 14:05:24, 2022-09-12 11:52:35, 2024-9-8 17:09:39, 2024-11-11 00:21:58, 2025-6-18 20:27:47
|
|
4
|
+
* Last: 2020-3-12 14:05:24, 2022-09-12 11:52:35, 2024-9-8 17:09:39, 2024-11-11 00:21:58, 2025-6-18 20:27:47, 2026-07-29 11:51
|
|
5
5
|
*/
|
|
6
6
|
import * as crypto from 'crypto';
|
|
7
7
|
/**
|
|
@@ -31,8 +31,8 @@ export declare function generateKeyPair(type: string, options?: {
|
|
|
31
31
|
* @param format 输出格式
|
|
32
32
|
* @param algorithm 哈希方式
|
|
33
33
|
*/
|
|
34
|
-
export declare function sign(data:
|
|
35
|
-
export declare function sign(data:
|
|
34
|
+
export declare function sign(data: string | NodeJS.ArrayBufferView, privateKey: crypto.KeyLike | crypto.SignKeyObjectInput | crypto.SignPrivateKeyInput | crypto.SignJsonWebKeyInput, format: 'hex' | 'base64' | 'binary', algorithm?: string): string;
|
|
35
|
+
export declare function sign(data: string | NodeJS.ArrayBufferView, privateKey: crypto.KeyLike | crypto.SignKeyObjectInput | crypto.SignPrivateKeyInput | crypto.SignJsonWebKeyInput, format?: 'buffer', algorithm?: string): Buffer;
|
|
36
36
|
/**
|
|
37
37
|
* --- 非对称验签 ---
|
|
38
38
|
* @param data 数据
|
|
@@ -40,31 +40,31 @@ export declare function sign(data: crypto.BinaryLike, privateKey: crypto.KeyLike
|
|
|
40
40
|
* @param signature 签名
|
|
41
41
|
* @param algorithm 哈希方式
|
|
42
42
|
*/
|
|
43
|
-
export declare function verify(data:
|
|
43
|
+
export declare function verify(data: string | NodeJS.ArrayBufferView, object: crypto.KeyLike | crypto.VerifyKeyObjectInput | crypto.VerifyPublicKeyInput | crypto.VerifyJsonWebKeyInput, signature: NodeJS.ArrayBufferView, algorithm?: string): boolean;
|
|
44
44
|
/**
|
|
45
45
|
* --- 非对称公钥加密 ---
|
|
46
46
|
* @param key 公钥
|
|
47
47
|
* @param buffer 数据
|
|
48
48
|
*/
|
|
49
|
-
export declare function publicEncrypt(key: crypto.
|
|
49
|
+
export declare function publicEncrypt(key: crypto.KeyLike | crypto.PublicKeyInput | crypto.PrivateKeyInput, buffer: NodeJS.ArrayBufferView | string): Buffer;
|
|
50
50
|
/**
|
|
51
51
|
* --- 非对称私钥加密 ---
|
|
52
52
|
* @param key 私钥
|
|
53
53
|
* @param buffer 数据
|
|
54
54
|
*/
|
|
55
|
-
export declare function privateEncrypt(key: crypto.
|
|
55
|
+
export declare function privateEncrypt(key: crypto.KeyLike | crypto.PrivateKeyInput, buffer: NodeJS.ArrayBufferView | string): Buffer;
|
|
56
56
|
/**
|
|
57
57
|
* --- 非对称公钥解密 ---
|
|
58
58
|
* @param key 公钥
|
|
59
59
|
* @param buffer 数据
|
|
60
60
|
*/
|
|
61
|
-
export declare function publicDecrypt(key: crypto.
|
|
61
|
+
export declare function publicDecrypt(key: crypto.KeyLike | crypto.PublicKeyInput | crypto.PrivateKeyInput, buffer: NodeJS.ArrayBufferView | string): Buffer;
|
|
62
62
|
/**
|
|
63
63
|
* --- 非对称私钥解密 ---
|
|
64
64
|
* @param key 私钥
|
|
65
65
|
* @param buffer 数据
|
|
66
66
|
*/
|
|
67
|
-
export declare function privateDecrypt(key: crypto.
|
|
67
|
+
export declare function privateDecrypt(key: crypto.KeyLike | crypto.PrivateKeyInput, buffer: NodeJS.ArrayBufferView | string): Buffer;
|
|
68
68
|
/** --- 勿使用,无 iv 默认,但勿使用 --- */
|
|
69
69
|
export declare const AES_256_ECB = "aes-256-ecb";
|
|
70
70
|
/** --- 一般不用,兼容性场景下用 --- */
|
|
@@ -86,7 +86,7 @@ export declare const SM4_CFB = "sm4-cfb";
|
|
|
86
86
|
* @param method 加密方法
|
|
87
87
|
* @param output 输出类型
|
|
88
88
|
*/
|
|
89
|
-
export declare function cipherEncrypt(original: string | Buffer, key: crypto.
|
|
89
|
+
export declare function cipherEncrypt(original: string | Buffer, key: crypto.KeyLike, iv?: string, method?: string, output?: 'base64' | 'buffer'): string | Buffer | false;
|
|
90
90
|
/**
|
|
91
91
|
* --- AES 加密 ---
|
|
92
92
|
* @param original 原始字符串
|
|
@@ -95,16 +95,16 @@ export declare function cipherEncrypt(original: string | Buffer, key: crypto.Cip
|
|
|
95
95
|
* @param method 加密方法
|
|
96
96
|
* @param output 输出类型
|
|
97
97
|
*/
|
|
98
|
-
export declare function aesEncrypt(original: string | Buffer, key: crypto.
|
|
99
|
-
export declare function aesEncrypt(original: string | Buffer, key: crypto.
|
|
98
|
+
export declare function aesEncrypt(original: string | Buffer, key: crypto.KeyLike, iv: string, method: string, output: 'buffer'): Buffer | false;
|
|
99
|
+
export declare function aesEncrypt(original: string | Buffer, key: crypto.KeyLike, iv?: string, method?: string, output?: 'base64'): string | false;
|
|
100
100
|
/**
|
|
101
101
|
* --- AES GCM 托管加密 ---
|
|
102
102
|
* @param original 原始字符串
|
|
103
103
|
* @param key 密钥尽量 32 个英文字母和数字,不是 32 个系统会自动处理
|
|
104
104
|
* @param output 输出类型
|
|
105
105
|
*/
|
|
106
|
-
export declare function gcmEncrypt(original: string | Buffer, key: crypto.
|
|
107
|
-
export declare function gcmEncrypt(original: string | Buffer, key: crypto.
|
|
106
|
+
export declare function gcmEncrypt(original: string | Buffer, key: crypto.KeyLike, output: 'buffer'): Buffer | false;
|
|
107
|
+
export declare function gcmEncrypt(original: string | Buffer, key: crypto.KeyLike, output?: 'base64'): string | false;
|
|
108
108
|
/**
|
|
109
109
|
* --- SM4 加密 ---
|
|
110
110
|
* @param original 原始字符串
|
|
@@ -112,8 +112,8 @@ export declare function gcmEncrypt(original: string | Buffer, key: crypto.Cipher
|
|
|
112
112
|
* @param iv 向量 16 个英文字母和数字
|
|
113
113
|
* @param method 加密方法
|
|
114
114
|
*/
|
|
115
|
-
export declare function sm4Encrypt(original: string | Buffer, key: crypto.
|
|
116
|
-
export declare function sm4Encrypt(original: string | Buffer, key: crypto.
|
|
115
|
+
export declare function sm4Encrypt(original: string | Buffer, key: crypto.KeyLike, iv: string, method: string, output: 'buffer'): Buffer | false;
|
|
116
|
+
export declare function sm4Encrypt(original: string | Buffer, key: crypto.KeyLike, iv?: string, method?: string, output?: 'base64'): string | false;
|
|
117
117
|
/**
|
|
118
118
|
* --- cipher 解密 ---
|
|
119
119
|
* @param encrypt 需解密的字符串
|
|
@@ -122,7 +122,7 @@ export declare function sm4Encrypt(original: string | Buffer, key: crypto.Cipher
|
|
|
122
122
|
* @param method 加密方法
|
|
123
123
|
* @param output 输出类型
|
|
124
124
|
*/
|
|
125
|
-
export declare function cipherDecrypt(encrypt: string | Buffer, key: crypto.
|
|
125
|
+
export declare function cipherDecrypt(encrypt: string | Buffer, key: crypto.KeyLike, iv?: string, method?: string, output?: 'binary' | 'buffer'): string | Buffer | false;
|
|
126
126
|
/**
|
|
127
127
|
* --- AES 解密 ---
|
|
128
128
|
* @param encrypt 需解密的字符串
|
|
@@ -130,16 +130,16 @@ export declare function cipherDecrypt(encrypt: string | Buffer, key: crypto.Ciph
|
|
|
130
130
|
* @param iv 向量 16(CTR) 或 12(GCM) 个英文字母和数字
|
|
131
131
|
* @param method 加密方法
|
|
132
132
|
*/
|
|
133
|
-
export declare function aesDecrypt(encrypt: string | Buffer, key: crypto.
|
|
134
|
-
export declare function aesDecrypt(encrypt: string | Buffer, key: crypto.
|
|
133
|
+
export declare function aesDecrypt(encrypt: string | Buffer, key: crypto.KeyLike, iv: string, method: string, output: 'buffer'): Buffer | false;
|
|
134
|
+
export declare function aesDecrypt(encrypt: string | Buffer, key: crypto.KeyLike, iv?: string, method?: string, output?: 'binary'): string | false;
|
|
135
135
|
/**
|
|
136
136
|
* --- AES 解密 ---
|
|
137
137
|
* @param encrypt 需解密的字符串
|
|
138
138
|
* @param key 密钥 32 个英文字母和数字
|
|
139
139
|
* @param output 输出类型
|
|
140
140
|
*/
|
|
141
|
-
export declare function gcmDecrypt(encrypt: string | Buffer, key: crypto.
|
|
142
|
-
export declare function gcmDecrypt(encrypt: string | Buffer, key: crypto.
|
|
141
|
+
export declare function gcmDecrypt(encrypt: string | Buffer, key: crypto.KeyLike, output: 'buffer'): Buffer | false;
|
|
142
|
+
export declare function gcmDecrypt(encrypt: string | Buffer, key: crypto.KeyLike, output?: 'binary'): string | false;
|
|
143
143
|
/**
|
|
144
144
|
* --- SM4 解密 ---
|
|
145
145
|
* @param encrypt 需解密的字符串
|
|
@@ -147,24 +147,24 @@ export declare function gcmDecrypt(encrypt: string | Buffer, key: crypto.CipherK
|
|
|
147
147
|
* @param iv 向量 16 个英文字母和数字
|
|
148
148
|
* @param method 加密方法
|
|
149
149
|
*/
|
|
150
|
-
export declare function sm4Decrypt(encrypt: string | Buffer, key: crypto.
|
|
151
|
-
export declare function sm4Decrypt(encrypt: string | Buffer, key: crypto.
|
|
150
|
+
export declare function sm4Decrypt(encrypt: string | Buffer, key: crypto.KeyLike, iv: string, method: string, output: 'buffer'): Buffer | false;
|
|
151
|
+
export declare function sm4Decrypt(encrypt: string | Buffer, key: crypto.KeyLike, iv?: string, method?: string, output?: 'binary'): string | false;
|
|
152
152
|
/**
|
|
153
153
|
* --- hash 或 hmac 加密 ---
|
|
154
154
|
* @param algorithm 哈希方式
|
|
155
155
|
* @param data 源数据
|
|
156
156
|
* @param key 设置则采用 hmac 加密
|
|
157
157
|
*/
|
|
158
|
-
export declare function hashHmac(algorithm: string, data: Buffer | string, key?: crypto.
|
|
159
|
-
export declare function hashHmac(algorithm: string, data: Buffer | string, key: crypto.
|
|
158
|
+
export declare function hashHmac(algorithm: string, data: Buffer | string, key?: crypto.KeyLike, format?: 'hex' | 'base64'): string;
|
|
159
|
+
export declare function hashHmac(algorithm: string, data: Buffer | string, key: crypto.KeyLike | undefined, format: 'buffer'): Buffer;
|
|
160
160
|
/**
|
|
161
161
|
* --- hash 或 hmac 加密文件 ---
|
|
162
162
|
* @param algorithm 加密方式,如 md5、sha256、sm3 等
|
|
163
163
|
* @param path 文件路径
|
|
164
164
|
* @param key 设置则采用 hmac 加密
|
|
165
165
|
*/
|
|
166
|
-
export declare function hashHmacFile(algorithm: string, path: string, key?: crypto.
|
|
167
|
-
export declare function hashHmacFile(algorithm: string, path: string, key: crypto.
|
|
166
|
+
export declare function hashHmacFile(algorithm: string, path: string, key?: crypto.KeyLike, encoding?: 'hex' | 'base64' | 'base64url'): Promise<string | false>;
|
|
167
|
+
export declare function hashHmacFile(algorithm: string, path: string, key: crypto.KeyLike, encoding: 'buffer'): Promise<Buffer | false>;
|
|
168
168
|
/**
|
|
169
169
|
* --- base64 编码 ---
|
|
170
170
|
* @param data 字符串或 Buffer
|
package/lib/crypto.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Project: Kebab, User: JianSuoQiYue
|
|
3
3
|
* Date: 2019-4-2 14:01:06
|
|
4
|
-
* Last: 2020-3-12 14:05:24, 2022-09-12 11:52:35, 2024-9-8 17:09:39, 2024-11-11 00:21:58, 2025-6-18 20:27:47
|
|
4
|
+
* Last: 2020-3-12 14:05:24, 2022-09-12 11:52:35, 2024-9-8 17:09:39, 2024-11-11 00:21:58, 2025-6-18 20:27:47, 2026-07-29 11:51
|
|
5
5
|
*/
|
|
6
6
|
import * as crypto from 'crypto';
|
|
7
7
|
// --- 库和定义 ---
|
package/lib/db/conn.js
CHANGED
|
@@ -3,6 +3,8 @@ import * as lCore from '#kebab/lib/core.js';
|
|
|
3
3
|
import * as lTime from '#kebab/lib/time.js';
|
|
4
4
|
import * as lDb from '#kebab/lib/db.js';
|
|
5
5
|
// --- 注册解析器 ---
|
|
6
|
+
// --- pg 库对以下类型默认返回 string,为与 MySQL 行为保持一致,在此注册解析器转为 JS 原生类型 ---
|
|
7
|
+
// --- POLYGON: 返回如 ((1,1),(2,2)) 的字符串,解析为 {x, y}[] ---
|
|
6
8
|
pg.types.setTypeParser(pg.types.builtins.POLYGON, val => {
|
|
7
9
|
if (val === null) {
|
|
8
10
|
return null;
|
|
@@ -20,6 +22,7 @@ pg.types.setTypeParser(pg.types.builtins.POLYGON, val => {
|
|
|
20
22
|
// --- 返回 [{x: 1, y: 1}, {x :2, y: 2}, ... ] ---
|
|
21
23
|
return points;
|
|
22
24
|
});
|
|
25
|
+
// --- INT8 (bigint): JS Number 无法安全表示 64 位整数,pg 默认返回 string,parseInt 转为 number ---
|
|
23
26
|
pg.types.setTypeParser(pg.types.builtins.INT8, val => {
|
|
24
27
|
if (val === null) {
|
|
25
28
|
return null;
|
|
@@ -170,7 +173,7 @@ export class Connection {
|
|
|
170
173
|
}));
|
|
171
174
|
}
|
|
172
175
|
else {
|
|
173
|
-
const res = await this._link.
|
|
176
|
+
const res = await this._link.query(sql, values);
|
|
174
177
|
rtn.rows = res[0];
|
|
175
178
|
if (res[1]) {
|
|
176
179
|
rtn.fields = res[1].map(item => ({
|
|
@@ -236,7 +239,7 @@ export class Connection {
|
|
|
236
239
|
}));
|
|
237
240
|
}
|
|
238
241
|
else {
|
|
239
|
-
const res = await this._link.
|
|
242
|
+
const res = await this._link.query(sql, values);
|
|
240
243
|
rtn.packet = {
|
|
241
244
|
'affected': res[0].affectedRows,
|
|
242
245
|
'insert': res[0].insertId,
|
package/lib/sql.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@maiyunnet/kebab",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.14.0",
|
|
4
4
|
"description": "Simple, easy-to-use, and fully-featured Node.js framework that is ready-to-use out of the box.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"keywords": [
|
|
@@ -22,47 +22,47 @@
|
|
|
22
22
|
"#kebab/*": "./*"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@aws-sdk/client-s3": "^3.
|
|
26
|
-
"@aws-sdk/lib-storage": "^3.
|
|
25
|
+
"@aws-sdk/client-s3": "^3.1096.0",
|
|
26
|
+
"@aws-sdk/lib-storage": "^3.1096.0",
|
|
27
27
|
"@litert/http-client": "^1.1.2",
|
|
28
28
|
"@litert/mime": "^0.1.3",
|
|
29
29
|
"@litert/redis": "^3.2.1",
|
|
30
30
|
"@litert/websocket": "^0.2.8",
|
|
31
|
-
"@radix-ui/react-checkbox": "^1.3.
|
|
32
|
-
"@radix-ui/react-label": "^2.1.
|
|
33
|
-
"@radix-ui/react-slot": "^1.
|
|
34
|
-
"@radix-ui/react-switch": "^1.
|
|
35
|
-
"@tailwindcss/cli": "^4.3.
|
|
31
|
+
"@radix-ui/react-checkbox": "^1.3.11",
|
|
32
|
+
"@radix-ui/react-label": "^2.1.15",
|
|
33
|
+
"@radix-ui/react-slot": "^1.3.3",
|
|
34
|
+
"@radix-ui/react-switch": "^1.3.7",
|
|
35
|
+
"@tailwindcss/cli": "^4.3.3",
|
|
36
36
|
"@types/ssh2": "^1.15.5",
|
|
37
37
|
"ajv": "^8.20.0",
|
|
38
38
|
"ajv-formats": "^3.0.1",
|
|
39
39
|
"class-variance-authority": "^0.7.1",
|
|
40
40
|
"clsx": "^2.1.1",
|
|
41
|
-
"ejs": "^
|
|
42
|
-
"esbuild": "^0.28.
|
|
41
|
+
"ejs": "^6.0.1",
|
|
42
|
+
"esbuild": "^0.28.1",
|
|
43
43
|
"jszip": "^3.10.1",
|
|
44
|
-
"mysql2": "^3.
|
|
45
|
-
"node-cron": "^4.
|
|
46
|
-
"openai": "^
|
|
47
|
-
"pg": "^8.
|
|
48
|
-
"react": "^19.2.
|
|
49
|
-
"react-dom": "^19.2.
|
|
50
|
-
"react-router-dom": "^7.
|
|
44
|
+
"mysql2": "^3.23.2",
|
|
45
|
+
"node-cron": "^4.6.0",
|
|
46
|
+
"openai": "^7.0.0",
|
|
47
|
+
"pg": "^8.22.0",
|
|
48
|
+
"react": "^19.2.8",
|
|
49
|
+
"react-dom": "^19.2.8",
|
|
50
|
+
"react-router-dom": "^7.18.1",
|
|
51
51
|
"ssh2": "^1.17.0",
|
|
52
52
|
"svg-captcha": "^1.4.0",
|
|
53
53
|
"tailwind-merge": "^3.6.0",
|
|
54
|
-
"tencentcloud-sdk-nodejs": "^4.1.
|
|
55
|
-
"undici": "^8.
|
|
54
|
+
"tencentcloud-sdk-nodejs": "^4.1.277",
|
|
55
|
+
"undici": "^8.9.0"
|
|
56
56
|
},
|
|
57
57
|
"devDependencies": {
|
|
58
58
|
"@litert/eslint-plugin-rules": "^0.3.1",
|
|
59
59
|
"@types/ejs": "^3.1.5",
|
|
60
|
-
"@types/node": "^
|
|
60
|
+
"@types/node": "^26.1.2",
|
|
61
61
|
"@types/pg": "^8.20.0",
|
|
62
|
-
"@types/react": "^19.2.
|
|
62
|
+
"@types/react": "^19.2.17",
|
|
63
63
|
"@types/react-dom": "^19.2.3",
|
|
64
|
-
"typedoc": "^0.28.
|
|
65
|
-
"typedoc-plugin-markdown": "^4.
|
|
64
|
+
"typedoc": "^0.28.20",
|
|
65
|
+
"typedoc-plugin-markdown": "^4.12.0",
|
|
66
66
|
"typescript": "^6.0.3"
|
|
67
67
|
}
|
|
68
68
|
}
|
package/sys/child.js
CHANGED
|
@@ -47,6 +47,8 @@ let http2Server;
|
|
|
47
47
|
const linkCount = {};
|
|
48
48
|
/** --- 是否正在停止,停止时对 HTTP/1.1 响应追加 Connection: close,避免请求完成后连接回到保活池 --- */
|
|
49
49
|
let stopping = false;
|
|
50
|
+
/** --- 当前活跃的 HTTP/2 会话集合,用于 graceful shutdown 时发送 GOAWAY 帧 --- */
|
|
51
|
+
const http2Sessions = new Set();
|
|
50
52
|
/**
|
|
51
53
|
* --- 包装请求处理函数,统一管理 linkCount 计数和错误处理 ---
|
|
52
54
|
* @param key 连接标识
|
|
@@ -144,6 +146,12 @@ async function run() {
|
|
|
144
146
|
}
|
|
145
147
|
wrapWithLinkCount(host + (req.url ?? ''), () => upgradeHandler(req, socket, true, head), '[CHILD][http2][upgrade]', 'UPGRADE');
|
|
146
148
|
}).listen(lCore.globalConfig.httpsPort);
|
|
149
|
+
// --- 追踪 HTTP/2 会话,用于 graceful shutdown 时发送 GOAWAY 帧通知 CDN 切换连接 ---
|
|
150
|
+
http2Server.on('session', (session) => {
|
|
151
|
+
http2Sessions.add(session);
|
|
152
|
+
session.on('close', () => { http2Sessions.delete(session); });
|
|
153
|
+
session.on('error', () => { http2Sessions.delete(session); });
|
|
154
|
+
});
|
|
147
155
|
// --- 增大 HTTP/2 超时,防止 CDN 预建连接被 Node.js 过早关闭 ---
|
|
148
156
|
http2Server.setTimeout(120_000);
|
|
149
157
|
httpServer = http.createServer(function (req, res) {
|
|
@@ -303,7 +311,9 @@ async function requestHandler(req, res, https) {
|
|
|
303
311
|
res.setHeader('content-length', Buffer.byteLength(content));
|
|
304
312
|
lCore.writeHead(res, 500);
|
|
305
313
|
}
|
|
306
|
-
res.
|
|
314
|
+
if (!res.writableEnded) {
|
|
315
|
+
res.end(content);
|
|
316
|
+
}
|
|
307
317
|
return;
|
|
308
318
|
}
|
|
309
319
|
}
|
|
@@ -344,7 +354,9 @@ async function requestHandler(req, res, https) {
|
|
|
344
354
|
res.setHeader('content-length', Buffer.byteLength(content));
|
|
345
355
|
lCore.writeHead(res, 500);
|
|
346
356
|
}
|
|
347
|
-
res.
|
|
357
|
+
if (!res.writableEnded) {
|
|
358
|
+
res.end(content);
|
|
359
|
+
}
|
|
348
360
|
return;
|
|
349
361
|
}
|
|
350
362
|
}
|
|
@@ -558,6 +570,13 @@ process.on('message', function (msg) {
|
|
|
558
570
|
case 'stop': {
|
|
559
571
|
// --- 需要停止监听,等待已有连接全部断开,然后关闭线程 ---
|
|
560
572
|
stopping = true;
|
|
573
|
+
// --- 向所有 HTTP/2 会话发送 GOAWAY 帧,通知 CDN 客户端停止在该连接上发送新请求并切换到新连接 ---
|
|
574
|
+
for (const session of http2Sessions) {
|
|
575
|
+
try {
|
|
576
|
+
session.goaway(http2.constants.NGHTTP2_NO_ERROR);
|
|
577
|
+
}
|
|
578
|
+
catch { }
|
|
579
|
+
}
|
|
561
580
|
httpServer?.close();
|
|
562
581
|
http2Server?.close();
|
|
563
582
|
// --- 立即关闭空闲保活连接(无活跃请求的 keep-alive socket),避免进程长时间等待 ---
|
package/sys/master.js
CHANGED
|
@@ -18,6 +18,29 @@ import * as lTime from '#kebab/lib/time.js';
|
|
|
18
18
|
import * as lZip from '#kebab/lib/zip.js';
|
|
19
19
|
/** --- 当前运行中的子进程列表 --- */
|
|
20
20
|
const workerList = {};
|
|
21
|
+
/**
|
|
22
|
+
* --- 等待指定 worker 开始监听端口就绪 ---
|
|
23
|
+
* @param worker 要等待的 worker 对象
|
|
24
|
+
* @param timeout 超时时间(毫秒),默认 30 秒
|
|
25
|
+
*/
|
|
26
|
+
function waitForWorkerListening(worker, timeout = 30_000) {
|
|
27
|
+
return new Promise((resolve) => {
|
|
28
|
+
let timer;
|
|
29
|
+
const onListening = (w) => {
|
|
30
|
+
if (w.id === worker.id) {
|
|
31
|
+
clearTimeout(timer);
|
|
32
|
+
cluster.removeListener('listening', onListening);
|
|
33
|
+
resolve();
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
timer = setTimeout(() => {
|
|
37
|
+
lCore.display(`[master] Worker ${worker.process.pid ?? 'undefined'} timed out waiting for listening, proceeding anyway.`);
|
|
38
|
+
cluster.removeListener('listening', onListening);
|
|
39
|
+
resolve();
|
|
40
|
+
}, timeout);
|
|
41
|
+
cluster.on('listening', onListening);
|
|
42
|
+
});
|
|
43
|
+
}
|
|
21
44
|
/**
|
|
22
45
|
* --- 最终调用执行的函数块 ---
|
|
23
46
|
*/
|
|
@@ -124,16 +147,7 @@ function createRpcListener() {
|
|
|
124
147
|
break;
|
|
125
148
|
}
|
|
126
149
|
case 'restart': {
|
|
127
|
-
|
|
128
|
-
for (const pid in workerList) {
|
|
129
|
-
workerList[pid].worker.send({
|
|
130
|
-
'action': 'stop'
|
|
131
|
-
});
|
|
132
|
-
// --- 开启新线程 ---
|
|
133
|
-
await createChildProcess(workerList[pid].cpu);
|
|
134
|
-
// --- 删除记录 ---
|
|
135
|
-
delete workerList[pid];
|
|
136
|
-
}
|
|
150
|
+
await restartWorkers();
|
|
137
151
|
break;
|
|
138
152
|
}
|
|
139
153
|
case 'global': {
|
|
@@ -768,6 +782,34 @@ function createRpcListener() {
|
|
|
768
782
|
});
|
|
769
783
|
}).listen(lCore.globalConfig.rpcPort);
|
|
770
784
|
}
|
|
785
|
+
/**
|
|
786
|
+
* --- 零宕机重启所有 worker 进程:先创建新进程并等待监听就绪,再停止旧进程 ---
|
|
787
|
+
*/
|
|
788
|
+
async function restartWorkers() {
|
|
789
|
+
// --- 收集旧进程信息(先快照,避免迭代过程中修改 workerList) ---
|
|
790
|
+
const oldEntries = [];
|
|
791
|
+
for (const pid in workerList) {
|
|
792
|
+
oldEntries.push({
|
|
793
|
+
'pid': pid,
|
|
794
|
+
'cpu': workerList[pid].cpu,
|
|
795
|
+
'worker': workerList[pid].worker
|
|
796
|
+
});
|
|
797
|
+
}
|
|
798
|
+
// --- 阶段 1:创建新进程并等待其监听端口就绪 ---
|
|
799
|
+
for (const entry of oldEntries) {
|
|
800
|
+
const newWorker = await createChildProcess(entry.cpu);
|
|
801
|
+
if (newWorker) {
|
|
802
|
+
await waitForWorkerListening(newWorker);
|
|
803
|
+
}
|
|
804
|
+
}
|
|
805
|
+
// --- 阶段 2:停止旧进程 ---
|
|
806
|
+
for (const entry of oldEntries) {
|
|
807
|
+
entry.worker.send({
|
|
808
|
+
'action': 'stop'
|
|
809
|
+
});
|
|
810
|
+
delete workerList[entry.pid];
|
|
811
|
+
}
|
|
812
|
+
}
|
|
771
813
|
/**
|
|
772
814
|
* --- 检测是否有死掉丢失的子进程,复活之 ---
|
|
773
815
|
*/
|
|
@@ -795,7 +837,7 @@ async function checkWorkerLost() {
|
|
|
795
837
|
async function createChildProcess(cpu) {
|
|
796
838
|
const worker = cluster.fork();
|
|
797
839
|
if (!worker.process.pid) {
|
|
798
|
-
return;
|
|
840
|
+
return null;
|
|
799
841
|
}
|
|
800
842
|
workerList[worker.process.pid] = {
|
|
801
843
|
'worker': worker,
|
|
@@ -823,16 +865,7 @@ async function createChildProcess(cpu) {
|
|
|
823
865
|
break;
|
|
824
866
|
}
|
|
825
867
|
case 'restart': {
|
|
826
|
-
|
|
827
|
-
for (const pid in workerList) {
|
|
828
|
-
workerList[pid].worker.send({
|
|
829
|
-
'action': 'stop'
|
|
830
|
-
});
|
|
831
|
-
// --- 开启新线程 ---
|
|
832
|
-
await createChildProcess(workerList[pid].cpu);
|
|
833
|
-
// --- 删除记录 ---
|
|
834
|
-
delete workerList[pid];
|
|
835
|
-
}
|
|
868
|
+
await restartWorkers();
|
|
836
869
|
break;
|
|
837
870
|
}
|
|
838
871
|
case 'global': {
|
|
@@ -889,6 +922,7 @@ async function createChildProcess(cpu) {
|
|
|
889
922
|
'data': lCore.global
|
|
890
923
|
});
|
|
891
924
|
}
|
|
925
|
+
return worker;
|
|
892
926
|
}
|
|
893
927
|
/**
|
|
894
928
|
* --- 开发模式下的文件监听自动重载(HMR),仅在 debug: true 时启用 ---
|
|
@@ -919,18 +953,10 @@ function startFileWatcher() {
|
|
|
919
953
|
}
|
|
920
954
|
restarting = true;
|
|
921
955
|
lCore.display(`[HMR] File changed: ${formatName}, reloading workers...`);
|
|
922
|
-
(
|
|
923
|
-
// --- 为所有子进程发送 stop 信息并重启 ---
|
|
924
|
-
for (const pid in workerList) {
|
|
925
|
-
workerList[pid].worker.send({
|
|
926
|
-
'action': 'stop'
|
|
927
|
-
});
|
|
928
|
-
await createChildProcess(workerList[pid].cpu);
|
|
929
|
-
delete workerList[pid];
|
|
930
|
-
}
|
|
956
|
+
restartWorkers().then(() => {
|
|
931
957
|
restarting = false;
|
|
932
958
|
lCore.display('[HMR] All workers reloaded.');
|
|
933
|
-
})
|
|
959
|
+
}).catch((e) => {
|
|
934
960
|
restarting = false;
|
|
935
961
|
lCore.display('[HMR] Reload error:', e);
|
|
936
962
|
});
|
package/sys/mod.d.ts
CHANGED
package/sys/route.js
CHANGED
|
@@ -37,7 +37,9 @@ function respond500(res) {
|
|
|
37
37
|
res.setHeader('content-length', Buffer.byteLength(content));
|
|
38
38
|
lCore.writeHead(res, 500);
|
|
39
39
|
}
|
|
40
|
-
res.
|
|
40
|
+
if (!res.writableEnded) {
|
|
41
|
+
res.end(content);
|
|
42
|
+
}
|
|
41
43
|
}
|
|
42
44
|
/**
|
|
43
45
|
* --- 输出 404 错误响应 ---
|
|
@@ -47,16 +49,24 @@ function respond500(res) {
|
|
|
47
49
|
*/
|
|
48
50
|
function respond404(res, config, path) {
|
|
49
51
|
if (config?.route?.['#404']) {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
52
|
+
if (!res.headersSent) {
|
|
53
|
+
res.setHeader('location', lText.urlResolve(config.const.urlBase, config.route['#404']));
|
|
54
|
+
lCore.writeHead(res, 302);
|
|
55
|
+
}
|
|
56
|
+
if (!res.writableEnded) {
|
|
57
|
+
res.end('');
|
|
58
|
+
}
|
|
53
59
|
return;
|
|
54
60
|
}
|
|
55
61
|
const content = '[Error] Controller not found, path: ' + path + '.';
|
|
56
|
-
res.
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
62
|
+
if (!res.headersSent) {
|
|
63
|
+
res.setHeader('content-type', 'text/html; charset=utf-8');
|
|
64
|
+
res.setHeader('content-length', Buffer.byteLength(content));
|
|
65
|
+
lCore.writeHead(res, 404);
|
|
66
|
+
}
|
|
67
|
+
if (!res.writableEnded) {
|
|
68
|
+
res.end(content);
|
|
69
|
+
}
|
|
60
70
|
}
|
|
61
71
|
/**
|
|
62
72
|
* --- 若为动态路径则执行此函数,此函数不进行判断 kebab.json 是否存在 ---
|
|
@@ -5,5 +5,5 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import * as CheckboxPrimitive from '@radix-ui/react-checkbox';
|
|
7
7
|
type CheckboxProps = React.ComponentPropsWithoutRef<typeof CheckboxPrimitive.Root>;
|
|
8
|
-
export declare function Checkbox({ className, ...props }: CheckboxProps): import("react
|
|
8
|
+
export declare function Checkbox({ className, ...props }: CheckboxProps): import("react").JSX.Element;
|
|
9
9
|
export {};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
type InputProps = React.InputHTMLAttributes<HTMLInputElement>;
|
|
2
|
-
export declare function Input({ className, ...props }: InputProps): import("react
|
|
2
|
+
export declare function Input({ className, ...props }: InputProps): import("react").JSX.Element;
|
|
3
3
|
export {};
|
|
@@ -7,5 +7,5 @@ import * as LabelPrimitive from '@radix-ui/react-label';
|
|
|
7
7
|
import { type VariantProps } from 'class-variance-authority';
|
|
8
8
|
declare const labelVariants: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
|
|
9
9
|
type LabelProps = React.ComponentPropsWithoutRef<typeof LabelPrimitive.Root> & VariantProps<typeof labelVariants>;
|
|
10
|
-
export declare function Label({ className, ...props }: LabelProps): import("react
|
|
10
|
+
export declare function Label({ className, ...props }: LabelProps): import("react").JSX.Element;
|
|
11
11
|
export {};
|
|
@@ -5,5 +5,5 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import * as SwitchPrimitive from '@radix-ui/react-switch';
|
|
7
7
|
type SwitchProps = React.ComponentPropsWithoutRef<typeof SwitchPrimitive.Root>;
|
|
8
|
-
export declare function Switch({ className, ...props }: SwitchProps): import("react
|
|
8
|
+
export declare function Switch({ className, ...props }: SwitchProps): import("react").JSX.Element;
|
|
9
9
|
export {};
|
|
@@ -48,5 +48,5 @@ interface IProps {
|
|
|
48
48
|
* 框架负责用 StaticRouter(服务端)/ BrowserRouter(客户端)包裹本组件,
|
|
49
49
|
* 组件内部只需使用 Routes/Route/Link 等,无需自行包裹 Router。
|
|
50
50
|
*/
|
|
51
|
-
export default function ReactRouterPage({ title, serverTime, node, users, user, _urlBase, _urlStc, _staticVer, }: IProps): import("react
|
|
51
|
+
export default function ReactRouterPage({ title, serverTime, node, users, user, _urlBase, _urlStc, _staticVer, }: IProps): import("react").JSX.Element;
|
|
52
52
|
export {};
|
|
@@ -44,5 +44,5 @@ interface IProps {
|
|
|
44
44
|
'_staticVer': string;
|
|
45
45
|
}
|
|
46
46
|
/** --- Kebab React 全页面演示 --- */
|
|
47
|
-
export default function ReactPage({ title, serverTime, node, _urlBase, _urlStc, _staticVer }: IProps): import("react
|
|
47
|
+
export default function ReactPage({ title, serverTime, node, _urlBase, _urlStc, _staticVer }: IProps): import("react").JSX.Element;
|
|
48
48
|
export {};
|