mas-server 2.0.1 → 2.0.2
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/dist/index.js +138 -136
- package/dist/state.js +4 -4
- package/dist/typings/index.js +2 -2
- package/dist/utils/apiDoc.js +18 -18
- package/dist/utils/getLog.js +18 -18
- package/dist/utils/getRouteByApiSrc.js +54 -54
- package/dist/utils/mas-encrypt.min.js +3072 -0
- package/dist/utils/masUtils.js +12 -12
- package/dist/utils/meaToken.js +57 -57
- package/dist/utils/quickSend.js +32 -32
- package/dist/utils/readApi.js +50 -50
- package/dist/utils/validRouteData.js +37 -37
- package/dist/utils/validToken.js +24 -24
- package/dist/utils/validType.js +101 -101
- package/package.json +49 -48
- package/src/index.ts +2 -0
- package/src/utils/meaToken.ts +1 -1
- package/test/config/api.config.ts +2 -2
- package/test/config/config.ts +1 -1
- package/test/src/sqlform.json +12 -1
- package/test//345/276/205/345/274/200/345/217/221.md +3 -1
package/package.json
CHANGED
|
@@ -1,49 +1,50 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "mas-server",
|
|
3
|
-
"version": "2.0.
|
|
4
|
-
"description": "一款基于express面向中小型项目的后端框架",
|
|
5
|
-
"main": "dist/index.js",
|
|
6
|
-
"typings": "src/index.ts",
|
|
7
|
-
"scripts": {
|
|
8
|
-
"testdev": "npx ts-node-dev --transpile-only ./test/scripts/run.ts --respawn",
|
|
9
|
-
"test": "npx ts-node ./test/scripts/beforeCreated.ts -end && npx ts-node ./test/scripts/run.ts",
|
|
10
|
-
"testmon": "npx nodemon ./test/scripts/run.ts",
|
|
11
|
-
"testTS": "npx nodemon ./test/test.ts",
|
|
12
|
-
"createSql": "npx ts-node ./test/scripts/createSqlForm.ts",
|
|
13
|
-
"createApi": "npx ts-node ./test/scripts/createApiFile.ts",
|
|
14
|
-
"createApis": "npx ts-node ./test/scripts/createApis.ts",
|
|
15
|
-
"init": "npx nodemon ./test/scripts/beforeCreated.ts -end",
|
|
16
|
-
"gsft": "npx nodemon ./test/scripts/getSqlFormType.ts"
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
"
|
|
20
|
-
"
|
|
21
|
-
"
|
|
22
|
-
|
|
23
|
-
"
|
|
24
|
-
"
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
"express
|
|
28
|
-
"
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
-
"
|
|
32
|
-
"
|
|
33
|
-
"
|
|
34
|
-
"
|
|
35
|
-
"
|
|
36
|
-
"
|
|
37
|
-
"ts-node
|
|
38
|
-
"
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
"
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
"@types/
|
|
47
|
-
"@types/
|
|
48
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "mas-server",
|
|
3
|
+
"version": "2.0.2",
|
|
4
|
+
"description": "一款基于express面向中小型项目的后端框架",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"typings": "src/index.ts",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"testdev": "npx ts-node-dev --transpile-only ./test/scripts/run.ts --respawn",
|
|
9
|
+
"test": "npx ts-node ./test/scripts/beforeCreated.ts -end && npx ts-node ./test/scripts/run.ts",
|
|
10
|
+
"testmon": "npx nodemon ./test/scripts/run.ts",
|
|
11
|
+
"testTS": "npx nodemon ./test/test.ts",
|
|
12
|
+
"createSql": "npx ts-node ./test/scripts/createSqlForm.ts",
|
|
13
|
+
"createApi": "npx ts-node ./test/scripts/createApiFile.ts",
|
|
14
|
+
"createApis": "npx ts-node ./test/scripts/createApis.ts",
|
|
15
|
+
"init": "npx nodemon ./test/scripts/beforeCreated.ts -end",
|
|
16
|
+
"gsft": "npx nodemon ./test/scripts/getSqlFormType.ts",
|
|
17
|
+
"build":"tsc"
|
|
18
|
+
},
|
|
19
|
+
"keywords": [],
|
|
20
|
+
"author": "tingxi8087",
|
|
21
|
+
"license": "ISC",
|
|
22
|
+
"dependencies": {
|
|
23
|
+
"@types/express": "^4.17.17",
|
|
24
|
+
"ansi-colors": "^4.1.3",
|
|
25
|
+
"axios": "^1.3.6",
|
|
26
|
+
"cors": "^2.8.5",
|
|
27
|
+
"express": "^4.18.2",
|
|
28
|
+
"express-ip": "^1.0.4",
|
|
29
|
+
"fs-extra": "^11.1.1",
|
|
30
|
+
"glob": "^10.3.1",
|
|
31
|
+
"mas-encrypt": "^1.0.0",
|
|
32
|
+
"masmysql": "^2.0.4",
|
|
33
|
+
"module-alias": "^2.2.2",
|
|
34
|
+
"moment": "^2.29.4",
|
|
35
|
+
"mysql": "^2.18.1",
|
|
36
|
+
"nodemon": "^2.0.22",
|
|
37
|
+
"ts-node": "^10.9.1",
|
|
38
|
+
"ts-node-dev": "^2.0.0",
|
|
39
|
+
"typescript": "^5.0.4"
|
|
40
|
+
},
|
|
41
|
+
"_moduleAliases": {
|
|
42
|
+
"@": "src/",
|
|
43
|
+
"@@": "."
|
|
44
|
+
},
|
|
45
|
+
"devDependencies": {
|
|
46
|
+
"@types/cors": "^2.8.13",
|
|
47
|
+
"@types/express": "^4.17.17",
|
|
48
|
+
"@types/moment": "^2.13.0"
|
|
49
|
+
}
|
|
49
50
|
}
|
package/src/index.ts
CHANGED
|
@@ -31,6 +31,7 @@ import {
|
|
|
31
31
|
import type { createSqlFormType, sqlForm } from "masmysql";
|
|
32
32
|
import apiDoc from "./utils/apiDoc";
|
|
33
33
|
import { createToken, validToken } from "./utils/meaToken";
|
|
34
|
+
import validType from "./utils/validType";
|
|
34
35
|
|
|
35
36
|
// =================================================================
|
|
36
37
|
export function getApp(
|
|
@@ -121,6 +122,7 @@ export {
|
|
|
121
122
|
massql,
|
|
122
123
|
validToken,
|
|
123
124
|
createToken,
|
|
125
|
+
validType
|
|
124
126
|
};
|
|
125
127
|
export type {
|
|
126
128
|
masReq,
|
package/src/utils/meaToken.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { apiConfigType } from "@/index";
|
|
2
|
-
const apiConfig: apiConfigType = {"/api/curd/student/del":{"name":"删除数据","methods":"all","des":"","validFormat":{"id":Number}},"/api/curd/student/get":{"name":"得到数据","methods":"all","des":"","validFormat":null},"/api/curd/student/set":{"name":"修改或添加数据","methods":"all","des":"","validFormat":null},"/api/index":{"name":"默认接口","methods":"post","des":"一个默认接口","validFormat":{"arr":[{"name":String,"age":Number}]},"header":[{"name":"token","type":String,"des":"token密钥"}],"validFormatDes":[{"name":"arr","type":{"arr":[{"name":String,"age":Number}]},"des":"学生数组"},{"name":"arg1","type":Number,"des":"可选参数","optional":true}],"example":{"arr":[{"name":"小明","age":18}]},"resExample":{"status":1,"data":"hello mas!","msg":""}},"/api/per":{"name":"新建接口","methods":"all","des":"","validFormat":null},"/api/person/del":{"name":"新建接口","methods":"all","des":"","validFormat":{"arr":[String]}},"/api/person/get":{"name":"新建接口","methods":"all","des":""},"/api/person/set":{"name":"新建接口","methods":"all","des":""},"/api/test":{"name":"新建接口","methods":"all","des":"","validFormat":null},"/api/validtest/boolArr":{"name":"新建接口","methods":"all","des":"","validFormat":[{"name":String}]}};
|
|
1
|
+
import { apiConfigType } from "@/index";
|
|
2
|
+
const apiConfig: apiConfigType = {"/api/curd/student/del":{"name":"删除数据","methods":"all","des":"","validFormat":{"id":Number}},"/api/curd/student/get":{"name":"得到数据","methods":"all","des":"","validFormat":null},"/api/curd/student/set":{"name":"修改或添加数据","methods":"all","des":"","validFormat":null},"/api/index":{"name":"默认接口","methods":"post","des":"一个默认接口","validFormat":{"arr":[{"name":String,"age":Number}]},"header":[{"name":"token","type":String,"des":"token密钥"}],"validFormatDes":[{"name":"arr","type":{"arr":[{"name":String,"age":Number}]},"des":"学生数组"},{"name":"arg1","type":Number,"des":"可选参数","optional":true}],"example":{"arr":[{"name":"小明","age":18}]},"resExample":{"status":1,"data":"hello mas!","msg":""}},"/api/per":{"name":"新建接口","methods":"all","des":"","validFormat":null},"/api/person/del":{"name":"新建接口","methods":"all","des":"","validFormat":{"arr":[String]}},"/api/person/get":{"name":"新建接口","methods":"all","des":""},"/api/person/set":{"name":"新建接口","methods":"all","des":""},"/api/test":{"name":"新建接口","methods":"all","des":"","validFormat":null},"/api/validtest/boolArr":{"name":"新建接口","methods":"all","des":"","validFormat":[{"name":String}]}};
|
|
3
3
|
export default apiConfig;
|
package/test/config/config.ts
CHANGED
package/test/src/sqlform.json
CHANGED
|
@@ -1 +1,12 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"student": [
|
|
3
|
+
"name",
|
|
4
|
+
"age",
|
|
5
|
+
"des",
|
|
6
|
+
"create_time",
|
|
7
|
+
"update_time",
|
|
8
|
+
"is_delete",
|
|
9
|
+
"id",
|
|
10
|
+
"@!student"
|
|
11
|
+
]
|
|
12
|
+
}
|