mirror of
https://github.com/strapi/strapi.git
synced 2025-12-27 07:03:38 +00:00
Merge branch 'master' into features/rbac
This commit is contained in:
commit
b71ffa6c6c
@ -59,7 +59,7 @@ If you use the same operator (except for in and nin) the values will be used to
|
||||
|
||||
If you want to use `AND` for your query you will have to create a custom query by using the [Query](../concepts/queries.md) documentation.
|
||||
|
||||
Strapi doesn't support the `AND` opperator for now.
|
||||
Strapi doesn't support the `AND` operator for now.
|
||||
|
||||
:::
|
||||
|
||||
|
||||
@ -187,6 +187,15 @@ while (fileCursor.hasNext()) {
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
if (el.name) {
|
||||
var splitName = el.name.split('.');
|
||||
var name = splitName[0];
|
||||
var ext = splitName[1];
|
||||
if (ext) {
|
||||
db.getCollection('upload_file').updateOne({ _id: el._id }, { $set: { name: name } });
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
@ -208,6 +217,9 @@ var models = {
|
||||
|
||||
Finally you can load this script in your mongo shell and run it.
|
||||
|
||||
Note that after migration the `name` field of the files you uploaded will be replaced with a name without an extension.
|
||||
If you were displaying the file name including the extension on the front end, you might have to show the extension separately through the `ext` field.
|
||||
|
||||
Once your migration is done you can delete the `export.js` and `models.json` files from your project. You are all set !
|
||||
|
||||
## Rebuilding your administration panel
|
||||
|
||||
@ -48,6 +48,8 @@ Security limits on maximum number of items in your response by default is limite
|
||||
|
||||
You can also enable the Apollo server tracing feature, which is supported by the playground to track the response time of each part of your query. To enable this feature just change/add the `"tracing": true` option in the GraphQL settings file. You can read more about the tracing feature from Apollo [here](https://www.apollographql.com/docs/apollo-server/federation/metrics/).
|
||||
|
||||
You can also enable Strapi as an implementing service for Apollo Federation, which allows you to set up Strapi as a service behind an Apollo Federation API gateway and allows you to add Strapi to a single exposed data graph across your organization. You can read more about Apollo Federation [here](https://www.apollographql.com/docs/apollo-server/federation/introduction/).
|
||||
|
||||
You can edit these configurations by creating following file.
|
||||
|
||||
**Path —** `./extensions/graphql/config/settings.json`.
|
||||
@ -59,7 +61,8 @@ You can edit these configurations by creating following file.
|
||||
"shadowCRUD": true,
|
||||
"playgroundAlways": false,
|
||||
"depthLimit": 7,
|
||||
"amountLimit": 100
|
||||
"amountLimit": 100,
|
||||
"federation": false
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
@ -61,6 +61,15 @@ Start a Strapi application with autoReload disabled.
|
||||
This commands is there to run a Strapi application without restarts and file writes (aimed at production usage).
|
||||
Certain features are disabled in the `strapi start` mode because they require application restarts.
|
||||
|
||||
Allowed environment variables:
|
||||
| Property | Description | Type | Default |
|
||||
| --------- | ----------- | ----- | ------- |
|
||||
| STRAPI_HIDE_STARTUP_MESSAGE | If `true` then Strapi will not show startup message on boot. Values can be `true` or `false` | string | `false` |
|
||||
| STRAPI_LOG_LEVEL | Values can be 'fatal', 'error', 'warn', 'info', 'debug', 'trace' | string | `debug` |
|
||||
| STRAPI_LOG_TIMESTAMP | Enables or disables the inclusion of a timestamp in the log message. Values can be `true` or `false` | string | `false`|
|
||||
| STRAPI_LOG_FORCE_COLOR | Values can be `true` or `false` | string | `true` |
|
||||
| STRAPI_LOG_PRETTY_PRINT | If pino-pretty module will be used to format logs. Values can be `true` or `false` | string | `true` |
|
||||
|
||||
## strapi build
|
||||
|
||||
Builds your admin panel.
|
||||
|
||||
@ -111,7 +111,7 @@ env.date('VAR', new Date());
|
||||
|
||||
## Environments
|
||||
|
||||
What if you need to specific static configurations for specific environments and using environment variables becomes tedious?
|
||||
What if you need specific static configurations for specific environments and using environment variables becomes tedious?
|
||||
|
||||
Strapi configurations can also be created per environment in `./config/env/{env}/{filename}`. These configurations will be merged into the base configurations defined in the `./config` folder.
|
||||
The environment is based on the `NODE_ENV` environment variable (defaults to `development`).
|
||||
|
||||
@ -52,4 +52,4 @@
|
||||
|
||||
### Deployment guides
|
||||
|
||||
For a more detailed overview of deployment please see the [related documentation](./deployment).
|
||||
For a more detailed overview of deployment please see the [related documentation](./deployment.md).
|
||||
|
||||
@ -311,7 +311,7 @@ Please note the `<password>` after your `username`. In this example, after `mong
|
||||
|
||||
#### 5. Update and replace your existing `/database.js` config file for the appropriate environment (development | production).
|
||||
|
||||
Replace the contents of `/database.json` with the following and replace **< password >** with the password of the user of your database you created earlier:
|
||||
Replace the contents of `/database.js` with the following and replace **< password >** with the password of the user of your database you created earlier:
|
||||
|
||||
`Path: ./config/database.js`.
|
||||
|
||||
@ -339,9 +339,9 @@ DATABASE_URI=mongodb://paulbocuse:<password>@strapidatabase-shard-00-00-fxxx6c.m
|
||||
```
|
||||
|
||||
::: warning NOTE
|
||||
The above configuration will create a database called `strapi`, the _default database_ Strapi sets for any **MongoDB** database. If you would like to name your database something else, add the following **key:value pair** into your **"settings":** located in your `database.json` file.
|
||||
The above configuration will create a database called `strapi`, the _default database_ Strapi sets for any **MongoDB** database. If you would like to name your database something else, add the following **key:value pair** into your **settings:** located in your `database.js` file.
|
||||
|
||||
`"database": "my-database-name"`
|
||||
`database: 'my-database-name'`
|
||||
|
||||
:::
|
||||
|
||||
|
||||
@ -187,6 +187,15 @@ while (fileCursor.hasNext()) {
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
if (el.name) {
|
||||
var splitName = el.name.split('.');
|
||||
var name = splitName[0];
|
||||
var ext = splitName[1];
|
||||
if (ext) {
|
||||
db.getCollection('upload_file').updateOne({ _id: el._id }, { $set: { name: name } });
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
@ -208,6 +217,9 @@ var models = {
|
||||
|
||||
Finally you can load this script in your mongo shell and run it.
|
||||
|
||||
Note that after migration the `name` field of the files you uploaded will be replaced with a name without an extension.
|
||||
If you were displaying the file name including the extension on the front end, you might have to show the extension separately through the `ext` field.
|
||||
|
||||
Once your migration is done you can delete the `export.js` and `models.json` files from your project. You are all set !
|
||||
|
||||
## Rebuilding your administration panel
|
||||
|
||||
@ -98,7 +98,33 @@ If you never configured any middlewares you can delete the file all together. Yo
|
||||
|
||||
We applied the same logic from the `middleware` configuration to the `hook` configuration.
|
||||
|
||||
First you can create a file `./config/hook.js`, and you can move the content of `./config/hook.json` into it.
|
||||
First you can create a file `./config/hook.js`, and you can move the content of `./config/hook.json` into it. Hooks should be placed under settings key eg:
|
||||
```js
|
||||
module.exports = {
|
||||
timeout: 10000,
|
||||
load: {
|
||||
before: ['hook-1', 'hook-2'],
|
||||
order: [
|
||||
"Define the hooks' load order by putting their names in this array in the right order",
|
||||
],
|
||||
after: ['hook-3', 'hook4'],
|
||||
},
|
||||
settings: {
|
||||
'hook-1': {
|
||||
enabled: true
|
||||
},
|
||||
'hook-2': {
|
||||
enabled: true
|
||||
},
|
||||
'hook-3': {
|
||||
enabled: true
|
||||
},
|
||||
'hook4': {
|
||||
enabled: true
|
||||
},
|
||||
},
|
||||
};
|
||||
```
|
||||
|
||||
::: tip
|
||||
If you never configured any hook you can delete the file all together. You can also only set the configurations you want to customize and leave the others out.
|
||||
|
||||
@ -748,7 +748,6 @@ You can update these templates under **Plugins** > **Roles & Permissions** > **E
|
||||
- `USER` (object)
|
||||
- `username`
|
||||
- `email`
|
||||
- ...and any other field that you added manually in the model.
|
||||
- `TOKEN` corresponds to the token generated to be able to reset the password.
|
||||
- `URL` is the link where the user will be redirected after clicking on it in the email.
|
||||
|
||||
@ -757,7 +756,6 @@ You can update these templates under **Plugins** > **Roles & Permissions** > **E
|
||||
- `USER` (object)
|
||||
- `username`
|
||||
- `email`
|
||||
- ...and any other field that you added manually in the model.
|
||||
- `CODE` corresponds to the CODE generated to be able confirm the user email.
|
||||
- `URL` is the Strapi backend URL that confirms the code (by default `/auth/email-confirmation`).
|
||||
|
||||
|
||||
@ -49,6 +49,8 @@ export class LocaleToggle extends React.Component {
|
||||
return 'https://cdnjs.cloudflare.com/ajax/libs/flag-icon-css/3.1.0/flags/4x3/cz.svg';
|
||||
case 'ms':
|
||||
return 'https://cdnjs.cloudflare.com/ajax/libs/flag-icon-css/3.1.0/flags/4x3/my.svg';
|
||||
case 'sv':
|
||||
return 'https://cdnjs.cloudflare.com/ajax/libs/flag-icon-css/3.1.0/flags/4x3/se.svg';
|
||||
default:
|
||||
return `https://cdnjs.cloudflare.com/ajax/libs/flag-icon-css/3.1.0/flags/4x3/${locale}.svg`;
|
||||
}
|
||||
|
||||
@ -117,6 +117,15 @@ describe('<LocaleToggle />', () => {
|
||||
);
|
||||
});
|
||||
|
||||
it('should return the se flag', () => {
|
||||
const renderedComponent = shallow(<LocaleToggle {...props} />);
|
||||
const { getFlagUrl } = renderedComponent.instance();
|
||||
|
||||
expect(getFlagUrl('sv')).toEqual(
|
||||
'https://cdnjs.cloudflare.com/ajax/libs/flag-icon-css/3.1.0/flags/4x3/se.svg'
|
||||
);
|
||||
});
|
||||
|
||||
it('should return the locale flag', () => {
|
||||
const renderedComponent = shallow(<LocaleToggle {...props} />);
|
||||
const { getFlagUrl } = renderedComponent.instance();
|
||||
|
||||
@ -94,6 +94,7 @@ function trackUsage({ event, scope, error }) {
|
||||
version: scope.strapiVersion,
|
||||
docker: scope.docker,
|
||||
useYarn: scope.useYarn.toString(),
|
||||
noRun: (scope.runQuickstartApp !== true).toString(),
|
||||
},
|
||||
});
|
||||
} catch (err) {
|
||||
|
||||
@ -73,7 +73,7 @@ class OverlayBlocker extends React.Component {
|
||||
<div className="buttonContainer">
|
||||
<a
|
||||
className={cn('primary', 'btn')}
|
||||
href="https://strapi.io/documentation/configurations/configurations.html#server"
|
||||
href="https://strapi.io/documentation"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
>
|
||||
|
||||
@ -116,7 +116,7 @@
|
||||
"components.Input.error.validation.min": "The value is too low.",
|
||||
"components.Input.error.validation.minLength": "The value is too short.",
|
||||
"components.Input.error.validation.minSupMax": "Can't be superior",
|
||||
"components.Input.error.validation.regex": "The value not match the regex.",
|
||||
"components.Input.error.validation.regex": "The value does not match the regex.",
|
||||
"components.Input.error.validation.required": "This value is required.",
|
||||
"components.ListRow.empty": "There is no data to be shown.",
|
||||
"components.OverlayBlocker.description": "You're using a feature that needs the server to restart. Please wait until the server is up.",
|
||||
|
||||
@ -110,7 +110,7 @@
|
||||
"error.validation.min": "The value is too low.",
|
||||
"error.validation.minLength": "The value is too short.",
|
||||
"error.validation.minSupMax": "Can't be superior",
|
||||
"error.validation.regex": "The value not match the regex.",
|
||||
"error.validation.regex": "The value does not match the regex.",
|
||||
"error.validation.required": "This value input is required.",
|
||||
"form.Input.bulkActions": "Enable bulk actions",
|
||||
"form.Input.defaultSort": "Default sort attribute",
|
||||
|
||||
@ -31,7 +31,7 @@
|
||||
},
|
||||
"replyTo": {
|
||||
"type": "string",
|
||||
"format": "email"
|
||||
"format": "email",
|
||||
"example": "user4@example.com"
|
||||
},
|
||||
"subject": {
|
||||
|
||||
@ -5,5 +5,6 @@
|
||||
"playgroundAlways": false,
|
||||
"depthLimit": 7,
|
||||
"amountLimit": 100,
|
||||
"shareEnabled": false
|
||||
"shareEnabled": false,
|
||||
"federation": false
|
||||
}
|
||||
|
||||
@ -7,6 +7,7 @@
|
||||
// Public node modules.
|
||||
const _ = require('lodash');
|
||||
const { ApolloServer } = require('apollo-server-koa');
|
||||
const { buildFederatedSchema } = require('@apollo/federation');
|
||||
const depthLimit = require('graphql-depth-limit');
|
||||
const loadConfigs = require('./load-config');
|
||||
|
||||
@ -84,9 +85,18 @@ module.exports = strapi => {
|
||||
return;
|
||||
}
|
||||
|
||||
// Get federation config
|
||||
const isFederated = _.get(strapi.plugins.graphql, 'config.federation', false);
|
||||
const schemaDef = {};
|
||||
if (isFederated) {
|
||||
schemaDef.schema = buildFederatedSchema([{ typeDefs, resolvers }]);
|
||||
} else {
|
||||
schemaDef.typeDefs = typeDefs;
|
||||
schemaDef.resolvers = resolvers;
|
||||
}
|
||||
|
||||
const serverParams = {
|
||||
typeDefs,
|
||||
resolvers,
|
||||
...schemaDef,
|
||||
context: ({ ctx }) => {
|
||||
// Initiliase loaders for this request.
|
||||
// TODO: set loaders in the context not globally
|
||||
|
||||
@ -11,6 +11,7 @@
|
||||
"test": "echo \"no tests yet\""
|
||||
},
|
||||
"dependencies": {
|
||||
"@apollo/federation": "^0.15.0",
|
||||
"apollo-server-koa": "2.9.12",
|
||||
"dataloader": "^1.4.0",
|
||||
"glob": "^7.1.4",
|
||||
|
||||
@ -95,8 +95,14 @@ const generateSchema = () => {
|
||||
writeGenerateSchema(graphql.printSchema(schema));
|
||||
}
|
||||
|
||||
// Remove custom scalar (like Upload);
|
||||
typeDefs = Types.removeCustomScalar(typeDefs, resolvers);
|
||||
// Remove custom scalar (like Upload), if not using Federation
|
||||
// Federation requires scalar Upload defined in typeDefs to use
|
||||
// buildFederatedSchema()
|
||||
// (https://www.apollographql.com/docs/apollo-server/federation/implementing-services/)
|
||||
const isFederated = _.get(strapi.plugins.graphql, 'config.federation', false);
|
||||
if (!isFederated) {
|
||||
typeDefs = Types.removeCustomScalar(typeDefs, resolvers);
|
||||
}
|
||||
|
||||
return {
|
||||
typeDefs: gql(typeDefs),
|
||||
|
||||
@ -71,8 +71,10 @@ module.exports = {
|
||||
break;
|
||||
}
|
||||
|
||||
if (attribute.required && action !== 'update') {
|
||||
type += '!';
|
||||
if (attribute.required) {
|
||||
if (rootType !== 'mutation' || (action !== 'update' && attribute.default === undefined)) {
|
||||
type += '!';
|
||||
}
|
||||
}
|
||||
|
||||
return type;
|
||||
|
||||
@ -49,7 +49,7 @@ module.exports = {
|
||||
}
|
||||
|
||||
type UsersPermissionsLoginPayload {
|
||||
jwt: String!
|
||||
jwt: String
|
||||
user: UsersPermissionsMe!
|
||||
}
|
||||
|
||||
|
||||
@ -22,7 +22,7 @@ const DEFAULT_PERMISSIONS = [
|
||||
type: 'users-permissions',
|
||||
roleType: 'public',
|
||||
},
|
||||
{ action: 'resetPassword', controller: 'auth', type: 'users-permissions', roleType: 'public' },
|
||||
{ action: 'resetpassword', controller: 'auth', type: 'users-permissions', roleType: 'public' },
|
||||
{ action: 'init', controller: 'userspermissions', type: null, roleType: null },
|
||||
{ action: 'me', controller: 'user', type: 'users-permissions', roleType: null },
|
||||
{ action: 'autoreload', controller: null, type: null, roleType: null },
|
||||
|
||||
@ -197,10 +197,17 @@ class Strapi {
|
||||
// Is the project initialised?
|
||||
const isInitialised = await utils.isInitialised(this);
|
||||
|
||||
if (!isInitialised) {
|
||||
this.logFirstStartupMessage();
|
||||
} else {
|
||||
this.logStartupMessage();
|
||||
// Should the startup message be displayed?
|
||||
const hideStartupMessage = process.env.STRAPI_HIDE_STARTUP_MESSAGE
|
||||
? process.env.STRAPI_HIDE_STARTUP_MESSAGE === 'true'
|
||||
: false;
|
||||
|
||||
if (hideStartupMessage === false) {
|
||||
if (!isInitialised) {
|
||||
this.logFirstStartupMessage();
|
||||
} else {
|
||||
this.logStartupMessage();
|
||||
}
|
||||
}
|
||||
|
||||
// Emit started event.
|
||||
|
||||
@ -116,7 +116,7 @@
|
||||
"components.Input.error.validation.min": "The value is too low.",
|
||||
"components.Input.error.validation.minLength": "The value is too short.",
|
||||
"components.Input.error.validation.minSupMax": "Can't be superior",
|
||||
"components.Input.error.validation.regex": "The value not match the regex.",
|
||||
"components.Input.error.validation.regex": "The value does not match the regex.",
|
||||
"components.Input.error.validation.required": "This value is required.",
|
||||
"components.ListRow.empty": "There is no data to be shown.",
|
||||
"components.OverlayBlocker.description": "You're using a feature that needs the server to restart. Please wait until the server is up.",
|
||||
|
||||
20
yarn.lock
20
yarn.lock
@ -2,6 +2,16 @@
|
||||
# yarn lockfile v1
|
||||
|
||||
|
||||
"@apollo/federation@^0.15.0":
|
||||
version "0.15.0"
|
||||
resolved "https://registry.yarnpkg.com/@apollo/federation/-/federation-0.15.0.tgz#385f9fd4473e7ec1c3dbd251f80a054d47e28614"
|
||||
integrity sha512-L6n41obKc0fLQdZ0uSHhHRJNCIAxZ5uDeqQON+Q+ewiUfS3XetCCf/cGpiiL50TIY/n8Bvh5ZPWLMTtP0tyw5g==
|
||||
dependencies:
|
||||
apollo-graphql "^0.4.0"
|
||||
apollo-server-env "^2.4.3"
|
||||
core-js "^3.4.0"
|
||||
lodash.xorby "^4.7.0"
|
||||
|
||||
"@apollo/protobufjs@^1.0.3":
|
||||
version "1.0.3"
|
||||
resolved "https://registry.yarnpkg.com/@apollo/protobufjs/-/protobufjs-1.0.3.tgz#02c655aedd4ba7c7f64cbc3d2b1dd9a000a391ba"
|
||||
@ -5950,6 +5960,11 @@ core-js@^3.0.1, core-js@^3.2.0:
|
||||
resolved "https://registry.yarnpkg.com/core-js/-/core-js-3.6.4.tgz#440a83536b458114b9cb2ac1580ba377dc470647"
|
||||
integrity sha512-4paDGScNgZP2IXXilaffL9X7968RuvwlkK3xWtZRVqgd8SYNiVKRJvkFd1aqqEuPfN7E68ZHEp9hDj6lHj4Hyw==
|
||||
|
||||
core-js@^3.4.0:
|
||||
version "3.6.5"
|
||||
resolved "https://registry.yarnpkg.com/core-js/-/core-js-3.6.5.tgz#7395dc273af37fb2e50e9bd3d9fe841285231d1a"
|
||||
integrity sha512-vZVEEwZoIsI+vPEuoF9Iqf5H7/M3eeQqWlQnYa8FSKKePuYTf5MWnxb5SDAzCa60b3JBRS5g9b+Dq7b1y/RCrA==
|
||||
|
||||
core-util-is@1.0.2, core-util-is@^1.0.2, core-util-is@~1.0.0:
|
||||
version "1.0.2"
|
||||
resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7"
|
||||
@ -11778,6 +11793,11 @@ lodash.uniq@^4.5.0:
|
||||
resolved "https://registry.yarnpkg.com/lodash.uniq/-/lodash.uniq-4.5.0.tgz#d0225373aeb652adc1bc82e4945339a842754773"
|
||||
integrity sha1-0CJTc662Uq3BvILklFM5qEJ1R3M=
|
||||
|
||||
lodash.xorby@^4.7.0:
|
||||
version "4.7.0"
|
||||
resolved "https://registry.yarnpkg.com/lodash.xorby/-/lodash.xorby-4.7.0.tgz#9c19a6f9f063a6eb53dd03c1b6871799801463d7"
|
||||
integrity sha1-nBmm+fBjputT3QPBtocXmYAUY9c=
|
||||
|
||||
lodash@4.17.12:
|
||||
version "4.17.12"
|
||||
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.12.tgz#a712c74fdc31f7ecb20fe44f157d802d208097ef"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user