From 786ccbf7f7b36ae9bf160944d39b926b095268ce Mon Sep 17 00:00:00 2001 From: Sajjad Shirazy Date: Tue, 8 Jan 2019 13:10:18 +0330 Subject: [PATCH 01/31] bugfix: in `production` Playground doesn't load the schema --- packages/strapi-plugin-graphql/hooks/graphql/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/strapi-plugin-graphql/hooks/graphql/index.js b/packages/strapi-plugin-graphql/hooks/graphql/index.js index 8f36e33166..3e5b802663 100644 --- a/packages/strapi-plugin-graphql/hooks/graphql/index.js +++ b/packages/strapi-plugin-graphql/hooks/graphql/index.js @@ -174,6 +174,7 @@ module.exports = strapi => { serverParams.playground = { endpoint: strapi.plugins.graphql.config.endpoint, }; + serverParams.introspection = true; } const server = new ApolloServer(serverParams); From 40faec28453e0542629d78573ab0184e6e893748 Mon Sep 17 00:00:00 2001 From: Liroo Date: Tue, 8 Jan 2019 14:52:17 +0100 Subject: [PATCH 02/31] "strapi new" mongo +srv prefix uri in command line args --- .../files/config/environments/production/database.json | 1 + .../files/config/environments/staging/database.json | 1 + packages/strapi/bin/strapi-new.js | 1 + packages/strapi/bin/strapi.js | 1 + 4 files changed, 4 insertions(+) diff --git a/packages/strapi-generate-new/files/config/environments/production/database.json b/packages/strapi-generate-new/files/config/environments/production/database.json index 3075fabf91..10581fc5bb 100644 --- a/packages/strapi-generate-new/files/config/environments/production/database.json +++ b/packages/strapi-generate-new/files/config/environments/production/database.json @@ -7,6 +7,7 @@ "client": "mongo", "uri": "${process.env.DATABASE_URI || ''}", "host": "${process.env.DATABASE_HOST || '127.0.0.1'}", + "srv": "${process.env.DATABASE_SRV || false}", "port": "${process.env.DATABASE_PORT || 27017}", "database": "${process.env.DATABASE_NAME || 'strapi-production'}", "username": "${process.env.DATABASE_USERNAME || ''}", diff --git a/packages/strapi-generate-new/files/config/environments/staging/database.json b/packages/strapi-generate-new/files/config/environments/staging/database.json index 43edf2421d..451aaa9684 100644 --- a/packages/strapi-generate-new/files/config/environments/staging/database.json +++ b/packages/strapi-generate-new/files/config/environments/staging/database.json @@ -7,6 +7,7 @@ "client": "mongo", "uri": "${process.env.DATABASE_URI || ''}", "host": "${process.env.DATABASE_HOST || '127.0.0.1'}", + "srv": "${process.env.DATABASE_SRV || false}", "port": "${process.env.DATABASE_PORT || 27017}", "database": "${process.env.DATABASE_NAME || 'strapi-staging'}", "username": "${process.env.DATABASE_USERNAME || ''}", diff --git a/packages/strapi/bin/strapi-new.js b/packages/strapi/bin/strapi-new.js index 707a7bbe35..87a11ce1b4 100644 --- a/packages/strapi/bin/strapi-new.js +++ b/packages/strapi/bin/strapi-new.js @@ -61,6 +61,7 @@ module.exports = function (name, cliArguments) { settings: { client: cliArguments.dbclient, host: cliArguments.dbhost, + srv: cliArguments.dbsrv, port: cliArguments.dbport, database: cliArguments.dbname, username: cliArguments.dbusername, diff --git a/packages/strapi/bin/strapi.js b/packages/strapi/bin/strapi.js index 4aa5d87cdd..03dad62503 100755 --- a/packages/strapi/bin/strapi.js +++ b/packages/strapi/bin/strapi.js @@ -56,6 +56,7 @@ program .option('--debug', 'Display database connection error') .option('--dbclient ', 'Database client') .option('--dbhost ', 'Database host') + .option('--dbsrv ', 'Database srv') .option('--dbport ', 'Database port') .option('--dbname ', 'Database name') .option('--dbusername ', 'Database username') From 603f536d5e063845f9ef312f0f6b8234a1c851aa Mon Sep 17 00:00:00 2001 From: Paolo Ragone Date: Wed, 9 Jan 2019 23:24:45 +1300 Subject: [PATCH 03/31] Updated knex --- packages/strapi-hook-knex/lib/index.js | 15 ++++++++++++--- packages/strapi-hook-knex/package.json | 2 +- packages/strapi-utils/package.json | 2 +- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/packages/strapi-hook-knex/lib/index.js b/packages/strapi-hook-knex/lib/index.js index ceacd92131..d661ec610c 100644 --- a/packages/strapi-hook-knex/lib/index.js +++ b/packages/strapi-hook-knex/lib/index.js @@ -106,15 +106,24 @@ module.exports = strapi => { migrations: _.get(connection.options, 'migrations') }, strapi.config.hook.settings.knex); + options.pool = { + min: _.get(connection.options, 'pool.min') || 0, + max: _.get(connection.options, 'pool.max') || 10, + acquireTimeoutMillis: _.get(connection.options, 'pool.acquireTimeoutMillis') || 2000, + createTimeoutMillis: _.get(connection.options, 'pool.createTimeoutMillis') || 2000, + idleTimeoutMillis: _.get(connection.options, 'pool.idleTimeoutMillis') || 30000, + reapIntervalMillis: _.get(connection.options, 'pool.reapIntervalMillis') || 1000, + createRetryIntervalMillis: _.get(connection.options, 'pool.createRetryIntervalMillis') || 200, + }; + if (options.client === 'pg') { client.types.setTypeParser(1700, 'text', parseFloat); if (_.isString(_.get(options.connection, 'schema'))) { options.pool = { - min: _.get(connection.options, 'pool.min') || 0, - max: _.get(connection.options, 'pool.max') || 10, afterCreate: (conn, cb) => { - conn.query(`SET SESSION SCHEMA '${options.connection.schema}';`, (err) => { + // conn.query(`SET SESSION SCHEMA '${options.connection.schema}';`, (err) => { // It seems the right way is the one below + conn.query(`SET search_path TO '${options.connection.schema}';`, (err) => { cb(err, conn); }); } diff --git a/packages/strapi-hook-knex/package.json b/packages/strapi-hook-knex/package.json index 639fec3a5a..25c8031fda 100644 --- a/packages/strapi-hook-knex/package.json +++ b/packages/strapi-hook-knex/package.json @@ -16,7 +16,7 @@ }, "main": "./lib", "dependencies": { - "knex": "^0.13.0", + "knex": "^0.16.3", "lodash": "^4.17.5" }, "author": { diff --git a/packages/strapi-utils/package.json b/packages/strapi-utils/package.json index 52cf337974..971cb13a25 100644 --- a/packages/strapi-utils/package.json +++ b/packages/strapi-utils/package.json @@ -20,7 +20,7 @@ "dependencies": { "commander": "^2.11.0", "joi-json": "^2.0.1", - "knex": "^0.13.0", + "knex": "^0.16.3", "lodash": "^4.17.5", "pino": "^4.7.1", "shelljs": "^0.7.7" From e998825b4d6218951d3a938cd1406dac3b697145 Mon Sep 17 00:00:00 2001 From: Paolo Ragone Date: Thu, 10 Jan 2019 21:53:17 +1300 Subject: [PATCH 04/31] Added some documentation --- CONTRIBUTING.md | 2 +- docs/3.x.x/configurations/configurations.md | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 7b1dda35ae..8f3afba92c 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -74,7 +74,7 @@ npm run setup:build You can open a new terminal window and go into any folder you want for the next steps. ```bash -cd /.../workspace/ +cd ../workspace/ ``` The command to generate a project is the same, except you have to add the `--dev` argument at the end of line. diff --git a/docs/3.x.x/configurations/configurations.md b/docs/3.x.x/configurations/configurations.md index f8d698023d..107e2ad26b 100644 --- a/docs/3.x.x/configurations/configurations.md +++ b/docs/3.x.x/configurations/configurations.md @@ -202,6 +202,14 @@ You can access the config of the current environment through `strapi.config.curr - `ssl` (boolean): For ssl database connection. - `debug` (boolean): Show database exchanges and errors. - `autoMigration` (boolean): To disable auto tables/columns creation for SQL database. + - `pool` Options used for database connection pooling. For more information look at [Knex's pool config documentation](https://knexjs.org/#Installation-pooling). + - `min` (integer): Minimum number of connections to keep in the pool. Default value: `0`. + - `max` (integer): Maximum number of connections to keep in the pool. Default value: `10`. + - `acquireTimeoutMillis` (integer): Maximum time in milliseconds to wait for acquiring a connection from the pool. Default value: `2000` (2 seconds). + - `createTimeoutMillis` (integer): Maximum time in milliseconds to wait for creating a connection to be added to the pool. Default value: `2000` (2 seconds). + - `idleTimeoutMillis` (integer): Number of milliseconds to wait before destroying idle connections. Default value: `30000` (30 seconds). + - `reapIntervalMillis` (integer): How often to check for idle connections in milliseconds. Default value: `1000` (1 second). + - `createRetryIntervalMillis` (integer): How long to idle after a failed create before trying again in milliseconds. Default value: `200`. #### Example From e23129b051d89daada45799814d2a3cf6b56a5e9 Mon Sep 17 00:00:00 2001 From: Paolo Ragone Date: Thu, 10 Jan 2019 23:39:32 +1300 Subject: [PATCH 05/31] Removed references to dead dialects --- packages/strapi-hook-knex/lib/index.js | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/packages/strapi-hook-knex/lib/index.js b/packages/strapi-hook-knex/lib/index.js index d661ec610c..8ac4877be1 100644 --- a/packages/strapi-hook-knex/lib/index.js +++ b/packages/strapi-hook-knex/lib/index.js @@ -18,8 +18,7 @@ const CLIENTS = [ 'sqlite3', 'mariasql', 'oracle', 'strong-oracle', - 'mssql', - 'websql' + 'mssql' ]; /** @@ -65,9 +64,6 @@ module.exports = strapi => { case 'ms': connection.settings.client = 'mssql'; break; - case 'web': - connection.settings.client = 'websql'; - break; } // Make sure the client is supported. From dd5ebdf46fef3194468b07b21c1ee3bdaba05ced Mon Sep 17 00:00:00 2001 From: Martin Muzatko Date: Tue, 15 Jan 2019 13:29:39 +0100 Subject: [PATCH 06/31] Add note about docker to deployment --- docs/3.x.x/guides/deployment.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/docs/3.x.x/guides/deployment.md b/docs/3.x.x/guides/deployment.md index eaf8a6da34..93ad982180 100644 --- a/docs/3.x.x/guides/deployment.md +++ b/docs/3.x.x/guides/deployment.md @@ -1,5 +1,13 @@ # Deployment +### Docker + +::: tip +You can also deploy using [https://hub.docker.com/r/strapi/strapi](Docker) +::: + +The method below describes regular deployment using the built-in mechanisms. + #### #1 - Configure Update the `production` settings with the IP and domain name where the project will be running. From cf33f01606c18110661555c683df0be0d2ac75dd Mon Sep 17 00:00:00 2001 From: Martin Muzatko Date: Tue, 15 Jan 2019 13:32:23 +0100 Subject: [PATCH 07/31] fixed link --- docs/3.x.x/guides/deployment.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/3.x.x/guides/deployment.md b/docs/3.x.x/guides/deployment.md index 93ad982180..50ad9673b7 100644 --- a/docs/3.x.x/guides/deployment.md +++ b/docs/3.x.x/guides/deployment.md @@ -3,7 +3,7 @@ ### Docker ::: tip -You can also deploy using [https://hub.docker.com/r/strapi/strapi](Docker) +You can also deploy using [Docker](https://hub.docker.com/r/strapi/strapi]) ::: The method below describes regular deployment using the built-in mechanisms. From 239835f0ae2bc667d03d09b06746f16a07948bf9 Mon Sep 17 00:00:00 2001 From: Paolo Ragone Date: Thu, 17 Jan 2019 22:24:09 +1300 Subject: [PATCH 08/31] Requested change --- packages/strapi-hook-knex/lib/index.js | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/packages/strapi-hook-knex/lib/index.js b/packages/strapi-hook-knex/lib/index.js index 8ac4877be1..4fca4e6398 100644 --- a/packages/strapi-hook-knex/lib/index.js +++ b/packages/strapi-hook-knex/lib/index.js @@ -91,25 +91,25 @@ module.exports = strapi => { password: _.get(connection.settings, 'password'), database: _.get(connection.settings, 'database'), charset: _.get(connection.settings, 'charset'), - schema: _.get(connection.settings, 'schema') || 'public', + schema: _.get(connection.settings, 'schema', 'public'), port: _.get(connection.settings, 'port'), socket: _.get(connection.settings, 'socketPath'), - ssl: _.get(connection.settings, 'ssl') || false, - timezone: _.get(connection.settings, 'timezone') || 'utc', + ssl: _.get(connection.settings, 'ssl', false), + timezone: _.get(connection.settings, 'timezone', 'utc'), }, - debug: _.get(connection.options, 'debug') || false, + debug: _.get(connection.options, 'debug', false), acquireConnectionTimeout: _.get(connection.options, 'acquireConnectionTimeout'), migrations: _.get(connection.options, 'migrations') }, strapi.config.hook.settings.knex); options.pool = { - min: _.get(connection.options, 'pool.min') || 0, - max: _.get(connection.options, 'pool.max') || 10, - acquireTimeoutMillis: _.get(connection.options, 'pool.acquireTimeoutMillis') || 2000, - createTimeoutMillis: _.get(connection.options, 'pool.createTimeoutMillis') || 2000, - idleTimeoutMillis: _.get(connection.options, 'pool.idleTimeoutMillis') || 30000, - reapIntervalMillis: _.get(connection.options, 'pool.reapIntervalMillis') || 1000, - createRetryIntervalMillis: _.get(connection.options, 'pool.createRetryIntervalMillis') || 200, + min: _.get(connection.options, 'pool.min', 0), + max: _.get(connection.options, 'pool.max', 10), + acquireTimeoutMillis: _.get(connection.options, 'pool.acquireTimeoutMillis', 2000), + createTimeoutMillis: _.get(connection.options, 'pool.createTimeoutMillis', 2000), + idleTimeoutMillis: _.get(connection.options, 'pool.idleTimeoutMillis', 30000), + reapIntervalMillis: _.get(connection.options, 'pool.reapIntervalMillis', 1000), + createRetryIntervalMillis: _.get(connection.options, 'pool.createRetryIntervalMillis', 200), }; if (options.client === 'pg') { From 925438d7b58ec3e03d472bbf1d1f8ffb19d00b3e Mon Sep 17 00:00:00 2001 From: soupette Date: Thu, 17 Jan 2019 17:18:54 +0100 Subject: [PATCH 09/31] Fixes #2541 --- .../admin/src/containers/EditPage/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/strapi-plugin-users-permissions/admin/src/containers/EditPage/index.js b/packages/strapi-plugin-users-permissions/admin/src/containers/EditPage/index.js index 72f57a17e9..894027dc90 100644 --- a/packages/strapi-plugin-users-permissions/admin/src/containers/EditPage/index.js +++ b/packages/strapi-plugin-users-permissions/admin/src/containers/EditPage/index.js @@ -110,7 +110,7 @@ export class EditPage extends React.Component { // eslint-disable-line react/pre showLoaderForm = () => { const { editPage: { modifiedData }, match: { params: { actionType } } } = this.props; - return actionType !== 'create' && get(modifiedData, ['name'], '') === ''; + return actionType !== 'create' && isEmpty(modifiedData); } showLoaderPermissions = () => { From c9e48860b1fa9926dd85ea55735244b690464be3 Mon Sep 17 00:00:00 2001 From: Divyansh Batham Date: Fri, 18 Jan 2019 03:04:42 +0530 Subject: [PATCH 10/31] Update controllers.md (Grammatical Mistake) "... the server will *called* the index action..." => "... the server will **call** the index action..." --- docs/3.x.x/guides/controllers.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/3.x.x/guides/controllers.md b/docs/3.x.x/guides/controllers.md index 94644bf6ac..3677baad81 100644 --- a/docs/3.x.x/guides/controllers.md +++ b/docs/3.x.x/guides/controllers.md @@ -14,7 +14,7 @@ Each controller’s action must be an `async` function and receives the `context #### Example -In this example, we are defining a specific route in `./api/hello/config/routes.json` that takes `Hello.index` as handler. It means that every time a web browser is pointed to the `/hello` URL, the server will called the `index` action in the `Hello.js` controller. Our `index` action will return `Hello World!`. You can also return a JSON object. +In this example, we are defining a specific route in `./api/hello/config/routes.json` that takes `Hello.index` as handler. It means that every time a web browser is pointed to the `/hello` URL, the server will call the `index` action in the `Hello.js` controller. Our `index` action will return `Hello World!`. You can also return a JSON object. **Path —** `./api/hello/config/routes.json`. ```json From 178f77db2b8648c3c7c8b88bcf7b46658450a989 Mon Sep 17 00:00:00 2001 From: Jim LAURIE Date: Tue, 22 Jan 2019 14:31:19 +0100 Subject: [PATCH 11/31] Add migration guide to alpha.20 --- docs/3.x.x/migration-guide/README.md | 1 + .../migration-guide-alpha.19-to-alpha.20.md | 67 +++++++++++++++++++ 2 files changed, 68 insertions(+) create mode 100644 docs/3.x.x/migration-guide/migration-guide-alpha.19-to-alpha.20.md diff --git a/docs/3.x.x/migration-guide/README.md b/docs/3.x.x/migration-guide/README.md index c46bbaed4d..a2f9ce2ef0 100644 --- a/docs/3.x.x/migration-guide/README.md +++ b/docs/3.x.x/migration-guide/README.md @@ -25,3 +25,4 @@ - [Migration guide from alpha.16 to alpha.17](migration-guide-alpha.16-to-alpha.17.md) - [Migration guide from alpha.17 to alpha.18](migration-guide-alpha.17-to-alpha.18.md) - [Migration guide from alpha.18 to alpha.19](migration-guide-alpha.18-to-alpha.19.md) +- [Migration guide from alpha.19 to alpha.20](migration-guide-alpha.19-to-alpha.20.md) diff --git a/docs/3.x.x/migration-guide/migration-guide-alpha.19-to-alpha.20.md b/docs/3.x.x/migration-guide/migration-guide-alpha.19-to-alpha.20.md new file mode 100644 index 0000000000..f4afb99ad6 --- /dev/null +++ b/docs/3.x.x/migration-guide/migration-guide-alpha.19-to-alpha.20.md @@ -0,0 +1,67 @@ +# Migration guide from alpha.19 to alpha.20 + +**Here are the major changes:** + +- Fix email issue on user update +- Improve GraphQL performances + +**Useful links:** +- Changelog: [https://github.com/strapi/strapi/releases/tag/v3.0.0-alpha.20](https://github.com/strapi/strapi/releases/tag/v3.0.0-alpha.20) +- GitHub diff: [https://github.com/strapi/strapi/compare/v3.0.0-alpha.19...v3.0.0-alpha.20](https://github.com/strapi/strapi/compare/v3.0.0-alpha.19...v3.0.0-alpha.20) + +
+ +::: note +Feel free to [join us on Slack](http://slack.strapi.io) and ask questions about the migration process. +::: + +
+ +## Getting started + +Install Strapi `alpha.20` globally on your computer. To do so run `npm install strapi@3.0.0-alpha.20 -g`. + +When it's done, generate a new empty project `strapi new myNewProject` (don't pay attention to the database configuration). + +
+ +## Update node modules + +Update the Strapi's dependencies version (move Strapi's dependencies to `3.0.0-alpha.20` version) of your project. + +Run `npm install strapi@3.0.0-alpha.20 --save` to update your strapi version. + +
+ +## Update the Admin + +::: note +If you performed updates in the Admin, you will have to manually migrate your changes. +::: + +Delete your old admin folder and replace it with the new one. + +
+ +## Update the Plugins + +::: note +If you did a custom update on one of the plugins, you will have to manually migrate your update. +::: + +Copy the fields and relations you had in your `/plugins/users-permissions/models/User.settings.json` and `/plugins/users-permissions/config/jwt.json` file in the new one. + +Then, delete your old `plugins` folder and replace it with the new one. + +## Update services + +For both bookshelf and mongoose, you will have to update all services of your generated API. + +You will have to update one line of the `fetchAll` function. + +**Mongoose** replace `.populate(populate);` by `.populate(filters.populate || populate);`. +**Bookshelf**: replace `withRelated: populate` by `withRelated: filters.populate || populate`. + +
+ +That's all, you have now upgraded to Strapi `alpha.20`. From 25f21fae42c0ccdd3bfbca21a300942fd936769a Mon Sep 17 00:00:00 2001 From: Jim LAURIE Date: Tue, 22 Jan 2019 14:31:49 +0100 Subject: [PATCH 12/31] 3.0.0-alpha.20 --- package.json | 2 +- packages/strapi-admin/package.json | 6 ++--- packages/strapi-generate-admin/package.json | 6 ++--- packages/strapi-generate-api/package.json | 2 +- .../strapi-generate-controller/package.json | 2 +- packages/strapi-generate-model/package.json | 2 +- packages/strapi-generate-new/package.json | 4 ++-- packages/strapi-generate-plugin/package.json | 2 +- packages/strapi-generate-policy/package.json | 2 +- packages/strapi-generate-service/package.json | 2 +- packages/strapi-generate/package.json | 4 ++-- packages/strapi-helper-plugin/package.json | 2 +- packages/strapi-hook-bookshelf/package.json | 6 ++--- packages/strapi-hook-ejs/package.json | 2 +- packages/strapi-hook-knex/package.json | 2 +- packages/strapi-hook-mongoose/package.json | 4 ++-- packages/strapi-hook-redis/package.json | 4 ++-- packages/strapi-lint/package.json | 2 +- packages/strapi-middleware-views/package.json | 2 +- .../package.json | 4 ++-- .../package.json | 8 +++---- .../strapi-plugin-documentation/package.json | 4 ++-- packages/strapi-plugin-email/package.json | 6 ++--- packages/strapi-plugin-graphql/package.json | 4 ++-- .../package.json | 4 ++-- packages/strapi-plugin-upload/package.json | 6 ++--- .../package.json | 6 ++--- .../package.json | 2 +- .../package.json | 2 +- .../package.json | 2 +- .../package.json | 2 +- .../package.json | 2 +- .../package.json | 2 +- .../strapi-provider-upload-local/package.json | 2 +- .../package.json | 2 +- packages/strapi-utils/package.json | 2 +- packages/strapi/package.json | 22 +++++++++---------- 37 files changed, 70 insertions(+), 70 deletions(-) diff --git a/package.json b/package.json index 42d22a2447..beeea28f57 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "private": true, - "version": "3.0.0-alpha.19", + "version": "3.0.0-alpha.20", "dependencies": {}, "devDependencies": { "assert": "~1.3.0", diff --git a/packages/strapi-admin/package.json b/packages/strapi-admin/package.json index 2299547e38..6f6f8b333b 100644 --- a/packages/strapi-admin/package.json +++ b/packages/strapi-admin/package.json @@ -1,6 +1,6 @@ { "name": "strapi-admin", - "version": "3.0.0-alpha.19", + "version": "3.0.0-alpha.20", "description": "Strapi Admin", "repository": { "type": "git", @@ -31,8 +31,8 @@ }, "devDependencies": { "sanitize.css": "^4.1.0", - "strapi-helper-plugin": "3.0.0-alpha.19", - "strapi-utils": "3.0.0-alpha.19" + "strapi-helper-plugin": "3.0.0-alpha.20", + "strapi-utils": "3.0.0-alpha.20" }, "author": { "name": "Strapi", diff --git a/packages/strapi-generate-admin/package.json b/packages/strapi-generate-admin/package.json index 54de357e79..145b7a9866 100644 --- a/packages/strapi-generate-admin/package.json +++ b/packages/strapi-generate-admin/package.json @@ -1,6 +1,6 @@ { "name": "strapi-generate-admin", - "version": "3.0.0-alpha.19", + "version": "3.0.0-alpha.20", "description": "Generate the default admin panel for a Strapi application.", "homepage": "http://strapi.io", "keywords": [ @@ -15,8 +15,8 @@ "dependencies": { "fs-extra": "^4.0.1", "lodash": "^4.17.5", - "strapi-admin": "3.0.0-alpha.19", - "strapi-utils": "3.0.0-alpha.19" + "strapi-admin": "3.0.0-alpha.20", + "strapi-utils": "3.0.0-alpha.20" }, "author": { "email": "hi@strapi.io", diff --git a/packages/strapi-generate-api/package.json b/packages/strapi-generate-api/package.json index 80b73c7237..faeb114252 100644 --- a/packages/strapi-generate-api/package.json +++ b/packages/strapi-generate-api/package.json @@ -1,6 +1,6 @@ { "name": "strapi-generate-api", - "version": "3.0.0-alpha.19", + "version": "3.0.0-alpha.20", "description": "Generate an API for a Strapi application.", "homepage": "http://strapi.io", "keywords": [ diff --git a/packages/strapi-generate-controller/package.json b/packages/strapi-generate-controller/package.json index c9cb06ab00..4ef0c0aa99 100644 --- a/packages/strapi-generate-controller/package.json +++ b/packages/strapi-generate-controller/package.json @@ -1,6 +1,6 @@ { "name": "strapi-generate-controller", - "version": "3.0.0-alpha.19", + "version": "3.0.0-alpha.20", "description": "Generate a controller for a Strapi API.", "homepage": "http://strapi.io", "keywords": [ diff --git a/packages/strapi-generate-model/package.json b/packages/strapi-generate-model/package.json index 10b26801a3..a44a88d1bc 100644 --- a/packages/strapi-generate-model/package.json +++ b/packages/strapi-generate-model/package.json @@ -1,6 +1,6 @@ { "name": "strapi-generate-model", - "version": "3.0.0-alpha.19", + "version": "3.0.0-alpha.20", "description": "Generate a model for a Strapi API.", "homepage": "http://strapi.io", "keywords": [ diff --git a/packages/strapi-generate-new/package.json b/packages/strapi-generate-new/package.json index 09457e33a1..616c063e45 100644 --- a/packages/strapi-generate-new/package.json +++ b/packages/strapi-generate-new/package.json @@ -1,6 +1,6 @@ { "name": "strapi-generate-new", - "version": "3.0.0-alpha.19", + "version": "3.0.0-alpha.20", "description": "Generate a new Strapi application.", "homepage": "http://strapi.io", "keywords": [ @@ -20,7 +20,7 @@ "lodash": "^4.17.5", "ora": "^2.1.0", "request": "^2.88.0", - "strapi-utils": "3.0.0-alpha.19", + "strapi-utils": "3.0.0-alpha.20", "uuid": "^3.1.0" }, "scripts": { diff --git a/packages/strapi-generate-plugin/package.json b/packages/strapi-generate-plugin/package.json index 5860f2306a..d4b04355a2 100644 --- a/packages/strapi-generate-plugin/package.json +++ b/packages/strapi-generate-plugin/package.json @@ -1,6 +1,6 @@ { "name": "strapi-generate-plugin", - "version": "3.0.0-alpha.19", + "version": "3.0.0-alpha.20", "description": "Generate an plugin for a Strapi application.", "homepage": "http://strapi.io", "keywords": [ diff --git a/packages/strapi-generate-policy/package.json b/packages/strapi-generate-policy/package.json index cea23c27da..26b6064e7b 100644 --- a/packages/strapi-generate-policy/package.json +++ b/packages/strapi-generate-policy/package.json @@ -1,6 +1,6 @@ { "name": "strapi-generate-policy", - "version": "3.0.0-alpha.19", + "version": "3.0.0-alpha.20", "description": "Generate a policy for a Strapi API.", "homepage": "http://strapi.io", "keywords": [ diff --git a/packages/strapi-generate-service/package.json b/packages/strapi-generate-service/package.json index fc5a10e61d..85e7d71287 100644 --- a/packages/strapi-generate-service/package.json +++ b/packages/strapi-generate-service/package.json @@ -1,6 +1,6 @@ { "name": "strapi-generate-service", - "version": "3.0.0-alpha.19", + "version": "3.0.0-alpha.20", "description": "Generate a service for a Strapi API.", "homepage": "http://strapi.io", "keywords": [ diff --git a/packages/strapi-generate/package.json b/packages/strapi-generate/package.json index ff5c256d16..f17ab0a536 100644 --- a/packages/strapi-generate/package.json +++ b/packages/strapi-generate/package.json @@ -1,6 +1,6 @@ { "name": "strapi-generate", - "version": "3.0.0-alpha.19", + "version": "3.0.0-alpha.20", "description": "Master of ceremonies for the Strapi generators.", "homepage": "http://strapi.io", "keywords": [ @@ -17,7 +17,7 @@ "fs-extra": "^4.0.0", "lodash": "^4.17.5", "reportback": "^2.0.1", - "strapi-utils": "3.0.0-alpha.19" + "strapi-utils": "3.0.0-alpha.20" }, "author": { "name": "Strapi team", diff --git a/packages/strapi-helper-plugin/package.json b/packages/strapi-helper-plugin/package.json index 25ac5263e7..5753781979 100644 --- a/packages/strapi-helper-plugin/package.json +++ b/packages/strapi-helper-plugin/package.json @@ -1,6 +1,6 @@ { "name": "strapi-helper-plugin", - "version": "3.0.0-alpha.19", + "version": "3.0.0-alpha.20", "description": "Helper for Strapi plugins development", "engines": { "node": ">= 10.0.0", diff --git a/packages/strapi-hook-bookshelf/package.json b/packages/strapi-hook-bookshelf/package.json index e22975a8e6..98ee358cbc 100644 --- a/packages/strapi-hook-bookshelf/package.json +++ b/packages/strapi-hook-bookshelf/package.json @@ -1,6 +1,6 @@ { "name": "strapi-hook-bookshelf", - "version": "3.0.0-alpha.19", + "version": "3.0.0-alpha.20", "description": "Bookshelf hook for the Strapi framework", "homepage": "http://strapi.io", "keywords": [ @@ -21,8 +21,8 @@ "lodash": "^4.17.5", "pluralize": "^6.0.0", "rimraf": "^2.6.2", - "strapi-hook-knex": "3.0.0-alpha.19", - "strapi-utils": "3.0.0-alpha.19" + "strapi-hook-knex": "3.0.0-alpha.20", + "strapi-utils": "3.0.0-alpha.20" }, "strapi": { "dependencies": [ diff --git a/packages/strapi-hook-ejs/package.json b/packages/strapi-hook-ejs/package.json index 2c2c9f1886..329cb493f4 100644 --- a/packages/strapi-hook-ejs/package.json +++ b/packages/strapi-hook-ejs/package.json @@ -1,6 +1,6 @@ { "name": "strapi-hook-ejs", - "version": "3.0.0-alpha.19", + "version": "3.0.0-alpha.20", "description": "EJS hook for the Strapi framework", "homepage": "http://strapi.io", "keywords": [ diff --git a/packages/strapi-hook-knex/package.json b/packages/strapi-hook-knex/package.json index c6afce30e5..6cc279610b 100644 --- a/packages/strapi-hook-knex/package.json +++ b/packages/strapi-hook-knex/package.json @@ -1,6 +1,6 @@ { "name": "strapi-hook-knex", - "version": "3.0.0-alpha.19", + "version": "3.0.0-alpha.20", "description": "Knex hook for the Strapi framework", "homepage": "http://strapi.io", "keywords": [ diff --git a/packages/strapi-hook-mongoose/package.json b/packages/strapi-hook-mongoose/package.json index f8678381c7..56c5d235e3 100644 --- a/packages/strapi-hook-mongoose/package.json +++ b/packages/strapi-hook-mongoose/package.json @@ -1,6 +1,6 @@ { "name": "strapi-hook-mongoose", - "version": "3.0.0-alpha.19", + "version": "3.0.0-alpha.20", "description": "Mongoose hook for the Strapi framework", "homepage": "http://strapi.io", "keywords": [ @@ -20,7 +20,7 @@ "mongoose-float": "^1.0.3", "pluralize": "^6.0.0", "rimraf": "^2.6.2", - "strapi-utils": "3.0.0-alpha.19" + "strapi-utils": "3.0.0-alpha.20" }, "author": { "email": "hi@strapi.io", diff --git a/packages/strapi-hook-redis/package.json b/packages/strapi-hook-redis/package.json index 964ca648c5..0e4a23d7e6 100644 --- a/packages/strapi-hook-redis/package.json +++ b/packages/strapi-hook-redis/package.json @@ -1,6 +1,6 @@ { "name": "strapi-hook-redis", - "version": "3.0.0-alpha.19", + "version": "3.0.0-alpha.20", "description": "Redis hook for the Strapi framework", "homepage": "http://strapi.io", "keywords": [ @@ -19,7 +19,7 @@ "lodash": "^4.17.5", "rimraf": "^2.6.2", "stack-trace": "0.0.10", - "strapi-utils": "3.0.0-alpha.19" + "strapi-utils": "3.0.0-alpha.20" }, "author": { "email": "hi@strapi.io", diff --git a/packages/strapi-lint/package.json b/packages/strapi-lint/package.json index 9cbc4a447f..afaaba13c1 100644 --- a/packages/strapi-lint/package.json +++ b/packages/strapi-lint/package.json @@ -1,6 +1,6 @@ { "name": "strapi-lint", - "version": "3.0.0-alpha.19", + "version": "3.0.0-alpha.20", "description": "Strapi eslint and prettier configurations", "directories": { "lib": "lib" diff --git a/packages/strapi-middleware-views/package.json b/packages/strapi-middleware-views/package.json index 11fa8372bf..8d0b9b653e 100644 --- a/packages/strapi-middleware-views/package.json +++ b/packages/strapi-middleware-views/package.json @@ -1,6 +1,6 @@ { "name": "strapi-middleware-views", - "version": "3.0.0-alpha.19", + "version": "3.0.0-alpha.20", "description": "Views middleware to enable server-side rendering for the Strapi framework", "homepage": "http://strapi.io", "keywords": [ diff --git a/packages/strapi-plugin-content-manager/package.json b/packages/strapi-plugin-content-manager/package.json index 00b77c04e3..e3f2c79b32 100644 --- a/packages/strapi-plugin-content-manager/package.json +++ b/packages/strapi-plugin-content-manager/package.json @@ -1,6 +1,6 @@ { "name": "strapi-plugin-content-manager", - "version": "3.0.0-alpha.19", + "version": "3.0.0-alpha.20", "description": "A powerful UI to easily manage your data.", "strapi": { "name": "Content Manager", @@ -26,7 +26,7 @@ "draft-js": "^0.10.5", "react-select": "^1.2.1", "showdown": "^1.8.6", - "strapi-helper-plugin": "3.0.0-alpha.19" + "strapi-helper-plugin": "3.0.0-alpha.20" }, "dependencies": { "pluralize": "^7.0.0" diff --git a/packages/strapi-plugin-content-type-builder/package.json b/packages/strapi-plugin-content-type-builder/package.json index 9e4fc78981..15d5477248 100644 --- a/packages/strapi-plugin-content-type-builder/package.json +++ b/packages/strapi-plugin-content-type-builder/package.json @@ -1,6 +1,6 @@ { "name": "strapi-plugin-content-type-builder", - "version": "3.0.0-alpha.19", + "version": "3.0.0-alpha.20", "description": "Strapi plugin to create content type (API).", "strapi": { "name": "Content Type Builder", @@ -24,11 +24,11 @@ "dependencies": { "immutable": "^3.8.2", "pluralize": "^7.0.0", - "strapi-generate": "3.0.0-alpha.19", - "strapi-generate-api": "3.0.0-alpha.19" + "strapi-generate": "3.0.0-alpha.20", + "strapi-generate-api": "3.0.0-alpha.20" }, "devDependencies": { - "strapi-helper-plugin": "3.0.0-alpha.19" + "strapi-helper-plugin": "3.0.0-alpha.20" }, "author": { "name": "Strapi team", diff --git a/packages/strapi-plugin-documentation/package.json b/packages/strapi-plugin-documentation/package.json index 9573370bc6..f352716201 100755 --- a/packages/strapi-plugin-documentation/package.json +++ b/packages/strapi-plugin-documentation/package.json @@ -1,6 +1,6 @@ { "name": "strapi-plugin-documentation", - "version": "3.0.0-alpha.19", + "version": "3.0.0-alpha.20", "description": "This is the description of the plugin.", "strapi": { "name": "Documentation", @@ -29,7 +29,7 @@ "swagger-ui-dist": "^3.18.3-republish2" }, "devDependencies": { - "strapi-helper-plugin": "3.0.0-alpha.19" + "strapi-helper-plugin": "3.0.0-alpha.20" }, "author": { "name": "soupette", diff --git a/packages/strapi-plugin-email/package.json b/packages/strapi-plugin-email/package.json index 1049aa8d64..e7a6e43d2e 100644 --- a/packages/strapi-plugin-email/package.json +++ b/packages/strapi-plugin-email/package.json @@ -1,6 +1,6 @@ { "name": "strapi-plugin-email", - "version": "3.0.0-alpha.19", + "version": "3.0.0-alpha.20", "description": "This is the description of the plugin.", "strapi": { "name": "Email", @@ -22,11 +22,11 @@ "prepublishOnly": "IS_MONOREPO=true npm run build" }, "dependencies": { - "strapi-provider-email-sendmail": "3.0.0-alpha.19" + "strapi-provider-email-sendmail": "3.0.0-alpha.20" }, "devDependencies": { "react-copy-to-clipboard": "5.0.1", - "strapi-helper-plugin": "3.0.0-alpha.19" + "strapi-helper-plugin": "3.0.0-alpha.20" }, "author": { "name": "Strapi team", diff --git a/packages/strapi-plugin-graphql/package.json b/packages/strapi-plugin-graphql/package.json index 86927489bf..257805be1a 100644 --- a/packages/strapi-plugin-graphql/package.json +++ b/packages/strapi-plugin-graphql/package.json @@ -1,6 +1,6 @@ { "name": "strapi-plugin-graphql", - "version": "3.0.0-alpha.19", + "version": "3.0.0-alpha.20", "description": "This is the description of the plugin.", "strapi": { "name": "graphql", @@ -31,7 +31,7 @@ "graphql-type-datetime": "^0.2.2", "graphql-type-json": "^0.2.1", "pluralize": "^7.0.0", - "strapi-utils": "3.0.0-alpha.19" + "strapi-utils": "3.0.0-alpha.20" }, "author": { "name": "A Strapi developer", diff --git a/packages/strapi-plugin-settings-manager/package.json b/packages/strapi-plugin-settings-manager/package.json index 0890a67353..766adf0c13 100644 --- a/packages/strapi-plugin-settings-manager/package.json +++ b/packages/strapi-plugin-settings-manager/package.json @@ -1,6 +1,6 @@ { "name": "strapi-plugin-settings-manager", - "version": "3.0.0-alpha.19", + "version": "3.0.0-alpha.20", "description": "Strapi plugin to manage settings.", "strapi": { "name": "Settings Manager", @@ -25,7 +25,7 @@ "devDependencies": { "flag-icon-css": "^2.8.0", "react-select": "^1.0.0-rc.5", - "strapi-helper-plugin": "3.0.0-alpha.19" + "strapi-helper-plugin": "3.0.0-alpha.20" }, "author": { "name": "Strapi team", diff --git a/packages/strapi-plugin-upload/package.json b/packages/strapi-plugin-upload/package.json index 9b209cb4c7..ec7617daaa 100644 --- a/packages/strapi-plugin-upload/package.json +++ b/packages/strapi-plugin-upload/package.json @@ -1,6 +1,6 @@ { "name": "strapi-plugin-upload", - "version": "3.0.0-alpha.19", + "version": "3.0.0-alpha.20", "description": "This is the description of the plugin.", "strapi": { "name": "Files Upload", @@ -22,12 +22,12 @@ "prepublishOnly": "IS_MONOREPO=true npm run build" }, "dependencies": { - "strapi-provider-upload-local": "3.0.0-alpha.19", + "strapi-provider-upload-local": "3.0.0-alpha.20", "stream-to-array": "^2.3.0", "uuid": "^3.2.1" }, "devDependencies": { - "strapi-helper-plugin": "3.0.0-alpha.19" + "strapi-helper-plugin": "3.0.0-alpha.20" }, "author": { "name": "A Strapi developer", diff --git a/packages/strapi-plugin-users-permissions/package.json b/packages/strapi-plugin-users-permissions/package.json index 4b47e26de9..4e8eda289e 100644 --- a/packages/strapi-plugin-users-permissions/package.json +++ b/packages/strapi-plugin-users-permissions/package.json @@ -1,6 +1,6 @@ { "name": "strapi-plugin-users-permissions", - "version": "3.0.0-alpha.19", + "version": "3.0.0-alpha.20", "description": "Protect your API with a full-authentication process based on JWT", "strapi": { "name": "Roles & Permissions", @@ -29,11 +29,11 @@ "koa2-ratelimit": "^0.6.1", "purest": "^2.0.1", "request": "^2.83.0", - "strapi-utils": "3.0.0-alpha.19", + "strapi-utils": "3.0.0-alpha.20", "uuid": "^3.1.0" }, "devDependencies": { - "strapi-helper-plugin": "3.0.0-alpha.19" + "strapi-helper-plugin": "3.0.0-alpha.20" }, "author": { "name": "Strapi team", diff --git a/packages/strapi-provider-email-amazon-ses/package.json b/packages/strapi-provider-email-amazon-ses/package.json index 50a34dcebd..8e31c7fb68 100644 --- a/packages/strapi-provider-email-amazon-ses/package.json +++ b/packages/strapi-provider-email-amazon-ses/package.json @@ -1,6 +1,6 @@ { "name": "strapi-provider-email-amazon-ses", - "version": "3.0.0-alpha.19", + "version": "3.0.0-alpha.20", "description": "Amazon SES provider for strapi email", "homepage": "http://strapi.io", "keywords": [ diff --git a/packages/strapi-provider-email-mailgun/package.json b/packages/strapi-provider-email-mailgun/package.json index 3a50c7f4ae..d18977058e 100644 --- a/packages/strapi-provider-email-mailgun/package.json +++ b/packages/strapi-provider-email-mailgun/package.json @@ -1,6 +1,6 @@ { "name": "strapi-provider-email-mailgun", - "version": "3.0.0-alpha.19", + "version": "3.0.0-alpha.20", "description": "Mailgun provider for strapi email plugin", "homepage": "http://strapi.io", "keywords": [ diff --git a/packages/strapi-provider-email-sendgrid/package.json b/packages/strapi-provider-email-sendgrid/package.json index 3ee4e4004b..497925897e 100644 --- a/packages/strapi-provider-email-sendgrid/package.json +++ b/packages/strapi-provider-email-sendgrid/package.json @@ -1,6 +1,6 @@ { "name": "strapi-provider-email-sendgrid", - "version": "3.0.0-alpha.19", + "version": "3.0.0-alpha.20", "description": "Sendgrid provider for strapi email", "homepage": "http://strapi.io", "keywords": [ diff --git a/packages/strapi-provider-email-sendmail/package.json b/packages/strapi-provider-email-sendmail/package.json index ff825739be..388d1f8a98 100644 --- a/packages/strapi-provider-email-sendmail/package.json +++ b/packages/strapi-provider-email-sendmail/package.json @@ -1,6 +1,6 @@ { "name": "strapi-provider-email-sendmail", - "version": "3.0.0-alpha.19", + "version": "3.0.0-alpha.20", "description": "Sendmail provider for strapi email", "homepage": "http://strapi.io", "keywords": [ diff --git a/packages/strapi-provider-upload-aws-s3/package.json b/packages/strapi-provider-upload-aws-s3/package.json index 0706ad7bf9..45e0b33b2f 100644 --- a/packages/strapi-provider-upload-aws-s3/package.json +++ b/packages/strapi-provider-upload-aws-s3/package.json @@ -1,6 +1,6 @@ { "name": "strapi-provider-upload-aws-s3", - "version": "3.0.0-alpha.19", + "version": "3.0.0-alpha.20", "description": "AWS S3 provider for strapi upload", "homepage": "http://strapi.io", "keywords": [ diff --git a/packages/strapi-provider-upload-cloudinary/package.json b/packages/strapi-provider-upload-cloudinary/package.json index adcd163f5e..f19aadc78e 100644 --- a/packages/strapi-provider-upload-cloudinary/package.json +++ b/packages/strapi-provider-upload-cloudinary/package.json @@ -1,6 +1,6 @@ { "name": "strapi-provider-upload-cloudinary", - "version": "3.0.0-alpha.19", + "version": "3.0.0-alpha.20", "description": "Cloudinary provider for strapi upload", "homepage": "http://strapi.io", "keywords": [ diff --git a/packages/strapi-provider-upload-local/package.json b/packages/strapi-provider-upload-local/package.json index 63a302eea9..a86df28fed 100644 --- a/packages/strapi-provider-upload-local/package.json +++ b/packages/strapi-provider-upload-local/package.json @@ -1,6 +1,6 @@ { "name": "strapi-provider-upload-local", - "version": "3.0.0-alpha.19", + "version": "3.0.0-alpha.20", "description": "Local provider for strapi upload", "homepage": "http://strapi.io", "keywords": [ diff --git a/packages/strapi-provider-upload-rackspace/package.json b/packages/strapi-provider-upload-rackspace/package.json index 12e751a8e4..fb2c28825c 100644 --- a/packages/strapi-provider-upload-rackspace/package.json +++ b/packages/strapi-provider-upload-rackspace/package.json @@ -1,6 +1,6 @@ { "name": "strapi-provider-upload-rackspace", - "version": "3.0.0-alpha.19", + "version": "3.0.0-alpha.20", "description": "Rackspace provider for strapi upload", "main": "./lib", "scripts": { diff --git a/packages/strapi-utils/package.json b/packages/strapi-utils/package.json index a7185fd8e9..6ed18986a2 100644 --- a/packages/strapi-utils/package.json +++ b/packages/strapi-utils/package.json @@ -1,6 +1,6 @@ { "name": "strapi-utils", - "version": "3.0.0-alpha.19", + "version": "3.0.0-alpha.20", "description": "Shared utilities for the Strapi packages", "homepage": "http://strapi.io", "keywords": [ diff --git a/packages/strapi/package.json b/packages/strapi/package.json index 45977dddba..beba561a5d 100644 --- a/packages/strapi/package.json +++ b/packages/strapi/package.json @@ -1,6 +1,6 @@ { "name": "strapi", - "version": "3.0.0-alpha.19", + "version": "3.0.0-alpha.20", "description": "An open source solution to create and manage your own API. It provides a powerful dashboard and features to make your life easier.", "homepage": "http://strapi.io", "keywords": [ @@ -60,16 +60,16 @@ "rimraf": "^2.6.2", "semver": "^5.4.1", "stack-trace": "0.0.10", - "strapi-generate": "3.0.0-alpha.19", - "strapi-generate-admin": "3.0.0-alpha.19", - "strapi-generate-api": "3.0.0-alpha.19", - "strapi-generate-controller": "3.0.0-alpha.19", - "strapi-generate-model": "3.0.0-alpha.19", - "strapi-generate-new": "3.0.0-alpha.19", - "strapi-generate-plugin": "3.0.0-alpha.19", - "strapi-generate-policy": "3.0.0-alpha.19", - "strapi-generate-service": "3.0.0-alpha.19", - "strapi-utils": "3.0.0-alpha.19" + "strapi-generate": "3.0.0-alpha.20", + "strapi-generate-admin": "3.0.0-alpha.20", + "strapi-generate-api": "3.0.0-alpha.20", + "strapi-generate-controller": "3.0.0-alpha.20", + "strapi-generate-model": "3.0.0-alpha.20", + "strapi-generate-new": "3.0.0-alpha.20", + "strapi-generate-plugin": "3.0.0-alpha.20", + "strapi-generate-policy": "3.0.0-alpha.20", + "strapi-generate-service": "3.0.0-alpha.20", + "strapi-utils": "3.0.0-alpha.20" }, "author": { "email": "hi@strapi.io", From 13c54411a9307e4e0b68b53217db568c88028383 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Abd=C3=B3n=20Rodr=C3=ADguez=20Davila?= Date: Tue, 22 Jan 2019 23:33:09 +0100 Subject: [PATCH 13/31] Fix avoid write files if production mode --- packages/strapi/lib/core/admin.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/strapi/lib/core/admin.js b/packages/strapi/lib/core/admin.js index 1e2f91aca1..57f0b17fc9 100644 --- a/packages/strapi/lib/core/admin.js +++ b/packages/strapi/lib/core/admin.js @@ -66,6 +66,8 @@ module.exports = function() { resolve(); }); + } else { + resolve(); } }); }); From 6347a4a869d8e0d8365e3e75039da79eadda0e14 Mon Sep 17 00:00:00 2001 From: Jim LAURIE Date: Wed, 23 Jan 2019 11:14:00 +0100 Subject: [PATCH 14/31] Add new line --- packages/strapi-plugin-graphql/hooks/graphql/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/strapi-plugin-graphql/hooks/graphql/index.js b/packages/strapi-plugin-graphql/hooks/graphql/index.js index 3e5b802663..cd6dfbeb8b 100644 --- a/packages/strapi-plugin-graphql/hooks/graphql/index.js +++ b/packages/strapi-plugin-graphql/hooks/graphql/index.js @@ -174,6 +174,7 @@ module.exports = strapi => { serverParams.playground = { endpoint: strapi.plugins.graphql.config.endpoint, }; + serverParams.introspection = true; } From 0238257eec34b117c75c952f0875cf436567f9e0 Mon Sep 17 00:00:00 2001 From: Jim LAURIE Date: Wed, 23 Jan 2019 15:19:34 +0100 Subject: [PATCH 15/31] Fix get timestamp in the admin --- packages/strapi-hook-bookshelf/lib/index.js | 19 +++++++++++-------- packages/strapi-hook-mongoose/lib/index.js | 1 + .../config/functions/bootstrap.js | 8 +++++++- 3 files changed, 19 insertions(+), 9 deletions(-) diff --git a/packages/strapi-hook-bookshelf/lib/index.js b/packages/strapi-hook-bookshelf/lib/index.js index 794f82eb87..8643b4781e 100644 --- a/packages/strapi-hook-bookshelf/lib/index.js +++ b/packages/strapi-hook-bookshelf/lib/index.js @@ -86,6 +86,16 @@ module.exports = function(strapi) { primaryKey: 'id', primaryKeyType: _.get(definition, 'options.idAttributeType', 'integer') }); + + // Use default timestamp column names if value is `true` + if (_.get(definition, 'options.timestamps', false) === true) { + _.set(definition, 'options.timestamps', ['created_at', 'updated_at']); + } + // Use false for values other than `Boolean` or `Array` + if (!_.isArray(_.get(definition, 'options.timestamps')) && !_.isBoolean(_.get(definition, 'options.timestamps'))) { + _.set(definition, 'options.timestamps', false); + } + // Register the final model for Bookshelf. const loadedModel = _.assign({ tableName: definition.collectionName, @@ -100,14 +110,7 @@ module.exports = function(strapi) { return acc; }, {}) }, definition.options); - // Use default timestamp column names if value is `true` - if (_.get(loadedModel, 'hasTimestamps') === true) { - _.set(loadedModel, 'hasTimestamps', ['created_at', 'updated_at']); - } - // Use false for values other than `Boolean` or `Array` - if (!_.isArray(_.get(loadedModel, 'hasTimestamps')) && !_.isBoolean(_.get(loadedModel, 'hasTimestamps'))) { - _.set(loadedModel, 'hasTimestamps', false); - } + if (_.isString(_.get(connection, 'options.pivot_prefix'))) { loadedModel.toJSON = function(options = {}) { const { shallow = false, omitPivot = false } = options; diff --git a/packages/strapi-hook-mongoose/lib/index.js b/packages/strapi-hook-mongoose/lib/index.js index 972990cf0c..f89e89f385 100644 --- a/packages/strapi-hook-mongoose/lib/index.js +++ b/packages/strapi-hook-mongoose/lib/index.js @@ -216,6 +216,7 @@ module.exports = function (strapi) { collection.schema.set('timestamps', timestamps); } else { collection.schema.set('timestamps', _.get(definition, 'options.timestamps') === true); + _.set(definition, 'options.timestamps', _.get(definition, 'options.timestamps') === true ? ['createdAt', 'updatedAt'] : false); } collection.schema.set('minimize', _.get(definition, 'options.minimize', false) === true); diff --git a/packages/strapi-plugin-content-manager/config/functions/bootstrap.js b/packages/strapi-plugin-content-manager/config/functions/bootstrap.js index 3886c5b8cc..bdeb7759f2 100644 --- a/packages/strapi-plugin-content-manager/config/functions/bootstrap.js +++ b/packages/strapi-plugin-content-manager/config/functions/bootstrap.js @@ -17,7 +17,7 @@ const pickData = (model) => _.pick(model, [ 'globalId', 'globalName', 'orm', - 'options.timestamps', + 'options', 'loadedModel', 'primaryKey', 'associations' @@ -383,6 +383,12 @@ module.exports = async cb => { _.set(prevSchema.models, fieldsPath, currentFields); }); + schemaApis.map((model) => { + const isPlugin = model.includes('plugins.'); + _.set(prevSchema.models[model], 'info', _.get(!isPlugin ? strapi.models[model] : strapi[model], 'info')); + _.set(prevSchema.models[model], 'options', _.get(!isPlugin ? strapi.models[model] : strapi[model], 'options')); + }); + await pluginStore.set({ key: 'schema', value: prevSchema }); } catch(err) { From 5f8b4ae667b678aef6e184755da1f53386e1dfbf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Georget?= Date: Wed, 23 Jan 2019 15:33:30 +0100 Subject: [PATCH 16/31] Complete funnel --- .../controllers/ContentManager.js | 2 ++ .../controllers/ContentTypeBuilder.js | 4 ++++ .../controllers/UsersPermissions.js | 4 +++- .../services/UsersPermissions.js | 1 - 4 files changed, 9 insertions(+), 2 deletions(-) diff --git a/packages/strapi-plugin-content-manager/controllers/ContentManager.js b/packages/strapi-plugin-content-manager/controllers/ContentManager.js index 7a580cf982..c5700c8696 100644 --- a/packages/strapi-plugin-content-manager/controllers/ContentManager.js +++ b/packages/strapi-plugin-content-manager/controllers/ContentManager.js @@ -64,6 +64,8 @@ module.exports = { try { // Create an entry using `queries` system ctx.body = await strapi.plugins['content-manager'].services['contentmanager'].add(ctx.params, ctx.request.body, source); + + strapi.emit('didCreateFirstContentTypeEntry', ctx.params, source); } catch(error) { strapi.log.error(error); ctx.badRequest(null, ctx.request.admin ? [{ messages: [{ id: error.message, field: error.field }] }] : error.message); diff --git a/packages/strapi-plugin-content-type-builder/controllers/ContentTypeBuilder.js b/packages/strapi-plugin-content-type-builder/controllers/ContentTypeBuilder.js index 907caf2a25..ded45f0277 100644 --- a/packages/strapi-plugin-content-type-builder/controllers/ContentTypeBuilder.js +++ b/packages/strapi-plugin-content-type-builder/controllers/ContentTypeBuilder.js @@ -78,6 +78,10 @@ module.exports = { try { fs.writeFileSync(modelFilePath, JSON.stringify(modelJSON, null, 2), 'utf8'); + if (_.isEmpty(strapi.api)) { + strapi.emit('didCreateFirstContentType'); + } + ctx.send({ ok: true }); strapi.reload(); diff --git a/packages/strapi-plugin-users-permissions/controllers/UsersPermissions.js b/packages/strapi-plugin-users-permissions/controllers/UsersPermissions.js index d3a13ebfa0..0596df5e31 100644 --- a/packages/strapi-plugin-users-permissions/controllers/UsersPermissions.js +++ b/packages/strapi-plugin-users-permissions/controllers/UsersPermissions.js @@ -160,9 +160,11 @@ module.exports = { try { await strapi.plugins['users-permissions'].services.userspermissions.updateRole(roleID, ctx.request.body); + + strapi.emit('didOpenAccessToFetchContentTypeEntries', ctx.request.body); ctx.send({ ok: true }); - } catch(error) { + } catch (error) { ctx.badRequest(null, [{ messages: [{ id: 'An error occurred' }] }]); } }, diff --git a/packages/strapi-plugin-users-permissions/services/UsersPermissions.js b/packages/strapi-plugin-users-permissions/services/UsersPermissions.js index 6df284bd8e..d3b4d6ec1d 100644 --- a/packages/strapi-plugin-users-permissions/services/UsersPermissions.js +++ b/packages/strapi-plugin-users-permissions/services/UsersPermissions.js @@ -420,7 +420,6 @@ module.exports = { arrayOfPromises.push(this.updateUserRole(user, authenticated._id || authenticated.id)); }); - return Promise.all(arrayOfPromises); }, From 5e3772694622f6752c5908183fb691237aec10ad Mon Sep 17 00:00:00 2001 From: Jim LAURIE Date: Wed, 23 Jan 2019 16:27:05 +0100 Subject: [PATCH 17/31] Add migration to alpha.21 --- docs/3.x.x/migration-guide/README.md | 1 + .../migration-guide-alpha.20-to-alpha.21.md | 58 +++++++++++++++++++ 2 files changed, 59 insertions(+) create mode 100644 docs/3.x.x/migration-guide/migration-guide-alpha.20-to-alpha.21.md diff --git a/docs/3.x.x/migration-guide/README.md b/docs/3.x.x/migration-guide/README.md index a2f9ce2ef0..d3b9e3ebdd 100644 --- a/docs/3.x.x/migration-guide/README.md +++ b/docs/3.x.x/migration-guide/README.md @@ -26,3 +26,4 @@ - [Migration guide from alpha.17 to alpha.18](migration-guide-alpha.17-to-alpha.18.md) - [Migration guide from alpha.18 to alpha.19](migration-guide-alpha.18-to-alpha.19.md) - [Migration guide from alpha.19 to alpha.20](migration-guide-alpha.19-to-alpha.20.md) +- [Migration guide from alpha.20 to alpha.21](migration-guide-alpha.20-to-alpha.21.md) diff --git a/docs/3.x.x/migration-guide/migration-guide-alpha.20-to-alpha.21.md b/docs/3.x.x/migration-guide/migration-guide-alpha.20-to-alpha.21.md new file mode 100644 index 0000000000..a8629de4ee --- /dev/null +++ b/docs/3.x.x/migration-guide/migration-guide-alpha.20-to-alpha.21.md @@ -0,0 +1,58 @@ +# Migration guide from alpha.20 to alpha.21 + +**Here are the major changes:** + +- Fix timestamps issue about update data in MySQL +- Fix production start + +**Useful links:** +- Changelog: [https://github.com/strapi/strapi/releases/tag/v3.0.0-alpha.21](https://github.com/strapi/strapi/releases/tag/v3.0.0-alpha.21) +- GitHub diff: [https://github.com/strapi/strapi/compare/v3.0.0-alpha.20...v3.0.0-alpha.21](https://github.com/strapi/strapi/compare/v3.0.0-alpha.20...v3.0.0-alpha.21) + +
+ +::: note +Feel free to [join us on Slack](http://slack.strapi.io) and ask questions about the migration process. +::: + +
+ +## Getting started + +Install Strapi `alpha.21` globally on your computer. To do so run `npm install strapi@3.0.0-alpha.21 -g`. + +When it's done, generate a new empty project `strapi new myNewProject` (don't pay attention to the database configuration). + +
+ +## Update node modules + +Update the Strapi's dependencies version (move Strapi's dependencies to `3.0.0-alpha.21` version) of your project. + +Run `npm install strapi@3.0.0-alpha.21 --save` to update your strapi version. + +
+ +## Update the Admin + +::: note +If you performed updates in the Admin, you will have to manually migrate your changes. +::: + +Delete your old admin folder and replace it with the new one. + +
+ +## Update the Plugins + +::: note +If you did a custom update on one of the plugins, you will have to manually migrate your update. +::: + +Copy the fields and relations you had in your `/plugins/users-permissions/models/User.settings.json` and `/plugins/users-permissions/config/jwt.json` file in the new one. + +Then, delete your old `plugins` folder and replace it with the new one. + +
+ +That's all, you have now upgraded to Strapi `alpha.21`. From ee8c94f09f34fb6ff92fd976b949a3f4baa747a0 Mon Sep 17 00:00:00 2001 From: Jim LAURIE Date: Wed, 23 Jan 2019 16:27:46 +0100 Subject: [PATCH 18/31] 3.0.0-alpha.21 --- package.json | 2 +- packages/strapi-admin/package.json | 6 ++--- packages/strapi-generate-admin/package.json | 6 ++--- packages/strapi-generate-api/package.json | 2 +- .../strapi-generate-controller/package.json | 2 +- packages/strapi-generate-model/package.json | 2 +- packages/strapi-generate-new/package.json | 4 ++-- packages/strapi-generate-plugin/package.json | 2 +- packages/strapi-generate-policy/package.json | 2 +- packages/strapi-generate-service/package.json | 2 +- packages/strapi-generate/package.json | 4 ++-- packages/strapi-helper-plugin/package.json | 2 +- packages/strapi-hook-bookshelf/package.json | 6 ++--- packages/strapi-hook-ejs/package.json | 2 +- packages/strapi-hook-knex/package.json | 2 +- packages/strapi-hook-mongoose/package.json | 4 ++-- packages/strapi-hook-redis/package.json | 4 ++-- packages/strapi-lint/package.json | 2 +- packages/strapi-middleware-views/package.json | 2 +- .../package.json | 4 ++-- .../package.json | 8 +++---- .../strapi-plugin-documentation/package.json | 4 ++-- packages/strapi-plugin-email/package.json | 6 ++--- packages/strapi-plugin-graphql/package.json | 4 ++-- .../package.json | 4 ++-- packages/strapi-plugin-upload/package.json | 6 ++--- .../package.json | 6 ++--- .../package.json | 2 +- .../package.json | 2 +- .../package.json | 2 +- .../package.json | 2 +- .../package.json | 2 +- .../package.json | 2 +- .../strapi-provider-upload-local/package.json | 2 +- .../package.json | 2 +- packages/strapi-utils/package.json | 2 +- packages/strapi/package.json | 22 +++++++++---------- 37 files changed, 70 insertions(+), 70 deletions(-) diff --git a/package.json b/package.json index beeea28f57..e14809713c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "private": true, - "version": "3.0.0-alpha.20", + "version": "3.0.0-alpha.21", "dependencies": {}, "devDependencies": { "assert": "~1.3.0", diff --git a/packages/strapi-admin/package.json b/packages/strapi-admin/package.json index 6f6f8b333b..2146cdefe3 100644 --- a/packages/strapi-admin/package.json +++ b/packages/strapi-admin/package.json @@ -1,6 +1,6 @@ { "name": "strapi-admin", - "version": "3.0.0-alpha.20", + "version": "3.0.0-alpha.21", "description": "Strapi Admin", "repository": { "type": "git", @@ -31,8 +31,8 @@ }, "devDependencies": { "sanitize.css": "^4.1.0", - "strapi-helper-plugin": "3.0.0-alpha.20", - "strapi-utils": "3.0.0-alpha.20" + "strapi-helper-plugin": "3.0.0-alpha.21", + "strapi-utils": "3.0.0-alpha.21" }, "author": { "name": "Strapi", diff --git a/packages/strapi-generate-admin/package.json b/packages/strapi-generate-admin/package.json index 145b7a9866..a8c2f09f62 100644 --- a/packages/strapi-generate-admin/package.json +++ b/packages/strapi-generate-admin/package.json @@ -1,6 +1,6 @@ { "name": "strapi-generate-admin", - "version": "3.0.0-alpha.20", + "version": "3.0.0-alpha.21", "description": "Generate the default admin panel for a Strapi application.", "homepage": "http://strapi.io", "keywords": [ @@ -15,8 +15,8 @@ "dependencies": { "fs-extra": "^4.0.1", "lodash": "^4.17.5", - "strapi-admin": "3.0.0-alpha.20", - "strapi-utils": "3.0.0-alpha.20" + "strapi-admin": "3.0.0-alpha.21", + "strapi-utils": "3.0.0-alpha.21" }, "author": { "email": "hi@strapi.io", diff --git a/packages/strapi-generate-api/package.json b/packages/strapi-generate-api/package.json index faeb114252..cfcf46c462 100644 --- a/packages/strapi-generate-api/package.json +++ b/packages/strapi-generate-api/package.json @@ -1,6 +1,6 @@ { "name": "strapi-generate-api", - "version": "3.0.0-alpha.20", + "version": "3.0.0-alpha.21", "description": "Generate an API for a Strapi application.", "homepage": "http://strapi.io", "keywords": [ diff --git a/packages/strapi-generate-controller/package.json b/packages/strapi-generate-controller/package.json index 4ef0c0aa99..034e02fddd 100644 --- a/packages/strapi-generate-controller/package.json +++ b/packages/strapi-generate-controller/package.json @@ -1,6 +1,6 @@ { "name": "strapi-generate-controller", - "version": "3.0.0-alpha.20", + "version": "3.0.0-alpha.21", "description": "Generate a controller for a Strapi API.", "homepage": "http://strapi.io", "keywords": [ diff --git a/packages/strapi-generate-model/package.json b/packages/strapi-generate-model/package.json index a44a88d1bc..e6e4f57392 100644 --- a/packages/strapi-generate-model/package.json +++ b/packages/strapi-generate-model/package.json @@ -1,6 +1,6 @@ { "name": "strapi-generate-model", - "version": "3.0.0-alpha.20", + "version": "3.0.0-alpha.21", "description": "Generate a model for a Strapi API.", "homepage": "http://strapi.io", "keywords": [ diff --git a/packages/strapi-generate-new/package.json b/packages/strapi-generate-new/package.json index 616c063e45..a231e8943d 100644 --- a/packages/strapi-generate-new/package.json +++ b/packages/strapi-generate-new/package.json @@ -1,6 +1,6 @@ { "name": "strapi-generate-new", - "version": "3.0.0-alpha.20", + "version": "3.0.0-alpha.21", "description": "Generate a new Strapi application.", "homepage": "http://strapi.io", "keywords": [ @@ -20,7 +20,7 @@ "lodash": "^4.17.5", "ora": "^2.1.0", "request": "^2.88.0", - "strapi-utils": "3.0.0-alpha.20", + "strapi-utils": "3.0.0-alpha.21", "uuid": "^3.1.0" }, "scripts": { diff --git a/packages/strapi-generate-plugin/package.json b/packages/strapi-generate-plugin/package.json index d4b04355a2..5ea99d8413 100644 --- a/packages/strapi-generate-plugin/package.json +++ b/packages/strapi-generate-plugin/package.json @@ -1,6 +1,6 @@ { "name": "strapi-generate-plugin", - "version": "3.0.0-alpha.20", + "version": "3.0.0-alpha.21", "description": "Generate an plugin for a Strapi application.", "homepage": "http://strapi.io", "keywords": [ diff --git a/packages/strapi-generate-policy/package.json b/packages/strapi-generate-policy/package.json index 26b6064e7b..0dc5a57f15 100644 --- a/packages/strapi-generate-policy/package.json +++ b/packages/strapi-generate-policy/package.json @@ -1,6 +1,6 @@ { "name": "strapi-generate-policy", - "version": "3.0.0-alpha.20", + "version": "3.0.0-alpha.21", "description": "Generate a policy for a Strapi API.", "homepage": "http://strapi.io", "keywords": [ diff --git a/packages/strapi-generate-service/package.json b/packages/strapi-generate-service/package.json index 85e7d71287..d4da4b5a8e 100644 --- a/packages/strapi-generate-service/package.json +++ b/packages/strapi-generate-service/package.json @@ -1,6 +1,6 @@ { "name": "strapi-generate-service", - "version": "3.0.0-alpha.20", + "version": "3.0.0-alpha.21", "description": "Generate a service for a Strapi API.", "homepage": "http://strapi.io", "keywords": [ diff --git a/packages/strapi-generate/package.json b/packages/strapi-generate/package.json index f17ab0a536..15a42cd28e 100644 --- a/packages/strapi-generate/package.json +++ b/packages/strapi-generate/package.json @@ -1,6 +1,6 @@ { "name": "strapi-generate", - "version": "3.0.0-alpha.20", + "version": "3.0.0-alpha.21", "description": "Master of ceremonies for the Strapi generators.", "homepage": "http://strapi.io", "keywords": [ @@ -17,7 +17,7 @@ "fs-extra": "^4.0.0", "lodash": "^4.17.5", "reportback": "^2.0.1", - "strapi-utils": "3.0.0-alpha.20" + "strapi-utils": "3.0.0-alpha.21" }, "author": { "name": "Strapi team", diff --git a/packages/strapi-helper-plugin/package.json b/packages/strapi-helper-plugin/package.json index 5753781979..47afd44fe0 100644 --- a/packages/strapi-helper-plugin/package.json +++ b/packages/strapi-helper-plugin/package.json @@ -1,6 +1,6 @@ { "name": "strapi-helper-plugin", - "version": "3.0.0-alpha.20", + "version": "3.0.0-alpha.21", "description": "Helper for Strapi plugins development", "engines": { "node": ">= 10.0.0", diff --git a/packages/strapi-hook-bookshelf/package.json b/packages/strapi-hook-bookshelf/package.json index 98ee358cbc..cc88d3e9bf 100644 --- a/packages/strapi-hook-bookshelf/package.json +++ b/packages/strapi-hook-bookshelf/package.json @@ -1,6 +1,6 @@ { "name": "strapi-hook-bookshelf", - "version": "3.0.0-alpha.20", + "version": "3.0.0-alpha.21", "description": "Bookshelf hook for the Strapi framework", "homepage": "http://strapi.io", "keywords": [ @@ -21,8 +21,8 @@ "lodash": "^4.17.5", "pluralize": "^6.0.0", "rimraf": "^2.6.2", - "strapi-hook-knex": "3.0.0-alpha.20", - "strapi-utils": "3.0.0-alpha.20" + "strapi-hook-knex": "3.0.0-alpha.21", + "strapi-utils": "3.0.0-alpha.21" }, "strapi": { "dependencies": [ diff --git a/packages/strapi-hook-ejs/package.json b/packages/strapi-hook-ejs/package.json index 329cb493f4..8e6f07809c 100644 --- a/packages/strapi-hook-ejs/package.json +++ b/packages/strapi-hook-ejs/package.json @@ -1,6 +1,6 @@ { "name": "strapi-hook-ejs", - "version": "3.0.0-alpha.20", + "version": "3.0.0-alpha.21", "description": "EJS hook for the Strapi framework", "homepage": "http://strapi.io", "keywords": [ diff --git a/packages/strapi-hook-knex/package.json b/packages/strapi-hook-knex/package.json index 7d1c37c995..3c51922bd6 100644 --- a/packages/strapi-hook-knex/package.json +++ b/packages/strapi-hook-knex/package.json @@ -1,6 +1,6 @@ { "name": "strapi-hook-knex", - "version": "3.0.0-alpha.20", + "version": "3.0.0-alpha.21", "description": "Knex hook for the Strapi framework", "homepage": "http://strapi.io", "keywords": [ diff --git a/packages/strapi-hook-mongoose/package.json b/packages/strapi-hook-mongoose/package.json index 56c5d235e3..ee6d19100d 100644 --- a/packages/strapi-hook-mongoose/package.json +++ b/packages/strapi-hook-mongoose/package.json @@ -1,6 +1,6 @@ { "name": "strapi-hook-mongoose", - "version": "3.0.0-alpha.20", + "version": "3.0.0-alpha.21", "description": "Mongoose hook for the Strapi framework", "homepage": "http://strapi.io", "keywords": [ @@ -20,7 +20,7 @@ "mongoose-float": "^1.0.3", "pluralize": "^6.0.0", "rimraf": "^2.6.2", - "strapi-utils": "3.0.0-alpha.20" + "strapi-utils": "3.0.0-alpha.21" }, "author": { "email": "hi@strapi.io", diff --git a/packages/strapi-hook-redis/package.json b/packages/strapi-hook-redis/package.json index 0e4a23d7e6..5f207293a1 100644 --- a/packages/strapi-hook-redis/package.json +++ b/packages/strapi-hook-redis/package.json @@ -1,6 +1,6 @@ { "name": "strapi-hook-redis", - "version": "3.0.0-alpha.20", + "version": "3.0.0-alpha.21", "description": "Redis hook for the Strapi framework", "homepage": "http://strapi.io", "keywords": [ @@ -19,7 +19,7 @@ "lodash": "^4.17.5", "rimraf": "^2.6.2", "stack-trace": "0.0.10", - "strapi-utils": "3.0.0-alpha.20" + "strapi-utils": "3.0.0-alpha.21" }, "author": { "email": "hi@strapi.io", diff --git a/packages/strapi-lint/package.json b/packages/strapi-lint/package.json index afaaba13c1..8674a03c36 100644 --- a/packages/strapi-lint/package.json +++ b/packages/strapi-lint/package.json @@ -1,6 +1,6 @@ { "name": "strapi-lint", - "version": "3.0.0-alpha.20", + "version": "3.0.0-alpha.21", "description": "Strapi eslint and prettier configurations", "directories": { "lib": "lib" diff --git a/packages/strapi-middleware-views/package.json b/packages/strapi-middleware-views/package.json index 8d0b9b653e..8326cdbc26 100644 --- a/packages/strapi-middleware-views/package.json +++ b/packages/strapi-middleware-views/package.json @@ -1,6 +1,6 @@ { "name": "strapi-middleware-views", - "version": "3.0.0-alpha.20", + "version": "3.0.0-alpha.21", "description": "Views middleware to enable server-side rendering for the Strapi framework", "homepage": "http://strapi.io", "keywords": [ diff --git a/packages/strapi-plugin-content-manager/package.json b/packages/strapi-plugin-content-manager/package.json index e3f2c79b32..04e197902f 100644 --- a/packages/strapi-plugin-content-manager/package.json +++ b/packages/strapi-plugin-content-manager/package.json @@ -1,6 +1,6 @@ { "name": "strapi-plugin-content-manager", - "version": "3.0.0-alpha.20", + "version": "3.0.0-alpha.21", "description": "A powerful UI to easily manage your data.", "strapi": { "name": "Content Manager", @@ -26,7 +26,7 @@ "draft-js": "^0.10.5", "react-select": "^1.2.1", "showdown": "^1.8.6", - "strapi-helper-plugin": "3.0.0-alpha.20" + "strapi-helper-plugin": "3.0.0-alpha.21" }, "dependencies": { "pluralize": "^7.0.0" diff --git a/packages/strapi-plugin-content-type-builder/package.json b/packages/strapi-plugin-content-type-builder/package.json index 15d5477248..8cdebb552a 100644 --- a/packages/strapi-plugin-content-type-builder/package.json +++ b/packages/strapi-plugin-content-type-builder/package.json @@ -1,6 +1,6 @@ { "name": "strapi-plugin-content-type-builder", - "version": "3.0.0-alpha.20", + "version": "3.0.0-alpha.21", "description": "Strapi plugin to create content type (API).", "strapi": { "name": "Content Type Builder", @@ -24,11 +24,11 @@ "dependencies": { "immutable": "^3.8.2", "pluralize": "^7.0.0", - "strapi-generate": "3.0.0-alpha.20", - "strapi-generate-api": "3.0.0-alpha.20" + "strapi-generate": "3.0.0-alpha.21", + "strapi-generate-api": "3.0.0-alpha.21" }, "devDependencies": { - "strapi-helper-plugin": "3.0.0-alpha.20" + "strapi-helper-plugin": "3.0.0-alpha.21" }, "author": { "name": "Strapi team", diff --git a/packages/strapi-plugin-documentation/package.json b/packages/strapi-plugin-documentation/package.json index f352716201..6bda71f8b7 100755 --- a/packages/strapi-plugin-documentation/package.json +++ b/packages/strapi-plugin-documentation/package.json @@ -1,6 +1,6 @@ { "name": "strapi-plugin-documentation", - "version": "3.0.0-alpha.20", + "version": "3.0.0-alpha.21", "description": "This is the description of the plugin.", "strapi": { "name": "Documentation", @@ -29,7 +29,7 @@ "swagger-ui-dist": "^3.18.3-republish2" }, "devDependencies": { - "strapi-helper-plugin": "3.0.0-alpha.20" + "strapi-helper-plugin": "3.0.0-alpha.21" }, "author": { "name": "soupette", diff --git a/packages/strapi-plugin-email/package.json b/packages/strapi-plugin-email/package.json index e7a6e43d2e..23b94c30f4 100644 --- a/packages/strapi-plugin-email/package.json +++ b/packages/strapi-plugin-email/package.json @@ -1,6 +1,6 @@ { "name": "strapi-plugin-email", - "version": "3.0.0-alpha.20", + "version": "3.0.0-alpha.21", "description": "This is the description of the plugin.", "strapi": { "name": "Email", @@ -22,11 +22,11 @@ "prepublishOnly": "IS_MONOREPO=true npm run build" }, "dependencies": { - "strapi-provider-email-sendmail": "3.0.0-alpha.20" + "strapi-provider-email-sendmail": "3.0.0-alpha.21" }, "devDependencies": { "react-copy-to-clipboard": "5.0.1", - "strapi-helper-plugin": "3.0.0-alpha.20" + "strapi-helper-plugin": "3.0.0-alpha.21" }, "author": { "name": "Strapi team", diff --git a/packages/strapi-plugin-graphql/package.json b/packages/strapi-plugin-graphql/package.json index 257805be1a..6641fa7cc9 100644 --- a/packages/strapi-plugin-graphql/package.json +++ b/packages/strapi-plugin-graphql/package.json @@ -1,6 +1,6 @@ { "name": "strapi-plugin-graphql", - "version": "3.0.0-alpha.20", + "version": "3.0.0-alpha.21", "description": "This is the description of the plugin.", "strapi": { "name": "graphql", @@ -31,7 +31,7 @@ "graphql-type-datetime": "^0.2.2", "graphql-type-json": "^0.2.1", "pluralize": "^7.0.0", - "strapi-utils": "3.0.0-alpha.20" + "strapi-utils": "3.0.0-alpha.21" }, "author": { "name": "A Strapi developer", diff --git a/packages/strapi-plugin-settings-manager/package.json b/packages/strapi-plugin-settings-manager/package.json index 766adf0c13..4b4f23c09d 100644 --- a/packages/strapi-plugin-settings-manager/package.json +++ b/packages/strapi-plugin-settings-manager/package.json @@ -1,6 +1,6 @@ { "name": "strapi-plugin-settings-manager", - "version": "3.0.0-alpha.20", + "version": "3.0.0-alpha.21", "description": "Strapi plugin to manage settings.", "strapi": { "name": "Settings Manager", @@ -25,7 +25,7 @@ "devDependencies": { "flag-icon-css": "^2.8.0", "react-select": "^1.0.0-rc.5", - "strapi-helper-plugin": "3.0.0-alpha.20" + "strapi-helper-plugin": "3.0.0-alpha.21" }, "author": { "name": "Strapi team", diff --git a/packages/strapi-plugin-upload/package.json b/packages/strapi-plugin-upload/package.json index ec7617daaa..cd15c9cebc 100644 --- a/packages/strapi-plugin-upload/package.json +++ b/packages/strapi-plugin-upload/package.json @@ -1,6 +1,6 @@ { "name": "strapi-plugin-upload", - "version": "3.0.0-alpha.20", + "version": "3.0.0-alpha.21", "description": "This is the description of the plugin.", "strapi": { "name": "Files Upload", @@ -22,12 +22,12 @@ "prepublishOnly": "IS_MONOREPO=true npm run build" }, "dependencies": { - "strapi-provider-upload-local": "3.0.0-alpha.20", + "strapi-provider-upload-local": "3.0.0-alpha.21", "stream-to-array": "^2.3.0", "uuid": "^3.2.1" }, "devDependencies": { - "strapi-helper-plugin": "3.0.0-alpha.20" + "strapi-helper-plugin": "3.0.0-alpha.21" }, "author": { "name": "A Strapi developer", diff --git a/packages/strapi-plugin-users-permissions/package.json b/packages/strapi-plugin-users-permissions/package.json index 4e8eda289e..0976092150 100644 --- a/packages/strapi-plugin-users-permissions/package.json +++ b/packages/strapi-plugin-users-permissions/package.json @@ -1,6 +1,6 @@ { "name": "strapi-plugin-users-permissions", - "version": "3.0.0-alpha.20", + "version": "3.0.0-alpha.21", "description": "Protect your API with a full-authentication process based on JWT", "strapi": { "name": "Roles & Permissions", @@ -29,11 +29,11 @@ "koa2-ratelimit": "^0.6.1", "purest": "^2.0.1", "request": "^2.83.0", - "strapi-utils": "3.0.0-alpha.20", + "strapi-utils": "3.0.0-alpha.21", "uuid": "^3.1.0" }, "devDependencies": { - "strapi-helper-plugin": "3.0.0-alpha.20" + "strapi-helper-plugin": "3.0.0-alpha.21" }, "author": { "name": "Strapi team", diff --git a/packages/strapi-provider-email-amazon-ses/package.json b/packages/strapi-provider-email-amazon-ses/package.json index 8e31c7fb68..0098b45b23 100644 --- a/packages/strapi-provider-email-amazon-ses/package.json +++ b/packages/strapi-provider-email-amazon-ses/package.json @@ -1,6 +1,6 @@ { "name": "strapi-provider-email-amazon-ses", - "version": "3.0.0-alpha.20", + "version": "3.0.0-alpha.21", "description": "Amazon SES provider for strapi email", "homepage": "http://strapi.io", "keywords": [ diff --git a/packages/strapi-provider-email-mailgun/package.json b/packages/strapi-provider-email-mailgun/package.json index d18977058e..929fbfc309 100644 --- a/packages/strapi-provider-email-mailgun/package.json +++ b/packages/strapi-provider-email-mailgun/package.json @@ -1,6 +1,6 @@ { "name": "strapi-provider-email-mailgun", - "version": "3.0.0-alpha.20", + "version": "3.0.0-alpha.21", "description": "Mailgun provider for strapi email plugin", "homepage": "http://strapi.io", "keywords": [ diff --git a/packages/strapi-provider-email-sendgrid/package.json b/packages/strapi-provider-email-sendgrid/package.json index 497925897e..79cfa053cd 100644 --- a/packages/strapi-provider-email-sendgrid/package.json +++ b/packages/strapi-provider-email-sendgrid/package.json @@ -1,6 +1,6 @@ { "name": "strapi-provider-email-sendgrid", - "version": "3.0.0-alpha.20", + "version": "3.0.0-alpha.21", "description": "Sendgrid provider for strapi email", "homepage": "http://strapi.io", "keywords": [ diff --git a/packages/strapi-provider-email-sendmail/package.json b/packages/strapi-provider-email-sendmail/package.json index 388d1f8a98..b7e1379087 100644 --- a/packages/strapi-provider-email-sendmail/package.json +++ b/packages/strapi-provider-email-sendmail/package.json @@ -1,6 +1,6 @@ { "name": "strapi-provider-email-sendmail", - "version": "3.0.0-alpha.20", + "version": "3.0.0-alpha.21", "description": "Sendmail provider for strapi email", "homepage": "http://strapi.io", "keywords": [ diff --git a/packages/strapi-provider-upload-aws-s3/package.json b/packages/strapi-provider-upload-aws-s3/package.json index 45e0b33b2f..43a74aa6a7 100644 --- a/packages/strapi-provider-upload-aws-s3/package.json +++ b/packages/strapi-provider-upload-aws-s3/package.json @@ -1,6 +1,6 @@ { "name": "strapi-provider-upload-aws-s3", - "version": "3.0.0-alpha.20", + "version": "3.0.0-alpha.21", "description": "AWS S3 provider for strapi upload", "homepage": "http://strapi.io", "keywords": [ diff --git a/packages/strapi-provider-upload-cloudinary/package.json b/packages/strapi-provider-upload-cloudinary/package.json index f19aadc78e..20465e1c61 100644 --- a/packages/strapi-provider-upload-cloudinary/package.json +++ b/packages/strapi-provider-upload-cloudinary/package.json @@ -1,6 +1,6 @@ { "name": "strapi-provider-upload-cloudinary", - "version": "3.0.0-alpha.20", + "version": "3.0.0-alpha.21", "description": "Cloudinary provider for strapi upload", "homepage": "http://strapi.io", "keywords": [ diff --git a/packages/strapi-provider-upload-local/package.json b/packages/strapi-provider-upload-local/package.json index a86df28fed..85a26e1db9 100644 --- a/packages/strapi-provider-upload-local/package.json +++ b/packages/strapi-provider-upload-local/package.json @@ -1,6 +1,6 @@ { "name": "strapi-provider-upload-local", - "version": "3.0.0-alpha.20", + "version": "3.0.0-alpha.21", "description": "Local provider for strapi upload", "homepage": "http://strapi.io", "keywords": [ diff --git a/packages/strapi-provider-upload-rackspace/package.json b/packages/strapi-provider-upload-rackspace/package.json index fb2c28825c..4c60218b97 100644 --- a/packages/strapi-provider-upload-rackspace/package.json +++ b/packages/strapi-provider-upload-rackspace/package.json @@ -1,6 +1,6 @@ { "name": "strapi-provider-upload-rackspace", - "version": "3.0.0-alpha.20", + "version": "3.0.0-alpha.21", "description": "Rackspace provider for strapi upload", "main": "./lib", "scripts": { diff --git a/packages/strapi-utils/package.json b/packages/strapi-utils/package.json index 7d0a2241a5..c47a7c1ad8 100644 --- a/packages/strapi-utils/package.json +++ b/packages/strapi-utils/package.json @@ -1,6 +1,6 @@ { "name": "strapi-utils", - "version": "3.0.0-alpha.20", + "version": "3.0.0-alpha.21", "description": "Shared utilities for the Strapi packages", "homepage": "http://strapi.io", "keywords": [ diff --git a/packages/strapi/package.json b/packages/strapi/package.json index beba561a5d..e3c641a254 100644 --- a/packages/strapi/package.json +++ b/packages/strapi/package.json @@ -1,6 +1,6 @@ { "name": "strapi", - "version": "3.0.0-alpha.20", + "version": "3.0.0-alpha.21", "description": "An open source solution to create and manage your own API. It provides a powerful dashboard and features to make your life easier.", "homepage": "http://strapi.io", "keywords": [ @@ -60,16 +60,16 @@ "rimraf": "^2.6.2", "semver": "^5.4.1", "stack-trace": "0.0.10", - "strapi-generate": "3.0.0-alpha.20", - "strapi-generate-admin": "3.0.0-alpha.20", - "strapi-generate-api": "3.0.0-alpha.20", - "strapi-generate-controller": "3.0.0-alpha.20", - "strapi-generate-model": "3.0.0-alpha.20", - "strapi-generate-new": "3.0.0-alpha.20", - "strapi-generate-plugin": "3.0.0-alpha.20", - "strapi-generate-policy": "3.0.0-alpha.20", - "strapi-generate-service": "3.0.0-alpha.20", - "strapi-utils": "3.0.0-alpha.20" + "strapi-generate": "3.0.0-alpha.21", + "strapi-generate-admin": "3.0.0-alpha.21", + "strapi-generate-api": "3.0.0-alpha.21", + "strapi-generate-controller": "3.0.0-alpha.21", + "strapi-generate-model": "3.0.0-alpha.21", + "strapi-generate-new": "3.0.0-alpha.21", + "strapi-generate-plugin": "3.0.0-alpha.21", + "strapi-generate-policy": "3.0.0-alpha.21", + "strapi-generate-service": "3.0.0-alpha.21", + "strapi-utils": "3.0.0-alpha.21" }, "author": { "email": "hi@strapi.io", From 2115124931976f7a31490b721d9a5b7138410036 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Georget?= Date: Wed, 23 Jan 2019 16:56:04 +0100 Subject: [PATCH 19/31] Remove Mongoose warning logs --- .../templates/mongoose/service.template | 4 ++-- packages/strapi-hook-mongoose/lib/index.js | 5 ++++- packages/strapi-hook-mongoose/lib/relations.js | 2 +- .../config/queries/mongoose.js | 6 +++--- packages/strapi-plugin-email/config/queries/mongoose.js | 6 +++--- packages/strapi-plugin-upload/config/queries/mongoose.js | 4 ++-- .../config/queries/mongoose.js | 8 ++++---- packages/strapi/lib/core/store.js | 2 +- 8 files changed, 20 insertions(+), 17 deletions(-) diff --git a/packages/strapi-generate-api/templates/mongoose/service.template b/packages/strapi-generate-api/templates/mongoose/service.template index bf41c3a199..afe2c1dffd 100644 --- a/packages/strapi-generate-api/templates/mongoose/service.template +++ b/packages/strapi-generate-api/templates/mongoose/service.template @@ -64,7 +64,7 @@ module.exports = { const filters = strapi.utils.models.convertParams('<%= globalID.toLowerCase() %>', params); return <%= globalID %> - .count() + .countDocuments() .where(filters.where); }, @@ -98,7 +98,7 @@ module.exports = { const data = _.omit(values, <%= globalID %>.associations.map(a => a.alias)); // Update entry with no-relational data. - const entry = await <%= globalID %>.update(params, data, { multi: true }); + const entry = await <%= globalID %>.updateOne(params, data, { multi: true }); // Update relational data and return the entry. return <%= globalID %>.updateRelations(Object.assign(params, { values: relations })); diff --git a/packages/strapi-hook-mongoose/lib/index.js b/packages/strapi-hook-mongoose/lib/index.js index f89e89f385..529743a023 100644 --- a/packages/strapi-hook-mongoose/lib/index.js +++ b/packages/strapi-hook-mongoose/lib/index.js @@ -60,7 +60,9 @@ module.exports = function (strapi) { // Connect to mongo database const connectOptions = {}; - const options = {}; + const options = { + useFindAndModify: false + }; if (!_.isEmpty(username)) { connectOptions.user = username; @@ -77,6 +79,7 @@ module.exports = function (strapi) { connectOptions.ssl = ssl === true || ssl === 'true'; connectOptions.useNewUrlParser = true; connectOptions.dbName = database; + connectOptions.useCreateIndex = true; options.debug = debug === true || debug === 'true'; diff --git a/packages/strapi-hook-mongoose/lib/relations.js b/packages/strapi-hook-mongoose/lib/relations.js index a2db86576c..4cdd4429f1 100644 --- a/packages/strapi-hook-mongoose/lib/relations.js +++ b/packages/strapi-hook-mongoose/lib/relations.js @@ -239,7 +239,7 @@ module.exports = { virtualFields.push( this - .update({ + .updateOne({ [this.primaryKey]: getValuePrimaryKey(params, this.primaryKey) }, values, { strict: false diff --git a/packages/strapi-plugin-content-manager/config/queries/mongoose.js b/packages/strapi-plugin-content-manager/config/queries/mongoose.js index 27a4ca6ad8..a3dabbdb35 100644 --- a/packages/strapi-plugin-content-manager/config/queries/mongoose.js +++ b/packages/strapi-plugin-content-manager/config/queries/mongoose.js @@ -15,7 +15,7 @@ module.exports = { count: async function (params) { return Number(await this .where(params.where) - .count()); + .countDocuments()); }, search: async function (params, populate) { // eslint-disable-line no-unused-vars @@ -81,7 +81,7 @@ module.exports = { return this .find({ $or }) - .count(); + .countDocuments(); }, findOne: async function (params, populate, raw = true) { @@ -150,7 +150,7 @@ module.exports = { deleteMany: async function (params) { return this - .remove({ + .deleteMany({ [this.primaryKey]: { $in: params[this.primaryKey] || params.id } diff --git a/packages/strapi-plugin-email/config/queries/mongoose.js b/packages/strapi-plugin-email/config/queries/mongoose.js index 8f7ebbebd6..620cd2cf1b 100644 --- a/packages/strapi-plugin-email/config/queries/mongoose.js +++ b/packages/strapi-plugin-email/config/queries/mongoose.js @@ -13,7 +13,7 @@ module.exports = { count: async function (params = {}) { return Number(await this - .count(params)); + .countDocuments(params)); }, findOne: async function (params, populate) { @@ -68,7 +68,7 @@ module.exports = { }; } - return this.update(search, params, { + return this.updateOne(search, params, { strict: false }) .catch((error) => { @@ -82,7 +82,7 @@ module.exports = { delete: async function (params) { // Delete entry. return this - .remove({ + .deleteOne({ [this.primaryKey]: params[this.primaryKey] || params.id }); }, diff --git a/packages/strapi-plugin-upload/config/queries/mongoose.js b/packages/strapi-plugin-upload/config/queries/mongoose.js index 8f7ebbebd6..003d54269a 100644 --- a/packages/strapi-plugin-upload/config/queries/mongoose.js +++ b/packages/strapi-plugin-upload/config/queries/mongoose.js @@ -13,7 +13,7 @@ module.exports = { count: async function (params = {}) { return Number(await this - .count(params)); + .countDocuments(params)); }, findOne: async function (params, populate) { @@ -68,7 +68,7 @@ module.exports = { }; } - return this.update(search, params, { + return this.updateOne(search, params, { strict: false }) .catch((error) => { diff --git a/packages/strapi-plugin-users-permissions/config/queries/mongoose.js b/packages/strapi-plugin-users-permissions/config/queries/mongoose.js index 53ce2cd17a..8c74435b9b 100644 --- a/packages/strapi-plugin-users-permissions/config/queries/mongoose.js +++ b/packages/strapi-plugin-users-permissions/config/queries/mongoose.js @@ -13,7 +13,7 @@ module.exports = { count: async function (params = {}) { return Number(await this - .count(params)); + .countDocuments(params)); }, findOne: async function (params, populate) { @@ -65,7 +65,7 @@ module.exports = { }; } - return this.update(search, params, { + return this.updateOne(search, params, { strict: false }) .catch((error) => { @@ -79,7 +79,7 @@ module.exports = { delete: async function (params) { // Delete entry. return this - .remove({ + .deleteOne({ [this.primaryKey]: params[this.primaryKey] || params.id }); }, @@ -87,7 +87,7 @@ module.exports = { deleteMany: async function (params) { // Delete entry. return this - .remove({ + .deleteMany({ [this.primaryKey]: { $in: params[this.primaryKey] || params.id } diff --git a/packages/strapi/lib/core/store.js b/packages/strapi/lib/core/store.js index 04fe05c0ea..6d95c00860 100644 --- a/packages/strapi/lib/core/store.js +++ b/packages/strapi/lib/core/store.js @@ -110,7 +110,7 @@ module.exports = function () { }); strapi.models['core_store'].orm === 'mongoose' - ? await strapi.models['core_store'].update({ _id: data._id }, data, { strict: false }) + ? await strapi.models['core_store'].updateOne({ _id: data._id }, data, { strict: false }) : await strapi.models['core_store'].forge({ id: data.id }).save(data, { patch: true }); } else { Object.assign(where, { From ceda08980a093ac5e78b9b9cf687762417e71176 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Georget?= Date: Wed, 23 Jan 2019 17:03:30 +0100 Subject: [PATCH 20/31] Fix PR template typo --- .github/PULL_REQUEST_TEMPLATE.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index eeda5718dd..1f7ab54906 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -15,7 +15,7 @@ - [ ] Plugin -**Manual testing done on the follow databases:** +**Manual testing done on the following databases:** - [ ] Not applicable - [ ] MongoDB - [ ] MySQL From 8e2169f005d075d3c046a1af67091b541240261a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Georget?= Date: Thu, 24 Jan 2019 11:09:45 +0100 Subject: [PATCH 21/31] Fix SQL query where oneWay relationship is null --- .../strapi-plugin-content-manager/config/queries/bookshelf.js | 4 +++- packages/strapi-plugin-graphql/services/Loaders.js | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/strapi-plugin-content-manager/config/queries/bookshelf.js b/packages/strapi-plugin-content-manager/config/queries/bookshelf.js index 1f422444f5..b28b0abe01 100644 --- a/packages/strapi-plugin-content-manager/config/queries/bookshelf.js +++ b/packages/strapi-plugin-content-manager/config/queries/bookshelf.js @@ -8,8 +8,10 @@ module.exports = { for (const value in where.value) { qb[value ? 'where' : 'orWhere'](key, where.symbol, where.value[value]); } + } else if (_.isArray(where)) { + qb.where(key, 'IN', where); } else { - qb.where(key, where.symbol, where.value); + qb.where(key, where.symbol || 'IN', where.value); } }); diff --git a/packages/strapi-plugin-graphql/services/Loaders.js b/packages/strapi-plugin-graphql/services/Loaders.js index 5f391c935c..3976f36926 100644 --- a/packages/strapi-plugin-graphql/services/Loaders.js +++ b/packages/strapi-plugin-graphql/services/Loaders.js @@ -143,7 +143,7 @@ module.exports = { limit: 100, }; - params.query[query.alias] = _.uniq(query.ids.filter(x => !_.isEmpty(x)).map(x => x.toString())); + params.query[query.alias] = _.uniq(query.ids.filter(x => !_.isEmpty(x) || _.isInteger(x)).map(x => x.toString())); if (['id', '_id'].includes(query.alias)) { // However, we're applying a limit based on the number of entries we've to fetch. From 2a62b9d96224468c4f8be837074cede75821081d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Georget?= Date: Thu, 24 Jan 2019 11:52:53 +0100 Subject: [PATCH 22/31] Convert where parameters instead of adding complexity in SQL query --- .../strapi-plugin-content-manager/config/queries/bookshelf.js | 4 +--- .../strapi-plugin-content-manager/services/ContentManager.js | 4 ++-- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/packages/strapi-plugin-content-manager/config/queries/bookshelf.js b/packages/strapi-plugin-content-manager/config/queries/bookshelf.js index b28b0abe01..1f422444f5 100644 --- a/packages/strapi-plugin-content-manager/config/queries/bookshelf.js +++ b/packages/strapi-plugin-content-manager/config/queries/bookshelf.js @@ -8,10 +8,8 @@ module.exports = { for (const value in where.value) { qb[value ? 'where' : 'orWhere'](key, where.symbol, where.value[value]); } - } else if (_.isArray(where)) { - qb.where(key, 'IN', where); } else { - qb.where(key, where.symbol || 'IN', where.value); + qb.where(key, where.symbol, where.value); } }); diff --git a/packages/strapi-plugin-content-manager/services/ContentManager.js b/packages/strapi-plugin-content-manager/services/ContentManager.js index d3bfd7ae44..6dca0bf51e 100644 --- a/packages/strapi-plugin-content-manager/services/ContentManager.js +++ b/packages/strapi-plugin-content-manager/services/ContentManager.js @@ -10,14 +10,14 @@ module.exports = { fetchAll: async (params, query) => { const { limit, skip, sort, query : request, queryAttribute, source, populate = [] } = query; const filters = strapi.utils.models.convertParams(params.model, query); - const where = !_.isEmpty(request) ? request : filters.where; + const where = !_.isEmpty(request) ? strapi.utils.models.convertParams(params.model, request) : filters; // Find entries using `queries` system return await strapi.query(params.model, source).find({ limit: limit || filters.limit, skip: skip || filters.start || 0, sort: sort || filters.sort, - where, + where: where.where, queryAttribute, }, populate); }, From ce242dfd89fe6fe965543da16b505c3f2e2e24eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Georget?= Date: Thu, 24 Jan 2019 11:56:21 +0100 Subject: [PATCH 23/31] Fixes #2672 --- packages/strapi-utils/lib/models.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/strapi-utils/lib/models.js b/packages/strapi-utils/lib/models.js index 73fa91c995..349628459d 100644 --- a/packages/strapi-utils/lib/models.js +++ b/packages/strapi-utils/lib/models.js @@ -486,7 +486,7 @@ module.exports = { const suffix = key.split('_'); // Mysql stores boolean as 1 or 0 if (client === 'mysql' && _.get(models, [model, 'attributes', suffix, 'type']) === 'boolean') { - formattedValue = value === 'true' ? '1' : '0'; + formattedValue = value.toString() === 'true' ? '1' : '0'; } let type; From 199ed431a8e701a990d96091cf1dc960cc19088f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Georget?= Date: Thu, 24 Jan 2019 12:05:33 +0100 Subject: [PATCH 24/31] Destructure where condition to make code more readable --- .../strapi-plugin-content-manager/services/ContentManager.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/strapi-plugin-content-manager/services/ContentManager.js b/packages/strapi-plugin-content-manager/services/ContentManager.js index 6dca0bf51e..60fd2c1934 100644 --- a/packages/strapi-plugin-content-manager/services/ContentManager.js +++ b/packages/strapi-plugin-content-manager/services/ContentManager.js @@ -10,14 +10,14 @@ module.exports = { fetchAll: async (params, query) => { const { limit, skip, sort, query : request, queryAttribute, source, populate = [] } = query; const filters = strapi.utils.models.convertParams(params.model, query); - const where = !_.isEmpty(request) ? strapi.utils.models.convertParams(params.model, request) : filters; + const { where = {} } = !_.isEmpty(request) ? strapi.utils.models.convertParams(params.model, request) : filters; // Find entries using `queries` system return await strapi.query(params.model, source).find({ limit: limit || filters.limit, skip: skip || filters.start || 0, sort: sort || filters.sort, - where: where.where, + where, queryAttribute, }, populate); }, From e62ab72b3b88e7bdfd5927647c8620e9a1f82f85 Mon Sep 17 00:00:00 2001 From: Adam Saparudin Date: Thu, 24 Jan 2019 23:43:53 +0700 Subject: [PATCH 25/31] Add _in array query example --- docs/3.x.x/guides/filters.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/3.x.x/guides/filters.md b/docs/3.x.x/guides/filters.md index 315401fd59..98a809b799 100644 --- a/docs/3.x.x/guides/filters.md +++ b/docs/3.x.x/guides/filters.md @@ -19,6 +19,7 @@ The available operators are separated in four different categories: Easily filter results according to fields values. - `=`: Equals + - `_in`: Include in array - `_ne`: Not equals - `_lt`: Lower than - `_gt`: Greater than @@ -37,6 +38,9 @@ Find products having a price equal or greater than `3`. `GET /products?price_gte=3` +Find multiple product with id 3, 6, 8 +`GET /products?id_in=3&id_in=6&id_in=8` + ::: note You can't use filter to have specific results inside relation, like "Find users and only their posts older than yesterday" as example. If you need it, you can modify or create your own service or use [GraphQL](./graphql.md#query-api). ::: From c0e808f82c2678b6e152708053889dc4b77bf6f3 Mon Sep 17 00:00:00 2001 From: Jim LAURIE Date: Fri, 25 Jan 2019 17:24:21 +0100 Subject: [PATCH 26/31] Fix image populate --- packages/strapi-hook-mongoose/lib/index.js | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/packages/strapi-hook-mongoose/lib/index.js b/packages/strapi-hook-mongoose/lib/index.js index 529743a023..54d9e885fd 100644 --- a/packages/strapi-hook-mongoose/lib/index.js +++ b/packages/strapi-hook-mongoose/lib/index.js @@ -160,6 +160,28 @@ module.exports = function (strapi) { } else { this._mongooseOptions.populate[association.alias].path = `${association.alias}.ref`; } + } else { + if (!this._mongooseOptions.populate) { + this._mongooseOptions.populate = {}; + } + + // Images are not displayed in populated data. + // We automaticaly populate morph relations. + if (association.nature === 'oneToManyMorph' || association.nature === 'manyToManyMorph') { + this._mongooseOptions.populate[association.alias] = { + path: association.alias, + match: { + [`${association.via}.${association.filter}`]: association.alias, + [`${association.via}.kind`]: definition.globalId + }, + options: { + sort: '-createdAt' + }, + select: undefined, + model: undefined, + _docs: {} + }; + } } next(); }); From 9539182768104a146ab4b3156f3692d4f0297ce2 Mon Sep 17 00:00:00 2001 From: Jim LAURIE Date: Sat, 26 Jan 2019 18:52:27 +0100 Subject: [PATCH 27/31] Change in order --- docs/3.x.x/guides/filters.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/3.x.x/guides/filters.md b/docs/3.x.x/guides/filters.md index 98a809b799..c4760cfc01 100644 --- a/docs/3.x.x/guides/filters.md +++ b/docs/3.x.x/guides/filters.md @@ -19,12 +19,12 @@ The available operators are separated in four different categories: Easily filter results according to fields values. - `=`: Equals - - `_in`: Include in array - `_ne`: Not equals - `_lt`: Lower than - `_gt`: Greater than - `_lte`: Lower than or equal to - `_gte`: Greater than or equal to + - `_in`: Include in array - `_contains`: Contains - `_containss`: Contains case sensitive From 292447a4d27605d17c4b11331e75f27610a509bc Mon Sep 17 00:00:00 2001 From: Jim LAURIE Date: Sun, 27 Jan 2019 16:55:55 +0100 Subject: [PATCH 28/31] Fix database prod and staging template --- .../environments/production/database.json | 21 --------- .../config/environments/staging/database.json | 21 --------- .../strapi-generate-new/json/database.json.js | 44 ++++++++++++++++++- packages/strapi-generate-new/lib/before.js | 8 +++- packages/strapi-generate-new/lib/index.js | 8 ++++ 5 files changed, 57 insertions(+), 45 deletions(-) delete mode 100644 packages/strapi-generate-new/files/config/environments/production/database.json delete mode 100644 packages/strapi-generate-new/files/config/environments/staging/database.json diff --git a/packages/strapi-generate-new/files/config/environments/production/database.json b/packages/strapi-generate-new/files/config/environments/production/database.json deleted file mode 100644 index 3075fabf91..0000000000 --- a/packages/strapi-generate-new/files/config/environments/production/database.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "defaultConnection": "default", - "connections": { - "default": { - "connector": "strapi-hook-mongoose", - "settings": { - "client": "mongo", - "uri": "${process.env.DATABASE_URI || ''}", - "host": "${process.env.DATABASE_HOST || '127.0.0.1'}", - "port": "${process.env.DATABASE_PORT || 27017}", - "database": "${process.env.DATABASE_NAME || 'strapi-production'}", - "username": "${process.env.DATABASE_USERNAME || ''}", - "password": "${process.env.DATABASE_PASSWORD || ''}" - }, - "options": { - "ssl": "${process.env.DATABASE_SSL || false}", - "authenticationDatabase": "${process.env.DATABASE_AUTHENTICATION_DATABASE || ''}" - } - } - } -} diff --git a/packages/strapi-generate-new/files/config/environments/staging/database.json b/packages/strapi-generate-new/files/config/environments/staging/database.json deleted file mode 100644 index 43edf2421d..0000000000 --- a/packages/strapi-generate-new/files/config/environments/staging/database.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "defaultConnection": "default", - "connections": { - "default": { - "connector": "strapi-hook-mongoose", - "settings": { - "client": "mongo", - "uri": "${process.env.DATABASE_URI || ''}", - "host": "${process.env.DATABASE_HOST || '127.0.0.1'}", - "port": "${process.env.DATABASE_PORT || 27017}", - "database": "${process.env.DATABASE_NAME || 'strapi-staging'}", - "username": "${process.env.DATABASE_USERNAME || ''}", - "password": "${process.env.DATABASE_PASSWORD || ''}" - }, - "options": { - "ssl": "${process.env.DATABASE_SSL || false}", - "authenticationDatabase": "${process.env.DATABASE_AUTHENTICATION_DATABASE || ''}" - } - } - } -} diff --git a/packages/strapi-generate-new/json/database.json.js b/packages/strapi-generate-new/json/database.json.js index 93434f6dd4..0e4806b166 100644 --- a/packages/strapi-generate-new/json/database.json.js +++ b/packages/strapi-generate-new/json/database.json.js @@ -1,8 +1,50 @@ 'use strict'; module.exports = scope => { + // Production/Staging Template + if (['production', 'staging'].includes(scope.keyPath.split('/')[2])) { + // All available settings (bookshelf and mongoose) + const settingsBase = { + client: scope.client.database, + host: '${process.env.DATABASE_HOST || 127.0.0.1 }', + port: '${process.env.DATABASE_PORT || 27017 }', + srv: '${process.env.DATABASE_SRV || false }', + database: '${process.env.DATABASE_NAME || strapi }', + username: '${process.env.DATABASE_USERNAME || \'\' }', + password: '${process.env.DATABASE_PASSWORD || \'\' }', + ssl: '${process.env.DATABASE_SSL || false }' + }; + + // Apply only settings set during the configuration + const settings = Object.keys(scope.database.settings).reduce((acc, key) => { + acc[key] = settingsBase[key]; + return acc; + }, {}); + + // All available options (bookshelf and mongoose) + const optionsBase = { + ssl: '${process.env.DATABASE_SSL || false }', + authenticationDatabase: '${process.env.DATABASE_AUTHENTICATION_DATABASE || \'\' }' + }; + + // Apply only options set during the configuration + const options = Object.keys(scope.database.options).reduce((acc, key) => { + acc[key] = optionsBase[key]; + return acc; + }, {}); + + return { + defaultConnection: 'default', + connections: { + default: { + connector: scope.client.connector, + settings, + options + } + } + }; + } - // Finally, return the JSON. return { defaultConnection: 'default', connections: { diff --git a/packages/strapi-generate-new/lib/before.js b/packages/strapi-generate-new/lib/before.js index e71301fa13..b02796d73c 100644 --- a/packages/strapi-generate-new/lib/before.js +++ b/packages/strapi-generate-new/lib/before.js @@ -205,12 +205,16 @@ module.exports = (scope, cb) => { } scope.database.settings.host = answers.host; - scope.database.settings.srv = _.toString(answers.srv) === 'true'; scope.database.settings.port = answers.port; scope.database.settings.database = answers.database; scope.database.settings.username = answers.username; scope.database.settings.password = answers.password; - scope.database.options.authenticationDatabase = answers.authenticationDatabase; + if (answers.srv) { + scope.database.settings.srv = _.toString(answers.srv) === 'true'; + } + if (answers.authenticationDatabase) { + scope.database.options.authenticationDatabase = answers.authenticationDatabase; + } if (scope.client.database === 'mongo') { scope.database.options.ssl = _.toString(answers.ssl) === 'true'; } else { diff --git a/packages/strapi-generate-new/lib/index.js b/packages/strapi-generate-new/lib/index.js index 7aacf6329b..f96ba44cde 100644 --- a/packages/strapi-generate-new/lib/index.js +++ b/packages/strapi-generate-new/lib/index.js @@ -34,6 +34,14 @@ module.exports = { jsonfile: database }, + 'config/environments/production/database.json': { + jsonfile: database + }, + + 'config/environments/staging/database.json': { + jsonfile: database + }, + // Copy dot files. '.editorconfig': { copy: 'editorconfig' From 23dd047f42d184347069c420045944f7f8b85979 Mon Sep 17 00:00:00 2001 From: Jim LAURIE Date: Mon, 28 Jan 2019 11:56:27 +0100 Subject: [PATCH 29/31] Fix typo --- packages/strapi-hook-mongoose/lib/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/strapi-hook-mongoose/lib/index.js b/packages/strapi-hook-mongoose/lib/index.js index 54d9e885fd..4daf8faa68 100644 --- a/packages/strapi-hook-mongoose/lib/index.js +++ b/packages/strapi-hook-mongoose/lib/index.js @@ -166,7 +166,7 @@ module.exports = function (strapi) { } // Images are not displayed in populated data. - // We automaticaly populate morph relations. + // We automatically populate morph relations. if (association.nature === 'oneToManyMorph' || association.nature === 'manyToManyMorph') { this._mongooseOptions.populate[association.alias] = { path: association.alias, @@ -576,4 +576,4 @@ module.exports = function (strapi) { }, relations); return hook; -}; \ No newline at end of file +}; From 08f3e0ecc313dcd41378983d3ff3ea3ef5a00356 Mon Sep 17 00:00:00 2001 From: Jim LAURIE Date: Mon, 28 Jan 2019 12:05:41 +0100 Subject: [PATCH 30/31] Apply PR feedback --- .../strapi-generate-new/json/database.json.js | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/packages/strapi-generate-new/json/database.json.js b/packages/strapi-generate-new/json/database.json.js index 0e4806b166..38ced395f8 100644 --- a/packages/strapi-generate-new/json/database.json.js +++ b/packages/strapi-generate-new/json/database.json.js @@ -16,10 +16,9 @@ module.exports = scope => { }; // Apply only settings set during the configuration - const settings = Object.keys(scope.database.settings).reduce((acc, key) => { - acc[key] = settingsBase[key]; - return acc; - }, {}); + Object.keys(scope.database.settings).forEach((key) => { + scope.database.settings[key] = settingsBase[key]; + }); // All available options (bookshelf and mongoose) const optionsBase = { @@ -28,18 +27,17 @@ module.exports = scope => { }; // Apply only options set during the configuration - const options = Object.keys(scope.database.options).reduce((acc, key) => { - acc[key] = optionsBase[key]; - return acc; - }, {}); + Object.keys(scope.database.options).forEach((key) => { + scope.database.options[key] = optionsBase[key]; + }); return { defaultConnection: 'default', connections: { default: { connector: scope.client.connector, - settings, - options + settings: scope.database.settings, + options: scope.database.options } } }; From f365534c780842abc538f499084b853da2e48301 Mon Sep 17 00:00:00 2001 From: Jim LAURIE Date: Mon, 28 Jan 2019 15:47:38 +0100 Subject: [PATCH 31/31] Hot fix database host --- packages/strapi-generate-new/json/database.json.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/strapi-generate-new/json/database.json.js b/packages/strapi-generate-new/json/database.json.js index 38ced395f8..ba1df27e7d 100644 --- a/packages/strapi-generate-new/json/database.json.js +++ b/packages/strapi-generate-new/json/database.json.js @@ -6,7 +6,7 @@ module.exports = scope => { // All available settings (bookshelf and mongoose) const settingsBase = { client: scope.client.database, - host: '${process.env.DATABASE_HOST || 127.0.0.1 }', + host: '${process.env.DATABASE_HOST || \'127.0.0.1\' }', port: '${process.env.DATABASE_PORT || 27017 }', srv: '${process.env.DATABASE_SRV || false }', database: '${process.env.DATABASE_NAME || strapi }',