very-express 0.5.1 → 0.5.3

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 (48) hide show
  1. package/.eslintrc.json +37 -37
  2. package/.gitattributes +2 -2
  3. package/.github/workflows/npm-start.yml +23 -23
  4. package/LICENSE +21 -21
  5. package/README.md +62 -61
  6. package/dist/index.js +416 -399
  7. package/dist/templates/_middlewares/Authentication.ts +22 -19
  8. package/dist/templates/_plugins/auth/JWTKeyStore.ts +46 -2
  9. package/dist/templates/_plugins/auth/jwt.ts +50 -22
  10. package/dist/templates/_plugins/auth/oauthVerify.ts +6 -2
  11. package/dist/templates/_plugins/auth/token.ts +8 -3
  12. package/dist/templates/_routes/oauth/OAuthRouteFactory.ts +39 -32
  13. package/dist/templates/_services/VexDbConnector.ts +2 -2
  14. package/dist/templates/_services/VexSystem.ts +37 -0
  15. package/dist/templates/_types/response/index.ts +1 -1
  16. package/dist/templates/_types/response/responseCode.ts +3 -1
  17. package/dist/templates/_types/response/responseMsg.ts +7 -2
  18. package/dist/templates/_types/response/responseStatusCodeMap.ts +70 -0
  19. package/dist/templates/_utils/index.ts +0 -6
  20. package/dist/templates/_utils/response.ts +40 -8
  21. package/dist/templates/jsonSchema/User.json +82 -82
  22. package/dist/templates/jsonSchema/session.json +32 -0
  23. package/dist/templates/root/.env +19 -13
  24. package/dist/templates/root/Dockerfile +19 -19
  25. package/dist/templates/root/README.md +38 -38
  26. package/dist/templates/root/package.json +48 -48
  27. package/dist/templates/root/public/css/style.css +8 -0
  28. package/dist/templates/root/public/js/logincallback.js +19 -0
  29. package/dist/templates/root/public/js/mytokens.js +11 -0
  30. package/dist/templates/root/public/js/refreshtokens.js +23 -0
  31. package/dist/templates/root/scripts/build.js +38 -38
  32. package/dist/templates/root/tsconfig.json +21 -21
  33. package/docs/ForeignKey.md +43 -40
  34. package/docs/appGenerated/auth.md +23 -0
  35. package/docs/developmentNote.md +22 -22
  36. package/docs/releaseNote/v0-5-0.md +17 -17
  37. package/docs/roadMap/released.md +49 -0
  38. package/docs/roadMap/v0-6-0.md +15 -15
  39. package/docs/roadMap/v0-7-0.md +5 -5
  40. package/docs/vexJsonSchema.md +55 -55
  41. package/package.json +50 -49
  42. package/scripts/build.js +13 -13
  43. package/scripts/copyTsTemplates.js +30 -30
  44. package/scripts/merge.js +125 -0
  45. package/tsconfig.json +121 -121
  46. package/vex.config.json +29 -29
  47. package/dist/templates/_types/response/responseStatusToCode.ts +0 -70
  48. package/docs/roadMap/RoadMap.md +0 -30
package/.eslintrc.json CHANGED
@@ -1,37 +1,37 @@
1
- {
2
- "env": {
3
- "browser": true,
4
- "es2021": true
5
- },
6
- "extends": [
7
- "eslint:recommended",
8
- "plugin:@typescript-eslint/recommended"
9
- ],
10
- "parser": "@typescript-eslint/parser",
11
- "parserOptions": {
12
- "ecmaVersion": "latest",
13
- "sourceType": "module"
14
- },
15
- "plugins": [
16
- "@typescript-eslint"
17
- ],
18
- "rules": {
19
- "@typescript-eslint/no-explicit-any": "off",
20
- "indent": [
21
- "error",
22
- 4
23
- ],
24
- "linebreak-style": [
25
- "error",
26
- "unix"
27
- ],
28
- "quotes": [
29
- "error",
30
- "double"
31
- ],
32
- "semi": [
33
- "error",
34
- "always"
35
- ]
36
- }
37
- }
1
+ {
2
+ "env": {
3
+ "browser": true,
4
+ "es2021": true
5
+ },
6
+ "extends": [
7
+ "eslint:recommended",
8
+ "plugin:@typescript-eslint/recommended"
9
+ ],
10
+ "parser": "@typescript-eslint/parser",
11
+ "parserOptions": {
12
+ "ecmaVersion": "latest",
13
+ "sourceType": "module"
14
+ },
15
+ "plugins": [
16
+ "@typescript-eslint"
17
+ ],
18
+ "rules": {
19
+ "@typescript-eslint/no-explicit-any": "off",
20
+ "indent": [
21
+ "error",
22
+ 4
23
+ ],
24
+ "linebreak-style": [
25
+ "error",
26
+ "unix"
27
+ ],
28
+ "quotes": [
29
+ "error",
30
+ "double"
31
+ ],
32
+ "semi": [
33
+ "error",
34
+ "always"
35
+ ]
36
+ }
37
+ }
package/.gitattributes CHANGED
@@ -1,2 +1,2 @@
1
- # Auto detect text files and perform LF normalization
2
- * text=auto
1
+ # Auto detect text files and perform LF normalization
2
+ * text=auto
@@ -1,24 +1,24 @@
1
- # This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
2
- # For more information see: https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages
3
-
4
- name: Node.js Package
5
-
6
- on:
7
- release:
8
- types: [created]
9
- pull_request:
10
- branches:
11
- - main
12
-
13
- jobs:
14
- build:
15
- runs-on: ubuntu-latest
16
- steps:
17
- - uses: actions/checkout@v4
18
- - uses: actions/setup-node@v3
19
- with:
20
- node-version: 22
21
- - run: npm ci
22
- - run: npm run build
23
- - run: node ./dist/index.js -i
1
+ # This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
2
+ # For more information see: https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages
3
+
4
+ name: Node.js Package
5
+
6
+ on:
7
+ release:
8
+ types: [created]
9
+ pull_request:
10
+ branches:
11
+ - main
12
+
13
+ jobs:
14
+ build:
15
+ runs-on: ubuntu-latest
16
+ steps:
17
+ - uses: actions/checkout@v4
18
+ - uses: actions/setup-node@v3
19
+ with:
20
+ node-version: 22
21
+ - run: npm ci
22
+ - run: npm run build
23
+ - run: node ./dist/index.js -i
24
24
  - run: npm run start
