graphql.execution.preparsed.persisted.ApolloPersistedQuerySupport Maven / Gradle / Ivy
package graphql.execution.preparsed.persisted;
import graphql.ExecutionInput;
import graphql.PublicApi;
import java.math.BigInteger;
import java.nio.charset.StandardCharsets;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.Map;
import java.util.Optional;
/**
* This persisted query support class supports the Apollo scheme where the persisted
* query id is in {@link graphql.ExecutionInput#getExtensions()}.
*
* You need to provide a {@link PersistedQueryCache} cache implementation
* as the backing cache.
*
* See Apollo Persisted Queries
*
* The Apollo client sends a hash of the persisted query in the input extensions in the following form
*
* {
* "extensions":{
* "persistedQuery":{
* "version":1,
* "sha256Hash":"fcf31818e50ac3e818ca4bdbc433d6ab73176f0b9d5f9d5ad17e200cdab6fba4"
* }
* }
* }
*
*
* @see graphql.ExecutionInput#getExtensions()
*/
@PublicApi
public class ApolloPersistedQuerySupport extends PersistedQuerySupport {
private static final String CHECKSUM_TYPE = "SHA-256";
public ApolloPersistedQuerySupport(PersistedQueryCache persistedQueryCache) {
super(persistedQueryCache);
}
@SuppressWarnings("unchecked")
@Override
protected Optional
© 2015 - 2024 Weber Informatics LLC | Privacy Policy