import { RequestNode , CacheConfig , Variables } from 'relay-runtime' ; import stableCopy from 'relay-runtime/lib/stableCopy.js' ; import stringHash from 'string-hash' ; export const isMutation = ( request ) => request . operationKind === 'mutation' ; export const mustForceFetch = ( cacheConfig ) => ! ! ( cacheConfig && cacheConfig . force ) ; export const getHash = ( request , variables ) : string => { const copy = stableCopy ( { variables : variables || { } , query : request . text , } ) ; const { name } = request ; const hash = stringHash ( JSON . stringify ( copy ) ) . toString ( ) ; return `${ name }_${ hash }` ; } ;