package/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2023 justin26l
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) 2023 justin26l
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,61 +1,62 @@
1
- # VeryExpress
2
- this is a generator to make [Express](https://github.com/expressjs/express) REST API app based on [Json Schema](https://github.com/json-schema-org) and [Open Api](https://github.com/OAI)
3
-
4
-
5
- ## Why?
6
- bored on writing CRUD API time after time ?
7
- then this tool might save your time,
8
- all you need is define the **Json Schema** files.
9
-
10
-
11
- # Quick Start
12
- 1. install package globally.
13
- ```npm i -g very-express```
14
-
15
- 3. use cli to initialize configuration file **vex.config.json** under your project root directory.
16
- `vex -init`
17
-
18
- 2. create a empty directory and name it as value of vex.config's "jsonSchemaDir", by default `jsonSchema`.
19
- `mkdir jsonSchema`.
20
-
21
- 4. you can create your db collection/table now in directory `./jsonSchema` just created,
22
- refer to [Define Json Schmea](./docs/vexJsonSchema.md),
23
- every changes require to regenerate app.
24
-
25
- 6. generate the app with vex.config param.
26
- `vex`
27
-
28
- 7. you should saw a express typescript app being generated (with src, package.json etc) .
29
- ```
30
- ├── jsonSchema/
31
- │ └── ...
32
- ├── src/
33
- │ └── ...
34
- ├── package.json
35
- ├── tsconfig.json
36
- ├── vex.config.json
37
- └── .env
38
- ```
39
-
40
- 8. start the generated express app.
41
- ```
42
- npm i
43
- npm build
44
- npm run start
45
- ```
46
-
47
- # Feature Supported
48
- - generate REST API server
49
- - API Validator by [express-validator](https://express-validator.github.io/docs/)
50
- - generate OpenApi
51
- - [Swagger UI Express](https://github.com/scottie1984/swagger-ui-express)
52
- - OAuth by [Passport.js](https://www.passportjs.org/)
53
- - Database Driver
54
- - MongoDB by [Mongoose](https://mongoosejs.com/)
55
-
56
- # Resource
57
- - [Documents](./docs/)
58
- - [Road Map](./docs/roadMap/)
59
- - [ReleaseNote](./docs/releaseNote)
60
-
61
- - [Discord](https://discord.gg/PZGMzDp7)
1
+ # VeryExpress
2
+ this is a generator to make [Express](https://github.com/expressjs/express) app
3
+ with custom REST API defined in [Json Schema](https://github.com/json-schema-org) and [Open Api](https://github.com/OAI)
4
+
5
+ # Features
6
+ - generate simple express.js server.
7
+ - generate custom REST API.
8
+ - API Validator by [express-validator](https://express-validator.github.io/docs/)
9
+ - generate OpenApi
10
+ - [Swagger UI Express](https://github.com/scottie1984/swagger-ui-express)
11
+ - OAuth by [Passport.js](https://www.passportjs.org/)
12
+ - Database Driver
13
+ - MongoDB by [Mongoose](https://mongoosejs.com/)
14
+
15
+ ## Why use ExpressJs
16
+ express.js is a simple & flexible framework to build a web app, it provide balanced performance,
17
+ as this is open-source project, i want lower the technical barrier to contribute ideas,
18
+ eventually lead to a usefull and powerful framework.
19
+
20
+
21
+ # Quick Start
22
+ 1. install package globally.
23
+ ```npm i -g very-express```
24
+
25
+ 3. use cli to initialize configuration file **vex.config.json** under your project root directory.
26
+ `vex -init`
27
+
28
+ 2. create a empty directory and name it as value of vex.config's "jsonSchemaDir", by default `jsonSchema`.
29
+ `mkdir jsonSchema`.
30
+
31
+ 4. you can create your db collection/table now in directory `./jsonSchema` just created,
32
+ refer to [Define Json Schmea](./docs/vexJsonSchema.md),
33
+ every changes require to regenerate app.
34
+
35
+ 6. generate the app with vex.config param.
36
+ `vex`
37
+
38
+ 7. you should saw a express typescript app being generated (with src, package.json etc) .
39
+ ```
40
+ ├── jsonSchema/
41
+ │ └── ...
42
+ ├── src/
43
+ │ └── ...
44
+ ├── package.json
45
+ ├── tsconfig.json
46
+ ├── vex.config.json
47
+ └── .env
48
+ ```
49
+
50
+ 8. start the generated express app.
51
+ ```
52
+ npm i
53
+ npm build
54
+ npm run start
55
+ ```
56
+
57
+ # Resource
58
+ - [Documents](./docs/)
59
+ - [Road Map](./docs/roadMap/)
60
+ - [ReleaseNote](./docs/releaseNote)
61
+
62
+ - [Discord](https://discord.gg/PZGMzDp7)