Socket
Socket
Sign inDemoInstall

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.2.8 to 0.2.9

67

lib/Connection.js

@@ -108,3 +108,3 @@ 'use strict';

var _ref = _asyncToGenerator(regeneratorRuntime.mark(function _callee(model, args) {
var after, _args$first, first, before, last, _args$condition, condition, _args$sort, sort, reverse, count, offset, result, index;
var after, _args$first, first, before, last, _args$condition, condition, _args$sort, sort, keywords, reverse, _fields, _value, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, _field, count, offset, result, index;

@@ -115,5 +115,56 @@ return regeneratorRuntime.wrap(function _callee$(_context) {

case 0:
after = args.after, _args$first = args.first, first = _args$first === undefined ? 100 : _args$first, before = args.before, last = args.last, _args$condition = args.condition, condition = _args$condition === undefined ? {} : _args$condition, _args$sort = args.sort, sort = _args$sort === undefined ? [{ field: 'id', order: 'ASC' }] : _args$sort;
after = args.after, _args$first = args.first, first = _args$first === undefined ? 100 : _args$first, before = args.before, last = args.last, _args$condition = args.condition, condition = _args$condition === undefined ? {} : _args$condition, _args$sort = args.sort, sort = _args$sort === undefined ? [{ field: 'id', order: 'ASC' }] : _args$sort, keywords = args.keywords;
reverse = false;
_context.next = 4;
if (!keywords) {
_context.next = 23;
break;
}
_fields = keywords.fields, _value = keywords.value;
_iteratorNormalCompletion = true;
_didIteratorError = false;
_iteratorError = undefined;
_context.prev = 7;
for (_iterator = _fields[Symbol.iterator](); !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
_field = _step.value;
condition[_field] = { $like: '%' + _value + '%' };
}
_context.next = 15;
break;
case 11:
_context.prev = 11;
_context.t0 = _context['catch'](7);
_didIteratorError = true;
_iteratorError = _context.t0;
case 15:
_context.prev = 15;
_context.prev = 16;
if (!_iteratorNormalCompletion && _iterator.return) {
_iterator.return();
}
case 18:
_context.prev = 18;
if (!_didIteratorError) {
_context.next = 21;
break;
}
throw _iteratorError;
case 21:
return _context.finish(18);
case 22:
return _context.finish(15);
case 23:
_context.next = 25;
return model.count({

@@ -123,3 +174,3 @@ where: condition

case 4:
case 25:
count = _context.sent;

@@ -140,3 +191,3 @@

offset = Math.max(after != null ? parseInt(after) : 0, 0);
_context.next = 9;
_context.next = 30;
return model.findAll({

@@ -151,3 +202,3 @@ where: condition,

case 9:
case 30:
result = _context.sent;

@@ -174,3 +225,3 @@ index = 0;

case 12:
case 33:
case 'end':

@@ -180,3 +231,3 @@ return _context.stop();

}
}, _callee, this);
}, _callee, this, [[7, 11, 15, 23], [16,, 18, 22]]);
}));

@@ -183,0 +234,0 @@

1

lib/Context.js

@@ -362,3 +362,2 @@ 'use strict';

model.config.associations.hasOne.forEach(function (config) {
console.log('*****', config);
self.dbModel(model.name).hasOne(self.dbModel(config.target), config.options);

@@ -365,0 +364,0 @@ });

{
"name": "simple-graphql",
"version": "0.2.8",
"version": "0.2.9",
"description": "The simple way to generates GraphQL schemas and Sequelize models from your models definition.",

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

@@ -58,3 +58,3 @@ 'use strict';

var _ref = _asyncToGenerator(regeneratorRuntime.mark(function _callee(root, args, context, info, models) {
var condition;
var condition, sort;
return regeneratorRuntime.wrap(function _callee$(_context) {

@@ -67,5 +67,6 @@ while (1) {

condition[_.get(hasManyCfg, 'options.foreignKey', name + 'Id')] = root.id;
return _context.abrupt('return', _Connection2.default.resolve(models[hasManyCfg.target], _extends({}, args, { condition: condition })));
sort = _.get(hasManyCfg, 'options.sort', [{ field: 'id', order: 'ASC' }]);
return _context.abrupt('return', _Connection2.default.resolve(models[hasManyCfg.target], _extends({}, args, { condition: condition, sort: sort })));
case 3:
case 4:
case 'end':

@@ -72,0 +73,0 @@ return _context.stop();

@@ -223,2 +223,12 @@ 'use strict';

description: 'Define the sort field'
},
keywords: {
fields: {
$type: [String],
required: true
},
value: {
$type: String,
required: true
}
}

@@ -263,6 +273,11 @@ }, _index2.default.Connection.args),

}
if (args && args.keywords && dbModel.options.underscored) {
args.keywords.fields = args.keywords.fields.map(function (field) {
return field.replace(/([A-Z])/g, '_$1').replace(/^_/, '').toLocaleLowerCase();
});
}
return _context.abrupt('return', _index2.default.Connection.resolve(dbModel, args));
case 3:
case 4:
case 'end':

@@ -269,0 +284,0 @@ return _context.stop();

@@ -67,5 +67,13 @@ 'use strict';

if (value && value['$type'] && value.required) {
model.belongsTo({ target: fType.name, options: { as: key, foreignKey: foreignKey, constraints: true } });
model.belongsTo({
target: fType.name,
hidden: true,
options: { as: key, foreignKey: foreignKey, constraints: true }
});
} else {
model.belongsTo({ target: fType.name, options: { as: key, foreignKey: foreignKey, constraints: false } });
model.belongsTo({
target: fType.name,
hidden: true,
options: { as: key, foreignKey: foreignKey, constraints: false }
});
}

@@ -72,0 +80,0 @@ } else {

{
"name": "simple-graphql",
"version": "0.2.8",
"version": "0.2.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

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc