Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
resolve: (_root, options, { geneFamiliesLoader }) => {
const gravityOptions = Object.assign(
{},
convertConnectionArgsToGravityArgs(options),
{
sort: "position",
}
)
return connectionFromPromisedArray(
geneFamiliesLoader(gravityOptions),
// FIXME: Need to type properly
// @ts-ignore
gravityOptions
)
},
}
// TODO better implementation
if (safeFilter.eq) {
safeFilter.in = [safeFilter.eq];
delete safeFilter.eq;
}
query[`data.${fieldName}`] = mapKeys(safeFilter, (value, key) => `$${key}`);
});
// Merge orderBy's
const sort = reduce(args.orderBy, (soFar, value) => Object.assign(soFar, value), {});
// Get all the data (ids only), using the optional sort
const getDataPromise = classesFieldsHelper._getAllClassData(className, { query, sort });
// Apply "connectionFromPromisedArray" to the result, which will filter the results
return connectionFromPromisedArray(getDataPromise, args)
.then((result) => {
// Then, we query the real data
const classesIds = map(result.edges, (edge) => edge.node._id);
const edgesPromise = classesFieldsHelper._getManyClassDataByIds(className, classesIds)
.then((results) => map(result.edges, (edge) => ({
...edge,
node: find(results, { mongoId: edge.node._id.toString() }),
})));
// Total count
const countPromise = getDataPromise.then((results) => results.length);
return Promise.props({ edges: edgesPromise, totalCount: countPromise })
.then(({ edges, totalCount }) => ({
...result,
edges,
resolve: (root, args) =>
connectionFromPromisedArray(resolveArrayByClass(Person, true), args)
},
resolve: (_, args) => connectionFromPromisedArray(getCharacters(), args),
},
resolve: (person, args) => {
return connectionFromPromisedArray(
resolveArrayData(person.getPosts(), true), args
)
}
}
resolve: (_, args) => connectionFromPromisedArray(
getVideos(),
args
),
},
resolve: (_, { slug, ...args }, { viewer }) => connectionFromPromisedArray(
categoryRepository.query(viewer, { slug }),
args
),
});
resolve: (obj, args) => {
return connectionFromPromisedArray(generateResolvedPromisedArray(obj, 'games', 'game'), args);
}
},
resolve : async (_, { title, ...args }) => {
const conditions = {
title,
};
const [
connection,
count,
] = await Promise.all([
connectionFromPromisedArray(getAllTagsByChar(conditions), args),
]);
return ({
...connection,
count,
});
},
};
.then(() => {
let ctxOptions = { accessToken: context.req.accessToken }
let wrap = promisify(model[method.name](params, ctxOptions));
if (typeObj.list) {
return connectionFromPromisedArray(wrap, args, model);
} else {
return wrap;
}
})
.catch((err) => {