mas-server 2.0.3 → 2.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (119) hide show
  1. package/.temp/merge/validType.ts +98 -0
  2. package/dist/index.js +8 -47
  3. package/dist/src/index.js +100 -0
  4. package/dist/src/state.js +4 -0
  5. package/dist/src/typings/index.js +2 -0
  6. package/dist/src/utils/apiDoc.js +33 -0
  7. package/dist/src/utils/createRouter.js +51 -0
  8. package/dist/src/utils/getLog.js +18 -0
  9. package/dist/src/utils/getRouterInfo.js +34 -0
  10. package/dist/src/utils/masUtils.js +12 -0
  11. package/dist/src/utils/meaToken.js +57 -0
  12. package/dist/src/utils/quickSend.js +32 -0
  13. package/dist/src/utils/readApi.js +50 -0
  14. package/dist/src/utils/validRouteData.js +37 -0
  15. package/dist/src/utils/validToken.js +24 -0
  16. package/dist/src/utils/validType.js +84 -0
  17. package/dist/test/apiTemplate/api.temp.js +24 -0
  18. package/dist/test/apiTemplate/curd/del.js +21 -0
  19. package/dist/test/apiTemplate/curd/get.js +21 -0
  20. package/dist/test/apiTemplate/curd/set.js +21 -0
  21. package/dist/test/config/config.js +31 -0
  22. package/dist/test/config/createSqlFormData.js +15 -0
  23. package/dist/test/config/defaultApiConfig.js +7 -0
  24. package/dist/test/config/docNav.js +0 -0
  25. package/dist/test/main.js +31 -0
  26. package/dist/test/scripts/beforeCreated.js +62 -0
  27. package/dist/test/scripts/createApiFile.js +52 -0
  28. package/dist/test/scripts/createApis.js +81 -0
  29. package/dist/test/scripts/createSqlForm.js +10 -0
  30. package/dist/test/scripts/getSqlFormType.js +56 -0
  31. package/dist/test/scripts/run.js +6 -0
  32. package/dist/test/src/api/example/ArrValid.js +21 -0
  33. package/dist/test/src/api/example/per.js +37 -0
  34. package/dist/test/src/api/example/tip.js +22 -0
  35. package/dist/test/src/api/example/validReqData.js +98 -0
  36. package/dist/test/src/api/index.js +24 -0
  37. package/dist/test/src/debug.js +10 -0
  38. package/dist/test/src/masState.js +4 -0
  39. package/dist/test/src/sql/selectStudent.js +10 -0
  40. package/dist/test/src/sqlform.json +1 -0
  41. package/dist/test/test.js +3 -0
  42. package/dist/utils/apiDoc.js +17 -2
  43. package/dist/utils/createRouter.js +51 -0
  44. package/dist/utils/getRouterInfo.js +34 -0
  45. package/dist/utils/validRouteData.js +1 -1
  46. package/dist/utils/validToken.js +1 -1
  47. package/dist/utils/validType.js +0 -17
  48. package/package.json +5 -5
  49. package/{dist/apiDoc/assets/empty-907982e4.js → src/apiDoc/assets/empty-a6de4920.js} +1 -1
  50. package/src/apiDoc/assets/index-be53fe8f.css +6 -0
  51. package/src/apiDoc/assets/index-f9ab4187.js +1427 -0
  52. package/src/apiDoc/assets/jsoneditor-icons-45c98bf0.svg +749 -749
  53. package/src/apiDoc/index.html +2 -2
  54. package/src/index.ts +20 -24
  55. package/src/typings/index.ts +5 -5
  56. package/src/utils/apiDoc.ts +18 -2
  57. package/src/utils/createRouter.ts +22 -0
  58. package/src/utils/getRouterInfo.ts +28 -0
  59. package/src/utils/readApi.ts +0 -2
  60. package/src/utils/validRouteData.ts +1 -2
  61. package/src/utils/validToken.ts +1 -1
  62. package/src/utils/validType.ts +0 -17
  63. package/test/apiTemplate/api.temp.ts +8 -3
  64. package/test/config/config.ts +1 -1
  65. package/test/config/defaultApiConfig.ts +7 -0
  66. package/test/config/docNav.ts +0 -0
  67. package/test/main.ts +1 -0
  68. package/test/scripts/beforeCreated.ts +2 -41
  69. package/test/scripts/createApiFile.ts +0 -1
  70. package/test/scripts/createApis.ts +0 -48
  71. package/test/scripts/getSqlFormType.ts +2 -13
  72. package/test/src/api/example/ArrValid.ts +11 -0
  73. package/test/src/api/example/per.ts +34 -0
  74. package/test/src/api/example/tip.ts +9 -0
  75. package/test/src/api/example/validReqData.ts +85 -0
  76. package/test/src/api/index.ts +8 -1
  77. package/test/src/debug.ts +3 -50
  78. package/test/src/sqlform.json +1 -12
  79. package/test/test.ts +0 -12
  80. package/test//345/276/205/345/274/200/345/217/221.md +12 -6
  81. package/tsconfig-build.json +20 -0
  82. package/tsconfig.json +1 -3
  83. package/.temp/validType.ts +0 -96
  84. package/dist/apiDoc/assets/index-b56e6bc6.js +0 -1414
  85. package/dist/apiDoc/assets/index-bb16d834.css +0 -6
  86. package/dist/apiDoc/assets/jsoneditor-icons-45c98bf0.svg +0 -749
  87. package/dist/apiDoc/favicon.ico +0 -0
  88. package/dist/apiDoc/index.html +0 -15
  89. package/dist/utils/getRouteByApiSrc.js +0 -54
  90. package/dist/utils/mas-encrypt.min.js +0 -3072
  91. package/src/apiDoc/assets/empty-907982e4.js +0 -1
  92. package/src/apiDoc/assets/index-b56e6bc6.js +0 -1414
  93. package/src/apiDoc/assets/index-bb16d834.css +0 -6
  94. package/test/config/api.config.ts +0 -3
  95. package/test/config/api.key.ts +0 -14
  96. package/test/src/api/curd/student/del.ts +0 -9
  97. package/test/src/api/curd/student/get.ts +0 -9
  98. package/test/src/api/curd/student/set.ts +0 -9
  99. package/test/src/api/per.ts +0 -6
  100. package/test/src/api/person/del.ts +0 -4
  101. package/test/src/api/person/get.ts +0 -4
  102. package/test/src/api/person/set.ts +0 -4
  103. package/test/src/api/test.ts +0 -7
  104. package/test/src/api/validtest/boolArr.ts +0 -4
  105. package/test/typings/studentSF.ts +0 -6
  106. package/test/typings/test11SF.ts +0 -1
  107. package/test/typings/test22SF.ts +0 -1
  108. package/test/typings/testformSF.ts +0 -1
  109. /package/.temp/{logs/.keep → .keep} +0 -0
  110. /package/{src/utils → .temp}/getRouteByApiSrc.ts +0 -0
  111. /package/.temp/{a.ts → merge/a.ts} +0 -0
  112. /package/.temp/{as.ts → merge/as.ts} +0 -0
  113. /package/.temp/{b.ts → merge/b.ts} +0 -0
  114. /package/.temp/{i.js → merge/i.js} +0 -0
  115. /package/{test/typings → .temp/merge/logs}/.keep +0 -0
  116. /package/.temp/{test.ts → merge/test.ts} +0 -0
  117. /package/.temp/{validType copy.ts → merge/validType copy.ts} +0 -0
  118. /package/.temp/{validTypeOptimize.ts → merge/validTypeOptimize.ts} +0 -0
  119. /package/{test/scripts → .temp}/updateRouter.ts +0 -0
