GitHub repository: FoalTS/foal
Description: Full-featured Node.js framework, with no complexity. 🚀 Simple and easy to use, TypeScript-based and well-documented.
Topics: api, auth, dependency-injection, express, foal, foalts, foalts-cli, framework, jwt, node, nodejs, nodejs-framework, orm, rest, sdk, security, typeorm, typescript, typescript-framework, web-framework

v4.2.0: tag_name: v4.2.0
body: # Features

- [x] [Bug] Fix "foal connect angular" to support latest versions of Angular (issue: #1197) (PR: #1236)
- [x] Allow to disable AJV strict mode (issue: #1206) (PR: #1239)
- [x] Possibility to pass `cacheControl` option to static middleware (issue: #1221) (PR: #1241 )
- [x] Logs added to socket.io controllers (PR: #1240)
v4.1.0: tag_name: v4.1.0
body: # Features

- [x] Add request ID (PR: #1234)
- [x] Add Foal logger (PR: #1234)
- [x] Support XML requests (issue: #1203) (PR: #1231)

# Dependencies

- `@foal/cli`
  - `commander@11.1`
- `@foal/swagger`
  - `swagger-ui-dist@5.9`

# Contributors

@paoloevan 
v4.0.0: tag_name: v4.0.0
body: # Overview and goals

#1223 

# Migration guide

- Run `npx foal upgrade`.
- Version 16 of Node is not supported anymore. Upgrade to version 18 or version 20.
- Support of MariaDB has been dropped.
- If you use any of these dependencies, upgrade `typeorm` to v0.3.17, `graphql` to v16, `type-graphql` to v2, `class-validator` to v0.14, `mongodb` to v5 and `@socket.io/redis-adapter` to v8.
- If you use both TypeORM and `MongoDBStore`, there is no need anymore to maintain two versions of `mongodb`. You can use version 5 of `mongodb` dependency.
- If you use `@foal/socket.io` with redis, install `socket.io-adapter`.
- Support for `better-sqlite` driver has been dropped. Use the `sqlite3` driver instead. In DB configuration, use `type: 'sqlite'` instead of `type: 'better-sqlite3'`.
- In your project dependencies, upgrade `@types/node` to v18.11.9.
- If you use TypeORM with MongoDB, for the entities definitions, rename `import { ObjectID } from 'typeorm';` to `import { ObjectId } from 'typeorm';`

# Dependencies

- `@foal/aws-s3`
  - `@aws-sdk/client-s3@3.405.0`
  - `@aws-sdk/lib-storage@3.405.0`
- `@foal/cli`
  - `commander@11.0`
- `@foal/graphiql`
  - `graphiql@3.0`
- `@foal/graphql`
  - `graphql@10.3`
  -  `graphql@^16.8` (peer dependency)
- `@foal/jwks-rsa`
  - `jwks-rsa@3.0`
- `@foal/mongodb`
  - `mongodb@5.8`
- `@foal/redis`
  - `redis@4.6`
- `@foal/socket.io`
  - `socket.io@4.7`
- `@foal/swagger`
  - `swagger-ui-dist@5.4`
- `@foal/typeorm`
  - `typeorm@0.3.17` (peer dependency)
  - `mongodb@5.8` (dev dependency / driver)
  - `pg@8.11` (dev dependency / driver)
- `@foal/typestack`
  - `class-validator@0.14` (peer dependency)
v3.3.0: tag_name: v3.3.0
body: # Features

The `jsonwebtoken` dependency has been upgraded to v9 to address [security issues](https://github.com/auth0/node-jsonwebtoken/blob/master/CHANGELOG.md#900---2022-12-21).

> Note that RSA key size now must be 2048 bits or greater. Make sure to check the size of your RSA key before upgrading to this version.

# Dependencies

- `@foal/cli`
  - `ajv@8.12`
- `@foal/core`
  - `ajv@8.12`
- `@foal/graphql`
  - `ajv@8.12`
- `@foal/jwt`
  - `jsonwebtoken@9.0`
- `@foal/social`
  - `jsonwebtoken@9.0`

# Dev dependencies

- mocha
- rimraf
- typescript
- supertest
- concurrently
- ESLint dependencies
- nyc
v3.2.0: tag_name: v3.2.0
body: # Features

- [x] Re-add `@foal/password` (issue: #1195) (PR: 1196)
- [x] Add `ctx.controllerName` and `ctx.controllerMethodeName` (issue: #1183) (PR: #1199)

# Contributors

@lcnvdl
v3.1.0: tag_name: v3.1.0
body: # Features

- [x] Update the `max-age` attribute of the `Strict-Transport-Security` header to "industry standard" (issue: #1146) (PR: #1155)
- [x] [CLI] Disable ESLint rule `@typescript-eslint/no-non-null-assertion` in generated projects (PR: #1178) 
- [x] [Bug] Support whitespaces around variable names in `.env` files (issue: #1182) (PR: #1185)
- [x] Support custom cookie domain in social auth (issue: #1099) (PR: #1187)
- [x] [CLI] Add `foal upgrade` command (issue: #1158) (PR: #1186, #1193)
- [x] Fix: support custom OpenAPI "example" keyword in AJV validation (issue: #1192) (PR: #1194)

# Dependencies

https://github.com/FoalTS/foal/pull/1162

# Dependencies

- `@foal/aws-s3`
    - `@aws-sdk/client-s3@3.198.0`
    - `@aws-sdk/lib-storage@3.198.0`
- `@foal/cli`
    - `commander@9.4.1`
- `@foal/core`
    - `express@4.18.2`
- `@foal/jwks-rsa`
    - `jwks-rsa@2.1.5`
-  `@foal/mongodb`
    - `mongodb@4.11.0`
- `@foal/socket.io`
    - `socket.io@4.5.3`
- `@foal/swagger`
    - `swagger-ui-dist@4.15.2`

# Contributors

- @edw1882 
v3.0.2: tag_name: v3.0.2
body: # Fixes

- [x] Make `createapp` install v3 of `@foal/cli` (PR: #1172)
v3.0.1: tag_name: v3.0.1
body: # Fixes

- [x] [CLI] Support AJV formats in shell scripts (issue: #1167) (PR: #1168)
v3.0.0: tag_name: v3.0.0
body: ## Features

- [x] Drop support for Node 10 (unmaintained), 12 (not maintained from April 2022) and 14 (not maintained in less that a year). Support versions 16 and 18.
    - #1029
    - #1070
    - #1075 
- [x] Upgrade all 3p dependencies doing major upgrades (`graphql`, etc). Specify which minimum version of TypeORM is required. Upgrade the peer dependencies. 
    - #1028 
    - #1030 
    - #1033
    - #1035 
    - #1036
    - #1041 
    - #1056
    - #1148
    - #1079
    - #1081
    - #1082
    - #1154
- [x] Use latest version of AJV and use its TS integration (maybe related: #988). Check that the option names are still the same. Check potential conflicts with OpenAPI types.
    - #1037
- [x] Remove the functions `escape` and `escapeProp`. Modern frontend frameworks (React, Angular, Vue, etc) take care of this.
    - #1034 
- [x] Improve the interface of the `Context` class to mainly improve type safety.
    - #1073
- [x] Correct the bad design on the precedence of environment variables. (issue: #1021)
    - #1128
- [x] Support optional fields in @ValidateMultipartFormDataBody (issue: #1008)
    - #1048 
- [x] Support TypeORM 0.3.0.
  - #1074
  - #1089 
  - #1091
  - #1092
  - #1093
  - #1094
  - #1095
  - #1096
  - #1098
  - #1100
  - #1156
- [x] Ignore `undefined` values in configuration (issue: #1071)
  - #1113
- [x] Simplify generated CLI files.
  - #1077
- [x] ~Drop `foal generate rest-api` command.~
  - #1078
  - #1088
- [x] Make the session and JWT systems a bit simpler.
  - #1107 
  - #1108
  - #1119
  - #1133
  - #1134
  - #1135
  - #1145
  - #1147
  - #1152
- [x] Miscellaneous
  - #1114
  - #1117
  - #1121
  - #1124 
  - #1125
  - #1127
  - [Replace v2 migration with empty v3 migration](https://github.com/FoalTS/foal/pull/1031/commits/1ca888f5b68783f694ddefa817663181fdf06df3)

# Dependencies

- `@foal/aws-s3`
  - `aws-sdk` -> `@aws-sdk/client-s3@3.113.0` and `@aws-sdk/lib-storage@3.113.0`
- `@foal/cli`
  - `ajv@8.11.0`
  - `commander@9.3.0`
- `@foal/core`
  - `ajv@8.11.0`
  - `ajv-formats@2.1.1`
  - `express@4.18.1`
- `@foal/graphql`
  - `ajv@8.11.0`
  - `peerDependencies: graphql@^15.8.0`
- `@foal/jwks-rsa`
  - `jwks-rsa@2.1.4`
- `@foal/jwt`
  - `jsonwebtoken@8.5.1`
- `@foal/mongodb`
  - `mongodb@4.7.0`
- `@foal/redis`
  - `redis@4.1.0`
- `@foal/socket.io`
  - `socket.io@4.5.1`
- `@foal/storage`
  - `busboy@1.6.0`
  - `mime@3.0.0`
- `@foal/swagger`
  - `swagger-ui-dist@4.12.0`
- `@foal/typeorm`
  - `peerDependencies: typeorm@^0.3.10`
- `@foal/typestack`
  - `peerDependencies: class-transformer@0.5.1`
  - `peerDependencies: class-validator@0.13.2`
v2.11.0: tag_name: v2.11.0
body: # Features

- [x] Increase password hashing iterations (PR: #1149)
v2.10.2: tag_name: v2.10.2
body: # Content

- [x] [Internal] Add `getCsrfTokenFromRequest` util (PR: #1138)
- [x] [Internal] Split directories `jwt` and `sessions` into `jwt|sessions/core` and `jwt|sessions/http` (PR: #1137)
- [x] [Internal] Add `getCsrfTokenFromCookie` and `shouldVerifyCsrfToken` utils (PR: #1140)
- [x] [Internal] Reorganize utils in `jwt/` and `sessions/` (PR: #1141)
v2.10.1: tag_name: v2.10.1
body: # Fixes

- [x] Do not throw errors on uploads with empty filenames (PR: #1129)
- [x] Add default `Content-Type` header in `Disk.createHttpResponse` responses (PR: #1130)
v2.10.0: tag_name: v2.10.0
body: # Features

- [x] `@foal/cli` included as dev dependency in new projects generated by `createapp` (issue: #1097) (PR: #1109)
- [x] [CLI] Do not use `http` module in new projects (PR: #1118)
- [x] [CLI] Fix `concurrently` issue on some OS (issues: #1115, #1022) (PR: #1123)
- [x] [Internal] [CLI] Add `fs.getProjectDependencies` and `fs.getProjectDevDependencies` (PR: #1111)
- [x] [Internal] Re-organize `common/` internal directory (PR: #1122)

# Contributors 

@scho-to 
v2.9.0: tag_name: v2.9.0
body: # Features

- [x] Support version 15 of `graphql` and recent versions of `type-graphql` (issue: #1066) (PR: #1068)
- [x] Support PKCE in OAuth2 providers (issue: #1014) (PR: #1053)
- [x] Add Twitter provider (issue: #1047) (PR: #1053)

# Dependencies

- `@foal/core`
  - `express@4.18`
- `@foal/mongodb`
  - `mongodb@3.7`
- `@foal/socket.io`
  - `socket.io@4.5`

# Contributors

@LeonardoSalvucci
v2.8.2: tag_name: v2.8.2
body: - [x] [CLI] Fix installation with yarn on node 10 (PR: #1058)
- [x] Show security requirements, servers and external doc of sub-controllers in Swagger auto-generated document (issue: #1057) (PR: #1060)
v2.8.1: tag_name: v2.8.1
body: # Improvements / fixes

- [x] [WS] Allow to emit client events without payload or callback (issue: #1043) (PR: #1044)
v2.8.0: tag_name: v2.8.0
body: ## Features

- [x] Add Websocket/Socket.io support (issue: #481) (PR: #901)
- [x] Allow to pass a custom redis client to the `RedisStore` (PR: #1032)
- [x] Allow to pass a custom MongoDB client to the `MongDBStore` (PR: #1032)
- [x] Allow to pass a custom TypeORM connection to the `TypeORMStore` (PR: #1032)
- [x] Support `ServerSideEncryption` for AWS S3 (issue: #1013) (PR: #1040)

## Dependencies

- `@foal/aws-s3`
  - `aws-sdk@2.1069.0`
- `@foal/core`
  - `express@4.17.2`
- `@foal/social`
  - `node-fetch@2.6.7`

v2.7.2: tag_name: v2.7.2
body: # Fixes

- [x] Fix `colors` dependency version which causes bad output on Windows terminal (PR: #1023)

# Contributors

@kingdun3284 
v2.7.1: tag_name: v2.7.1
body: # Bug fix

- [x] Fix bug introduced in v2.7.0 on `HttpResponse["body"]` (issue: #1009) (PR: #1010)
v2.7.0: tag_name: v2.7.0
body: # Features

- [x] `foal g hook` and `foal g entity` support sub-directories (issue: #993) (PR: #994)
- [x] Support signed cookies (issue: #992) (PR: #996)
- [x] Make `HttpResponse` generic to type the `body` property (PR: #978)
- [x] Allow to use `FOAL_ENV` (instead of `NODE_ENV`) to define the environment name (issue: #1004) (PR: #1007)
- [x] Add a `afterPreMiddlewares` option to `createApp` (issue: #980) (PR: #1003)

# Contributors

@MCluck90
@kingdun3284 
v2.6.0: tag_name: v2.6.0
body: # Features

- [x] Support the `array` value of the AJV `coerceTypes` option (issue: #961).
- [x] Support more strict CSP for Swagger page (issue: #969) (PR: #970)
- [x] [Bug] [CLI] Support empty angular.json for `connect` cmd (issue: #982) (PR: #990)

# Dependencies

- `@foal/swagger`
  - `swagger-ui-dist@3.52`
v2.5.0: tag_name: v2.5.0
body: # Features

- [x] [CLI] `npm run develop` watches config files (issue: #945) (PR:#947)
- [x] `createOpenApiDocument` accepts an optional serviceManager (issue: #949) (PR: #950)
v2.4.0: tag_name: v2.4.0
body: # Features

- [x] Support Ajv `$data` option (issue: #920) (PR: #923)
- [x] [CLI] Simplify default create-user script (PR: #927)
- [x] [Bug] Fix `renderError` error (issue: #930) (PR: #931)
- [x] Add cache option to `Disk.createHttpResponse` (issue: #401) (PR: #938)

# Contributors

@ZakRabe
v2.3.0: tag_name: v2.3.0
body: # Features

- [x] Support `.env.local` files for configuration (issue: #877) (PR: #899)
- [x] Support GraphiQL (issue: #439) (PR: #906).
- [x] Allow to access the service manager in `fetchUser` and add Prisma docs (issue: #856) (PR: #909).
- [x] Add `streamToBuffer` and `convertBase64urlToBase64` functions (PR: #910)
- [x] [Social] Fix state bad URL characters (issue: #754) (PR: #911)

# Dependencies

- `@foal/cli`
  - commander@7.2.0
- `@foal/jwks-rsa`
  - jwks-rsa@1.12.3
- `@foal/mongodb`
  - mongodb@3.6.6
- `@foal/redis`
  - redis@3.1.2
- `@foal/swagger`
  - swagger-ui-dist@3.47.1

# Contributors

- @ognjenjevremovic
v1.12.2: tag_name: v1.12.2
body: # Bug fixes

- [x] [Social] Fix state bad URL characters (issue: #754) (PR: #912)
v2.2.0: tag_name: v2.2.0
body: # Features

- [x] [CLI] Prettify createapp and add spinner (PR: #875)
- [x] [CLI] Support sub-paths in `generate rest-api` (issue: #862) (PR: #878)
- [x] Know if the user is authenticated on the client side when using cookies (issue: #843) (PR: #886).
- [x] Prettify server output (PR: #885)

# Dependencies

- @foal/cli
  - commander@7.1
v2.1.2: tag_name: v2.1.2
body: # Fixes

- [x] [CLI] Ignore SQLite SHM and WAL files in .gitignore (files generated by `better-sqlite3` since v2.1.1).
v2.1.1: tag_name: v2.1.1
body: # Features

Apologies for adding a new feature here (this does not strictly follow version semantic rules), but it was needed in order to fix a bug.

- [x] Support `better-sqlite3` (issue: #870) (PR: #872)

# Bug fixes

- [x] The 500 debug page has no scrollbar anymore.
- [x] Generating new projects with `sqlite3` pkg was causing some errors depending on the version of python installed on the host. This kind of errors already happened in the past. To fix this, new projects use `better-sqlite3` under the hood. The framework behavior (migrations, permissions, etc) is identical as if `sqlite3` library were used. (PR: #872)
v2.1.0: tag_name: v2.1.0
body: # Features

- [x] Pretiffy the welcome and the "500 error" pages (PR: #833)
- [x] CLI exits with code 1 when a command fails (PR: #848)
- [x] Hide unhelpful sqlite3 warnings when using createapp with npm (issue: #667) (PR: #854)
- [x] Add `@All` decorator to customize 404 errors when a route has no handler (issue: #750) (PR: #857)
- [x] Add CSRF option in UseSessions to override the configuration (issue: #859) (PR: #867)

# Dependencies

- @foal/aws-s3
  - aws-sdk@2.834
- @foal/cli
  - commander@7.0
- @foal/jwks-rsa
  - jwks-rsa@1.12
- @foal/swagger
  - swagger-ui-dist@3.41
v1.12.1: tag_name: v1.12.1
body: # Features / Fixes

- [x] Fix deprecation warnings in `foal g rest-api` (PR: https://github.com/FoalTS/foal/pull/834)

# Contributors

@JuanVqz 
v2.0.0: tag_name: v2.0.0
body: ## How to upgrade to v2.0

https://github.com/FoalTS/foal/blob/v2-0-0/docs/upgrade-to-v2/index.md
OR (if dead link)
https://github.com/FoalTS/foal/blob/master/docs/upgrade-to-v2/index.md

## Features

General issue: #658

### 1. Developper experience (CLI) :white_check_mark:

- Simplify commands for scripts and migrations (issue: #494) (PR: #684).

### 2. Authentication with sessions :white_check_mark:

Summary: #799.

- Simplify logout (issue: #726) (PR: #659)
- Remove the need for a secret (issue: #727) (PR: #742)
- Do not let TypeORMStore auto-update the database schema (issue: #766) (PR: #767)
- Allow to query all sessions of a user (issue: #510) (PR: #780)
- Allow to query all connected users (issue: #778) (PR: #780)
- Allow to force the disconnection of a user (issue: #779) (PR: #780)
- Support flash sessions (issue: #521) (PR: #781)
- Allow to regenerate the session ID for security reasons  (issue: #728) (PR: #792).
- Make it easier to implement a custom session store and maintain it (issue: #794) (PR: #792).
- Cleanup regularly expired sessions in MongoStore and TypeORMStore (issue: #793) (PR: #792).
- Make it easier to use templates and to authenticate anonymous users (issue: #795) (PR: #792).
- [MongoStore] Use sessionID instead of _id to prevent errors on hex vs base64 (issue: #797) (PR: #800)
- [V2][Sessions] Remove the need of setSessionCookie in login (issue: #796) (PR: #801)
- Make it easy/fast to use CSRF tokens with sessions (SPA & regular apps) (issue: #798) (PR: #802)
- Do not save sessions if an error is thrown in a controller or a hook (PR: #823).

### 3. Schema references in validation hooks :white_check_mark:

- Allow to use OpenAPI schema references (issue: #552) (PR: #734)

### 4. Service initialization :white_check_mark:

- Initialize services by default (PR: #733)

### 5. Accessing file metadata during uploading :white_check_mark:

- [File upload] Access file size, mime type, encoding and original file name (issue: #673) (PR: #730)

### 6. Safer configuration :white_check_mark:

- Replace Config.get with Config.get2 (issue: #496) (PR: #732)

### 7. Improve the naming of JWT settings :white_check_mark:

- PR: #802

### 8. Remove support of Mongoose :white_check_mark:

- Remove support of Mongoose (PR: #741)

### 9. Improve the configuration system :white_check_mark:

- Use new configuration system (issues: #497, #805) (PR: #806)

### 10. Simplify the management of custom errors thrown in controllers and hooks :white_check_mark:

- Simplify the management of custom errors thrown in controllers and hooks (issue: #638) (PR: #807)

### 11. Cleanup :white_check_mark:

- Drop NodeJS 8 support and test NodeJS 12 (PR: #699).
- Remove outdated and useless security headers.
- Remove the objects `ObjectDoesNotExist`, `PermissionDenied` (PR: #718)
- PR: #804

## Dependencies

### Packages

- @foal/cli
  - commander@6.2
- @foal/jwks-rsa
  - jwks-rsa@1.10
- @foal/swagger
  - swagger-ui-dist@3.35
- @foal/typestack
  - class-transformer@0.3 (peer dependency)

### Generated projects (`foal createapp`)

- sqlite3@5.0
- @types/mocha@7.0.2
- @types/node@10.17.24
- concurrently@5.3
- mocha@8.2
- supertest@6.0
- typescript@4.0

v1.12.0: tag_name: v1.12.0
body: - [x] Deprecate some components to prepare the migration to version 2.
v1.11.2: tag_name: v1.11.2
body: # Features

- [x] [OpenAPI] Fix incorrect path validation error (issue: #821) (PR: #822)

# Contributors

@jeredmasters 
v1.11.1: tag_name: v1.11.1
body: # Features and fixes

- [x] Fix timeouts in CI which cause some tests to fail.
- [x] Fix the "overriding" class bug in `@ValidateBody` (typestack) (issue: #785) (PR: #786)

# Contributors

@AleksandrSl
v1.11.0: tag_name: v1.11.0
body: # Features

**Key features**
- [x] [Sessions] Allow to specify the store name in the configuration (issue: #725) (PR: #729, #759)
      Doc: https://github.com/FoalTS/foal/blob/master/docs/authentication-and-access-control/session-tokens.md#specify-the-name-of-the-session-store-in-the-configuration
- [x] Support abstract services (issue: #758) (PR: #759).
      Doc: https://github.com/FoalTS/foal/blob/master/docs/architecture/services-and-dependency-injection.md#abstract-services
- [x] Extend `ValidateBody` from TypeStack to access the controller properties (issue: #752) (PR: #755).
      Doc: https://github.com/FoalTS/foal/blob/master/docs/validation-and-sanitization.md#usage-with-a-hook

**Small things**
- [x] Remove some useless npm and yarn warnings on install (issue: #695) (PR: #761)
- [x] [CLI] Catch rejected promises in shell scripts (issue: #671) (PR: #762)

# Contributors

@AleksandrSl

# Dependencies

- @foal/swagger
  - swagger-ui-dist@3.28
v1.10.0: tag_name: v1.10.0
body: Not published. See v1.11.0.
v1.9.0: tag_name: v1.9.0
body: # Features

- [x] Make JWTRequired and TokenRequired work with TypeORM and MongoDB (fetchMongoDBUser) (issue: #548) (PR: #701)
- [x] Request body and path parameters are now also passed as third and second arguments to the controller methods (issue: #507) (PR: #705)
- [x] Add `HttpResponseTooManyRequests` (issue: #664) (PR: #709)
- [x] Support custom type for `ctx.state` (issue: #711) (PR: #717)
- [x] [Bug] Make `forceDownload` option work on all browsers (PR: #722)

## CLI

> *This version also takes care of closing a lot of pending issues.*

- [x] [CLI] [Internal] Refactor the CLI to add new features in the future (issue: #577) (PR: #712)
- [x] [CLI] [Bug] Fix error displayed when running `foal g vscode-config` (issue: #694) (PR: #714).
- [x] [CLI] Support subdirectories in `g service|controller` (ex: `foal g controller api/products --register`) (issue: #368) (PR: #714)
- [x] [CLI] [Bug fix] Frontend projects attached to Foal with `foal connect` on Windows now can build on unix systems (issue: #562) (PR: #703)
- [x] [CLI] [Bug fix] Fix yarn installation failure on Node 8 (issue: #706) (PR: #705)
- [x] [CLI] [Bug fix] Scripts generated in a Mongoose project uses Mongoose (issue: #362) (PR: #715)
- [x] [CLI] Support `--auth` flag in `foal g rest-api` (issue: #366) (PR: #716)

# Contributors

@matt-harvey 
@kingdun3284 
@AminTaghikhani
v1.8.1: tag_name: v1.8.1
body: # Features

This patch fixes type issues introduced in v1.8.0

- [x] Remove mongoose types (issue: #687) (PR: #688).
- [x] Remove "@types/express-serve-static-core" and define own `Request` interface (issue: #686) (PR: #690)
v1.8.0: tag_name: v1.8.0
body: # Features

- [x] Allow to inject interfaces and generic classes (such as TypeORM entities) (issues: #598, #627) (PR: #675).
- [x] `ServiceManager.set` returns itself (PR: #675).
- [x] Support service initialization (boot method) (issues: #628) (PR: #678)
- [x] Base64-encoding option for JWT secrets (issues: #523) (PR: #677)
- [x] `UserWithPermissions` extends `BaseEntity` (issue: #656) (PR: #682)
- [x] `UserWithPermissions` has a static method to get all users with a given permission (issue: #637) (PR: #682)
- [x] Fix recurring bugs with the types of `@types/express` (issue: #683) (PR: #685).

# Dependencies

- @foal/jwks-rsa
  - jwks-rsa@1.8
- @foal/redis
  - redis@3.0
v1.7.1: tag_name: v1.7.1
body: - [x] Fix multipart fields validation (#672)
v1.7.0: tag_name: v1.7.0
body: # Features

- [x] [Config] Ajv: support the option `allErrors` (issue: #633) (PR: #642)
- [x] [Config] Add an option not to log errors (issue: #612) (PR: #644)
- [x] [Storage] Add `isFileDoesNotExist` function (#657).
- [x] Enhance Config to support type and value checking. More detailed errors (issue: #496) (PR: #641)
- [x] Validate multipart/formdata requests to facilitate file uploads (issue: #560) (PR: #651)

# Dependencies

- @foal/aws-s3
  - aws-sdk@2.640 (#662)
- @foal/cli
  - ajv@6.12
  - commander@5.0 (#662)
- @foal/core
  - ajv@6.12
  - morgan@1.10
- @foal/graphql
  - ajv@6.12
- @foal/jwks-rsa
  - jwks-rsa@1.7 (#662)

v1.6.0: tag_name: v1.6.0
body: # Features

- [x] **Support local and Cloud storage (fs and AWS S3)** (issues: #604, #421) (PR: #611)
- [x] **Allow to inject custom instances into the DI system** (PR: #599)
- [x] Fix `foal generate controller —register` bug (issue: #606) (PR: #619)
- [x] [CLI] Clean the build directory before building the files (issue: #607) (PR: #621)
- [x] [Internal] Update GraphQL version and modify `tsconfig` (issue: #614) (PR: #623, #624)
- [x] Better stream error handling (PR: #611)

# Deprecation

The function `createHttpResponseFile` is deprecated. Prefer to use `Disk.createHttpResponse` instead: https://foalts.gitbook.io/docs/topic-guides/file-system/upload-and-download-files#file-downloads

# How to upgrade

```
npm update @foal/core # and all the other packages you use
```

Additionally, you can update your `package.json` like [this](https://github.com/FoalTS/foal/issues/607#issuecomment-577303841).

# Contributors

@jeredmasters

# Dependencies

- @foal/cli
  - ajv@6.11 (#613)
- @foal/core
  - ajv@6.11 (#613)
- @foal/graphql
  - ajv@6.11 (#613)
- @foal/mongodb
  - mongodb@3.5 (#613)
- @foal/swagger
  - swagger-ui-dist@3.25 (#613)
v1.5.0: tag_name: v1.5.0
body: # Features

- [x] [Social auth] Add Github and LinkedIn providers  (issue: #125) (PR: #591)
- [x] [CLI] Set default CSRF protection for sessions in the configuration (PR: #594).
- [x] Support the `'none'` option for `SameSite` cookie attribute (PR: #594).
- [x] Be able to customize the global exception handler (issue: #370) (PR: #595)
- [x] Be able to increase the request body size limit (issue: #596) (PR: #597)
- [x] [Internal] Compile Foal's packages with the option `noImplicitAny: true` (PR: #600)
- [x] Remove `type-graphql` dependency introduced by mistake in v1.3.1 (PR: #608)
- [x] [CLI] Remove wrong npm naming control (PR: #610) 

# Dependencies

- @foal/mongodb
  - mongodb@3.4 (#609)
v1.4.0: tag_name: v1.4.0
body: There is no version v1.4.0. Please refer to version 1.5.0
v1.3.1: tag_name: v1.3.1
body: - [x] [Social Auth] [Bug] Improve social errors (issue: #582) (PR: #584)
v1.3.0: tag_name: v1.3.0
body: # Features

- [x] Migrate to TypeScript version 3 (PR: #557) (breaking change).
- [x] Fix the `unknown` issue when building `@foal/typestack` (PR: #557).
- [x] Accept null as GraphQL query variables (PR: #553).
- [x] [CLI] Add `--no-git` and `--no-install` options to `createapp` (PR: #554).
- [x] [CLI] Stop `createapp my-app` if the directory `my-app` already exists (PR: #554).
- [x] [CLI] Fix bug: the CLI help is displayed unexpectedly (PR: #554).
- [x] [CLI] Generate new projects with ESLint instead of TSLint (issue: #555) (PR: #561) (big thanks to @fer22f)
- [x] [Social Auth] Add Facebook and Google providers (issue: #125) (PR: #563)
- [x] Upgrade sub-dependencies (PR: #578).

# Breaking change

Due to a compatibility issue with `class-transformer`, Foal TS does not support TypeScript 2 anymore. Version 3.5 or higher is recommended.

# Contributors

@firesharker
@fer22f

# Dependencies

- @foal/cli
  - ajv@6.10
  - colors@1.4
- @foal/core
  - @types/express@4.17
  - ajv@6.10
  - express@4.17
- @foal/ejs
  - ejs@2.7
- @foal/jwks-rsa
  - jwks-rsa@1.6
- @foal/jwt
  - jsonwebtoken@8.5
- @foal/mongodb
  - mongodb@3.3
- @foal/mongoose
  - @types/mongoose@5.5
- @foal/swagger
  - swagger-ui-dist@3.24
v1.2.0: tag_name: v1.2.0
body: - [x] Add TypeStack unserialization and validation hooks (issue: #460) (PR: #542).
- [x] Support `AppController.init` to initialize the application (issue: #517) (PR: #544)
- [x] Support `ExpressOptions.expressInstance` in `createApp`(PR: #547)
- [x] Add community chat link in npm packages (PR: #541).
- [x] Remove Mongoose warning logs when creating a new project with `foal createapp` (PR: #541).
v1.1.1: tag_name: v1.1.1
body: - [x] Fixes incorrect configuration for `loggerFormat: none`.
v1.1.0: tag_name: v1.1.0
body: # Features

- [x] HTTP Request Logger: Support the "none" option (issue: #475) (PR: #482).
- [x] Prettify the "500 error page" in development (issue: #479) (PR: #487).
- [x] Be able to extend Swagger UI options (issue: #486) (PR: #495).
- [x] [CLI] Set default TS version to 3.5 in new projects (foal createapp) (issue: #528) (PR: #531)
- [x] [CLI] Handle promise rejections in main (issue: #534) (PR: #535)
- [x] [Sessions][Auth] Support MongoDB as session storage (issue: #474) (PR: #513).
- [x] Support Nuxt.js and post Express middlewares (issue: #502) (PR: #536)
- [x] Support AJV "nullable" option (issue: #532) (PR: #537).

# Contributors 

@yaaminu
@kingdun3284 
@amylily1011
Fix small inconsistencies and bugs in v1.0.0: tag_name: v1.0.1
body: # Content

- [x] `foal g sub-app` should not generate a sub `sub-apps` directory by default.
- [x] The configuration files generated with `foal createapp --mongodb` should not contain TypeORM options.
- [x] [Bug] Just like `setCsrfToken`, `@CsrfTokenRequired` should use the configuration key `settings.csrf.cookie.name` if it has a value.
- [x] [Bug] Make `foal generate` not fail if index.ts does not exist (PR: #484).
- [x] [Bug] Fix 500 errors on invalid JSON (issue: #457) (PR: #483)
- [x] [CLI] Add missing doc in command

Version 1.0.0: tag_name: v1.0.0
body: # What's new?

**Finally the version 1 of FoalTs is out!** This means that from now on:
- the architecture of the framework is stable,
- and features are production-ready.

This new version comes with hundreds of new lines of documentation and offers many new features:
- The session authentication system has been refactored so that we can build any kind of apps (API, SPA+API, Mobile+API, Regular Web Apps) without the difficulties that we usually have to deal with with sessions (SPA, hot reloading, serverless deployments, etc)
- VSCode debugger can be used when running unit or e2e tests.
- New functions allow us to generate tokens when we need to (password reset, ).
- Hooks can be merged into one single.
- All Express-compatible template engines are now supported.
- We can generate OpenAPI spec from the built-in hooks (`JWTRequired`, `ValidateBody`, `TokenRequired`, etc).
- Hooks can access controller properties facilitating code reuse with inheritance.

# Features (formal)

- [x] Be able to run unit & e2e tests with VSCode debugger (issue: #386) (PR: #444).
- [x] Infer OpenAPI specification from built-in hooks (`ValidateXXX`, `JWTRequired`, etc) (issues: #423, #424) (PR: #454)
- [x] Refactor the session system and introduce the authentication tokens (issue: #451) (PR: #456).
- [x] Have functions to generate and verify tokens (issue: #464) (PR: #456).
- [x] Be able to group multiple hooks into one (issue: #446) (PR: #453)
- [x] Implement the changes of **version 1.0.0** (issue: #431) (PRs: #452, #465).
- [x] Make the hooks and open api decorators have access to the controller instance (issue: #459) (PR: #466)
- [x] Support Express template engines (issue: #445) (PR: #465)
- [x] Simplify hook post functions (PR: #466)

# How to Upgrade to Version 1

Depending on your application, upgrading your code to version 1 should take **between 15 minutes and 1 hour**. **Most applications are only concerned by a limited number of the points mentioned below.**. As we are now on version 1, this the last *major* upgrade that you'll face.

If you have difficulties to upgrade to version 1, feel free to open an issue. I'll be happy to help!

**Feel free to open an issue**, if you have trouble upgrading to version 1. I'll be happy to help!

## Mandatory

*Don't be afraid.*

```sh
npm install @foal/core@1 # and @foal/typeorm@1, @foal/jwt@1, etc. if it applies.
```

1. The function `encryptPassword` has been renamed to `hashPassword`.

2. The configuration key `settings.staticUrl` has been renamed to `settings.staticPath`.

    If you created your project with `foal createapp <name>`, open `config/default.json` and rename the key as follows:

    ```json
    {
      "settings": {
        "staticPath": "public/"
        ...
      }
      ...
    }
    ```

    If you created your project with `foal createapp <name> --yaml`, open `config/default.yml` and rename the key as follows:

    ```yaml
    settings:
      staticPath: public/
      ...
    ...
    ```

3. **If you use _Server-Side Rendering_**, the function `render` now returns a `Promise<HttpResponseOK>` instead of an `HttpResponseOK` object. In most cases, it does not change anything to your code. The below example still work in version 1.

    ```typescript
    class ViewController {

      @Get('/')
      index() {
        return render('./templates/index.html', { name: 'Hello!' }, __dirname)
      }

    }
    ```

    If you use `@foal/ejs`, uninstall the package and install directly `ejs` instead.
    
    ```
    npm uninstall @foal/ejs
    npm install ejs
    ```

    Then specify the name of the template engine in your configuration.

    *Example with config/default.json*
    ```json
    {
      "settings": {
        "templateEngine": "ejs"
        ...
      }
      ...
    }
    ```

    *Example with config/default.yml*
    ```yaml
    settings:
      templateEngine: "ejs"
      ...
    ...
    ```

4. **If you use cookies**, the `maxAge` directive is now the number of seconds until the cookie expires (it was previously the number of milliseconds).

    ```typescript
    // Before
    const response = new HttpResponseOK();
    response.setCookie('my-cookie-name', 'my-cookie-value', { maxAge: 60000 })

    // After
    const response = new HttpResponseOK();
    response.setCookie('my-cookie-name', 'my-cookie-value', { maxAge: 60 })
    ```

5. **If you provide your own express instance** to `createApp`, the `createApp` function now accepts only two parameters.

    ```typescript
    // Before
    const app = createApp(AppController, { /* ... */ }, myExpressApp);

    // After
    const app = createApp(AppController, myExpressApp);
    ```

6. **If you use hook post functions** (which the case if you enabled **CORS**), their interface has been simplified. From now on, they only accept one parameter: the response object.

    *CORS example*

    ```typescript
    // Before
    @Hook(() => (ctx, services, response) => {
      response.setHeader('Access-Control-Allow-Origin', '*');
    })
    export class ApiController {
      // ...
    }

    // After
    @Hook(() => response => {
      response.setHeader('Access-Control-Allow-Origin', '*');
    })
    export class ApiController {
      // ...
    }
    ```

7. **If you call directly the functions `getApiComponents` or `getApiCompleteOperation` (very unlikely)**, they now accept 2-3 parameters:

    ```typescript
    // Before
    getApiComponents(Foobar);
    getApiComponents(Foobar, 'foo');

    // After
    getApiComponents(Foobar, new Foobar());
    getApiComponents(Foobar, new Foobar(), 'foo');
    ```

8. **If you use the hooks `@ValidateBody`, `@ValidateQuery`, `@ValidateParams`, `@ValidateCookies`**, their HTTP responses are now more detailed.

    *Example of HTTP response body for `@ValidateParams`*
    ```json
    // Before
    [
      // ...
    ]

    // After
    {
      "pathParams": [
        // ...
      ]
    }
    ```

9. **If you use sessions or authentication with sessions (`@LoginRequired`, `@LoginOptional`)**, go to the appendix [*Sessions*](#Sessions) below.

10. **If you use cookies and the CSRF protection**, 
go to the appendix [*CSRF*](#CSRF) below.

## Recommended

Previous versions of FoalTS used a `ormconfig.json` or `ormcofing.yml` file to specify the database credentials and the configuration of TypeORM.

However, this had some disadvantages:
- It was difficult to provide database credentials using environment variables. We were stuck with names such as `TYPEORM_USERNAME` or `TYPEORM_PASSWORD` while most cloud providers use a different naming: `DATABASE_PASSWORD`, `RDS_USERNAME`, etc.
- It was **difficult to use a different database per environment**. For example, it is very common to use different databases for development and testing. When running tests, we usually delete all existing data in the database, while when we run the server under development, we want the data from the last launch to be back.

This is why new versions of FoalTS use an `ormconfig.js` file along with the `Config` class (see example below). In this way, we can configure different configurations per environment (with `config/` files) and use custom environment variable in `ormconfig.js` (`RDS_USERNAME`, etc).

I **recommend that you migrate to this new configuration** because it is used by default in new projects and in the new documentation.

In addition, new projects generated by FoalTS will not use the **`synchronize` option** by default. This option recreated the database schema each time the application was launched. This is very convenient during prototyping because we don't need to create and run migrations every time we modify a model.  However, this use is **considered unsafe** and can erase data from the database by mistake (which we do NOT want in production).

This is why new projects disable this option by default (except during testing). **As a replacement, developpers must generate and run migrations each time an entity is modified.** It is a little annoying but more secure. The *get started* tutorials will explain how migrations work and how to use them.

**Example with SQLite**

*ormconfig.js (it replaces ormconfig.js and ormconfig.yml)*
```typescript
const { Config } = require('@foal/core');

module.exports = {
  type: "sqlite",
  database: Config.get('database.database'),
  dropSchema: Config.get('database.dropSchema', false),
  entities: ["build/app/**/*.entity.js"],
  migrations: ["build/migrations/*.js"],
  cli: {
    migrationsDir: "src/migrations"
  },
  synchronize: Config.get('database.synchronize', false)
}

```

*config/default.yml*
```yml
port: 3001

settings:
  ...

database:
  database: './db.sqlite3'

```

*config/default.json*
```json
{
  "port": 3001,
  "settings": {
    ...
  },
  "database": {
    "database": "./db.sqlite3"
  }
}

```

*config/test.yml*
```yml
database:
  database: './test_db.sqlite3'
  dropSchema: true
  synchronize: true
```

*config/test.json*
```json
{
  "database": {
    "database": "./test_db.sqlite3",
    "dropSchema": true,
    "synchronize": true
  }
}
```

> Note: the tests generated by `foal g rest-api` assume that you use this new configuration.

## Optional

1.  If you have been using **JWT** so far **to manage authentication and find it difficult**, then take a look at the new [Session Tokens](link).

1. **If you do not use** `Permission`s or `Group`s, i.e your class `User` does not extend `UserWithPermissions`, you can remove the shell scripts `create-perm.ts` and `create-group.ts` from the directory `src/scripts`.

2. **If you do not use** *Server-Side Rendering* with EJS, you can uninstall the `@foal/ejs` package from your application.

    ```
    npm uninstall @foal/ejs
    ```

3. `HttpResponse.setHeader` and `HttpResponse.setCookie` now returns `this`. So the below example can be refactored as follows to reduce the amount of code.

    ```typescript
    class ApiController {

      @Get('/products')
      readProducts() {
        // Before
        const response = new HttpResponseOK();
        response.setHeader('XXX', 'my header value');
        response.setCookie('XXX', 'my cookie value');
        return response;

        // Possible refactoring after
        return new HttpResponseOK()
          .setHeader('XXX', 'my header value')
          .setCookie('XXX', 'my cookie value');
      }

    }
    ```

## Appendices

### Sessions

> In version 1, the session system has been redesigned to do less magic and to allow developpers to build any kind of applications using sessions (SPA, Mobile, Regular Web Applications).

1. Remove the ExpressJS store from your file `src/index.ts`.

    *Before*
    ```typescript
    // ...
    import * as sqliteStoreFactory from 'connect-sqlite3';
    // ...

    async function main() {
      // ...

      const app = createApp(AppController, {
        store: session => new (sqliteStoreFactory(session))({ db: 'db.sqlite3' })
      });

      // ...
    }

    main();
    ```

    *After*
    ```typescript
    // ...

    async function main() {
      // ...

      const app = createApp(AppController);

      // ...
    }

    main();
    ```

    ```
    npm uninstall connect-sqlite3
    ```

    > In the new version, FoalTS only supports Redis and SQL databases for session storage. If you need more option, feel free to open an issue on Github.

2. Replace `@LoginRequired({ user: xxx })` with `@TokenRequired({ user: xxx, store: TypeORMStore, cookie: true })`.

    *Before*
    ```typescript
    import { LoginRequired } from '@foal/core';
    import { fetchUser } from '@foal/typeorm';

    import { User } from '../entities';
    
    @LoginRequired({ user: fetchUser(User) })
    export class ApiController {
      // ...
    }
    ```

    *After*
    ```typescript
    import { TokenRequired, TypeORMStore } from '@foal/core';
    import { fetchUser } from '@foal/typeorm';

    import { User } from '../entities';
    
    @TokenRequired({
      store: TypeORMStore,
      user: fetchUser(User),
      cookie: true
    })
    export class ApiController {
      // ...
    }
    ```

3. In the same way, replace `@LoginOptional({ user: xxx })` with `@TokenOptional({ user: xxx, store: TypeORMStore, cookie: true })`.

4. Open `config/default.json` (or `config/default.yml`) and replace the session settings with the following:

    *Before*
    ```json
    {
      "settings": {
        ...
        "session": {	
          "cookie": {	
            "path": "/"	
          },	
          "resave": false,	
          "saveUninitialized": false,	
          "secret": "my-secret"	
        }
      },
      ...
    }
    ```

    *After*
    ```json
    {
      "settings": {
        ...
        "session": {	
          "cookie": {	
            "path": "/"	
          },	
          "secret": "my-secret"	
        }
      },
      ...
    }
    ```

5. Open `config/production.json` (or `config/production.yml`) and replace the session settings with the following:

    *Before*
    ```json
    {	
      "settings": {	
        "session": {	
          "cookie": {	
            "httpOnly": true,	
            "maxAge": 3600000,	
            "sameSite": "lax",	
            "secure": true	
          },	
          "name": "id"	
        }	
      }	
    }
    ```

    *After*
    ```json
    {	
      "settings": {	
        "session": {	
          "cookie": {	
            "httpOnly": true,	
            "maxAge": 3600,	
            "sameSite": "lax",	
            "secure": true,
            "name": "id"	
          }
        }	
      }	
    }

6. **If you use `ctx.request.session`**, update your code as follows:

    ```typescript
    // Before
    const x = ctx.request.session.x;
    ctx.request.session.y = 1;

    // After
    const x = ctx.session.get('x');
    ctx.session.set('y', 1);
    ```

7. Update your "login and logout controller" as follows:

    *Before*
    ```typescript
    export class AuthController {

      @Post('/login')
      // ...
      async login(ctx: Context) {
        // ...

        logIn(ctx, user);

        return new HttpResponseRedirect('/');
      }

      @Get('/logout')
      logout(ctx) {
        logOut(ctx);
        return new HttpResponseRedirect('/signin');
      }

    }
    ```

    *After*
    ```typescript
    import { Context, dependency, Post, removeSessionCookie, Session, setSessionCookie, TokenRequired } from '@foal/core';
    import { TypeORMStore } from '@foal/typeorm';

    export class AuthController {
      @dependency
      store: TypeORMStore;

      @Post('/login')
      // ...
      async login(ctx: Context) {
        // ...

        const session = await this.store.createAndSaveSessionFromUser(user);

        const response = new HttpResponseRedirect('/');
        setSessionCookie(response, session.getToken());
        return new HttpResponseRedirect('/');
      }

      @Post('/logout')
      @TokenRequired({
        store: TypeORMStore,
        cookie: true,
        extendLifeTimeOrUpdate: false
      })
      async logout(ctx: Context<any, Session>) {
        await this.store.destroy(ctx.session.sessionID);
        const response = new HttpResponseRedirect('/login');
        removeSessionCookie(response);
        return response;
      }

    }
    ```

### CSRF

1. Install the package `@foal/csrf`.

    ```
    npm install @foal/csrf
    ```

2. **If you use sessions**, add the hook `@CsrfTokenRequired()` after `@TokenRequired(...)`

    *Example*
    ```typescript
    import { CsrfTokenRequired } from '@foal/csrf';

    @TokenRequired({
      cookie: true,
      /* ... */
    })
    @CsrfTokenRequired()
    export class ApiController {
      // ...
    }
    ```

3. **OR if you use double submit cookie technique**, add the hook `@CsrfTokenRequired({ doubleSubmitCookie: true })` on the protected routes.

    *Example*
    ```typescript
    import { CsrfTokenRequired } from '@foal/csrf';

    // Ex: @JWTRequired()
    @CsrfTokenRequired({ doubleSubmitCookie: true })
    export class ApiController {

    }
    ```

4. The CSRF configuration has changed from

    ```yaml
    settings:
      csrf: true
    ```

    to

    ```yaml
    settings:
      csrf:
        enabled: true
    ```

5. Replace `ctx.request.csrfToken()` with `getCsrfToken(ctx.session)` if you use sessions or `getCsrfToken()` if you use double submit cookie technique.

    *Before*
    ```typescript
    export class PageController {

      @Get('/home')
      home(ctx: Context) {
        return render(
          './templates/index.html',
          { csrfToken: ctx.request.csrfToken() }
          , __diname
        );
      }

    }
    ```

    *After*
    ```typescript
    import { getCsrfToken } from '@foal/csrf';

    @TokenRequired(/* ... */) // Only if you use sessions
    export class PageController {

      @Get('/home')
      home(ctx: Context) {
        return render(
          './templates/index.html',
          { csrfToken: getCsrfToken(ctx.session) }
          , __diname
        );
      }

    }
    ```

May Release: tag_name: v0.8.9
body: # Features

- [x] Prevent name conflicts with "foal g rest-api" (PR: #426)
- [x] Support server-side authentication with Auth0 & AWS Cognito (be able to retrieve RSA public key from JWKS endpoint) (issues: #320, #405) (PR: #430)
- [x] Add GraphQL components to create HTTP GraphQL servers (issue: #427) (PR: #126)
- [x] Fix invalid environment variable conversion in `Config` (issue: #437) (PR: #438).

# How to upgrade

```sh
npm install -g @foal/cli
npm update @foal/core # and other @foal/xxx if needed
```
April Release: tag_name: v0.8.8
body: # Features

- [x] Support OpenAPI & Swagger UI (issue: #276) (PR: #403)
- [x] Add the class `HttpResponseMovedPermanently` (PR: #403)
- [x] Fix case-sensitive headers in the `@Log` hook (issue: #409) (PR: #410)
- [x] Reduce the number of dependencies of the core package (19 indirect dependencies) (PR: #413)

# How to upgrade

```sh
npm install -g @foal/cli
npm update @foal/core # and other @foal/xxx if needed
```
March Release: tag_name: v0.8.7
body: # Features

- [x] Update to v0.8 the message displayed with 500 errors (issue: #387).
- [x] Have a CLI command to generate secrets (issue: #365) (PR: #392).
- [x] [@foal/cli] New projects will use source maps when displaying error traceback upon unit and e2e testing (issue: #385) (PR: #391).
- [x] Support stateless CSRF protection using *double submit cookie* technique (issue: #363) (PR: #396).
- [x] Be able to specify a virtual path prefix for static files (issue: #382) (PR: #393).
- [x] Provide a class `ConfigMock` to mock the `Config` when it used as a service (issue: #367) (PR: #394).
- [x] Add a `ValidateCookies` hook (issue: #375) (PR: #398).
- [x] Support **file uploads** and **downloads** (issues: #374, #298)

# How to upgrade

```sh
npm install -g @foal/cli
npm update # in your project
```

# Contributors

@swanncastel 
@LoicPoullain 
v0.8.6: tag_name: v0.8.6
body: # Features

- [x] New projects created with the CLI will now use TypeScript 3.3 or greater by default (issue: #377) (PR: #379).
- [x] Add 1300 lines of doc comment in the code (PR: #373).

# How to upgrade

```
npm install -g @foal/cli
npm update # in your project
```
v0.8.5: tag_name: v0.8.5
body: # Features

- [x] [@foal/cli] Set the default cookie path to `/` in `config/` (issue: #357) (PR: #358)
v0.8.1: tag_name: v0.8.1
body: Fixes v0.8.0.
[Config] v0.8.0 didn't look at the configuration files in the right order.
February Release: tag_name: v0.8.0
body: # Features

- [x] [@foal/mongoose] Add support for Mongoose (MongoDB) (issue: #277) (PR: #342).
- [x] [@foal/cli] Add CLI commands to quickly connect a Vue/React/Angular frontend to the backend (dev & prod) (issue: #279) (PR: #348).
- [x] Add a type to `Context.request` (issue: #318) (PR: #337).
- [x] Automatically parse cookies (issue: #333) (PR: #334).
- [x] Let the JWT hooks retrieve the token from a cookie (issue: #335) (PR: #336).
- [x] Let the developer generate a script from anywhere in the project (terminal) (issue: #340) (PR: #349).
- [x] Simplify the Config system and support YAML (issue: #338) (PR: #351).
- [x] Remove legacy deprecated components (PR: #353).

# How to migrate

```
npm install -g @foal/cli
npm install @foal/core@0.8 # and @foal/jwt@0.8, @foal/jwt@0.8, etc if relevant.
```

The new configuration system should be the only breaking change in the February release. Feel free to submit an issue if you are having trouble migrating.

- New versions of Foal uses by default the port 3001 to not conflict with a running React server. You can still keep the port 3000 if you want.

- Update all the `Config.get` calls in your code:
```typescript
// Before
Config.get('mongodb', 'uri');
Config.get('settings', 'staticUrl', 'public/') as string;

// After
Config.get('mongodb.uri');
Config.get<string>('settings.staticUrl', 'public/');
```

- Merge all your config files as follows:
```
Before:
- mongodb.e2e.json
- mongodb.development.json
- settings.development.json
- settings.json

After:
- e2e.json
- development.json
- default.json
```

```json
// ***********
// Before
// ***********
// mongodb.development.json
{
  "uri": "my_uri"
}
// settings.development.json
{
  "debug": true
}

// ***********
// After
// ***********
// development.json
{
  "mongodb": {
    "uri": "my_uri"
  },
  "settings": {
    "debug": false
  }
}
```

- If you're using the `@foal/jwt` package, replace the env variables `JWT_WHATEVER` with `SETTINGS_JWT_WHATEVER` and update your config files as follows:
```json
// incorrect
{
  "jwt": {
    "secret": "xxx"
  },
  "settings": {
    ...
  }
}

// correct
{
  "settings": {
    "jwt": {
      "secret": "xxx"
    },
    ...
  }
}
```
The `settings` section now encompasses all the configuration of the official Foal packages.

- If you customized the AJV instance (validation & sanitization), replace the env variables `AJV_WHATEVER` with `SETTINGS_AJV_WHATEVER` and update your config files as follows:
```json
// incorrect
{
  "ajv": {
    "coerceTypes": true
  },
  "settings": {
    ...
  }
}

// correct
{
  "settings": {
    "ajv": {
      "coerceTypes": true
    },
    ...
  }
}
```
The `settings` section now encompasses all the configuration of the official Foal packages.

- Divide the session keys into nested objects:
```json
// Before
{
  "sessionResave": false,
  "sessionSaveUninitialized": false,
  "sessionSecret": "my-secret",
  "sessionCookieHttpOnly": true,
  "sessionCookieMaxAge": 1000,
  "sessionCookieSameSite": "lax",
  "sessionCookieSecure": true,
  "sessionName": "id"
}

// After
{
  "settings": {
    "session": {
      "resave": false,
      "saveUninitialized": false,
      "secret": "my-secret",
      "cookie": {
        "httpOnly": true,
        "maxAge": 3600000,
        "sameSite": "lax",
        "secure": true
      },
      "name": "id"
    }
  }
}
```

Here's are examples of config files using the new system:
- [default.json](https://github.com/FoalTS/foal/blob/35c12c0249f6befa6f4c9bc22377fc53bf66a799/packages/cli/src/generate/specs/app/config/default.json) & [default.yml](https://github.com/FoalTS/foal/blob/35c12c0249f6befa6f4c9bc22377fc53bf66a799/packages/cli/src/generate/specs/app/config/default.yml)
- [development.json](https://github.com/FoalTS/foal/blob/35c12c0249f6befa6f4c9bc22377fc53bf66a799/packages/cli/src/generate/specs/app/config/development.mongodb.json) & [development.yml](https://github.com/FoalTS/foal/blob/35c12c0249f6befa6f4c9bc22377fc53bf66a799/packages/cli/src/generate/specs/app/config/development.mongodb.yml)
- [production.json](https://github.com/FoalTS/foal/blob/35c12c0249f6befa6f4c9bc22377fc53bf66a799/packages/cli/src/generate/specs/app/config/production.json) & [production.yml](https://github.com/FoalTS/foal/blob/35c12c0249f6befa6f4c9bc22377fc53bf66a799/packages/cli/src/generate/specs/app/config/production.yml)

You'll find more information [here](https://foalts.gitbook.io/docs/topic-guides/deployment-and-environments/configuration) on how the new configuration system works.
v0.7.7: tag_name: v0.7.7
body: # Features

- [x] [@foal/cli] Validate params in REST APIs (issue: #344) (PR: #345).
- [x] Let developers customize the AJV baseline configuration if they want to (issue: #343) (PR: #347).

# How to migrate

```
npm install -g @foal/cli
npm update # in your project
```
v0.7.6: tag_name: v0.7.6
body: # Features

- [x] (Bug) Fix type error in JWTOptional and JWTRequired (issue: #328) (#325) 
- [x] Validate project name as per npm conventions (issue: #313) (PR: #326)

# Contributors

@LoicPoullain 
@jamesgeorge007 
v0.7.5: tag_name: v0.7.5
body: - [x] [@foal/cli] Make the `createapp` command not fail when Git is not installed (issue: #319) (PR: #321).
v0.7.3: tag_name: v0.7.3
body: # Features

- [x] [@foal/cli] Validate arguments for `createapp` command (issue: #310) (PR: 309).
- [x] [@foal/cli] Validates random commands and shows up help if none supplied (issue: #308) (PR: #307).
- [x] [@foal/cli] Add `foal run` as alias of `foal run-script` (PR: #316).
- [x] [@foal/cli] Make new applications have an architecture example closest to SPA (PR: #315)
- [x] [@foal/cli] `foal createapp`: prettify the outputs and auto initialize git repo (issue: #314) (PR #317).

# Contributors

@jamesgeorge007
@LoicPoullain 
v0.7.2: tag_name: v0.7.2
body: # Features

- [x] Add the command `foal generate rest-api <name>` (PR: #303) (Issues: #278, #288)
- [x] Be able to customize the logger outputs (PR: #305)
v0.7.0: tag_name: v0.7.0
body: # How to migrate from v0.6

- Install the last version of the CLI: `npm install -g @foal/cli`.
- Update the dependencies in your package.json:
```json
{
   ...
  "dependencies": {
    "@foal/core": "~0.7.0",
    "@foal/ejs": "~0.7.0",
    "@foal/typeorm": "~0.7.0",
    ...
  }
}
```
- Replace `parsePassword` with `encryptPassword(password, { legacy: true })`
- Remove the hook `AuthenticateWithSessionAndCookie` (you might need to use the `LoginOptional` hook in some situations)
- Import `fetchUser` from `@foal/typeorm` and replace `@LoginRequired()` by `@LoginRequired({ user: fetchUser(User) )}`
- Rename `AbstractUser` to `UserWithPermissions` and import it from `@foal/typeorm`
- Import `EntityResourceCollection`, `EmailAuthenticator`, `emailSchema`, `middleware`, `Group`, `Permission` and `PermissionRequired` from `@foal/typeorm` instead of `@foal/core`.

# General Notes

The purpose of this release is to make the code of FoalTS less complex, more readable and modular and to add the support of recent technologies (JWT). It introduces some changes and improvements listed below.

## The `AuthenticationWithSessionAndCookie` and `LoginRequired` hooks have been merged

In previous versions of FoalTS, `AuthenticationWithSessionAndCookie` and `LoginRequired` were both required to authenticate and restrict access to authenticated users. They have been merged into one hook `LoginRequired` for simplicity (and consistency with the `JWTRequired` hook presented below). A new hook `LoginOptional` has also been added in this version.

*Old code:*
```typescript
import { AuthenticationWithSessionAndCookie, LoginRequired, Get } from '@foal/core';
...

@AuthenticationWithSessionAndCookie(User)
export class AppController {

  @Get('/')
  index(ctx) {
    const name = ctx.user ? ctx.user.name : 'you';
    return new HttpResponseOK(`Hello ${name}!`);
  }

  @Get('/home')
  @LoginRequired({ redirect: '/' })
  home(ctx) {
    return new HttpResponseOK(`Hello ${ctx.user.name}!`);
  }

}
```

*New code:*
```typescript
import { LoginOptional, LoginRequired, Get } from '@foal/core';
import { fetchUser } from '@foal/typeorm';
...

export class AppController {

  @Get('/')
  @LoginOptional({ user: fetchUser(User) })
  index(ctx) {
    const name = ctx.user ? ctx.user.name : 'you';
    return new HttpResponseOK(`Hello ${name}!`);
  }

  @Get('/home')
  @LoginRequired({ redirect: '/', user: fetchUser(User) })
  home(ctx) {
    return new HttpResponseOK(`Hello ${ctx.user.name}!`);
  }

}
```

## Support of JWT with `JWTRequired` and `JWTOptional`

This release adds the support of JWT for authentication. The two new hooks `JWTRequired` and `JWTOptional` are similar to `LoginRequired` and `LoginOptional`.

*Example:*
```typescript
import { Get, isInFile } from '@foal/core';
import { JWTRequired } from '@foal/jwt';
import { fetchUser } from '@foal/typeorm';

export class AppController {
  @Get('/home')
  @JWTRequired()
  home(ctx) {
    return new HttpResponseOK(`Hello ${ctx.user.name}!`);
  }
}

export class AppController2 {
  @Get('/home')
  // With some options
  @JWTRequired({ user: fetchUser(User), blackList: isInFile('./blacklist') }, { audience: 'foobar' })
  home(ctx) {
    return new HttpResponseOK(`Hello ${ctx.user.name}!`);
  }
}
```

## Password Management with `encryptPassword` and `verifyPassword`

You can now manage password encryption directly with the `encryptPassword` and `verifyPassword` functions.

*Note:* The `parsePassword(password)` util has been removed. Use its equivalent with `encryptPassword`: `encryptPassword(password, { legacy: true })`.

## The controller routes are now registered after the sub-controllers routes

In the previous versions of FoalTS, the sub-controllers' routes were registered after the controller routes. Then it was hard to display a custom 404 page when a route did not exist. In the example below, requesting `/home` was returning a `404` instead of `200 - 'You are on the home page!'`

```typescript
export class ViewController {
  @Get('/')
  index() {
    return new HttpResponseOK('Hello world');
  }

  @Get('/home')
  home() {
    return new HttpResponseOK('You are on the home page!');
  }
}

export class AppController {
  subControllers = [ ViewController ];

  @Get('*')
  notFound() {
    return new HttpResponseNotFound('The page your are looking for does not exist');
  }
}
```

This is now changed and this example returns a success on `GET /home`.

## TypeORM-dependent components moved in a separate package `@foal/typeorm`

All TypeORM-dependent components have been moved to a separate package `@foal/typeorm`. 

These components are:
- `EmailUser` and `EmailAuthenticator` (deprecated)
- `emailSchema` (deprecated)
- `Middleware`, `RelationLoader`, `middleware`, `EntityResourceCollection` (deprecated)
- `Group`, `Permission`, `UserWithPermissions` 
- `PermissionRequired`
- `fetchUserWithPermissions`, `fetchUser`

This way developers can use another ORM/ODM if they want (Mongoose, Sequelize, etc)

##  The `User` class and the `UserWithPermissions` entity (previously named `AbstractUser`)

The abstract class `AbstractUser` has been renamed into `UserWithPermissions`.

Because not all applications require permissions and groups, and a different ORM can be used instead of TypeORM, the `User` class no longer needs to extend the class `UserWithPermissions`.

The type of `Context['user']` is now `any`. You can force this type with a generic parameter: `Context<User>`.

## The deprecated components

Due to their unnecessary complexity, some components have been deprecated and will be removed in further versions:
- `IAuthenticator`
- `Strategy`, `strategy`, `LoginController`
- `IResourceCollection`, `CollectionParams`
- `RestController`
- `EmailUser` and `EmailAuthenticator`
- `emailSchema`
- `Middleware`, `RelationLoader`, `middleware`, `EntityResourceCollection`

Here are some alternatives that you might consider:
- `encryptPassword` and `verifyPassword`
- `foal generate rest-api <name>` (coming in a next release in January 2019)

# Features

- [x] Fix the error `ctx.request.csrfToken is not a function` when the CSRF protection is disabled (issue: #283) (PR: #284).
- [x] Add support for JWT (issue: #254) (PR: #272).
- [x] Merge `AuthenticationWithSessionAndCookie` and `LoginRequired` into `LoginRequired` and `LoginOptional`(issue: #286) (PR: #287)
- [x] Provide two util functions `encryptPassword` and `verifyPassword` to manage password encryption(issue: https://github.com/FoalTS/foal/issues/288) (PR: #300).
- [x] Register the controller routes *after* its sub-controllers (issue #289) (PR: #292).
- [x] Move `EmailAuthenticator`, `EmailSchema`, `LoginController`, `PermissionRequired`, `AbstractUser`, `Group`, `Permission`, `fetchUser`, `fetchUserWithPermissions`, `EntityResourceCollection` to the new package `@foal/typeorm` (issue: #290) (PR: #293 ).
- [x] Rename `AbstractUser` to `UserWithPermissions` and simplify the definition of `Context` (issue: https://github.com/FoalTS/foal/issues/291) (PR: #293)
- [x] Mark as deprecated `EmailUser`, `EmailAuthenticator`, `emailSchema`, `Middleware`, `RelationLoader`, `middleware`, `EntityResourceCollection`, `IAuthenticator`, `Strategy`, `strategy`, `LoginController`, `IResourceCollection`, `CollectionParams` and `RestController` (issue: #288) (PR: #293, #295).
- [x] [Docs] Add API reference for each package.
- [x] Ignore WebStorm and VSCode config directories in Git (https://github.com/FoalTS/foal/pull/297).
- [x] Change the output directory name (lib/ -> build/) (issue: #296) (PR: #301)

# Contributors

@LoicPoullain 
@rustamwin
v0.6.2: tag_name: v0.6.2
body: - [x] Improve the logo and the welcoming page generated by `foal createapp` (https://github.com/FoalTS/foal/pull/270).
- [x] [@foal/cli] Auto install dependencies upon project creation (https://github.com/FoalTS/foal/pull/269).
v0.6.1: tag_name: v0.6.1
body: # Features

- [x] [@foal/cli] Fix a typo in the generated controller spec (issue: https://github.com/FoalTS/foal/issues/239) (PR: https://github.com/FoalTS/foal/pull/267)
v0.6.0: tag_name: v0.6.0
body: # Features

- [x] Let hooks execute functions after the method execution (https://github.com/FoalTS/foal/pull/253).
- [x] Let createApp accept a custom express instance as base (https://github.com/FoalTS/foal/pull/264).
- [x] Support the missing HTTP methods `HEAD` and `OPTIONS` (https://github.com/FoalTS/foal/pull/262).
- [x] [Internal] Make the CLI unit tests work on Windows (issue: https://github.com/FoalTS/foal/issues/207) (https://github.com/FoalTS/foal/pull/260, https://github.com/FoalTS/foal/pull/261).
- [x] Rename the hook `Authenticate` to `AuthenticateWithSessionAndCookie` (https://github.com/FoalTS/foal/pull/263).

# Breaking changes

- The returned type of a hook function is now `void | HttpResponse | HookPostFunction | Promise <void | HttpResponse | HookPostFunction>` and not `any` anymore.
 This means that if you have a hook defined like `@Hook(ctx => ctx.state.foo = 2)`, you to have update its definition as follows: `@Hook(ctx => { ctx.state.foo = 2; })`
- The hook `Authenticate` is now named `AuthenticateWithSessionAndCookie`.

# Contributors

@LoicPoullain 
@Jrfidellis 
v0.6.0-beta.6: tag_name: v0.6.0-beta.6
body: # Features

- [x] Use `getAjvInstance` in `LoginController`.
- [x] [@foal/cli] Generate vscode config files for fast debugging (https://github.com/FoalTS/foal/pull/244).
- [x] Let the `Log` hook print information about the HTTP request (https://github.com/FoalTS/foal/pull/246) (breaking change).
- [x] Add the `logIn` and `logOut` utilities (https://github.com/FoalTS/foal/pull/247).
- [x] [@foal/cli] Prettify the CLI outputs with colors (https://github.com/FoalTS/foal/pull/249).
- [x] [@foal/cli] Register the controllers with their kebab names (https://github.com/FoalTS/foal/pull/250).
- [x] Make `HttpResponse` support headers and cookies (https://github.com/FoalTS/foal/pull/251).

# Breaking changes
- The property `headers` of `HttpResponse` is now private. You need to use the `setHeader`, `getHeader` and `getHeaders` methods instead.
- The optional parameter of the `Log` Hook is not the log function anymore but an `options` object. 
  ```typescript
  @Log('hello', console.error) // before
  @Log('hello', { logFn: console.error }) // after
v0.6.0-beta.5: tag_name: v0.6.0-beta.5
body: # General Note

This release introduces numerous breaking changes. They are the fruit of several feedbacks and should be the last breaking changes of this version. `v0.6.0` will come out soon!

# Features

- [x] Make the tests run with NODE_ENV=test on both Unix and Windows systems (issue: https://github.com/FoalTS/foal/issues/187) (PR: https://github.com/FoalTS/foal/pull/219).
- [x] Improve the 'Successfully Installed' page (https://github.com/FoalTS/foal/pull/215).
- [x] Add the utility `isCommon` to test if a password is too common (issue: https://github.com/FoalTS/foal/issues/111) (https://github.com/FoalTS/foal/pull/229).
- [x] Reduce the size of the FoalTS packages (https://github.com/FoalTS/foal/pull/232).
- [x] [@foal/cli] Add e2e tests to the generated apps and improve builds (issue: https://github.com/FoalTS/foal/issues/138) (https://github.com/FoalTS/foal/pull/233).
- [x] Set `strictPropertyInitialization` to `false` in `tsconfig.json` and remove the `ts-ignore`s (https://github.com/FoalTS/foal/pull/234).
- [x] Simplify shell scripts (https://github.com/FoalTS/foal/pull/235).
- [x] Make ajv global instance coerce types, remove additional properties if required and use default values (https://github.com/FoalTS/foal/pull/236).
- [x] Add `ValidateParams` and `ValidateHeaders`(https://github.com/FoalTS/foal/pull/236).
- [x] Simplify dependency injection mechanism (https://github.com/FoalTS/foal/pull/237).
- [x] Remove modules and let controllers have sub-controllers (https://github.com/FoalTS/foal/pull/238). 

# Contributors

@LoicPoullain
@Jrfidellis 

# How to migrate

## Update you dependencies

- Update your local dependencies: `npm update`.
- Update globally `@foal/cli`: `npm -g update @foal/cli`.

## Bug https://github.com/FoalTS/foal/issues/187

Create a new file `src/test.ts` with the content `process.env.NODE_ENV = 'test';`. Then in your `package.json` make the commands `start:test` and `start:test:w` start with `mocha --file \"./lib/test.js\"`.

## Support e2e tests and improve builds

- Create the directory `src/e2e`.
- Install `supertest`: `npm install --save-dev supertest`.
- Create or replace these files:
  - [src/app/tsconfig.app.json](https://github.com/FoalTS/foal/blob/fd037498bde5798452a46f87b22ad4c456af64b1/packages/cli/src/generate/specs/app/tsconfig.app.json)
  - [src/app/tsconfig.e2e.json](https://github.com/FoalTS/foal/blob/fd037498bde5798452a46f87b22ad4c456af64b1/packages/cli/src/generate/specs/app/tsconfig.e2e.json)
  - [src/app/tsconfig.json](https://github.com/FoalTS/foal/blob/fd037498bde5798452a46f87b22ad4c456af64b1/packages/cli/src/generate/specs/app/tsconfig.json)
  - [src/app/tsconfig.migrations.json](https://github.com/FoalTS/foal/blob/fd037498bde5798452a46f87b22ad4c456af64b1/packages/cli/src/generate/specs/app/tsconfig.migrations.json)
  - [src/app/tsconfig.scripts.json](https://github.com/FoalTS/foal/blob/fd037498bde5798452a46f87b22ad4c456af64b1/packages/cli/src/generate/specs/app/tsconfig.scripts.json)
  - [src/app/tsconfig.test.json](https://github.com/FoalTS/foal/blob/fd037498bde5798452a46f87b22ad4c456af64b1/packages/cli/src/generate/specs/app/tsconfig.test.json)
- Change the commands in your `package.json` by these ones: https://github.com/FoalTS/foal/blob/fd037498bde5798452a46f87b22ad4c456af64b1/packages/cli/src/generate/specs/app/package.json
- Create a file named `e2e.ts` in `src/` with this content: `process.env.NODE_ENV = 'e2e'`

## Simplify shell scripts

Update your scripts following this pattern:
```typescript
const argSchema = {
  /* ... */
};

export function main(argv) {
  const args = getCommandLineArguments(argv);	
  try {	
    validate(argSchema, args);	
  } catch (error) {	
    if (error instanceof ValidationError) {	
      error.content.forEach(err => {	
        console.log(`The command line arguments ${err.message}`);	
      });	
      return;	
    }	
    throw error;	
  }	
  /* ... */
}

// Replace this with:

export const schema = {
  /* ... */
};

export function main(args) {
  /* ... */
}
```

## `ValidateQuery` & `ValidateBody`

The hooks `ValidateQuery` and `ValidateBody` now use under the hood this configuration of Ajv:

```js
{
  coerceTypes: true,  // change data type of data to match type keyword
  removeAdditional: true, // remove additional properties
  useDefaults: true, // replace missing properties and items with the values from corresponding default keyword
}
```

## Dependency Injection

- Remove all the occurrences of the decorators `Module`, `Controller` and `Service`.
- Follow this pattern in your controllers and services:
```typescript
@Controller()
export class MyController {
  constructor(private myService1: MyService1, public myService2: MyService2) {}
}
// becomes:
export class MyController {
  @dependency
  private myService1: MyService1;

  @dependency
  myService2: MyService2;
}
```
- Change your `RestController`s following this pattern:
```typescript
export class MyController extends RestController {
  collectionClass = MyCollectionClass;
}
// becomes:
export class MyController extends RestController {
  @dependency
  collection: MyCollectionClass;
}
```
- If you need to instantiate controllers or services in your tests, use `createService` or `createController`.

## Modules -> Controllers and SubControllers

- Rename all your files `**.module.ts` into `**.controller.ts`
- Change the content of your module files following this pattern:
```typescript
export AppModule implements IModule {
  controllers = [
    controller('/foo', Controller1)
  ];

  subModules = [
     subModule('/api', ApiModule)
  ];
}
// Replace this with:
export AppController {
  subControllers = [
    controller('/foo', Controller1),
    controller('/api', ApiController)
  ];
}
```
- Rename the directories `sub-modules` to `sub-apps`.
- In `src/index.ts`, import `AppController` instead of `AppModule` as it no longer exists.
v0.6.0-beta.4: tag_name: v0.6.0-beta.4
body: # Features
- [x] Change framework description.
- [x] [Internal] Use both male and female names in tests (https://github.com/FoalTS/foal/pull/194).
- [x] Add validate util and add it by default when generating an `EntityResourceCollection` (https://github.com/FoalTS/foal/pull/196).
- [x] Add getCommandLineArguments util and `create-user`, `create-group` and `create-perm` scripts (issue: https://github.com/FoalTS/foal/issues/162) (PR: https://github.com/FoalTS/foal/pull/197).
- [x] [Internal] Add e2e tests in Travis (https://github.com/FoalTS/foal/pull/198).
- [x] Add a script generator (https://github.com/FoalTS/foal/pull/199).
- [x] Automatically register controllers upon creation (https://github.com/FoalTS/foal/pull/200).
- [x] Update session default configuration following OWASP recommandations (https://github.com/FoalTS/foal/pull/201).
- [x] Add the `foal run-script` feature (https://github.com/FoalTS/foal/pull/202).
- [x] Correct typeorm scripts (issue: https://github.com/FoalTS/foal/issues/204) (https://github.com/FoalTS/foal/pull/206).

# How to migrate

## Update you dependencies

Update your local dependencies: `npm update`.
Update globally `@foal/cli`: `npm -g update @foal/cli`.

## Database migrations

The entity `Group` now has a `codeName`.
- If you have `synchronize` set to `true` in your `ormconfig.json` then the database schema will automatically be updated.
- Otherwise run the following commands to update the db schema:
```sh
npm run build
npm run migration:generate -- -n add-codename-to-group
npm run build
npm run migration:run
```

## Shell scripts

Remove `src/scripts/create-users.ts` and add the following scripts:
- [create-user](https://github.com/FoalTS/foal/blob/0-6-0-beta-4/packages/cli/src/generate/specs/app/src/scripts/create-user.ts)
- [create-perm](https://github.com/FoalTS/foal/blob/0-6-0-beta-4/packages/cli/src/generate/specs/app/src/scripts/create-perm.ts)
- [create-group](https://github.com/FoalTS/foal/blob/0-6-0-beta-4/packages/cli/src/generate/specs/app/src/scripts/create-group.ts)

## Session configuration

Remove the line `"sessionCookieDomain": "localhost"` in `config/settings.production.json`.
v0.6.0-beta.3: tag_name: v0.6.0-beta.3
body: # Features
- [x] Do not build test when running npm run build (https://github.com/FoalTS/foal/pull/182).
- [x] Remove all the outdated test.ts which are not required anymore in v0.6.0-beta.2 (https://github.com/FoalTS/foal/pull/182).
- [x] Make `render` use template paths (https://github.com/FoalTS/foal/pull/184).
- [x] Move migrations to `src/migrations` (issue: https://github.com/FoalTS/foal/issues/175) (https://github.com/FoalTS/foal/issues/185).
- [x] Add the exports to the `index.ts` when creating a file (https://github.com/FoalTS/foal/pull/186).
- [x] [@foal/cli] [Internal] Refactor @foal/cli (https://github.com/FoalTS/foal/pull/188). 

# How to migrate

Update your dependencies by running `npm update`.

## The `render` util

```typescript
// Before
import { readFileSync } from 'fs';
import { join } from 'path';

const login = readFileSync(join(__dirname, './templates/login.html'), 'utf8');
render(login, { csrfToken: ctx.request.csrfToken() });

// After
render('./templates/login.html', { csrfToken: ctx.request.csrfToken() }, __dirname);
```

## The migrations
- Move you root `migrations` directory (if it exists) to `src`.
- Update your `tslint.json` and `ormconfig.json` with:
```json
{
   ...
   "linterOptions": {
      "exclude": "src/migrations/*.ts"
   }
}
```

```json
{
   ...
   "migrations": ["lib/migrations/*.js"],
   "cli": {
      "migrationsDir": "src/migrations"
   },
}
```
v0.6.0-beta.2: tag_name: v0.6.0-beta.2
body: - [x] Make the `copy` command work on Windows (hot fix).
v0.6.0-beta.1: tag_name: v0.6.0-beta.1
body: # Features
- Do not have to manually register each entity (issue https://github.com/FoalTS/foal/issues/174).
- Improve installation speed (from 28/31/34 s to 12/14/14 s) (issue https://github.com/FoalTS/foal/issues/174).
- Reduce the number of dependencies (mainly for security reasons) (total dependencies for `@foal/cli`: 901 -> 34) (issue https://github.com/FoalTS/foal/issues/174).
- Set the stage to have a REPL shell (issue https://github.com/FoalTS/foal/issues/137).
- Set the stage to create users, groups and permissions easily through a command line (issue https://github.com/FoalTS/foal/issues/162).
- Be able to use the database in the constructor of a service or more widely before a request is received.
- Fix this issue: if the first requests are made simultaneously then some of them may not have the connection established to the database.
- Improve the test experience: the client should be able to run its tests without registering them into a `test.ts` file (issue https://github.com/FoalTS/foal/issues/174).
- Set the stage to improve "smooth" debugging in vscode (issue https://github.com/FoalTS/foal/issues/174).
- Improve "hard" (by hand) debugging (issue https://github.com/FoalTS/foal/issues/174).
- Support multiple database connections
- [Internal] Remove build complexity (issue https://github.com/FoalTS/foal/issues/174).

# Steps

- [x] Remove `InitDB` and add a `createConnection` in the main `index.ts` file instead.
- [x] Update the build, run and test commands to use `copy` and to get rid of `webpack`.
- [x] Update `tsconfig.json` and `ormconfig.json` to use the correct paths.
- [x] Move the `scripts/` directory into `src`.
- [x] Replace all the `require('**/*.html')` by `fs` reads.

# How to migrate

- Delete your `lib/` directory.
- Update your dependencies by running `npm update`.
- The hook `InitDB` does not longer exist and you don't need to register your entities anymore. Remove the hook from your code and replace the content of `src/index.ts` by this:
```typescript
// The imports ...
async function main() {
  await createConnection();

  const app = createApp(AppModule, {
    store: session => new (sqliteStoreFactory(session))({ db: 'db.sqlite3' })
  });

  const httpServer = http.createServer(app);
  const port = Config.get('settings', 'port', 3000);
  httpServer.listen(port, () => {
    console.log(`Listening on port ${port}...`);
  });
}

main();
```
- Change the commands of your `package.json` by this:
```json
{
    "build": "tsc && copy-cli \"src/**/*.html\" lib",
    "build:w": "tsc -w",
    "start": "node ./lib/index.js",
    "start:w": "supervisor -w ./lib --no-restart-on error ./lib/index.js",
    "develop": "npm run build && concurrently \"npm run build:w\" \"npm run start:w\"",

    "build:test": "tsc && copy-cli \"src/**/*.html\" lib",
    "build:test:w": "tsc -w",
    "start:test": "mocha \"./lib/**/*.spec.js\"",
    "start:test:w": "mocha -w \"./lib/**/*.spec.js\"",
    "test": "npm run build:test && concurrently \"npm run build:test:w\" \"npm run start:test:w\"",

    "lint": "tslint -c tslint.json -p tsconfig.json",
    "migration:generate": "ts-node ./node_modules/.bin/typeorm migration:generate",
    "migration:run": "ts-node ./node_modules/.bin/typeorm migration:run",
    "migration:revert": "ts-node ./node_modules/.bin/typeorm migration:revert"
}
```
- Update the following properties in your `tsconfig.json` and `ormconfig.json`:
```json
// tsconfig
"outDir": "lib" 
//ormconfig
 "entities": ["lib/app/**/*.entity.js"],
```
- Move your `scripts/` directory to `src`.
- Replace all your `require('./foobar.html')` to `fs.readFileSync(path.join(__dirname, './foobar.html'), 'utf8')`.
v0.6.0-beta.0: tag_name: v0.6.0-beta.0
body: **Goal: Create complex REST API.**
- [x] Rename `ISerializer` to `IResourceCollection` and `EntitySerializer` to `EntityResourceCollection`(https://github.com/FoalTS/foal/pull/170).
- [x] Change `IResourceCollection` interface (https://github.com/FoalTS/foal/pull/172).
- [x] [@foal/cli] Make `User` entity and `scripts/create-users` consistent (https://github.com/FoalTS/foal/pull/176).
- [x] [REST] Support postgres and sqlite (https://github.com/FoalTS/foal/pull/173).
- [x] [REST] Support `PermissionDenied` and `ValidationError` in `EntityCollection`s (https://github.com/FoalTS/foal/pull/173).
- [x] [REST] Add `allowedOperations`, `loadedRelations` and ` middlewares `in `EntityResourceCollection` (https://github.com/FoalTS/foal/pull/173).
- [x] [REST] Use `params.fields` in `EntityResourceCollection` to restrict the returned representations (https://github.com/FoalTS/foal/pull/173).
- [x] [REST] Let the client create several resources within one request (https://github.com/FoalTS/foal/pull/173).
v0.6.0-alpha.4: tag_name: v0.6.0-alpha.4
body: **Goal: having an authentication and authorization system that work.**
- [x] Infer response type from `isHttpResponseXXX`(https://github.com/FoalTS/foal/pull/160).
- [x] [@foal/cli] Add `Authenticate` hook in generated apps (https://github.com/FoalTS/foal/pull/164).
- [x] Add url-encoded parsing and add more tests (https://github.com/FoalTS/foal/pull/165).
- [x] Add the `createController` util (https://github.com/FoalTS/foal/pull/166).
- [x] Fix the `LoginController` bug `"get" of undefined` (https://github.com/FoalTS/foal/pull/166).
- [x] [@foal/cli] Generate controller specs (empty controllers) (https://github.com/FoalTS/foal/pull/166).
- [x] Support custom session store (https://github.com/FoalTS/foal/pull/167).
- [x] [@foal/cli] Generated apps now use by default an sqlite3 session store to not loose the user authentication when reloading the server (https://github.com/FoalTS/foal/pull/167).
- [x] Add e2e tests for authentication and authorization (https://github.com/FoalTS/foal/pull/168).
- [x] Add redirect URL to `PermissionRequired`.
v0.6.0-alpha.3: tag_name: v0.6.0-alpha.3
body: - [x] [@foal/cli] Remove `chai` from created apps. (https://github.com/FoalTS/foal/pull/155).
- [x] [@foal/cli] Give a default User path in generated authenticator files.
- [x] [@foal/cli] Generate `Login` controllers (https://github.com/FoalTS/foal/pull/157).
- [x] Add redirect option in `LoginRequired`.
- [x] [@foal/cli] Add `HookDecorator` to hook template.
- [x] Add `ValidateQuery` hook (https://github.com/FoalTS/foal/pull/158).
- [x] Remove `bootstrap` from `@foal/cli` (https://github.com/FoalTS/foal/pull/159).
v0.6.0-alpha.2: tag_name: v0.6.0-alpha.2
body: - [x] `parsePassword` now expects a string instead of an object (https://github.com/FoalTS/foal/pull/145).
- [x] Add `src/app/sub-modules` and `sub-modules/` paths to `foal g module` (https://github.com/FoalTS/foal/pull/147).
- [x] Export all entities in sub-modules (https://github.com/FoalTS/foal/pull/147).
- [x] Remove restrictBodyAndQueryToAuthenticated as it is now useless (https://github.com/FoalTS/foal/pull/148).
- [x] Do not modify/set the value of `process.env.NODE_ENV` (https://github.com/FoalTS/foal/pull/149).
- [x] Make the app return 403 'Bad csrf token' when the csrf token is incorrect or missing (bug) (https://github.com/FoalTS/foal/pull/150).
- [x] By default auto create database schema on every application launch (https://github.com/FoalTS/foal/pull/151).
- [x] Fix commands `npm run migration:generate` and `npm run migration:run` (https://github.com/FoalTS/foal/pull/152).
v0.6.0-alpha.1: tag_name: v0.6.0-alpha.1
body: - [x] Remove `route` controller factory.
- [x] Remove `methodNotAllowed` pre-hook.
- [x] Remove `onSuccessKeepFields` (https://github.com/FoalTS/foal/pull/134).
- [x] Add the csrf token in a meta tag in `index.html` (https://github.com/FoalTS/foal/pull/135).
- [x] Remove yeoman generators and move all the generations into the cli package (https://github.com/FoalTS/foal/pull/135).
- [x] Rename `restrictAccessToAuthenticated` to `LoginRequired` (https://github.com/FoalTS/foal/pull/139).
- [x] Support graphql loading.
- [x] Remove Abstract prefix from EmailAuthenticator.
- [x] Move validate to @foal/core and remove @foal/ajv package.

- [x] Remove `combinePostHooks` and `combinePreHooks` (https://github.com/FoalTS/foal/pull/140).
- [x] Remove handlers and convert controllers to classes (with http method decorators and DI) (https://github.com/FoalTS/foal/pull/140).
- [x] Convert pre and post hooks in Hook decorators (https://github.com/FoalTS/foal/pull/140).
- [x] Make standard start by a capital letter (https://github.com/FoalTS/foal/pull/140).
- [x] Convert modules to classes implementing `IModule` (https://github.com/FoalTS/foal/pull/140).
- [x] Reorganize `@foal/core` code structure (internal) (https://github.com/FoalTS/foal/pull/140).
- [x] Split test command into several commands (internal) (https://github.com/FoalTS/foal/pull/140).
- [x] Simplify `ctx` by using the express `request` object (https://github.com/FoalTS/foal/pull/140).
- [x] Remove `PostContext` (https://github.com/FoalTS/foal/pull/140).
- [x] Remove body-parser dep (https://github.com/FoalTS/foal/pull/140).
- [x] Support that hook functions may return other values that `HttpResponse` (https://github.com/FoalTS/foal/pull/140).
- [x] Remove `afterThatLog` post-hook (https://github.com/FoalTS/foal/pull/140).
- [x] Rename models to entities (consistency with typeorm) (https://github.com/FoalTS/foal/pull/140).
- [x] Rename `IModelService` and `ModelService` to `ISerializer` and `EntitySerializer` (https://github.com/FoalTS/foal/pull/140).
- [x] Add `Permission` and `Group` entities (https://github.com/FoalTS/foal/pull/140).
- [x] Add `getPath`, `getHookFunction` and `getHttpMethod` utils (https://github.com/FoalTS/foal/pull/140).
- [x] Allow to inject the ServiceManager inside a service or controller.
- [x] Simplify authentication (controller mostly) (https://github.com/FoalTS/foal/pull/140).
- [x] Add `PermissionRequired` and remove `restrictAccessToAdmin` (https://github.com/FoalTS/foal/pull/140).
- [x] Add "remove additionalProperties" feature (https://github.com/FoalTS/foal/pull/140).
- [x] Move `templates/` to `controllers/` dir (https://github.com/FoalTS/foal/pull/140).
- [x] Remove csrfToken from state (https://github.com/FoalTS/foal/pull/140).
- [x] [@foal/cli] Do not restart the server on error (https://github.com/FoalTS/foal/pull/140).
- [x] [@foal/cli] Add smart detection folder with `foal generate` (https://github.com/FoalTS/foal/pull/140).
- [x] Rename Validate to ValidateBody.
- [x] Add test coverage on `@foal/core`.
v0.5.0-alpha.4: tag_name: v0.5.0-alpha.4
body: Fix typo.
v0.5.0-alpha.2: tag_name: v0.5.0-alpha.2
body: - [x] `@foal/cli`: Prevent image loading when requiring html templates.
v0.5.0-alpha.1.0: tag_name: v0.5.0-alpha.1.0
v0.4.0-beta.4: tag_name: v0.4.0-beta.4
body: - [x] Rename `validateEmailCredentialsFormat` to `validateEmailAndPasswordCredentialsFormat`. (https://github.com/FoalTS/foal/pull/101).
v0.4.0-beta.3: tag_name: v0.4.0-beta.3
body: - [x] Remove `ObjectType`.
- [x] Add Microsoft SQL Server support (https://github.com/FoalTS/foal/pull/92).
- [x] Add validateLocalCredentialsFormat (https://github.com/FoalTS/foal/pull/93).
- [x] Rename LocalAuthenticator to EmailAndPasswordAuthenticator (https://github.com/FoalTS/foal/pull/94, https://github.com/FoalTS/foal/pull/97).
- [x] Convert ServiceControllerFactory to an interface (https://github.com/FoalTS/foal/pull/96).
- [x] Make authentication simpler and add a `UserModelService` (https://github.com/FoalTS/foal/pull/97).
v0.4.0-beta.2: tag_name: v0.4.0-beta.2
body: - [x] [rest] Fix POST / bug and add more tests (https://github.com/FoalTS/foal/pull/88).
- [x] Support SQLite (https://github.com/FoalTS/foal/pull/87).
v0.4.0-beta.1: tag_name: v0.4.0-beta.1
body: To fix `instanceof` issues across several npm packages:
- [x] Introduce `isObjectDoesNotExist`.
- [x] Introduce all the `isHttpResponse`s.
v0.4.0-beta.0: tag_name: v0.4.0-beta.0
body: - [x] Return 404 in @foal/express when a path is not found.
- [x] Support several templates in one ejs service (https://github.com/FoalTS/foal/issues/82).
- [x] Add `stateDef` to `getCallback` (now `getMiddlewares`) (https://github.com/FoalTS/foal/issues/80)
- [x] Fix sequelize warning (https://github.com/FoalTS/foal/issues/71).
- [x] Improve docs.
- [x] Improve unit testing.

## Breaking changes
- [x] **Redefine entire architecture** (especially hooks and controllers) (https://github.com/FoalTS/foal/issues/84).
- [x] Add authentication and convert CRUD services to model services (https://github.com/FoalTS/foal/issues/83).
v0.4.0-alpha.3: tag_name: v0.4.0-alpha.3
body: - [x] Add handle-errors in `@foal/express` (https://github.com/FoalTS/foal/pull/53).
- [x] Add `escape` and `escapeHTML` utils (https://github.com/FoalTS/foal/pull/60).
- [x] Add `@foal/ajv` for schema validation (https://github.com/FoalTS/foal/pull/59).
- [x] Add `details` to `HttpError` and use them in `handleErrors` (https://github.com/FoalTS/foal/pull/59).
- [x] Allow `null` value for `Route.serviceMethodName` in controller factories (https://github.com/FoalTS/foal/pull/61).
- [x] Add more unit tests (https://github.com/FoalTS/foal/pull/64, https://github.com/FoalTS/foal/pull/62)
- [x] In `rest` PATCH, DELETE, PUT / and POST /:id throw now an `MethodNotAllowedError` (https://github.com/FoalTS/foal/pull/62)
- [x] `@foal/sequelize` is now supported by MySQL (https://github.com/FoalTS/foal/pull/65).

## Small breaking changes

- [x] Rename `Middleware` to `ReducedMiddleware`. (https://github.com/FoalTS/foal/pull/56)
- [x] Rename `PreMiddleware` and `PostMiddleware` to a same type `Middleware`. (https://github.com/FoalTS/foal/pull/56)
- [x] Rename `serviceMethodBinder` to `middleware`. (https://github.com/FoalTS/foal/pull/56)
- [x] Rename `LowLevelRoute` to `ReducedRoute` (consistency with `ReducedMiddleware`). (https://github.com/FoalTS/foal/pull/56)
v0.4.0-alpha.2: tag_name: v0.4.0-alpha.2
body: - [x] Add `getPreMiddleware` and `getPostMiddleware` utils in `@foal/core` (https://github.com/FoalTS/foal/pull/41).
- [x] Add more docs (https://github.com/FoalTS/foal/pull/43).
- [x] Add more tests (https://github.com/FoalTS/foal/pull/43).
- [x] Add new pre-hook `afterThatRemoveField(name: string)` (https://github.com/FoalTS/foal/pull/43).
- [x] Add `createEmptyContext` util in `@foal/core` (https://github.com/FoalTS/foal/pull/47).
- [x] Make service declaration optional in modules (https://github.com/FoalTS/foal/pull/48).
v0.4.0-alpha.0: tag_name: v0.4.0-alpha.0
body: **Note**: v0.3.0 was a POC and was not ready for prod. That's why breaking changes are permitted here.

- [x] Add useful access control hooks in a new package: `@foal/common` (https://github.com/FoalTS/foal/pull/22).
- [x] Add authentication and authorization example in `@foal/examples` (https://github.com/FoalTS/foal/pull/22)
- [x] Add `post-hooks` (https://github.com/FoalTS/foal/pull/30)
- [x] Introduce `view` controller binder with `ViewService` (https://github.com/FoalTS/foal/pull/34)
- [x] Add `@foal/ejs` to render ejs templates (https://github.com/FoalTS/foal/pull/34)
- [x] Having a PR in https://github.com/FoalTS/generator-foal to support v4 (https://github.com/FoalTS/generator-foal/pull/17)
- [x] Remove the `in progress` and replace them with `alpha version`

### Breaking changes
- [x] Convert `SequelizeService` to a generic class (https://github.com/FoalTS/foal/pull/15).
- [x] Redefine contexts (https://github.com/FoalTS/foal/pull/19, https://github.com/FoalTS/foal/pull/22).
- [x] Rename `Injector` to `ServiceManager` with some of its attributes (https://github.com/FoalTS/foal/pull/27).
- [x] Rename `module.preHooks` to `module.hooks` (https://github.com/FoalTS/foal/pull/30).
- [x] FoalTS requires node version >= 8 (https://github.com/FoalTS/foal/pull/35)
- [x] Rename `update` and `patch` to `replace` and `modify` (https://github.com/FoalTS/foal/pull/37).
- [x] Controllers are not any more a sub-category of services(https://github.com/FoalTS/foal/pull/37).
- [x] The `controller binders` become the `controllers`(https://github.com/FoalTS/foal/pull/37).
- [x] `RestController` is replaced by `PartialCRUDService`, `CRUDService`, `CreateService`, `ReadService`, `UpdateService`, `DeleteService`(https://github.com/FoalTS/foal/pull/37).
- [x] `module.controllerBindings|imports` become `module.controllers|modules`(https://github.com/FoalTS/foal/pull/37).
- [x] Split `@foal/core` into `@foal/core` and `@foal/common`(https://github.com/FoalTS/foal/pull/37).
v0.3.0: tag_name: v0.3.0
body: - Remove express and contextual decorators
- Add pre-hooks
- Remove `express` from `@foal/core` and add the new package `@foal/express`