Merge branch 'master' into step-any-fix

This commit is contained in:
jasongitmail 2019-09-16 18:32:51 +00:00 committed by GitHub
commit 2f2ecb587c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
49 changed files with 194 additions and 146 deletions

View File

@ -492,7 +492,7 @@ module.exports = {
Query: { Query: {
post: { post: {
description: 'Return a single post', description: 'Return a single post',
policy: ['plugins.users-permissions.isAuthenticated', 'isOwner'], // Apply the 'isAuthenticated' policy of the `Users & Permissions` plugin, then the 'isOwner' policy before executing the resolver. policies: ['plugins.users-permissions.isAuthenticated', 'isOwner'], // Apply the 'isAuthenticated' policy of the `Users & Permissions` plugin, then the 'isOwner' policy before executing the resolver.
}, },
posts: { posts: {
description: 'Return a list of posts', // Add a description to the query. description: 'Return a list of posts', // Add a description to the query.
@ -504,7 +504,7 @@ module.exports = {
}, },
postsByTags: { postsByTags: {
description: 'Return the posts published by the author', description: 'Return the posts published by the author',
resolverOf: 'Post.findByTags', // Will apply the same policy on the custom resolver than the controller's action `findByTags`. resolverOf: 'Post.findByTags', // Will apply the same policy on the custom resolver as the controller's action `findByTags`.
resolver: (obj, options, ctx) => { resolver: (obj, options, ctx) => {
// ctx is the context of the Koa request. // ctx is the context of the Koa request.
await strapi.controllers.posts.findByTags(ctx); await strapi.controllers.posts.findByTags(ctx);
@ -516,7 +516,7 @@ module.exports = {
Mutation: { Mutation: {
attachPostToAuthor: { attachPostToAuthor: {
description: 'Attach a post to an author', description: 'Attach a post to an author',
policy: ['plugins.users-permissions.isAuthenticated', 'isOwner'], policies: ['plugins.users-permissions.isAuthenticated', 'isOwner'],
resolver: 'Post.attachToAuthor' resolver: 'Post.attachToAuthor'
} }
} }
@ -677,7 +677,7 @@ module.exports = {
Query: { Query: {
posts: { posts: {
description: 'Return a list of posts', description: 'Return a list of posts',
policy: [ policies: [
'plugins.users-permissions.isAuthenticated', 'plugins.users-permissions.isAuthenticated',
'isOwner', 'isOwner',
'global.logging', 'global.logging',
@ -687,7 +687,10 @@ module.exports = {
Mutation: { Mutation: {
createPost: { createPost: {
description: 'Create a new post', description: 'Create a new post',
policy: ['plugins.users-permissions.isAuthenticated', 'global.logging'], policies: [
'plugins.users-permissions.isAuthenticated',
'global.logging',
],
}, },
}, },
}, },
@ -782,7 +785,7 @@ module.exports = {
Query: { Query: {
posts: { posts: {
description: 'Return a list of posts by author', description: 'Return a list of posts by author',
resolverOf: 'Post.find', // Will apply the same policy on the custom resolver than the controller's action `find` located in `Post.js`. resolverOf: 'Post.find', // Will apply the same policy on the custom resolver as the controller's action `find` located in `Post.js`.
resolver: (obj, options, context) => { resolver: (obj, options, context) => {
// You can return a raw JSON object or a promise. // You can return a raw JSON object or a promise.

View File

@ -1,7 +1,7 @@
{ {
"name": "getstarted", "name": "getstarted",
"private": true, "private": true,
"version": "3.0.0-beta.16.2", "version": "3.0.0-beta.16.3",
"description": "A Strapi application.", "description": "A Strapi application.",
"scripts": { "scripts": {
"develop": "strapi develop", "develop": "strapi develop",
@ -15,23 +15,23 @@
"mysql": "^2.17.1", "mysql": "^2.17.1",
"pg": "^7.10.0", "pg": "^7.10.0",
"sqlite3": "^4.0.6", "sqlite3": "^4.0.6",
"strapi": "3.0.0-beta.16.2", "strapi": "3.0.0-beta.16.3",
"strapi-admin": "3.0.0-beta.16.2", "strapi-admin": "3.0.0-beta.16.3",
"strapi-hook-bookshelf": "3.0.0-beta.16.2", "strapi-hook-bookshelf": "3.0.0-beta.16.3",
"strapi-hook-knex": "3.0.0-beta.16.2", "strapi-hook-knex": "3.0.0-beta.16.3",
"strapi-hook-mongoose": "3.0.0-beta.16.2", "strapi-hook-mongoose": "3.0.0-beta.16.3",
"strapi-middleware-views": "3.0.0-beta.16.2", "strapi-middleware-views": "3.0.0-beta.16.3",
"strapi-plugin-content-manager": "3.0.0-beta.16.2", "strapi-plugin-content-manager": "3.0.0-beta.16.3",
"strapi-plugin-content-type-builder": "3.0.0-beta.16.2", "strapi-plugin-content-type-builder": "3.0.0-beta.16.3",
"strapi-plugin-documentation": "3.0.0-beta.16.2", "strapi-plugin-documentation": "3.0.0-beta.16.3",
"strapi-plugin-email": "3.0.0-beta.16.2", "strapi-plugin-email": "3.0.0-beta.16.3",
"strapi-plugin-graphql": "3.0.0-beta.16.2", "strapi-plugin-graphql": "3.0.0-beta.16.3",
"strapi-plugin-settings-manager": "3.0.0-beta.16.2", "strapi-plugin-settings-manager": "3.0.0-beta.16.3",
"strapi-plugin-upload": "3.0.0-beta.16.2", "strapi-plugin-upload": "3.0.0-beta.16.3",
"strapi-plugin-users-permissions": "3.0.0-beta.16.2", "strapi-plugin-users-permissions": "3.0.0-beta.16.3",
"strapi-provider-email-mailgun": "3.0.0-beta.16.2", "strapi-provider-email-mailgun": "3.0.0-beta.16.3",
"strapi-provider-upload-aws-s3": "3.0.0-beta.16.2", "strapi-provider-upload-aws-s3": "3.0.0-beta.16.3",
"strapi-utils": "3.0.0-beta.16.2" "strapi-utils": "3.0.0-beta.16.3"
}, },
"strapi": { "strapi": {
"uuid": "getstarted" "uuid": "getstarted"

View File

@ -1,5 +1,5 @@
{ {
"version": "3.0.0-beta.16.2", "version": "3.0.0-beta.16.3",
"packages": [ "packages": [
"packages/*", "packages/*",
"examples/*" "examples/*"

View File

@ -1,6 +1,6 @@
{ {
"name": "create-strapi-app", "name": "create-strapi-app",
"version": "3.0.0-beta.16.2", "version": "3.0.0-beta.16.3",
"description": "Generate a new Strapi application.", "description": "Generate a new Strapi application.",
"license": "MIT", "license": "MIT",
"homepage": "http://strapi.io", "homepage": "http://strapi.io",
@ -21,7 +21,7 @@
], ],
"dependencies": { "dependencies": {
"commander": "^2.20.0", "commander": "^2.20.0",
"strapi-generate-new": "3.0.0-beta.16.2" "strapi-generate-new": "3.0.0-beta.16.3"
}, },
"scripts": { "scripts": {
"test": "echo \"no tests yet\"" "test": "echo \"no tests yet\""

View File

@ -1,6 +1,6 @@
{ {
"name": "strapi-admin", "name": "strapi-admin",
"version": "3.0.0-beta.16.2", "version": "3.0.0-beta.16.3",
"description": "Strapi Admin", "description": "Strapi Admin",
"repository": { "repository": {
"type": "git", "type": "git",
@ -72,8 +72,8 @@
"sanitize.css": "^4.1.0", "sanitize.css": "^4.1.0",
"sass-loader": "^7.1.0", "sass-loader": "^7.1.0",
"shelljs": "^0.7.8", "shelljs": "^0.7.8",
"strapi-helper-plugin": "3.0.0-beta.16.2", "strapi-helper-plugin": "3.0.0-beta.16.3",
"strapi-utils": "3.0.0-beta.16.2", "strapi-utils": "3.0.0-beta.16.3",
"style-loader": "^0.23.1", "style-loader": "^0.23.1",
"styled-components": "^4.2.0", "styled-components": "^4.2.0",
"terser-webpack-plugin": "^1.2.3", "terser-webpack-plugin": "^1.2.3",

View File

@ -1,6 +1,6 @@
{ {
"name": "strapi-generate-api", "name": "strapi-generate-api",
"version": "3.0.0-beta.16.2", "version": "3.0.0-beta.16.3",
"description": "Generate an API for a Strapi application.", "description": "Generate an API for a Strapi application.",
"homepage": "http://strapi.io", "homepage": "http://strapi.io",
"keywords": [ "keywords": [

View File

@ -1,6 +1,6 @@
{ {
"name": "strapi-generate-controller", "name": "strapi-generate-controller",
"version": "3.0.0-beta.16.2", "version": "3.0.0-beta.16.3",
"description": "Generate a controller for a Strapi API.", "description": "Generate a controller for a Strapi API.",
"homepage": "http://strapi.io", "homepage": "http://strapi.io",
"keywords": [ "keywords": [

View File

@ -1,6 +1,6 @@
{ {
"name": "strapi-generate-model", "name": "strapi-generate-model",
"version": "3.0.0-beta.16.2", "version": "3.0.0-beta.16.3",
"description": "Generate a model for a Strapi API.", "description": "Generate a model for a Strapi API.",
"homepage": "http://strapi.io", "homepage": "http://strapi.io",
"keywords": [ "keywords": [

View File

@ -1,6 +1,6 @@
{ {
"name": "strapi-generate-new", "name": "strapi-generate-new",
"version": "3.0.0-beta.16.2", "version": "3.0.0-beta.16.3",
"description": "Generate a new Strapi application.", "description": "Generate a new Strapi application.",
"homepage": "http://strapi.io", "homepage": "http://strapi.io",
"keywords": [ "keywords": [

View File

@ -1,6 +1,6 @@
{ {
"name": "strapi-generate-plugin", "name": "strapi-generate-plugin",
"version": "3.0.0-beta.16.2", "version": "3.0.0-beta.16.3",
"description": "Generate an plugin for a Strapi application.", "description": "Generate an plugin for a Strapi application.",
"homepage": "http://strapi.io", "homepage": "http://strapi.io",
"keywords": [ "keywords": [

View File

@ -1,6 +1,6 @@
{ {
"name": "strapi-generate-policy", "name": "strapi-generate-policy",
"version": "3.0.0-beta.16.2", "version": "3.0.0-beta.16.3",
"description": "Generate a policy for a Strapi API.", "description": "Generate a policy for a Strapi API.",
"homepage": "http://strapi.io", "homepage": "http://strapi.io",
"keywords": [ "keywords": [

View File

@ -1,6 +1,6 @@
{ {
"name": "strapi-generate-service", "name": "strapi-generate-service",
"version": "3.0.0-beta.16.2", "version": "3.0.0-beta.16.3",
"description": "Generate a service for a Strapi API.", "description": "Generate a service for a Strapi API.",
"homepage": "http://strapi.io", "homepage": "http://strapi.io",
"keywords": [ "keywords": [

View File

@ -1,6 +1,6 @@
{ {
"name": "strapi-generate", "name": "strapi-generate",
"version": "3.0.0-beta.16.2", "version": "3.0.0-beta.16.3",
"description": "Master of ceremonies for the Strapi generators.", "description": "Master of ceremonies for the Strapi generators.",
"homepage": "http://strapi.io", "homepage": "http://strapi.io",
"keywords": [ "keywords": [
@ -20,7 +20,7 @@
"fs-extra": "^8.0.1", "fs-extra": "^8.0.1",
"lodash": "^4.17.11", "lodash": "^4.17.11",
"reportback": "^2.0.2", "reportback": "^2.0.2",
"strapi-utils": "3.0.0-beta.16.2" "strapi-utils": "3.0.0-beta.16.3"
}, },
"author": { "author": {
"name": "Strapi team", "name": "Strapi team",

View File

@ -60,6 +60,7 @@ function InputDate(props) {
target: { target: {
name: props.name, name: props.name,
value: moment, value: moment,
type: 'date',
}, },
}) })
} }

View File

@ -117,7 +117,7 @@ class InputToggleWithErrors extends React.Component {
InputToggleWithErrors.defaultProps = { InputToggleWithErrors.defaultProps = {
autoFocus: false, autoFocus: false,
className: '', className: '',
customBootstrapClass: 'col-md-6', customBootstrapClass: 'col-md-4',
deactivateErrorHighlight: false, deactivateErrorHighlight: false,
didCheckErrors: false, didCheckErrors: false,
disabled: false, disabled: false,

View File

@ -1,6 +1,6 @@
{ {
"name": "strapi-helper-plugin", "name": "strapi-helper-plugin",
"version": "3.0.0-beta.16.2", "version": "3.0.0-beta.16.3",
"description": "Helper for Strapi plugins development", "description": "Helper for Strapi plugins development",
"files": [ "files": [
"dist" "dist"

View File

@ -887,17 +887,13 @@ module.exports = ({ models, target, plugin = false }, ctx) => {
return Promise.all(updates); return Promise.all(updates);
}; };
const castValueFromType = (type, value, definition) => { const castValueFromType = (type, value, /* definition */) => {
// do not cast null values // do not cast null values
if (value === null) return null; if (value === null) return null;
switch (type) { switch (type) {
case 'json': { case 'json':
if (definition.client === 'mysql' || definition.client === 'sqlite3') { return JSON.stringify(value);
return JSON.stringify(value);
}
return value;
}
// TODO: handle real date format 1970-01-01 // TODO: handle real date format 1970-01-01
// TODO: handle real time format 12:00:00 // TODO: handle real time format 12:00:00
case 'time': case 'time':

View File

@ -1,6 +1,6 @@
{ {
"name": "strapi-hook-bookshelf", "name": "strapi-hook-bookshelf",
"version": "3.0.0-beta.16.2", "version": "3.0.0-beta.16.3",
"description": "Bookshelf hook for the Strapi framework", "description": "Bookshelf hook for the Strapi framework",
"homepage": "http://strapi.io", "homepage": "http://strapi.io",
"keywords": [ "keywords": [
@ -22,8 +22,8 @@
"lodash": "^4.17.11", "lodash": "^4.17.11",
"pluralize": "^7.0.0", "pluralize": "^7.0.0",
"rimraf": "^2.6.3", "rimraf": "^2.6.3",
"strapi-hook-knex": "3.0.0-beta.16.2", "strapi-hook-knex": "3.0.0-beta.16.3",
"strapi-utils": "3.0.0-beta.16.2" "strapi-utils": "3.0.0-beta.16.3"
}, },
"strapi": { "strapi": {
"dependencies": [ "dependencies": [

View File

@ -1,6 +1,6 @@
{ {
"name": "strapi-hook-ejs", "name": "strapi-hook-ejs",
"version": "3.0.0-beta.16.2", "version": "3.0.0-beta.16.3",
"description": "EJS hook for the Strapi framework", "description": "EJS hook for the Strapi framework",
"homepage": "http://strapi.io", "homepage": "http://strapi.io",
"keywords": [ "keywords": [

View File

@ -1,6 +1,6 @@
{ {
"name": "strapi-hook-knex", "name": "strapi-hook-knex",
"version": "3.0.0-beta.16.2", "version": "3.0.0-beta.16.3",
"description": "Knex hook for the Strapi framework", "description": "Knex hook for the Strapi framework",
"homepage": "http://strapi.io", "homepage": "http://strapi.io",
"keywords": [ "keywords": [

View File

@ -1,6 +1,6 @@
{ {
"name": "strapi-hook-mongoose", "name": "strapi-hook-mongoose",
"version": "3.0.0-beta.16.2", "version": "3.0.0-beta.16.3",
"description": "Mongoose hook for the Strapi framework", "description": "Mongoose hook for the Strapi framework",
"homepage": "http://strapi.io", "homepage": "http://strapi.io",
"keywords": [ "keywords": [
@ -20,7 +20,7 @@
"mongoose-float": "^1.0.4", "mongoose-float": "^1.0.4",
"mongoose-long": "^0.2.1", "mongoose-long": "^0.2.1",
"pluralize": "^7.0.0", "pluralize": "^7.0.0",
"strapi-utils": "3.0.0-beta.16.2" "strapi-utils": "3.0.0-beta.16.3"
}, },
"author": { "author": {
"email": "hi@strapi.io", "email": "hi@strapi.io",

View File

@ -1,6 +1,6 @@
{ {
"name": "strapi-hook-redis", "name": "strapi-hook-redis",
"version": "3.0.0-beta.16.2", "version": "3.0.0-beta.16.3",
"description": "Redis hook for the Strapi framework", "description": "Redis hook for the Strapi framework",
"homepage": "http://strapi.io", "homepage": "http://strapi.io",
"keywords": [ "keywords": [
@ -19,7 +19,7 @@
"lodash": "^4.17.11", "lodash": "^4.17.11",
"rimraf": "^2.6.3", "rimraf": "^2.6.3",
"stack-trace": "0.0.10", "stack-trace": "0.0.10",
"strapi-utils": "3.0.0-beta.16.2" "strapi-utils": "3.0.0-beta.16.3"
}, },
"author": { "author": {
"email": "hi@strapi.io", "email": "hi@strapi.io",

View File

@ -1,6 +1,6 @@
{ {
"name": "strapi-middleware-views", "name": "strapi-middleware-views",
"version": "3.0.0-beta.16.2", "version": "3.0.0-beta.16.3",
"description": "Views middleware to enable server-side rendering for the Strapi framework", "description": "Views middleware to enable server-side rendering for the Strapi framework",
"homepage": "http://strapi.io", "homepage": "http://strapi.io",
"keywords": [ "keywords": [

View File

@ -212,6 +212,22 @@ function EditView({
}); });
}; };
const handleChange = ({ target: { name, value, type } }) => {
let inputValue = value;
// Empty string is not a valid date,
// Set the date to null when it's empty
if (type === 'date' && value === '') {
inputValue = null;
}
dispatch({
type: 'ON_CHANGE',
keys: name.split('.'),
value: inputValue,
});
};
const handleSubmit = async e => { const handleSubmit = async e => {
e.preventDefault(); e.preventDefault();
const schema = createYupSchema(layout, { groups: groupLayoutsData }); const schema = createYupSchema(layout, { groups: groupLayoutsData });
@ -278,7 +294,6 @@ function EditView({
strapi.notification.error(error); strapi.notification.error(error);
} }
} catch (err) { } catch (err) {
console.log({ formErrors: err });
setIsSubmitting(false); setIsSubmitting(false);
const errors = get(err, 'inner', []).reduce((acc, curr) => { const errors = get(err, 'inner', []).reduce((acc, curr) => {
acc[ acc[
@ -291,6 +306,7 @@ function EditView({
return acc; return acc;
}, {}); }, {});
dispatch({ dispatch({
type: 'SET_ERRORS', type: 'SET_ERRORS',
errors, errors,
@ -322,13 +338,7 @@ function EditView({
keys: name.split('.'), keys: name.split('.'),
}); });
}} }}
onChange={({ target: { name, value } }) => { onChange={handleChange}
dispatch({
type: 'ON_CHANGE',
keys: name.split('.'),
value,
});
}}
onRemove={keys => { onRemove={keys => {
dispatch({ dispatch({
type: 'REMOVE_RELATION', type: 'REMOVE_RELATION',
@ -448,13 +458,7 @@ function EditView({
keys: name.split('.'), keys: name.split('.'),
}); });
}} }}
onChange={({ target: { name, value } }) => { onChange={handleChange}
dispatch({
type: 'ON_CHANGE',
keys: name.split('.'),
value,
});
}}
layout={get(groupLayoutsData, group.group, {})} layout={get(groupLayoutsData, group.group, {})}
pathname={pathname} pathname={pathname}
removeField={(keys, shouldAddEmptyField) => { removeField={(keys, shouldAddEmptyField) => {
@ -481,13 +485,7 @@ function EditView({
layout={layout} layout={layout}
modifiedData={modifiedData} modifiedData={modifiedData}
name={name} name={name}
onChange={({ target: { name, value } }) => { onChange={handleChange}
dispatch({
type: 'ON_CHANGE',
keys: name.split('.'),
value,
});
}}
/> />
); );
})} })}

View File

@ -130,7 +130,7 @@ const createYupSchemaAttribute = (type, validations) => {
.typeError(); .typeError();
} }
if (['date', 'datetime'].includes(type)) { if (['date', 'datetime'].includes(type)) {
schema = yup.date().typeError(); schema = yup.date();
} }
Object.keys(validations).forEach(validation => { Object.keys(validations).forEach(validation => {

View File

@ -45,12 +45,12 @@ const createSettingsSchema = (model, schema) => {
// should be reset when the type changes // should be reset when the type changes
mainField: yup mainField: yup
.string() .string()
.oneOf(validAttributes) .oneOf(validAttributes.concat('id'))
.default('id'), .default('id'),
// should be reset when the type changes // should be reset when the type changes
defaultSortBy: yup defaultSortBy: yup
.string() .string()
.oneOf(validAttributes) .oneOf(validAttributes.concat('id'))
.default('id'), .default('id'),
defaultSortOrder: yup defaultSortOrder: yup
.string() .string()

View File

@ -1,6 +1,6 @@
{ {
"name": "strapi-plugin-content-manager", "name": "strapi-plugin-content-manager",
"version": "3.0.0-beta.16.2", "version": "3.0.0-beta.16.3",
"description": "A powerful UI to easily manage your data.", "description": "A powerful UI to easily manage your data.",
"strapi": { "strapi": {
"name": "Content Manager", "name": "Content Manager",
@ -32,8 +32,8 @@
"redux-immutable": "^4.0.0", "redux-immutable": "^4.0.0",
"reselect": "^3.0.1", "reselect": "^3.0.1",
"showdown": "^1.9.0", "showdown": "^1.9.0",
"strapi-helper-plugin": "3.0.0-beta.16.2", "strapi-helper-plugin": "3.0.0-beta.16.3",
"strapi-utils": "3.0.0-beta.16.2", "strapi-utils": "3.0.0-beta.16.3",
"styled-components": "^4.2.0", "styled-components": "^4.2.0",
"yup": "^0.27.0" "yup": "^0.27.0"
}, },

View File

@ -35,6 +35,27 @@ describe('Test type json', () => {
}); });
}); });
test('Create entry with array value input JSON', async () => {
const inputValue = [
{
key: 'value',
},
{
key: 'value',
},
];
const res = await rq.post('/content-manager/explorer/withjson', {
body: {
field: inputValue,
},
});
expect(res.statusCode).toBe(200);
expect(res.body).toMatchObject({
field: inputValue,
});
});
test('Create entry with value input Formdata', async () => { test('Create entry with value input Formdata', async () => {
const inputValue = { const inputValue = {
number: '12', number: '12',

View File

@ -1,6 +1,6 @@
{ {
"name": "strapi-plugin-content-type-builder", "name": "strapi-plugin-content-type-builder",
"version": "3.0.0-beta.16.2", "version": "3.0.0-beta.16.3",
"description": "Strapi plugin to create content type (API).", "description": "Strapi plugin to create content type (API).",
"strapi": { "strapi": {
"name": "Content Type Builder", "name": "Content Type Builder",
@ -29,9 +29,9 @@
"redux": "^4.0.1", "redux": "^4.0.1",
"redux-immutable": "^4.0.0", "redux-immutable": "^4.0.0",
"reselect": "^3.0.1", "reselect": "^3.0.1",
"strapi-generate": "3.0.0-beta.16.2", "strapi-generate": "3.0.0-beta.16.3",
"strapi-generate-api": "3.0.0-beta.16.2", "strapi-generate-api": "3.0.0-beta.16.3",
"strapi-helper-plugin": "3.0.0-beta.16.2", "strapi-helper-plugin": "3.0.0-beta.16.3",
"yup": "^0.27.0" "yup": "^0.27.0"
}, },
"author": { "author": {

View File

@ -1,6 +1,6 @@
{ {
"name": "strapi-plugin-documentation", "name": "strapi-plugin-documentation",
"version": "3.0.0-beta.16.2", "version": "3.0.0-beta.16.3",
"description": "This is the description of the plugin.", "description": "This is the description of the plugin.",
"strapi": { "strapi": {
"name": "Documentation", "name": "Documentation",
@ -32,7 +32,7 @@
"redux": "^4.0.1", "redux": "^4.0.1",
"redux-immutable": "^4.0.0", "redux-immutable": "^4.0.0",
"reselect": "^4.0.0", "reselect": "^4.0.0",
"strapi-helper-plugin": "3.0.0-beta.16.2", "strapi-helper-plugin": "3.0.0-beta.16.3",
"swagger-ui-dist": "3.22.1" "swagger-ui-dist": "3.22.1"
}, },
"author": { "author": {

View File

@ -1,6 +1,6 @@
{ {
"name": "strapi-plugin-email", "name": "strapi-plugin-email",
"version": "3.0.0-beta.16.2", "version": "3.0.0-beta.16.3",
"description": "This is the description of the plugin.", "description": "This is the description of the plugin.",
"strapi": { "strapi": {
"name": "Email", "name": "Email",
@ -12,13 +12,13 @@
"test": "echo \"no tests yet\"" "test": "echo \"no tests yet\""
}, },
"dependencies": { "dependencies": {
"strapi-provider-email-sendmail": "3.0.0-beta.16.2", "strapi-provider-email-sendmail": "3.0.0-beta.16.3",
"strapi-utils": "3.0.0-beta.16.2" "strapi-utils": "3.0.0-beta.16.3"
}, },
"devDependencies": { "devDependencies": {
"react-copy-to-clipboard": "5.0.1", "react-copy-to-clipboard": "5.0.1",
"rimraf": "^2.6.3", "rimraf": "^2.6.3",
"strapi-helper-plugin": "3.0.0-beta.16.2" "strapi-helper-plugin": "3.0.0-beta.16.3"
}, },
"author": { "author": {
"name": "Strapi team", "name": "Strapi team",

View File

@ -1,6 +1,6 @@
{ {
"name": "strapi-plugin-graphql", "name": "strapi-plugin-graphql",
"version": "3.0.0-beta.16.2", "version": "3.0.0-beta.16.3",
"description": "This is the description of the plugin.", "description": "This is the description of the plugin.",
"strapi": { "strapi": {
"name": "graphql", "name": "graphql",
@ -23,7 +23,7 @@
"graphql-type-long": "^0.1.1", "graphql-type-long": "^0.1.1",
"koa-compose": "^4.1.0", "koa-compose": "^4.1.0",
"pluralize": "^7.0.0", "pluralize": "^7.0.0",
"strapi-utils": "3.0.0-beta.16.2" "strapi-utils": "3.0.0-beta.16.3"
}, },
"devDependencies": { "devDependencies": {
"cross-env": "^5.2.0", "cross-env": "^5.2.0",

View File

@ -19,11 +19,15 @@ module.exports = {
* @return Promise or Error. * @return Promise or Error.
*/ */
composeMutationResolver: function(_schema, plugin, name, action) { composeMutationResolver: function({ _schema, plugin, name, action }) {
// Extract custom resolver or type description. // Extract custom resolver or type description.
const { resolver: handler = {} } = _schema; const { resolver: handler = {} } = _schema;
const queryName = `${action}${_.capitalize(name)}`; let queryName = `${action}${_.capitalize(name)}`;
if (_.has(handler, `Mutation.${action}`)) {
queryName = action;
}
// Retrieve policies. // Retrieve policies.
const policies = _.get(handler, `Mutation.${queryName}.policies`, []); const policies = _.get(handler, `Mutation.${queryName}.policies`, []);
@ -155,7 +159,7 @@ module.exports = {
} }
if (strapi.plugins['users-permissions']) { if (strapi.plugins['users-permissions']) {
policies.push('plugins.users-permissions.permissions'); policies.unshift('plugins.users-permissions.permissions');
} }
// Populate policies. // Populate policies.

View File

@ -69,7 +69,7 @@ module.exports = {
* @return Promise or Error. * @return Promise or Error.
*/ */
composeQueryResolver: function(_schema, plugin, name, isSingular) { composeQueryResolver: function({ _schema, plugin, name, isSingular }) {
const params = { const params = {
model: name, model: name,
}; };
@ -236,7 +236,7 @@ module.exports = {
} }
if (strapi.plugins['users-permissions']) { if (strapi.plugins['users-permissions']) {
policies.push('plugins.users-permissions.permissions'); policies.unshift('plugins.users-permissions.permissions');
} }
// Populate policies. // Populate policies.

View File

@ -326,11 +326,21 @@ const buildShadowCRUD = (models, plugin) => {
const queries = { const queries = {
singular: singular:
_.get(resolver, `Query.${singularName}`) !== false _.get(resolver, `Query.${singularName}`) !== false
? Query.composeQueryResolver(_schema, plugin, name, true) ? Query.composeQueryResolver({
_schema,
plugin,
name,
isSingular: true,
})
: null, : null,
plural: plural:
_.get(resolver, `Query.${pluralName}`) !== false _.get(resolver, `Query.${pluralName}`) !== false
? Query.composeQueryResolver(_schema, plugin, name, false) ? Query.composeQueryResolver({
_schema,
plugin,
name,
isSingular: false,
})
: null, : null,
}; };
@ -376,15 +386,30 @@ const buildShadowCRUD = (models, plugin) => {
const mutations = { const mutations = {
create: create:
_.get(resolver, `Mutation.create${capitalizedName}`) !== false _.get(resolver, `Mutation.create${capitalizedName}`) !== false
? Mutation.composeMutationResolver(_schema, plugin, name, 'create') ? Mutation.composeMutationResolver({
_schema,
plugin,
name,
action: 'create',
})
: null, : null,
update: update:
_.get(resolver, `Mutation.update${capitalizedName}`) !== false _.get(resolver, `Mutation.update${capitalizedName}`) !== false
? Mutation.composeMutationResolver(_schema, plugin, name, 'update') ? Mutation.composeMutationResolver({
_schema,
plugin,
name,
action: 'update',
})
: null, : null,
delete: delete:
_.get(resolver, `Mutation.delete${capitalizedName}`) !== false _.get(resolver, `Mutation.delete${capitalizedName}`) !== false
? Mutation.composeMutationResolver(_schema, plugin, name, 'delete') ? Mutation.composeMutationResolver({
_schema,
plugin,
name,
action: 'delete',
})
: null, : null,
}; };

View File

@ -228,22 +228,22 @@ const schemaBuilder = {
const [name, action] = acc[type][resolver].split('.'); const [name, action] = acc[type][resolver].split('.');
const normalizedName = _.toLower(name); const normalizedName = _.toLower(name);
acc[type][resolver] = Mutation.composeMutationResolver( acc[type][resolver] = Mutation.composeMutationResolver({
strapi.plugins.graphql.config._schema.graphql, _schema: strapi.plugins.graphql.config._schema.graphql,
plugin, plugin,
normalizedName, name: normalizedName,
action action,
); });
break; break;
} }
case 'Query': case 'Query':
default: default:
acc[type][resolver] = Query.composeQueryResolver( acc[type][resolver] = Query.composeQueryResolver({
strapi.plugins.graphql.config._schema.graphql, _schema: strapi.plugins.graphql.config._schema.graphql,
plugin, plugin,
resolver, name: resolver,
'force' // Avoid singular/pluralize and force query name. isSingular: 'force', // Avoid singular/pluralize and force query name.
); });
break; break;
} }
} }

View File

@ -1,6 +1,6 @@
{ {
"name": "strapi-plugin-settings-manager", "name": "strapi-plugin-settings-manager",
"version": "3.0.0-beta.16.2", "version": "3.0.0-beta.16.3",
"description": "Strapi plugin to manage settings.", "description": "Strapi plugin to manage settings.",
"strapi": { "strapi": {
"name": "Settings Manager", "name": "Settings Manager",
@ -27,7 +27,7 @@
"redux": "^4.0.1", "redux": "^4.0.1",
"reselect": "^3.0.1", "reselect": "^3.0.1",
"shelljs": "^0.7.8", "shelljs": "^0.7.8",
"strapi-helper-plugin": "3.0.0-beta.16.2" "strapi-helper-plugin": "3.0.0-beta.16.3"
}, },
"author": { "author": {
"name": "Strapi team", "name": "Strapi team",

View File

@ -1,6 +1,6 @@
{ {
"name": "strapi-plugin-upload", "name": "strapi-plugin-upload",
"version": "3.0.0-beta.16.2", "version": "3.0.0-beta.16.3",
"description": "This is the description of the plugin.", "description": "This is the description of the plugin.",
"strapi": { "strapi": {
"name": "Files Upload", "name": "Files Upload",
@ -23,9 +23,9 @@
"react-router-dom": "^5.0.0", "react-router-dom": "^5.0.0",
"react-transition-group": "^2.5.0", "react-transition-group": "^2.5.0",
"reactstrap": "^5.0.0", "reactstrap": "^5.0.0",
"strapi-helper-plugin": "3.0.0-beta.16.2", "strapi-helper-plugin": "3.0.0-beta.16.3",
"strapi-provider-upload-local": "3.0.0-beta.16.2", "strapi-provider-upload-local": "3.0.0-beta.16.3",
"strapi-utils": "3.0.0-beta.16.2", "strapi-utils": "3.0.0-beta.16.3",
"stream-to-array": "^2.3.0", "stream-to-array": "^2.3.0",
"uuid": "^3.2.1" "uuid": "^3.2.1"
}, },

View File

@ -1,6 +1,6 @@
{ {
"name": "strapi-plugin-users-permissions", "name": "strapi-plugin-users-permissions",
"version": "3.0.0-beta.16.2", "version": "3.0.0-beta.16.3",
"description": "Protect your API with a full-authentication process based on JWT", "description": "Protect your API with a full-authentication process based on JWT",
"strapi": { "strapi": {
"name": "Roles & Permissions", "name": "Roles & Permissions",
@ -31,8 +31,8 @@
"reactstrap": "^5.0.0", "reactstrap": "^5.0.0",
"redux-saga": "^0.16.0", "redux-saga": "^0.16.0",
"request": "^2.83.0", "request": "^2.83.0",
"strapi-helper-plugin": "3.0.0-beta.16.2", "strapi-helper-plugin": "3.0.0-beta.16.3",
"strapi-utils": "3.0.0-beta.16.2", "strapi-utils": "3.0.0-beta.16.3",
"uuid": "^3.1.0" "uuid": "^3.1.0"
}, },
"devDependencies": { "devDependencies": {

View File

@ -1,6 +1,6 @@
{ {
"name": "strapi-provider-email-amazon-ses", "name": "strapi-provider-email-amazon-ses",
"version": "3.0.0-beta.16.2", "version": "3.0.0-beta.16.3",
"description": "Amazon SES provider for strapi email", "description": "Amazon SES provider for strapi email",
"homepage": "http://strapi.io", "homepage": "http://strapi.io",
"keywords": [ "keywords": [

View File

@ -1,6 +1,6 @@
{ {
"name": "strapi-provider-email-mailgun", "name": "strapi-provider-email-mailgun",
"version": "3.0.0-beta.16.2", "version": "3.0.0-beta.16.3",
"description": "Mailgun provider for strapi email plugin", "description": "Mailgun provider for strapi email plugin",
"homepage": "http://strapi.io", "homepage": "http://strapi.io",
"keywords": [ "keywords": [

View File

@ -1,6 +1,6 @@
{ {
"name": "strapi-provider-email-sendgrid", "name": "strapi-provider-email-sendgrid",
"version": "3.0.0-beta.16.2", "version": "3.0.0-beta.16.3",
"description": "Sendgrid provider for strapi email", "description": "Sendgrid provider for strapi email",
"homepage": "http://strapi.io", "homepage": "http://strapi.io",
"keywords": [ "keywords": [

View File

@ -1,6 +1,6 @@
{ {
"name": "strapi-provider-email-sendmail", "name": "strapi-provider-email-sendmail",
"version": "3.0.0-beta.16.2", "version": "3.0.0-beta.16.3",
"description": "Sendmail provider for strapi email", "description": "Sendmail provider for strapi email",
"homepage": "http://strapi.io", "homepage": "http://strapi.io",
"keywords": [ "keywords": [

View File

@ -1,6 +1,6 @@
{ {
"name": "strapi-provider-upload-aws-s3", "name": "strapi-provider-upload-aws-s3",
"version": "3.0.0-beta.16.2", "version": "3.0.0-beta.16.3",
"description": "AWS S3 provider for strapi upload", "description": "AWS S3 provider for strapi upload",
"homepage": "http://strapi.io", "homepage": "http://strapi.io",
"keywords": [ "keywords": [

View File

@ -1,6 +1,6 @@
{ {
"name": "strapi-provider-upload-cloudinary", "name": "strapi-provider-upload-cloudinary",
"version": "3.0.0-beta.16.2", "version": "3.0.0-beta.16.3",
"description": "Cloudinary provider for strapi upload", "description": "Cloudinary provider for strapi upload",
"homepage": "http://strapi.io", "homepage": "http://strapi.io",
"keywords": [ "keywords": [

View File

@ -1,6 +1,6 @@
{ {
"name": "strapi-provider-upload-local", "name": "strapi-provider-upload-local",
"version": "3.0.0-beta.16.2", "version": "3.0.0-beta.16.3",
"description": "Local provider for strapi upload", "description": "Local provider for strapi upload",
"homepage": "http://strapi.io", "homepage": "http://strapi.io",
"keywords": [ "keywords": [

View File

@ -1,6 +1,6 @@
{ {
"name": "strapi-provider-upload-rackspace", "name": "strapi-provider-upload-rackspace",
"version": "3.0.0-beta.16.2", "version": "3.0.0-beta.16.3",
"description": "Rackspace provider for strapi upload", "description": "Rackspace provider for strapi upload",
"main": "./lib", "main": "./lib",
"keywords": [], "keywords": [],

View File

@ -1,6 +1,6 @@
{ {
"name": "strapi-utils", "name": "strapi-utils",
"version": "3.0.0-beta.16.2", "version": "3.0.0-beta.16.3",
"description": "Shared utilities for the Strapi packages", "description": "Shared utilities for the Strapi packages",
"homepage": "http://strapi.io", "homepage": "http://strapi.io",
"keywords": [ "keywords": [

View File

@ -1,6 +1,6 @@
{ {
"name": "strapi", "name": "strapi",
"version": "3.0.0-beta.16.2", "version": "3.0.0-beta.16.3",
"description": "An open source headless CMS solution to create and manage your own API. It provides a powerful dashboard and features to make your life easier. Databases supported: MongoDB, MySQL, MariaDB, PostgreSQL, SQLite", "description": "An open source headless CMS solution to create and manage your own API. It provides a powerful dashboard and features to make your life easier. Databases supported: MongoDB, MySQL, MariaDB, PostgreSQL, SQLite",
"homepage": "http://strapi.io", "homepage": "http://strapi.io",
"directories": { "directories": {
@ -47,15 +47,15 @@
"resolve-cwd": "^3.0.0", "resolve-cwd": "^3.0.0",
"rimraf": "^2.6.2", "rimraf": "^2.6.2",
"shelljs": "^0.8.3", "shelljs": "^0.8.3",
"strapi-generate": "3.0.0-beta.16.2", "strapi-generate": "3.0.0-beta.16.3",
"strapi-generate-api": "3.0.0-beta.16.2", "strapi-generate-api": "3.0.0-beta.16.3",
"strapi-generate-controller": "3.0.0-beta.16.2", "strapi-generate-controller": "3.0.0-beta.16.3",
"strapi-generate-model": "3.0.0-beta.16.2", "strapi-generate-model": "3.0.0-beta.16.3",
"strapi-generate-new": "3.0.0-beta.16.2", "strapi-generate-new": "3.0.0-beta.16.3",
"strapi-generate-plugin": "3.0.0-beta.16.2", "strapi-generate-plugin": "3.0.0-beta.16.3",
"strapi-generate-policy": "3.0.0-beta.16.2", "strapi-generate-policy": "3.0.0-beta.16.3",
"strapi-generate-service": "3.0.0-beta.16.2", "strapi-generate-service": "3.0.0-beta.16.3",
"strapi-utils": "3.0.0-beta.16.2" "strapi-utils": "3.0.0-beta.16.3"
}, },
"scripts": { "scripts": {
"test": "jest --verbose", "test": "jest --verbose",