simple-graphql
Advanced tools
Comparing version 3.1.16 to 3.1.17
@@ -292,9 +292,21 @@ "use strict"; | ||
if (schemas.find(s => s.name === subTypeName) != null) { | ||
if (root[fieldName] != null && root[fieldName].length > 0 && (typeof root[fieldName][0] === 'string' || typeof root[fieldName][0] === 'number')) { | ||
if (root[fieldName] != null && root[fieldName].length > 0 && | ||
(typeof root[fieldName][0] === 'string' || | ||
typeof root[fieldName][0] === 'number' || | ||
(root[fieldName][0] != null && typeof root[fieldName][0].id === 'string' && relay.fromGlobalId(root[fieldName][0].id).type === subTypeName))) { | ||
const dbModel = sgContext.models[subTypeName]; | ||
const ids = root[fieldName].map(r => { | ||
if (typeof r === 'string' && relay.fromGlobalId(r).type === subTypeName) { | ||
return relay.fromGlobalId(r).id; | ||
} | ||
else if (r != null && typeof r.id === 'string' && relay.fromGlobalId(r.id).type === subTypeName) { | ||
return relay.fromGlobalId(r).id; | ||
} | ||
return r; | ||
}); | ||
const list = yield (dbModel.withCache ? dbModel.withCache() : dbModel).findAll({ | ||
where: { id: { [sequelize_1.default.Op.in]: root[fieldName] } } | ||
where: { id: { [sequelize_1.default.Op.in]: ids } } | ||
}); | ||
const result = []; | ||
for (const id of root[fieldName]) { | ||
for (const id of ids) { | ||
const element = list.find(e => '' + e.id === '' + id); | ||
@@ -301,0 +313,0 @@ if (element) { |
{ | ||
"name": "simple-graphql", | ||
"version": "3.1.16", | ||
"version": "3.1.17", | ||
"description": "The simple way to generates GraphQL schemas and Sequelize models from your models definition.", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
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
328178
4649