very-express 0.5.26 → 0.6.1-alpha
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/.eslintrc.json +35 -37
- package/.gitattributes +2 -2
- package/.github/copilot-instructions.md +107 -84
- package/.github/workflows/npm-start.yml +23 -23
- package/LICENSE +21 -21
- package/README.md +75 -75
- package/dist/index.js +1039 -1149
- package/dist/templates/_controllers/_ControllerFactory.ts +7 -3
- package/dist/templates/_middlewares/Authentication.ts +1 -5
- package/dist/templates/_middlewares/tsoaAuthentication.ts +24 -0
- package/dist/templates/_projectSettings/env +25 -24
- package/dist/templates/_projectSettings/package.json +50 -54
- package/dist/templates/_services/MongooseRepositoryAdapter.ts +48 -0
- package/dist/templates/_services/TypeOrmRepositoryAdapter.ts +59 -0
- package/dist/templates/_services/VexDb.ts +14 -0
- package/dist/templates/_services/VexDbConnector.ts +108 -163
- package/dist/templates/_services/VexSystem.ts +25 -42
- package/dist/templates/_services/auth/JWTService.ts +26 -14
- package/dist/templates/_services/oauth/OAuthProfileMap.ts +6 -14
- package/dist/templates/_services/oauth/OAuthStrategyService.ts +69 -51
- package/dist/templates/_types/IVexRepository.ts +18 -0
- package/dist/templates/_types/VexRequest.ts +11 -0
- package/dist/templates/_types/VexResponse.ts +25 -0
- package/dist/templates/_types/VexResponseError.ts +4 -3
- package/dist/templates/_types/responseObject.ts +1 -1
- package/dist/templates/_utils/common.ts +50 -16
- package/dist/templates/_utils/hash.ts +6 -5
- package/dist/templates/_utils/index.ts +2 -1
- package/dist/templates/_utils/logger.ts +15 -14
- package/dist/templates/_utils/processTimer.ts +1 -0
- package/dist/templates/_utils/response.ts +4 -3
- package/dist/templates/_utils/validator.ts +1 -0
- package/dist/templates/jsonSchema/Session.json +34 -31
- package/dist/templates/jsonSchema/User.json +50 -85
- package/dist/templates/jsonSchema/UserAuthProfiles.json +48 -0
- package/dist/templates/root/Dockerfile +19 -19
- package/dist/templates/root/README.md +38 -38
- package/dist/templates/root/public/css/style.css +7 -7
- package/dist/templates/root/public/js/login.js +58 -58
- package/dist/templates/root/public/js/logincallback.js +18 -18
- package/dist/templates/root/public/js/mytokens.js +10 -10
- package/dist/templates/root/public/js/refreshtokens.js +22 -22
- package/dist/templates/root/scripts/build.js +38 -38
- package/dist/templates/root/tsconfig.json +29 -27
- package/docs/ForeignKey.md +43 -43
- package/docs/appGenerated/auth.md +22 -22
- package/docs/developmentNote.md +22 -22
- package/docs/releaseNote/v0-5-0.md +17 -17
- package/docs/roadMap/futurePlan.md +9 -9
- package/docs/roadMap/released.md +49 -49
- package/docs/roadMap/v0-6-0.md +15 -15
- package/docs/vexJsonSchema.md +55 -55
- package/package.json +59 -58
- package/scripts/build.js +13 -13
- package/scripts/bump-version.js +86 -86
- package/scripts/copyTsTemplates.js +30 -30
- package/scripts/merge.js +124 -124
- package/tsconfig.json +121 -121
- package/vex.config.json +37 -36
- package/dist/templates/_types/VexResponsePayloadError.ts +0 -20
|
@@ -1,28 +1,30 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
/* Visit https://aka.ms/tsconfig to read more about this file */
|
|
4
|
-
|
|
5
|
-
"baseUrl": ".",
|
|
6
|
-
"paths": {
|
|
7
|
-
"@": ["src"],
|
|
8
|
-
"@/*": ["src/*"]
|
|
9
|
-
},
|
|
10
|
-
|
|
11
|
-
/* Language and Environment */
|
|
12
|
-
"target": "
|
|
13
|
-
|
|
14
|
-
/* Modules */
|
|
15
|
-
"module": "commonjs",
|
|
16
|
-
|
|
17
|
-
/* Emit */
|
|
18
|
-
"outDir": "./dist", /* Specify an output folder for all emitted files. */
|
|
19
|
-
"esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */
|
|
20
|
-
"forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */
|
|
21
|
-
"allowArbitraryExtensions": true, /* Allow arbitrary file extensions. */
|
|
22
|
-
|
|
23
|
-
/* Type Checking */
|
|
24
|
-
"
|
|
25
|
-
"
|
|
26
|
-
|
|
27
|
-
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
/* Visit https://aka.ms/tsconfig to read more about this file */
|
|
4
|
+
|
|
5
|
+
"baseUrl": ".",
|
|
6
|
+
"paths": {
|
|
7
|
+
"@": ["src"],
|
|
8
|
+
"@/*": ["src/*"]
|
|
9
|
+
},
|
|
10
|
+
|
|
11
|
+
/* Language and Environment */
|
|
12
|
+
"target": "es2021", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
|
|
13
|
+
|
|
14
|
+
/* Modules */
|
|
15
|
+
"module": "commonjs",
|
|
16
|
+
|
|
17
|
+
/* Emit */
|
|
18
|
+
"outDir": "./dist", /* Specify an output folder for all emitted files. */
|
|
19
|
+
"esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */
|
|
20
|
+
"forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */
|
|
21
|
+
"allowArbitraryExtensions": true, /* Allow arbitrary file extensions. */
|
|
22
|
+
|
|
23
|
+
/* Type Checking */
|
|
24
|
+
"experimentalDecorators": true, /* Enable experimental support for TC39 stage 2+ decorators. */
|
|
25
|
+
"emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations. */
|
|
26
|
+
"strict": true, /* Enable all strict type-checking options. */
|
|
27
|
+
"skipLibCheck": true /* Skip type checking all .d.ts files. */
|
|
28
|
+
}
|
|
29
|
+
}
|
|
28
30
|
|
package/docs/ForeignKey.md
CHANGED
|
@@ -1,43 +1,43 @@
|
|
|
1
|
-
# Foreign-key
|
|
2
|
-
- Avalilable from v0.5.x
|
|
3
|
-
- Api level collection joining
|
|
4
|
-
|
|
5
|
-
## Define Foreign-key
|
|
6
|
-
Add attribute at JsonSchmea's field props, `x-foreignKey: "targetCollectionName"`
|
|
7
|
-
|
|
8
|
-
Example:
|
|
9
|
-
- **User Collection's** field "contactId" as foreign-key of **Contact Collection**
|
|
10
|
-
```JSON
|
|
11
|
-
{
|
|
12
|
-
"username": {
|
|
13
|
-
"type" : "string",
|
|
14
|
-
...
|
|
15
|
-
},
|
|
16
|
-
"contactId": {
|
|
17
|
-
"type" : "string",
|
|
18
|
-
"x-foreignKey" : "contact"
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
```
|
|
22
|
-
# REST API
|
|
23
|
-
## Parameters
|
|
24
|
-
### HTTP GET :
|
|
25
|
-
| Param | Type | Mandatory | Description |
|
|
26
|
-
| ----- | ---- | --------- | ----------- |
|
|
27
|
-
| _join | QueryString `array<String>` | false | join collection using **Current Resource's Field Name**. target joined collection decleare by `x-forignKey` |
|
|
28
|
-
| _select | QueryString `array<String>` | false | work with `_join`, select fields to join for target collection. empty = select all. |
|
|
29
|
-
|
|
30
|
-
## Example
|
|
31
|
-
`/user?_join=["contact"]&_select=["contactName","contactNumber"]`
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
**Output:**
|
|
35
|
-
```JSON
|
|
36
|
-
{
|
|
37
|
-
"username": "justin",
|
|
38
|
-
"contactId": {
|
|
39
|
-
"contactName": "justin's mobile",
|
|
40
|
-
"contactNumber": 1122333445566
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
|
|
1
|
+
# Foreign-key
|
|
2
|
+
- Avalilable from v0.5.x
|
|
3
|
+
- Api level collection joining
|
|
4
|
+
|
|
5
|
+
## Define Foreign-key
|
|
6
|
+
Add attribute at JsonSchmea's field props, `x-foreignKey: "targetCollectionName"`
|
|
7
|
+
|
|
8
|
+
Example:
|
|
9
|
+
- **User Collection's** field "contactId" as foreign-key of **Contact Collection**
|
|
10
|
+
```JSON
|
|
11
|
+
{
|
|
12
|
+
"username": {
|
|
13
|
+
"type" : "string",
|
|
14
|
+
...
|
|
15
|
+
},
|
|
16
|
+
"contactId": {
|
|
17
|
+
"type" : "string",
|
|
18
|
+
"x-foreignKey" : "contact"
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
```
|
|
22
|
+
# REST API
|
|
23
|
+
## Parameters
|
|
24
|
+
### HTTP GET :
|
|
25
|
+
| Param | Type | Mandatory | Description |
|
|
26
|
+
| ----- | ---- | --------- | ----------- |
|
|
27
|
+
| _join | QueryString `array<String>` | false | join collection using **Current Resource's Field Name**. target joined collection decleare by `x-forignKey` |
|
|
28
|
+
| _select | QueryString `array<String>` | false | work with `_join`, select fields to join for target collection. empty = select all. |
|
|
29
|
+
|
|
30
|
+
## Example
|
|
31
|
+
`/user?_join=["contact"]&_select=["contactName","contactNumber"]`
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
**Output:**
|
|
35
|
+
```JSON
|
|
36
|
+
{
|
|
37
|
+
"username": "justin",
|
|
38
|
+
"contactId": {
|
|
39
|
+
"contactName": "justin's mobile",
|
|
40
|
+
"contactNumber": 1122333445566
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
# Auth
|
|
2
|
-
- Stateless JWT token
|
|
3
|
-
- **Rolling Keys**
|
|
4
|
-
define in `.env`,
|
|
5
|
-
named `JWT_KEY{increment}`
|
|
6
|
-
```bash
|
|
7
|
-
JWT_KEY1=aaaaa
|
|
8
|
-
JWT_KEY2=bbbbb
|
|
9
|
-
JWT_KEY3=ccccc
|
|
10
|
-
```
|
|
11
|
-
- **OAuth2**
|
|
12
|
-
Supported Providers:
|
|
13
|
-
- Google
|
|
14
|
-
- Github
|
|
15
|
-
|
|
16
|
-
define in `.env`,
|
|
17
|
-
named `OAUTH_{provider}_CLIENTID` & `OAUTH_{provider}_CLIENTSECRET`
|
|
18
|
-
```bash
|
|
19
|
-
OAUTH_GOOGLE_CLIENTID=xxxxx
|
|
20
|
-
OAUTH_GOOGLE_CLIENTSECRET=xxxxx
|
|
21
|
-
```
|
|
22
|
-
- Stated
|
|
1
|
+
# Auth
|
|
2
|
+
- Stateless JWT token
|
|
3
|
+
- **Rolling Keys**
|
|
4
|
+
define in `.env`,
|
|
5
|
+
named `JWT_KEY{increment}`
|
|
6
|
+
```bash
|
|
7
|
+
JWT_KEY1=aaaaa
|
|
8
|
+
JWT_KEY2=bbbbb
|
|
9
|
+
JWT_KEY3=ccccc
|
|
10
|
+
```
|
|
11
|
+
- **OAuth2**
|
|
12
|
+
Supported Providers:
|
|
13
|
+
- Google
|
|
14
|
+
- Github
|
|
15
|
+
|
|
16
|
+
define in `.env`,
|
|
17
|
+
named `OAUTH_{provider}_CLIENTID` & `OAUTH_{provider}_CLIENTSECRET`
|
|
18
|
+
```bash
|
|
19
|
+
OAUTH_GOOGLE_CLIENTID=xxxxx
|
|
20
|
+
OAUTH_GOOGLE_CLIENTSECRET=xxxxx
|
|
21
|
+
```
|
|
22
|
+
- Stated
|
|
23
23
|
- not yet implement
|
package/docs/developmentNote.md
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
# Development Note
|
|
2
|
-
- "Project" or "The Project" is refer to this package which named "VeryExpress", github repository "[Justin26l/VeryExpress](https://github.com/Justin26l/VeryExpress)", npm package "[very-express](https://www.npmjs.com/package/very-express)".
|
|
3
|
-
|
|
4
|
-
- "Package" is refer to one of the node module, npm package, third-party library.
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
1. **TypeScript**
|
|
8
|
-
this project is based on [TypeScript](https://www.typescriptlang.org/).
|
|
9
|
-
we do not use ts-node in development due to file structure of the project,
|
|
10
|
-
you can refer to [package.json](./../package.json) "dev" script to know how to run the project in development.
|
|
11
|
-
|
|
12
|
-
2. **Esbuild**
|
|
13
|
-
the project require to compile into bundle to run.
|
|
14
|
-
due to the single file design, working directory of the project will always be at "dist/".
|
|
15
|
-
refer to [package.json](./../package.json) `scripts > compile`.
|
|
16
|
-
|
|
17
|
-
3. **File Generate Template**
|
|
18
|
-
if there is any function calling pass by object need to be write in file output,
|
|
19
|
-
use syntax: `FUNC{{ <myFunc(){...}> }}`.
|
|
20
|
-
refer to :
|
|
21
|
-
1. [controller custom validatior](./../src/generators/controller/controllers.generator.ts#L<202>)
|
|
22
|
-
2. [controller template return](./../src/generators/controller/controller.template.ts#L<246>)
|
|
1
|
+
# Development Note
|
|
2
|
+
- "Project" or "The Project" is refer to this package which named "VeryExpress", github repository "[Justin26l/VeryExpress](https://github.com/Justin26l/VeryExpress)", npm package "[very-express](https://www.npmjs.com/package/very-express)".
|
|
3
|
+
|
|
4
|
+
- "Package" is refer to one of the node module, npm package, third-party library.
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
1. **TypeScript**
|
|
8
|
+
this project is based on [TypeScript](https://www.typescriptlang.org/).
|
|
9
|
+
we do not use ts-node in development due to file structure of the project,
|
|
10
|
+
you can refer to [package.json](./../package.json) "dev" script to know how to run the project in development.
|
|
11
|
+
|
|
12
|
+
2. **Esbuild**
|
|
13
|
+
the project require to compile into bundle to run.
|
|
14
|
+
due to the single file design, working directory of the project will always be at "dist/".
|
|
15
|
+
refer to [package.json](./../package.json) `scripts > compile`.
|
|
16
|
+
|
|
17
|
+
3. **File Generate Template**
|
|
18
|
+
if there is any function calling pass by object need to be write in file output,
|
|
19
|
+
use syntax: `FUNC{{ <myFunc(){...}> }}`.
|
|
20
|
+
refer to :
|
|
21
|
+
1. [controller custom validatior](./../src/generators/controller/controllers.generator.ts#L<202>)
|
|
22
|
+
2. [controller template return](./../src/generators/controller/controller.template.ts#L<246>)
|
|
23
23
|
3. [template formatter function](./../src/utils/template.ts#L<6>)
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
# v0.5.0 Plan
|
|
2
|
-
|
|
3
|
-
### foreign-key
|
|
4
|
-
- [x] define FK, add props at field, `x-foreignKey: "targetCollectionName"`
|
|
5
|
-
```JSON
|
|
6
|
-
{
|
|
7
|
-
"username": {
|
|
8
|
-
"type" : "string",
|
|
9
|
-
},
|
|
10
|
-
"contactId": {
|
|
11
|
-
"type" : "string",
|
|
12
|
-
"x-foreignKey" : "contact" // target collection's name
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
```
|
|
16
|
-
- [x] REST API, to request data with foreign-key collection:
|
|
17
|
-
add field name as array into querystring "_join"
|
|
1
|
+
# v0.5.0 Plan
|
|
2
|
+
|
|
3
|
+
### foreign-key
|
|
4
|
+
- [x] define FK, add props at field, `x-foreignKey: "targetCollectionName"`
|
|
5
|
+
```JSON
|
|
6
|
+
{
|
|
7
|
+
"username": {
|
|
8
|
+
"type" : "string",
|
|
9
|
+
},
|
|
10
|
+
"contactId": {
|
|
11
|
+
"type" : "string",
|
|
12
|
+
"x-foreignKey" : "contact" // target collection's name
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
```
|
|
16
|
+
- [x] REST API, to request data with foreign-key collection:
|
|
17
|
+
add field name as array into querystring "_join"
|
|
18
18
|
example `/user?_join=["contact"]_select=["contactNo"]&`
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
# future Plan
|
|
2
|
-
|
|
3
|
-
## security
|
|
4
|
-
- [ ] Rate Limiting
|
|
5
|
-
- [ ] db fields encryption
|
|
6
|
-
|
|
7
|
-
## features supports
|
|
8
|
-
- [ ] controller extendable, support customisation based on vex generated controller.
|
|
9
|
-
- [ ] [tsoa](https://tsoa-community.github.io/docs/) make it nextjs like and support opanapi with custom endpoint (non generated).
|
|
1
|
+
# future Plan
|
|
2
|
+
|
|
3
|
+
## security
|
|
4
|
+
- [ ] Rate Limiting
|
|
5
|
+
- [ ] db fields encryption
|
|
6
|
+
|
|
7
|
+
## features supports
|
|
8
|
+
- [ ] controller extendable, support customisation based on vex generated controller.
|
|
9
|
+
- [ ] [tsoa](https://tsoa-community.github.io/docs/) make it nextjs like and support opanapi with custom endpoint (non generated).
|
package/docs/roadMap/released.md
CHANGED
|
@@ -1,49 +1,49 @@
|
|
|
1
|
-
# Road Map
|
|
2
|
-
|
|
3
|
-
## Compatibility
|
|
4
|
-
|
|
5
|
-
- [ ] Dockernize
|
|
6
|
-
|
|
7
|
-
- [x] Generate App
|
|
8
|
-
- [x] generate openapi based on json schema
|
|
9
|
-
- [x] generate controllers based on openapi
|
|
10
|
-
- [x] CRUD API
|
|
11
|
-
- [x] data validation (express-validator)
|
|
12
|
-
|
|
13
|
-
- [ ] Database
|
|
14
|
-
- [x] MongoDB
|
|
15
|
-
- SQL **(ON HOLD)**
|
|
16
|
-
|
|
17
|
-
- [ ] OAuth2
|
|
18
|
-
- [x] google
|
|
19
|
-
- [ ] microsoft
|
|
20
|
-
- [ ] github
|
|
21
|
-
|
|
22
|
-
## Features
|
|
23
|
-
|
|
24
|
-
- [ ] Schema Definition
|
|
25
|
-
- [x] App level foreign-key. `x-foreign-key` under properties
|
|
26
|
-
```JSON
|
|
27
|
-
{
|
|
28
|
-
"username": {
|
|
29
|
-
"type" : "string",
|
|
30
|
-
},
|
|
31
|
-
"contactId": {
|
|
32
|
-
"type" : "string",
|
|
33
|
-
"x-foreignKey" : "contact", // target collection's name
|
|
34
|
-
"x-foreignValue" : [ // fields to join
|
|
35
|
-
"contactName",
|
|
36
|
-
"contactNumber",
|
|
37
|
-
"isActive"
|
|
38
|
-
]
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
```
|
|
42
|
-
- [x] REST API, to request data with foreign-key collection:
|
|
43
|
-
add field name as array into querystring "_join"
|
|
44
|
-
example `/user?_join=["contact"]_select=["contactNo"]&`
|
|
45
|
-
- [ ] DB field encryption. `x-encrypt`
|
|
46
|
-
|
|
47
|
-
- [x] Role Base Access Control
|
|
48
|
-
- [x] API access control
|
|
49
|
-
- different controller data validation rule by role **(ON HOLD)**
|
|
1
|
+
# Road Map
|
|
2
|
+
|
|
3
|
+
## Compatibility
|
|
4
|
+
|
|
5
|
+
- [ ] Dockernize
|
|
6
|
+
|
|
7
|
+
- [x] Generate App
|
|
8
|
+
- [x] generate openapi based on json schema
|
|
9
|
+
- [x] generate controllers based on openapi
|
|
10
|
+
- [x] CRUD API
|
|
11
|
+
- [x] data validation (express-validator)
|
|
12
|
+
|
|
13
|
+
- [ ] Database
|
|
14
|
+
- [x] MongoDB
|
|
15
|
+
- SQL **(ON HOLD)**
|
|
16
|
+
|
|
17
|
+
- [ ] OAuth2
|
|
18
|
+
- [x] google
|
|
19
|
+
- [ ] microsoft
|
|
20
|
+
- [ ] github
|
|
21
|
+
|
|
22
|
+
## Features
|
|
23
|
+
|
|
24
|
+
- [ ] Schema Definition
|
|
25
|
+
- [x] App level foreign-key. `x-foreign-key` under properties
|
|
26
|
+
```JSON
|
|
27
|
+
{
|
|
28
|
+
"username": {
|
|
29
|
+
"type" : "string",
|
|
30
|
+
},
|
|
31
|
+
"contactId": {
|
|
32
|
+
"type" : "string",
|
|
33
|
+
"x-foreignKey" : "contact", // target collection's name
|
|
34
|
+
"x-foreignValue" : [ // fields to join
|
|
35
|
+
"contactName",
|
|
36
|
+
"contactNumber",
|
|
37
|
+
"isActive"
|
|
38
|
+
]
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
```
|
|
42
|
+
- [x] REST API, to request data with foreign-key collection:
|
|
43
|
+
add field name as array into querystring "_join"
|
|
44
|
+
example `/user?_join=["contact"]_select=["contactNo"]&`
|
|
45
|
+
- [ ] DB field encryption. `x-encrypt`
|
|
46
|
+
|
|
47
|
+
- [x] Role Base Access Control
|
|
48
|
+
- [x] API access control
|
|
49
|
+
- different controller data validation rule by role **(ON HOLD)**
|
package/docs/roadMap/v0-6-0.md
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
# v0.6.0 Plan
|
|
2
|
-
|
|
3
|
-
### dockernize
|
|
4
|
-
- [ ] dockernize
|
|
5
|
-
### oauth2 support
|
|
6
|
-
- [x] google
|
|
7
|
-
- [ ] apple
|
|
8
|
-
- [ ] microsoft
|
|
9
|
-
- [x] github
|
|
10
|
-
- [ ] meta/facebook
|
|
11
|
-
### session storage
|
|
12
|
-
- [x] jwt
|
|
13
|
-
- [x] stateless design
|
|
14
|
-
- [ ] redis cache
|
|
15
|
-
- [x] rolling session secret
|
|
1
|
+
# v0.6.0 Plan
|
|
2
|
+
|
|
3
|
+
### dockernize
|
|
4
|
+
- [ ] dockernize
|
|
5
|
+
### oauth2 support
|
|
6
|
+
- [x] google
|
|
7
|
+
- [ ] apple
|
|
8
|
+
- [ ] microsoft
|
|
9
|
+
- [x] github
|
|
10
|
+
- [ ] meta/facebook
|
|
11
|
+
### session storage
|
|
12
|
+
- [x] jwt
|
|
13
|
+
- [x] stateless design
|
|
14
|
+
- [ ] redis cache
|
|
15
|
+
- [x] rolling session secret
|
package/docs/vexJsonSchema.md
CHANGED
|
@@ -1,56 +1,56 @@
|
|
|
1
|
-
# Define Json Schema for VeryExpress
|
|
2
|
-
|
|
3
|
-
## x-documentConfig:
|
|
4
|
-
|
|
5
|
-
| Fields | Data Type | Options | Description |
|
|
6
|
-
| - | - | - | - |
|
|
7
|
-
| documentName | `string` | - | auto generated using file name. this value should be same as the collection name, it will used to name **Collection**, **TS Interface**, **ODM Model** etc. |
|
|
8
|
-
| methods | `array<string>` | `get`, `post`, `put`, `patch`, `delete` | array of **REST API Method** to be enable. |
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
## Properties Definition:
|
|
12
|
-
|
|
13
|
-
| Fields | Data Type | Required | options | Description |
|
|
14
|
-
| - | - | - | - | - |
|
|
15
|
-
| type | `string` | true | - | [JsonSchema's type field](https://json-schema.org/understanding-json-schema/reference/type) |
|
|
16
|
-
| required | `boolean` | false | - | rest api's validator will check value cannot be falsy / undefined. |
|
|
17
|
-
| x-vexData | `string` | false | `primaryKey`, `role` | determine veryExpress generation process. |
|
|
18
|
-
| x-foreignKey | `string` | false | - | `documentName` from other JsonSchema, auto indexed, use to join collection |
|
|
19
|
-
| x-foreignValue | `array<String>` | false | - | default selected fields for target collection |
|
|
20
|
-
<!-- | format | `string` | false | - | veryExpress did not handle this field | -->
|
|
21
|
-
|
|
22
|
-
### System Fields
|
|
23
|
-
System Fields is the properties to let generator run as expected,it should not be changed.
|
|
24
|
-
- `_id` : if defined in schema, it will auto being set as `"index": true`, `"x-vexData": "ObjectId"`.
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
#### Example :
|
|
28
|
-
```JSON
|
|
29
|
-
{
|
|
30
|
-
"x-documentConfig": {
|
|
31
|
-
"documentName": "user", // auto generated using name
|
|
32
|
-
"methods": [
|
|
33
|
-
"get",
|
|
34
|
-
"post",
|
|
35
|
-
"put",
|
|
36
|
-
"patch",
|
|
37
|
-
"delete"
|
|
38
|
-
]
|
|
39
|
-
},
|
|
40
|
-
"properties": {
|
|
41
|
-
"_id": {
|
|
42
|
-
"type": "string",
|
|
43
|
-
"index": true,
|
|
44
|
-
"x-vexData": "ObjectId"
|
|
45
|
-
},
|
|
46
|
-
"username": {
|
|
47
|
-
"type": "string"
|
|
48
|
-
},
|
|
49
|
-
"invoice_id": {
|
|
50
|
-
"type": "string",
|
|
51
|
-
"required": true,
|
|
52
|
-
"x-foreignKey": "invoice"
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
}
|
|
1
|
+
# Define Json Schema for VeryExpress
|
|
2
|
+
|
|
3
|
+
## x-documentConfig:
|
|
4
|
+
|
|
5
|
+
| Fields | Data Type | Options | Description |
|
|
6
|
+
| - | - | - | - |
|
|
7
|
+
| documentName | `string` | - | auto generated using file name. this value should be same as the collection name, it will used to name **Collection**, **TS Interface**, **ODM Model** etc. |
|
|
8
|
+
| methods | `array<string>` | `get`, `post`, `put`, `patch`, `delete` | array of **REST API Method** to be enable. |
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
## Properties Definition:
|
|
12
|
+
|
|
13
|
+
| Fields | Data Type | Required | options | Description |
|
|
14
|
+
| - | - | - | - | - |
|
|
15
|
+
| type | `string` | true | - | [JsonSchema's type field](https://json-schema.org/understanding-json-schema/reference/type) |
|
|
16
|
+
| required | `boolean` | false | - | rest api's validator will check value cannot be falsy / undefined. |
|
|
17
|
+
| x-vexData | `string` | false | `primaryKey`, `role` | determine veryExpress generation process. |
|
|
18
|
+
| x-foreignKey | `string` | false | - | `documentName` from other JsonSchema, auto indexed, use to join collection |
|
|
19
|
+
| x-foreignValue | `array<String>` | false | - | default selected fields for target collection |
|
|
20
|
+
<!-- | format | `string` | false | - | veryExpress did not handle this field | -->
|
|
21
|
+
|
|
22
|
+
### System Fields
|
|
23
|
+
System Fields is the properties to let generator run as expected,it should not be changed.
|
|
24
|
+
- `_id` : if defined in schema, it will auto being set as `"index": true`, `"x-vexData": "ObjectId"`.
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
#### Example :
|
|
28
|
+
```JSON
|
|
29
|
+
{
|
|
30
|
+
"x-documentConfig": {
|
|
31
|
+
"documentName": "user", // auto generated using name
|
|
32
|
+
"methods": [
|
|
33
|
+
"get",
|
|
34
|
+
"post",
|
|
35
|
+
"put",
|
|
36
|
+
"patch",
|
|
37
|
+
"delete"
|
|
38
|
+
]
|
|
39
|
+
},
|
|
40
|
+
"properties": {
|
|
41
|
+
"_id": {
|
|
42
|
+
"type": "string",
|
|
43
|
+
"index": true,
|
|
44
|
+
"x-vexData": "ObjectId"
|
|
45
|
+
},
|
|
46
|
+
"username": {
|
|
47
|
+
"type": "string"
|
|
48
|
+
},
|
|
49
|
+
"invoice_id": {
|
|
50
|
+
"type": "string",
|
|
51
|
+
"required": true,
|
|
52
|
+
"x-foreignKey": "invoice"
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
56
|
```
|
package/package.json
CHANGED
|
@@ -1,58 +1,59 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "very-express",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "based on json schema and openapi, generate Express RestApi server with mongoDb ",
|
|
5
|
-
"author": "Justin26l",
|
|
6
|
-
"license": "MIT",
|
|
7
|
-
"main": "index.js",
|
|
8
|
-
"bin": {
|
|
9
|
-
"vex": "./dist/index.js"
|
|
10
|
-
},
|
|
11
|
-
"scripts": {
|
|
12
|
-
"start": "node ./dist/index.js",
|
|
13
|
-
"dev": "npm run compile && npm run start",
|
|
14
|
-
"build": "npm run lint && npm run compile",
|
|
15
|
-
"lint": "eslint ./src --ext .ts --fix",
|
|
16
|
-
"compile": "node ./scripts/build.js && node ./scripts/copyTsTemplates.js",
|
|
17
|
-
"preversion": "npm run lint",
|
|
18
|
-
"postversion": "npm run compile",
|
|
19
|
-
"v": "node scripts/bump-version.js"
|
|
20
|
-
},
|
|
21
|
-
"keywords": [
|
|
22
|
-
"jsonSchema",
|
|
23
|
-
"express",
|
|
24
|
-
"RestApi",
|
|
25
|
-
"mongoDb",
|
|
26
|
-
"mongoose",
|
|
27
|
-
"json2mongoose"
|
|
28
|
-
],
|
|
29
|
-
"repository": {
|
|
30
|
-
"type": "git",
|
|
31
|
-
"url": "git+https://github.com/Justin26l/VeryExpress.git"
|
|
32
|
-
},
|
|
33
|
-
"devDependencies": {
|
|
34
|
-
"@types/js-yaml": "^4.0.9",
|
|
35
|
-
"@types/minimist": "^1.2.5",
|
|
36
|
-
"@types/ms": "^2.1.0",
|
|
37
|
-
"@types/node": "^20.
|
|
38
|
-
"@types/passport": "^1.0.16",
|
|
39
|
-
"@types/pg": "^8.20.0",
|
|
40
|
-
"@typescript-eslint/eslint-plugin": "^6.18.1",
|
|
41
|
-
"@typescript-eslint/parser": "^6.18.1",
|
|
42
|
-
"diff-match-patch": "^1.0.5",
|
|
43
|
-
"dotenv": "^16.3.1",
|
|
44
|
-
"esbuild": "0.23.0",
|
|
45
|
-
"eslint": "^8.57.1",
|
|
46
|
-
"js-yaml": "^4.1.0",
|
|
47
|
-
"json-schema-to-openapi-schema": "^0.4.0",
|
|
48
|
-
"json-schema-to-typescript": "^13.1.1",
|
|
49
|
-
"json2mongoose": "^0.4.8",
|
|
50
|
-
"knex": "^3.2.9",
|
|
51
|
-
"minimist": "^1.2.8",
|
|
52
|
-
"mongoose": "^8.7.1",
|
|
53
|
-
"mysql2": "^3.22.0",
|
|
54
|
-
"
|
|
55
|
-
"
|
|
56
|
-
"
|
|
57
|
-
|
|
58
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "very-express",
|
|
3
|
+
"version": "0.6.1-alpha",
|
|
4
|
+
"description": "based on json schema and openapi, generate Express RestApi server with mongoDb ",
|
|
5
|
+
"author": "Justin26l",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"main": "index.js",
|
|
8
|
+
"bin": {
|
|
9
|
+
"vex": "./dist/index.js"
|
|
10
|
+
},
|
|
11
|
+
"scripts": {
|
|
12
|
+
"start": "node ./dist/index.js",
|
|
13
|
+
"dev": "npm run compile && npm run start",
|
|
14
|
+
"build": "npm run lint && npm run compile",
|
|
15
|
+
"lint": "eslint ./src --ext .ts --fix",
|
|
16
|
+
"compile": "node ./scripts/build.js && node ./scripts/copyTsTemplates.js",
|
|
17
|
+
"preversion": "npm run lint",
|
|
18
|
+
"postversion": "npm run compile",
|
|
19
|
+
"v": "node scripts/bump-version.js"
|
|
20
|
+
},
|
|
21
|
+
"keywords": [
|
|
22
|
+
"jsonSchema",
|
|
23
|
+
"express",
|
|
24
|
+
"RestApi",
|
|
25
|
+
"mongoDb",
|
|
26
|
+
"mongoose",
|
|
27
|
+
"json2mongoose"
|
|
28
|
+
],
|
|
29
|
+
"repository": {
|
|
30
|
+
"type": "git",
|
|
31
|
+
"url": "git+https://github.com/Justin26l/VeryExpress.git"
|
|
32
|
+
},
|
|
33
|
+
"devDependencies": {
|
|
34
|
+
"@types/js-yaml": "^4.0.9",
|
|
35
|
+
"@types/minimist": "^1.2.5",
|
|
36
|
+
"@types/ms": "^2.1.0",
|
|
37
|
+
"@types/node": "^20.19.39",
|
|
38
|
+
"@types/passport": "^1.0.16",
|
|
39
|
+
"@types/pg": "^8.20.0",
|
|
40
|
+
"@typescript-eslint/eslint-plugin": "^6.18.1",
|
|
41
|
+
"@typescript-eslint/parser": "^6.18.1",
|
|
42
|
+
"diff-match-patch": "^1.0.5",
|
|
43
|
+
"dotenv": "^16.3.1",
|
|
44
|
+
"esbuild": "0.23.0",
|
|
45
|
+
"eslint": "^8.57.1",
|
|
46
|
+
"js-yaml": "^4.1.0",
|
|
47
|
+
"json-schema-to-openapi-schema": "^0.4.0",
|
|
48
|
+
"json-schema-to-typescript": "^13.1.1",
|
|
49
|
+
"json2mongoose": "^0.4.8",
|
|
50
|
+
"knex": "^3.2.9",
|
|
51
|
+
"minimist": "^1.2.8",
|
|
52
|
+
"mongoose": "^8.7.1",
|
|
53
|
+
"mysql2": "^3.22.0",
|
|
54
|
+
"objection": "^3.1.5",
|
|
55
|
+
"pg": "^8.20.0",
|
|
56
|
+
"ts-node": "^10.9.2",
|
|
57
|
+
"typescript": "^5.3.3"
|
|
58
|
+
}
|
|
59
|
+
}
|