Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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,
requestFieldPath: updatedRequestFieldPath,
responseDataPath: updatedResponseDataPath,
};
}
private async _request(
request: string,
options: RequestOptions,
context: RequestContext,
): Promise | MaybeRequestResult> {
try {
const { ast, request: updateRequest } = await this._requestParser.updateRequest(request, options, context);
const requestData = { ast, hash: hashRequest(updateRequest), request: updateRequest };
return this._handleRequest(requestData, options, context);
} catch (error) {
return Promise.reject(error);
}
}
const cachedResponseData = await this._getCachedResponseData(requestData, options, context);
const { cacheMetadata, data, fieldCount } = cachedResponseData;
if (fieldCount.missing === fieldCount.total) return { updated: requestData };
if (!fieldCount.missing) {
const dataCaching = this._setQueryResponseCacheEntry(hash, { cacheMetadata, data }, options, context);
if (options.awaitDataCaching) await dataCaching;
return { response: { cacheMetadata, data } };
}
this._setPartialQueryResponse(hash, { cacheMetadata, data }, options, context);
this._filterQuery(requestData, cachedResponseData, context);
const request = print(ast);
return { updated: { ast, hash: hashRequest(request), request } };
}