very-express 0.4.11 → 0.4.13

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.
@@ -1,56 +1,56 @@
1
- {
2
- "type": "object",
3
- "x-documentConfig": {
4
- "methods": [
5
- "get",
6
- "getList",
7
- "post",
8
- "patch"
9
- ]
10
- },
11
- "properties": {
12
- "_id": {
13
- "type": "string",
14
- "index": true
15
- },
16
- "authProvider": {
17
- "type": "string"
18
- },
19
- "authId": {
20
- "type": "string",
21
- "index": true
22
- },
23
- "email": {
24
- "type": "string",
25
- "format": "email",
26
- "index": true,
27
- "required": true
28
- },
29
- "name": {
30
- "type": "string",
31
- "maxLength": 64,
32
- "required": true
33
- },
34
- "active": {
35
- "type": "boolean",
36
- "default": true,
37
- "required": true
38
- },
39
- "locale": {
40
- "type": "string",
41
- "maxLength": 8
42
- },
43
- "roles":{
44
- "type": "array",
45
- "x-vexData": "role",
46
- "items": {
47
- "type": "string",
48
- "default": "user",
49
- "required": true,
50
- "enum": [
51
- "user"
52
- ]
53
- }
54
- }
55
- }
1
+ {
2
+ "type": "object",
3
+ "x-documentConfig": {
4
+ "methods": [
5
+ "get",
6
+ "getList",
7
+ "post",
8
+ "patch"
9
+ ]
10
+ },
11
+ "properties": {
12
+ "_id": {
13
+ "type": "string",
14
+ "index": true
15
+ },
16
+ "authProvider": {
17
+ "type": "string"
18
+ },
19
+ "authId": {
20
+ "type": "string",
21
+ "index": true
22
+ },
23
+ "email": {
24
+ "type": "string",
25
+ "format": "email",
26
+ "index": true,
27
+ "required": true
28
+ },
29
+ "name": {
30
+ "type": "string",
31
+ "maxLength": 64,
32
+ "required": true
33
+ },
34
+ "active": {
35
+ "type": "boolean",
36
+ "default": true,
37
+ "required": true
38
+ },
39
+ "locale": {
40
+ "type": "string",
41
+ "maxLength": 8
42
+ },
43
+ "roles":{
44
+ "type": "array",
45
+ "x-vexData": "role",
46
+ "items": {
47
+ "type": "string",
48
+ "default": "user",
49
+ "required": true,
50
+ "enum": [
51
+ "user"
52
+ ]
53
+ }
54
+ }
55
+ }
56
56
  }
@@ -1,5 +1,5 @@
1
- APP_HOST=http://localhost:3000
2
- MONGODB_URI=mongodb://localhost:27017/veryExpressDB
3
-
4
- OAUTH_GOOGLE_CLIENTID=
1
+ APP_HOST=http://localhost:3000
2
+ MONGODB_URI=mongodb://localhost:27017/veryExpressDB
3
+
4
+ OAUTH_GOOGLE_CLIENTID=
5
5
  OAUTH_GOOGLE_CLIENTSECRET=
@@ -1,33 +1,33 @@
1
- # This app is generated by [VeryExpress](https://github.com/Justin26l/VeryExpress)
2
-
3
-
4
- # Quick Start
5
-
6
- 1. check configuration file **vex.config.json** under your project root directory.
7
- [vex.config.json](./vex.config.json)
8
-
9
- 2. generate the app with your vex.config settings.
10
- *Note : every db schema changes require to regenerate app.
11
- `vex`
12
- 3. you should saw a express typescript app being generated.
13
- ```
14
- ├── src/
15
- │ └── ...
16
- ├── package.json
17
- ├── tsconfig.json
18
- ├── vex.config.json
19
- ├── .env
20
- └── ...
21
- ```
22
-
23
- 4. start the generated express app.
24
- ```
25
- npm i
26
- npm build
27
- npm run start
28
- ```
29
-
30
- # Resource
31
- - [Documents](https://github.com/Justin26l/VeryExpress/blob/main/README.md)
32
-
33
- - [Discord](https://discord.gg/PZGMzDp7)
1
+ # This app is generated by [VeryExpress](https://github.com/Justin26l/VeryExpress)
2
+
3
+
4
+ # Quick Start
5
+
6
+ 1. check configuration file **vex.config.json** under your project root directory.
7
+ [vex.config.json](./vex.config.json)
8
+
9
+ 2. generate the app with your vex.config settings.
10
+ *Note : every db schema changes require to regenerate app.
11
+ `vex`
12
+ 3. you should saw a express typescript app being generated.
13
+ ```
14
+ ├── src/
15
+ │ └── ...
16
+ ├── package.json
17
+ ├── tsconfig.json
18
+ ├── vex.config.json
19
+ ├── .env
20
+ └── ...
21
+ ```
22
+
23
+ 4. start the generated express app.
24
+ ```
25
+ npm i
26
+ npm build
27
+ npm run start
28
+ ```
29
+
30
+ # Resource
31
+ - [Documents](https://github.com/Justin26l/VeryExpress/blob/main/README.md)
32
+
33
+ - [Discord](https://discord.gg/PZGMzDp7)
@@ -1,40 +1,40 @@
1
- {
2
- "main": "index.js",
3
- "scripts": {
4
- "build": "tsc -p .",
5
- "start": "node dist/server.js",
6
- "dev": "nodemon --watch src --exec ts-node src/server.ts"
7
- },
8
- "dependencies": {
9
- "dotenv": "^16.4.4",
10
- "express": "^4.18.2",
11
- "express-session": "^1.18.0",
12
- "express-validator": "^7.0.1",
13
- "helmet": "^7.1.0",
14
- "js-yaml": "^4.1.0",
15
- "mongo-ts-querystring": "^1.0.4",
16
- "mongodb": "^5.6.0",
17
- "mongoose": "^7.4.0",
18
- "passport": "^0.7.0",
19
- "passport-google-oauth20": "^2.0.0",
20
- "swagger-ui-express": "^5.0.0"
21
- },
22
- "devDependencies": {
23
- "@types/crypto-js": "^4.1.2",
24
- "@types/dotenv": "^8.2.0",
25
- "@types/express": "^4.17.17",
26
- "@types/express-session": "^1.17.10",
27
- "@types/express-validator": "^3.0.0",
28
- "@types/js-yaml": "^4.0.9",
29
- "@types/mongodb": "^4.0.7",
30
- "@types/node": "^20.4.2",
31
- "@types/passport": "^1.0.16",
32
- "@types/passport-google-oauth20": "^2.0.14",
33
- "@types/sequelize": "^4.28.15",
34
- "@types/swagger-ui-express": "^4.1.6",
35
- "@types/ws": "^8.5.5",
36
- "nodemon": "^2.0.22",
37
- "ts-node": "^10.9.1",
38
- "typescript": "^5.1.6"
39
- }
1
+ {
2
+ "main": "index.js",
3
+ "scripts": {
4
+ "build": "tsc -p .",
5
+ "start": "node dist/server.js",
6
+ "dev": "nodemon --watch src --exec ts-node src/server.ts"
7
+ },
8
+ "dependencies": {
9
+ "dotenv": "^16.4.4",
10
+ "express": "^4.18.2",
11
+ "express-session": "^1.18.0",
12
+ "express-validator": "^7.0.1",
13
+ "helmet": "^7.1.0",
14
+ "js-yaml": "^4.1.0",
15
+ "mongo-ts-querystring": "^1.0.4",
16
+ "mongodb": "^5.6.0",
17
+ "mongoose": "^7.4.0",
18
+ "passport": "^0.7.0",
19
+ "passport-google-oauth20": "^2.0.0",
20
+ "swagger-ui-express": "^5.0.0"
21
+ },
22
+ "devDependencies": {
23
+ "@types/crypto-js": "^4.1.2",
24
+ "@types/dotenv": "^8.2.0",
25
+ "@types/express": "^4.17.17",
26
+ "@types/express-session": "^1.17.10",
27
+ "@types/express-validator": "^3.0.0",
28
+ "@types/js-yaml": "^4.0.9",
29
+ "@types/mongodb": "^4.0.7",
30
+ "@types/node": "^20.4.2",
31
+ "@types/passport": "^1.0.16",
32
+ "@types/passport-google-oauth20": "^2.0.14",
33
+ "@types/sequelize": "^4.28.15",
34
+ "@types/swagger-ui-express": "^4.1.6",
35
+ "@types/ws": "^8.5.5",
36
+ "nodemon": "^2.0.22",
37
+ "ts-node": "^10.9.1",
38
+ "typescript": "^5.1.6"
39
+ }
40
40
  }
@@ -1,22 +1,22 @@
1
- {
2
- "compilerOptions": {
3
- /* Visit https://aka.ms/tsconfig to read more about this file */
4
-
5
- /* Language and Environment */
6
- "target": "es2016", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
7
-
8
- /* Modules */
9
- "module": "commonjs", /* Specify what module code is generated. */
10
-
11
- /* Emit */
12
- "outDir": "./dist", /* Specify an output folder for all emitted files. */
13
- "esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */
14
- "forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */
15
- "allowArbitraryExtensions": true, /* Allow arbitrary file extensions. */
16
-
17
- /* Type Checking */
18
- "strict": true, /* Enable all strict type-checking options. */
19
- "skipLibCheck": true /* Skip type checking all .d.ts files. */
20
- }
21
- }
1
+ {
2
+ "compilerOptions": {
3
+ /* Visit https://aka.ms/tsconfig to read more about this file */
4
+
5
+ /* Language and Environment */
6
+ "target": "es2016", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
7
+
8
+ /* Modules */
9
+ "module": "commonjs", /* Specify what module code is generated. */
10
+
11
+ /* Emit */
12
+ "outDir": "./dist", /* Specify an output folder for all emitted files. */
13
+ "esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */
14
+ "forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */
15
+ "allowArbitraryExtensions": true, /* Allow arbitrary file extensions. */
16
+
17
+ /* Type Checking */
18
+ "strict": true, /* Enable all strict type-checking options. */
19
+ "skipLibCheck": true /* Skip type checking all .d.ts files. */
20
+ }
21
+ }
22
22
 
@@ -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,30 +1,30 @@
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
- - [ ] App level foreign-key. `x-foreign-key`
26
- - [ ] DB field encryption. `x-encrypt`
27
-
28
- - [x] Role Base Access Control
29
- - [x] API access control
30
- - 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
+ - [ ] App level foreign-key. `x-foreign-key`
26
+ - [ ] DB field encryption. `x-encrypt`
27
+
28
+ - [x] Role Base Access Control
29
+ - [x] API access control
30
+ - different controller data validation rule by role **(ON HOLD)**
@@ -1,20 +1,20 @@
1
- # v0.5.0 Plan
2
-
3
- ### App level foreign-key
4
- - [ ] at JsonSchmea properties item, add attribute `x-foreignKey: "collectionName"`
5
- use this column value to match with target collectionName's "_id" fields.
6
- ```JSON
7
- {
8
- "invoiceId": {
9
- "type" : "string",
10
- "x-foreignKey" : "invoice"
11
- },
12
- "orderId": {
13
- "type" : "string",
14
- "x-foreignKey" : "order"
15
- }
16
- }
17
- ```
18
- - [ ] REST API, to request data with foreign-key collection:
19
- add field name as stringified array into querystring "join"
1
+ # v0.5.0 Plan
2
+
3
+ ### App level foreign-key
4
+ - [ ] at JsonSchmea properties item, add attribute `x-foreignKey: "collectionName"`
5
+ use this column value to match with target collectionName's "_id" fields.
6
+ ```JSON
7
+ {
8
+ "invoiceId": {
9
+ "type" : "string",
10
+ "x-foreignKey" : "invoice"
11
+ },
12
+ "orderId": {
13
+ "type" : "string",
14
+ "x-foreignKey" : "order"
15
+ }
16
+ }
17
+ ```
18
+ - [ ] REST API, to request data with foreign-key collection:
19
+ add field name as stringified array into querystring "join"
20
20
  example `/myDataApi?join=[invoiceId,orderId]`
@@ -1,7 +1,7 @@
1
- # v0.6.0 Plan
2
-
3
- ### dockernize
4
- - [ ] dockernize
5
- ### oauth2 support
6
- - [ ] microsoft
1
+ # v0.6.0 Plan
2
+
3
+ ### dockernize
4
+ - [ ] dockernize
5
+ ### oauth2 support
6
+ - [ ] microsoft
7
7
  - [ ] github
@@ -1,4 +1,4 @@
1
- # v0.7.0 Plan
2
-
3
- ## app level foreign-key.
1
+ # v0.7.0 Plan
2
+
3
+ ## app level foreign-key.
4
4
  - [ ] db fields encryption
@@ -1,55 +1,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. 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 | - | - | - | `documentName` from other JsonSchema, auto index. plan to implemented on [v0.5.0](./RoadMap/v0-5-0.md) |
19
- <!-- | format | `string` | false | - | veryExpress did not handle this field | -->
20
-
21
- ### System Fields
22
- which mean there field properties is not changable.
23
- - `_id` : if defined in schema, will auto set as `"index": true`, `"x-vexData": "ObjectId"`.
24
-
25
-
26
- #### Example :
27
- ```JSON
28
- {
29
- "x-documentConfig": {
30
- "documentName": "user", // auto generated using name
31
- "methods": [
32
- "get",
33
- "post",
34
- "put",
35
- "patch",
36
- "delete"
37
- ]
38
- },
39
- "properties": {
40
- "_id": {
41
- "type": "string",
42
- "index": true,
43
- "x-vexData": "ObjectId"
44
- },
45
- "username": {
46
- "type": "string"
47
- },
48
- "invoice_id": {
49
- "type": "string",
50
- "required": true,
51
- "x-foreignKey": "invoice"
52
- }
53
- }
54
- }
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. 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 | - | - | - | `documentName` from other JsonSchema, auto index. plan to implemented on [v0.5.0](./RoadMap/v0-5-0.md) |
19
+ <!-- | format | `string` | false | - | veryExpress did not handle this field | -->
20
+
21
+ ### System Fields
22
+ which mean there field properties is not changable.
23
+ - `_id` : if defined in schema, will auto set as `"index": true`, `"x-vexData": "ObjectId"`.
24
+
25
+
26
+ #### Example :
27
+ ```JSON
28
+ {
29
+ "x-documentConfig": {
30
+ "documentName": "user", // auto generated using name
31
+ "methods": [
32
+ "get",
33
+ "post",
34
+ "put",
35
+ "patch",
36
+ "delete"
37
+ ]
38
+ },
39
+ "properties": {
40
+ "_id": {
41
+ "type": "string",
42
+ "index": true,
43
+ "x-vexData": "ObjectId"
44
+ },
45
+ "username": {
46
+ "type": "string"
47
+ },
48
+ "invoice_id": {
49
+ "type": "string",
50
+ "required": true,
51
+ "x-foreignKey": "invoice"
52
+ }
53
+ }
54
+ }
55
55
  ```