Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
fragmentSelections.forEach((s) => {
if (variables && !shouldInclude(s, variables)) {
// Skip this entirely
return;
}
const selName = getDefinitionID(s);
if (!(selName in o)) {
o[selName] = s;
return;
}
o[selName] = mergeDefinitions(o[selName], s);
});
return o;
const execute = async (selection: SelectionNode): Promise => {
if (!shouldInclude(selection, variables)) {
// Skip this entirely.
return;
}
if (isField(selection)) {
return this.resolveField(selection, rootValue, execContext).then(
fieldResult => {
if (typeof fieldResult !== 'undefined') {
resultsToMerge.push({
[resultKeyNameFromField(selection)]: fieldResult,
} as TData);
}
},
);
}
selectionSet.selections.forEach(selection => {
if (!shouldInclude(selection, variables)) {
// Skip this entirely
return;
}
if (isField(selection)) {
const fieldResult = handleMissing(
this.executeField(object, typename, selection, execContext),
);
if (typeof fieldResult !== 'undefined') {
objectsToMerge.push({
[resultKeyNameFromField(selection)]: fieldResult,
});
}
} else {
selectionSet.selections.forEach(selection => {
if (!shouldInclude(selection, variables)) {
// Skip this entirely
return;
}
if (isField(selection)) {
const fieldResult = executeField(selection, rootValue, execContext);
const resultFieldKey = resultKeyNameFromField(selection);
if (fieldResult !== undefined) {
if (result[resultFieldKey] === undefined) {
result[resultFieldKey] = fieldResult;
} else {
merge(result[resultFieldKey], fieldResult);
}
}
selectionSet.selections.forEach(selection => {
if (!shouldInclude(selection, variables)) {
// Skip this entirely
return;
}
if (isField(selection)) {
const fieldResult = executeField(selection, rootValue, execContext);
const resultFieldKey = resultKeyNameFromField(selection);
if (fieldResult !== undefined) {
if (result[resultFieldKey] === undefined) {
result[resultFieldKey] = fieldResult;
} else {
merge(result[resultFieldKey], fieldResult);
}
}
const execute = async selection => {
if (!shouldInclude(selection, variables)) {
// Skip this entirely
return;
}
if (isField(selection)) {
const fieldResult = await executeField(selection, rootValue, execContext);
const resultFieldKey = resultKeyNameFromField(selection);
if (fieldResult !== undefined) {
if (result[resultFieldKey] === undefined) {
result[resultFieldKey] = fieldResult;
} else {
merge(result[resultFieldKey], fieldResult);
}
}
const selectionsMap = definition.selectionSet.selections.reduce((o, sel) => {
if (variables && !shouldInclude(sel, variables)) {
// Skip this entirely
return o;
}
if (sel.kind !== 'FragmentSpread') {
const transformed = transformDefinition(sel, execContext, path, gqlType);
const name = getDefinitionID(sel);
// Merge existing value.
if (name in o) {
o[name] = mergeDefinitions(o[name], transformed);
return o;
}
o[name] = transformed;
return o;
selectionSet.selections.forEach(selection => {
if (!shouldInclude(selection, variables)) {
return;
}
if (isField(selection)) {
const resultFieldKey: string = resultKeyNameFromField(selection);
const value: any = result[resultFieldKey];
if (typeof value !== 'undefined') {
this.writeFieldToStore({
dataId,
value,
field: selection,
context,
});
} else {
let isDefered = false;
selectionSet.selections.forEach(function (selection) {
var included = shouldInclude(selection, variables);
if (isField(selection)) {
var resultFieldKey = resultKeyNameFromField(selection);
var value = result[resultFieldKey];
if (included) {
if (typeof value !== 'undefined') {
writeFieldToStore({
dataId: dataId,
value: value,
field: selection,
context: context,
});
}
else {
var isDefered = selection.directives &&
selection.directives.length &&
selection.directives.some(function (directive) { return directive.name && directive.name.value === 'defer'; });