diff --git a/normalized-cache-incubating/api/normalized-cache-incubating.api b/normalized-cache-incubating/api/normalized-cache-incubating.api index b0ce82f6..26807113 100644 --- a/normalized-cache-incubating/api/normalized-cache-incubating.api +++ b/normalized-cache-incubating/api/normalized-cache-incubating.api @@ -8,7 +8,7 @@ public abstract interface class com/apollographql/cache/normalized/ApolloStore { public abstract fun normalize (Lcom/apollographql/apollo/api/Operation;Lcom/apollographql/apollo/api/Operation$Data;Lcom/apollographql/apollo/api/CustomScalarAdapters;)Ljava/util/Map; public abstract fun publish (Ljava/util/Set;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public abstract fun readFragment (Lcom/apollographql/apollo/api/Fragment;Lcom/apollographql/cache/normalized/api/CacheKey;Lcom/apollographql/apollo/api/CustomScalarAdapters;Lcom/apollographql/cache/normalized/api/CacheHeaders;)Lcom/apollographql/cache/normalized/ApolloStore$ReadResult; - public abstract fun readOperation (Lcom/apollographql/apollo/api/Operation;Lcom/apollographql/apollo/api/CustomScalarAdapters;Lcom/apollographql/cache/normalized/api/CacheHeaders;)Lcom/apollographql/cache/normalized/ApolloStore$ReadResult; + public abstract fun readOperation (Lcom/apollographql/apollo/api/Operation;Lcom/apollographql/apollo/api/CustomScalarAdapters;Lcom/apollographql/cache/normalized/api/CacheHeaders;)Lcom/apollographql/apollo/api/ApolloResponse; public abstract fun remove (Lcom/apollographql/cache/normalized/api/CacheKey;Z)Z public abstract fun remove (Ljava/util/List;Z)I public abstract fun rollbackOptimisticUpdates (Ljava/util/UUID;)Ljava/util/Set; @@ -24,7 +24,7 @@ public final class com/apollographql/cache/normalized/ApolloStore$Companion { public final class com/apollographql/cache/normalized/ApolloStore$DefaultImpls { public static synthetic fun readFragment$default (Lcom/apollographql/cache/normalized/ApolloStore;Lcom/apollographql/apollo/api/Fragment;Lcom/apollographql/cache/normalized/api/CacheKey;Lcom/apollographql/apollo/api/CustomScalarAdapters;Lcom/apollographql/cache/normalized/api/CacheHeaders;ILjava/lang/Object;)Lcom/apollographql/cache/normalized/ApolloStore$ReadResult; - public static synthetic fun readOperation$default (Lcom/apollographql/cache/normalized/ApolloStore;Lcom/apollographql/apollo/api/Operation;Lcom/apollographql/apollo/api/CustomScalarAdapters;Lcom/apollographql/cache/normalized/api/CacheHeaders;ILjava/lang/Object;)Lcom/apollographql/cache/normalized/ApolloStore$ReadResult; + public static synthetic fun readOperation$default (Lcom/apollographql/cache/normalized/ApolloStore;Lcom/apollographql/apollo/api/Operation;Lcom/apollographql/apollo/api/CustomScalarAdapters;Lcom/apollographql/cache/normalized/api/CacheHeaders;ILjava/lang/Object;)Lcom/apollographql/apollo/api/ApolloResponse; public static synthetic fun remove$default (Lcom/apollographql/cache/normalized/ApolloStore;Lcom/apollographql/cache/normalized/api/CacheKey;ZILjava/lang/Object;)Z public static synthetic fun remove$default (Lcom/apollographql/cache/normalized/ApolloStore;Ljava/util/List;ZILjava/lang/Object;)I public static synthetic fun writeFragment$default (Lcom/apollographql/cache/normalized/ApolloStore;Lcom/apollographql/apollo/api/Fragment;Lcom/apollographql/cache/normalized/api/CacheKey;Lcom/apollographql/apollo/api/Fragment$Data;Lcom/apollographql/apollo/api/CustomScalarAdapters;Lcom/apollographql/cache/normalized/api/CacheHeaders;ILjava/lang/Object;)Ljava/util/Set; @@ -46,7 +46,7 @@ public final class com/apollographql/cache/normalized/ApolloStoreKt { public final class com/apollographql/cache/normalized/CacheInfo : com/apollographql/apollo/api/ExecutionContext$Element { public static final field Key Lcom/apollographql/cache/normalized/CacheInfo$Key; - public synthetic fun (JJJJZLcom/apollographql/apollo/exception/CacheMissException;Lcom/apollographql/apollo/exception/ApolloException;ZLkotlin/jvm/internal/DefaultConstructorMarker;)V + public synthetic fun (JJJJZZLcom/apollographql/apollo/exception/CacheMissException;Lcom/apollographql/apollo/exception/ApolloException;ZLkotlin/jvm/internal/DefaultConstructorMarker;)V public final fun getCacheEndMillis ()J public final fun getCacheMissException ()Lcom/apollographql/apollo/exception/CacheMissException; public final fun getCacheStartMillis ()J @@ -55,6 +55,7 @@ public final class com/apollographql/cache/normalized/CacheInfo : com/apollograp public final fun getNetworkException ()Lcom/apollographql/apollo/exception/ApolloException; public final fun getNetworkStartMillis ()J public final fun isCacheHit ()Z + public final fun isFromCache ()Z public final fun isStale ()Z public final fun newBuilder ()Lcom/apollographql/cache/normalized/CacheInfo$Builder; } @@ -66,6 +67,7 @@ public final class com/apollographql/cache/normalized/CacheInfo$Builder { public final fun cacheHit (Z)Lcom/apollographql/cache/normalized/CacheInfo$Builder; public final fun cacheMissException (Lcom/apollographql/apollo/exception/CacheMissException;)Lcom/apollographql/cache/normalized/CacheInfo$Builder; public final fun cacheStartMillis (J)Lcom/apollographql/cache/normalized/CacheInfo$Builder; + public final fun fromCache (Z)Lcom/apollographql/cache/normalized/CacheInfo$Builder; public final fun networkEndMillis (J)Lcom/apollographql/cache/normalized/CacheInfo$Builder; public final fun networkException (Lcom/apollographql/apollo/exception/ApolloException;)Lcom/apollographql/cache/normalized/CacheInfo$Builder; public final fun networkStartMillis (J)Lcom/apollographql/cache/normalized/CacheInfo$Builder; @@ -139,11 +141,13 @@ public final class com/apollographql/cache/normalized/NormalizedCache { public static final fun configureApolloClientBuilder2 (Lcom/apollographql/apollo/ApolloClient$Builder;Lcom/apollographql/cache/normalized/api/NormalizedCacheFactory;Lcom/apollographql/cache/normalized/api/CacheKeyGenerator;Lcom/apollographql/cache/normalized/api/MetadataGenerator;Lcom/apollographql/cache/normalized/api/CacheResolver;Lcom/apollographql/cache/normalized/api/RecordMerger;Lcom/apollographql/cache/normalized/api/FieldKeyGenerator;Lcom/apollographql/cache/normalized/api/EmbeddedFieldsProvider;Z)Lcom/apollographql/apollo/ApolloClient$Builder; public static synthetic fun configureApolloClientBuilder2$default (Lcom/apollographql/apollo/ApolloClient$Builder;Lcom/apollographql/cache/normalized/api/NormalizedCacheFactory;Lcom/apollographql/cache/normalized/api/CacheKeyGenerator;Lcom/apollographql/cache/normalized/api/MetadataGenerator;Lcom/apollographql/cache/normalized/api/CacheResolver;Lcom/apollographql/cache/normalized/api/RecordMerger;Lcom/apollographql/cache/normalized/api/FieldKeyGenerator;Lcom/apollographql/cache/normalized/api/EmbeddedFieldsProvider;ZILjava/lang/Object;)Lcom/apollographql/apollo/ApolloClient$Builder; public static final fun doNotStore (Lcom/apollographql/apollo/api/MutableExecutionOptions;Z)Ljava/lang/Object; + public static final fun fetchFromCache (Lcom/apollographql/apollo/api/ApolloRequest$Builder;Z)Lcom/apollographql/apollo/api/ApolloRequest$Builder; public static final fun fetchPolicy (Lcom/apollographql/apollo/api/MutableExecutionOptions;Lcom/apollographql/cache/normalized/FetchPolicy;)Ljava/lang/Object; public static final fun fetchPolicyInterceptor (Lcom/apollographql/apollo/api/MutableExecutionOptions;Lcom/apollographql/apollo/interceptor/ApolloInterceptor;)Ljava/lang/Object; public static final fun getApolloStore (Lcom/apollographql/apollo/ApolloClient;)Lcom/apollographql/cache/normalized/ApolloStore; public static final fun getCacheHeaders (Lcom/apollographql/apollo/api/ApolloResponse;)Lcom/apollographql/cache/normalized/api/CacheHeaders; public static final fun getCacheInfo (Lcom/apollographql/apollo/api/ApolloResponse;)Lcom/apollographql/cache/normalized/CacheInfo; + public static final fun getFetchFromCache (Lcom/apollographql/apollo/api/ApolloRequest;)Z public static final fun isFromCache (Lcom/apollographql/apollo/api/ApolloResponse;)Z public static final fun maxStale-HG0u8IE (Lcom/apollographql/apollo/api/MutableExecutionOptions;J)Ljava/lang/Object; public static final fun memoryCacheOnly (Lcom/apollographql/apollo/api/MutableExecutionOptions;Z)Ljava/lang/Object; diff --git a/normalized-cache-incubating/api/normalized-cache-incubating.klib.api b/normalized-cache-incubating/api/normalized-cache-incubating.klib.api index ffcf6097..fe931702 100644 --- a/normalized-cache-incubating/api/normalized-cache-incubating.klib.api +++ b/normalized-cache-incubating/api/normalized-cache-incubating.klib.api @@ -6,41 +6,53 @@ // - Show declarations: true // Library unique name: -abstract class com.apollographql.cache.normalized.api/CacheKeyResolver : com.apollographql.cache.normalized.api/CacheResolver { // com.apollographql.cache.normalized.api/CacheKeyResolver|null[0] - abstract fun cacheKeyForField(com.apollographql.cache.normalized.api/ResolverContext): com.apollographql.cache.normalized.api/CacheKey? // com.apollographql.cache.normalized.api/CacheKeyResolver.cacheKeyForField|cacheKeyForField(com.apollographql.cache.normalized.api.ResolverContext){}[0] - constructor () // com.apollographql.cache.normalized.api/CacheKeyResolver.|(){}[0] - final fun resolveField(com.apollographql.cache.normalized.api/ResolverContext): kotlin/Any? // com.apollographql.cache.normalized.api/CacheKeyResolver.resolveField|resolveField(com.apollographql.cache.normalized.api.ResolverContext){}[0] - open fun listOfCacheKeysForField(com.apollographql.cache.normalized.api/ResolverContext): kotlin.collections/List? // com.apollographql.cache.normalized.api/CacheKeyResolver.listOfCacheKeysForField|listOfCacheKeysForField(com.apollographql.cache.normalized.api.ResolverContext){}[0] -} -abstract class com.apollographql.cache.normalized.api/NormalizedCacheFactory { // com.apollographql.cache.normalized.api/NormalizedCacheFactory|null[0] - abstract fun create(): com.apollographql.cache.normalized.api/NormalizedCache // com.apollographql.cache.normalized.api/NormalizedCacheFactory.create|create(){}[0] - constructor () // com.apollographql.cache.normalized.api/NormalizedCacheFactory.|(){}[0] +final enum class com.apollographql.cache.normalized/FetchPolicy : kotlin/Enum { // com.apollographql.cache.normalized/FetchPolicy|null[0] + enum entry CacheAndNetwork // com.apollographql.cache.normalized/FetchPolicy.CacheAndNetwork|null[0] + enum entry CacheFirst // com.apollographql.cache.normalized/FetchPolicy.CacheFirst|null[0] + enum entry CacheOnly // com.apollographql.cache.normalized/FetchPolicy.CacheOnly|null[0] + enum entry NetworkFirst // com.apollographql.cache.normalized/FetchPolicy.NetworkFirst|null[0] + enum entry NetworkOnly // com.apollographql.cache.normalized/FetchPolicy.NetworkOnly|null[0] + + final val entries // com.apollographql.cache.normalized/FetchPolicy.entries|#static{}entries[0] + final fun (): kotlin.enums/EnumEntries // com.apollographql.cache.normalized/FetchPolicy.entries.|#static(){}[0] + + final fun valueOf(kotlin/String): com.apollographql.cache.normalized/FetchPolicy // com.apollographql.cache.normalized/FetchPolicy.valueOf|valueOf#static(kotlin.String){}[0] + final fun values(): kotlin/Array // com.apollographql.cache.normalized/FetchPolicy.values|values#static(){}[0] } + abstract interface com.apollographql.cache.normalized.api/CacheKeyGenerator { // com.apollographql.cache.normalized.api/CacheKeyGenerator|null[0] abstract fun cacheKeyForObject(kotlin.collections/Map, com.apollographql.cache.normalized.api/CacheKeyGeneratorContext): com.apollographql.cache.normalized.api/CacheKey? // com.apollographql.cache.normalized.api/CacheKeyGenerator.cacheKeyForObject|cacheKeyForObject(kotlin.collections.Map;com.apollographql.cache.normalized.api.CacheKeyGeneratorContext){}[0] } + abstract interface com.apollographql.cache.normalized.api/CacheResolver { // com.apollographql.cache.normalized.api/CacheResolver|null[0] abstract fun resolveField(com.apollographql.cache.normalized.api/ResolverContext): kotlin/Any? // com.apollographql.cache.normalized.api/CacheResolver.resolveField|resolveField(com.apollographql.cache.normalized.api.ResolverContext){}[0] + final class ResolvedValue { // com.apollographql.cache.normalized.api/CacheResolver.ResolvedValue|null[0] constructor (kotlin/Any?, com.apollographql.cache.normalized.api/CacheHeaders) // com.apollographql.cache.normalized.api/CacheResolver.ResolvedValue.|(kotlin.Any?;com.apollographql.cache.normalized.api.CacheHeaders){}[0] + final val cacheHeaders // com.apollographql.cache.normalized.api/CacheResolver.ResolvedValue.cacheHeaders|{}cacheHeaders[0] final fun (): com.apollographql.cache.normalized.api/CacheHeaders // com.apollographql.cache.normalized.api/CacheResolver.ResolvedValue.cacheHeaders.|(){}[0] final val value // com.apollographql.cache.normalized.api/CacheResolver.ResolvedValue.value|{}value[0] final fun (): kotlin/Any? // com.apollographql.cache.normalized.api/CacheResolver.ResolvedValue.value.|(){}[0] } } + abstract interface com.apollographql.cache.normalized.api/EmbeddedFieldsProvider { // com.apollographql.cache.normalized.api/EmbeddedFieldsProvider|null[0] abstract fun getEmbeddedFields(com.apollographql.cache.normalized.api/EmbeddedFieldsContext): kotlin.collections/List // com.apollographql.cache.normalized.api/EmbeddedFieldsProvider.getEmbeddedFields|getEmbeddedFields(com.apollographql.cache.normalized.api.EmbeddedFieldsContext){}[0] } + abstract interface com.apollographql.cache.normalized.api/FieldKeyGenerator { // com.apollographql.cache.normalized.api/FieldKeyGenerator|null[0] abstract fun getFieldKey(com.apollographql.cache.normalized.api/FieldKeyContext): kotlin/String // com.apollographql.cache.normalized.api/FieldKeyGenerator.getFieldKey|getFieldKey(com.apollographql.cache.normalized.api.FieldKeyContext){}[0] } + abstract interface com.apollographql.cache.normalized.api/MaxAgeProvider { // com.apollographql.cache.normalized.api/MaxAgeProvider|null[0] abstract fun getMaxAge(com.apollographql.cache.normalized.api/MaxAgeContext): kotlin.time/Duration // com.apollographql.cache.normalized.api/MaxAgeProvider.getMaxAge|getMaxAge(com.apollographql.cache.normalized.api.MaxAgeContext){}[0] } + abstract interface com.apollographql.cache.normalized.api/MetadataGenerator { // com.apollographql.cache.normalized.api/MetadataGenerator|null[0] abstract fun metadataForObject(kotlin/Any?, com.apollographql.cache.normalized.api/MetadataGeneratorContext): kotlin.collections/Map // com.apollographql.cache.normalized.api/MetadataGenerator.metadataForObject|metadataForObject(kotlin.Any?;com.apollographql.cache.normalized.api.MetadataGeneratorContext){}[0] } + abstract interface com.apollographql.cache.normalized.api/NormalizedCache : com.apollographql.cache.normalized.api/ReadOnlyNormalizedCache { // com.apollographql.cache.normalized.api/NormalizedCache|null[0] abstract fun clearAll() // com.apollographql.cache.normalized.api/NormalizedCache.clearAll|clearAll(){}[0] abstract fun merge(com.apollographql.cache.normalized.api/Record, com.apollographql.cache.normalized.api/CacheHeaders, com.apollographql.cache.normalized.api/RecordMerger): kotlin.collections/Set // com.apollographql.cache.normalized.api/NormalizedCache.merge|merge(com.apollographql.cache.normalized.api.Record;com.apollographql.cache.normalized.api.CacheHeaders;com.apollographql.cache.normalized.api.RecordMerger){}[0] @@ -48,24 +60,31 @@ abstract interface com.apollographql.cache.normalized.api/NormalizedCache : com. abstract fun remove(com.apollographql.cache.normalized.api/CacheKey, kotlin/Boolean): kotlin/Boolean // com.apollographql.cache.normalized.api/NormalizedCache.remove|remove(com.apollographql.cache.normalized.api.CacheKey;kotlin.Boolean){}[0] abstract fun remove(kotlin.collections/Collection, kotlin/Boolean): kotlin/Int // com.apollographql.cache.normalized.api/NormalizedCache.remove|remove(kotlin.collections.Collection;kotlin.Boolean){}[0] abstract fun remove(kotlin/String): kotlin/Int // com.apollographql.cache.normalized.api/NormalizedCache.remove|remove(kotlin.String){}[0] + final object Companion { // com.apollographql.cache.normalized.api/NormalizedCache.Companion|null[0] final fun prettifyDump(kotlin.collections/Map, kotlin.collections/Map>): kotlin/String // com.apollographql.cache.normalized.api/NormalizedCache.Companion.prettifyDump|prettifyDump(kotlin.collections.Map,kotlin.collections.Map>){}[0] } } + abstract interface com.apollographql.cache.normalized.api/ReadOnlyNormalizedCache { // com.apollographql.cache.normalized.api/ReadOnlyNormalizedCache|null[0] abstract fun dump(): kotlin.collections/Map, kotlin.collections/Map> // com.apollographql.cache.normalized.api/ReadOnlyNormalizedCache.dump|dump(){}[0] abstract fun loadRecord(kotlin/String, com.apollographql.cache.normalized.api/CacheHeaders): com.apollographql.cache.normalized.api/Record? // com.apollographql.cache.normalized.api/ReadOnlyNormalizedCache.loadRecord|loadRecord(kotlin.String;com.apollographql.cache.normalized.api.CacheHeaders){}[0] abstract fun loadRecords(kotlin.collections/Collection, com.apollographql.cache.normalized.api/CacheHeaders): kotlin.collections/Collection // com.apollographql.cache.normalized.api/ReadOnlyNormalizedCache.loadRecords|loadRecords(kotlin.collections.Collection;com.apollographql.cache.normalized.api.CacheHeaders){}[0] } + abstract interface com.apollographql.cache.normalized.api/RecordMerger { // com.apollographql.cache.normalized.api/RecordMerger|null[0] abstract fun merge(com.apollographql.cache.normalized.api/Record, com.apollographql.cache.normalized.api/Record): kotlin/Pair> // com.apollographql.cache.normalized.api/RecordMerger.merge|merge(com.apollographql.cache.normalized.api.Record;com.apollographql.cache.normalized.api.Record){}[0] } + abstract interface com.apollographql.cache.normalized/ApolloStore { // com.apollographql.cache.normalized/ApolloStore|null[0] + abstract val changedKeys // com.apollographql.cache.normalized/ApolloStore.changedKeys|{}changedKeys[0] + abstract fun (): kotlinx.coroutines.flow/SharedFlow> // com.apollographql.cache.normalized/ApolloStore.changedKeys.|(){}[0] + abstract fun <#A1: com.apollographql.apollo.api/Fragment.Data> readFragment(com.apollographql.apollo.api/Fragment<#A1>, com.apollographql.cache.normalized.api/CacheKey, com.apollographql.apollo.api/CustomScalarAdapters = ..., com.apollographql.cache.normalized.api/CacheHeaders = ...): com.apollographql.cache.normalized/ApolloStore.ReadResult<#A1> // com.apollographql.cache.normalized/ApolloStore.readFragment|readFragment(com.apollographql.apollo.api.Fragment<0:0>;com.apollographql.cache.normalized.api.CacheKey;com.apollographql.apollo.api.CustomScalarAdapters;com.apollographql.cache.normalized.api.CacheHeaders){0§}[0] abstract fun <#A1: com.apollographql.apollo.api/Fragment.Data> writeFragment(com.apollographql.apollo.api/Fragment<#A1>, com.apollographql.cache.normalized.api/CacheKey, #A1, com.apollographql.apollo.api/CustomScalarAdapters = ..., com.apollographql.cache.normalized.api/CacheHeaders = ...): kotlin.collections/Set // com.apollographql.cache.normalized/ApolloStore.writeFragment|writeFragment(com.apollographql.apollo.api.Fragment<0:0>;com.apollographql.cache.normalized.api.CacheKey;0:0;com.apollographql.apollo.api.CustomScalarAdapters;com.apollographql.cache.normalized.api.CacheHeaders){0§}[0] abstract fun <#A1: com.apollographql.apollo.api/Fragment.Data> writeOptimisticUpdates(com.apollographql.apollo.api/Fragment<#A1>, com.apollographql.cache.normalized.api/CacheKey, #A1, com.benasher44.uuid/Uuid, com.apollographql.apollo.api/CustomScalarAdapters = ...): kotlin.collections/Set // com.apollographql.cache.normalized/ApolloStore.writeOptimisticUpdates|writeOptimisticUpdates(com.apollographql.apollo.api.Fragment<0:0>;com.apollographql.cache.normalized.api.CacheKey;0:0;com.benasher44.uuid.Uuid;com.apollographql.apollo.api.CustomScalarAdapters){0§}[0] abstract fun <#A1: com.apollographql.apollo.api/Operation.Data> normalize(com.apollographql.apollo.api/Operation<#A1>, #A1, com.apollographql.apollo.api/CustomScalarAdapters): kotlin.collections/Map // com.apollographql.cache.normalized/ApolloStore.normalize|normalize(com.apollographql.apollo.api.Operation<0:0>;0:0;com.apollographql.apollo.api.CustomScalarAdapters){0§}[0] - abstract fun <#A1: com.apollographql.apollo.api/Operation.Data> readOperation(com.apollographql.apollo.api/Operation<#A1>, com.apollographql.apollo.api/CustomScalarAdapters = ..., com.apollographql.cache.normalized.api/CacheHeaders = ...): com.apollographql.cache.normalized/ApolloStore.ReadResult<#A1> // com.apollographql.cache.normalized/ApolloStore.readOperation|readOperation(com.apollographql.apollo.api.Operation<0:0>;com.apollographql.apollo.api.CustomScalarAdapters;com.apollographql.cache.normalized.api.CacheHeaders){0§}[0] + abstract fun <#A1: com.apollographql.apollo.api/Operation.Data> readOperation(com.apollographql.apollo.api/Operation<#A1>, com.apollographql.apollo.api/CustomScalarAdapters = ..., com.apollographql.cache.normalized.api/CacheHeaders = ...): com.apollographql.apollo.api/ApolloResponse<#A1> // com.apollographql.cache.normalized/ApolloStore.readOperation|readOperation(com.apollographql.apollo.api.Operation<0:0>;com.apollographql.apollo.api.CustomScalarAdapters;com.apollographql.cache.normalized.api.CacheHeaders){0§}[0] abstract fun <#A1: com.apollographql.apollo.api/Operation.Data> writeOperation(com.apollographql.apollo.api/Operation<#A1>, #A1, com.apollographql.apollo.api/CustomScalarAdapters = ..., com.apollographql.cache.normalized.api/CacheHeaders = ...): kotlin.collections/Set // com.apollographql.cache.normalized/ApolloStore.writeOperation|writeOperation(com.apollographql.apollo.api.Operation<0:0>;0:0;com.apollographql.apollo.api.CustomScalarAdapters;com.apollographql.cache.normalized.api.CacheHeaders){0§}[0] abstract fun <#A1: com.apollographql.apollo.api/Operation.Data> writeOptimisticUpdates(com.apollographql.apollo.api/Operation<#A1>, #A1, com.benasher44.uuid/Uuid, com.apollographql.apollo.api/CustomScalarAdapters = ...): kotlin.collections/Set // com.apollographql.cache.normalized/ApolloStore.writeOptimisticUpdates|writeOptimisticUpdates(com.apollographql.apollo.api.Operation<0:0>;0:0;com.benasher44.uuid.Uuid;com.apollographql.apollo.api.CustomScalarAdapters){0§}[0] abstract fun <#A1: kotlin/Any?> accessCache(kotlin/Function1): #A1 // com.apollographql.cache.normalized/ApolloStore.accessCache|accessCache(kotlin.Function1){0§}[0] @@ -76,86 +95,141 @@ abstract interface com.apollographql.cache.normalized/ApolloStore { // com.apoll abstract fun remove(kotlin.collections/List, kotlin/Boolean = ...): kotlin/Int // com.apollographql.cache.normalized/ApolloStore.remove|remove(kotlin.collections.List;kotlin.Boolean){}[0] abstract fun rollbackOptimisticUpdates(com.benasher44.uuid/Uuid): kotlin.collections/Set // com.apollographql.cache.normalized/ApolloStore.rollbackOptimisticUpdates|rollbackOptimisticUpdates(com.benasher44.uuid.Uuid){}[0] abstract suspend fun publish(kotlin.collections/Set) // com.apollographql.cache.normalized/ApolloStore.publish|publish(kotlin.collections.Set){}[0] - abstract val changedKeys // com.apollographql.cache.normalized/ApolloStore.changedKeys|{}changedKeys[0] - abstract fun (): kotlinx.coroutines.flow/SharedFlow> // com.apollographql.cache.normalized/ApolloStore.changedKeys.|(){}[0] + final class <#A1: com.apollographql.apollo.api/Executable.Data> ReadResult { // com.apollographql.cache.normalized/ApolloStore.ReadResult|null[0] constructor (#A1, com.apollographql.cache.normalized.api/CacheHeaders) // com.apollographql.cache.normalized/ApolloStore.ReadResult.|(1:0;com.apollographql.cache.normalized.api.CacheHeaders){}[0] + final val cacheHeaders // com.apollographql.cache.normalized/ApolloStore.ReadResult.cacheHeaders|{}cacheHeaders[0] final fun (): com.apollographql.cache.normalized.api/CacheHeaders // com.apollographql.cache.normalized/ApolloStore.ReadResult.cacheHeaders.|(){}[0] final val data // com.apollographql.cache.normalized/ApolloStore.ReadResult.data|{}data[0] final fun (): #A1 // com.apollographql.cache.normalized/ApolloStore.ReadResult.data.|(){}[0] } + final object Companion { // com.apollographql.cache.normalized/ApolloStore.Companion|null[0] final val ALL_KEYS // com.apollographql.cache.normalized/ApolloStore.Companion.ALL_KEYS|{}ALL_KEYS[0] final fun (): kotlin.collections/AbstractSet // com.apollographql.cache.normalized/ApolloStore.Companion.ALL_KEYS.|(){}[0] } } + +sealed interface com.apollographql.cache.normalized.api/MaxAge { // com.apollographql.cache.normalized.api/MaxAge|null[0] + final class Duration : com.apollographql.cache.normalized.api/MaxAge { // com.apollographql.cache.normalized.api/MaxAge.Duration|null[0] + constructor (kotlin.time/Duration) // com.apollographql.cache.normalized.api/MaxAge.Duration.|(kotlin.time.Duration){}[0] + + final val duration // com.apollographql.cache.normalized.api/MaxAge.Duration.duration|{}duration[0] + final fun (): kotlin.time/Duration // com.apollographql.cache.normalized.api/MaxAge.Duration.duration.|(){}[0] + } + + final object Inherit : com.apollographql.cache.normalized.api/MaxAge { // com.apollographql.cache.normalized.api/MaxAge.Inherit|null[0] + final fun equals(kotlin/Any?): kotlin/Boolean // com.apollographql.cache.normalized.api/MaxAge.Inherit.equals|equals(kotlin.Any?){}[0] + final fun hashCode(): kotlin/Int // com.apollographql.cache.normalized.api/MaxAge.Inherit.hashCode|hashCode(){}[0] + final fun toString(): kotlin/String // com.apollographql.cache.normalized.api/MaxAge.Inherit.toString|toString(){}[0] + } +} + +abstract class com.apollographql.cache.normalized.api/CacheKeyResolver : com.apollographql.cache.normalized.api/CacheResolver { // com.apollographql.cache.normalized.api/CacheKeyResolver|null[0] + constructor () // com.apollographql.cache.normalized.api/CacheKeyResolver.|(){}[0] + + abstract fun cacheKeyForField(com.apollographql.cache.normalized.api/ResolverContext): com.apollographql.cache.normalized.api/CacheKey? // com.apollographql.cache.normalized.api/CacheKeyResolver.cacheKeyForField|cacheKeyForField(com.apollographql.cache.normalized.api.ResolverContext){}[0] + final fun resolveField(com.apollographql.cache.normalized.api/ResolverContext): kotlin/Any? // com.apollographql.cache.normalized.api/CacheKeyResolver.resolveField|resolveField(com.apollographql.cache.normalized.api.ResolverContext){}[0] + open fun listOfCacheKeysForField(com.apollographql.cache.normalized.api/ResolverContext): kotlin.collections/List? // com.apollographql.cache.normalized.api/CacheKeyResolver.listOfCacheKeysForField|listOfCacheKeysForField(com.apollographql.cache.normalized.api.ResolverContext){}[0] +} + +abstract class com.apollographql.cache.normalized.api/NormalizedCacheFactory { // com.apollographql.cache.normalized.api/NormalizedCacheFactory|null[0] + constructor () // com.apollographql.cache.normalized.api/NormalizedCacheFactory.|(){}[0] + + abstract fun create(): com.apollographql.cache.normalized.api/NormalizedCache // com.apollographql.cache.normalized.api/NormalizedCacheFactory.create|create(){}[0] +} + final class com.apollographql.cache.normalized.api/CacheControlCacheResolver : com.apollographql.cache.normalized.api/CacheResolver { // com.apollographql.cache.normalized.api/CacheControlCacheResolver|null[0] constructor (com.apollographql.cache.normalized.api/CacheResolver = ...) // com.apollographql.cache.normalized.api/CacheControlCacheResolver.|(com.apollographql.cache.normalized.api.CacheResolver){}[0] constructor (com.apollographql.cache.normalized.api/MaxAgeProvider, com.apollographql.cache.normalized.api/CacheResolver = ...) // com.apollographql.cache.normalized.api/CacheControlCacheResolver.|(com.apollographql.cache.normalized.api.MaxAgeProvider;com.apollographql.cache.normalized.api.CacheResolver){}[0] + final fun resolveField(com.apollographql.cache.normalized.api/ResolverContext): kotlin/Any? // com.apollographql.cache.normalized.api/CacheControlCacheResolver.resolveField|resolveField(com.apollographql.cache.normalized.api.ResolverContext){}[0] } + final class com.apollographql.cache.normalized.api/CacheHeaders { // com.apollographql.cache.normalized.api/CacheHeaders|null[0] + final fun hasHeader(kotlin/String): kotlin/Boolean // com.apollographql.cache.normalized.api/CacheHeaders.hasHeader|hasHeader(kotlin.String){}[0] + final fun headerValue(kotlin/String): kotlin/String? // com.apollographql.cache.normalized.api/CacheHeaders.headerValue|headerValue(kotlin.String){}[0] + final fun newBuilder(): com.apollographql.cache.normalized.api/CacheHeaders.Builder // com.apollographql.cache.normalized.api/CacheHeaders.newBuilder|newBuilder(){}[0] + final fun plus(com.apollographql.cache.normalized.api/CacheHeaders): com.apollographql.cache.normalized.api/CacheHeaders // com.apollographql.cache.normalized.api/CacheHeaders.plus|plus(com.apollographql.cache.normalized.api.CacheHeaders){}[0] + final class Builder { // com.apollographql.cache.normalized.api/CacheHeaders.Builder|null[0] constructor () // com.apollographql.cache.normalized.api/CacheHeaders.Builder.|(){}[0] + final fun addHeader(kotlin/String, kotlin/String): com.apollographql.cache.normalized.api/CacheHeaders.Builder // com.apollographql.cache.normalized.api/CacheHeaders.Builder.addHeader|addHeader(kotlin.String;kotlin.String){}[0] final fun addHeaders(kotlin.collections/Map): com.apollographql.cache.normalized.api/CacheHeaders.Builder // com.apollographql.cache.normalized.api/CacheHeaders.Builder.addHeaders|addHeaders(kotlin.collections.Map){}[0] final fun build(): com.apollographql.cache.normalized.api/CacheHeaders // com.apollographql.cache.normalized.api/CacheHeaders.Builder.build|build(){}[0] } - final fun hasHeader(kotlin/String): kotlin/Boolean // com.apollographql.cache.normalized.api/CacheHeaders.hasHeader|hasHeader(kotlin.String){}[0] - final fun headerValue(kotlin/String): kotlin/String? // com.apollographql.cache.normalized.api/CacheHeaders.headerValue|headerValue(kotlin.String){}[0] - final fun newBuilder(): com.apollographql.cache.normalized.api/CacheHeaders.Builder // com.apollographql.cache.normalized.api/CacheHeaders.newBuilder|newBuilder(){}[0] - final fun plus(com.apollographql.cache.normalized.api/CacheHeaders): com.apollographql.cache.normalized.api/CacheHeaders // com.apollographql.cache.normalized.api/CacheHeaders.plus|plus(com.apollographql.cache.normalized.api.CacheHeaders){}[0] + final object Companion { // com.apollographql.cache.normalized.api/CacheHeaders.Companion|null[0] - final fun builder(): com.apollographql.cache.normalized.api/CacheHeaders.Builder // com.apollographql.cache.normalized.api/CacheHeaders.Companion.builder|builder(){}[0] final val NONE // com.apollographql.cache.normalized.api/CacheHeaders.Companion.NONE|{}NONE[0] final fun (): com.apollographql.cache.normalized.api/CacheHeaders // com.apollographql.cache.normalized.api/CacheHeaders.Companion.NONE.|(){}[0] + + final fun builder(): com.apollographql.cache.normalized.api/CacheHeaders.Builder // com.apollographql.cache.normalized.api/CacheHeaders.Companion.builder|builder(){}[0] } } + final class com.apollographql.cache.normalized.api/CacheKey { // com.apollographql.cache.normalized.api/CacheKey|null[0] constructor (kotlin/String) // com.apollographql.cache.normalized.api/CacheKey.|(kotlin.String){}[0] constructor (kotlin/String, kotlin.collections/List) // com.apollographql.cache.normalized.api/CacheKey.|(kotlin.String;kotlin.collections.List){}[0] constructor (kotlin/String, kotlin/Array...) // com.apollographql.cache.normalized.api/CacheKey.|(kotlin.String;kotlin.Array...){}[0] + + final val key // com.apollographql.cache.normalized.api/CacheKey.key|{}key[0] + final fun (): kotlin/String // com.apollographql.cache.normalized.api/CacheKey.key.|(){}[0] + final fun equals(kotlin/Any?): kotlin/Boolean // com.apollographql.cache.normalized.api/CacheKey.equals|equals(kotlin.Any?){}[0] final fun hashCode(): kotlin/Int // com.apollographql.cache.normalized.api/CacheKey.hashCode|hashCode(){}[0] final fun serialize(): kotlin/String // com.apollographql.cache.normalized.api/CacheKey.serialize|serialize(){}[0] final fun toString(): kotlin/String // com.apollographql.cache.normalized.api/CacheKey.toString|toString(){}[0] + final object Companion { // com.apollographql.cache.normalized.api/CacheKey.Companion|null[0] final fun canDeserialize(kotlin/String): kotlin/Boolean // com.apollographql.cache.normalized.api/CacheKey.Companion.canDeserialize|canDeserialize(kotlin.String){}[0] final fun deserialize(kotlin/String): com.apollographql.cache.normalized.api/CacheKey // com.apollographql.cache.normalized.api/CacheKey.Companion.deserialize|deserialize(kotlin.String){}[0] final fun rootKey(): com.apollographql.cache.normalized.api/CacheKey // com.apollographql.cache.normalized.api/CacheKey.Companion.rootKey|rootKey(){}[0] } - final val key // com.apollographql.cache.normalized.api/CacheKey.key|{}key[0] - final fun (): kotlin/String // com.apollographql.cache.normalized.api/CacheKey.key.|(){}[0] } + final class com.apollographql.cache.normalized.api/CacheKeyGeneratorContext { // com.apollographql.cache.normalized.api/CacheKeyGeneratorContext|null[0] constructor (com.apollographql.apollo.api/CompiledField, com.apollographql.apollo.api/Executable.Variables) // com.apollographql.cache.normalized.api/CacheKeyGeneratorContext.|(com.apollographql.apollo.api.CompiledField;com.apollographql.apollo.api.Executable.Variables){}[0] + final val field // com.apollographql.cache.normalized.api/CacheKeyGeneratorContext.field|{}field[0] final fun (): com.apollographql.apollo.api/CompiledField // com.apollographql.cache.normalized.api/CacheKeyGeneratorContext.field.|(){}[0] final val variables // com.apollographql.cache.normalized.api/CacheKeyGeneratorContext.variables|{}variables[0] final fun (): com.apollographql.apollo.api/Executable.Variables // com.apollographql.cache.normalized.api/CacheKeyGeneratorContext.variables.|(){}[0] } + final class com.apollographql.cache.normalized.api/ConnectionEmbeddedFieldsProvider : com.apollographql.cache.normalized.api/EmbeddedFieldsProvider { // com.apollographql.cache.normalized.api/ConnectionEmbeddedFieldsProvider|null[0] constructor (kotlin.collections/Map>, kotlin.collections/Set) // com.apollographql.cache.normalized.api/ConnectionEmbeddedFieldsProvider.|(kotlin.collections.Map>;kotlin.collections.Set){}[0] + final fun getEmbeddedFields(com.apollographql.cache.normalized.api/EmbeddedFieldsContext): kotlin.collections/List // com.apollographql.cache.normalized.api/ConnectionEmbeddedFieldsProvider.getEmbeddedFields|getEmbeddedFields(com.apollographql.cache.normalized.api.EmbeddedFieldsContext){}[0] + final object Companion // com.apollographql.cache.normalized.api/ConnectionEmbeddedFieldsProvider.Companion|null[0] } + final class com.apollographql.cache.normalized.api/ConnectionFieldKeyGenerator : com.apollographql.cache.normalized.api/FieldKeyGenerator { // com.apollographql.cache.normalized.api/ConnectionFieldKeyGenerator|null[0] constructor (kotlin.collections/Map>) // com.apollographql.cache.normalized.api/ConnectionFieldKeyGenerator.|(kotlin.collections.Map>){}[0] + final fun getFieldKey(com.apollographql.cache.normalized.api/FieldKeyContext): kotlin/String // com.apollographql.cache.normalized.api/ConnectionFieldKeyGenerator.getFieldKey|getFieldKey(com.apollographql.cache.normalized.api.FieldKeyContext){}[0] + final object Companion // com.apollographql.cache.normalized.api/ConnectionFieldKeyGenerator.Companion|null[0] } + final class com.apollographql.cache.normalized.api/ConnectionMetadataGenerator : com.apollographql.cache.normalized.api/MetadataGenerator { // com.apollographql.cache.normalized.api/ConnectionMetadataGenerator|null[0] constructor (kotlin.collections/Set) // com.apollographql.cache.normalized.api/ConnectionMetadataGenerator.|(kotlin.collections.Set){}[0] + final fun metadataForObject(kotlin/Any?, com.apollographql.cache.normalized.api/MetadataGeneratorContext): kotlin.collections/Map // com.apollographql.cache.normalized.api/ConnectionMetadataGenerator.metadataForObject|metadataForObject(kotlin.Any?;com.apollographql.cache.normalized.api.MetadataGeneratorContext){}[0] } + final class com.apollographql.cache.normalized.api/EmbeddedFieldsContext { // com.apollographql.cache.normalized.api/EmbeddedFieldsContext|null[0] constructor (com.apollographql.apollo.api/CompiledNamedType) // com.apollographql.cache.normalized.api/EmbeddedFieldsContext.|(com.apollographql.apollo.api.CompiledNamedType){}[0] + final val parentType // com.apollographql.cache.normalized.api/EmbeddedFieldsContext.parentType|{}parentType[0] final fun (): com.apollographql.apollo.api/CompiledNamedType // com.apollographql.cache.normalized.api/EmbeddedFieldsContext.parentType.|(){}[0] } + final class com.apollographql.cache.normalized.api/FieldKeyContext { // com.apollographql.cache.normalized.api/FieldKeyContext|null[0] constructor (kotlin/String, com.apollographql.apollo.api/CompiledField, com.apollographql.apollo.api/Executable.Variables) // com.apollographql.cache.normalized.api/FieldKeyContext.|(kotlin.String;com.apollographql.apollo.api.CompiledField;com.apollographql.apollo.api.Executable.Variables){}[0] + final val field // com.apollographql.cache.normalized.api/FieldKeyContext.field|{}field[0] final fun (): com.apollographql.apollo.api/CompiledField // com.apollographql.cache.normalized.api/FieldKeyContext.field.|(){}[0] final val parentType // com.apollographql.cache.normalized.api/FieldKeyContext.parentType|{}parentType[0] @@ -163,43 +237,61 @@ final class com.apollographql.cache.normalized.api/FieldKeyContext { // com.apol final val variables // com.apollographql.cache.normalized.api/FieldKeyContext.variables|{}variables[0] final fun (): com.apollographql.apollo.api/Executable.Variables // com.apollographql.cache.normalized.api/FieldKeyContext.variables.|(){}[0] } + final class com.apollographql.cache.normalized.api/FieldRecordMerger : com.apollographql.cache.normalized.api/RecordMerger { // com.apollographql.cache.normalized.api/FieldRecordMerger|null[0] + constructor (com.apollographql.cache.normalized.api/FieldRecordMerger.FieldMerger) // com.apollographql.cache.normalized.api/FieldRecordMerger.|(com.apollographql.cache.normalized.api.FieldRecordMerger.FieldMerger){}[0] + + final fun merge(com.apollographql.cache.normalized.api/Record, com.apollographql.cache.normalized.api/Record): kotlin/Pair> // com.apollographql.cache.normalized.api/FieldRecordMerger.merge|merge(com.apollographql.cache.normalized.api.Record;com.apollographql.cache.normalized.api.Record){}[0] + abstract interface FieldMerger { // com.apollographql.cache.normalized.api/FieldRecordMerger.FieldMerger|null[0] abstract fun mergeFields(com.apollographql.cache.normalized.api/FieldRecordMerger.FieldInfo, com.apollographql.cache.normalized.api/FieldRecordMerger.FieldInfo): com.apollographql.cache.normalized.api/FieldRecordMerger.FieldInfo // com.apollographql.cache.normalized.api/FieldRecordMerger.FieldMerger.mergeFields|mergeFields(com.apollographql.cache.normalized.api.FieldRecordMerger.FieldInfo;com.apollographql.cache.normalized.api.FieldRecordMerger.FieldInfo){}[0] } - constructor (com.apollographql.cache.normalized.api/FieldRecordMerger.FieldMerger) // com.apollographql.cache.normalized.api/FieldRecordMerger.|(com.apollographql.cache.normalized.api.FieldRecordMerger.FieldMerger){}[0] + final class FieldInfo { // com.apollographql.cache.normalized.api/FieldRecordMerger.FieldInfo|null[0] constructor (kotlin/Any?, kotlin.collections/Map) // com.apollographql.cache.normalized.api/FieldRecordMerger.FieldInfo.|(kotlin.Any?;kotlin.collections.Map){}[0] + + final val metadata // com.apollographql.cache.normalized.api/FieldRecordMerger.FieldInfo.metadata|{}metadata[0] + final fun (): kotlin.collections/Map // com.apollographql.cache.normalized.api/FieldRecordMerger.FieldInfo.metadata.|(){}[0] + final val value // com.apollographql.cache.normalized.api/FieldRecordMerger.FieldInfo.value|{}value[0] + final fun (): kotlin/Any? // com.apollographql.cache.normalized.api/FieldRecordMerger.FieldInfo.value.|(){}[0] + final fun component1(): kotlin/Any? // com.apollographql.cache.normalized.api/FieldRecordMerger.FieldInfo.component1|component1(){}[0] final fun component2(): kotlin.collections/Map // com.apollographql.cache.normalized.api/FieldRecordMerger.FieldInfo.component2|component2(){}[0] final fun copy(kotlin/Any? = ..., kotlin.collections/Map = ...): com.apollographql.cache.normalized.api/FieldRecordMerger.FieldInfo // com.apollographql.cache.normalized.api/FieldRecordMerger.FieldInfo.copy|copy(kotlin.Any?;kotlin.collections.Map){}[0] final fun equals(kotlin/Any?): kotlin/Boolean // com.apollographql.cache.normalized.api/FieldRecordMerger.FieldInfo.equals|equals(kotlin.Any?){}[0] final fun hashCode(): kotlin/Int // com.apollographql.cache.normalized.api/FieldRecordMerger.FieldInfo.hashCode|hashCode(){}[0] final fun toString(): kotlin/String // com.apollographql.cache.normalized.api/FieldRecordMerger.FieldInfo.toString|toString(){}[0] - final val metadata // com.apollographql.cache.normalized.api/FieldRecordMerger.FieldInfo.metadata|{}metadata[0] - final fun (): kotlin.collections/Map // com.apollographql.cache.normalized.api/FieldRecordMerger.FieldInfo.metadata.|(){}[0] - final val value // com.apollographql.cache.normalized.api/FieldRecordMerger.FieldInfo.value|{}value[0] - final fun (): kotlin/Any? // com.apollographql.cache.normalized.api/FieldRecordMerger.FieldInfo.value.|(){}[0] } - final fun merge(com.apollographql.cache.normalized.api/Record, com.apollographql.cache.normalized.api/Record): kotlin/Pair> // com.apollographql.cache.normalized.api/FieldRecordMerger.merge|merge(com.apollographql.cache.normalized.api.Record;com.apollographql.cache.normalized.api.Record){}[0] } + final class com.apollographql.cache.normalized.api/GlobalMaxAgeProvider : com.apollographql.cache.normalized.api/MaxAgeProvider { // com.apollographql.cache.normalized.api/GlobalMaxAgeProvider|null[0] constructor (kotlin.time/Duration) // com.apollographql.cache.normalized.api/GlobalMaxAgeProvider.|(kotlin.time.Duration){}[0] + final fun getMaxAge(com.apollographql.cache.normalized.api/MaxAgeContext): kotlin.time/Duration // com.apollographql.cache.normalized.api/GlobalMaxAgeProvider.getMaxAge|getMaxAge(com.apollographql.cache.normalized.api.MaxAgeContext){}[0] } + final class com.apollographql.cache.normalized.api/IdCacheKeyGenerator : com.apollographql.cache.normalized.api/CacheKeyGenerator { // com.apollographql.cache.normalized.api/IdCacheKeyGenerator|null[0] constructor (kotlin/Array... = ...) // com.apollographql.cache.normalized.api/IdCacheKeyGenerator.|(kotlin.Array...){}[0] + final fun cacheKeyForObject(kotlin.collections/Map, com.apollographql.cache.normalized.api/CacheKeyGeneratorContext): com.apollographql.cache.normalized.api/CacheKey? // com.apollographql.cache.normalized.api/IdCacheKeyGenerator.cacheKeyForObject|cacheKeyForObject(kotlin.collections.Map;com.apollographql.cache.normalized.api.CacheKeyGeneratorContext){}[0] } + final class com.apollographql.cache.normalized.api/IdCacheKeyResolver : com.apollographql.cache.normalized.api/CacheKeyResolver { // com.apollographql.cache.normalized.api/IdCacheKeyResolver|null[0] constructor (kotlin.collections/List = ..., kotlin.collections/List = ...) // com.apollographql.cache.normalized.api/IdCacheKeyResolver.|(kotlin.collections.List;kotlin.collections.List){}[0] + final fun cacheKeyForField(com.apollographql.cache.normalized.api/ResolverContext): com.apollographql.cache.normalized.api/CacheKey? // com.apollographql.cache.normalized.api/IdCacheKeyResolver.cacheKeyForField|cacheKeyForField(com.apollographql.cache.normalized.api.ResolverContext){}[0] final fun listOfCacheKeysForField(com.apollographql.cache.normalized.api/ResolverContext): kotlin.collections/List? // com.apollographql.cache.normalized.api/IdCacheKeyResolver.listOfCacheKeysForField|listOfCacheKeysForField(com.apollographql.cache.normalized.api.ResolverContext){}[0] } + final class com.apollographql.cache.normalized.api/MaxAgeContext { // com.apollographql.cache.normalized.api/MaxAgeContext|null[0] constructor (kotlin.collections/List) // com.apollographql.cache.normalized.api/MaxAgeContext.|(kotlin.collections.List){}[0] + + final val fieldPath // com.apollographql.cache.normalized.api/MaxAgeContext.fieldPath|{}fieldPath[0] + final fun (): kotlin.collections/List // com.apollographql.cache.normalized.api/MaxAgeContext.fieldPath.|(){}[0] + final class Field { // com.apollographql.cache.normalized.api/MaxAgeContext.Field|null[0] constructor (kotlin/String, kotlin/String, kotlin/Boolean) // com.apollographql.cache.normalized.api/MaxAgeContext.Field.|(kotlin.String;kotlin.String;kotlin.Boolean){}[0] + final val isTypeComposite // com.apollographql.cache.normalized.api/MaxAgeContext.Field.isTypeComposite|{}isTypeComposite[0] final fun (): kotlin/Boolean // com.apollographql.cache.normalized.api/MaxAgeContext.Field.isTypeComposite.|(){}[0] final val name // com.apollographql.cache.normalized.api/MaxAgeContext.Field.name|{}name[0] @@ -207,28 +299,23 @@ final class com.apollographql.cache.normalized.api/MaxAgeContext { // com.apollo final val type // com.apollographql.cache.normalized.api/MaxAgeContext.Field.type|{}type[0] final fun (): kotlin/String // com.apollographql.cache.normalized.api/MaxAgeContext.Field.type.|(){}[0] } - final val fieldPath // com.apollographql.cache.normalized.api/MaxAgeContext.fieldPath|{}fieldPath[0] - final fun (): kotlin.collections/List // com.apollographql.cache.normalized.api/MaxAgeContext.fieldPath.|(){}[0] } + final class com.apollographql.cache.normalized.api/MetadataGeneratorContext { // com.apollographql.cache.normalized.api/MetadataGeneratorContext|null[0] constructor (com.apollographql.apollo.api/CompiledField, com.apollographql.apollo.api/Executable.Variables) // com.apollographql.cache.normalized.api/MetadataGeneratorContext.|(com.apollographql.apollo.api.CompiledField;com.apollographql.apollo.api.Executable.Variables){}[0] - final fun allArgumentValues(): kotlin.collections/Map // com.apollographql.cache.normalized.api/MetadataGeneratorContext.allArgumentValues|allArgumentValues(){}[0] - final fun argumentValue(kotlin/String): kotlin/Any? // com.apollographql.cache.normalized.api/MetadataGeneratorContext.argumentValue|argumentValue(kotlin.String){}[0] + final val field // com.apollographql.cache.normalized.api/MetadataGeneratorContext.field|{}field[0] final fun (): com.apollographql.apollo.api/CompiledField // com.apollographql.cache.normalized.api/MetadataGeneratorContext.field.|(){}[0] final val variables // com.apollographql.cache.normalized.api/MetadataGeneratorContext.variables|{}variables[0] final fun (): com.apollographql.apollo.api/Executable.Variables // com.apollographql.cache.normalized.api/MetadataGeneratorContext.variables.|(){}[0] + + final fun allArgumentValues(): kotlin.collections/Map // com.apollographql.cache.normalized.api/MetadataGeneratorContext.allArgumentValues|allArgumentValues(){}[0] + final fun argumentValue(kotlin/String): kotlin/Any? // com.apollographql.cache.normalized.api/MetadataGeneratorContext.argumentValue|argumentValue(kotlin.String){}[0] } + final class com.apollographql.cache.normalized.api/Record : kotlin.collections/Map { // com.apollographql.cache.normalized.api/Record|null[0] constructor (kotlin/String, kotlin.collections/Map, com.benasher44.uuid/Uuid? = ..., kotlin.collections/Map> = ...) // com.apollographql.cache.normalized.api/Record.|(kotlin.String;kotlin.collections.Map;com.benasher44.uuid.Uuid?;kotlin.collections.Map>){}[0] - final fun containsKey(kotlin/String): kotlin/Boolean // com.apollographql.cache.normalized.api/Record.containsKey|containsKey(kotlin.String){}[0] - final fun containsValue(kotlin/Any?): kotlin/Boolean // com.apollographql.cache.normalized.api/Record.containsValue|containsValue(kotlin.Any?){}[0] - final fun fieldKeys(): kotlin.collections/Set // com.apollographql.cache.normalized.api/Record.fieldKeys|fieldKeys(){}[0] - final fun get(kotlin/String): kotlin/Any? // com.apollographql.cache.normalized.api/Record.get|get(kotlin.String){}[0] - final fun isEmpty(): kotlin/Boolean // com.apollographql.cache.normalized.api/Record.isEmpty|isEmpty(){}[0] - final fun mergeWith(com.apollographql.cache.normalized.api/Record): kotlin/Pair> // com.apollographql.cache.normalized.api/Record.mergeWith|mergeWith(com.apollographql.cache.normalized.api.Record){}[0] - final fun referencedFields(): kotlin.collections/List // com.apollographql.cache.normalized.api/Record.referencedFields|referencedFields(){}[0] - final object Companion // com.apollographql.cache.normalized.api/Record.Companion|null[0] + final val entries // com.apollographql.cache.normalized.api/Record.entries|{}entries[0] final fun (): kotlin.collections/Set> // com.apollographql.cache.normalized.api/Record.entries.|(){}[0] final val fields // com.apollographql.cache.normalized.api/Record.fields|{}fields[0] @@ -247,11 +334,24 @@ final class com.apollographql.cache.normalized.api/Record : kotlin.collections/M final fun (): kotlin/Int // com.apollographql.cache.normalized.api/Record.sizeInBytes.|(){}[0] final val values // com.apollographql.cache.normalized.api/Record.values|{}values[0] final fun (): kotlin.collections/Collection // com.apollographql.cache.normalized.api/Record.values.|(){}[0] + + final fun containsKey(kotlin/String): kotlin/Boolean // com.apollographql.cache.normalized.api/Record.containsKey|containsKey(kotlin.String){}[0] + final fun containsValue(kotlin/Any?): kotlin/Boolean // com.apollographql.cache.normalized.api/Record.containsValue|containsValue(kotlin.Any?){}[0] + final fun fieldKeys(): kotlin.collections/Set // com.apollographql.cache.normalized.api/Record.fieldKeys|fieldKeys(){}[0] + final fun get(kotlin/String): kotlin/Any? // com.apollographql.cache.normalized.api/Record.get|get(kotlin.String){}[0] + final fun isEmpty(): kotlin/Boolean // com.apollographql.cache.normalized.api/Record.isEmpty|isEmpty(){}[0] + final fun mergeWith(com.apollographql.cache.normalized.api/Record): kotlin/Pair> // com.apollographql.cache.normalized.api/Record.mergeWith|mergeWith(com.apollographql.cache.normalized.api.Record){}[0] + final fun referencedFields(): kotlin.collections/List // com.apollographql.cache.normalized.api/Record.referencedFields|referencedFields(){}[0] + + final object Companion // com.apollographql.cache.normalized.api/Record.Companion|null[0] + // Targets: [js] final fun asJsReadonlyMapView(): kotlin.js.collections/JsReadonlyMap // com.apollographql.cache.normalized.api/Record.asJsReadonlyMapView|asJsReadonlyMapView(){}[0] } + final class com.apollographql.cache.normalized.api/ResolverContext { // com.apollographql.cache.normalized.api/ResolverContext|null[0] constructor (com.apollographql.apollo.api/CompiledField, com.apollographql.apollo.api/Executable.Variables, kotlin.collections/Map, kotlin/String, kotlin/String, com.apollographql.cache.normalized.api/CacheHeaders, com.apollographql.cache.normalized.api/FieldKeyGenerator, kotlin.collections/List) // com.apollographql.cache.normalized.api/ResolverContext.|(com.apollographql.apollo.api.CompiledField;com.apollographql.apollo.api.Executable.Variables;kotlin.collections.Map;kotlin.String;kotlin.String;com.apollographql.cache.normalized.api.CacheHeaders;com.apollographql.cache.normalized.api.FieldKeyGenerator;kotlin.collections.List){}[0] + final val cacheHeaders // com.apollographql.cache.normalized.api/ResolverContext.cacheHeaders|{}cacheHeaders[0] final fun (): com.apollographql.cache.normalized.api/CacheHeaders // com.apollographql.cache.normalized.api/ResolverContext.cacheHeaders.|(){}[0] final val field // com.apollographql.cache.normalized.api/ResolverContext.field|{}field[0] @@ -269,12 +369,19 @@ final class com.apollographql.cache.normalized.api/ResolverContext { // com.apol final val variables // com.apollographql.cache.normalized.api/ResolverContext.variables|{}variables[0] final fun (): com.apollographql.apollo.api/Executable.Variables // com.apollographql.cache.normalized.api/ResolverContext.variables.|(){}[0] } + final class com.apollographql.cache.normalized.api/SchemaCoordinatesMaxAgeProvider : com.apollographql.cache.normalized.api/MaxAgeProvider { // com.apollographql.cache.normalized.api/SchemaCoordinatesMaxAgeProvider|null[0] constructor (kotlin.collections/Map, kotlin.time/Duration) // com.apollographql.cache.normalized.api/SchemaCoordinatesMaxAgeProvider.|(kotlin.collections.Map;kotlin.time.Duration){}[0] + final fun getMaxAge(com.apollographql.cache.normalized.api/MaxAgeContext): kotlin.time/Duration // com.apollographql.cache.normalized.api/SchemaCoordinatesMaxAgeProvider.getMaxAge|getMaxAge(com.apollographql.cache.normalized.api.MaxAgeContext){}[0] } + final class com.apollographql.cache.normalized.memory/MemoryCache : com.apollographql.cache.normalized.api/NormalizedCache { // com.apollographql.cache.normalized.memory/MemoryCache|null[0] constructor (com.apollographql.cache.normalized.api/NormalizedCache? = ..., kotlin/Int = ..., kotlin/Long = ...) // com.apollographql.cache.normalized.memory/MemoryCache.|(com.apollographql.cache.normalized.api.NormalizedCache?;kotlin.Int;kotlin.Long){}[0] + + final val size // com.apollographql.cache.normalized.memory/MemoryCache.size|{}size[0] + final fun (): kotlin/Int // com.apollographql.cache.normalized.memory/MemoryCache.size.|(){}[0] + final fun clearAll() // com.apollographql.cache.normalized.memory/MemoryCache.clearAll|clearAll(){}[0] final fun dump(): kotlin.collections/Map, kotlin.collections/Map> // com.apollographql.cache.normalized.memory/MemoryCache.dump|dump(){}[0] final fun loadRecord(kotlin/String, com.apollographql.cache.normalized.api/CacheHeaders): com.apollographql.cache.normalized.api/Record? // com.apollographql.cache.normalized.memory/MemoryCache.loadRecord|loadRecord(kotlin.String;com.apollographql.cache.normalized.api.CacheHeaders){}[0] @@ -284,29 +391,16 @@ final class com.apollographql.cache.normalized.memory/MemoryCache : com.apollogr final fun remove(com.apollographql.cache.normalized.api/CacheKey, kotlin/Boolean): kotlin/Boolean // com.apollographql.cache.normalized.memory/MemoryCache.remove|remove(com.apollographql.cache.normalized.api.CacheKey;kotlin.Boolean){}[0] final fun remove(kotlin.collections/Collection, kotlin/Boolean): kotlin/Int // com.apollographql.cache.normalized.memory/MemoryCache.remove|remove(kotlin.collections.Collection;kotlin.Boolean){}[0] final fun remove(kotlin/String): kotlin/Int // com.apollographql.cache.normalized.memory/MemoryCache.remove|remove(kotlin.String){}[0] - final val size // com.apollographql.cache.normalized.memory/MemoryCache.size|{}size[0] - final fun (): kotlin/Int // com.apollographql.cache.normalized.memory/MemoryCache.size.|(){}[0] } + final class com.apollographql.cache.normalized.memory/MemoryCacheFactory : com.apollographql.cache.normalized.api/NormalizedCacheFactory { // com.apollographql.cache.normalized.memory/MemoryCacheFactory|null[0] constructor (kotlin/Int = ..., kotlin/Long = ...) // com.apollographql.cache.normalized.memory/MemoryCacheFactory.|(kotlin.Int;kotlin.Long){}[0] + final fun chain(com.apollographql.cache.normalized.api/NormalizedCacheFactory): com.apollographql.cache.normalized.memory/MemoryCacheFactory // com.apollographql.cache.normalized.memory/MemoryCacheFactory.chain|chain(com.apollographql.cache.normalized.api.NormalizedCacheFactory){}[0] final fun create(): com.apollographql.cache.normalized.memory/MemoryCache // com.apollographql.cache.normalized.memory/MemoryCacheFactory.create|create(){}[0] } + final class com.apollographql.cache.normalized/CacheInfo : com.apollographql.apollo.api/ExecutionContext.Element { // com.apollographql.cache.normalized/CacheInfo|null[0] - final class Builder { // com.apollographql.cache.normalized/CacheInfo.Builder|null[0] - constructor () // com.apollographql.cache.normalized/CacheInfo.Builder.|(){}[0] - final fun build(): com.apollographql.cache.normalized/CacheInfo // com.apollographql.cache.normalized/CacheInfo.Builder.build|build(){}[0] - final fun cacheEndMillis(kotlin/Long): com.apollographql.cache.normalized/CacheInfo.Builder // com.apollographql.cache.normalized/CacheInfo.Builder.cacheEndMillis|cacheEndMillis(kotlin.Long){}[0] - final fun cacheHit(kotlin/Boolean): com.apollographql.cache.normalized/CacheInfo.Builder // com.apollographql.cache.normalized/CacheInfo.Builder.cacheHit|cacheHit(kotlin.Boolean){}[0] - final fun cacheMissException(com.apollographql.apollo.exception/CacheMissException?): com.apollographql.cache.normalized/CacheInfo.Builder // com.apollographql.cache.normalized/CacheInfo.Builder.cacheMissException|cacheMissException(com.apollographql.apollo.exception.CacheMissException?){}[0] - final fun cacheStartMillis(kotlin/Long): com.apollographql.cache.normalized/CacheInfo.Builder // com.apollographql.cache.normalized/CacheInfo.Builder.cacheStartMillis|cacheStartMillis(kotlin.Long){}[0] - final fun networkEndMillis(kotlin/Long): com.apollographql.cache.normalized/CacheInfo.Builder // com.apollographql.cache.normalized/CacheInfo.Builder.networkEndMillis|networkEndMillis(kotlin.Long){}[0] - final fun networkException(com.apollographql.apollo.exception/ApolloException?): com.apollographql.cache.normalized/CacheInfo.Builder // com.apollographql.cache.normalized/CacheInfo.Builder.networkException|networkException(com.apollographql.apollo.exception.ApolloException?){}[0] - final fun networkStartMillis(kotlin/Long): com.apollographql.cache.normalized/CacheInfo.Builder // com.apollographql.cache.normalized/CacheInfo.Builder.networkStartMillis|networkStartMillis(kotlin.Long){}[0] - final fun stale(kotlin/Boolean): com.apollographql.cache.normalized/CacheInfo.Builder // com.apollographql.cache.normalized/CacheInfo.Builder.stale|stale(kotlin.Boolean){}[0] - } - final fun newBuilder(): com.apollographql.cache.normalized/CacheInfo.Builder // com.apollographql.cache.normalized/CacheInfo.newBuilder|newBuilder(){}[0] - final object Key : com.apollographql.apollo.api/ExecutionContext.Key // com.apollographql.cache.normalized/CacheInfo.Key|null[0] final val cacheEndMillis // com.apollographql.cache.normalized/CacheInfo.cacheEndMillis|{}cacheEndMillis[0] final fun (): kotlin/Long // com.apollographql.cache.normalized/CacheInfo.cacheEndMillis.|(){}[0] final val cacheMissException // com.apollographql.cache.normalized/CacheInfo.cacheMissException|{}cacheMissException[0] @@ -315,6 +409,8 @@ final class com.apollographql.cache.normalized/CacheInfo : com.apollographql.apo final fun (): kotlin/Long // com.apollographql.cache.normalized/CacheInfo.cacheStartMillis.|(){}[0] final val isCacheHit // com.apollographql.cache.normalized/CacheInfo.isCacheHit|{}isCacheHit[0] final fun (): kotlin/Boolean // com.apollographql.cache.normalized/CacheInfo.isCacheHit.|(){}[0] + final val isFromCache // com.apollographql.cache.normalized/CacheInfo.isFromCache|{}isFromCache[0] + final fun (): kotlin/Boolean // com.apollographql.cache.normalized/CacheInfo.isFromCache.|(){}[0] final val isStale // com.apollographql.cache.normalized/CacheInfo.isStale|{}isStale[0] final fun (): kotlin/Boolean // com.apollographql.cache.normalized/CacheInfo.isStale.|(){}[0] final val key // com.apollographql.cache.normalized/CacheInfo.key|{}key[0] @@ -325,13 +421,36 @@ final class com.apollographql.cache.normalized/CacheInfo : com.apollographql.apo final fun (): com.apollographql.apollo.exception/ApolloException? // com.apollographql.cache.normalized/CacheInfo.networkException.|(){}[0] final val networkStartMillis // com.apollographql.cache.normalized/CacheInfo.networkStartMillis|{}networkStartMillis[0] final fun (): kotlin/Long // com.apollographql.cache.normalized/CacheInfo.networkStartMillis.|(){}[0] + + final fun newBuilder(): com.apollographql.cache.normalized/CacheInfo.Builder // com.apollographql.cache.normalized/CacheInfo.newBuilder|newBuilder(){}[0] + + final class Builder { // com.apollographql.cache.normalized/CacheInfo.Builder|null[0] + constructor () // com.apollographql.cache.normalized/CacheInfo.Builder.|(){}[0] + + final fun build(): com.apollographql.cache.normalized/CacheInfo // com.apollographql.cache.normalized/CacheInfo.Builder.build|build(){}[0] + final fun cacheEndMillis(kotlin/Long): com.apollographql.cache.normalized/CacheInfo.Builder // com.apollographql.cache.normalized/CacheInfo.Builder.cacheEndMillis|cacheEndMillis(kotlin.Long){}[0] + final fun cacheHit(kotlin/Boolean): com.apollographql.cache.normalized/CacheInfo.Builder // com.apollographql.cache.normalized/CacheInfo.Builder.cacheHit|cacheHit(kotlin.Boolean){}[0] + final fun cacheMissException(com.apollographql.apollo.exception/CacheMissException?): com.apollographql.cache.normalized/CacheInfo.Builder // com.apollographql.cache.normalized/CacheInfo.Builder.cacheMissException|cacheMissException(com.apollographql.apollo.exception.CacheMissException?){}[0] + final fun cacheStartMillis(kotlin/Long): com.apollographql.cache.normalized/CacheInfo.Builder // com.apollographql.cache.normalized/CacheInfo.Builder.cacheStartMillis|cacheStartMillis(kotlin.Long){}[0] + final fun fromCache(kotlin/Boolean): com.apollographql.cache.normalized/CacheInfo.Builder // com.apollographql.cache.normalized/CacheInfo.Builder.fromCache|fromCache(kotlin.Boolean){}[0] + final fun networkEndMillis(kotlin/Long): com.apollographql.cache.normalized/CacheInfo.Builder // com.apollographql.cache.normalized/CacheInfo.Builder.networkEndMillis|networkEndMillis(kotlin.Long){}[0] + final fun networkException(com.apollographql.apollo.exception/ApolloException?): com.apollographql.cache.normalized/CacheInfo.Builder // com.apollographql.cache.normalized/CacheInfo.Builder.networkException|networkException(com.apollographql.apollo.exception.ApolloException?){}[0] + final fun networkStartMillis(kotlin/Long): com.apollographql.cache.normalized/CacheInfo.Builder // com.apollographql.cache.normalized/CacheInfo.Builder.networkStartMillis|networkStartMillis(kotlin.Long){}[0] + final fun stale(kotlin/Boolean): com.apollographql.cache.normalized/CacheInfo.Builder // com.apollographql.cache.normalized/CacheInfo.Builder.stale|stale(kotlin.Boolean){}[0] + } + + final object Key : com.apollographql.apollo.api/ExecutionContext.Key // com.apollographql.cache.normalized/CacheInfo.Key|null[0] } + final class com.apollographql.cache.normalized/CacheMissLoggingInterceptor : com.apollographql.apollo.interceptor/ApolloInterceptor { // com.apollographql.cache.normalized/CacheMissLoggingInterceptor|null[0] constructor (kotlin/Function1) // com.apollographql.cache.normalized/CacheMissLoggingInterceptor.|(kotlin.Function1){}[0] + final fun <#A1: com.apollographql.apollo.api/Operation.Data> intercept(com.apollographql.apollo.api/ApolloRequest<#A1>, com.apollographql.apollo.interceptor/ApolloInterceptorChain): kotlinx.coroutines.flow/Flow> // com.apollographql.cache.normalized/CacheMissLoggingInterceptor.intercept|intercept(com.apollographql.apollo.api.ApolloRequest<0:0>;com.apollographql.apollo.interceptor.ApolloInterceptorChain){0§}[0] } + final class com.apollographql.cache.normalized/GarbageCollectResult { // com.apollographql.cache.normalized/GarbageCollectResult|null[0] constructor (com.apollographql.cache.normalized/RemovedFieldsAndRecords, com.apollographql.cache.normalized/RemovedFieldsAndRecords, kotlin.collections/Set) // com.apollographql.cache.normalized/GarbageCollectResult.|(com.apollographql.cache.normalized.RemovedFieldsAndRecords;com.apollographql.cache.normalized.RemovedFieldsAndRecords;kotlin.collections.Set){}[0] + final val removedDanglingReferences // com.apollographql.cache.normalized/GarbageCollectResult.removedDanglingReferences|{}removedDanglingReferences[0] final fun (): com.apollographql.cache.normalized/RemovedFieldsAndRecords // com.apollographql.cache.normalized/GarbageCollectResult.removedDanglingReferences.|(){}[0] final val removedStaleFields // com.apollographql.cache.normalized/GarbageCollectResult.removedStaleFields|{}removedStaleFields[0] @@ -339,66 +458,16 @@ final class com.apollographql.cache.normalized/GarbageCollectResult { // com.apo final val removedUnreachableRecords // com.apollographql.cache.normalized/GarbageCollectResult.removedUnreachableRecords|{}removedUnreachableRecords[0] final fun (): kotlin.collections/Set // com.apollographql.cache.normalized/GarbageCollectResult.removedUnreachableRecords.|(){}[0] } + final class com.apollographql.cache.normalized/RemovedFieldsAndRecords { // com.apollographql.cache.normalized/RemovedFieldsAndRecords|null[0] constructor (kotlin.collections/Set, kotlin.collections/Set) // com.apollographql.cache.normalized/RemovedFieldsAndRecords.|(kotlin.collections.Set;kotlin.collections.Set){}[0] + final val removedFields // com.apollographql.cache.normalized/RemovedFieldsAndRecords.removedFields|{}removedFields[0] final fun (): kotlin.collections/Set // com.apollographql.cache.normalized/RemovedFieldsAndRecords.removedFields.|(){}[0] final val removedRecords // com.apollographql.cache.normalized/RemovedFieldsAndRecords.removedRecords|{}removedRecords[0] final fun (): kotlin.collections/Set // com.apollographql.cache.normalized/RemovedFieldsAndRecords.removedRecords.|(){}[0] } -final const val com.apollographql.cache.normalized/VERSION // com.apollographql.cache.normalized/VERSION|{}VERSION[0] - final fun (): kotlin/String // com.apollographql.cache.normalized/VERSION.|(){}[0] -final enum class com.apollographql.cache.normalized/FetchPolicy : kotlin/Enum { // com.apollographql.cache.normalized/FetchPolicy|null[0] - enum entry CacheAndNetwork // com.apollographql.cache.normalized/FetchPolicy.CacheAndNetwork|null[0] - enum entry CacheFirst // com.apollographql.cache.normalized/FetchPolicy.CacheFirst|null[0] - enum entry CacheOnly // com.apollographql.cache.normalized/FetchPolicy.CacheOnly|null[0] - enum entry NetworkFirst // com.apollographql.cache.normalized/FetchPolicy.NetworkFirst|null[0] - enum entry NetworkOnly // com.apollographql.cache.normalized/FetchPolicy.NetworkOnly|null[0] - final fun valueOf(kotlin/String): com.apollographql.cache.normalized/FetchPolicy // com.apollographql.cache.normalized/FetchPolicy.valueOf|valueOf#static(kotlin.String){}[0] - final fun values(): kotlin/Array // com.apollographql.cache.normalized/FetchPolicy.values|values#static(){}[0] - final val entries // com.apollographql.cache.normalized/FetchPolicy.entries|#static{}entries[0] - final fun (): kotlin.enums/EnumEntries // com.apollographql.cache.normalized/FetchPolicy.entries.|#static(){}[0] -} -final fun (com.apollographql.apollo/ApolloClient.Builder).com.apollographql.cache.normalized/logCacheMisses(kotlin/Function1 = ...): com.apollographql.apollo/ApolloClient.Builder // com.apollographql.cache.normalized/logCacheMisses|logCacheMisses@com.apollographql.apollo.ApolloClient.Builder(kotlin.Function1){}[0] -final fun (com.apollographql.apollo/ApolloClient.Builder).com.apollographql.cache.normalized/normalizedCache(com.apollographql.cache.normalized.api/NormalizedCacheFactory, com.apollographql.cache.normalized.api/CacheKeyGenerator = ..., com.apollographql.cache.normalized.api/MetadataGenerator = ..., com.apollographql.cache.normalized.api/CacheResolver = ..., com.apollographql.cache.normalized.api/RecordMerger = ..., com.apollographql.cache.normalized.api/FieldKeyGenerator = ..., com.apollographql.cache.normalized.api/EmbeddedFieldsProvider = ..., kotlin/Boolean = ...): com.apollographql.apollo/ApolloClient.Builder // com.apollographql.cache.normalized/normalizedCache|normalizedCache@com.apollographql.apollo.ApolloClient.Builder(com.apollographql.cache.normalized.api.NormalizedCacheFactory;com.apollographql.cache.normalized.api.CacheKeyGenerator;com.apollographql.cache.normalized.api.MetadataGenerator;com.apollographql.cache.normalized.api.CacheResolver;com.apollographql.cache.normalized.api.RecordMerger;com.apollographql.cache.normalized.api.FieldKeyGenerator;com.apollographql.cache.normalized.api.EmbeddedFieldsProvider;kotlin.Boolean){}[0] -final fun (com.apollographql.apollo/ApolloClient.Builder).com.apollographql.cache.normalized/store(com.apollographql.cache.normalized/ApolloStore, kotlin/Boolean = ...): com.apollographql.apollo/ApolloClient.Builder // com.apollographql.cache.normalized/store|store@com.apollographql.apollo.ApolloClient.Builder(com.apollographql.cache.normalized.ApolloStore;kotlin.Boolean){}[0] -final fun (com.apollographql.cache.normalized.api/NormalizedCache).com.apollographql.cache.normalized/allRecords(): kotlin.collections/Map // com.apollographql.cache.normalized/allRecords|allRecords@com.apollographql.cache.normalized.api.NormalizedCache(){}[0] -final fun (com.apollographql.cache.normalized.api/NormalizedCache).com.apollographql.cache.normalized/garbageCollect(com.apollographql.cache.normalized.api/MaxAgeProvider, kotlin.time/Duration = ...): com.apollographql.cache.normalized/GarbageCollectResult // com.apollographql.cache.normalized/garbageCollect|garbageCollect@com.apollographql.cache.normalized.api.NormalizedCache(com.apollographql.cache.normalized.api.MaxAgeProvider;kotlin.time.Duration){}[0] -final fun (com.apollographql.cache.normalized.api/NormalizedCache).com.apollographql.cache.normalized/removeDanglingReferences(): com.apollographql.cache.normalized/RemovedFieldsAndRecords // com.apollographql.cache.normalized/removeDanglingReferences|removeDanglingReferences@com.apollographql.cache.normalized.api.NormalizedCache(){}[0] -final fun (com.apollographql.cache.normalized.api/NormalizedCache).com.apollographql.cache.normalized/removeStaleFields(com.apollographql.cache.normalized.api/MaxAgeProvider, kotlin.time/Duration = ...): com.apollographql.cache.normalized/RemovedFieldsAndRecords // com.apollographql.cache.normalized/removeStaleFields|removeStaleFields@com.apollographql.cache.normalized.api.NormalizedCache(com.apollographql.cache.normalized.api.MaxAgeProvider;kotlin.time.Duration){}[0] -final fun (com.apollographql.cache.normalized.api/NormalizedCache).com.apollographql.cache.normalized/removeUnreachableRecords(): kotlin.collections/Set // com.apollographql.cache.normalized/removeUnreachableRecords|removeUnreachableRecords@com.apollographql.cache.normalized.api.NormalizedCache(){}[0] -final fun (com.apollographql.cache.normalized.api/Record).com.apollographql.cache.normalized.api/expirationDate(kotlin/String): kotlin/Long? // com.apollographql.cache.normalized.api/expirationDate|expirationDate@com.apollographql.cache.normalized.api.Record(kotlin.String){}[0] -final fun (com.apollographql.cache.normalized.api/Record).com.apollographql.cache.normalized.api/receivedDate(kotlin/String): kotlin/Long? // com.apollographql.cache.normalized.api/receivedDate|receivedDate@com.apollographql.cache.normalized.api.Record(kotlin.String){}[0] -final fun (com.apollographql.cache.normalized.api/Record).com.apollographql.cache.normalized.api/withDates(kotlin/String?, kotlin/String?): com.apollographql.cache.normalized.api/Record // com.apollographql.cache.normalized.api/withDates|withDates@com.apollographql.cache.normalized.api.Record(kotlin.String?;kotlin.String?){}[0] -final fun (com.apollographql.cache.normalized/ApolloStore).com.apollographql.cache.normalized/garbageCollect(com.apollographql.cache.normalized.api/MaxAgeProvider, kotlin.time/Duration = ...): com.apollographql.cache.normalized/GarbageCollectResult // com.apollographql.cache.normalized/garbageCollect|garbageCollect@com.apollographql.cache.normalized.ApolloStore(com.apollographql.cache.normalized.api.MaxAgeProvider;kotlin.time.Duration){}[0] -final fun (com.apollographql.cache.normalized/ApolloStore).com.apollographql.cache.normalized/removeDanglingReferences(): com.apollographql.cache.normalized/RemovedFieldsAndRecords // com.apollographql.cache.normalized/removeDanglingReferences|removeDanglingReferences@com.apollographql.cache.normalized.ApolloStore(){}[0] -final fun (com.apollographql.cache.normalized/ApolloStore).com.apollographql.cache.normalized/removeStaleFields(com.apollographql.cache.normalized.api/MaxAgeProvider, kotlin.time/Duration = ...): com.apollographql.cache.normalized/RemovedFieldsAndRecords // com.apollographql.cache.normalized/removeStaleFields|removeStaleFields@com.apollographql.cache.normalized.ApolloStore(com.apollographql.cache.normalized.api.MaxAgeProvider;kotlin.time.Duration){}[0] -final fun (com.apollographql.cache.normalized/ApolloStore).com.apollographql.cache.normalized/removeUnreachableRecords(): kotlin.collections/Set // com.apollographql.cache.normalized/removeUnreachableRecords|removeUnreachableRecords@com.apollographql.cache.normalized.ApolloStore(){}[0] -final fun (kotlin.collections/Collection?).com.apollographql.cache.normalized.api/dependentKeys(): kotlin.collections/Set // com.apollographql.cache.normalized.api/dependentKeys|dependentKeys@kotlin.collections.Collection?(){}[0] -final fun (kotlin.collections/Map).com.apollographql.cache.normalized/getReachableCacheKeys(): kotlin.collections/Set // com.apollographql.cache.normalized/getReachableCacheKeys|getReachableCacheKeys@kotlin.collections.Map(){}[0] -final fun <#A: com.apollographql.apollo.api/Executable.Data> (com.apollographql.apollo.api/Executable<#A>).com.apollographql.cache.normalized.api/normalize(#A, com.apollographql.apollo.api/CustomScalarAdapters, com.apollographql.cache.normalized.api/CacheKeyGenerator, com.apollographql.cache.normalized.api/MetadataGenerator = ..., com.apollographql.cache.normalized.api/FieldKeyGenerator = ..., com.apollographql.cache.normalized.api/EmbeddedFieldsProvider = ..., kotlin/String): kotlin.collections/Map // com.apollographql.cache.normalized.api/normalize|normalize@com.apollographql.apollo.api.Executable<0:0>(0:0;com.apollographql.apollo.api.CustomScalarAdapters;com.apollographql.cache.normalized.api.CacheKeyGenerator;com.apollographql.cache.normalized.api.MetadataGenerator;com.apollographql.cache.normalized.api.FieldKeyGenerator;com.apollographql.cache.normalized.api.EmbeddedFieldsProvider;kotlin.String){0§}[0] -final fun <#A: com.apollographql.apollo.api/Executable.Data> (com.apollographql.apollo.api/Executable<#A>).com.apollographql.cache.normalized.api/readDataFromCache(com.apollographql.apollo.api/CustomScalarAdapters, com.apollographql.cache.normalized.api/ReadOnlyNormalizedCache, com.apollographql.cache.normalized.api/CacheResolver, com.apollographql.cache.normalized.api/CacheHeaders, com.apollographql.cache.normalized.api/FieldKeyGenerator = ...): #A // com.apollographql.cache.normalized.api/readDataFromCache|readDataFromCache@com.apollographql.apollo.api.Executable<0:0>(com.apollographql.apollo.api.CustomScalarAdapters;com.apollographql.cache.normalized.api.ReadOnlyNormalizedCache;com.apollographql.cache.normalized.api.CacheResolver;com.apollographql.cache.normalized.api.CacheHeaders;com.apollographql.cache.normalized.api.FieldKeyGenerator){0§}[0] -final fun <#A: com.apollographql.apollo.api/Executable.Data> (com.apollographql.apollo.api/Executable<#A>).com.apollographql.cache.normalized.api/readDataFromCache(com.apollographql.cache.normalized.api/CacheKey, com.apollographql.apollo.api/CustomScalarAdapters, com.apollographql.cache.normalized.api/ReadOnlyNormalizedCache, com.apollographql.cache.normalized.api/CacheResolver, com.apollographql.cache.normalized.api/CacheHeaders, com.apollographql.cache.normalized.api/FieldKeyGenerator = ...): #A // com.apollographql.cache.normalized.api/readDataFromCache|readDataFromCache@com.apollographql.apollo.api.Executable<0:0>(com.apollographql.cache.normalized.api.CacheKey;com.apollographql.apollo.api.CustomScalarAdapters;com.apollographql.cache.normalized.api.ReadOnlyNormalizedCache;com.apollographql.cache.normalized.api.CacheResolver;com.apollographql.cache.normalized.api.CacheHeaders;com.apollographql.cache.normalized.api.FieldKeyGenerator){0§}[0] -final fun <#A: com.apollographql.apollo.api/Mutation.Data> (com.apollographql.apollo.api/ApolloRequest.Builder<#A>).com.apollographql.cache.normalized/optimisticUpdates(#A): com.apollographql.apollo.api/ApolloRequest.Builder<#A> // com.apollographql.cache.normalized/optimisticUpdates|optimisticUpdates@com.apollographql.apollo.api.ApolloRequest.Builder<0:0>(0:0){0§}[0] -final fun <#A: com.apollographql.apollo.api/Mutation.Data> (com.apollographql.apollo/ApolloCall<#A>).com.apollographql.cache.normalized/optimisticUpdates(#A): com.apollographql.apollo/ApolloCall<#A> // com.apollographql.cache.normalized/optimisticUpdates|optimisticUpdates@com.apollographql.apollo.ApolloCall<0:0>(0:0){0§}[0] -final fun <#A: com.apollographql.apollo.api/Operation.Data> (com.apollographql.apollo.api/ApolloResponse.Builder<#A>).com.apollographql.cache.normalized/cacheHeaders(com.apollographql.cache.normalized.api/CacheHeaders): com.apollographql.apollo.api/ApolloResponse.Builder<#A> // com.apollographql.cache.normalized/cacheHeaders|cacheHeaders@com.apollographql.apollo.api.ApolloResponse.Builder<0:0>(com.apollographql.cache.normalized.api.CacheHeaders){0§}[0] -final fun <#A: com.apollographql.apollo.api/Operation.Data> (com.apollographql.apollo.api/Operation<#A>).com.apollographql.cache.normalized.api/normalize(#A, com.apollographql.apollo.api/CustomScalarAdapters, com.apollographql.cache.normalized.api/CacheKeyGenerator, com.apollographql.cache.normalized.api/MetadataGenerator = ..., com.apollographql.cache.normalized.api/FieldKeyGenerator = ..., com.apollographql.cache.normalized.api/EmbeddedFieldsProvider = ...): kotlin.collections/Map // com.apollographql.cache.normalized.api/normalize|normalize@com.apollographql.apollo.api.Operation<0:0>(0:0;com.apollographql.apollo.api.CustomScalarAdapters;com.apollographql.cache.normalized.api.CacheKeyGenerator;com.apollographql.cache.normalized.api.MetadataGenerator;com.apollographql.cache.normalized.api.FieldKeyGenerator;com.apollographql.cache.normalized.api.EmbeddedFieldsProvider){0§}[0] -final fun <#A: com.apollographql.apollo.api/Query.Data> (com.apollographql.apollo/ApolloCall<#A>).com.apollographql.cache.normalized/watch(#A?): kotlinx.coroutines.flow/Flow> // com.apollographql.cache.normalized/watch|watch@com.apollographql.apollo.ApolloCall<0:0>(0:0?){0§}[0] -final fun <#A: com.apollographql.apollo.api/Query.Data> (com.apollographql.apollo/ApolloCall<#A>).com.apollographql.cache.normalized/watch(): kotlinx.coroutines.flow/Flow> // com.apollographql.cache.normalized/watch|watch@com.apollographql.apollo.ApolloCall<0:0>(){0§}[0] -final fun <#A: kotlin/Any?> (com.apollographql.apollo.api/MutableExecutionOptions<#A>).com.apollographql.cache.normalized/addCacheHeader(kotlin/String, kotlin/String): #A // com.apollographql.cache.normalized/addCacheHeader|addCacheHeader@com.apollographql.apollo.api.MutableExecutionOptions<0:0>(kotlin.String;kotlin.String){0§}[0] -final fun <#A: kotlin/Any?> (com.apollographql.apollo.api/MutableExecutionOptions<#A>).com.apollographql.cache.normalized/cacheHeaders(com.apollographql.cache.normalized.api/CacheHeaders): #A // com.apollographql.cache.normalized/cacheHeaders|cacheHeaders@com.apollographql.apollo.api.MutableExecutionOptions<0:0>(com.apollographql.cache.normalized.api.CacheHeaders){0§}[0] -final fun <#A: kotlin/Any?> (com.apollographql.apollo.api/MutableExecutionOptions<#A>).com.apollographql.cache.normalized/doNotStore(kotlin/Boolean): #A // com.apollographql.cache.normalized/doNotStore|doNotStore@com.apollographql.apollo.api.MutableExecutionOptions<0:0>(kotlin.Boolean){0§}[0] -final fun <#A: kotlin/Any?> (com.apollographql.apollo.api/MutableExecutionOptions<#A>).com.apollographql.cache.normalized/fetchPolicy(com.apollographql.cache.normalized/FetchPolicy): #A // com.apollographql.cache.normalized/fetchPolicy|fetchPolicy@com.apollographql.apollo.api.MutableExecutionOptions<0:0>(com.apollographql.cache.normalized.FetchPolicy){0§}[0] -final fun <#A: kotlin/Any?> (com.apollographql.apollo.api/MutableExecutionOptions<#A>).com.apollographql.cache.normalized/fetchPolicyInterceptor(com.apollographql.apollo.interceptor/ApolloInterceptor): #A // com.apollographql.cache.normalized/fetchPolicyInterceptor|fetchPolicyInterceptor@com.apollographql.apollo.api.MutableExecutionOptions<0:0>(com.apollographql.apollo.interceptor.ApolloInterceptor){0§}[0] -final fun <#A: kotlin/Any?> (com.apollographql.apollo.api/MutableExecutionOptions<#A>).com.apollographql.cache.normalized/maxStale(kotlin.time/Duration): #A // com.apollographql.cache.normalized/maxStale|maxStale@com.apollographql.apollo.api.MutableExecutionOptions<0:0>(kotlin.time.Duration){0§}[0] -final fun <#A: kotlin/Any?> (com.apollographql.apollo.api/MutableExecutionOptions<#A>).com.apollographql.cache.normalized/memoryCacheOnly(kotlin/Boolean): #A // com.apollographql.cache.normalized/memoryCacheOnly|memoryCacheOnly@com.apollographql.apollo.api.MutableExecutionOptions<0:0>(kotlin.Boolean){0§}[0] -final fun <#A: kotlin/Any?> (com.apollographql.apollo.api/MutableExecutionOptions<#A>).com.apollographql.cache.normalized/refetchPolicy(com.apollographql.cache.normalized/FetchPolicy): #A // com.apollographql.cache.normalized/refetchPolicy|refetchPolicy@com.apollographql.apollo.api.MutableExecutionOptions<0:0>(com.apollographql.cache.normalized.FetchPolicy){0§}[0] -final fun <#A: kotlin/Any?> (com.apollographql.apollo.api/MutableExecutionOptions<#A>).com.apollographql.cache.normalized/refetchPolicyInterceptor(com.apollographql.apollo.interceptor/ApolloInterceptor): #A // com.apollographql.cache.normalized/refetchPolicyInterceptor|refetchPolicyInterceptor@com.apollographql.apollo.api.MutableExecutionOptions<0:0>(com.apollographql.apollo.interceptor.ApolloInterceptor){0§}[0] -final fun <#A: kotlin/Any?> (com.apollographql.apollo.api/MutableExecutionOptions<#A>).com.apollographql.cache.normalized/storeExpirationDate(kotlin/Boolean): #A // com.apollographql.cache.normalized/storeExpirationDate|storeExpirationDate@com.apollographql.apollo.api.MutableExecutionOptions<0:0>(kotlin.Boolean){0§}[0] -final fun <#A: kotlin/Any?> (com.apollographql.apollo.api/MutableExecutionOptions<#A>).com.apollographql.cache.normalized/storePartialResponses(kotlin/Boolean): #A // com.apollographql.cache.normalized/storePartialResponses|storePartialResponses@com.apollographql.apollo.api.MutableExecutionOptions<0:0>(kotlin.Boolean){0§}[0] -final fun <#A: kotlin/Any?> (com.apollographql.apollo.api/MutableExecutionOptions<#A>).com.apollographql.cache.normalized/storeReceiveDate(kotlin/Boolean): #A // com.apollographql.cache.normalized/storeReceiveDate|storeReceiveDate@com.apollographql.apollo.api.MutableExecutionOptions<0:0>(kotlin.Boolean){0§}[0] -final fun <#A: kotlin/Any?> (com.apollographql.apollo.api/MutableExecutionOptions<#A>).com.apollographql.cache.normalized/writeToCacheAsynchronously(kotlin/Boolean): #A // com.apollographql.cache.normalized/writeToCacheAsynchronously|writeToCacheAsynchronously@com.apollographql.apollo.api.MutableExecutionOptions<0:0>(kotlin.Boolean){0§}[0] -final fun com.apollographql.cache.normalized/ApolloStore(com.apollographql.cache.normalized.api/NormalizedCacheFactory, com.apollographql.cache.normalized.api/CacheKeyGenerator = ..., com.apollographql.cache.normalized.api/MetadataGenerator = ..., com.apollographql.cache.normalized.api/CacheResolver = ..., com.apollographql.cache.normalized.api/RecordMerger = ..., com.apollographql.cache.normalized.api/FieldKeyGenerator = ..., com.apollographql.cache.normalized.api/EmbeddedFieldsProvider = ...): com.apollographql.cache.normalized/ApolloStore // com.apollographql.cache.normalized/ApolloStore|ApolloStore(com.apollographql.cache.normalized.api.NormalizedCacheFactory;com.apollographql.cache.normalized.api.CacheKeyGenerator;com.apollographql.cache.normalized.api.MetadataGenerator;com.apollographql.cache.normalized.api.CacheResolver;com.apollographql.cache.normalized.api.RecordMerger;com.apollographql.cache.normalized.api.FieldKeyGenerator;com.apollographql.cache.normalized.api.EmbeddedFieldsProvider){}[0] + final object com.apollographql.cache.normalized.api/ApolloCacheHeaders { // com.apollographql.cache.normalized.api/ApolloCacheHeaders|null[0] final const val DO_NOT_STORE // com.apollographql.cache.normalized.api/ApolloCacheHeaders.DO_NOT_STORE|{}DO_NOT_STORE[0] final fun (): kotlin/String // com.apollographql.cache.normalized.api/ApolloCacheHeaders.DO_NOT_STORE.|(){}[0] @@ -415,27 +484,38 @@ final object com.apollographql.cache.normalized.api/ApolloCacheHeaders { // com. final const val STALE // com.apollographql.cache.normalized.api/ApolloCacheHeaders.STALE|{}STALE[0] final fun (): kotlin/String // com.apollographql.cache.normalized.api/ApolloCacheHeaders.STALE.|(){}[0] } + final object com.apollographql.cache.normalized.api/DefaultCacheResolver : com.apollographql.cache.normalized.api/CacheResolver { // com.apollographql.cache.normalized.api/DefaultCacheResolver|null[0] final fun resolveField(com.apollographql.cache.normalized.api/ResolverContext): kotlin/Any? // com.apollographql.cache.normalized.api/DefaultCacheResolver.resolveField|resolveField(com.apollographql.cache.normalized.api.ResolverContext){}[0] } + final object com.apollographql.cache.normalized.api/DefaultEmbeddedFieldsProvider : com.apollographql.cache.normalized.api/EmbeddedFieldsProvider { // com.apollographql.cache.normalized.api/DefaultEmbeddedFieldsProvider|null[0] final fun getEmbeddedFields(com.apollographql.cache.normalized.api/EmbeddedFieldsContext): kotlin.collections/List // com.apollographql.cache.normalized.api/DefaultEmbeddedFieldsProvider.getEmbeddedFields|getEmbeddedFields(com.apollographql.cache.normalized.api.EmbeddedFieldsContext){}[0] } + final object com.apollographql.cache.normalized.api/DefaultFieldKeyGenerator : com.apollographql.cache.normalized.api/FieldKeyGenerator { // com.apollographql.cache.normalized.api/DefaultFieldKeyGenerator|null[0] final fun getFieldKey(com.apollographql.cache.normalized.api/FieldKeyContext): kotlin/String // com.apollographql.cache.normalized.api/DefaultFieldKeyGenerator.getFieldKey|getFieldKey(com.apollographql.cache.normalized.api.FieldKeyContext){}[0] } + final object com.apollographql.cache.normalized.api/DefaultRecordMerger : com.apollographql.cache.normalized.api/RecordMerger { // com.apollographql.cache.normalized.api/DefaultRecordMerger|null[0] final fun merge(com.apollographql.cache.normalized.api/Record, com.apollographql.cache.normalized.api/Record): kotlin/Pair> // com.apollographql.cache.normalized.api/DefaultRecordMerger.merge|merge(com.apollographql.cache.normalized.api.Record;com.apollographql.cache.normalized.api.Record){}[0] } + final object com.apollographql.cache.normalized.api/EmptyMetadataGenerator : com.apollographql.cache.normalized.api/MetadataGenerator { // com.apollographql.cache.normalized.api/EmptyMetadataGenerator|null[0] final fun metadataForObject(kotlin/Any?, com.apollographql.cache.normalized.api/MetadataGeneratorContext): kotlin.collections/Map // com.apollographql.cache.normalized.api/EmptyMetadataGenerator.metadataForObject|metadataForObject(kotlin.Any?;com.apollographql.cache.normalized.api.MetadataGeneratorContext){}[0] } + final object com.apollographql.cache.normalized.api/FieldPolicyCacheResolver : com.apollographql.cache.normalized.api/CacheResolver { // com.apollographql.cache.normalized.api/FieldPolicyCacheResolver|null[0] final fun resolveField(com.apollographql.cache.normalized.api/ResolverContext): kotlin/Any? // com.apollographql.cache.normalized.api/FieldPolicyCacheResolver.resolveField|resolveField(com.apollographql.cache.normalized.api.ResolverContext){}[0] } + final object com.apollographql.cache.normalized.api/TypePolicyCacheKeyGenerator : com.apollographql.cache.normalized.api/CacheKeyGenerator { // com.apollographql.cache.normalized.api/TypePolicyCacheKeyGenerator|null[0] final fun cacheKeyForObject(kotlin.collections/Map, com.apollographql.cache.normalized.api/CacheKeyGeneratorContext): com.apollographql.cache.normalized.api/CacheKey? // com.apollographql.cache.normalized.api/TypePolicyCacheKeyGenerator.cacheKeyForObject|cacheKeyForObject(kotlin.collections.Map;com.apollographql.cache.normalized.api.CacheKeyGeneratorContext){}[0] } + +final const val com.apollographql.cache.normalized/VERSION // com.apollographql.cache.normalized/VERSION|{}VERSION[0] + final fun (): kotlin/String // com.apollographql.cache.normalized/VERSION.|(){}[0] + final val com.apollographql.cache.normalized.api/ConnectionRecordMerger // com.apollographql.cache.normalized.api/ConnectionRecordMerger|{}ConnectionRecordMerger[0] final fun (): com.apollographql.cache.normalized.api/FieldRecordMerger // com.apollographql.cache.normalized.api/ConnectionRecordMerger.|(){}[0] final val com.apollographql.cache.normalized/CacheAndNetworkInterceptor // com.apollographql.cache.normalized/CacheAndNetworkInterceptor|{}CacheAndNetworkInterceptor[0] @@ -454,17 +534,49 @@ final val com.apollographql.cache.normalized/cacheHeaders // com.apollographql.c final fun <#A1: com.apollographql.apollo.api/Operation.Data> (com.apollographql.apollo.api/ApolloResponse<#A1>).(): com.apollographql.cache.normalized.api/CacheHeaders // com.apollographql.cache.normalized/cacheHeaders.|@com.apollographql.apollo.api.ApolloResponse<0:0>(){0§}[0] final val com.apollographql.cache.normalized/cacheInfo // com.apollographql.cache.normalized/cacheInfo|@com.apollographql.apollo.api.ApolloResponse<0:0>{0§}cacheInfo[0] final fun <#A1: com.apollographql.apollo.api/Operation.Data> (com.apollographql.apollo.api/ApolloResponse<#A1>).(): com.apollographql.cache.normalized/CacheInfo? // com.apollographql.cache.normalized/cacheInfo.|@com.apollographql.apollo.api.ApolloResponse<0:0>(){0§}[0] +final val com.apollographql.cache.normalized/fetchFromCache // com.apollographql.cache.normalized/fetchFromCache|@com.apollographql.apollo.api.ApolloRequest<0:0>{0§}fetchFromCache[0] + final fun <#A1: com.apollographql.apollo.api/Operation.Data> (com.apollographql.apollo.api/ApolloRequest<#A1>).(): kotlin/Boolean // com.apollographql.cache.normalized/fetchFromCache.|@com.apollographql.apollo.api.ApolloRequest<0:0>(){0§}[0] final val com.apollographql.cache.normalized/isFromCache // com.apollographql.cache.normalized/isFromCache|@com.apollographql.apollo.api.ApolloResponse<0:0>{0§}isFromCache[0] final fun <#A1: com.apollographql.apollo.api/Operation.Data> (com.apollographql.apollo.api/ApolloResponse<#A1>).(): kotlin/Boolean // com.apollographql.cache.normalized/isFromCache.|@com.apollographql.apollo.api.ApolloResponse<0:0>(){0§}[0] -sealed interface com.apollographql.cache.normalized.api/MaxAge { // com.apollographql.cache.normalized.api/MaxAge|null[0] - final class Duration : com.apollographql.cache.normalized.api/MaxAge { // com.apollographql.cache.normalized.api/MaxAge.Duration|null[0] - constructor (kotlin.time/Duration) // com.apollographql.cache.normalized.api/MaxAge.Duration.|(kotlin.time.Duration){}[0] - final val duration // com.apollographql.cache.normalized.api/MaxAge.Duration.duration|{}duration[0] - final fun (): kotlin.time/Duration // com.apollographql.cache.normalized.api/MaxAge.Duration.duration.|(){}[0] - } - final object Inherit : com.apollographql.cache.normalized.api/MaxAge { // com.apollographql.cache.normalized.api/MaxAge.Inherit|null[0] - final fun equals(kotlin/Any?): kotlin/Boolean // com.apollographql.cache.normalized.api/MaxAge.Inherit.equals|equals(kotlin.Any?){}[0] - final fun hashCode(): kotlin/Int // com.apollographql.cache.normalized.api/MaxAge.Inherit.hashCode|hashCode(){}[0] - final fun toString(): kotlin/String // com.apollographql.cache.normalized.api/MaxAge.Inherit.toString|toString(){}[0] - } -} + +final fun (com.apollographql.apollo/ApolloClient.Builder).com.apollographql.cache.normalized/logCacheMisses(kotlin/Function1 = ...): com.apollographql.apollo/ApolloClient.Builder // com.apollographql.cache.normalized/logCacheMisses|logCacheMisses@com.apollographql.apollo.ApolloClient.Builder(kotlin.Function1){}[0] +final fun (com.apollographql.apollo/ApolloClient.Builder).com.apollographql.cache.normalized/normalizedCache(com.apollographql.cache.normalized.api/NormalizedCacheFactory, com.apollographql.cache.normalized.api/CacheKeyGenerator = ..., com.apollographql.cache.normalized.api/MetadataGenerator = ..., com.apollographql.cache.normalized.api/CacheResolver = ..., com.apollographql.cache.normalized.api/RecordMerger = ..., com.apollographql.cache.normalized.api/FieldKeyGenerator = ..., com.apollographql.cache.normalized.api/EmbeddedFieldsProvider = ..., kotlin/Boolean = ...): com.apollographql.apollo/ApolloClient.Builder // com.apollographql.cache.normalized/normalizedCache|normalizedCache@com.apollographql.apollo.ApolloClient.Builder(com.apollographql.cache.normalized.api.NormalizedCacheFactory;com.apollographql.cache.normalized.api.CacheKeyGenerator;com.apollographql.cache.normalized.api.MetadataGenerator;com.apollographql.cache.normalized.api.CacheResolver;com.apollographql.cache.normalized.api.RecordMerger;com.apollographql.cache.normalized.api.FieldKeyGenerator;com.apollographql.cache.normalized.api.EmbeddedFieldsProvider;kotlin.Boolean){}[0] +final fun (com.apollographql.apollo/ApolloClient.Builder).com.apollographql.cache.normalized/store(com.apollographql.cache.normalized/ApolloStore, kotlin/Boolean = ...): com.apollographql.apollo/ApolloClient.Builder // com.apollographql.cache.normalized/store|store@com.apollographql.apollo.ApolloClient.Builder(com.apollographql.cache.normalized.ApolloStore;kotlin.Boolean){}[0] +final fun (com.apollographql.cache.normalized.api/NormalizedCache).com.apollographql.cache.normalized/allRecords(): kotlin.collections/Map // com.apollographql.cache.normalized/allRecords|allRecords@com.apollographql.cache.normalized.api.NormalizedCache(){}[0] +final fun (com.apollographql.cache.normalized.api/NormalizedCache).com.apollographql.cache.normalized/garbageCollect(com.apollographql.cache.normalized.api/MaxAgeProvider, kotlin.time/Duration = ...): com.apollographql.cache.normalized/GarbageCollectResult // com.apollographql.cache.normalized/garbageCollect|garbageCollect@com.apollographql.cache.normalized.api.NormalizedCache(com.apollographql.cache.normalized.api.MaxAgeProvider;kotlin.time.Duration){}[0] +final fun (com.apollographql.cache.normalized.api/NormalizedCache).com.apollographql.cache.normalized/removeDanglingReferences(): com.apollographql.cache.normalized/RemovedFieldsAndRecords // com.apollographql.cache.normalized/removeDanglingReferences|removeDanglingReferences@com.apollographql.cache.normalized.api.NormalizedCache(){}[0] +final fun (com.apollographql.cache.normalized.api/NormalizedCache).com.apollographql.cache.normalized/removeStaleFields(com.apollographql.cache.normalized.api/MaxAgeProvider, kotlin.time/Duration = ...): com.apollographql.cache.normalized/RemovedFieldsAndRecords // com.apollographql.cache.normalized/removeStaleFields|removeStaleFields@com.apollographql.cache.normalized.api.NormalizedCache(com.apollographql.cache.normalized.api.MaxAgeProvider;kotlin.time.Duration){}[0] +final fun (com.apollographql.cache.normalized.api/NormalizedCache).com.apollographql.cache.normalized/removeUnreachableRecords(): kotlin.collections/Set // com.apollographql.cache.normalized/removeUnreachableRecords|removeUnreachableRecords@com.apollographql.cache.normalized.api.NormalizedCache(){}[0] +final fun (com.apollographql.cache.normalized.api/Record).com.apollographql.cache.normalized.api/expirationDate(kotlin/String): kotlin/Long? // com.apollographql.cache.normalized.api/expirationDate|expirationDate@com.apollographql.cache.normalized.api.Record(kotlin.String){}[0] +final fun (com.apollographql.cache.normalized.api/Record).com.apollographql.cache.normalized.api/receivedDate(kotlin/String): kotlin/Long? // com.apollographql.cache.normalized.api/receivedDate|receivedDate@com.apollographql.cache.normalized.api.Record(kotlin.String){}[0] +final fun (com.apollographql.cache.normalized.api/Record).com.apollographql.cache.normalized.api/withDates(kotlin/String?, kotlin/String?): com.apollographql.cache.normalized.api/Record // com.apollographql.cache.normalized.api/withDates|withDates@com.apollographql.cache.normalized.api.Record(kotlin.String?;kotlin.String?){}[0] +final fun (com.apollographql.cache.normalized/ApolloStore).com.apollographql.cache.normalized/garbageCollect(com.apollographql.cache.normalized.api/MaxAgeProvider, kotlin.time/Duration = ...): com.apollographql.cache.normalized/GarbageCollectResult // com.apollographql.cache.normalized/garbageCollect|garbageCollect@com.apollographql.cache.normalized.ApolloStore(com.apollographql.cache.normalized.api.MaxAgeProvider;kotlin.time.Duration){}[0] +final fun (com.apollographql.cache.normalized/ApolloStore).com.apollographql.cache.normalized/removeDanglingReferences(): com.apollographql.cache.normalized/RemovedFieldsAndRecords // com.apollographql.cache.normalized/removeDanglingReferences|removeDanglingReferences@com.apollographql.cache.normalized.ApolloStore(){}[0] +final fun (com.apollographql.cache.normalized/ApolloStore).com.apollographql.cache.normalized/removeStaleFields(com.apollographql.cache.normalized.api/MaxAgeProvider, kotlin.time/Duration = ...): com.apollographql.cache.normalized/RemovedFieldsAndRecords // com.apollographql.cache.normalized/removeStaleFields|removeStaleFields@com.apollographql.cache.normalized.ApolloStore(com.apollographql.cache.normalized.api.MaxAgeProvider;kotlin.time.Duration){}[0] +final fun (com.apollographql.cache.normalized/ApolloStore).com.apollographql.cache.normalized/removeUnreachableRecords(): kotlin.collections/Set // com.apollographql.cache.normalized/removeUnreachableRecords|removeUnreachableRecords@com.apollographql.cache.normalized.ApolloStore(){}[0] +final fun (kotlin.collections/Collection?).com.apollographql.cache.normalized.api/dependentKeys(): kotlin.collections/Set // com.apollographql.cache.normalized.api/dependentKeys|dependentKeys@kotlin.collections.Collection?(){}[0] +final fun (kotlin.collections/Map).com.apollographql.cache.normalized/getReachableCacheKeys(): kotlin.collections/Set // com.apollographql.cache.normalized/getReachableCacheKeys|getReachableCacheKeys@kotlin.collections.Map(){}[0] +final fun <#A: com.apollographql.apollo.api/Executable.Data> (com.apollographql.apollo.api/Executable<#A>).com.apollographql.cache.normalized.api/normalize(#A, com.apollographql.apollo.api/CustomScalarAdapters, com.apollographql.cache.normalized.api/CacheKeyGenerator, com.apollographql.cache.normalized.api/MetadataGenerator = ..., com.apollographql.cache.normalized.api/FieldKeyGenerator = ..., com.apollographql.cache.normalized.api/EmbeddedFieldsProvider = ..., kotlin/String): kotlin.collections/Map // com.apollographql.cache.normalized.api/normalize|normalize@com.apollographql.apollo.api.Executable<0:0>(0:0;com.apollographql.apollo.api.CustomScalarAdapters;com.apollographql.cache.normalized.api.CacheKeyGenerator;com.apollographql.cache.normalized.api.MetadataGenerator;com.apollographql.cache.normalized.api.FieldKeyGenerator;com.apollographql.cache.normalized.api.EmbeddedFieldsProvider;kotlin.String){0§}[0] +final fun <#A: com.apollographql.apollo.api/Executable.Data> (com.apollographql.apollo.api/Executable<#A>).com.apollographql.cache.normalized.api/readDataFromCache(com.apollographql.apollo.api/CustomScalarAdapters, com.apollographql.cache.normalized.api/ReadOnlyNormalizedCache, com.apollographql.cache.normalized.api/CacheResolver, com.apollographql.cache.normalized.api/CacheHeaders, com.apollographql.cache.normalized.api/FieldKeyGenerator = ...): #A // com.apollographql.cache.normalized.api/readDataFromCache|readDataFromCache@com.apollographql.apollo.api.Executable<0:0>(com.apollographql.apollo.api.CustomScalarAdapters;com.apollographql.cache.normalized.api.ReadOnlyNormalizedCache;com.apollographql.cache.normalized.api.CacheResolver;com.apollographql.cache.normalized.api.CacheHeaders;com.apollographql.cache.normalized.api.FieldKeyGenerator){0§}[0] +final fun <#A: com.apollographql.apollo.api/Executable.Data> (com.apollographql.apollo.api/Executable<#A>).com.apollographql.cache.normalized.api/readDataFromCache(com.apollographql.cache.normalized.api/CacheKey, com.apollographql.apollo.api/CustomScalarAdapters, com.apollographql.cache.normalized.api/ReadOnlyNormalizedCache, com.apollographql.cache.normalized.api/CacheResolver, com.apollographql.cache.normalized.api/CacheHeaders, com.apollographql.cache.normalized.api/FieldKeyGenerator = ...): #A // com.apollographql.cache.normalized.api/readDataFromCache|readDataFromCache@com.apollographql.apollo.api.Executable<0:0>(com.apollographql.cache.normalized.api.CacheKey;com.apollographql.apollo.api.CustomScalarAdapters;com.apollographql.cache.normalized.api.ReadOnlyNormalizedCache;com.apollographql.cache.normalized.api.CacheResolver;com.apollographql.cache.normalized.api.CacheHeaders;com.apollographql.cache.normalized.api.FieldKeyGenerator){0§}[0] +final fun <#A: com.apollographql.apollo.api/Mutation.Data> (com.apollographql.apollo.api/ApolloRequest.Builder<#A>).com.apollographql.cache.normalized/optimisticUpdates(#A): com.apollographql.apollo.api/ApolloRequest.Builder<#A> // com.apollographql.cache.normalized/optimisticUpdates|optimisticUpdates@com.apollographql.apollo.api.ApolloRequest.Builder<0:0>(0:0){0§}[0] +final fun <#A: com.apollographql.apollo.api/Mutation.Data> (com.apollographql.apollo/ApolloCall<#A>).com.apollographql.cache.normalized/optimisticUpdates(#A): com.apollographql.apollo/ApolloCall<#A> // com.apollographql.cache.normalized/optimisticUpdates|optimisticUpdates@com.apollographql.apollo.ApolloCall<0:0>(0:0){0§}[0] +final fun <#A: com.apollographql.apollo.api/Operation.Data> (com.apollographql.apollo.api/ApolloRequest.Builder<#A>).com.apollographql.cache.normalized/fetchFromCache(kotlin/Boolean): com.apollographql.apollo.api/ApolloRequest.Builder<#A> // com.apollographql.cache.normalized/fetchFromCache|fetchFromCache@com.apollographql.apollo.api.ApolloRequest.Builder<0:0>(kotlin.Boolean){0§}[0] +final fun <#A: com.apollographql.apollo.api/Operation.Data> (com.apollographql.apollo.api/ApolloResponse.Builder<#A>).com.apollographql.cache.normalized/cacheHeaders(com.apollographql.cache.normalized.api/CacheHeaders): com.apollographql.apollo.api/ApolloResponse.Builder<#A> // com.apollographql.cache.normalized/cacheHeaders|cacheHeaders@com.apollographql.apollo.api.ApolloResponse.Builder<0:0>(com.apollographql.cache.normalized.api.CacheHeaders){0§}[0] +final fun <#A: com.apollographql.apollo.api/Operation.Data> (com.apollographql.apollo.api/Operation<#A>).com.apollographql.cache.normalized.api/normalize(#A, com.apollographql.apollo.api/CustomScalarAdapters, com.apollographql.cache.normalized.api/CacheKeyGenerator, com.apollographql.cache.normalized.api/MetadataGenerator = ..., com.apollographql.cache.normalized.api/FieldKeyGenerator = ..., com.apollographql.cache.normalized.api/EmbeddedFieldsProvider = ...): kotlin.collections/Map // com.apollographql.cache.normalized.api/normalize|normalize@com.apollographql.apollo.api.Operation<0:0>(0:0;com.apollographql.apollo.api.CustomScalarAdapters;com.apollographql.cache.normalized.api.CacheKeyGenerator;com.apollographql.cache.normalized.api.MetadataGenerator;com.apollographql.cache.normalized.api.FieldKeyGenerator;com.apollographql.cache.normalized.api.EmbeddedFieldsProvider){0§}[0] +final fun <#A: com.apollographql.apollo.api/Query.Data> (com.apollographql.apollo/ApolloCall<#A>).com.apollographql.cache.normalized/watch(#A?): kotlinx.coroutines.flow/Flow> // com.apollographql.cache.normalized/watch|watch@com.apollographql.apollo.ApolloCall<0:0>(0:0?){0§}[0] +final fun <#A: com.apollographql.apollo.api/Query.Data> (com.apollographql.apollo/ApolloCall<#A>).com.apollographql.cache.normalized/watch(): kotlinx.coroutines.flow/Flow> // com.apollographql.cache.normalized/watch|watch@com.apollographql.apollo.ApolloCall<0:0>(){0§}[0] +final fun <#A: kotlin/Any?> (com.apollographql.apollo.api/MutableExecutionOptions<#A>).com.apollographql.cache.normalized/addCacheHeader(kotlin/String, kotlin/String): #A // com.apollographql.cache.normalized/addCacheHeader|addCacheHeader@com.apollographql.apollo.api.MutableExecutionOptions<0:0>(kotlin.String;kotlin.String){0§}[0] +final fun <#A: kotlin/Any?> (com.apollographql.apollo.api/MutableExecutionOptions<#A>).com.apollographql.cache.normalized/cacheHeaders(com.apollographql.cache.normalized.api/CacheHeaders): #A // com.apollographql.cache.normalized/cacheHeaders|cacheHeaders@com.apollographql.apollo.api.MutableExecutionOptions<0:0>(com.apollographql.cache.normalized.api.CacheHeaders){0§}[0] +final fun <#A: kotlin/Any?> (com.apollographql.apollo.api/MutableExecutionOptions<#A>).com.apollographql.cache.normalized/doNotStore(kotlin/Boolean): #A // com.apollographql.cache.normalized/doNotStore|doNotStore@com.apollographql.apollo.api.MutableExecutionOptions<0:0>(kotlin.Boolean){0§}[0] +final fun <#A: kotlin/Any?> (com.apollographql.apollo.api/MutableExecutionOptions<#A>).com.apollographql.cache.normalized/fetchPolicy(com.apollographql.cache.normalized/FetchPolicy): #A // com.apollographql.cache.normalized/fetchPolicy|fetchPolicy@com.apollographql.apollo.api.MutableExecutionOptions<0:0>(com.apollographql.cache.normalized.FetchPolicy){0§}[0] +final fun <#A: kotlin/Any?> (com.apollographql.apollo.api/MutableExecutionOptions<#A>).com.apollographql.cache.normalized/fetchPolicyInterceptor(com.apollographql.apollo.interceptor/ApolloInterceptor): #A // com.apollographql.cache.normalized/fetchPolicyInterceptor|fetchPolicyInterceptor@com.apollographql.apollo.api.MutableExecutionOptions<0:0>(com.apollographql.apollo.interceptor.ApolloInterceptor){0§}[0] +final fun <#A: kotlin/Any?> (com.apollographql.apollo.api/MutableExecutionOptions<#A>).com.apollographql.cache.normalized/maxStale(kotlin.time/Duration): #A // com.apollographql.cache.normalized/maxStale|maxStale@com.apollographql.apollo.api.MutableExecutionOptions<0:0>(kotlin.time.Duration){0§}[0] +final fun <#A: kotlin/Any?> (com.apollographql.apollo.api/MutableExecutionOptions<#A>).com.apollographql.cache.normalized/memoryCacheOnly(kotlin/Boolean): #A // com.apollographql.cache.normalized/memoryCacheOnly|memoryCacheOnly@com.apollographql.apollo.api.MutableExecutionOptions<0:0>(kotlin.Boolean){0§}[0] +final fun <#A: kotlin/Any?> (com.apollographql.apollo.api/MutableExecutionOptions<#A>).com.apollographql.cache.normalized/refetchPolicy(com.apollographql.cache.normalized/FetchPolicy): #A // com.apollographql.cache.normalized/refetchPolicy|refetchPolicy@com.apollographql.apollo.api.MutableExecutionOptions<0:0>(com.apollographql.cache.normalized.FetchPolicy){0§}[0] +final fun <#A: kotlin/Any?> (com.apollographql.apollo.api/MutableExecutionOptions<#A>).com.apollographql.cache.normalized/refetchPolicyInterceptor(com.apollographql.apollo.interceptor/ApolloInterceptor): #A // com.apollographql.cache.normalized/refetchPolicyInterceptor|refetchPolicyInterceptor@com.apollographql.apollo.api.MutableExecutionOptions<0:0>(com.apollographql.apollo.interceptor.ApolloInterceptor){0§}[0] +final fun <#A: kotlin/Any?> (com.apollographql.apollo.api/MutableExecutionOptions<#A>).com.apollographql.cache.normalized/storeExpirationDate(kotlin/Boolean): #A // com.apollographql.cache.normalized/storeExpirationDate|storeExpirationDate@com.apollographql.apollo.api.MutableExecutionOptions<0:0>(kotlin.Boolean){0§}[0] +final fun <#A: kotlin/Any?> (com.apollographql.apollo.api/MutableExecutionOptions<#A>).com.apollographql.cache.normalized/storePartialResponses(kotlin/Boolean): #A // com.apollographql.cache.normalized/storePartialResponses|storePartialResponses@com.apollographql.apollo.api.MutableExecutionOptions<0:0>(kotlin.Boolean){0§}[0] +final fun <#A: kotlin/Any?> (com.apollographql.apollo.api/MutableExecutionOptions<#A>).com.apollographql.cache.normalized/storeReceiveDate(kotlin/Boolean): #A // com.apollographql.cache.normalized/storeReceiveDate|storeReceiveDate@com.apollographql.apollo.api.MutableExecutionOptions<0:0>(kotlin.Boolean){0§}[0] +final fun <#A: kotlin/Any?> (com.apollographql.apollo.api/MutableExecutionOptions<#A>).com.apollographql.cache.normalized/writeToCacheAsynchronously(kotlin/Boolean): #A // com.apollographql.cache.normalized/writeToCacheAsynchronously|writeToCacheAsynchronously@com.apollographql.apollo.api.MutableExecutionOptions<0:0>(kotlin.Boolean){0§}[0] +final fun com.apollographql.cache.normalized/ApolloStore(com.apollographql.cache.normalized.api/NormalizedCacheFactory, com.apollographql.cache.normalized.api/CacheKeyGenerator = ..., com.apollographql.cache.normalized.api/MetadataGenerator = ..., com.apollographql.cache.normalized.api/CacheResolver = ..., com.apollographql.cache.normalized.api/RecordMerger = ..., com.apollographql.cache.normalized.api/FieldKeyGenerator = ..., com.apollographql.cache.normalized.api/EmbeddedFieldsProvider = ...): com.apollographql.cache.normalized/ApolloStore // com.apollographql.cache.normalized/ApolloStore|ApolloStore(com.apollographql.cache.normalized.api.NormalizedCacheFactory;com.apollographql.cache.normalized.api.CacheKeyGenerator;com.apollographql.cache.normalized.api.MetadataGenerator;com.apollographql.cache.normalized.api.CacheResolver;com.apollographql.cache.normalized.api.RecordMerger;com.apollographql.cache.normalized.api.FieldKeyGenerator;com.apollographql.cache.normalized.api.EmbeddedFieldsProvider){}[0] diff --git a/normalized-cache-incubating/src/commonMain/kotlin/com/apollographql/cache/normalized/ApolloStore.kt b/normalized-cache-incubating/src/commonMain/kotlin/com/apollographql/cache/normalized/ApolloStore.kt index 6395e463..2fa5a9f8 100644 --- a/normalized-cache-incubating/src/commonMain/kotlin/com/apollographql/cache/normalized/ApolloStore.kt +++ b/normalized-cache-incubating/src/commonMain/kotlin/com/apollographql/cache/normalized/ApolloStore.kt @@ -1,5 +1,6 @@ package com.apollographql.cache.normalized +import com.apollographql.apollo.api.ApolloResponse import com.apollographql.apollo.api.CustomScalarAdapters import com.apollographql.apollo.api.Executable import com.apollographql.apollo.api.Fragment @@ -56,20 +57,19 @@ interface ApolloStore { /** * Reads an operation from the store. * + * The returned [ApolloResponse.data] has `null` values for any missing fields if their type is nullable, propagating up to their parent + * otherwise. Missing fields have a corresponding [com.apollographql.apollo.api.Error] + * in [ApolloResponse.errors]. + * * This is a synchronous operation that might block if the underlying cache is doing IO. * * @param operation the operation to read - * - * @throws [com.apollographql.apollo.exception.CacheMissException] on cache miss - * @throws [com.apollographql.apollo.exception.ApolloException] on other cache read errors - * - * @return the operation data with optional headers from the [NormalizedCache] */ fun readOperation( operation: Operation, customScalarAdapters: CustomScalarAdapters = CustomScalarAdapters.Empty, cacheHeaders: CacheHeaders = CacheHeaders.NONE, - ): ReadResult + ): ApolloResponse /** * Reads a fragment from the store. diff --git a/normalized-cache-incubating/src/commonMain/kotlin/com/apollographql/cache/normalized/CacheMissLoggingInterceptor.kt b/normalized-cache-incubating/src/commonMain/kotlin/com/apollographql/cache/normalized/CacheMissLoggingInterceptor.kt index 91eea381..7e26207f 100644 --- a/normalized-cache-incubating/src/commonMain/kotlin/com/apollographql/cache/normalized/CacheMissLoggingInterceptor.kt +++ b/normalized-cache-incubating/src/commonMain/kotlin/com/apollographql/cache/normalized/CacheMissLoggingInterceptor.kt @@ -12,8 +12,8 @@ import kotlinx.coroutines.flow.onEach class CacheMissLoggingInterceptor(private val log: (String) -> Unit) : ApolloInterceptor { override fun intercept(request: ApolloRequest, chain: ApolloInterceptorChain): Flow> { return chain.proceed(request).onEach { - if (it.exception is CacheMissException) { - log(it.exception!!.message.toString()) + it.errors.orEmpty().mapNotNull { it.extensions?.get("exception") as? CacheMissException }.forEach { + log(it.message.toString()) } } } diff --git a/normalized-cache-incubating/src/commonMain/kotlin/com/apollographql/cache/normalized/ClientCacheExtensions.kt b/normalized-cache-incubating/src/commonMain/kotlin/com/apollographql/cache/normalized/ClientCacheExtensions.kt index 2dbb1850..b23a6ddc 100644 --- a/normalized-cache-incubating/src/commonMain/kotlin/com/apollographql/cache/normalized/ClientCacheExtensions.kt +++ b/normalized-cache-incubating/src/commonMain/kotlin/com/apollographql/cache/normalized/ClientCacheExtensions.kt @@ -405,19 +405,36 @@ internal val ExecutionOptions.cacheHeaders: CacheHeaders internal val ApolloRequest.watchContext: WatchContext? get() = executionContext[WatchContext] -/** - * @param isCacheHit true if this was a cache hit - * @param cacheMissException the exception while reading the cache. Note that it's possible to have [isCacheHit] == false && [cacheMissException] == null - * if no cache read was attempted - */ class CacheInfo private constructor( val cacheStartMillis: Long, val cacheEndMillis: Long, val networkStartMillis: Long, val networkEndMillis: Long, + + /** + * True if the response is from the cache, false if it's from the network. + */ + val isFromCache: Boolean, + + /** + * True if **all** the fields are found in the cache, false for full or partial cache misses. + */ val isCacheHit: Boolean, + + /** + * The exception that occurred while reading the cache. + */ val cacheMissException: CacheMissException?, + + /** + * The exception that occurred while reading the network. + */ val networkException: ApolloException?, + + /** + * True if at least one field in the response is stale. + * Always `false` if [isFromCache] is false. + */ val isStale: Boolean, ) : ExecutionContext.Element { override val key: ExecutionContext.Key<*> @@ -430,6 +447,7 @@ class CacheInfo private constructor( .cacheEndMillis(cacheEndMillis) .networkStartMillis(networkStartMillis) .networkEndMillis(networkEndMillis) + .fromCache(isFromCache) .cacheHit(isCacheHit) .cacheMissException(cacheMissException) .networkException(networkException) @@ -441,6 +459,7 @@ class CacheInfo private constructor( private var cacheEndMillis: Long = 0 private var networkStartMillis: Long = 0 private var networkEndMillis: Long = 0 + private var fromCache: Boolean = false private var cacheHit: Boolean = false private var cacheMissException: CacheMissException? = null private var networkException: ApolloException? = null @@ -462,6 +481,10 @@ class CacheInfo private constructor( this.networkEndMillis = networkEndMillis } + fun fromCache(fromCache: Boolean) = apply { + this.fromCache = fromCache + } + fun cacheHit(cacheHit: Boolean) = apply { this.cacheHit = cacheHit } @@ -483,6 +506,7 @@ class CacheInfo private constructor( cacheEndMillis = cacheEndMillis, networkStartMillis = networkStartMillis, networkEndMillis = networkEndMillis, + isFromCache = fromCache, isCacheHit = cacheHit, cacheMissException = cacheMissException, networkException = networkException, @@ -499,7 +523,7 @@ class CacheInfo private constructor( */ val ApolloResponse.isFromCache: Boolean get() { - return cacheInfo?.isCacheHit == true || exception is CacheMissException + return cacheInfo?.isFromCache == true } val ApolloResponse.cacheInfo @@ -559,7 +583,6 @@ internal class StoreExpirationDateContext(val value: Boolean) : ExecutionContext companion object Key : ExecutionContext.Key } - internal class WriteToCacheAsynchronouslyContext(val value: Boolean) : ExecutionContext.Element { override val key: ExecutionContext.Key<*> get() = Key @@ -597,11 +620,11 @@ internal class FetchFromCacheContext(val value: Boolean) : ExecutionContext.Elem companion object Key : ExecutionContext.Key } -internal fun ApolloRequest.Builder.fetchFromCache(fetchFromCache: Boolean) = apply { +fun ApolloRequest.Builder.fetchFromCache(fetchFromCache: Boolean) = apply { addExecutionContext(FetchFromCacheContext(fetchFromCache)) } -internal val ApolloRequest.fetchFromCache +val ApolloRequest.fetchFromCache get() = executionContext[FetchFromCacheContext]?.value ?: false fun ApolloResponse.Builder.cacheHeaders(cacheHeaders: CacheHeaders) = diff --git a/normalized-cache-incubating/src/commonMain/kotlin/com/apollographql/cache/normalized/FetchPolicy.kt b/normalized-cache-incubating/src/commonMain/kotlin/com/apollographql/cache/normalized/FetchPolicy.kt index 385c0f3e..ca7ec39f 100644 --- a/normalized-cache-incubating/src/commonMain/kotlin/com/apollographql/cache/normalized/FetchPolicy.kt +++ b/normalized-cache-incubating/src/commonMain/kotlin/com/apollographql/cache/normalized/FetchPolicy.kt @@ -1,11 +1,15 @@ package com.apollographql.cache.normalized +import com.apollographql.apollo.api.ApolloResponse +import com.apollographql.apollo.exception.ApolloException + enum class FetchPolicy { /** * Try the cache, if that failed, try the network. * * This [FetchPolicy] emits one or more [ApolloResponse]s. - * Cache misses and network errors have [ApolloResponse.exception] set to a non-null [ApolloException] + * Cache misses have [ApolloResponse.errors] set to a non-empty list. + * Network errors have [ApolloResponse.exception] set to a non-null [ApolloException]. * * This is the default behaviour. */ @@ -15,7 +19,7 @@ enum class FetchPolicy { * Only try the cache. * * This [FetchPolicy] emits one [ApolloResponse]. - * Cache misses have [ApolloResponse.exception] set to a non-null [ApolloException] + * Cache misses have [ApolloResponse.errors] set to a non-empty list. */ CacheOnly, @@ -23,7 +27,8 @@ enum class FetchPolicy { * Try the network, if that failed, try the cache. * * This [FetchPolicy] emits one or more [ApolloResponse]s. - * Cache misses and network errors have [ApolloResponse.exception] set to a non-null [ApolloException] + * Network errors have [ApolloResponse.exception] set to a non-null [ApolloException]. + * Cache misses have [ApolloResponse.errors] set to a non-empty list. */ NetworkFirst, @@ -32,7 +37,7 @@ enum class FetchPolicy { * * This [FetchPolicy] emits one or more [ApolloResponse]s. Several [ApolloResponse]s * may be emitted if your [NetworkTransport] supports it, for example with `@defer`. - * Network errors have [ApolloResponse.exception] set to a non-null [ApolloException] + * Network errors have [ApolloResponse.exception] set to a non-null [ApolloException]. */ NetworkOnly, @@ -40,7 +45,8 @@ enum class FetchPolicy { * Try the cache, then also try the network. * * This [FetchPolicy] emits two or more [ApolloResponse]s. - * Cache misses and network errors have [ApolloResponse.exception] set to a non-null [ApolloException] + * Cache misses have [ApolloResponse.errors] set to a non-empty list. + * Network errors have [ApolloResponse.exception] set to a non-null [ApolloException]. */ CacheAndNetwork, } diff --git a/normalized-cache-incubating/src/commonMain/kotlin/com/apollographql/cache/normalized/FetchPolicyInterceptors.kt b/normalized-cache-incubating/src/commonMain/kotlin/com/apollographql/cache/normalized/FetchPolicyInterceptors.kt index 227e772e..ad7dff93 100644 --- a/normalized-cache-incubating/src/commonMain/kotlin/com/apollographql/cache/normalized/FetchPolicyInterceptors.kt +++ b/normalized-cache-incubating/src/commonMain/kotlin/com/apollographql/cache/normalized/FetchPolicyInterceptors.kt @@ -32,7 +32,7 @@ val CacheOnlyInterceptor = object : ApolloInterceptor { .newBuilder() .fetchFromCache(true) .build() - ) + ).map { it.cacheMissAsException() } } } @@ -56,7 +56,7 @@ val CacheFirstInterceptor = object : ApolloInterceptor { .newBuilder() .fetchFromCache(true) .build() - ).single() + ).single().cacheMissAsException() emit(cacheResponse.newBuilder().isLast(cacheResponse.exception == null).build()) if (cacheResponse.exception == null) { return@flow @@ -102,7 +102,7 @@ val NetworkFirstInterceptor = object : ApolloInterceptor { .newBuilder() .fetchFromCache(true) .build() - ).single() + ).single().cacheMissAsException() emit(cacheResponse) } } @@ -119,7 +119,7 @@ val CacheAndNetworkInterceptor = object : ApolloInterceptor { .newBuilder() .fetchFromCache(true) .build() - ).single() + ).single().cacheMissAsException() emit(cacheResponse.newBuilder().isLast(false).build()) @@ -129,6 +129,21 @@ val CacheAndNetworkInterceptor = object : ApolloInterceptor { } } +private fun ApolloResponse.cacheMissAsException(): ApolloResponse { + return if (cacheInfo!!.isCacheHit) { + this + } else { + val cacheMissException = errors.orEmpty().mapNotNull { it.extensions?.get("exception") as? ApolloException }.reduceOrNull { acc, e -> + acc.addSuppressed(e) + acc + } + newBuilder() + .exception(cacheMissException) + .data(null) + .build() + } +} + internal object FetchPolicyRouterInterceptor : ApolloInterceptor, ApolloStoreInterceptor { override fun intercept(request: ApolloRequest, chain: ApolloInterceptorChain): Flow> { if (request.operation !is Query) { diff --git a/normalized-cache-incubating/src/commonMain/kotlin/com/apollographql/cache/normalized/api/OperationCacheExtensions.kt b/normalized-cache-incubating/src/commonMain/kotlin/com/apollographql/cache/normalized/api/OperationCacheExtensions.kt index 6741e464..47e1ad28 100644 --- a/normalized-cache-incubating/src/commonMain/kotlin/com/apollographql/cache/normalized/api/OperationCacheExtensions.kt +++ b/normalized-cache-incubating/src/commonMain/kotlin/com/apollographql/cache/normalized/api/OperationCacheExtensions.kt @@ -53,6 +53,7 @@ fun Executable.readDataFromCache( cacheHeaders = cacheHeaders, variables = variables, fieldKeyGenerator = fieldKeyGenerator, + returnPartialResponses = false, ).toData(adapter(), customScalarAdapters, variables) } @@ -73,6 +74,7 @@ fun Executable.readDataFromCache( cacheHeaders = cacheHeaders, variables = variables, fieldKeyGenerator = fieldKeyGenerator, + returnPartialResponses = false, ).toData(adapter(), customScalarAdapters, variables) } @@ -83,6 +85,7 @@ internal fun Executable.readDataFromCacheInternal( cacheHeaders: CacheHeaders, variables: Executable.Variables, fieldKeyGenerator: FieldKeyGenerator, + returnPartialResponses: Boolean, ): CacheBatchReaderData = readInternal( cacheKey = cacheKey, cache = cache, @@ -90,6 +93,7 @@ internal fun Executable.readDataFromCacheInternal( cacheHeaders = cacheHeaders, variables = variables, fieldKeyGenerator = fieldKeyGenerator, + returnPartialResponses = returnPartialResponses, ) @@ -100,6 +104,7 @@ private fun Executable.readInternal( cacheHeaders: CacheHeaders, variables: Executable.Variables, fieldKeyGenerator: FieldKeyGenerator, + returnPartialResponses: Boolean, ): CacheBatchReaderData { return CacheBatchReader( cache = cache, @@ -110,6 +115,7 @@ private fun Executable.readInternal( rootSelections = rootField().selections, rootField = rootField(), fieldKeyGenerator = fieldKeyGenerator, + returnPartialResponses = returnPartialResponses, ).collectData() } diff --git a/normalized-cache-incubating/src/commonMain/kotlin/com/apollographql/cache/normalized/internal/ApolloCacheInterceptor.kt b/normalized-cache-incubating/src/commonMain/kotlin/com/apollographql/cache/normalized/internal/ApolloCacheInterceptor.kt index 531a6197..004d87b5 100644 --- a/normalized-cache-incubating/src/commonMain/kotlin/com/apollographql/cache/normalized/internal/ApolloCacheInterceptor.kt +++ b/normalized-cache-incubating/src/commonMain/kotlin/com/apollographql/cache/normalized/internal/ApolloCacheInterceptor.kt @@ -9,7 +9,6 @@ import com.apollographql.apollo.api.Operation import com.apollographql.apollo.api.Query import com.apollographql.apollo.api.Subscription import com.apollographql.apollo.exception.ApolloException -import com.apollographql.apollo.exception.CacheMissException import com.apollographql.apollo.exception.DefaultApolloException import com.apollographql.apollo.exception.apolloExceptionHandler import com.apollographql.apollo.interceptor.ApolloInterceptor @@ -205,59 +204,29 @@ internal class ApolloCacheInterceptor( request: ApolloRequest, customScalarAdapters: CustomScalarAdapters, ): ApolloResponse { - val operation = request.operation - val startMillis = currentTimeMillis() - - val readResult = try { - var cacheHeaders = request.cacheHeaders - if (request.memoryCacheOnly) { - cacheHeaders += CacheHeaders.Builder().addHeader(ApolloCacheHeaders.MEMORY_CACHE_ONLY, "true").build() - } - store.readOperation( - operation = operation, - customScalarAdapters = customScalarAdapters, - cacheHeaders = cacheHeaders, - ) - } catch (e: CacheMissException) { - return ApolloResponse.Builder( - requestUuid = request.requestUuid, - operation = operation, - ) - .exception(e) - .addExecutionContext(request.executionContext) - .cacheInfo( - CacheInfo.Builder() - .cacheStartMillis(startMillis) - .cacheEndMillis(currentTimeMillis()) - .cacheHit(false) - .cacheMissException(e) - .stale(e.stale) - .build() - ) - .isLast(true) - .build() + var cacheHeaders = request.cacheHeaders + if (request.memoryCacheOnly) { + cacheHeaders += CacheHeaders.Builder().addHeader(ApolloCacheHeaders.MEMORY_CACHE_ONLY, "true").build() } - - return ApolloResponse.Builder( - requestUuid = request.requestUuid, - operation = operation, + val startMillis = currentTimeMillis() + val response = store.readOperation( + operation = request.operation, + customScalarAdapters = customScalarAdapters, + cacheHeaders = cacheHeaders, ) - .data(readResult.data) + return response.newBuilder() + .requestUuid(request.requestUuid) .addExecutionContext(request.executionContext) - .cacheHeaders(readResult.cacheHeaders) .cacheInfo( - CacheInfo.Builder() + response.cacheInfo!!.newBuilder() .cacheStartMillis(startMillis) .cacheEndMillis(currentTimeMillis()) - .cacheHit(true) - .stale(readResult.cacheHeaders.headerValue(ApolloCacheHeaders.STALE) == "true") .build() ) .isLast(true) .build() } - private fun readFromNetwork( request: ApolloRequest, chain: ApolloInterceptorChain, diff --git a/normalized-cache-incubating/src/commonMain/kotlin/com/apollographql/cache/normalized/internal/CacheBatchReader.kt b/normalized-cache-incubating/src/commonMain/kotlin/com/apollographql/cache/normalized/internal/CacheBatchReader.kt index 3e239af8..536974fa 100644 --- a/normalized-cache-incubating/src/commonMain/kotlin/com/apollographql/cache/normalized/internal/CacheBatchReader.kt +++ b/normalized-cache-incubating/src/commonMain/kotlin/com/apollographql/cache/normalized/internal/CacheBatchReader.kt @@ -5,6 +5,7 @@ import com.apollographql.apollo.api.CompiledField import com.apollographql.apollo.api.CompiledFragment import com.apollographql.apollo.api.CompiledSelection import com.apollographql.apollo.api.CustomScalarAdapters +import com.apollographql.apollo.api.Error import com.apollographql.apollo.api.Executable import com.apollographql.apollo.api.json.MapJsonReader import com.apollographql.apollo.exception.CacheMissException @@ -31,6 +32,7 @@ internal class CacheBatchReader( private val rootSelections: List, private val rootField: CompiledField, private val fieldKeyGenerator: FieldKeyGenerator, + private val returnPartialResponses: Boolean, ) { /** * @param key: the key of the record we need to fetch @@ -45,10 +47,11 @@ internal class CacheBatchReader( ) /** - * The objects read from the cache with only the fields that are selected and maybe some values changed - * The key is the path to the object + * The objects read from the cache, as a `Map` with only the fields that are selected and maybe some values changed. + * Can also be an [Error] in case of a cache miss. + * The key is the path to the object. */ - private val data = mutableMapOf, Map>() + private val data = mutableMapOf, Any>() /** * True if at least one of the resolved fields is stale @@ -61,9 +64,6 @@ internal class CacheBatchReader( val fields = mutableListOf() } - /** - * - */ private fun collect(selections: List, parentType: String, typename: String?, state: CollectState) { selections.forEach { compiledSelection -> when (compiledSelection) { @@ -116,7 +116,13 @@ internal class CacheBatchReader( // This happens the very first time we read the cache record = Record(pendingReference.key, emptyMap()) } else { - throw CacheMissException(pendingReference.key) + if (returnPartialResponses) { + data[pendingReference.path] = + cacheMissError(CacheMissException(key = pendingReference.key, fieldName = null, stale = false), path = pendingReference.path) + return@forEach + } else { + throw CacheMissException(pendingReference.key) + } } } @@ -128,18 +134,27 @@ internal class CacheBatchReader( return@mapNotNull null } - val value = cacheResolver.resolveField( - ResolverContext( - field = it, - variables = variables, - parent = record, - parentKey = record.key, - parentType = pendingReference.parentType, - cacheHeaders = cacheHeaders, - fieldKeyGenerator = fieldKeyGenerator, - path = pendingReference.fieldPath + it, - ) - ).unwrap() + val value = try { + cacheResolver.resolveField( + ResolverContext( + field = it, + variables = variables, + parent = record, + parentKey = record.key, + parentType = pendingReference.parentType, + cacheHeaders = cacheHeaders, + fieldKeyGenerator = fieldKeyGenerator, + path = pendingReference.fieldPath + it, + ) + ).unwrap() + } catch (e: CacheMissException) { + if (e.stale) isStale = true + if (returnPartialResponses) { + cacheMissError(e, pendingReference.path + it.responseName) + } else { + throw e + } + } value.registerCacheKeys(pendingReference.path + it.responseName, pendingReference.fieldPath + it, it.selections, it.type.rawType().name) it.responseName to value @@ -204,18 +219,27 @@ internal class CacheBatchReader( return@mapNotNull null } - val value = cacheResolver.resolveField( - ResolverContext( - field = it, - variables = variables, - parent = this, - parentKey = "", - parentType = parentType, - cacheHeaders = cacheHeaders, - fieldKeyGenerator = fieldKeyGenerator, - path = fieldPath + it, - ) - ).unwrap() + val value = try { + cacheResolver.resolveField( + ResolverContext( + field = it, + variables = variables, + parent = this, + parentKey = "", + parentType = parentType, + cacheHeaders = cacheHeaders, + fieldKeyGenerator = fieldKeyGenerator, + path = fieldPath + it, + ) + ).unwrap() + } catch (e: CacheMissException) { + if (e.stale) isStale = true + if (returnPartialResponses) { + cacheMissError(e, path + it.responseName) + } else { + throw e + } + } value.registerCacheKeys(path + it.responseName, fieldPath + it, it.selections, it.type.rawType().name) } } @@ -223,7 +247,7 @@ internal class CacheBatchReader( } internal class CacheBatchReaderData( - private val data: Map, Map>, + private val data: Map, Any>, val cacheHeaders: CacheHeaders, ) { fun toData( @@ -239,7 +263,7 @@ internal class CacheBatchReader( } @Suppress("UNCHECKED_CAST") - private fun toMap(): Map { + internal fun toMap(): Map { return data[emptyList()].replaceCacheKeys(emptyList()) as Map } @@ -263,10 +287,26 @@ internal class CacheBatchReader( } else -> { - // Scalar value + // Scalar value or CacheMissException this } } } } + + private fun cacheMissError(exception: CacheMissException, path: List): Error { + val message = if (exception.fieldName == null) { + "Object '${exception.key}' not found in the cache" + } else { + if (exception.stale) { + "Field '${exception.key}' on object '${exception.fieldName}' is stale in the cache" + } else { + "Object '${exception.key}' has no field named '${exception.fieldName}' in the cache" + } + } + return Error.Builder(message) + .path(path = path) + .putExtension("exception", exception) + .build() + } } diff --git a/normalized-cache-incubating/src/commonMain/kotlin/com/apollographql/cache/normalized/internal/DefaultApolloStore.kt b/normalized-cache-incubating/src/commonMain/kotlin/com/apollographql/cache/normalized/internal/DefaultApolloStore.kt index 2c4a8981..9babb59d 100644 --- a/normalized-cache-incubating/src/commonMain/kotlin/com/apollographql/cache/normalized/internal/DefaultApolloStore.kt +++ b/normalized-cache-incubating/src/commonMain/kotlin/com/apollographql/cache/normalized/internal/DefaultApolloStore.kt @@ -1,11 +1,21 @@ package com.apollographql.cache.normalized.internal +import com.apollographql.apollo.api.ApolloResponse +import com.apollographql.apollo.api.CompiledField +import com.apollographql.apollo.api.CompiledFragment +import com.apollographql.apollo.api.CompiledListType +import com.apollographql.apollo.api.CompiledNotNullType +import com.apollographql.apollo.api.CompiledSelection import com.apollographql.apollo.api.CustomScalarAdapters +import com.apollographql.apollo.api.Error import com.apollographql.apollo.api.Fragment import com.apollographql.apollo.api.Operation +import com.apollographql.apollo.api.json.jsonReader import com.apollographql.apollo.api.variables import com.apollographql.cache.normalized.ApolloStore import com.apollographql.cache.normalized.ApolloStore.ReadResult +import com.apollographql.cache.normalized.CacheInfo +import com.apollographql.cache.normalized.api.ApolloCacheHeaders import com.apollographql.cache.normalized.api.CacheHeaders import com.apollographql.cache.normalized.api.CacheKey import com.apollographql.cache.normalized.api.CacheKeyGenerator @@ -19,7 +29,10 @@ import com.apollographql.cache.normalized.api.Record import com.apollographql.cache.normalized.api.RecordMerger import com.apollographql.cache.normalized.api.normalize import com.apollographql.cache.normalized.api.readDataFromCacheInternal +import com.apollographql.cache.normalized.cacheHeaders +import com.apollographql.cache.normalized.cacheInfo import com.benasher44.uuid.Uuid +import com.benasher44.uuid.uuid4 import kotlinx.coroutines.channels.BufferOverflow import kotlinx.coroutines.flow.MutableSharedFlow import kotlinx.coroutines.flow.asSharedFlow @@ -109,7 +122,7 @@ internal class DefaultApolloStore( operation: Operation, customScalarAdapters: CustomScalarAdapters, cacheHeaders: CacheHeaders, - ): ReadResult { + ): ApolloResponse { val variables = operation.variables(customScalarAdapters, true) val batchReaderData = operation.readDataFromCacheInternal( cache = cache, @@ -118,11 +131,123 @@ internal class DefaultApolloStore( cacheKey = CacheKey.rootKey(), variables = variables, fieldKeyGenerator = fieldKeyGenerator, + returnPartialResponses = true, ) - return ReadResult( - data = batchReaderData.toData(operation.adapter(), customScalarAdapters, variables), - cacheHeaders = batchReaderData.cacheHeaders, - ) + val dataWithErrors: Map = batchReaderData.toMap() + val errors = mutableListOf() + + @Suppress("UNCHECKED_CAST") + val dataWithNulls: Map? = propagateErrors(dataWithErrors, operation.rootField(), errors) as Map? + val falseVariablesCustomScalarAdapter = + customScalarAdapters.newBuilder().falseVariables(variables.valueMap.filter { it.value == false }.keys).build() + val data = dataWithNulls?.let { operation.adapter().fromJson(it.jsonReader(), falseVariablesCustomScalarAdapter) } + return ApolloResponse.Builder(operation, uuid4()) + .data(data) + .errors(errors.takeIf { it.isNotEmpty() }) + .cacheHeaders(batchReaderData.cacheHeaders) + .cacheInfo( + CacheInfo.Builder() + .fromCache(true) + .cacheHit(errors.isEmpty()) + .stale(batchReaderData.cacheHeaders.headerValue(ApolloCacheHeaders.STALE) == "true") + .build() + ) + .build() + } + + /** + * If a position contains an Error, replace it by a null if the field's type is nullable, propagate the error if not. + */ + private fun propagateErrors(dataWithErrors: Any?, field: CompiledField, errors: MutableList): Any? { + return when (dataWithErrors) { + is Map<*, *> -> { + if (field.selections.isEmpty()) { + // This is a scalar represented as a Map. + return dataWithErrors + } + @Suppress("UNCHECKED_CAST") + dataWithErrors as Map + dataWithErrors.mapValues { (key, value) -> + val selection = field.fieldSelection(key) + ?: // Should never happen + return@mapValues value + when (value) { + is Error -> { + errors.add(value) + if (selection.type is CompiledNotNullType) { + return null + } + null + } + + else -> { + propagateErrors(value, selection, errors).also { + if (it == null && selection.type is CompiledNotNullType) { + return null + } + } + } + } + } + } + + is List<*> -> { + val listType = if (field.type is CompiledNotNullType) { + (field.type as CompiledNotNullType).ofType + } else { + field.type + } + if (listType !is CompiledListType) { + // This is a scalar represented as a List. + return dataWithErrors + } + dataWithErrors.map { value -> + val elementType = listType.ofType + when (value) { + is Error -> { + errors.add(value) + if (elementType is CompiledNotNullType) { + return null + } + null + } + + else -> { + propagateErrors(value, field, errors).also { + if (it == null && elementType is CompiledNotNullType) { + return null + } + } + } + } + } + } + + else -> { + dataWithErrors + } + } + } + + private fun CompiledSelection.fieldSelection(responseName: String): CompiledField? { + fun CompiledSelection.fieldSelections(): List { + return when (this) { + is CompiledField -> selections.filterIsInstance() + selections.filterIsInstance() + .flatMap { it.fieldSelections() } + + is CompiledFragment -> selections.filterIsInstance() + selections.filterIsInstance() + .flatMap { it.fieldSelections() } + } + } + // Fields can be selected multiple times, combine the selections + return fieldSelections().filter { it.responseName == responseName }.reduceOrNull { acc, compiledField -> + CompiledField.Builder( + name = acc.name, + type = acc.type, + ) + .selections(acc.selections + compiledField.selections) + .build() + } } override fun readFragment( @@ -140,6 +265,7 @@ internal class DefaultApolloStore( cacheKey = cacheKey, variables = variables, fieldKeyGenerator = fieldKeyGenerator, + returnPartialResponses = false, ) return ReadResult( data = batchReaderData.toData(fragment.adapter(), customScalarAdapters, variables), diff --git a/normalized-cache-sqlite-incubating/api/normalized-cache-sqlite-incubating.klib.api b/normalized-cache-sqlite-incubating/api/normalized-cache-sqlite-incubating.klib.api index 179691a8..25be1d66 100644 --- a/normalized-cache-sqlite-incubating/api/normalized-cache-sqlite-incubating.klib.api +++ b/normalized-cache-sqlite-incubating/api/normalized-cache-sqlite-incubating.klib.api @@ -9,23 +9,30 @@ abstract interface com.apollographql.cache.normalized.sql.internal.blob/BlobDatabase : app.cash.sqldelight/Transacter { // com.apollographql.cache.normalized.sql.internal.blob/BlobDatabase|null[0] abstract val blobQueries // com.apollographql.cache.normalized.sql.internal.blob/BlobDatabase.blobQueries|{}blobQueries[0] abstract fun (): com.apollographql.cache.normalized.sql.internal.blob/BlobQueries // com.apollographql.cache.normalized.sql.internal.blob/BlobDatabase.blobQueries.|(){}[0] + final object Companion { // com.apollographql.cache.normalized.sql.internal.blob/BlobDatabase.Companion|null[0] - final fun invoke(app.cash.sqldelight.db/SqlDriver): com.apollographql.cache.normalized.sql.internal.blob/BlobDatabase // com.apollographql.cache.normalized.sql.internal.blob/BlobDatabase.Companion.invoke|invoke(app.cash.sqldelight.db.SqlDriver){}[0] final val Schema // com.apollographql.cache.normalized.sql.internal.blob/BlobDatabase.Companion.Schema|{}Schema[0] final fun (): app.cash.sqldelight.db/SqlSchema> // com.apollographql.cache.normalized.sql.internal.blob/BlobDatabase.Companion.Schema.|(){}[0] + + final fun invoke(app.cash.sqldelight.db/SqlDriver): com.apollographql.cache.normalized.sql.internal.blob/BlobDatabase // com.apollographql.cache.normalized.sql.internal.blob/BlobDatabase.Companion.invoke|invoke(app.cash.sqldelight.db.SqlDriver){}[0] } } + abstract interface com.apollographql.cache.normalized.sql.internal.blob2/Blob2Database : app.cash.sqldelight/Transacter { // com.apollographql.cache.normalized.sql.internal.blob2/Blob2Database|null[0] abstract val blob2Queries // com.apollographql.cache.normalized.sql.internal.blob2/Blob2Database.blob2Queries|{}blob2Queries[0] abstract fun (): com.apollographql.cache.normalized.sql.internal.blob2/Blob2Queries // com.apollographql.cache.normalized.sql.internal.blob2/Blob2Database.blob2Queries.|(){}[0] + final object Companion { // com.apollographql.cache.normalized.sql.internal.blob2/Blob2Database.Companion|null[0] - final fun invoke(app.cash.sqldelight.db/SqlDriver): com.apollographql.cache.normalized.sql.internal.blob2/Blob2Database // com.apollographql.cache.normalized.sql.internal.blob2/Blob2Database.Companion.invoke|invoke(app.cash.sqldelight.db.SqlDriver){}[0] final val Schema // com.apollographql.cache.normalized.sql.internal.blob2/Blob2Database.Companion.Schema|{}Schema[0] final fun (): app.cash.sqldelight.db/SqlSchema> // com.apollographql.cache.normalized.sql.internal.blob2/Blob2Database.Companion.Schema.|(){}[0] + + final fun invoke(app.cash.sqldelight.db/SqlDriver): com.apollographql.cache.normalized.sql.internal.blob2/Blob2Database // com.apollographql.cache.normalized.sql.internal.blob2/Blob2Database.Companion.invoke|invoke(app.cash.sqldelight.db.SqlDriver){}[0] } } + final class com.apollographql.cache.normalized.sql.internal.blob/BlobQueries : app.cash.sqldelight/TransacterImpl { // com.apollographql.cache.normalized.sql.internal.blob/BlobQueries|null[0] constructor (app.cash.sqldelight.db/SqlDriver) // com.apollographql.cache.normalized.sql.internal.blob/BlobQueries.|(app.cash.sqldelight.db.SqlDriver){}[0] + final fun <#A1: kotlin/Any> recordForKey(kotlin/String, kotlin/Function2): app.cash.sqldelight/Query<#A1> // com.apollographql.cache.normalized.sql.internal.blob/BlobQueries.recordForKey|recordForKey(kotlin.String;kotlin.Function2){0§}[0] final fun <#A1: kotlin/Any> recordsForKeys(kotlin.collections/Collection, kotlin/Function2): app.cash.sqldelight/Query<#A1> // com.apollographql.cache.normalized.sql.internal.blob/BlobQueries.recordsForKeys|recordsForKeys(kotlin.collections.Collection;kotlin.Function2){0§}[0] final fun <#A1: kotlin/Any> selectRecords(kotlin/Function2): app.cash.sqldelight/Query<#A1> // com.apollographql.cache.normalized.sql.internal.blob/BlobQueries.selectRecords|selectRecords(kotlin.Function2){0§}[0] @@ -40,21 +47,26 @@ final class com.apollographql.cache.normalized.sql.internal.blob/BlobQueries : a final fun selectRecords(): app.cash.sqldelight/Query // com.apollographql.cache.normalized.sql.internal.blob/BlobQueries.selectRecords|selectRecords(){}[0] final fun update(kotlin/ByteArray, kotlin/String) // com.apollographql.cache.normalized.sql.internal.blob/BlobQueries.update|update(kotlin.ByteArray;kotlin.String){}[0] } + final class com.apollographql.cache.normalized.sql.internal.blob/Blobs { // com.apollographql.cache.normalized.sql.internal.blob/Blobs|null[0] constructor (kotlin/String, kotlin/ByteArray) // com.apollographql.cache.normalized.sql.internal.blob/Blobs.|(kotlin.String;kotlin.ByteArray){}[0] + + final val blob // com.apollographql.cache.normalized.sql.internal.blob/Blobs.blob|{}blob[0] + final fun (): kotlin/ByteArray // com.apollographql.cache.normalized.sql.internal.blob/Blobs.blob.|(){}[0] + final val key // com.apollographql.cache.normalized.sql.internal.blob/Blobs.key|{}key[0] + final fun (): kotlin/String // com.apollographql.cache.normalized.sql.internal.blob/Blobs.key.|(){}[0] + final fun component1(): kotlin/String // com.apollographql.cache.normalized.sql.internal.blob/Blobs.component1|component1(){}[0] final fun component2(): kotlin/ByteArray // com.apollographql.cache.normalized.sql.internal.blob/Blobs.component2|component2(){}[0] final fun copy(kotlin/String = ..., kotlin/ByteArray = ...): com.apollographql.cache.normalized.sql.internal.blob/Blobs // com.apollographql.cache.normalized.sql.internal.blob/Blobs.copy|copy(kotlin.String;kotlin.ByteArray){}[0] final fun equals(kotlin/Any?): kotlin/Boolean // com.apollographql.cache.normalized.sql.internal.blob/Blobs.equals|equals(kotlin.Any?){}[0] final fun hashCode(): kotlin/Int // com.apollographql.cache.normalized.sql.internal.blob/Blobs.hashCode|hashCode(){}[0] final fun toString(): kotlin/String // com.apollographql.cache.normalized.sql.internal.blob/Blobs.toString|toString(){}[0] - final val blob // com.apollographql.cache.normalized.sql.internal.blob/Blobs.blob|{}blob[0] - final fun (): kotlin/ByteArray // com.apollographql.cache.normalized.sql.internal.blob/Blobs.blob.|(){}[0] - final val key // com.apollographql.cache.normalized.sql.internal.blob/Blobs.key|{}key[0] - final fun (): kotlin/String // com.apollographql.cache.normalized.sql.internal.blob/Blobs.key.|(){}[0] } + final class com.apollographql.cache.normalized.sql.internal.blob2/Blob2Queries : app.cash.sqldelight/TransacterImpl { // com.apollographql.cache.normalized.sql.internal.blob2/Blob2Queries|null[0] constructor (app.cash.sqldelight.db/SqlDriver) // com.apollographql.cache.normalized.sql.internal.blob2/Blob2Queries.|(app.cash.sqldelight.db.SqlDriver){}[0] + final fun <#A1: kotlin/Any> recordForKey(kotlin/String, kotlin/Function2): app.cash.sqldelight/Query<#A1> // com.apollographql.cache.normalized.sql.internal.blob2/Blob2Queries.recordForKey|recordForKey(kotlin.String;kotlin.Function2){0§}[0] final fun <#A1: kotlin/Any> recordsForKeys(kotlin.collections/Collection, kotlin/Function2): app.cash.sqldelight/Query<#A1> // com.apollographql.cache.normalized.sql.internal.blob2/Blob2Queries.recordsForKeys|recordsForKeys(kotlin.collections.Collection;kotlin.Function2){0§}[0] final fun <#A1: kotlin/Any> selectRecords(kotlin/Function3): app.cash.sqldelight/Query<#A1> // com.apollographql.cache.normalized.sql.internal.blob2/Blob2Queries.selectRecords|selectRecords(kotlin.Function3){0§}[0] @@ -71,8 +83,17 @@ final class com.apollographql.cache.normalized.sql.internal.blob2/Blob2Queries : final fun trim(kotlin/Long) // com.apollographql.cache.normalized.sql.internal.blob2/Blob2Queries.trim|trim(kotlin.Long){}[0] final fun update(kotlin/ByteArray, kotlin/Long?, kotlin/String) // com.apollographql.cache.normalized.sql.internal.blob2/Blob2Queries.update|update(kotlin.ByteArray;kotlin.Long?;kotlin.String){}[0] } + final class com.apollographql.cache.normalized.sql.internal.blob2/Blobs { // com.apollographql.cache.normalized.sql.internal.blob2/Blobs|null[0] constructor (kotlin/String, kotlin/ByteArray, kotlin/Long?) // com.apollographql.cache.normalized.sql.internal.blob2/Blobs.|(kotlin.String;kotlin.ByteArray;kotlin.Long?){}[0] + + final val blob // com.apollographql.cache.normalized.sql.internal.blob2/Blobs.blob|{}blob[0] + final fun (): kotlin/ByteArray // com.apollographql.cache.normalized.sql.internal.blob2/Blobs.blob.|(){}[0] + final val date // com.apollographql.cache.normalized.sql.internal.blob2/Blobs.date|{}date[0] + final fun (): kotlin/Long? // com.apollographql.cache.normalized.sql.internal.blob2/Blobs.date.|(){}[0] + final val key // com.apollographql.cache.normalized.sql.internal.blob2/Blobs.key|{}key[0] + final fun (): kotlin/String // com.apollographql.cache.normalized.sql.internal.blob2/Blobs.key.|(){}[0] + final fun component1(): kotlin/String // com.apollographql.cache.normalized.sql.internal.blob2/Blobs.component1|component1(){}[0] final fun component2(): kotlin/ByteArray // com.apollographql.cache.normalized.sql.internal.blob2/Blobs.component2|component2(){}[0] final fun component3(): kotlin/Long? // com.apollographql.cache.normalized.sql.internal.blob2/Blobs.component3|component3(){}[0] @@ -80,39 +101,40 @@ final class com.apollographql.cache.normalized.sql.internal.blob2/Blobs { // com final fun equals(kotlin/Any?): kotlin/Boolean // com.apollographql.cache.normalized.sql.internal.blob2/Blobs.equals|equals(kotlin.Any?){}[0] final fun hashCode(): kotlin/Int // com.apollographql.cache.normalized.sql.internal.blob2/Blobs.hashCode|hashCode(){}[0] final fun toString(): kotlin/String // com.apollographql.cache.normalized.sql.internal.blob2/Blobs.toString|toString(){}[0] - final val blob // com.apollographql.cache.normalized.sql.internal.blob2/Blobs.blob|{}blob[0] - final fun (): kotlin/ByteArray // com.apollographql.cache.normalized.sql.internal.blob2/Blobs.blob.|(){}[0] - final val date // com.apollographql.cache.normalized.sql.internal.blob2/Blobs.date|{}date[0] - final fun (): kotlin/Long? // com.apollographql.cache.normalized.sql.internal.blob2/Blobs.date.|(){}[0] - final val key // com.apollographql.cache.normalized.sql.internal.blob2/Blobs.key|{}key[0] - final fun (): kotlin/String // com.apollographql.cache.normalized.sql.internal.blob2/Blobs.key.|(){}[0] } + final class com.apollographql.cache.normalized.sql.internal.blob2/RecordForKey { // com.apollographql.cache.normalized.sql.internal.blob2/RecordForKey|null[0] constructor (kotlin/String, kotlin/ByteArray) // com.apollographql.cache.normalized.sql.internal.blob2/RecordForKey.|(kotlin.String;kotlin.ByteArray){}[0] + + final val blob // com.apollographql.cache.normalized.sql.internal.blob2/RecordForKey.blob|{}blob[0] + final fun (): kotlin/ByteArray // com.apollographql.cache.normalized.sql.internal.blob2/RecordForKey.blob.|(){}[0] + final val key // com.apollographql.cache.normalized.sql.internal.blob2/RecordForKey.key|{}key[0] + final fun (): kotlin/String // com.apollographql.cache.normalized.sql.internal.blob2/RecordForKey.key.|(){}[0] + final fun component1(): kotlin/String // com.apollographql.cache.normalized.sql.internal.blob2/RecordForKey.component1|component1(){}[0] final fun component2(): kotlin/ByteArray // com.apollographql.cache.normalized.sql.internal.blob2/RecordForKey.component2|component2(){}[0] final fun copy(kotlin/String = ..., kotlin/ByteArray = ...): com.apollographql.cache.normalized.sql.internal.blob2/RecordForKey // com.apollographql.cache.normalized.sql.internal.blob2/RecordForKey.copy|copy(kotlin.String;kotlin.ByteArray){}[0] final fun equals(kotlin/Any?): kotlin/Boolean // com.apollographql.cache.normalized.sql.internal.blob2/RecordForKey.equals|equals(kotlin.Any?){}[0] final fun hashCode(): kotlin/Int // com.apollographql.cache.normalized.sql.internal.blob2/RecordForKey.hashCode|hashCode(){}[0] final fun toString(): kotlin/String // com.apollographql.cache.normalized.sql.internal.blob2/RecordForKey.toString|toString(){}[0] - final val blob // com.apollographql.cache.normalized.sql.internal.blob2/RecordForKey.blob|{}blob[0] - final fun (): kotlin/ByteArray // com.apollographql.cache.normalized.sql.internal.blob2/RecordForKey.blob.|(){}[0] - final val key // com.apollographql.cache.normalized.sql.internal.blob2/RecordForKey.key|{}key[0] - final fun (): kotlin/String // com.apollographql.cache.normalized.sql.internal.blob2/RecordForKey.key.|(){}[0] } + final class com.apollographql.cache.normalized.sql.internal.blob2/RecordsForKeys { // com.apollographql.cache.normalized.sql.internal.blob2/RecordsForKeys|null[0] constructor (kotlin/String, kotlin/ByteArray) // com.apollographql.cache.normalized.sql.internal.blob2/RecordsForKeys.|(kotlin.String;kotlin.ByteArray){}[0] + + final val blob // com.apollographql.cache.normalized.sql.internal.blob2/RecordsForKeys.blob|{}blob[0] + final fun (): kotlin/ByteArray // com.apollographql.cache.normalized.sql.internal.blob2/RecordsForKeys.blob.|(){}[0] + final val key // com.apollographql.cache.normalized.sql.internal.blob2/RecordsForKeys.key|{}key[0] + final fun (): kotlin/String // com.apollographql.cache.normalized.sql.internal.blob2/RecordsForKeys.key.|(){}[0] + final fun component1(): kotlin/String // com.apollographql.cache.normalized.sql.internal.blob2/RecordsForKeys.component1|component1(){}[0] final fun component2(): kotlin/ByteArray // com.apollographql.cache.normalized.sql.internal.blob2/RecordsForKeys.component2|component2(){}[0] final fun copy(kotlin/String = ..., kotlin/ByteArray = ...): com.apollographql.cache.normalized.sql.internal.blob2/RecordsForKeys // com.apollographql.cache.normalized.sql.internal.blob2/RecordsForKeys.copy|copy(kotlin.String;kotlin.ByteArray){}[0] final fun equals(kotlin/Any?): kotlin/Boolean // com.apollographql.cache.normalized.sql.internal.blob2/RecordsForKeys.equals|equals(kotlin.Any?){}[0] final fun hashCode(): kotlin/Int // com.apollographql.cache.normalized.sql.internal.blob2/RecordsForKeys.hashCode|hashCode(){}[0] final fun toString(): kotlin/String // com.apollographql.cache.normalized.sql.internal.blob2/RecordsForKeys.toString|toString(){}[0] - final val blob // com.apollographql.cache.normalized.sql.internal.blob2/RecordsForKeys.blob|{}blob[0] - final fun (): kotlin/ByteArray // com.apollographql.cache.normalized.sql.internal.blob2/RecordsForKeys.blob.|(){}[0] - final val key // com.apollographql.cache.normalized.sql.internal.blob2/RecordsForKeys.key|{}key[0] - final fun (): kotlin/String // com.apollographql.cache.normalized.sql.internal.blob2/RecordsForKeys.key.|(){}[0] } + final class com.apollographql.cache.normalized.sql/SqlNormalizedCache : com.apollographql.cache.normalized.api/NormalizedCache { // com.apollographql.cache.normalized.sql/SqlNormalizedCache|null[0] final fun clearAll() // com.apollographql.cache.normalized.sql/SqlNormalizedCache.clearAll|clearAll(){}[0] final fun dump(): kotlin.collections/Map, kotlin.collections/Map> // com.apollographql.cache.normalized.sql/SqlNormalizedCache.dump|dump(){}[0] @@ -124,8 +146,10 @@ final class com.apollographql.cache.normalized.sql/SqlNormalizedCache : com.apol final fun remove(kotlin.collections/Collection, kotlin/Boolean): kotlin/Int // com.apollographql.cache.normalized.sql/SqlNormalizedCache.remove|remove(kotlin.collections.Collection;kotlin.Boolean){}[0] final fun remove(kotlin/String): kotlin/Int // com.apollographql.cache.normalized.sql/SqlNormalizedCache.remove|remove(kotlin.String){}[0] } + final const val com.apollographql.cache.normalized.sql/VERSION // com.apollographql.cache.normalized.sql/VERSION|{}VERSION[0] final fun (): kotlin/String // com.apollographql.cache.normalized.sql/VERSION.|(){}[0] + final fun com.apollographql.cache.normalized.sql/SqlNormalizedCacheFactory(app.cash.sqldelight.db/SqlDriver): com.apollographql.cache.normalized.api/NormalizedCacheFactory // com.apollographql.cache.normalized.sql/SqlNormalizedCacheFactory|SqlNormalizedCacheFactory(app.cash.sqldelight.db.SqlDriver){}[0] final fun com.apollographql.cache.normalized.sql/SqlNormalizedCacheFactory(kotlin/String? = ...): com.apollographql.cache.normalized.api/NormalizedCacheFactory // com.apollographql.cache.normalized.sql/SqlNormalizedCacheFactory|SqlNormalizedCacheFactory(kotlin.String?){}[0] final fun com.apollographql.cache.normalized.sql/SqlNormalizedCacheFactory(kotlin/String?, kotlin/String?): com.apollographql.cache.normalized.api/NormalizedCacheFactory // com.apollographql.cache.normalized.sql/SqlNormalizedCacheFactory|SqlNormalizedCacheFactory(kotlin.String?;kotlin.String?){}[0] diff --git a/tests/normalization-tests/src/commonTest/kotlin/com/example/NormalizationTest.kt b/tests/normalization-tests/src/commonTest/kotlin/com/example/NormalizationTest.kt index e9a4b9ce..f3023331 100644 --- a/tests/normalization-tests/src/commonTest/kotlin/com/example/NormalizationTest.kt +++ b/tests/normalization-tests/src/commonTest/kotlin/com/example/NormalizationTest.kt @@ -111,7 +111,7 @@ class NormalizationTest { ), ) - val data = apolloStore.readOperation(Issue2818Query()).data + val data = apolloStore.readOperation(Issue2818Query()).data!! assertEquals("section-name", data.home.sectionA?.name) assertEquals("section-id", data.home.sectionFragment.sectionA?.id) assertEquals("https://...", data.home.sectionFragment.sectionA?.imageUrl) diff --git a/tests/normalized-cache/src/commonTest/kotlin/circular/CircularCacheReadTest.kt b/tests/normalized-cache/src/commonTest/kotlin/circular/CircularCacheReadTest.kt index 909c9695..dce29384 100644 --- a/tests/normalized-cache/src/commonTest/kotlin/circular/CircularCacheReadTest.kt +++ b/tests/normalized-cache/src/commonTest/kotlin/circular/CircularCacheReadTest.kt @@ -30,7 +30,7 @@ class CircularCacheReadTest { ) store.writeOperation(operation, data) - val result = store.readOperation(operation, customScalarAdapters = CustomScalarAdapters.Empty).data + val result = store.readOperation(operation, customScalarAdapters = CustomScalarAdapters.Empty).data!! assertEquals("42", result.user.friend.id) } } diff --git a/tests/normalized-cache/src/commonTest/kotlin/declarativecache/DeclarativeCacheTest.kt b/tests/normalized-cache/src/commonTest/kotlin/declarativecache/DeclarativeCacheTest.kt index 5aa5a47a..8278084c 100644 --- a/tests/normalized-cache/src/commonTest/kotlin/declarativecache/DeclarativeCacheTest.kt +++ b/tests/normalized-cache/src/commonTest/kotlin/declarativecache/DeclarativeCacheTest.kt @@ -36,7 +36,7 @@ class DeclarativeCacheTest { store.writeOperation(otherOperation, otherData) // Get the "promo" book again, the title must be updated - val data = store.readOperation(promoOperation, CustomScalarAdapters.Empty).data + val data = store.readOperation(promoOperation, CustomScalarAdapters.Empty).data!! assertEquals("Other", data.promoBook?.title) } @@ -56,7 +56,7 @@ class DeclarativeCacheTest { store.writeOperation(otherOperation, otherData) // Get the "promo" library again, the address must be updated - val data = store.readOperation(promoOperation, CustomScalarAdapters.Empty).data + val data = store.readOperation(promoOperation, CustomScalarAdapters.Empty).data!! assertEquals("OtherAddress", data.promoLibrary?.address) } @@ -70,7 +70,7 @@ class DeclarativeCacheTest { store.writeOperation(bookQuery1, bookData1) val bookQuery2 = GetBookQuery("42") - val bookData2 = store.readOperation(bookQuery2, CustomScalarAdapters.Empty).data + val bookData2 = store.readOperation(bookQuery2, CustomScalarAdapters.Empty).data!! assertEquals("Promo", bookData2.book?.title) @@ -86,7 +86,7 @@ class DeclarativeCacheTest { store.writeOperation(authorQuery1, authorData1) val authorQuery2 = GetAuthorQuery("Pierre", "Bordage") - val authorData2 = store.readOperation(authorQuery2, CustomScalarAdapters.Empty).data + val authorData2 = store.readOperation(authorQuery2, CustomScalarAdapters.Empty).data!! assertEquals("Pierre", authorData2.author?.firstName) assertEquals("Bordage", authorData2.author?.lastName) @@ -117,13 +117,13 @@ class DeclarativeCacheTest { store.writeOperation(promoOperation, GetPromoBookQuery.Data(GetPromoBookQuery.PromoBook("Title4", "4", "Book"))) var operation = GetBooksQuery(listOf("4", "1")) - var data = store.readOperation(operation, CustomScalarAdapters.Empty).data + var data = store.readOperation(operation, CustomScalarAdapters.Empty).data!! assertEquals("Title4", data.books.get(0).title) assertEquals("Title1", data.books.get(1).title) operation = GetBooksQuery(listOf("3")) - data = store.readOperation(operation, CustomScalarAdapters.Empty).data + data = store.readOperation(operation, CustomScalarAdapters.Empty).data!! assertEquals("Title3", data.books.get(0).title) } diff --git a/tests/partial-results/build.gradle.kts b/tests/partial-results/build.gradle.kts new file mode 100644 index 00000000..f0e14739 --- /dev/null +++ b/tests/partial-results/build.gradle.kts @@ -0,0 +1,48 @@ +plugins { + alias(libs.plugins.kotlin.multiplatform) + alias(libs.plugins.apollo) +} + +kotlin { + configureKmp( + withJs = false, + withWasm = false, + withAndroid = false, + withApple = AppleTargets.Host, + ) + + sourceSets { + getByName("commonMain") { + dependencies { + implementation(libs.apollo.runtime) + implementation("com.apollographql.cache:normalized-cache-incubating") + } + } + + getByName("commonTest") { + dependencies { + implementation(libs.apollo.testing.support) + implementation(libs.apollo.mockserver) + implementation(libs.kotlin.test) + } + } + + getByName("jvmTest") { + dependencies { + implementation(libs.slf4j.nop) + } + } + } +} + +apollo { + service("service") { + packageName.set("test") + + plugin("com.apollographql.cache:normalized-cache-apollo-compiler-plugin") { + argument("packageName", packageName.get()) + } + + mapScalar("Category", "test.Category", "test.CategoryAdapter") + } +} diff --git a/tests/partial-results/src/commonMain/graphql/extra.graphqls b/tests/partial-results/src/commonMain/graphql/extra.graphqls new file mode 100644 index 00000000..a7709299 --- /dev/null +++ b/tests/partial-results/src/commonMain/graphql/extra.graphqls @@ -0,0 +1,15 @@ +extend schema +@link( + url: "https://specs.apollo.dev/kotlin_labs/v0.3", + import: ["@fieldPolicy", "@typePolicy"] +) +@link( + url: "https://specs.apollo.dev/cache/v0.1", + import: ["@cacheControl", "@cacheControlField"] +) + + +extend type User @typePolicy(keyFields: "id") +extend type Query @fieldPolicy(forField: "users", keyArgs: "ids") + +extend type User @cacheControlField(name: "nickName", maxAge: 0) diff --git a/tests/partial-results/src/commonMain/graphql/operation.graphql b/tests/partial-results/src/commonMain/graphql/operation.graphql new file mode 100644 index 00000000..bf99fea5 --- /dev/null +++ b/tests/partial-results/src/commonMain/graphql/operation.graphql @@ -0,0 +1,119 @@ +query MeWithoutNickNameWithEmailQuery { + me { + firstName + lastName + email + + ... on User { + id + } + } +} + +query MeWithoutNickNameWithoutEmailQuery { + me { + id + firstName + lastName + } +} + +query MeWithNickNameQuery { + me { + id + firstName + lastName + nickName + } +} + +query UsersQuery($ids: [ID!]!) { + users(ids: $ids) { + id + firstName + lastName + email + } +} + +query MeWithBestFriendQuery { + me { + id + firstName + lastName + bestFriend { + id + firstName + lastName + } + projects { + lead { + id + firstName + lastName + } + users { + id + firstName + lastName + } + } + } +} + +query DefaultProjectQuery($id: ID! = "42") { + project(id: $id) { + id + name + description + } + project2: project(id: "44") { + id + name + description + } +} + +query UserByCategoryQuery($category: Category!) { + user(category: $category) { + firstName + lastName + category + moreInfo + } +} + +query WithFragmentsQuery { + me { + id + firstName0: firstName + ... on User { + lastName + ... on User { + nickName0: nickName + } + } + ... UserFields + } + + me { + firstName0: firstName + mainProject { + id + lead0: lead { + id + } + } + mainProject { + lead0: lead { + id + firstName + } + } + } +} + +fragment UserFields on User { + email0: email + category +} diff --git a/tests/partial-results/src/commonMain/graphql/schema.graphqls b/tests/partial-results/src/commonMain/graphql/schema.graphqls new file mode 100644 index 00000000..3de5e880 --- /dev/null +++ b/tests/partial-results/src/commonMain/graphql/schema.graphqls @@ -0,0 +1,32 @@ +type Query { + me: User! + users(ids: [ID!]!): [User]! + project(id: ID! = "1"): Project + user(category: Category!): User! + someInt: Int + someInt2: Int +} + +type User { + id: ID! + firstName: String! + lastName: String! + nickName: String + email: String! + bestFriend: User + projects: [Project!]! + mainProject: Project! + category: Category! + moreInfo: Json! +} + +type Project { + id: ID! + name: String! + description: String + lead: User + users: [User!]! +} + +scalar Category +scalar Json diff --git a/tests/partial-results/src/commonMain/kotlin/test/Category.kt b/tests/partial-results/src/commonMain/kotlin/test/Category.kt new file mode 100644 index 00000000..f1d88161 --- /dev/null +++ b/tests/partial-results/src/commonMain/kotlin/test/Category.kt @@ -0,0 +1,35 @@ +package test + +import com.apollographql.apollo.api.Adapter +import com.apollographql.apollo.api.CustomScalarAdapters +import com.apollographql.apollo.api.json.JsonReader +import com.apollographql.apollo.api.json.JsonWriter + +data class Category( + val code: Int, + val name: String, +) + +val CategoryAdapter = object : Adapter { + override fun fromJson(reader: JsonReader, customScalarAdapters: CustomScalarAdapters): Category { + reader.beginObject() + var code: Int? = null + var name: String? = null + while (true) { + when (reader.selectName(listOf("code", "name"))) { + 0 -> code = reader.nextInt() + 1 -> name = reader.nextString() + else -> break + } + } + reader.endObject() + return Category(code = code!!, name = name!!) + } + + override fun toJson(writer: JsonWriter, customScalarAdapters: CustomScalarAdapters, value: Category) { + writer.beginObject() + writer.name("code").value(value.code) + writer.name("name").value(value.name) + writer.endObject() + } +} diff --git a/tests/partial-results/src/commonTest/kotlin/test/CachePartialResultTest.kt b/tests/partial-results/src/commonTest/kotlin/test/CachePartialResultTest.kt new file mode 100644 index 00000000..d4f22feb --- /dev/null +++ b/tests/partial-results/src/commonTest/kotlin/test/CachePartialResultTest.kt @@ -0,0 +1,777 @@ +package test + +import com.apollographql.apollo.ApolloClient +import com.apollographql.apollo.api.ApolloRequest +import com.apollographql.apollo.api.ApolloResponse +import com.apollographql.apollo.api.Error +import com.apollographql.apollo.api.Error.Location +import com.apollographql.apollo.api.Operation +import com.apollographql.apollo.interceptor.ApolloInterceptor +import com.apollographql.apollo.interceptor.ApolloInterceptorChain +import com.apollographql.apollo.testing.internal.runTest +import com.apollographql.cache.normalized.ApolloStore +import com.apollographql.cache.normalized.FetchPolicy +import com.apollographql.cache.normalized.api.CacheControlCacheResolver +import com.apollographql.cache.normalized.api.CacheHeaders +import com.apollographql.cache.normalized.api.CacheKey +import com.apollographql.cache.normalized.api.DefaultRecordMerger +import com.apollographql.cache.normalized.api.IdCacheKeyGenerator +import com.apollographql.cache.normalized.api.IdCacheKeyResolver +import com.apollographql.cache.normalized.api.Record +import com.apollographql.cache.normalized.api.SchemaCoordinatesMaxAgeProvider +import com.apollographql.cache.normalized.apolloStore +import com.apollographql.cache.normalized.fetchFromCache +import com.apollographql.cache.normalized.fetchPolicy +import com.apollographql.cache.normalized.fetchPolicyInterceptor +import com.apollographql.cache.normalized.memory.MemoryCacheFactory +import com.apollographql.cache.normalized.normalizedCache +import com.apollographql.cache.normalized.store +import com.apollographql.cache.normalized.storePartialResponses +import com.apollographql.cache.normalized.storeReceiveDate +import com.apollographql.mockserver.MockServer +import com.apollographql.mockserver.enqueueString +import kotlinx.coroutines.flow.Flow +import okio.use +import test.cache.Cache +import test.fragment.UserFields +import kotlin.test.Test +import kotlin.test.assertContentEquals +import kotlin.test.assertEquals +import kotlin.test.assertNull +import kotlin.time.Duration + +class CachePartialResultTest { + private lateinit var mockServer: MockServer + + private fun setUp() { + mockServer = MockServer() + } + + private fun tearDown() { + mockServer.close() + } + + @Test + fun simple() = runTest(before = { setUp() }, after = { tearDown() }) { + mockServer.enqueueString( + // language=JSON + """ + { + "data": { + "me": { + "__typename": "User", + "id": "1", + "firstName": "John", + "lastName": "Smith", + "email": "jsmith@example.com" + } + } + } + """ + ) + ApolloClient.Builder() + .serverUrl(mockServer.url()) + .normalizedCache(MemoryCacheFactory()) + .build() + .use { apolloClient -> + val networkResult = apolloClient.query(MeWithoutNickNameWithEmailQuery()) + .fetchPolicy(FetchPolicy.NetworkOnly) + .execute() + assertEquals( + MeWithoutNickNameWithEmailQuery.Data( + MeWithoutNickNameWithEmailQuery.Me( + __typename = "User", + firstName = "John", + lastName = "Smith", + email = "jsmith@example.com", + id = "1", + onUser = MeWithoutNickNameWithEmailQuery.OnUser( + id = "1" + ) + ) + ), + networkResult.data + ) + + val cacheResult = apolloClient.query(MeWithoutNickNameWithoutEmailQuery()) + .fetchPolicyInterceptor(PartialCacheOnlyInterceptor) + .execute() + assertEquals( + MeWithoutNickNameWithoutEmailQuery.Data( + MeWithoutNickNameWithoutEmailQuery.Me( + id = "1", + firstName = "John", + lastName = "Smith", + __typename = "User" + ) + ), + cacheResult.data + ) + + val cacheMissResult = apolloClient.query(MeWithNickNameQuery()) + .fetchPolicyInterceptor(PartialCacheOnlyInterceptor) + .execute() + assertEquals( + MeWithNickNameQuery.Data( + MeWithNickNameQuery.Me( + id = "1", + firstName = "John", + lastName = "Smith", + nickName = null, + __typename = "User" + ) + ), + cacheMissResult.data + ) + assertErrorsEquals( + listOf( + Error.Builder("Object 'User:1' has no field named 'nickName' in the cache").path(listOf("me", "nickName")).build() + ), + cacheMissResult.errors + ) + } + } + + @Test + fun lists() = runTest(before = { setUp() }, after = { tearDown() }) { + mockServer.enqueueString( + // language=JSON + """ + { + "data": { + "users": [ + { + "__typename": "User", + "id": "1", + "firstName": "John", + "lastName": "Smith", + "email": "jsmith@example.com" + }, + { + "__typename": "User", + "id": "2", + "firstName": "Jane", + "lastName": "Doe", + "email": "jdoe@example.com" + }, + null + ] + }, + "errors": [ + { + "message": "User `3` not found", + "path": ["users", 2] + } + ] + } + """ + ) + ApolloClient.Builder() + .serverUrl(mockServer.url()) + .store( + ApolloStore( + normalizedCacheFactory = MemoryCacheFactory(), + cacheKeyGenerator = IdCacheKeyGenerator(), + cacheResolver = IdCacheKeyResolver() + ) + ) + .build() + .use { apolloClient -> + val networkResult = apolloClient.query(UsersQuery(listOf("1", "2", "3"))) + .fetchPolicy(FetchPolicy.NetworkOnly) + .storePartialResponses(true) + .execute() + assertEquals( + UsersQuery.Data( + users = listOf( + UsersQuery.User( + __typename = "User", + id = "1", + firstName = "John", + lastName = "Smith", + email = "jsmith@example.com", + ), + UsersQuery.User( + __typename = "User", + id = "2", + firstName = "Jane", + lastName = "Doe", + email = "jdoe@example.com", + ), + null, + ) + ), + networkResult.data + ) + + val cacheResult = apolloClient.query(UsersQuery(listOf("1", "2", "3"))) + .fetchPolicyInterceptor(PartialCacheOnlyInterceptor) + .execute() + assertEquals( + networkResult.data, + cacheResult.data, + ) + assertErrorsEquals( + listOf( + Error.Builder("Object 'User:3' not found in the cache").path(listOf("users", 2)).build() + ), + cacheResult.errors + ) + } + } + + @Test + fun composite() = runTest(before = { setUp() }, after = { tearDown() }) { + mockServer.enqueueString( + // language=JSON + """ + { + "data": { + "me": { + "__typename": "User", + "id": "1", + "firstName": "John", + "lastName": "Smith", + "bestFriend": { + "__typename": "User", + "id": "2", + "firstName": "Jane", + "lastName": "Doe" + }, + "projects": [ + { + "__typename": "Project", + "lead": { + "__typename": "User", + "id": "3", + "firstName": "Amanda", + "lastName": "Brown" + }, + "users": [ + { + "__typename": "User", + "id": "4", + "firstName": "Alice", + "lastName": "White" + } + ] + } + ] + } + } + } + """ + ) + ApolloClient.Builder() + .serverUrl(mockServer.url()) + .normalizedCache(MemoryCacheFactory()) + .build() + .use { apolloClient -> + // Prime the cache + val networkResult = apolloClient.query(MeWithBestFriendQuery()) + .fetchPolicy(FetchPolicy.NetworkOnly) + .execute() + assertEquals( + MeWithBestFriendQuery.Data( + MeWithBestFriendQuery.Me( + __typename = "User", + id = "1", + firstName = "John", + lastName = "Smith", + bestFriend = MeWithBestFriendQuery.BestFriend( + __typename = "User", + id = "2", + firstName = "Jane", + lastName = "Doe" + ), + projects = listOf( + MeWithBestFriendQuery.Project( + lead = MeWithBestFriendQuery.Lead( + __typename = "User", + id = "3", + firstName = "Amanda", + lastName = "Brown" + ), + users = listOf( + MeWithBestFriendQuery.User( + __typename = "User", + id = "4", + firstName = "Alice", + lastName = "White" + ) + ) + ) + ) + ) + ), + networkResult.data + ) + + // Remove project lead from the cache + apolloClient.apolloStore.remove(CacheKey("User", "3")) + val cacheResult = apolloClient.query(MeWithBestFriendQuery()) + .fetchPolicyInterceptor(PartialCacheOnlyInterceptor) + .execute() + assertEquals( + MeWithBestFriendQuery.Data( + MeWithBestFriendQuery.Me( + __typename = "User", + id = "1", + firstName = "John", + lastName = "Smith", + bestFriend = MeWithBestFriendQuery.BestFriend( + __typename = "User", + id = "2", + firstName = "Jane", + lastName = "Doe" + ), + projects = listOf( + MeWithBestFriendQuery.Project( + lead = null, + users = listOf( + MeWithBestFriendQuery.User( + __typename = "User", + id = "4", + firstName = "Alice", + lastName = "White" + ) + ) + ) + ) + ) + ), + cacheResult.data + ) + assertErrorsEquals( + listOf( + Error.Builder("Object 'User:3' not found in the cache").path(listOf("me", "projects", 0, "lead")).build() + ), + cacheResult.errors + ) + + // Remove best friend from the cache + apolloClient.apolloStore.remove(CacheKey("User", "2")) + val cacheResult2 = apolloClient.query(MeWithBestFriendQuery()) + .fetchPolicyInterceptor(PartialCacheOnlyInterceptor) + .execute() + assertEquals( + MeWithBestFriendQuery.Data( + MeWithBestFriendQuery.Me( + __typename = "User", + id = "1", + firstName = "John", + lastName = "Smith", + bestFriend = null, + projects = listOf( + MeWithBestFriendQuery.Project( + lead = null, + users = listOf( + MeWithBestFriendQuery.User( + __typename = "User", + id = "4", + firstName = "Alice", + lastName = "White" + ) + ) + ) + ) + ) + ), + cacheResult2.data + ) + assertErrorsEquals( + listOf( + Error.Builder("Object 'User:2' not found in the cache").path(listOf("me", "bestFriend")).build(), + Error.Builder("Object 'User:3' not found in the cache").path(listOf("me", "projects", 0, "lead")).build(), + ), + cacheResult2.errors + ) + + // Remove project user from the cache + apolloClient.apolloStore.remove(CacheKey("User", "4")) + val cacheResult3 = apolloClient.query(MeWithBestFriendQuery()) + .fetchPolicyInterceptor(PartialCacheOnlyInterceptor) + .execute() + // Due to null bubbling the whole data is null + assertNull(cacheResult3.data) + assertErrorsEquals( + listOf( + Error.Builder("Object 'User:2' not found in the cache").path(listOf("me", "bestFriend")).build(), + Error.Builder("Object 'User:3' not found in the cache").path(listOf("me", "projects", 0, "lead")).build(), + Error.Builder("Object 'User:4' not found in the cache").path(listOf("me", "projects", 0, "users", 0)).build() + ), + cacheResult3.errors + ) + } + } + + @Test + fun argumentsAndAliases() = runTest(before = { setUp() }, after = { tearDown() }) { + mockServer.enqueueString( + // language=JSON + """ + { + "data": { + "project": { + "__typename": "Project", + "id": "42", + "name": "El Dorado", + "description": "The lost city of gold" + }, + "project2": { + "__typename": "Project", + "id": "44", + "name": "Atlantis", + "description": "The lost city of water" + } + } + } + """ + ) + ApolloClient.Builder() + .serverUrl(mockServer.url()) + .store( + ApolloStore( + normalizedCacheFactory = MemoryCacheFactory(), + cacheKeyGenerator = IdCacheKeyGenerator(), + cacheResolver = IdCacheKeyResolver() + ) + ) + .build() + .use { apolloClient -> + val networkResult = apolloClient.query(DefaultProjectQuery()) + .fetchPolicy(FetchPolicy.NetworkOnly) + .execute() + assertEquals( + DefaultProjectQuery.Data( + project = DefaultProjectQuery.Project( + id = "42", + name = "El Dorado", + description = "The lost city of gold" + ), + project2 = DefaultProjectQuery.Project2( + id = "44", + name = "Atlantis", + description = "The lost city of water" + ) + ), + networkResult.data + ) + + val cacheResult = apolloClient.query(DefaultProjectQuery()) + .fetchPolicyInterceptor(PartialCacheOnlyInterceptor) + .execute() + assertEquals( + networkResult.data, + cacheResult.data + ) + } + } + + @Test + fun customScalar() = runTest(before = { setUp() }, after = { tearDown() }) { + mockServer.enqueueString( + // language=JSON + """ + { + "data": { + "user": { + "__typename": "User", + "id": "1", + "firstName": "John", + "lastName": "Smith", + "category": { + "code": 1, + "name": "First" + }, + "moreInfo": [0, "no", false, {}, []] + } + } + } + """ + ) + ApolloClient.Builder() + .serverUrl(mockServer.url()) + .store( + ApolloStore( + normalizedCacheFactory = MemoryCacheFactory(), + cacheKeyGenerator = IdCacheKeyGenerator(), + cacheResolver = IdCacheKeyResolver() + ) + ) + .build() + .use { apolloClient -> + val networkResult = apolloClient.query(UserByCategoryQuery(Category(2, "Second"))) + .fetchPolicy(FetchPolicy.NetworkOnly) + .execute() + assertEquals( + UserByCategoryQuery.Data( + UserByCategoryQuery.User( + firstName = "John", + lastName = "Smith", + category = Category( + code = 1, + name = "First" + ), + moreInfo = listOf(0, "no", false, mapOf(), emptyList()), + id = "1", + __typename = "User", + ) + ), + networkResult.data + ) + + val cacheResult = apolloClient.query(UserByCategoryQuery(Category(2, "Second"))) + .fetchPolicyInterceptor(PartialCacheOnlyInterceptor) + .execute() + assertEquals( + networkResult.data, + cacheResult.data + ) + + // Remove the category from the cache + apolloClient.apolloStore.accessCache { cache -> + val record = cache.loadRecord("User:1", CacheHeaders.NONE)!! + cache.remove(CacheKey("User", "1"), false) + cache.merge(Record(record.key, record.fields - "category"), CacheHeaders.NONE, DefaultRecordMerger) + } + val cacheMissResult = apolloClient.query(UserByCategoryQuery(Category(2, "Second"))) + .fetchPolicyInterceptor(PartialCacheOnlyInterceptor) + .execute() + // Due to null bubbling the whole data is null + assertNull(cacheMissResult.data) + assertErrorsEquals( + listOf( + Error.Builder("Object 'User:1' has no field named 'category' in the cache").path(listOf("user", "category")).build() + ), + cacheMissResult.errors + ) + } + } + + @Test + fun fragmentsAndAliases() = runTest(before = { setUp() }, after = { tearDown() }) { + mockServer.enqueueString( + // language=JSON + """ + { + "data": { + "me": { + "__typename": "User", + "id": "1", + "firstName0": "John", + "mainProject": { + "id": "1", + "lead0": { + "id": "2", + "__typename": "User", + "firstName": "Jane" + } + }, + "lastName": "Smith", + "nickName0": "JS", + "email0": "jdoe@example.com", + "category": { + "code": 1, + "name": "First" + } + } + } + } + """ + ) + ApolloClient.Builder() + .serverUrl(mockServer.url()) + .normalizedCache(MemoryCacheFactory()) + .build() + .use { apolloClient -> + val networkResult = apolloClient.query(WithFragmentsQuery()) + .fetchPolicy(FetchPolicy.NetworkOnly) + .execute() + assertEquals( + WithFragmentsQuery.Data( + WithFragmentsQuery.Me( + __typename = "User", + id = "1", + firstName0 = "John", + mainProject = WithFragmentsQuery.MainProject( + id = "1", + lead0 = WithFragmentsQuery.Lead0( + id = "2", + __typename = "User", + firstName = "Jane", + ), + ), + onUser = WithFragmentsQuery.OnUser( + lastName = "Smith", + onUser = WithFragmentsQuery.OnUser1( + nickName0 = "JS" + ), + __typename = "User", + ), + userFields = UserFields( + email0 = "jdoe@example.com", + category = Category( + code = 1, + name = "First" + ), + id = "1", + __typename = "User", + ), + ) + ), + networkResult.data + ) + + val cacheResult = apolloClient.query(WithFragmentsQuery()) + .fetchPolicyInterceptor(PartialCacheOnlyInterceptor) + .execute() + assertEquals( + networkResult.data, + cacheResult.data + ) + + // Remove lead from the cache + apolloClient.apolloStore.remove(CacheKey("User", "2")) + + val cacheMissResult = apolloClient.query(WithFragmentsQuery()) + .fetchPolicyInterceptor(PartialCacheOnlyInterceptor) + .execute() + assertEquals( + WithFragmentsQuery.Data( + WithFragmentsQuery.Me( + __typename = "User", + id = "1", + firstName0 = "John", + mainProject = WithFragmentsQuery.MainProject( + id = "1", + lead0 = null, + ), + onUser = WithFragmentsQuery.OnUser( + lastName = "Smith", + onUser = WithFragmentsQuery.OnUser1( + nickName0 = "JS" + ), + __typename = "User", + ), + userFields = UserFields( + email0 = "jdoe@example.com", + category = Category( + code = 1, + name = "First" + ), + id = "1", + __typename = "User", + ), + ) + ), + cacheMissResult.data + ) + assertErrorsEquals( + listOf( + Error.Builder("Object 'User:2' not found in the cache").path(listOf("me", "mainProject", "lead0")).build() + ), + cacheMissResult.errors + ) + } + } + + @Test + fun cacheControl() = runTest(before = { setUp() }, after = { tearDown() }) { + mockServer.enqueueString( + // language=JSON + """ + { + "data": { + "me": { + "__typename": "User", + "id": "1", + "firstName": "John", + "lastName": "Smith", + "nickName": "JS" + } + } + } + """ + ) + ApolloClient.Builder() + .serverUrl(mockServer.url()) + .normalizedCache(MemoryCacheFactory(), cacheResolver = CacheControlCacheResolver(SchemaCoordinatesMaxAgeProvider(Cache.maxAges, Duration.INFINITE))) + .storeReceiveDate(true) + .build() + .use { apolloClient -> + val networkResult = apolloClient.query(MeWithNickNameQuery()) + .fetchPolicy(FetchPolicy.NetworkOnly) + .execute() + assertEquals( + MeWithNickNameQuery.Data( + MeWithNickNameQuery.Me( + __typename = "User", + id = "1", + firstName = "John", + lastName = "Smith", + nickName = "JS" + ) + ), + networkResult.data + ) + + val cacheMissResult = apolloClient.query(MeWithNickNameQuery()) + .fetchPolicyInterceptor(PartialCacheOnlyInterceptor) + .execute() + assertEquals( + MeWithNickNameQuery.Data( + MeWithNickNameQuery.Me( + id = "1", + firstName = "John", + lastName = "Smith", + nickName = null, + __typename = "User" + ) + ), + cacheMissResult.data + ) + assertErrorsEquals( + listOf( + Error.Builder("Field 'User:1' on object 'nickName' is stale in the cache").path(listOf("me", "nickName")).build() + ), + cacheMissResult.errors + ) + } + } +} + +val PartialCacheOnlyInterceptor = object : ApolloInterceptor { + override fun intercept(request: ApolloRequest, chain: ApolloInterceptorChain): Flow> { + return chain.proceed( + request = request + .newBuilder() + .fetchFromCache(true) + .build() + ) + } +} + +/** + * Helps using assertEquals. + */ +private data class ComparableError( + val message: String, + val locations: List?, + val path: List?, +) + +private fun assertErrorsEquals(expected: Iterable?, actual: Iterable?) = + assertContentEquals(expected?.map { + ComparableError( + message = it.message, + locations = it.locations, + path = it.path, + ) + }, actual?.map { + ComparableError( + message = it.message, + locations = it.locations, + path = it.path, + ) + })