@@ -1,3 +0,0 @@
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
- export default apiConfig;
@@ -1,14 +0,0 @@
1
- export default {
2
- api: "接口",
3
- curd: "",
4
- student: "",
5
- del: "删除",
6
- get: "",
7
- set: "",
8
- index: "",
9
- per: "",
10
- person: "人",
11
- test: "",
12
- validtest: "",
13
- boolArr: "",
14
- };
@@ -1,9 +0,0 @@
1
- import type { masReq, masRes } from "@/index";
2
- import masState from "@@/test/src/masState";
3
- import sqlform from "@@/test/src/sqlform.json";
4
-
5
- export default async (req: masReq, res: masRes) => {
6
- const { sql } = masState;
7
- const sqlRes = await sql.use(sqlform.student).delete(req.body).go();
8
- res.return(sqlRes);
9
- };
@@ -1,9 +0,0 @@
1
- import type { masReq, masRes } from "@/index";
2
- import masState from "@@/test/src/masState";
3
- import sqlform from "@@/test/src/sqlform.json";
4
-
5
- export default async (req: masReq, res: masRes) => {
6
- const { sql } = masState;
7
- const sqlRes = await sql.use(sqlform.student).select(req.body).paging().go();
8
- res.return(sqlRes);
9
- };
@@ -1,9 +0,0 @@
1
- import type { masReq, masRes } from "@/index";
2
- import masState from "@@/test/src/masState";
3
- import sqlform from "@@/test/src/sqlform.json";
4
-
5
- export default async (req: masReq, res: masRes) => {
6
- const { sql } = masState;
7
- const sqlRes = await sql.use(sqlform.student).set(req.body).go();
8
- res.return(sqlRes, sqlRes);
9
- };
@@ -1,6 +0,0 @@
1
- import type { masReq, masRes } from "@/index";
2
- export default async (req: masReq, res: masRes) => {
3
- console.log(res.token);
4
-
5
- res.return("hello mas-server!");
6
- };
@@ -1,4 +0,0 @@
1
- import type { masReq, masRes } from "@/index";
2
- export default async (req: masReq, res: masRes) => {
3
- res.return([1, 2]);
4
- };
@@ -1,4 +0,0 @@
1
- import type { masReq, masRes } from "@/index";
2
- export default async (req: masReq, res: masRes) => {
3
- res.return([1, 2]);
4
- };
@@ -1,4 +0,0 @@
1
- import type { masReq, masRes } from "@/index";
2
- export default async (req: masReq, res: masRes) => {
3
- res.return("hello set!");
4
- };
@@ -1,7 +0,0 @@
1
- import type { masReq, masRes } from "@/index";
2
- export default async (req: masReq, res: masRes) => {
3
- console.log(req.body, "@body");
4
- console.log(req.query, "@query");
5
-
6
- res.return("hello test!");
7
- };
@@ -1,4 +0,0 @@
1
- import type { masReq, masRes } from "@/index";
2
- export default async (req: masReq, res: masRes) => {
3
- res.return("hello bool");
4
- };
@@ -1,6 +0,0 @@
1
- export type studentSF = {
2
- id?: number;
3
- name?: string;
4
- age?: number;
5
- des?: string;
6
- };
@@ -1 +0,0 @@
1
- export type test11SF = { id?: number; name?: string; age?: number };
@@ -1 +0,0 @@
1
- export type test22SF = {id?:number;name?:string;age?:number;}
@@ -1 +0,0 @@
1
- export type testformSF = { id?: number; testA?: string; numB?: number };
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes