Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

simple-graphql

Package Overview
Dependencies
Maintainers
1
Versions
300
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

simple-graphql - npm Package Compare versions

Comparing version 0.3.0 to 0.3.1

2

lib/package.json
{
"name": "simple-graphql",
"version": "0.3.0",
"version": "0.3.1",
"description": "The simple way to generates GraphQL schemas and Sequelize models from your models definition.",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

@@ -201,2 +201,6 @@ 'use strict';

if (model.config.options.pluralQuery && model.config.options.pluralQuery.conditionArgs) {
Object.assign(searchFields, model.config.options.pluralQuery.conditionArgs);
}
// 生产

@@ -244,3 +248,3 @@ return {

var _ref = _asyncToGenerator(regeneratorRuntime.mark(function _callee(args, context, info, models) {
var dbModel, _ref2, _ref2$sort, sort, _ref2$condition, condition, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, item, include, includeFields, _args$keywords, fields, value, keywordsCondition, associationType, _iteratorNormalCompletion4, _didIteratorError4, _iteratorError4, _iterator4, _step4, field, fieldName, type, colFieldName;
var dbModel, _ref2, _ref2$sort, sort, _ref2$condition, condition, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, item, include, includeFields, associationType, _args$keywords, fields, value, keywordsCondition, _iteratorNormalCompletion4, _didIteratorError4, _iteratorError4, _iterator4, _step4, field, fieldName, type, colFieldName;

@@ -312,30 +316,5 @@ return regeneratorRuntime.wrap(function _callee$(_context) {

_.forOwn(model.config.fields, function (value, key) {
if (value instanceof _ModelRef2.default || value && value.$type instanceof _ModelRef2.default) {
if (!key.endsWith('Id')) {
key = key + 'Id';
}
if (typeof condition[key] !== 'undefined') {
if (dbModel.options.underscored) {
var underscoredKey = _StringHelper2.default.toUnderscoredName(key);
if (underscoredKey !== key) {
condition[underscoredKey] = condition[key];
delete condition[key];
}
}
}
}
});
include = [];
includeFields = {};
if (!(args && args.keywords)) {
_context.next = 50;
break;
}
_args$keywords = args.keywords, fields = _args$keywords.fields, value = _args$keywords.value;
keywordsCondition = [];
associationType = function associationType(model, fieldName) {

@@ -399,2 +378,49 @@ var _iteratorNormalCompletion2 = true;

_.forOwn(model.config.fields, function (value, key) {
if (value instanceof _ModelRef2.default || value && value.$type instanceof _ModelRef2.default) {
if (typeof condition[key] !== 'undefined') {
if (!includeFields[key]) {
var type = associationType(model, key);
includeFields[key] = true;
include.push({
model: dbModel.sequelize.models[type],
as: key,
required: true
});
}
if (!condition.$and) {
condition.$and = [];
}
Object.keys(condition[key]).forEach(function (f) {
if (dbModel.options.underscored) {
condition.$and.push(_sequelize2.default.where(_sequelize2.default.col(_StringHelper2.default.toUnderscoredName(key + '.' + f)), { $eq: condition[key][f] }));
} else {
condition.$and.push(_sequelize2.default.where(_sequelize2.default.col(key + '.' + f), { $eq: condition[key][f] }));
}
});
delete condition[key];
}
if (!key.endsWith('Id')) {
key = key + 'Id';
}
if (typeof condition[key] !== 'undefined') {
if (dbModel.options.underscored) {
var underscoredKey = _StringHelper2.default.toUnderscoredName(key);
if (underscoredKey !== key) {
condition[underscoredKey] = condition[key];
delete condition[key];
}
}
}
}
});
if (!(args && args.keywords)) {
_context.next = 50;
break;
}
_args$keywords = args.keywords, fields = _args$keywords.fields, value = _args$keywords.value;
keywordsCondition = [];
_iteratorNormalCompletion4 = true;

@@ -405,2 +431,3 @@ _didIteratorError4 = false;

for (_iterator4 = fields[Symbol.iterator](); !(_iteratorNormalCompletion4 = (_step4 = _iterator4.next()).done); _iteratorNormalCompletion4 = true) {

@@ -407,0 +434,0 @@ field = _step4.value;

{
"name": "simple-graphql",
"version": "0.3.0",
"version": "0.3.1",
"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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc