very-express 0.6.10-alpha → 0.6.12-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.
Files changed (28) hide show
  1. package/.github/copilot-instructions.md +2 -3
  2. package/README.md +46 -68
  3. package/dist/index.js +274 -279
  4. package/dist/templates/_middlewares/tsoaAuthentication.ts +3 -3
  5. package/dist/templates/_routes/oauth/OAuthRouteFactory.ts +1 -1
  6. package/dist/templates/_services/MongooseRepositoryAdapter.ts +2 -3
  7. package/dist/templates/_services/TypeOrmRepositoryAdapter.ts +17 -20
  8. package/dist/templates/_services/VexDbConnector.ts +4 -4
  9. package/dist/templates/_services/VexSystem.ts +5 -5
  10. package/dist/templates/_services/auth/JWTService.ts +6 -7
  11. package/dist/templates/_services/oauth/OAuthStrategyService.ts +3 -3
  12. package/dist/templates/_types/{IVexRepository.ts → vex/VexRepository.ts} +6 -2
  13. package/dist/templates/_types/{VexRequest.ts → vex/VexRequest.ts} +6 -3
  14. package/dist/templates/_types/{VexResponseError.ts → vex/VexResErr.ts} +9 -5
  15. package/dist/templates/_types/{VexResponse.ts → vex/VexResOk.ts} +9 -5
  16. package/dist/templates/_types/vex/VexResponse.ts +12 -0
  17. package/dist/templates/_types/vex/index.ts +6 -0
  18. package/dist/templates/_utils/index.ts +0 -2
  19. package/dist/templates/root/scripts/oacg-fix.js +83 -0
  20. package/docs/CONTRIBUTING.md +38 -0
  21. package/docs/ForeignKey.md +4 -4
  22. package/docs/roadMap/futurePlan.md +1 -2
  23. package/docs/roadMap/released.md +4 -22
  24. package/docs/vexJsonSchema.md +139 -37
  25. package/package.json +3 -4
  26. package/dist/templates/_types/responseObject.ts +0 -7
  27. package/dist/templates/_utils/common.ts +0 -140
  28. package/scripts/bump-version.js +0 -87
@@ -23,7 +23,6 @@ jsonSchema/*.json → preprocess → generators → templates → output
23
23
  npm run dev # compile (esbuild → dist/index.js) + run CLI
24
24
  npm run build # lint + compile (production)
25
25
  npm run lint # eslint --fix
26
- npm run v <type> # bump version (major | minor | patch)
27
26
  ```
28
27
 
29
28
  - Build bundles everything into a single `dist/index.js` via esbuild (platform: node, target: es2016).
@@ -60,7 +59,7 @@ Every generator exports an async `compile(options)` that:
60
59
  Custom `x-*` properties drive generation — see [docs/vexJsonSchema.md](../docs/vexJsonSchema.md):
61
60
 
62
61
  - `x-documentConfig` — REST methods, document name
63
- - `x-foreignKey` / `x-foreignValue` — relationships ([docs/ForeignKey.md](../docs/ForeignKey.md))
62
+ - `x-foreignKey` — relationships ([docs/ForeignKey.md](../docs/ForeignKey.md))
64
63
  - `x-vexData: "role"` — marks role field for RBAC
65
64
  - `x-format: "ObjectId"` — MongoDB ObjectId handling
66
65
 
@@ -71,7 +70,7 @@ Custom `x-*` properties drive generation — see [docs/vexJsonSchema.md](../docs
71
70
  ## Key docs (link, don't duplicate)
72
71
 
73
72
  - [docs/vexJsonSchema.md](../docs/vexJsonSchema.md) — full schema definition guide
74
- - [docs/ForeignKey.md](../docs/ForeignKey.md) — foreign-key joins and `_join`/`_select` params
73
+ - [docs/ForeignKey.md](../docs/ForeignKey.md) — foreign-key joins and `join`/`select` params
75
74
  - [docs/appGenerated/auth.md](../docs/appGenerated/auth.md) — JWT rolling keys, OAuth2 setup
76
75
  - [docs/developmentNote.md](../docs/developmentNote.md) — dev conventions, `FUNC{{ }}` syntax
77
76
  - [docs/roadMap/](../docs/roadMap/) — released features and upcoming plans
package/README.md CHANGED
@@ -1,75 +1,53 @@
1
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)
2
+ VeryExpress is a generator that reads JSON Schema and produces a complete Express.js REST API (TypeScript, Mongoose, RBAC, OAuth2, Swagger).
4
3
 
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/)
4
+ ## Features
5
+ - Generate Express TypeScript server from JSON Schema
6
+ - API validation with `express-validator`
7
+ - OpenAPI generation + Swagger UI
8
+ - OAuth via `passport` (OAuth2)
9
+ - Mongoose (MongoDB) and TypeORM(SQL) DB driver
10
+ - CLI for quick project scaffolding
14
11
 
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
- ```
12
+ ## Quick Start
13
+ 1. Install globally (optional):
14
+ ```
15
+ npm i -g very-express
16
+ ```
17
+ Or run via `npx`:
18
+ ```
19
+ npx very-express
20
+ ```
21
+ 2. Initialize config in project root:
22
+ ```
23
+ vex -init
24
+ ```
25
+ This creates `vex.config.json`.
56
26
 
57
- ## Project Versioning
58
- This project use versioning based on (Semantic Versioning)[https://semver.org/]
27
+ 3. Create schema directory (or use directory set in `vex.config.json`):
28
+ ```
29
+ mkdir jsonSchema
30
+ ```
31
+ 4. Add your JSON Schema files into `jsonSchema/` following schema guide: [docs/vexJsonSchema.md](docs/vexJsonSchema.md)
59
32
 
60
- Use this instead :
61
- ```cmd
62
- npm run v <version-type>
63
- ```
64
- Version Types :
65
- - `major` version when you make incompatible API changes
66
- - `minor` version when you add functionality in a backward compatible manner
67
- - `patch` version when you make backward compatible bug fixes
68
- - `dev` simply mark for development, you should not publish under this versions
33
+ 5. Generate app:
34
+ ```
35
+ vex
36
+ ```
37
+ 6. Run generated app:
38
+ ```
39
+ cd output
40
+ npm i
41
+ npm run dev
42
+ ```
69
43
 
70
- # Resources
71
- - [Documents](./docs/)
72
- - [Road Map](./docs/roadMap/)
73
- - [ReleaseNote](./docs/releaseNote)
44
+ Notes:
45
+ - suffix `*.gen.ts` is regenerated by the generator. edit at own risk.
46
+
47
+ ## Docs
48
+ - Schema reference: [docs/vexJsonSchema.md](docs/vexJsonSchema.md)
49
+ - Contributing: [docs/CONTRIBUTING.md](docs/CONTRIBUTING.md)
50
+ - Usage & CLI: [docs/USAGE.md](docs/USAGE.md)
51
+ - Changelog: [docs/CHANGELOG.md](docs/CHANGELOG.md)
52
+ - Release notes: [docs/releaseNote/](docs/releaseNote/)
74
53
 
75
- - [Discord](https://discord.gg/PZGMzDp7)