diff --git a/CHANGELOG.md b/CHANGELOG.md index 931c00a..2d353bd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,10 +7,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog). -## [v1.4.3](https://github.com/konfer-be/typeplate/compare/v1.4.2...v1.4.3) +## [v1.4.4](https://github.com/konfer-be/typeplate/compare/v1.4.3...v1.4.4) ### Commits +- API doc, update dependencies, fix media routes path in doc [`f9c3043`](https://github.com/konfer-be/typeplate/commit/f9c30436bd99487c6da11725ad3c737cf5ffc3f6) + +## [v1.4.3](https://github.com/konfer-be/typeplate/compare/v1.4.2...v1.4.3) - 2021-04-23 + +### Commits + +- Update changelog [`935a5a4`](https://github.com/konfer-be/typeplate/commit/935a5a4761b22e99a96cecba11f666c43fb7b377) - Fix CI env variables [`d54efa0`](https://github.com/konfer-be/typeplate/commit/d54efa03e4baad38935980840eb47d74c4b998a8) - Fix DB name [`57b6a34`](https://github.com/konfer-be/typeplate/commit/57b6a3473d1a8bdd72ce4a40332fe11f9e21d58c) diff --git a/README.md b/README.md index 9d0729e..d25972b 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ [![Node](https://img.shields.io/badge/Node-14.16.0-informational?logo=node.js&color=43853D)](https://nodejs.org/docs/latest-v14.x/api/index.html) [![TypeScript](https://img.shields.io/badge/Typescript-4.2.2-informational?logo=typescript&color=2F74C0)](https://www.typescriptlang.org/) [![Express](https://img.shields.io/badge/Express-4.16.4-informational?logo=express&color=B1B1B1)](https://expressjs.com/) -[![Typeorm](https://img.shields.io/badge/Typeorm-0.2.31-informational?logo=typeorm&color=E8352B)](https://typeorm.io/#/) +[![Typeorm](https://img.shields.io/badge/Typeorm-0.2.32-informational?logo=typeorm&color=FFAB00)](https://typeorm.io/#/) [![Mocha](https://img.shields.io/badge/Mocha-8.0.3-informational?logo=mocha&color=8A6343)](https://mochajs.org) [![Build Status](https://travis-ci.com/konfer-be/typeplate.svg?token=DmbPFqq91BhwsJKVDsHw&branch=master)](https://travis-ci.com/konfer-be/typeplate) @@ -19,27 +19,33 @@ Ready to use RESTful API boilerplate builded with [Express.js](http://expressjs. Thanks to Daniel F. Sousa for inspiration with her [Express ES2017 REST API boilerplate](https://github.com/danielfsousa/express-rest-boilerplate) :beer: :beer: :beer: ## > Features -* **Clear code architecture** with classic layers such controllers, services, repositories, models, ... -* **Object Relational Mapping** with [Typeorm](https://typeorm.io/#/). -* **SSL secure connection** with native [HTTPS node module](https://nodejs.org/docs/latest-v14.x/api/https.html). -* **Entity generation** (controller, route, repository, model, validations, test, fixture) with [rsgen](https://github.com/konfer-be/rsgen). -* **Sending transactional emails** with [cliam](https://github.com/konfer-be/cliam). -* **Cross Origin Resource Sharing** with [CORS](https://expressjs.com/en/resources/middleware/cors.html). -* **Securized HTTP headers** with [Helmet](https://helmetjs.github.io/). -* **HTTP header pollution** preventing with [Hpp](https://www.npmjs.com/package/hpp). -* **API request rate limit** with [Express rate limit](https://www.npmjs.com/package/express-rate-limit). -* **HTTP friendly errors** based on a custom pipe with [boom](https://github.com/hapijs/boom) and [http-status](https://www.npmjs.com/package/http-status). -* **Logs management** with [Morgan](https://github.com/expressjs/morgan) and [Winston](https://github.com/winstonjs/winston). -* **HTTP request cache** with [memory-cache](https://www.npmjs.com/package/memory-cache). -* **Database query cache** with [typeorm caching](https://github.com/typeorm/typeorm/blob/master/docs/caching.md). -* **JWT authentication process** with [passport.js](http://www.passportjs.org/). -* **oAuth authentication process** with [passport.js](http://www.passportjs.org/). -* **Route validation** with [Joi](https://github.com/hapijs/joi). -* **Customizable file upload** with [Multer](https://www.npmjs.com/package/multer). -* **Customizable image resizing** designed for front-end requirements with [Jimp](https://www.npmjs.com/package/jimp). -* **Automatic changelog completion** with [auto-changelog](https://www.npmjs.com/package/auto-changelog). -* **Easy API testing** with included unit and e2e test sets builded with [Mocha](https://mochajs.org/), [Chai](https://www.chaijs.com/), [Sinon](https://sinonjs.org/) and [Supertest](https://github.com/visionmedia/supertest). -* **Easy generation of documentation** with [api-doc](https://apidocjs.com/) and [typedoc](https://typedoc.org/). +- **Basics** + - **Clear & clean code architecture** with classic layers such controllers, services, repositories, models, ... + - **Business validation** with business service and business rule interface. + - **Object Relational Mapping** with [typeorm](https://typeorm.io/#/). + - **Entity generation** (controller, route, repository, model, validations, interfaces, subscriber, test, fixture) with [rsgen](https://github.com/konfer-be/rsgen). + - **Logs management** with [morgan](https://github.com/expressjs/morgan) and [winston](https://github.com/winstonjs/winston). + - **Changelog completion** with [auto-changelog](https://www.npmjs.com/package/auto-changelog). + - **Testing** with included unit and e2e test sets builded with [mocha](https://mochajs.org/), [chai](https://www.chaijs.com/), [sinon](https://sinonjs.org/) and [supertest](https://github.com/visionmedia/supertest). + - **Documentation** with [api-doc](https://apidocjs.com/) and [typedoc](https://typedoc.org/). +- **Security** + - **SSL secure connection** with native [HTTPS node module](https://nodejs.org/docs/latest-v14.x/api/https.html). + - **Cross Origin Resource Sharing** with [CORS](https://expressjs.com/en/resources/middleware/cors.html). + - **Securized HTTP headers** with [helmet](https://helmetjs.github.io/). + - **HTTP header pollution** preventing with [hpp](https://www.npmjs.com/package/hpp). + - **API request rate limit** with [express-rate-limit](https://www.npmjs.com/package/express-rate-limit). + - **Route validation** with [joi](https://github.com/hapijs/joi). + - **HTTP friendly errors** with obfuscated messages based on a custom pipe with [boom](https://github.com/hapijs/boom) and [http-status](https://www.npmjs.com/package/http-status). +- **Authentication** + - **JWT authentication process** with [passport.js](http://www.passportjs.org/). + - **oAuth authentication process** with [passport.js](http://www.passportjs.org/). + - **Sending transactional emails** with [cliam](https://github.com/konfer-be/cliam). +- **Performances** + - **HTTP request cache** with [memory-cache](https://www.npmjs.com/package/memory-cache). + - **Database query cache** with [typeorm caching](https://github.com/typeorm/typeorm/blob/master/docs/caching.md). +- **Assets management** + - **Customizable file upload** with [multer](https://www.npmjs.com/package/multer). + - **Customizable image resizing** designed for front-end requirements with [jimp](https://www.npmjs.com/package/jimp). ## > Table of contents @@ -49,7 +55,6 @@ Thanks to Daniel F. Sousa for inspiration with her [Express ES2017 REST API boil * [Tests](#tests) * [Continuous integration](#continuous-integration) * [Deployment](#deployment) -* [Related links](#related-links) * [Licence](#licence) ## > Getting started @@ -58,10 +63,10 @@ Thanks to Daniel F. Sousa for inspiration with her [Express ES2017 REST API boil * Git * Node.js >= 14.16.0 -* NPM >= 6.14.0 or yarn -* A database engine +* NPM >= 6.14.0 +* A database engine with a dedicated database -When you're ready with that, starting your project is a matter of minutes. :clock12: +When you're with that, starting your project is a matter of minutes. :clock12: ### Step 1: install @@ -89,11 +94,11 @@ $ rm -rf ./.git && npm run build:repo ### Step 5: setup package.json -Open the *./package.json* file and edit *version*, *author*, *name*, *description*, *homepage*, *repository* and *bugs* fields with your own values. +Open the *./package.json* file and edit it with your own values. ### Step 6: setup environment variables -Environment variables are defined in *.env* files. Open *./dist/env/development.env* and fill the required values (uncommented in the file). See [env variables list](https://github.com/konfer-be/typeplate/wiki/Environment-variables) for more informations. +Open *./dist/env/development.env* and fill the required env variables (uncommented in the file). See [env variables list](https://github.com/konfer-be/typeplate/wiki/Environment-variables) for more informations. ```bash # Access token Secret passphrase @@ -108,6 +113,9 @@ DOMAIN = "localhost" # Application port. PORT = 8101 +# Refresh token Secret passphrase +REFRESH_TOKEN_SECRET = "your-secret" + # Database engine TYPEORM_TYPE = "mysql" @@ -129,11 +137,9 @@ TYPEORM_PORT = "3306" ### Step 7: setup cliamrc.json for sending transactional email -Sending transactional email is provided by [cliam](https://github.com/konfer-be/cliam). Currently supported providers are Mailgun, Mailjet, Postmark, Sendgrid, Sendinblue and Sparkpost. If you're not with they, you can use a simple SMTP server. - -Open the *.cliamrc.json* and fill the [required configuration](https://github.com/konfer-be/cliam/wiki/Configuration) according your sending mode. +Transactional emails are used in authentication process, to confirm an account or execute a new password request. Currently supported providers are Mailgun, Mailjet, Postmark, Sendgrid, Sendinblue and Sparkpost. If you're not with them, you can use a simple SMTP server (default with [ethereal](https://ethereal.email/)). -See [Cliam official documentation](https://github.com/konfer-be/cliam/wiki) for more information about configuration of this file. +Open the *.cliamrc.json* and fill the [required configuration](https://github.com/konfer-be/cliam/wiki/Configuration) according your sending mode. See Cliam official [documentation](https://github.com/konfer-be/cliam/wiki) for more information. Sandbox is set to true by default and emails are not send. Pass this value to false when you're ready. @@ -151,17 +157,9 @@ $ nodemon ## > Entity generation -Some repetitive tasks such as creating resources can be done easily with [rsgen](https://github.com/konfer-be/rsgen). This small tool allow you to generate a complete set of resources who are linked to an entity: +Some repetitive tasks such as creating resources can be done easily with [rsgen](https://github.com/konfer-be/rsgen). This small tool allow you to generate a complete set of resources who are linked to an entity. -- Controller -- Routes -- Repository -- Model -- Validations -- E2e tests -- Fixtures - -See the [documentation](https://github.com/konfer-be/typeplate/wiki/Entity-generation) about it. +See the [entity generation](https://github.com/konfer-be/typeplate/wiki/Entity-generation) wiki section to see the complete list of generated elements and how to. ## > Documentation @@ -203,9 +201,9 @@ Basic Travis-CI configuration is provided in *./.travis.yml* file. ## > Deployment -Project implements a basic [PM2](https://github.com/Unitech/PM2/) configuration to allow easy deployment. +Project implements a basic [PM2](https://github.com/Unitech/PM2/) configuration to allow deployment. -First, install PM2 globaly : +Install PM2 globaly : ```bash $ npm i pm2 -g @@ -213,30 +211,22 @@ $ npm i pm2 -g ### Configuration -Configure the *./ecosystem.config.js* file with your environments informations. +Configure the *./ecosystem.config.js* file with your env informations. ```javascript -deploy : { - staging : { - user : 'node', - host : '212.83.163.1', - ref : 'origin/master', - repo : 'git@github.com:repo.git', - ssh_options: ['StrictHostKeyChecking=no', 'PasswordAuthentication=yes', 'ForwardAgent=yes'], - path : '/var/www/staging', - 'post-setup' : 'npm run kickstart:staging && pm2 reload ecosystem.config.js --env staging', - 'post-deploy' : 'npm i && tsc && pm2 reload ecosystem.config.js --env staging' - }, - production : { - user : 'node', - host : '212.83.163.1', - ref : 'origin/master', - repo : 'git@github.com:repo.git', - ssh_options: ['StrictHostKeyChecking=no', 'PasswordAuthentication=yes', 'ForwardAgent=yes'], - path : '/var/www/production', - 'post-setup' : 'npm run kickstart:production && pm2 reload ecosystem.config.js --env production', - 'post-deploy' : 'npm i && tsc && pm2 reload ecosystem.config.js --env production' - } +{ + deploy : { + staging : { + user : 'node', + host : '212.83.163.1', + ref : 'origin/master', + repo : 'git@github.com:repo.git', + ssh_options: ['StrictHostKeyChecking=no', 'PasswordAuthentication=yes', 'ForwardAgent=yes'], + path : '/var/www/staging', + 'post-setup' : 'npm run kickstart:staging && pm2 reload ecosystem.config.js --env staging', + 'post-deploy' : 'npm i && tsc && pm2 reload ecosystem.config.js --env staging' + } + } } ``` More info about PM2 [ecosystem.config.js](https://pm2.io/doc/en/runtime/reference/ecosystem-file/) file. @@ -254,9 +244,6 @@ $ pm2 deploy production update # Revert to -1 deployment $ pm2 deploy production revert 1 - -# execute a command on remote servers -$ pm2 deploy production exec "pm2 reload all" ``` More info about [PM2](http://pm2.keymetrics.io/docs/usage/quick-start/) and [PM2 deploy](https://pm2.io/doc/en/runtime/guide/easy-deploy-with-ssh/). diff --git a/apidoc.json b/apidoc.json index 2b46672..02ecfa5 100644 --- a/apidoc.json +++ b/apidoc.json @@ -1,11 +1,11 @@ { - "name": "Your project", + "name": "Typeplate", "version": "1.0.0", - "description": "Final user documentation", - "title": "API final user documentation", - "url": "https://www.your-project.com/docs/apidoc", + "description": "REST API consumer documentation.", + "title": "[Typeplate] API consumer documentation", + "url": "https://www.your-project.com/api/v1", "order": [ - "Info", + "Main", "Auth", "User", "Media" diff --git a/package-lock.json b/package-lock.json index 4266e02..4904c93 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "typeplate", - "version": "1.4.1", + "version": "1.4.3", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -901,9 +901,9 @@ "dev": true }, "@sqltools/formatter": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/@sqltools/formatter/-/formatter-1.2.2.tgz", - "integrity": "sha512-/5O7Fq6Vnv8L6ucmPjaWbVG1XkP4FO+w5glqfkIsq3Xw4oyNAdJddbnYodNDAfjVUvo/rrSCTom4kAND7T1o5Q==" + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/@sqltools/formatter/-/formatter-1.2.3.tgz", + "integrity": "sha512-O3uyB/JbkAEMZaP3YqyHH7TMnex7tWyCbCI4EfJdOCoN6HIhqdJBWTM6aCCiWQ/5f5wxjgU735QAIpJbjDvmzg==" }, "@szmarczak/http-timer": { "version": "1.1.2", @@ -1045,6 +1045,11 @@ "integrity": "sha512-eQ9qFW/fhfGJF8WKHGEHZEyVWfZxrT+6CLIJGBcZPfxUh/+BnEj+UCGYMlr9qZuX/2AltsvwrGqp0LhEW8D0zQ==", "dev": true }, + "@types/zen-observable": { + "version": "0.8.2", + "resolved": "https://registry.npmjs.org/@types/zen-observable/-/zen-observable-0.8.2.tgz", + "integrity": "sha512-HrCIVMLjE1MOozVoD86622S7aunluLb2PJdPfb3nYiEtohm8mIB/vyv0Fd37AdeMFrTUQXEunw78YloMA3Qilg==" + }, "@typescript-eslint/eslint-plugin": { "version": "4.18.0", "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-4.18.0.tgz", @@ -1484,9 +1489,9 @@ } }, "apidoc": { - "version": "0.26.0", - "resolved": "https://registry.npmjs.org/apidoc/-/apidoc-0.26.0.tgz", - "integrity": "sha512-IEw/Z7HMMbjeVjK2sZvZSwAln8AqalLzf3qLDtkcedXVhdxGm6W7UgIW6fshegqNTMLzm8CFEMi4Lxbeu0xKTw==", + "version": "0.27.0", + "resolved": "https://registry.npmjs.org/apidoc/-/apidoc-0.27.0.tgz", + "integrity": "sha512-P/DOkJNeV8lZ2liUUMUkyxrnYB0+/ssVqkP8mEjTYkRvNL6jsKdVE0I3hAQh7ZKvu3sIRh/kFM10O8HqeWsMOg==", "dev": true, "requires": { "apidoc-core": "^0.12.0", @@ -1554,9 +1559,9 @@ } }, "semver": { - "version": "7.3.4", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.4.tgz", - "integrity": "sha512-tCfb2WLjqFAtXn4KEdxIhalnRtoKFN7nAwj0B3ZXCbQloV2tq5eDbcTmT68JJD3nRJq24/XgxtQKFIpQdtvmVw==", + "version": "7.3.5", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.5.tgz", + "integrity": "sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ==", "dev": true, "requires": { "lru-cache": "^6.0.0" @@ -1613,6 +1618,7 @@ "version": "1.0.10", "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", + "dev": true, "requires": { "sprintf-js": "~1.0.2" } @@ -1874,9 +1880,9 @@ } }, "aws-sdk": { - "version": "2.888.0", - "resolved": "https://registry.npmjs.org/aws-sdk/-/aws-sdk-2.888.0.tgz", - "integrity": "sha512-9Rg14eneXnrs5Wh5FL42qGEXf7QaqaV/gMHU9SfvAA0SEM390QnwVjCSKF5YAReWjSuJriKJTDiodMI39J+Nrg==", + "version": "2.892.0", + "resolved": "https://registry.npmjs.org/aws-sdk/-/aws-sdk-2.892.0.tgz", + "integrity": "sha512-OOXJ15AnJJMHZYXJQVy22Wjnp5GrZCfvCxmoZuXdsLNs8M+BL4mfBqma82+UkM2NhJgLYuAhDfvFUBob6VGIWw==", "requires": { "buffer": "4.9.2", "events": "1.1.1", @@ -2482,12 +2488,12 @@ } }, "cli-highlight": { - "version": "2.1.10", - "resolved": "https://registry.npmjs.org/cli-highlight/-/cli-highlight-2.1.10.tgz", - "integrity": "sha512-CcPFD3JwdQ2oSzy+AMG6j3LRTkNjM82kzcSKzoVw6cLanDCJNlsLjeqVTOTfOfucnWv5F0rmBemVf1m9JiIasw==", + "version": "2.1.11", + "resolved": "https://registry.npmjs.org/cli-highlight/-/cli-highlight-2.1.11.tgz", + "integrity": "sha512-9KDcoEVwyUXrjcJNvHD0NFc/hiwe/WPVYIleQh2O1N2Zro5gWJZ/K+3DGn8w8P/F6FxOgzyC5bxDyHIgCSPhGg==", "requires": { "chalk": "^4.0.0", - "highlight.js": "^10.0.0", + "highlight.js": "^10.7.1", "mz": "^2.4.0", "parse5": "^5.1.1", "parse5-htmlparser2-tree-adapter": "^6.0.0", @@ -2503,9 +2509,9 @@ } }, "chalk": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.0.tgz", - "integrity": "sha512-qwx12AxXe2Q5xQ43Ac//I6v5aXTipYrSESdOgzrN+9XjgEpyjpKuvSGaN4qE93f7TQTlerQQ8S+EQ0EyDoVL1A==", + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.1.tgz", + "integrity": "sha512-diHzdDKxcU+bAsUboHLPEDQiw0qEe0qd7SYUn3HgcFlWgbDcfLGswOHYeGrHKzG9z6UYf01d9VFMfZxPM1xZSg==", "requires": { "ansi-styles": "^4.1.0", "supports-color": "^7.1.0" @@ -2529,11 +2535,6 @@ "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==" }, - "highlight.js": { - "version": "10.6.0", - "resolved": "https://registry.npmjs.org/highlight.js/-/highlight.js-10.6.0.tgz", - "integrity": "sha512-8mlRcn5vk/r4+QcqerapwBYTe+iPL5ih6xrNylxrnBdHQiijDETfXX7VIxC3UiCRiINBJfANBAsPzAvRQj8RpQ==" - }, "supports-color": { "version": "7.2.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", @@ -2604,24 +2605,24 @@ "dev": true }, "cliam": { - "version": "1.0.10", - "resolved": "https://registry.npmjs.org/cliam/-/cliam-1.0.10.tgz", - "integrity": "sha512-WLqW7GfwR+nN9mBqa2ZrZHVospZoxWhhhvVpf9pyuAsqxTqUabQ3fC6KcAua+ezHIlDi3EAxsSwwiLyFCyzWkA==", + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/cliam/-/cliam-1.0.11.tgz", + "integrity": "sha512-5zBxxirN9EIV+3T5Ng+McW4puvSs0NNC4dUz3OrLA8iWA1cfKE/TbU9Q6RrkrKvlT3UAHiyH6dsUMZ23hSU2Gw==", "requires": { "chalk": "^4.1.0", "color": "^3.1.3", "hbs": "^4.1.1", "html-to-text": "^7.0.0", "joi": "17.4.0", - "node-mailjet": "3.3.1", + "node-mailjet": "^3.3.1", "nodemailer": "6.5.0", - "nodemailer-mailgun-transport": "2.0.2", - "nodemailer-mandrill-transport": "1.2.0", - "nodemailer-postmark-transport": "4.0.0", - "nodemailer-sendgrid": "1.0.3", + "nodemailer-mailgun-transport": "^2.0.2", + "nodemailer-mandrill-transport": "^1.2.0", + "nodemailer-postmark-transport": "^4.0.0", + "nodemailer-sendgrid": "^1.0.3", "nodemailer-sendinblue-transport": "git+https://github.com/konfer-be/nodemailer-sendinblue-transport.git", "nodemailer-ses-transport": "^1.5.1", - "nodemailer-sparkpost-transport": "2.2.0" + "nodemailer-sparkpost-transport": "^2.2.0" }, "dependencies": { "ansi-styles": { @@ -2633,9 +2634,9 @@ } }, "chalk": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.0.tgz", - "integrity": "sha512-qwx12AxXe2Q5xQ43Ac//I6v5aXTipYrSESdOgzrN+9XjgEpyjpKuvSGaN4qE93f7TQTlerQQ8S+EQ0EyDoVL1A==", + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.1.tgz", + "integrity": "sha512-diHzdDKxcU+bAsUboHLPEDQiw0qEe0qd7SYUn3HgcFlWgbDcfLGswOHYeGrHKzG9z6UYf01d9VFMfZxPM1xZSg==", "requires": { "ansi-styles": "^4.1.0", "supports-color": "^7.1.0" @@ -5140,6 +5141,11 @@ "resolved": "https://registry.npmjs.org/helmet/-/helmet-4.4.1.tgz", "integrity": "sha512-G8tp0wUMI7i8wkMk2xLcEvESg5PiCitFMYgGRc/PwULB0RVhTP5GFdxOwvJwp9XVha8CuS8mnhmE8I/8dx/pbw==" }, + "highlight.js": { + "version": "10.7.2", + "resolved": "https://registry.npmjs.org/highlight.js/-/highlight.js-10.7.2.tgz", + "integrity": "sha512-oFLl873u4usRM9K63j4ME9u3etNF0PLiJhSQ8rdfuL51Wn3zkD6drf9ZW0dOzjnZI22YYG24z30JcmfCZjMgYg==" + }, "hosted-git-info": { "version": "2.8.2", "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.2.tgz", @@ -5182,13 +5188,13 @@ "dev": true }, "html-to-text": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/html-to-text/-/html-to-text-7.0.0.tgz", - "integrity": "sha512-UR/WMSHRN8m+L7qQUhbSoxylwBovNPS+xURn/pHeJvbnemhyMiuPYBTBGqB6s8ajAARN5jzKfF0d3CY86VANpA==", + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/html-to-text/-/html-to-text-7.1.1.tgz", + "integrity": "sha512-c9QWysrfnRZevVpS8MlE7PyOdSuIOjg8Bt8ZE10jMU/BEngA6j3llj4GRfAmtQzcd1FjKE0sWu5IHXRUH9YxIQ==", "requires": { "deepmerge": "^4.2.2", "he": "^1.2.0", - "htmlparser2": "^6.0.0", + "htmlparser2": "^6.1.0", "minimist": "^1.2.5" } }, @@ -7638,9 +7644,9 @@ "integrity": "sha1-QfYx0Wsx2lXigkloizKRZ93Q1lE=" }, "nodemailer-mailgun-transport": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/nodemailer-mailgun-transport/-/nodemailer-mailgun-transport-2.0.2.tgz", - "integrity": "sha512-4j0G4yUrYrJ2o/1Ow3d5HeW/ed9anWQ1+He7HuL2+0XcSyLLjNkft30zodFTyTWlFaiLiaIJ9Ssnjmz+qrtIZg==", + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/nodemailer-mailgun-transport/-/nodemailer-mailgun-transport-2.0.3.tgz", + "integrity": "sha512-+tbMRfw+ACs3OEVYyidC5qzthr5xd/KFxSNrprTWihKTl5QLXqgiTHCR6m2rZIB2VKV3QvdZ2D8OTBWT/l9/7w==", "requires": { "consolidate": "^0.15.1", "mailgun-js": "^0.22.0" @@ -9615,7 +9621,8 @@ "sprintf-js": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", - "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=" + "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=", + "dev": true }, "sqlstring": { "version": "2.3.1", @@ -10146,7 +10153,8 @@ "tslib": { "version": "1.14.1", "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", - "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==" + "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==", + "dev": true }, "tsscmp": { "version": "1.0.6", @@ -10266,26 +10274,27 @@ "dev": true }, "typeorm": { - "version": "0.2.31", - "resolved": "https://registry.npmjs.org/typeorm/-/typeorm-0.2.31.tgz", - "integrity": "sha512-dVvCEVHH48DG0QPXAKfo0l6ecQrl3A8ucGP4Yw4myz4YEDMProebTQo8as83uyES+nrwCbu3qdkL4ncC2+qcMA==", + "version": "0.2.32", + "resolved": "https://registry.npmjs.org/typeorm/-/typeorm-0.2.32.tgz", + "integrity": "sha512-LOBZKZ9As3f8KRMPCUT2H0JZbZfWfkcUnO3w/1BFAbL/X9+cADTF6bczDGGaKVENJ3P8SaKheKmBgpt5h1x+EQ==", "requires": { - "@sqltools/formatter": "1.2.2", + "@sqltools/formatter": "^1.2.2", "app-root-path": "^3.0.0", - "buffer": "^5.5.0", + "buffer": "^6.0.3", "chalk": "^4.1.0", "cli-highlight": "^2.1.10", - "debug": "^4.1.1", + "debug": "^4.3.1", "dotenv": "^8.2.0", "glob": "^7.1.6", - "js-yaml": "^3.14.0", + "js-yaml": "^4.0.0", "mkdirp": "^1.0.4", "reflect-metadata": "^0.1.13", "sha.js": "^2.4.11", - "tslib": "^1.13.0", + "tslib": "^2.1.0", "xml2js": "^0.4.23", - "yargonaut": "^1.1.2", - "yargs": "^16.0.3" + "yargonaut": "^1.1.4", + "yargs": "^16.2.0", + "zen-observable-ts": "^1.0.0" }, "dependencies": { "ansi-styles": { @@ -10296,24 +10305,24 @@ "color-convert": "^2.0.1" } }, - "base64-js": { - "version": "1.5.1", - "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", - "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==" + "argparse": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==" }, "buffer": { - "version": "5.7.1", - "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz", - "integrity": "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==", + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz", + "integrity": "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==", "requires": { "base64-js": "^1.3.1", - "ieee754": "^1.1.13" + "ieee754": "^1.2.1" } }, "chalk": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.0.tgz", - "integrity": "sha512-qwx12AxXe2Q5xQ43Ac//I6v5aXTipYrSESdOgzrN+9XjgEpyjpKuvSGaN4qE93f7TQTlerQQ8S+EQ0EyDoVL1A==", + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.1.tgz", + "integrity": "sha512-diHzdDKxcU+bAsUboHLPEDQiw0qEe0qd7SYUn3HgcFlWgbDcfLGswOHYeGrHKzG9z6UYf01d9VFMfZxPM1xZSg==", "requires": { "ansi-styles": "^4.1.0", "supports-color": "^7.1.0" @@ -10340,11 +10349,6 @@ "ms": "2.1.2" } }, - "dotenv": { - "version": "8.2.0", - "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-8.2.0.tgz", - "integrity": "sha512-8sJ78ElpbDJBHNeBzUbUVLsqKdccaa/BXF1uPTw3GrvQTBgrQrtObr2mUrE38vzYd8cEv+m/JBfDLioYcfXoaw==" - }, "glob": { "version": "7.1.6", "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz", @@ -10363,18 +10367,12 @@ "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==" }, - "ieee754": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", - "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==" - }, "js-yaml": { - "version": "3.14.1", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.1.tgz", - "integrity": "sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==", + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", + "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", "requires": { - "argparse": "^1.0.7", - "esprima": "^4.0.0" + "argparse": "^2.0.1" } }, "mkdirp": { @@ -10395,19 +10393,10 @@ "has-flag": "^4.0.0" } }, - "xml2js": { - "version": "0.4.23", - "resolved": "https://registry.npmjs.org/xml2js/-/xml2js-0.4.23.tgz", - "integrity": "sha512-ySPiMjM0+pLDftHgXY4By0uswI3SPKLDw/i3UXbnO8M/p28zqexCUoPmQFrYD+/1BzhGJSs2i1ERWKJAtiLrug==", - "requires": { - "sax": ">=0.6.0", - "xmlbuilder": "~11.0.0" - } - }, - "xmlbuilder": { - "version": "11.0.1", - "resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-11.0.1.tgz", - "integrity": "sha512-fDlsI/kFEx7gLvbecc0/ohLG50fugQp8ryHzMTuW9vSa1GJ0XYWKnhsUx7oie3G98+r56aTQIUB4kht42R3JvA==" + "tslib": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.2.0.tgz", + "integrity": "sha512-gS9GVHRU+RGn5KQM2rllAlR3dU6m7AcpJKdtH8gFvQiC4Otgk98XnmMU+nZenHt/+VhnBPWwgrJsyrdcw6i23w==" } } }, @@ -11088,6 +11077,20 @@ "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==", "dev": true + }, + "zen-observable": { + "version": "0.8.15", + "resolved": "https://registry.npmjs.org/zen-observable/-/zen-observable-0.8.15.tgz", + "integrity": "sha512-PQ2PC7R9rslx84ndNBZB/Dkv8V8fZEpk83RLgXtYd0fwUgEjseMn1Dgajh2x6S8QbZAFa9p2qVCEuYZNgve0dQ==" + }, + "zen-observable-ts": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/zen-observable-ts/-/zen-observable-ts-1.0.0.tgz", + "integrity": "sha512-KmWcbz+9kKUeAQ8btY8m1SsEFgBcp7h/Uf3V5quhan7ZWdjGsf0JcGLULQiwOZibbFWnHkYq8Nn2AZbJabovQg==", + "requires": { + "@types/zen-observable": "^0.8.2", + "zen-observable": "^0.8.15" + } } } } diff --git a/package.json b/package.json index f043ae7..75ed576 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "version": "1.4.3", + "version": "1.4.4", "engines": { "node": ">=14.16", "npm": ">=6.14.11" @@ -85,7 +85,7 @@ "axios": "0.21.1", "bcrypt": "5.0.0", "body-parser": "1.19.0", - "cliam": "^1.0.10", + "cliam": "^1.0.11", "compression": "1.7.4", "cors": "2.8.5", "dayjs": "^1.10.4", @@ -115,7 +115,7 @@ "passport-linkedin-oauth2": "2.0.0", "pluralize": "8.0.0", "reflect-metadata": "0.1.13", - "typeorm": "0.2.31", + "typeorm": "^0.2.32", "uuid": "8.3.2", "winston": "3.3.3" }, @@ -127,7 +127,7 @@ "@types/uuid": "8.3.0", "@typescript-eslint/eslint-plugin": "4.18.0", "@typescript-eslint/parser": "4.18.0", - "apidoc": "0.26.0", + "apidoc": "^0.27.0", "auto-changelog": "2.2.1", "chai": "4.3.4", "chance": "1.1.7", diff --git a/src/api/core/routes/v1/media.route.ts b/src/api/core/routes/v1/media.route.ts index 1301fa2..bfc3e51 100644 --- a/src/api/core/routes/v1/media.route.ts +++ b/src/api/core/routes/v1/media.route.ts @@ -21,7 +21,7 @@ export class MediaRouter extends Router { this.router.route('/') /** - * @api {get} api/v1/medias List medias + * @api {get} /medias List medias * @apiDescription Get a list of medias * @apiVersion 1.0.0 * @apiName ListMedias @@ -85,7 +85,7 @@ export class MediaRouter extends Router { .get(Guard.authorize([ROLE.admin, ROLE.user]), Validator.check(listMedias), MediaController.list) /** - * @api {post} api/v1/medias Create media(s) + * @api {post} /medias Create media(s) * @apiDescription Create one or many new media(s) * @apiVersion 1.0.0 * @apiName CreateMedia @@ -142,7 +142,7 @@ export class MediaRouter extends Router { this.router.route('/:mediaId') /** - * @api {get} api/v1/medias/:id Get one media + * @api {get} /medias/:id Get one media * @apiDescription Get media * @apiVersion 1.0.0 * @apiName GetMedia @@ -193,7 +193,7 @@ export class MediaRouter extends Router { .get(Guard.authorize([ROLE.admin, ROLE.user]), Validator.check(getMedia), MediaController.get) /** - * @api {put} api/v1/medias/:id Replace media + * @api {put} /medias/:id Replace media * @apiDescription Replace the whole media with a new one * @apiVersion 1.0.0 * @apiName ReplaceDocument @@ -244,7 +244,7 @@ export class MediaRouter extends Router { .put(Guard.authorize([ROLE.admin, ROLE.user]), Validator.check(replaceMedia), MediaController.get, Uploader.upload( { wildcards: list(MIME_TYPE) } ), Validator.check(insertMedia), MediaController.update) /** - * @api {patch} api/v1/medias/:id Update media + * @api {patch} /medias/:id Update media * @apiDescription Update some fields of a media * @apiVersion 1.0.0 * @apiName UpdateDocument