Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
): void {
const { ancestors, fieldNode, isEntity, isInterface, isUnion, possibleTypes, typeIDKey, typeName } = data;
const ancestorRequestFieldPath: string[] = [operation];
ancestors.forEach(ancestor => {
if (isPlainObject(ancestor) && getKind(ancestor as ASTNode) === FIELD) {
const ancestorFieldNode = ancestor as FieldNode;
ancestorRequestFieldPath.push(getAlias(ancestorFieldNode) || (getName(ancestorFieldNode) as string));
}
});
const fieldName = getAlias(fieldNode) || (getName(fieldNode) as string);
ancestorRequestFieldPath.push(fieldName);
const requestfieldPath = ancestorRequestFieldPath.join(".");
const argumentsObjectMap = getArguments(fieldNode);
const directives = getDirectives(fieldNode);
let typeIDValue: string | undefined;
if (argumentsObjectMap) {
if (argumentsObjectMap[typeIDKey]) {
typeIDValue = argumentsObjectMap[typeIDKey];
} else if (variables && variables[typeIDKey]) {
typeIDValue = variables[typeIDKey];
}
}
fieldTypeMap.set(requestfieldPath, {
hasArguments: !!argumentsObjectMap,
hasDirectives: !!directives,
isEntity,
isInterface,
isUnion,
private static _getFieldKeysAndPaths(field: FieldNode, options: KeysAndPathsOptions): KeysAndPaths {
const { index, requestFieldCacheKey = "", requestFieldPath = "", responseDataPath = "" } = options;
const name = getName(field) as string;
const updatedRequestFieldCacheKey = CacheManager._buildRequestFieldCacheKey(
name,
requestFieldCacheKey,
getArguments(field),
getDirectives(field),
index,
);
const fieldAliasOrName = getAlias(field) || name;
const updatedRequestFieldPath = isNumber(index)
? requestFieldPath
: CacheManager._buildKey(fieldAliasOrName, requestFieldPath);
const propNameOrIndex = isNumber(index) ? index : fieldAliasOrName;
const updatedResponseDataPath = CacheManager._buildKey(propNameOrIndex, responseDataPath);
return {
hashedRequestFieldCacheKey: hashRequest(updatedRequestFieldCacheKey),
propNameOrIndex,
requestFieldCacheKey: updatedRequestFieldCacheKey,