simple-graphql
Advanced tools
Comparing version 0.3.8 to 0.3.9
@@ -6,2 +6,5 @@ 'use strict'; | ||
}); | ||
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; | ||
exports.default = addMutation; | ||
@@ -45,3 +48,3 @@ | ||
var config = {}; | ||
var inputFields = {}; | ||
_lodash2.default.forOwn(model.config.fields, function (value, key) { | ||
@@ -55,11 +58,16 @@ if (value instanceof _ModelRef2.default || value && value.$type instanceof _ModelRef2.default) { | ||
if (!value.hidden && value.initializable !== false) { | ||
config[key] = value; | ||
inputFields[key] = value; | ||
} | ||
} else { | ||
config[key] = value; | ||
inputFields[key] = value; | ||
} | ||
}); | ||
var config = {}; | ||
if (_typeof(model.config.options.addMutation) === 'object') { | ||
config = model.config.options.addMutation; | ||
} | ||
return { | ||
name: name, | ||
inputFields: config, | ||
config: config, | ||
inputFields: inputFields, | ||
outputFields: _defineProperty({}, addedName, _index2.default.Connection.edgeType(_index2.default.modelRef(model.name))), | ||
@@ -66,0 +74,0 @@ mutateAndGetPayload: function () { |
@@ -6,2 +6,5 @@ 'use strict'; | ||
}); | ||
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; | ||
exports.default = deleteMutation; | ||
@@ -41,4 +44,9 @@ | ||
var name = 'delete' + _StringHelper2.default.toInitialUpperCase(model.name); | ||
var config = {}; | ||
if (_typeof(model.config.options.deleteMutation) === 'object') { | ||
config = model.config.options.deleteMutation; | ||
} | ||
return { | ||
name: name, | ||
config: config, | ||
inputFields: { | ||
@@ -45,0 +53,0 @@ id: { |
@@ -7,2 +7,4 @@ 'use strict'; | ||
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; | ||
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; | ||
@@ -48,3 +50,3 @@ | ||
var config = { | ||
var inputFields = { | ||
id: { | ||
@@ -64,12 +66,18 @@ $type: _index2.default.modelRef(model.name), | ||
if (!value.hidden && value.mutable !== false) { | ||
config.values[key] = _extends({}, value, { required: false, default: null }); | ||
inputFields.values[key] = _extends({}, value, { required: false, default: null }); | ||
} | ||
} else { | ||
config.values[key] = value; | ||
inputFields.values[key] = value; | ||
} | ||
}); | ||
var config = {}; | ||
if (_typeof(model.config.options.updateMutation) === 'object') { | ||
config = model.config.options.updateMutation; | ||
} | ||
return { | ||
name: name, | ||
inputFields: config, | ||
config: config, | ||
inputFields: inputFields, | ||
outputFields: _defineProperty({}, changedName, _index2.default.modelRef(model.name)), | ||
@@ -76,0 +84,0 @@ mutateAndGetPayload: function () { |
{ | ||
"name": "simple-graphql", | ||
"version": "0.3.8", | ||
"version": "0.3.9", | ||
"description": "The simple way to generates GraphQL schemas and Sequelize models from your models definition.", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -9,2 +9,4 @@ 'use strict'; | ||
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; | ||
exports.default = pluralQuery; | ||
@@ -206,5 +208,11 @@ | ||
var config = {}; | ||
if (_typeof(model.config.options.pluralQuery) === 'object') { | ||
config = model.config.options.pluralQuery; | ||
} | ||
// 生产 | ||
return { | ||
name: name, | ||
config: config, | ||
$type: _index2.default.Connection.connectionType(_index2.default.modelRef(model.name)), | ||
@@ -326,6 +334,6 @@ args: _extends({ | ||
for (var _iterator2 = model.config.associations.hasOne[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) { | ||
var config = _step2.value; | ||
var _config = _step2.value; | ||
if (_.get(config, 'options.as') === fieldName) { | ||
return config.target; | ||
if (_.get(_config, 'options.as') === fieldName) { | ||
return _config.target; | ||
} | ||
@@ -354,6 +362,6 @@ } | ||
for (var _iterator3 = model.config.associations.belongsTo[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) { | ||
var _config = _step3.value; | ||
var _config2 = _step3.value; | ||
if (_.get(_config, 'options.as') === fieldName) { | ||
return _config.target; | ||
if (_.get(_config2, 'options.as') === fieldName) { | ||
return _config2.target; | ||
} | ||
@@ -360,0 +368,0 @@ } |
@@ -9,2 +9,4 @@ 'use strict'; | ||
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; | ||
exports.default = singularQuery; | ||
@@ -54,4 +56,10 @@ | ||
var config = {}; | ||
if (_typeof(model.config.options.singularQuery) === 'object') { | ||
config = model.config.options.singularQuery; | ||
} | ||
return { | ||
name: name, | ||
config: config, | ||
$type: _index2.default.modelRef(model.name), | ||
@@ -58,0 +66,0 @@ args: searchFields, |
{ | ||
"name": "simple-graphql", | ||
"version": "0.3.8", | ||
"version": "0.3.9", | ||
"description": "The simple way to generates GraphQL schemas and Sequelize models from your models definition.", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
294861
5060