From 5289524e8e344ed02bb4398d1c0dfb4aa22e24a7 Mon Sep 17 00:00:00 2001 From: BoD Date: Thu, 11 Jul 2024 18:59:34 +0200 Subject: [PATCH 1/3] Remove CacheResolver --- .../cache/normalized/ApolloStore.kt | 16 -- .../cache/normalized/ClientCacheExtensions.kt | 14 -- .../cache/normalized/api/CacheKeyResolver.kt | 72 --------- .../cache/normalized/api/CacheResolver.kt | 146 ++++++------------ .../api/OperationCacheExtensions.kt | 58 +------ .../api/internal/CacheBatchReader.kt | 57 +++---- .../normalized/internal/DefaultApolloStore.kt | 43 +----- .../cache/normalized/CacheKeyResolverTest.kt | 101 ------------ .../src/commonTest/kotlin/ExpirationTest.kt | 2 +- 9 files changed, 77 insertions(+), 432 deletions(-) delete mode 100644 normalized-cache-incubating/src/commonTest/kotlin/com/apollographql/cache/normalized/CacheKeyResolverTest.kt 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 4658f3f0..fa2ce59a 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 @@ -9,7 +9,6 @@ import com.apollographql.cache.normalized.api.ApolloResolver import com.apollographql.cache.normalized.api.CacheHeaders import com.apollographql.cache.normalized.api.CacheKey import com.apollographql.cache.normalized.api.CacheKeyGenerator -import com.apollographql.cache.normalized.api.CacheResolver import com.apollographql.cache.normalized.api.DefaultEmbeddedFieldsProvider import com.apollographql.cache.normalized.api.DefaultFieldKeyGenerator import com.apollographql.cache.normalized.api.DefaultRecordMerger @@ -17,7 +16,6 @@ import com.apollographql.cache.normalized.api.EmbeddedFieldsProvider import com.apollographql.cache.normalized.api.EmptyMetadataGenerator import com.apollographql.cache.normalized.api.FieldKeyGenerator import com.apollographql.cache.normalized.api.FieldPolicyApolloResolver -import com.apollographql.cache.normalized.api.FieldPolicyCacheResolver import com.apollographql.cache.normalized.api.MetadataGenerator import com.apollographql.cache.normalized.api.NormalizedCache import com.apollographql.cache.normalized.api.NormalizedCacheFactory @@ -204,20 +202,6 @@ interface ApolloStore { fun dispose() } -fun ApolloStore( - normalizedCacheFactory: NormalizedCacheFactory, - cacheKeyGenerator: CacheKeyGenerator = TypePolicyCacheKeyGenerator, - cacheResolver: CacheResolver = FieldPolicyCacheResolver, -): ApolloStore = DefaultApolloStore( - normalizedCacheFactory = normalizedCacheFactory, - cacheKeyGenerator = cacheKeyGenerator, - metadataGenerator = EmptyMetadataGenerator, - cacheResolver = cacheResolver, - recordMerger = DefaultRecordMerger, - fieldKeyGenerator = DefaultFieldKeyGenerator, - embeddedFieldsProvider = DefaultEmbeddedFieldsProvider, -) - @ApolloExperimental fun ApolloStore( normalizedCacheFactory: NormalizedCacheFactory, 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 3416d8dd..777a0886 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 @@ -26,7 +26,6 @@ import com.apollographql.cache.normalized.api.ApolloCacheHeaders import com.apollographql.cache.normalized.api.ApolloResolver import com.apollographql.cache.normalized.api.CacheHeaders import com.apollographql.cache.normalized.api.CacheKeyGenerator -import com.apollographql.cache.normalized.api.CacheResolver import com.apollographql.cache.normalized.api.DefaultEmbeddedFieldsProvider import com.apollographql.cache.normalized.api.DefaultFieldKeyGenerator import com.apollographql.cache.normalized.api.DefaultRecordMerger @@ -34,7 +33,6 @@ import com.apollographql.cache.normalized.api.EmbeddedFieldsProvider import com.apollographql.cache.normalized.api.EmptyMetadataGenerator import com.apollographql.cache.normalized.api.FieldKeyGenerator import com.apollographql.cache.normalized.api.FieldPolicyApolloResolver -import com.apollographql.cache.normalized.api.FieldPolicyCacheResolver import com.apollographql.cache.normalized.api.MetadataGenerator import com.apollographql.cache.normalized.api.NormalizedCacheFactory import com.apollographql.cache.normalized.api.RecordMerger @@ -108,18 +106,6 @@ enum class FetchPolicy { * This allows to display results faster */ @JvmOverloads -@JvmName("configureApolloClientBuilder") -fun ApolloClient.Builder.normalizedCache( - normalizedCacheFactory: NormalizedCacheFactory, - cacheKeyGenerator: CacheKeyGenerator = TypePolicyCacheKeyGenerator, - cacheResolver: CacheResolver = FieldPolicyCacheResolver, - writeToCacheAsynchronously: Boolean = false, -): ApolloClient.Builder { - return store(ApolloStore(normalizedCacheFactory, cacheKeyGenerator, cacheResolver), writeToCacheAsynchronously) -} - -@ApolloExperimental -@JvmOverloads @JvmName("configureApolloClientBuilder2") fun ApolloClient.Builder.normalizedCache( normalizedCacheFactory: NormalizedCacheFactory, diff --git a/normalized-cache-incubating/src/commonMain/kotlin/com/apollographql/cache/normalized/api/CacheKeyResolver.kt b/normalized-cache-incubating/src/commonMain/kotlin/com/apollographql/cache/normalized/api/CacheKeyResolver.kt index 39430bdb..f02aea98 100644 --- a/normalized-cache-incubating/src/commonMain/kotlin/com/apollographql/cache/normalized/api/CacheKeyResolver.kt +++ b/normalized-cache-incubating/src/commonMain/kotlin/com/apollographql/cache/normalized/api/CacheKeyResolver.kt @@ -1,80 +1,9 @@ package com.apollographql.cache.normalized.api -import com.apollographql.apollo.annotations.ApolloExperimental -import com.apollographql.apollo.api.CompiledField import com.apollographql.apollo.api.CompiledListType import com.apollographql.apollo.api.CompiledNamedType import com.apollographql.apollo.api.CompiledNotNullType -import com.apollographql.apollo.api.Executable import com.apollographql.apollo.api.isComposite -import kotlin.jvm.JvmSuppressWildcards - -/** - * A [CacheResolver] that resolves objects and list of objects and falls back to the default resolver for scalar fields. - * It is intended to simplify the usage of [CacheResolver] when no special handling is needed for scalar fields. - * - * Override [cacheKeyForField] to compute a cache key for a field of composite type. - * Override [listOfCacheKeysForField] to compute a list of cache keys for a field of 'list-of-composite' type. - * - * For simplicity, this only handles one level of lists. Implement [CacheResolver] if you need arbitrary nested lists of objects. - */ -abstract class CacheKeyResolver : CacheResolver { - /** - * Returns the computed cache key for a composite field. - * - * If the field is of object type, you can get the object typename with `field.type.rawType().name`. - * If the field is of interface or union type, the concrete object typename is not predictable and the returned [CacheKey] must be unique - * in the whole schema as it cannot be namespaced by the typename anymore. - * - * If the returned [CacheKey] is null, the resolver will use the default handling and use any previously cached value. - */ - abstract fun cacheKeyForField(field: CompiledField, variables: Executable.Variables): CacheKey? - - /** - * For a field that contains a list of objects, [listOfCacheKeysForField] returns a list of [CacheKey]s where each [CacheKey] identifies an object. - * - * If the field is of object type, you can get the object typename with `field.type.rawType().name`. - * If the field is of interface or union type, the concrete object typename is not predictable and the returned [CacheKey] must be unique - * in the whole schema as it cannot be namespaced by the typename anymore. - * - * If an individual [CacheKey] is null, the resulting object will be null in the response. - * If the returned list of [CacheKey]s is null, the resolver will use the default handling and use any previously cached value. - */ - open fun listOfCacheKeysForField(field: CompiledField, variables: Executable.Variables): List? = null - - final override fun resolveField( - field: CompiledField, - variables: Executable.Variables, - parent: Map, - parentId: String, - ): Any? { - var type = field.type - if (type is CompiledNotNullType) { - type = type.ofType - } - if (type is CompiledNamedType && type.isComposite()) { - val result = cacheKeyForField(field, variables) - if (result != null) { - return result - } - } - - if (type is CompiledListType) { - type = type.ofType - if (type is CompiledNotNullType) { - type = type.ofType - } - if (type is CompiledNamedType && type.isComposite()) { - val result = listOfCacheKeysForField(field, variables) - if (result != null) { - return result - } - } - } - - return DefaultCacheResolver.resolveField(field, variables, parent, parentId) - } -} /** * An [ApolloResolver] that resolves objects and list of objects and falls back to the default resolver for scalar fields. @@ -85,7 +14,6 @@ abstract class CacheKeyResolver : CacheResolver { * * For simplicity, this only handles one level of lists. Implement [ApolloResolver] if you need arbitrary nested lists of objects. */ -@ApolloExperimental abstract class CacheKeyApolloResolver : ApolloResolver { /** * Returns the computed cache key for a composite field. diff --git a/normalized-cache-incubating/src/commonMain/kotlin/com/apollographql/cache/normalized/api/CacheResolver.kt b/normalized-cache-incubating/src/commonMain/kotlin/com/apollographql/cache/normalized/api/CacheResolver.kt index 9008b2c6..70f4ff9d 100644 --- a/normalized-cache-incubating/src/commonMain/kotlin/com/apollographql/cache/normalized/api/CacheResolver.kt +++ b/normalized-cache-incubating/src/commonMain/kotlin/com/apollographql/cache/normalized/api/CacheResolver.kt @@ -1,6 +1,5 @@ package com.apollographql.cache.normalized.api -import com.apollographql.apollo.annotations.ApolloExperimental import com.apollographql.apollo.api.CompiledField import com.apollographql.apollo.api.Executable import com.apollographql.apollo.exception.CacheMissException @@ -8,16 +7,16 @@ import com.apollographql.apollo.mpp.currentTimeMillis import kotlin.jvm.JvmSuppressWildcards /** - * An interface for [CacheResolver] used to read the cache + * Controls how fields are resolved from the cache. */ -interface CacheResolver { +interface ApolloResolver { /** * Resolves a field from the cache. Called when reading from the cache, usually before a network request. * - takes a GraphQL field and operation variables as input and generates data for this field * - this data can be a CacheKey for objects but it can also be any other data if needed. In that respect, - * it's closer to a resolver as might be found in apollo-server - * - is used before a network request - * - is used when reading the cache + * it's closer to a resolver as might be found in a GraphQL server + * - used before a network request + * - used when reading the cache * * It can be used to map field arguments to [CacheKey]: * @@ -32,13 +31,13 @@ interface CacheResolver { * ``` * * ``` - * override fun resolveField(field: CompiledField, variables: Executable.Variables, parent: Map, parentId: String): Any? { - * val id = field.resolveArgument("id", variables)?.toString() + * override fun resolveField(context: ResolverContext): Any? { + * val id = context.field.resolveArgument("id", context.variables)?.toString() * if (id != null) { * return CacheKey(id) * } * - * return super.resolveField(field, variables, parent, parentId) + * return super.resolveField(context) * } * ``` * @@ -48,82 +47,68 @@ interface CacheResolver { * [resolveField] can also be generalized to return any value: * * ``` - * override fun resolveField(field: CompiledField, variables: Executable.Variables, parent: Map, parentId: String): Any? { - * if (field.name == "name") { + * override fun resolveField(context: ResolverContext): Any? { + * if (context.field.name == "name") { * // Every "name" field will return "JohnDoe" now! * return "JohnDoe" * } * - * return super.resolveField(field, variables, parent, parentId) + * return super.resolveField(context) * } * ``` * - * See also @fieldPolicy + * See also `@fieldPolicy` * See also [CacheKeyGenerator] * - * @param field the field to resolve - * @param variables the variables of the current operation - * @param parent the parent object as a map. It can contain the same values as [Record]. Especially, nested objects will be represented - * by [CacheKey] - * @param parentId the key of the parent. Mainly used for debugging + * @param context the field to resolve and associated information to resolve it * * @return a value that can go in a [Record]. No type checking is done. It is the responsibility of implementations to return the correct * type */ - fun resolveField( - field: CompiledField, - variables: Executable.Variables, - parent: Map, - parentId: String, - ): Any? + fun resolveField(context: ResolverContext): Any? } -@ApolloExperimental class ResolverContext( + /** + * The field to resolve + */ val field: CompiledField, + + /** + * The variables of the current operation + */ val variables: Executable.Variables, + + /** + * The parent object as a map. It can contain the same values as [Record]. Especially, nested objects will be represented + * by [CacheKey] + */ val parent: Map, + + /** + * The key of the parent. Mainly used for debugging + */ val parentKey: String, + + /** + * The type of the parent + */ val parentType: String, + + /** + * The cache headers used to pass arbitrary information to the resolver + */ val cacheHeaders: CacheHeaders, + + /** + * The [FieldKeyGenerator] to use to generate field keys + */ val fieldKeyGenerator: FieldKeyGenerator, ) -/** - * Same as [CacheResolver] but takes a [ResolverContext] as a parameter that's easier to evolve - */ -@ApolloExperimental -interface ApolloResolver { - fun resolveField( - context: ResolverContext, - ): Any? -} - /** * A cache resolver that uses the parent to resolve fields. */ -object DefaultCacheResolver : CacheResolver { - /** - * @param parent a [Map] that represent the object containing this field. The map values can have the same types as the ones in [Record] - */ - override fun resolveField( - field: CompiledField, - variables: Executable.Variables, - parent: Map, - parentId: String, - ): Any? { - val fieldKey = field.nameWithArguments(variables) - if (!parent.containsKey(fieldKey)) { - throw CacheMissException(parentId, fieldKey) - } - - return parent[fieldKey] - } -} - -/** - * An [ApolloResolver] that uses the parent to resolve fields. - */ object DefaultApolloResolver : ApolloResolver { override fun resolveField(context: ResolverContext): Any? { val fieldKey = context.fieldKeyGenerator.getFieldKey(FieldKeyContext(context.parentType, context.field, context.variables)) @@ -138,9 +123,7 @@ object DefaultApolloResolver : ApolloResolver { /** * A cache resolver that uses the cache date as a receive date and expires after a fixed max age */ -@ApolloExperimental class ReceiveDateApolloResolver(private val maxAge: Int) : ApolloResolver { - override fun resolveField(context: ResolverContext): Any? { val parent = context.parent val parentKey = context.parentKey @@ -159,7 +142,6 @@ class ReceiveDateApolloResolver(private val maxAge: Int) : ApolloResolver { if (maxAge + maxStale - age < 0) { throw CacheMissException(parentKey, fieldKey, true) } - } } } @@ -171,27 +153,21 @@ class ReceiveDateApolloResolver(private val maxAge: Int) : ApolloResolver { /** * A cache resolver that uses the cache date as an expiration date and expires past it */ -@ApolloExperimental -class ExpireDateCacheResolver : CacheResolver { - /** - * @param parent a [Map] that represent the object containing this field. The map values can have the same types as the ones in [Record] - */ - override fun resolveField( - field: CompiledField, - variables: Executable.Variables, - parent: Map, - parentId: String, - ): Any? { - val fieldKey = field.nameWithArguments(variables) +class ExpireDateCacheResolver : ApolloResolver { + override fun resolveField(context: ResolverContext): Any? { + val parent = context.parent + val parentKey = context.parentKey + + val fieldKey = context.fieldKeyGenerator.getFieldKey(FieldKeyContext(context.parentType, context.field, context.variables)) if (!parent.containsKey(fieldKey)) { - throw CacheMissException(parentId, fieldKey) + throw CacheMissException(parentKey, fieldKey) } if (parent is Record) { val expires = parent.dates?.get(fieldKey) if (expires != null) { if (currentTimeMillis() / 1000 - expires >= 0) { - throw CacheMissException(parentId, fieldKey, true) + throw CacheMissException(parentKey, fieldKey, true) } } } @@ -201,27 +177,7 @@ class ExpireDateCacheResolver : CacheResolver { } /** - * A [CacheResolver] that uses @fieldPolicy annotations to resolve fields and delegates to [DefaultCacheResolver] else - */ -object FieldPolicyCacheResolver : CacheResolver { - override fun resolveField( - field: CompiledField, - variables: Executable.Variables, - parent: Map, - parentId: String, - ): Any? { - val keyArgsValues = field.argumentValues(variables) { it.definition.isKey }.values.map { it.toString() } - - if (keyArgsValues.isNotEmpty()) { - return CacheKey(field.type.rawType().name, keyArgsValues) - } - - return DefaultCacheResolver.resolveField(field, variables, parent, parentId) - } -} - -/** - * A [ApolloResolver] that uses @fieldPolicy annotations to resolve fields and delegates to [DefaultApolloResolver] else + * A cache resolver that uses `@fieldPolicy` annotations to resolve fields and delegates to [DefaultApolloResolver] otherwise */ object FieldPolicyApolloResolver : ApolloResolver { override fun resolveField(context: ResolverContext): Any? { 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 c8fee6ad..6acbdd6e 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 @@ -39,45 +39,6 @@ fun Executable.normalize( .normalize(writer.root() as Map, rootField().selections, rootField().type.rawType()) } -@JvmOverloads -fun Executable.readDataFromCache( - customScalarAdapters: CustomScalarAdapters, - cache: ReadOnlyNormalizedCache, - cacheResolver: CacheResolver, - cacheHeaders: CacheHeaders, - fieldKeyGenerator: FieldKeyGenerator = DefaultFieldKeyGenerator, -): D { - val variables = variables(customScalarAdapters, true) - return readInternal( - cacheKey = CacheKey.rootKey(), - cache = cache, - cacheResolver = cacheResolver, - cacheHeaders = cacheHeaders, - variables = variables, - fieldKeyGenerator = fieldKeyGenerator, - ).toData(adapter(), customScalarAdapters, variables) -} - -@JvmOverloads -fun Executable.readDataFromCache( - cacheKey: CacheKey, - customScalarAdapters: CustomScalarAdapters, - cache: ReadOnlyNormalizedCache, - cacheResolver: CacheResolver, - cacheHeaders: CacheHeaders, - fieldKeyGenerator: FieldKeyGenerator = DefaultFieldKeyGenerator, -): D { - val variables = variables(customScalarAdapters, true) - return readInternal( - cacheKey = cacheKey, - cache = cache, - cacheResolver = cacheResolver, - cacheHeaders = cacheHeaders, - variables = variables, - fieldKeyGenerator = fieldKeyGenerator, - ).toData(adapter(), customScalarAdapters, variables) -} - @JvmOverloads fun Executable.readDataFromCache( customScalarAdapters: CustomScalarAdapters, @@ -117,23 +78,6 @@ fun Executable.readDataFromCache( ).toData(adapter(), customScalarAdapters, variables) } -@ApolloInternal -fun Executable.readDataFromCacheInternal( - cacheKey: CacheKey, - cache: ReadOnlyNormalizedCache, - cacheResolver: CacheResolver, - cacheHeaders: CacheHeaders, - variables: Executable.Variables, - fieldKeyGenerator: FieldKeyGenerator, -): CacheData = readInternal( - cacheKey = cacheKey, - cache = cache, - cacheResolver = cacheResolver, - cacheHeaders = cacheHeaders, - variables = variables, - fieldKeyGenerator = fieldKeyGenerator, -) - @ApolloInternal fun Executable.readDataFromCacheInternal( cacheKey: CacheKey, @@ -155,7 +99,7 @@ fun Executable.readDataFromCacheInternal( private fun Executable.readInternal( cacheKey: CacheKey, cache: ReadOnlyNormalizedCache, - cacheResolver: Any, + cacheResolver: ApolloResolver, cacheHeaders: CacheHeaders, variables: Executable.Variables, fieldKeyGenerator: FieldKeyGenerator, diff --git a/normalized-cache-incubating/src/commonMain/kotlin/com/apollographql/cache/normalized/api/internal/CacheBatchReader.kt b/normalized-cache-incubating/src/commonMain/kotlin/com/apollographql/cache/normalized/api/internal/CacheBatchReader.kt index 0d3e522e..5eb44830 100644 --- a/normalized-cache-incubating/src/commonMain/kotlin/com/apollographql/cache/normalized/api/internal/CacheBatchReader.kt +++ b/normalized-cache-incubating/src/commonMain/kotlin/com/apollographql/cache/normalized/api/internal/CacheBatchReader.kt @@ -9,7 +9,6 @@ import com.apollographql.cache.normalized.api.ApolloResolver import com.apollographql.cache.normalized.api.CacheData import com.apollographql.cache.normalized.api.CacheHeaders import com.apollographql.cache.normalized.api.CacheKey -import com.apollographql.cache.normalized.api.CacheResolver import com.apollographql.cache.normalized.api.FieldKeyGenerator import com.apollographql.cache.normalized.api.ReadOnlyNormalizedCache import com.apollographql.cache.normalized.api.Record @@ -26,7 +25,7 @@ internal class CacheBatchReader( private val cache: ReadOnlyNormalizedCache, private val rootKey: String, private val variables: Executable.Variables, - private val cacheResolver: Any, + private val cacheResolver: ApolloResolver, private val cacheHeaders: CacheHeaders, private val rootSelections: List, private val rootTypename: String, @@ -121,24 +120,17 @@ internal class CacheBatchReader( return@mapNotNull null } - val value = when (cacheResolver) { - is CacheResolver -> cacheResolver.resolveField(it, variables, record, record.key) - is ApolloResolver -> { - cacheResolver.resolveField( - ResolverContext( - field = it, - variables = variables, - parent = record, - parentKey = record.key, - parentType = pendingReference.parentType, - cacheHeaders = cacheHeaders, - fieldKeyGenerator = fieldKeyGenerator, - ) + val value = cacheResolver.resolveField( + ResolverContext( + field = it, + variables = variables, + parent = record, + parentKey = record.key, + parentType = pendingReference.parentType, + cacheHeaders = cacheHeaders, + fieldKeyGenerator = fieldKeyGenerator, ) - } - - else -> throw IllegalStateException() - } + ) value.registerCacheKeys(pendingReference.path + it.responseName, it.selections, it.type.rawType().name) it.responseName to value @@ -182,24 +174,17 @@ internal class CacheBatchReader( return@mapNotNull null } - val value = when (cacheResolver) { - is CacheResolver -> cacheResolver.resolveField(it, variables, this, "") - is ApolloResolver -> { - cacheResolver.resolveField( - ResolverContext( - field = it, - variables = variables, - parent = this, - parentKey = "", - parentType = parentType, - cacheHeaders = cacheHeaders, - fieldKeyGenerator = fieldKeyGenerator, - ) + val value = cacheResolver.resolveField( + ResolverContext( + field = it, + variables = variables, + parent = this, + parentKey = "", + parentType = parentType, + cacheHeaders = cacheHeaders, + fieldKeyGenerator = fieldKeyGenerator, ) - } - - else -> throw IllegalStateException() - } + ) value.registerCacheKeys(path + it.responseName, it.selections, it.type.rawType().name) it.responseName to value 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 9b3ea68b..5f366338 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,23 +1,19 @@ package com.apollographql.cache.normalized.internal import com.apollographql.apollo.api.CustomScalarAdapters -import com.apollographql.apollo.api.Executable import com.apollographql.apollo.api.Fragment import com.apollographql.apollo.api.Operation import com.apollographql.apollo.api.variables import com.apollographql.cache.normalized.ApolloStore import com.apollographql.cache.normalized.api.ApolloResolver -import com.apollographql.cache.normalized.api.CacheData import com.apollographql.cache.normalized.api.CacheHeaders import com.apollographql.cache.normalized.api.CacheKey import com.apollographql.cache.normalized.api.CacheKeyGenerator -import com.apollographql.cache.normalized.api.CacheResolver import com.apollographql.cache.normalized.api.EmbeddedFieldsProvider import com.apollographql.cache.normalized.api.FieldKeyGenerator import com.apollographql.cache.normalized.api.MetadataGenerator import com.apollographql.cache.normalized.api.NormalizedCache import com.apollographql.cache.normalized.api.NormalizedCacheFactory -import com.apollographql.cache.normalized.api.ReadOnlyNormalizedCache import com.apollographql.cache.normalized.api.Record import com.apollographql.cache.normalized.api.RecordMerger import com.apollographql.cache.normalized.api.internal.OptimisticNormalizedCache @@ -35,7 +31,7 @@ internal class DefaultApolloStore( private val cacheKeyGenerator: CacheKeyGenerator, private val fieldKeyGenerator: FieldKeyGenerator, private val metadataGenerator: MetadataGenerator, - private val cacheResolver: Any, + private val cacheResolver: ApolloResolver, private val recordMerger: RecordMerger, private val embeddedFieldsProvider: EmbeddedFieldsProvider, ) : ApolloStore { @@ -122,7 +118,7 @@ internal class DefaultApolloStore( cacheHeaders: CacheHeaders, ): D { val variables = operation.variables(customScalarAdapters, true) - return operation.readDataFromCachePrivate( + return operation.readDataFromCacheInternal( cache = cache, cacheResolver = cacheResolver, cacheHeaders = cacheHeaders, @@ -140,7 +136,7 @@ internal class DefaultApolloStore( ): D { val variables = fragment.variables(customScalarAdapters, true) - return fragment.readDataFromCachePrivate( + return fragment.readDataFromCacheInternal( cache = cache, cacheResolver = cacheResolver, cacheHeaders = cacheHeaders, @@ -234,37 +230,4 @@ internal class DefaultApolloStore( } override fun dispose() {} - - companion object { - private fun Executable.readDataFromCachePrivate( - cacheKey: CacheKey, - cache: ReadOnlyNormalizedCache, - cacheResolver: Any, - cacheHeaders: CacheHeaders, - variables: Executable.Variables, - fieldKeyGenerator: FieldKeyGenerator, - ): CacheData { - return when (cacheResolver) { - is CacheResolver -> readDataFromCacheInternal( - cacheKey = cacheKey, - cache = cache, - cacheResolver = cacheResolver, - cacheHeaders = cacheHeaders, - variables = variables, - fieldKeyGenerator = fieldKeyGenerator, - ) - - is ApolloResolver -> readDataFromCacheInternal( - cacheKey = cacheKey, - cache = cache, - cacheResolver = cacheResolver, - cacheHeaders = cacheHeaders, - variables = variables, - fieldKeyGenerator = fieldKeyGenerator, - ) - - else -> throw IllegalStateException() - } - } - } } diff --git a/normalized-cache-incubating/src/commonTest/kotlin/com/apollographql/cache/normalized/CacheKeyResolverTest.kt b/normalized-cache-incubating/src/commonTest/kotlin/com/apollographql/cache/normalized/CacheKeyResolverTest.kt deleted file mode 100644 index 2ef9ece9..00000000 --- a/normalized-cache-incubating/src/commonTest/kotlin/com/apollographql/cache/normalized/CacheKeyResolverTest.kt +++ /dev/null @@ -1,101 +0,0 @@ -package com.apollographql.cache.normalized - -import com.apollographql.apollo.api.CompiledField -import com.apollographql.apollo.api.CompiledListType -import com.apollographql.apollo.api.Executable -import com.apollographql.apollo.api.ObjectType -import com.apollographql.apollo.exception.CacheMissException -import com.apollographql.cache.normalized.CacheKeyResolverTest.Fixtures.TEST_LIST_FIELD -import com.apollographql.cache.normalized.CacheKeyResolverTest.Fixtures.TEST_SIMPLE_FIELD -import com.apollographql.cache.normalized.api.CacheKey -import com.apollographql.cache.normalized.api.CacheKeyResolver -import kotlin.test.BeforeTest -import kotlin.test.Test -import kotlin.test.assertEquals -import kotlin.test.assertFailsWith -import kotlin.test.fail - - -class CacheKeyResolverTest { - - private lateinit var subject: CacheKeyResolver - lateinit var onCacheKeyForField: (field: CompiledField, variables: Executable.Variables) -> CacheKey? - lateinit var onListOfCacheKeysForField: (field: CompiledField, variables: Executable.Variables) -> List? - - @BeforeTest - fun setup() { - subject = FakeCacheKeyResolver() - onCacheKeyForField = { _, _ -> - fail("Unexpected call to cacheKeyForField") - } - onListOfCacheKeysForField = { _, _ -> - fail("Unexpected call to listOfCacheKeysForField") - } - } - - @Test - fun verify_cacheKeyForField_called_for_named_composite_field() { - val expectedKey = CacheKey("test") - val fields = mutableListOf() - - onCacheKeyForField = { field: CompiledField, _: Executable.Variables -> - fields += field - expectedKey - } - - val returned = subject.resolveField(TEST_SIMPLE_FIELD, Executable.Variables(emptyMap()), emptyMap(), "") - - assertEquals(returned, expectedKey) - assertEquals(fields[0], TEST_SIMPLE_FIELD) - } - - @Test - fun listOfCacheKeysForField_called_for_list_field() { - val expectedKeys = listOf(CacheKey("test")) - val fields = mutableListOf() - - onListOfCacheKeysForField = { field: CompiledField, _: Executable.Variables -> - fields += field - expectedKeys - } - - val returned = subject.resolveField(TEST_LIST_FIELD, Executable.Variables(emptyMap()), emptyMap(), "") - - assertEquals(returned, expectedKeys) - assertEquals(fields[0], TEST_LIST_FIELD) - } - - @Test - fun super_called_for_null_return_values() { - onCacheKeyForField = { _, _ -> null } - onListOfCacheKeysForField = { _, _ -> null } - - // The best way to ensure that super was called is to check for a cache miss exception from CacheResolver() - assertFailsWith { - subject.resolveField(TEST_SIMPLE_FIELD, Executable.Variables(emptyMap()), emptyMap(), "") - } - assertFailsWith { - subject.resolveField(TEST_LIST_FIELD, Executable.Variables(emptyMap()), emptyMap(), "") - } - } - - inner class FakeCacheKeyResolver : CacheKeyResolver() { - - override fun cacheKeyForField(field: CompiledField, variables: Executable.Variables): CacheKey? { - return onCacheKeyForField(field, variables) - } - - override fun listOfCacheKeysForField(field: CompiledField, variables: Executable.Variables): List? { - return onListOfCacheKeysForField(field, variables) - } - } - - object Fixtures { - - private val TEST_TYPE = ObjectType.Builder(name = "Test").keyFields(keyFields = listOf("id")).build() - - val TEST_SIMPLE_FIELD = CompiledField.Builder(name = "test", type = TEST_TYPE).build() - - val TEST_LIST_FIELD = CompiledField.Builder(name = "testList", type = CompiledListType(ofType = TEST_TYPE)).build() - } -} diff --git a/tests/sqlite/src/commonTest/kotlin/ExpirationTest.kt b/tests/sqlite/src/commonTest/kotlin/ExpirationTest.kt index 199c27a6..9bcdf5a0 100644 --- a/tests/sqlite/src/commonTest/kotlin/ExpirationTest.kt +++ b/tests/sqlite/src/commonTest/kotlin/ExpirationTest.kt @@ -79,7 +79,7 @@ class ExpirationTest { .normalizedCache( normalizedCacheFactory = SqlNormalizedCacheFactory(name = null, withDates = true), cacheKeyGenerator = TypePolicyCacheKeyGenerator, - cacheResolver = ExpireDateCacheResolver() + apolloResolver = ExpireDateCacheResolver() ) .storeExpirationDate(true) .serverUrl(mockServer.url()) From 441264734ef8af8b4cd00ba30e971df42a069505 Mon Sep 17 00:00:00 2001 From: BoD Date: Thu, 11 Jul 2024 20:06:24 +0200 Subject: [PATCH 2/3] Rename ApolloResolver -> CacheResolver --- .../api/normalized-cache-incubating.api | 67 +++++-------------- .../api/normalized-cache-incubating.klib.api | 44 ++++-------- .../cache/normalized/ApolloStore.kt | 8 +-- .../cache/normalized/ClientCacheExtensions.kt | 8 +-- .../cache/normalized/api/CacheKeyResolver.kt | 10 +-- .../cache/normalized/api/CacheResolver.kt | 14 ++-- .../api/OperationCacheExtensions.kt | 8 +-- .../api/internal/CacheBatchReader.kt | 4 +- .../normalized/internal/DefaultApolloStore.kt | 4 +- ...esolverTest.kt => CacheKeyResolverTest.kt} | 14 ++-- .../kotlin/ConnectionPaginationTest.kt | 4 +- .../ConnectionProgrammaticPaginationTest.kt | 4 +- .../ConnectionWithNodesPaginationTest.kt | 4 +- .../kotlin/CursorBasedPaginationTest.kt | 6 +- .../OffsetBasedWithArrayPaginationTest.kt | 4 +- ...fsetBasedWithPageAndInputPaginationTest.kt | 6 +- .../OffsetBasedWithPagePaginationTest.kt | 6 +- .../src/commonTest/kotlin/ExpirationTest.kt | 6 +- 18 files changed, 83 insertions(+), 138 deletions(-) rename normalized-cache-incubating/src/commonTest/kotlin/com/apollographql/cache/normalized/{CacheKeyApolloResolverTest.kt => CacheKeyResolverTest.kt} (87%) diff --git a/normalized-cache-incubating/api/normalized-cache-incubating.api b/normalized-cache-incubating/api/normalized-cache-incubating.api index dabf34e6..a4ff4007 100644 --- a/normalized-cache-incubating/api/normalized-cache-incubating.api +++ b/normalized-cache-incubating/api/normalized-cache-incubating.api @@ -27,10 +27,8 @@ public final class com/apollographql/cache/normalized/ApolloStore$DefaultImpls { } public final class com/apollographql/cache/normalized/ApolloStoreKt { - public static final fun ApolloStore (Lcom/apollographql/cache/normalized/api/NormalizedCacheFactory;Lcom/apollographql/cache/normalized/api/CacheKeyGenerator;Lcom/apollographql/cache/normalized/api/CacheResolver;)Lcom/apollographql/cache/normalized/ApolloStore; - public static final fun ApolloStore (Lcom/apollographql/cache/normalized/api/NormalizedCacheFactory;Lcom/apollographql/cache/normalized/api/CacheKeyGenerator;Lcom/apollographql/cache/normalized/api/MetadataGenerator;Lcom/apollographql/cache/normalized/api/ApolloResolver;Lcom/apollographql/cache/normalized/api/RecordMerger;Lcom/apollographql/cache/normalized/api/FieldKeyGenerator;Lcom/apollographql/cache/normalized/api/EmbeddedFieldsProvider;)Lcom/apollographql/cache/normalized/ApolloStore; - public static synthetic fun ApolloStore$default (Lcom/apollographql/cache/normalized/api/NormalizedCacheFactory;Lcom/apollographql/cache/normalized/api/CacheKeyGenerator;Lcom/apollographql/cache/normalized/api/CacheResolver;ILjava/lang/Object;)Lcom/apollographql/cache/normalized/ApolloStore; - public static synthetic fun ApolloStore$default (Lcom/apollographql/cache/normalized/api/NormalizedCacheFactory;Lcom/apollographql/cache/normalized/api/CacheKeyGenerator;Lcom/apollographql/cache/normalized/api/MetadataGenerator;Lcom/apollographql/cache/normalized/api/ApolloResolver;Lcom/apollographql/cache/normalized/api/RecordMerger;Lcom/apollographql/cache/normalized/api/FieldKeyGenerator;Lcom/apollographql/cache/normalized/api/EmbeddedFieldsProvider;ILjava/lang/Object;)Lcom/apollographql/cache/normalized/ApolloStore; + public static final fun ApolloStore (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;)Lcom/apollographql/cache/normalized/ApolloStore; + public static synthetic fun ApolloStore$default (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;ILjava/lang/Object;)Lcom/apollographql/cache/normalized/ApolloStore; } public final class com/apollographql/cache/normalized/CacheInfo : com/apollographql/apollo/api/ExecutionContext$Element { @@ -97,20 +95,15 @@ public final class com/apollographql/cache/normalized/NormalizedCache { public static synthetic fun -logCacheMisses$default (Lcom/apollographql/apollo/ApolloClient$Builder;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Lcom/apollographql/apollo/ApolloClient$Builder; public static final fun cacheHeaders (Lcom/apollographql/apollo/api/ApolloResponse$Builder;Lcom/apollographql/cache/normalized/api/CacheHeaders;)Lcom/apollographql/apollo/api/ApolloResponse$Builder; public static final fun cacheHeaders (Lcom/apollographql/apollo/api/MutableExecutionOptions;Lcom/apollographql/cache/normalized/api/CacheHeaders;)Ljava/lang/Object; - public static final fun configureApolloClientBuilder (Lcom/apollographql/apollo/ApolloClient$Builder;Lcom/apollographql/cache/normalized/api/NormalizedCacheFactory;)Lcom/apollographql/apollo/ApolloClient$Builder; - public static final fun configureApolloClientBuilder (Lcom/apollographql/apollo/ApolloClient$Builder;Lcom/apollographql/cache/normalized/api/NormalizedCacheFactory;Lcom/apollographql/cache/normalized/api/CacheKeyGenerator;)Lcom/apollographql/apollo/ApolloClient$Builder; - public static final fun configureApolloClientBuilder (Lcom/apollographql/apollo/ApolloClient$Builder;Lcom/apollographql/cache/normalized/api/NormalizedCacheFactory;Lcom/apollographql/cache/normalized/api/CacheKeyGenerator;Lcom/apollographql/cache/normalized/api/CacheResolver;)Lcom/apollographql/apollo/ApolloClient$Builder; - public static final fun configureApolloClientBuilder (Lcom/apollographql/apollo/ApolloClient$Builder;Lcom/apollographql/cache/normalized/api/NormalizedCacheFactory;Lcom/apollographql/cache/normalized/api/CacheKeyGenerator;Lcom/apollographql/cache/normalized/api/CacheResolver;Z)Lcom/apollographql/apollo/ApolloClient$Builder; - public static synthetic fun configureApolloClientBuilder$default (Lcom/apollographql/apollo/ApolloClient$Builder;Lcom/apollographql/cache/normalized/api/NormalizedCacheFactory;Lcom/apollographql/cache/normalized/api/CacheKeyGenerator;Lcom/apollographql/cache/normalized/api/CacheResolver;ZILjava/lang/Object;)Lcom/apollographql/apollo/ApolloClient$Builder; public static final fun configureApolloClientBuilder2 (Lcom/apollographql/apollo/ApolloClient$Builder;Lcom/apollographql/cache/normalized/api/NormalizedCacheFactory;)Lcom/apollographql/apollo/ApolloClient$Builder; public static final fun configureApolloClientBuilder2 (Lcom/apollographql/apollo/ApolloClient$Builder;Lcom/apollographql/cache/normalized/api/NormalizedCacheFactory;Lcom/apollographql/cache/normalized/api/CacheKeyGenerator;)Lcom/apollographql/apollo/ApolloClient$Builder; 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/apollo/ApolloClient$Builder; - 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/ApolloResolver;)Lcom/apollographql/apollo/ApolloClient$Builder; - 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/ApolloResolver;Lcom/apollographql/cache/normalized/api/RecordMerger;)Lcom/apollographql/apollo/ApolloClient$Builder; - 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/ApolloResolver;Lcom/apollographql/cache/normalized/api/RecordMerger;Lcom/apollographql/cache/normalized/api/FieldKeyGenerator;)Lcom/apollographql/apollo/ApolloClient$Builder; - 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/ApolloResolver;Lcom/apollographql/cache/normalized/api/RecordMerger;Lcom/apollographql/cache/normalized/api/FieldKeyGenerator;Lcom/apollographql/cache/normalized/api/EmbeddedFieldsProvider;)Lcom/apollographql/apollo/ApolloClient$Builder; - 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/ApolloResolver;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/ApolloResolver;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 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/apollo/ApolloClient$Builder; + 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/apollo/ApolloClient$Builder; + 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/apollo/ApolloClient$Builder; + 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;)Lcom/apollographql/apollo/ApolloClient$Builder; + 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 emitCacheMisses (Lcom/apollographql/apollo/api/MutableExecutionOptions;Z)Lcom/apollographql/apollo/api/MutableExecutionOptions; public static final fun executeCacheAndNetwork (Lcom/apollographql/apollo/ApolloCall;)Lkotlinx/coroutines/flow/Flow; @@ -150,10 +143,6 @@ public final class com/apollographql/cache/normalized/api/ApolloCacheHeaders { public static final field MEMORY_CACHE_ONLY Ljava/lang/String; } -public abstract interface class com/apollographql/cache/normalized/api/ApolloResolver { - public abstract fun resolveField (Lcom/apollographql/cache/normalized/api/ResolverContext;)Ljava/lang/Object; -} - public abstract interface class com/apollographql/cache/normalized/api/CacheData { public abstract fun toMap ()Ljava/util/Map; } @@ -202,13 +191,6 @@ public final class com/apollographql/cache/normalized/api/CacheKey$Companion { public final fun rootKey ()Lcom/apollographql/cache/normalized/api/CacheKey; } -public abstract class com/apollographql/cache/normalized/api/CacheKeyApolloResolver : com/apollographql/cache/normalized/api/ApolloResolver { - public fun ()V - public abstract fun cacheKeyForField (Lcom/apollographql/cache/normalized/api/ResolverContext;)Lcom/apollographql/cache/normalized/api/CacheKey; - public fun listOfCacheKeysForField (Lcom/apollographql/cache/normalized/api/ResolverContext;)Ljava/util/List; - public final fun resolveField (Lcom/apollographql/cache/normalized/api/ResolverContext;)Ljava/lang/Object; -} - public abstract interface class com/apollographql/cache/normalized/api/CacheKeyGenerator { public abstract fun cacheKeyForObject (Ljava/util/Map;Lcom/apollographql/cache/normalized/api/CacheKeyGeneratorContext;)Lcom/apollographql/cache/normalized/api/CacheKey; } @@ -221,13 +203,13 @@ public final class com/apollographql/cache/normalized/api/CacheKeyGeneratorConte public abstract class com/apollographql/cache/normalized/api/CacheKeyResolver : com/apollographql/cache/normalized/api/CacheResolver { public fun ()V - public abstract fun cacheKeyForField (Lcom/apollographql/apollo/api/CompiledField;Lcom/apollographql/apollo/api/Executable$Variables;)Lcom/apollographql/cache/normalized/api/CacheKey; - public fun listOfCacheKeysForField (Lcom/apollographql/apollo/api/CompiledField;Lcom/apollographql/apollo/api/Executable$Variables;)Ljava/util/List; - public final fun resolveField (Lcom/apollographql/apollo/api/CompiledField;Lcom/apollographql/apollo/api/Executable$Variables;Ljava/util/Map;Ljava/lang/String;)Ljava/lang/Object; + public abstract fun cacheKeyForField (Lcom/apollographql/cache/normalized/api/ResolverContext;)Lcom/apollographql/cache/normalized/api/CacheKey; + public fun listOfCacheKeysForField (Lcom/apollographql/cache/normalized/api/ResolverContext;)Ljava/util/List; + public final fun resolveField (Lcom/apollographql/cache/normalized/api/ResolverContext;)Ljava/lang/Object; } public abstract interface class com/apollographql/cache/normalized/api/CacheResolver { - public abstract fun resolveField (Lcom/apollographql/apollo/api/CompiledField;Lcom/apollographql/apollo/api/Executable$Variables;Ljava/util/Map;Ljava/lang/String;)Ljava/lang/Object; + public abstract fun resolveField (Lcom/apollographql/cache/normalized/api/ResolverContext;)Ljava/lang/Object; } public final class com/apollographql/cache/normalized/api/ConnectionEmbeddedFieldsProvider : com/apollographql/cache/normalized/api/EmbeddedFieldsProvider { @@ -253,14 +235,9 @@ public final class com/apollographql/cache/normalized/api/ConnectionMetadataGene public fun metadataForObject (Ljava/lang/Object;Lcom/apollographql/cache/normalized/api/MetadataGeneratorContext;)Ljava/util/Map; } -public final class com/apollographql/cache/normalized/api/DefaultApolloResolver : com/apollographql/cache/normalized/api/ApolloResolver { - public static final field INSTANCE Lcom/apollographql/cache/normalized/api/DefaultApolloResolver; - public fun resolveField (Lcom/apollographql/cache/normalized/api/ResolverContext;)Ljava/lang/Object; -} - public final class com/apollographql/cache/normalized/api/DefaultCacheResolver : com/apollographql/cache/normalized/api/CacheResolver { public static final field INSTANCE Lcom/apollographql/cache/normalized/api/DefaultCacheResolver; - public fun resolveField (Lcom/apollographql/apollo/api/CompiledField;Lcom/apollographql/apollo/api/Executable$Variables;Ljava/util/Map;Ljava/lang/String;)Ljava/lang/Object; + public fun resolveField (Lcom/apollographql/cache/normalized/api/ResolverContext;)Ljava/lang/Object; } public final class com/apollographql/cache/normalized/api/DefaultEmbeddedFieldsProvider : com/apollographql/cache/normalized/api/EmbeddedFieldsProvider { @@ -294,7 +271,7 @@ public final class com/apollographql/cache/normalized/api/EmptyMetadataGenerator public final class com/apollographql/cache/normalized/api/ExpireDateCacheResolver : com/apollographql/cache/normalized/api/CacheResolver { public fun ()V - public fun resolveField (Lcom/apollographql/apollo/api/CompiledField;Lcom/apollographql/apollo/api/Executable$Variables;Ljava/util/Map;Ljava/lang/String;)Ljava/lang/Object; + public fun resolveField (Lcom/apollographql/cache/normalized/api/ResolverContext;)Ljava/lang/Object; } public final class com/apollographql/cache/normalized/api/FieldKeyContext { @@ -308,14 +285,9 @@ public abstract interface class com/apollographql/cache/normalized/api/FieldKeyG public abstract fun getFieldKey (Lcom/apollographql/cache/normalized/api/FieldKeyContext;)Ljava/lang/String; } -public final class com/apollographql/cache/normalized/api/FieldPolicyApolloResolver : com/apollographql/cache/normalized/api/ApolloResolver { - public static final field INSTANCE Lcom/apollographql/cache/normalized/api/FieldPolicyApolloResolver; - public fun resolveField (Lcom/apollographql/cache/normalized/api/ResolverContext;)Ljava/lang/Object; -} - public final class com/apollographql/cache/normalized/api/FieldPolicyCacheResolver : com/apollographql/cache/normalized/api/CacheResolver { public static final field INSTANCE Lcom/apollographql/cache/normalized/api/FieldPolicyCacheResolver; - public fun resolveField (Lcom/apollographql/apollo/api/CompiledField;Lcom/apollographql/apollo/api/Executable$Variables;Ljava/util/Map;Ljava/lang/String;)Ljava/lang/Object; + public fun resolveField (Lcom/apollographql/cache/normalized/api/ResolverContext;)Ljava/lang/Object; } public final class com/apollographql/cache/normalized/api/FieldRecordMerger : com/apollographql/cache/normalized/api/RecordMerger { @@ -402,19 +374,12 @@ public final class com/apollographql/cache/normalized/api/OperationCacheExtensio public static final fun normalize (Lcom/apollographql/apollo/api/Operation;Lcom/apollographql/apollo/api/Operation$Data;Lcom/apollographql/apollo/api/CustomScalarAdapters;Lcom/apollographql/cache/normalized/api/CacheKeyGenerator;Lcom/apollographql/cache/normalized/api/MetadataGenerator;Lcom/apollographql/cache/normalized/api/FieldKeyGenerator;Lcom/apollographql/cache/normalized/api/EmbeddedFieldsProvider;)Ljava/util/Map; public static synthetic fun normalize$default (Lcom/apollographql/apollo/api/Executable;Lcom/apollographql/apollo/api/Executable$Data;Lcom/apollographql/apollo/api/CustomScalarAdapters;Lcom/apollographql/cache/normalized/api/CacheKeyGenerator;Lcom/apollographql/cache/normalized/api/MetadataGenerator;Lcom/apollographql/cache/normalized/api/FieldKeyGenerator;Lcom/apollographql/cache/normalized/api/EmbeddedFieldsProvider;Ljava/lang/String;ILjava/lang/Object;)Ljava/util/Map; public static synthetic fun normalize$default (Lcom/apollographql/apollo/api/Operation;Lcom/apollographql/apollo/api/Operation$Data;Lcom/apollographql/apollo/api/CustomScalarAdapters;Lcom/apollographql/cache/normalized/api/CacheKeyGenerator;Lcom/apollographql/cache/normalized/api/MetadataGenerator;Lcom/apollographql/cache/normalized/api/FieldKeyGenerator;Lcom/apollographql/cache/normalized/api/EmbeddedFieldsProvider;ILjava/lang/Object;)Ljava/util/Map; - public static final fun readDataFromCache (Lcom/apollographql/apollo/api/Executable;Lcom/apollographql/apollo/api/CustomScalarAdapters;Lcom/apollographql/cache/normalized/api/ReadOnlyNormalizedCache;Lcom/apollographql/cache/normalized/api/ApolloResolver;Lcom/apollographql/cache/normalized/api/CacheHeaders;)Lcom/apollographql/apollo/api/Executable$Data; - public static final fun readDataFromCache (Lcom/apollographql/apollo/api/Executable;Lcom/apollographql/apollo/api/CustomScalarAdapters;Lcom/apollographql/cache/normalized/api/ReadOnlyNormalizedCache;Lcom/apollographql/cache/normalized/api/ApolloResolver;Lcom/apollographql/cache/normalized/api/CacheHeaders;Lcom/apollographql/cache/normalized/api/FieldKeyGenerator;)Lcom/apollographql/apollo/api/Executable$Data; public static final fun readDataFromCache (Lcom/apollographql/apollo/api/Executable;Lcom/apollographql/apollo/api/CustomScalarAdapters;Lcom/apollographql/cache/normalized/api/ReadOnlyNormalizedCache;Lcom/apollographql/cache/normalized/api/CacheResolver;Lcom/apollographql/cache/normalized/api/CacheHeaders;)Lcom/apollographql/apollo/api/Executable$Data; public static final fun readDataFromCache (Lcom/apollographql/apollo/api/Executable;Lcom/apollographql/apollo/api/CustomScalarAdapters;Lcom/apollographql/cache/normalized/api/ReadOnlyNormalizedCache;Lcom/apollographql/cache/normalized/api/CacheResolver;Lcom/apollographql/cache/normalized/api/CacheHeaders;Lcom/apollographql/cache/normalized/api/FieldKeyGenerator;)Lcom/apollographql/apollo/api/Executable$Data; - public static final fun readDataFromCache (Lcom/apollographql/apollo/api/Executable;Lcom/apollographql/cache/normalized/api/CacheKey;Lcom/apollographql/apollo/api/CustomScalarAdapters;Lcom/apollographql/cache/normalized/api/ReadOnlyNormalizedCache;Lcom/apollographql/cache/normalized/api/ApolloResolver;Lcom/apollographql/cache/normalized/api/CacheHeaders;)Lcom/apollographql/apollo/api/Executable$Data; - public static final fun readDataFromCache (Lcom/apollographql/apollo/api/Executable;Lcom/apollographql/cache/normalized/api/CacheKey;Lcom/apollographql/apollo/api/CustomScalarAdapters;Lcom/apollographql/cache/normalized/api/ReadOnlyNormalizedCache;Lcom/apollographql/cache/normalized/api/ApolloResolver;Lcom/apollographql/cache/normalized/api/CacheHeaders;Lcom/apollographql/cache/normalized/api/FieldKeyGenerator;)Lcom/apollographql/apollo/api/Executable$Data; public static final fun readDataFromCache (Lcom/apollographql/apollo/api/Executable;Lcom/apollographql/cache/normalized/api/CacheKey;Lcom/apollographql/apollo/api/CustomScalarAdapters;Lcom/apollographql/cache/normalized/api/ReadOnlyNormalizedCache;Lcom/apollographql/cache/normalized/api/CacheResolver;Lcom/apollographql/cache/normalized/api/CacheHeaders;)Lcom/apollographql/apollo/api/Executable$Data; public static final fun readDataFromCache (Lcom/apollographql/apollo/api/Executable;Lcom/apollographql/cache/normalized/api/CacheKey;Lcom/apollographql/apollo/api/CustomScalarAdapters;Lcom/apollographql/cache/normalized/api/ReadOnlyNormalizedCache;Lcom/apollographql/cache/normalized/api/CacheResolver;Lcom/apollographql/cache/normalized/api/CacheHeaders;Lcom/apollographql/cache/normalized/api/FieldKeyGenerator;)Lcom/apollographql/apollo/api/Executable$Data; - public static synthetic fun readDataFromCache$default (Lcom/apollographql/apollo/api/Executable;Lcom/apollographql/apollo/api/CustomScalarAdapters;Lcom/apollographql/cache/normalized/api/ReadOnlyNormalizedCache;Lcom/apollographql/cache/normalized/api/ApolloResolver;Lcom/apollographql/cache/normalized/api/CacheHeaders;Lcom/apollographql/cache/normalized/api/FieldKeyGenerator;ILjava/lang/Object;)Lcom/apollographql/apollo/api/Executable$Data; public static synthetic fun readDataFromCache$default (Lcom/apollographql/apollo/api/Executable;Lcom/apollographql/apollo/api/CustomScalarAdapters;Lcom/apollographql/cache/normalized/api/ReadOnlyNormalizedCache;Lcom/apollographql/cache/normalized/api/CacheResolver;Lcom/apollographql/cache/normalized/api/CacheHeaders;Lcom/apollographql/cache/normalized/api/FieldKeyGenerator;ILjava/lang/Object;)Lcom/apollographql/apollo/api/Executable$Data; - public static synthetic fun readDataFromCache$default (Lcom/apollographql/apollo/api/Executable;Lcom/apollographql/cache/normalized/api/CacheKey;Lcom/apollographql/apollo/api/CustomScalarAdapters;Lcom/apollographql/cache/normalized/api/ReadOnlyNormalizedCache;Lcom/apollographql/cache/normalized/api/ApolloResolver;Lcom/apollographql/cache/normalized/api/CacheHeaders;Lcom/apollographql/cache/normalized/api/FieldKeyGenerator;ILjava/lang/Object;)Lcom/apollographql/apollo/api/Executable$Data; public static synthetic fun readDataFromCache$default (Lcom/apollographql/apollo/api/Executable;Lcom/apollographql/cache/normalized/api/CacheKey;Lcom/apollographql/apollo/api/CustomScalarAdapters;Lcom/apollographql/cache/normalized/api/ReadOnlyNormalizedCache;Lcom/apollographql/cache/normalized/api/CacheResolver;Lcom/apollographql/cache/normalized/api/CacheHeaders;Lcom/apollographql/cache/normalized/api/FieldKeyGenerator;ILjava/lang/Object;)Lcom/apollographql/apollo/api/Executable$Data; - public static final fun readDataFromCacheInternal (Lcom/apollographql/apollo/api/Executable;Lcom/apollographql/cache/normalized/api/CacheKey;Lcom/apollographql/cache/normalized/api/ReadOnlyNormalizedCache;Lcom/apollographql/cache/normalized/api/ApolloResolver;Lcom/apollographql/cache/normalized/api/CacheHeaders;Lcom/apollographql/apollo/api/Executable$Variables;Lcom/apollographql/cache/normalized/api/FieldKeyGenerator;)Lcom/apollographql/cache/normalized/api/CacheData; public static final fun readDataFromCacheInternal (Lcom/apollographql/apollo/api/Executable;Lcom/apollographql/cache/normalized/api/CacheKey;Lcom/apollographql/cache/normalized/api/ReadOnlyNormalizedCache;Lcom/apollographql/cache/normalized/api/CacheResolver;Lcom/apollographql/cache/normalized/api/CacheHeaders;Lcom/apollographql/apollo/api/Executable$Variables;Lcom/apollographql/cache/normalized/api/FieldKeyGenerator;)Lcom/apollographql/cache/normalized/api/CacheData; public static final fun toData (Lcom/apollographql/cache/normalized/api/CacheData;Lcom/apollographql/apollo/api/Adapter;Lcom/apollographql/apollo/api/CustomScalarAdapters;Lcom/apollographql/apollo/api/Executable$Variables;)Lcom/apollographql/apollo/api/Executable$Data; } @@ -425,7 +390,7 @@ public abstract interface class com/apollographql/cache/normalized/api/ReadOnlyN public abstract fun loadRecords (Ljava/util/Collection;Lcom/apollographql/cache/normalized/api/CacheHeaders;)Ljava/util/Collection; } -public final class com/apollographql/cache/normalized/api/ReceiveDateApolloResolver : com/apollographql/cache/normalized/api/ApolloResolver { +public final class com/apollographql/cache/normalized/api/ReceiveDateCacheResolver : com/apollographql/cache/normalized/api/CacheResolver { public fun (I)V public fun resolveField (Lcom/apollographql/cache/normalized/api/ResolverContext;)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 93fcb0bd..611b4b18 100644 --- a/normalized-cache-incubating/api/normalized-cache-incubating.klib.api +++ b/normalized-cache-incubating/api/normalized-cache-incubating.klib.api @@ -6,17 +6,11 @@ // - Show declarations: true // Library unique name: -abstract class com.apollographql.cache.normalized.api/CacheKeyApolloResolver : com.apollographql.cache.normalized.api/ApolloResolver { // com.apollographql.cache.normalized.api/CacheKeyApolloResolver|null[0] - abstract fun cacheKeyForField(com.apollographql.cache.normalized.api/ResolverContext): com.apollographql.cache.normalized.api/CacheKey? // com.apollographql.cache.normalized.api/CacheKeyApolloResolver.cacheKeyForField|cacheKeyForField(com.apollographql.cache.normalized.api.ResolverContext){}[0] - constructor () // com.apollographql.cache.normalized.api/CacheKeyApolloResolver.|(){}[0] - final fun resolveField(com.apollographql.cache.normalized.api/ResolverContext): kotlin/Any? // com.apollographql.cache.normalized.api/CacheKeyApolloResolver.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/CacheKeyApolloResolver.listOfCacheKeysForField|listOfCacheKeysForField(com.apollographql.cache.normalized.api.ResolverContext){}[0] -} 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.apollo.api/CompiledField, com.apollographql.apollo.api/Executable.Variables): com.apollographql.cache.normalized.api/CacheKey? // com.apollographql.cache.normalized.api/CacheKeyResolver.cacheKeyForField|cacheKeyForField(com.apollographql.apollo.api.CompiledField;com.apollographql.apollo.api.Executable.Variables){}[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.apollo.api/CompiledField, com.apollographql.apollo.api/Executable.Variables, kotlin.collections/Map, kotlin/String): kotlin/Any? // com.apollographql.cache.normalized.api/CacheKeyResolver.resolveField|resolveField(com.apollographql.apollo.api.CompiledField;com.apollographql.apollo.api.Executable.Variables;kotlin.collections.Map;kotlin.String){}[0] - open fun listOfCacheKeysForField(com.apollographql.apollo.api/CompiledField, com.apollographql.apollo.api/Executable.Variables): kotlin.collections/List? // com.apollographql.cache.normalized.api/CacheKeyResolver.listOfCacheKeysForField|listOfCacheKeysForField(com.apollographql.apollo.api.CompiledField;com.apollographql.apollo.api.Executable.Variables){}[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] @@ -34,9 +28,6 @@ abstract interface <#A: kotlin/Any, #B: kotlin/Any> com.apollographql.cache.norm abstract fun putAll(kotlin.collections/Map<#A, #B>) // com.apollographql.cache.normalized.api.internal.store/Cache.putAll|putAll(kotlin.collections.Map<1:0,1:1>){}[0] abstract fun size(): kotlin/Long // com.apollographql.cache.normalized.api.internal.store/Cache.size|size(){}[0] } -abstract interface com.apollographql.cache.normalized.api/ApolloResolver { // com.apollographql.cache.normalized.api/ApolloResolver|null[0] - abstract fun resolveField(com.apollographql.cache.normalized.api/ResolverContext): kotlin/Any? // com.apollographql.cache.normalized.api/ApolloResolver.resolveField|resolveField(com.apollographql.cache.normalized.api.ResolverContext){}[0] -} abstract interface com.apollographql.cache.normalized.api/CacheData { // com.apollographql.cache.normalized.api/CacheData|null[0] abstract fun toMap(): kotlin.collections/Map // com.apollographql.cache.normalized.api/CacheData.toMap|toMap(){}[0] } @@ -44,7 +35,7 @@ abstract interface com.apollographql.cache.normalized.api/CacheKeyGenerator { // 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.apollo.api/CompiledField, com.apollographql.apollo.api/Executable.Variables, kotlin.collections/Map, kotlin/String): kotlin/Any? // com.apollographql.cache.normalized.api/CacheResolver.resolveField|resolveField(com.apollographql.apollo.api.CompiledField;com.apollographql.apollo.api.Executable.Variables;kotlin.collections.Map;kotlin.String){}[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] } 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] @@ -184,7 +175,7 @@ final class com.apollographql.cache.normalized.api/EmbeddedFieldsContext { // co } final class com.apollographql.cache.normalized.api/ExpireDateCacheResolver : com.apollographql.cache.normalized.api/CacheResolver { // com.apollographql.cache.normalized.api/ExpireDateCacheResolver|null[0] constructor () // com.apollographql.cache.normalized.api/ExpireDateCacheResolver.|(){}[0] - final fun resolveField(com.apollographql.apollo.api/CompiledField, com.apollographql.apollo.api/Executable.Variables, kotlin.collections/Map, kotlin/String): kotlin/Any? // com.apollographql.cache.normalized.api/ExpireDateCacheResolver.resolveField|resolveField(com.apollographql.apollo.api.CompiledField;com.apollographql.apollo.api.Executable.Variables;kotlin.collections.Map;kotlin.String){}[0] + final fun resolveField(com.apollographql.cache.normalized.api/ResolverContext): kotlin/Any? // com.apollographql.cache.normalized.api/ExpireDateCacheResolver.resolveField|resolveField(com.apollographql.cache.normalized.api.ResolverContext){}[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] @@ -242,9 +233,9 @@ final class com.apollographql.cache.normalized.api/MetadataGeneratorContext { // 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 class com.apollographql.cache.normalized.api/ReceiveDateApolloResolver : com.apollographql.cache.normalized.api/ApolloResolver { // com.apollographql.cache.normalized.api/ReceiveDateApolloResolver|null[0] - constructor (kotlin/Int) // com.apollographql.cache.normalized.api/ReceiveDateApolloResolver.|(kotlin.Int){}[0] - final fun resolveField(com.apollographql.cache.normalized.api/ResolverContext): kotlin/Any? // com.apollographql.cache.normalized.api/ReceiveDateApolloResolver.resolveField|resolveField(com.apollographql.cache.normalized.api.ResolverContext){}[0] +final class com.apollographql.cache.normalized.api/ReceiveDateCacheResolver : com.apollographql.cache.normalized.api/CacheResolver { // com.apollographql.cache.normalized.api/ReceiveDateCacheResolver|null[0] + constructor (kotlin/Int) // com.apollographql.cache.normalized.api/ReceiveDateCacheResolver.|(kotlin.Int){}[0] + final fun resolveField(com.apollographql.cache.normalized.api/ResolverContext): kotlin/Any? // com.apollographql.cache.normalized.api/ReceiveDateCacheResolver.resolveField|resolveField(com.apollographql.cache.normalized.api.ResolverContext){}[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? = ...) // com.apollographql.cache.normalized.api/Record.|(kotlin.String;kotlin.collections.Map;com.benasher44.uuid.Uuid?){}[0] @@ -357,16 +348,12 @@ final enum class com.apollographql.cache.normalized/FetchPolicy : kotlin/Enum(): 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/CacheResolver = ..., 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.CacheResolver;kotlin.Boolean){}[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/ApolloResolver = ..., 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.ApolloResolver;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/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 (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 <#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/ApolloResolver, 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.ApolloResolver;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.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/ApolloResolver, 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.ApolloResolver;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/Executable.Data> (com.apollographql.apollo.api/Executable<#A>).com.apollographql.cache.normalized.api/readDataFromCacheInternal(com.apollographql.cache.normalized.api/CacheKey, com.apollographql.cache.normalized.api/ReadOnlyNormalizedCache, com.apollographql.cache.normalized.api/ApolloResolver, com.apollographql.cache.normalized.api/CacheHeaders, com.apollographql.apollo.api/Executable.Variables, com.apollographql.cache.normalized.api/FieldKeyGenerator): com.apollographql.cache.normalized.api/CacheData // com.apollographql.cache.normalized.api/readDataFromCacheInternal|readDataFromCacheInternal@com.apollographql.apollo.api.Executable<0:0>(com.apollographql.cache.normalized.api.CacheKey;com.apollographql.cache.normalized.api.ReadOnlyNormalizedCache;com.apollographql.cache.normalized.api.ApolloResolver;com.apollographql.cache.normalized.api.CacheHeaders;com.apollographql.apollo.api.Executable.Variables;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/readDataFromCacheInternal(com.apollographql.cache.normalized.api/CacheKey, com.apollographql.cache.normalized.api/ReadOnlyNormalizedCache, com.apollographql.cache.normalized.api/CacheResolver, com.apollographql.cache.normalized.api/CacheHeaders, com.apollographql.apollo.api/Executable.Variables, com.apollographql.cache.normalized.api/FieldKeyGenerator): com.apollographql.cache.normalized.api/CacheData // com.apollographql.cache.normalized.api/readDataFromCacheInternal|readDataFromCacheInternal@com.apollographql.apollo.api.Executable<0:0>(com.apollographql.cache.normalized.api.CacheKey;com.apollographql.cache.normalized.api.ReadOnlyNormalizedCache;com.apollographql.cache.normalized.api.CacheResolver;com.apollographql.cache.normalized.api.CacheHeaders;com.apollographql.apollo.api.Executable.Variables;com.apollographql.cache.normalized.api.FieldKeyGenerator){0§}[0] final fun <#A: com.apollographql.apollo.api/Executable.Data> (com.apollographql.cache.normalized.api/CacheData).com.apollographql.cache.normalized.api/toData(com.apollographql.apollo.api/Adapter<#A>, com.apollographql.apollo.api/CustomScalarAdapters, com.apollographql.apollo.api/Executable.Variables): #A // com.apollographql.cache.normalized.api/toData|toData@com.apollographql.cache.normalized.api.CacheData(com.apollographql.apollo.api.Adapter<0:0>;com.apollographql.apollo.api.CustomScalarAdapters;com.apollographql.apollo.api.Executable.Variables){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] @@ -390,8 +377,7 @@ final fun <#A: kotlin/Any?> (com.apollographql.apollo.api/MutableExecutionOption 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/CacheResolver = ...): 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.CacheResolver){}[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/ApolloResolver = ..., 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.ApolloResolver;com.apollographql.cache.normalized.api.RecordMerger;com.apollographql.cache.normalized.api.FieldKeyGenerator;com.apollographql.cache.normalized.api.EmbeddedFieldsProvider){}[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.internal/BlobRecordSerializer { // com.apollographql.cache.normalized.api.internal/BlobRecordSerializer|null[0] final fun deserialize(kotlin/String, kotlin/ByteArray): com.apollographql.cache.normalized.api/Record // com.apollographql.cache.normalized.api.internal/BlobRecordSerializer.deserialize|deserialize(kotlin.String;kotlin.ByteArray){}[0] final fun serialize(com.apollographql.cache.normalized.api/Record): kotlin/ByteArray // com.apollographql.cache.normalized.api.internal/BlobRecordSerializer.serialize|serialize(com.apollographql.cache.normalized.api.Record){}[0] @@ -412,11 +398,8 @@ final object com.apollographql.cache.normalized.api/ApolloCacheHeaders { // com. final const val MEMORY_CACHE_ONLY // com.apollographql.cache.normalized.api/ApolloCacheHeaders.MEMORY_CACHE_ONLY|{}MEMORY_CACHE_ONLY[0] final fun (): kotlin/String // com.apollographql.cache.normalized.api/ApolloCacheHeaders.MEMORY_CACHE_ONLY.|(){}[0] } -final object com.apollographql.cache.normalized.api/DefaultApolloResolver : com.apollographql.cache.normalized.api/ApolloResolver { // com.apollographql.cache.normalized.api/DefaultApolloResolver|null[0] - final fun resolveField(com.apollographql.cache.normalized.api/ResolverContext): kotlin/Any? // com.apollographql.cache.normalized.api/DefaultApolloResolver.resolveField|resolveField(com.apollographql.cache.normalized.api.ResolverContext){}[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.apollo.api/CompiledField, com.apollographql.apollo.api/Executable.Variables, kotlin.collections/Map, kotlin/String): kotlin/Any? // com.apollographql.cache.normalized.api/DefaultCacheResolver.resolveField|resolveField(com.apollographql.apollo.api.CompiledField;com.apollographql.apollo.api.Executable.Variables;kotlin.collections.Map;kotlin.String){}[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] @@ -430,11 +413,8 @@ final object com.apollographql.cache.normalized.api/DefaultRecordMerger : com.ap 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/FieldPolicyApolloResolver : com.apollographql.cache.normalized.api/ApolloResolver { // com.apollographql.cache.normalized.api/FieldPolicyApolloResolver|null[0] - final fun resolveField(com.apollographql.cache.normalized.api/ResolverContext): kotlin/Any? // com.apollographql.cache.normalized.api/FieldPolicyApolloResolver.resolveField|resolveField(com.apollographql.cache.normalized.api.ResolverContext){}[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.apollo.api/CompiledField, com.apollographql.apollo.api/Executable.Variables, kotlin.collections/Map, kotlin/String): kotlin/Any? // com.apollographql.cache.normalized.api/FieldPolicyCacheResolver.resolveField|resolveField(com.apollographql.apollo.api.CompiledField;com.apollographql.apollo.api.Executable.Variables;kotlin.collections.Map;kotlin.String){}[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] 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 fa2ce59a..67d9e3d4 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 @@ -5,17 +5,17 @@ import com.apollographql.apollo.api.CustomScalarAdapters import com.apollographql.apollo.api.Fragment import com.apollographql.apollo.api.Operation import com.apollographql.apollo.interceptor.ApolloInterceptor -import com.apollographql.cache.normalized.api.ApolloResolver import com.apollographql.cache.normalized.api.CacheHeaders import com.apollographql.cache.normalized.api.CacheKey import com.apollographql.cache.normalized.api.CacheKeyGenerator +import com.apollographql.cache.normalized.api.CacheResolver import com.apollographql.cache.normalized.api.DefaultEmbeddedFieldsProvider import com.apollographql.cache.normalized.api.DefaultFieldKeyGenerator import com.apollographql.cache.normalized.api.DefaultRecordMerger import com.apollographql.cache.normalized.api.EmbeddedFieldsProvider import com.apollographql.cache.normalized.api.EmptyMetadataGenerator import com.apollographql.cache.normalized.api.FieldKeyGenerator -import com.apollographql.cache.normalized.api.FieldPolicyApolloResolver +import com.apollographql.cache.normalized.api.FieldPolicyCacheResolver import com.apollographql.cache.normalized.api.MetadataGenerator import com.apollographql.cache.normalized.api.NormalizedCache import com.apollographql.cache.normalized.api.NormalizedCacheFactory @@ -207,7 +207,7 @@ fun ApolloStore( normalizedCacheFactory: NormalizedCacheFactory, cacheKeyGenerator: CacheKeyGenerator = TypePolicyCacheKeyGenerator, metadataGenerator: MetadataGenerator = EmptyMetadataGenerator, - apolloResolver: ApolloResolver = FieldPolicyApolloResolver, + cacheResolver: CacheResolver = FieldPolicyCacheResolver, recordMerger: RecordMerger = DefaultRecordMerger, fieldKeyGenerator: FieldKeyGenerator = DefaultFieldKeyGenerator, embeddedFieldsProvider: EmbeddedFieldsProvider = DefaultEmbeddedFieldsProvider, @@ -215,7 +215,7 @@ fun ApolloStore( normalizedCacheFactory = normalizedCacheFactory, cacheKeyGenerator = cacheKeyGenerator, metadataGenerator = metadataGenerator, - cacheResolver = apolloResolver, + cacheResolver = cacheResolver, recordMerger = recordMerger, fieldKeyGenerator = fieldKeyGenerator, embeddedFieldsProvider = embeddedFieldsProvider, 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 777a0886..3cc2b264 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 @@ -23,16 +23,16 @@ import com.apollographql.apollo.interceptor.AutoPersistedQueryInterceptor import com.apollographql.apollo.mpp.currentTimeMillis import com.apollographql.apollo.network.http.HttpInfo import com.apollographql.cache.normalized.api.ApolloCacheHeaders -import com.apollographql.cache.normalized.api.ApolloResolver import com.apollographql.cache.normalized.api.CacheHeaders import com.apollographql.cache.normalized.api.CacheKeyGenerator +import com.apollographql.cache.normalized.api.CacheResolver import com.apollographql.cache.normalized.api.DefaultEmbeddedFieldsProvider import com.apollographql.cache.normalized.api.DefaultFieldKeyGenerator import com.apollographql.cache.normalized.api.DefaultRecordMerger import com.apollographql.cache.normalized.api.EmbeddedFieldsProvider import com.apollographql.cache.normalized.api.EmptyMetadataGenerator import com.apollographql.cache.normalized.api.FieldKeyGenerator -import com.apollographql.cache.normalized.api.FieldPolicyApolloResolver +import com.apollographql.cache.normalized.api.FieldPolicyCacheResolver import com.apollographql.cache.normalized.api.MetadataGenerator import com.apollographql.cache.normalized.api.NormalizedCacheFactory import com.apollographql.cache.normalized.api.RecordMerger @@ -111,7 +111,7 @@ fun ApolloClient.Builder.normalizedCache( normalizedCacheFactory: NormalizedCacheFactory, cacheKeyGenerator: CacheKeyGenerator = TypePolicyCacheKeyGenerator, metadataGenerator: MetadataGenerator = EmptyMetadataGenerator, - apolloResolver: ApolloResolver = FieldPolicyApolloResolver, + cacheResolver: CacheResolver = FieldPolicyCacheResolver, recordMerger: RecordMerger = DefaultRecordMerger, fieldKeyGenerator: FieldKeyGenerator = DefaultFieldKeyGenerator, embeddedFieldsProvider: EmbeddedFieldsProvider = DefaultEmbeddedFieldsProvider, @@ -122,7 +122,7 @@ fun ApolloClient.Builder.normalizedCache( normalizedCacheFactory = normalizedCacheFactory, cacheKeyGenerator = cacheKeyGenerator, metadataGenerator = metadataGenerator, - apolloResolver = apolloResolver, + cacheResolver = cacheResolver, recordMerger = recordMerger, fieldKeyGenerator = fieldKeyGenerator, embeddedFieldsProvider = embeddedFieldsProvider diff --git a/normalized-cache-incubating/src/commonMain/kotlin/com/apollographql/cache/normalized/api/CacheKeyResolver.kt b/normalized-cache-incubating/src/commonMain/kotlin/com/apollographql/cache/normalized/api/CacheKeyResolver.kt index f02aea98..905cc6b1 100644 --- a/normalized-cache-incubating/src/commonMain/kotlin/com/apollographql/cache/normalized/api/CacheKeyResolver.kt +++ b/normalized-cache-incubating/src/commonMain/kotlin/com/apollographql/cache/normalized/api/CacheKeyResolver.kt @@ -6,15 +6,15 @@ import com.apollographql.apollo.api.CompiledNotNullType import com.apollographql.apollo.api.isComposite /** - * An [ApolloResolver] that resolves objects and list of objects and falls back to the default resolver for scalar fields. - * It is intended to simplify the usage of [ApolloResolver] when no special handling is needed for scalar fields. + * An [CacheResolver] that resolves objects and list of objects and falls back to the default resolver for scalar fields. + * It is intended to simplify the usage of [CacheResolver] when no special handling is needed for scalar fields. * * Override [cacheKeyForField] to compute a cache key for a field of composite type. * Override [listOfCacheKeysForField] to compute a list of cache keys for a field of 'list-of-composite' type. * - * For simplicity, this only handles one level of lists. Implement [ApolloResolver] if you need arbitrary nested lists of objects. + * For simplicity, this only handles one level of lists. Implement [CacheResolver] if you need arbitrary nested lists of objects. */ -abstract class CacheKeyApolloResolver : ApolloResolver { +abstract class CacheKeyResolver : CacheResolver { /** * Returns the computed cache key for a composite field. * @@ -63,6 +63,6 @@ abstract class CacheKeyApolloResolver : ApolloResolver { } } - return DefaultApolloResolver.resolveField(context) + return DefaultCacheResolver.resolveField(context) } } diff --git a/normalized-cache-incubating/src/commonMain/kotlin/com/apollographql/cache/normalized/api/CacheResolver.kt b/normalized-cache-incubating/src/commonMain/kotlin/com/apollographql/cache/normalized/api/CacheResolver.kt index 70f4ff9d..22401bfb 100644 --- a/normalized-cache-incubating/src/commonMain/kotlin/com/apollographql/cache/normalized/api/CacheResolver.kt +++ b/normalized-cache-incubating/src/commonMain/kotlin/com/apollographql/cache/normalized/api/CacheResolver.kt @@ -9,7 +9,7 @@ import kotlin.jvm.JvmSuppressWildcards /** * Controls how fields are resolved from the cache. */ -interface ApolloResolver { +interface CacheResolver { /** * Resolves a field from the cache. Called when reading from the cache, usually before a network request. * - takes a GraphQL field and operation variables as input and generates data for this field @@ -109,7 +109,7 @@ class ResolverContext( /** * A cache resolver that uses the parent to resolve fields. */ -object DefaultApolloResolver : ApolloResolver { +object DefaultCacheResolver : CacheResolver { override fun resolveField(context: ResolverContext): Any? { val fieldKey = context.fieldKeyGenerator.getFieldKey(FieldKeyContext(context.parentType, context.field, context.variables)) if (!context.parent.containsKey(fieldKey)) { @@ -123,7 +123,7 @@ object DefaultApolloResolver : ApolloResolver { /** * A cache resolver that uses the cache date as a receive date and expires after a fixed max age */ -class ReceiveDateApolloResolver(private val maxAge: Int) : ApolloResolver { +class ReceiveDateCacheResolver(private val maxAge: Int) : CacheResolver { override fun resolveField(context: ResolverContext): Any? { val parent = context.parent val parentKey = context.parentKey @@ -153,7 +153,7 @@ class ReceiveDateApolloResolver(private val maxAge: Int) : ApolloResolver { /** * A cache resolver that uses the cache date as an expiration date and expires past it */ -class ExpireDateCacheResolver : ApolloResolver { +class ExpireDateCacheResolver : CacheResolver { override fun resolveField(context: ResolverContext): Any? { val parent = context.parent val parentKey = context.parentKey @@ -177,9 +177,9 @@ class ExpireDateCacheResolver : ApolloResolver { } /** - * A cache resolver that uses `@fieldPolicy` annotations to resolve fields and delegates to [DefaultApolloResolver] otherwise + * A cache resolver that uses `@fieldPolicy` annotations to resolve fields and delegates to [DefaultCacheResolver] otherwise */ -object FieldPolicyApolloResolver : ApolloResolver { +object FieldPolicyCacheResolver : CacheResolver { override fun resolveField(context: ResolverContext): Any? { val keyArgsValues = context.field.argumentValues(context.variables) { it.definition.isKey }.values.map { it.toString() } @@ -187,6 +187,6 @@ object FieldPolicyApolloResolver : ApolloResolver { return CacheKey(context.field.type.rawType().name, keyArgsValues) } - return DefaultApolloResolver.resolveField(context) + return DefaultCacheResolver.resolveField(context) } } 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 6acbdd6e..9c24f110 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 @@ -43,7 +43,7 @@ fun Executable.normalize( fun Executable.readDataFromCache( customScalarAdapters: CustomScalarAdapters, cache: ReadOnlyNormalizedCache, - cacheResolver: ApolloResolver, + cacheResolver: CacheResolver, cacheHeaders: CacheHeaders, fieldKeyGenerator: FieldKeyGenerator = DefaultFieldKeyGenerator, ): D { @@ -63,7 +63,7 @@ fun Executable.readDataFromCache( cacheKey: CacheKey, customScalarAdapters: CustomScalarAdapters, cache: ReadOnlyNormalizedCache, - cacheResolver: ApolloResolver, + cacheResolver: CacheResolver, cacheHeaders: CacheHeaders, fieldKeyGenerator: FieldKeyGenerator = DefaultFieldKeyGenerator, ): D { @@ -82,7 +82,7 @@ fun Executable.readDataFromCache( fun Executable.readDataFromCacheInternal( cacheKey: CacheKey, cache: ReadOnlyNormalizedCache, - cacheResolver: ApolloResolver, + cacheResolver: CacheResolver, cacheHeaders: CacheHeaders, variables: Executable.Variables, fieldKeyGenerator: FieldKeyGenerator, @@ -99,7 +99,7 @@ fun Executable.readDataFromCacheInternal( private fun Executable.readInternal( cacheKey: CacheKey, cache: ReadOnlyNormalizedCache, - cacheResolver: ApolloResolver, + cacheResolver: CacheResolver, cacheHeaders: CacheHeaders, variables: Executable.Variables, fieldKeyGenerator: FieldKeyGenerator, diff --git a/normalized-cache-incubating/src/commonMain/kotlin/com/apollographql/cache/normalized/api/internal/CacheBatchReader.kt b/normalized-cache-incubating/src/commonMain/kotlin/com/apollographql/cache/normalized/api/internal/CacheBatchReader.kt index 5eb44830..eced4955 100644 --- a/normalized-cache-incubating/src/commonMain/kotlin/com/apollographql/cache/normalized/api/internal/CacheBatchReader.kt +++ b/normalized-cache-incubating/src/commonMain/kotlin/com/apollographql/cache/normalized/api/internal/CacheBatchReader.kt @@ -5,10 +5,10 @@ import com.apollographql.apollo.api.CompiledFragment import com.apollographql.apollo.api.CompiledSelection import com.apollographql.apollo.api.Executable import com.apollographql.apollo.exception.CacheMissException -import com.apollographql.cache.normalized.api.ApolloResolver import com.apollographql.cache.normalized.api.CacheData import com.apollographql.cache.normalized.api.CacheHeaders import com.apollographql.cache.normalized.api.CacheKey +import com.apollographql.cache.normalized.api.CacheResolver import com.apollographql.cache.normalized.api.FieldKeyGenerator import com.apollographql.cache.normalized.api.ReadOnlyNormalizedCache import com.apollographql.cache.normalized.api.Record @@ -25,7 +25,7 @@ internal class CacheBatchReader( private val cache: ReadOnlyNormalizedCache, private val rootKey: String, private val variables: Executable.Variables, - private val cacheResolver: ApolloResolver, + private val cacheResolver: CacheResolver, private val cacheHeaders: CacheHeaders, private val rootSelections: List, private val rootTypename: String, 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 5f366338..df46f8a4 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 @@ -5,10 +5,10 @@ import com.apollographql.apollo.api.Fragment import com.apollographql.apollo.api.Operation import com.apollographql.apollo.api.variables import com.apollographql.cache.normalized.ApolloStore -import com.apollographql.cache.normalized.api.ApolloResolver import com.apollographql.cache.normalized.api.CacheHeaders import com.apollographql.cache.normalized.api.CacheKey import com.apollographql.cache.normalized.api.CacheKeyGenerator +import com.apollographql.cache.normalized.api.CacheResolver import com.apollographql.cache.normalized.api.EmbeddedFieldsProvider import com.apollographql.cache.normalized.api.FieldKeyGenerator import com.apollographql.cache.normalized.api.MetadataGenerator @@ -31,7 +31,7 @@ internal class DefaultApolloStore( private val cacheKeyGenerator: CacheKeyGenerator, private val fieldKeyGenerator: FieldKeyGenerator, private val metadataGenerator: MetadataGenerator, - private val cacheResolver: ApolloResolver, + private val cacheResolver: CacheResolver, private val recordMerger: RecordMerger, private val embeddedFieldsProvider: EmbeddedFieldsProvider, ) : ApolloStore { diff --git a/normalized-cache-incubating/src/commonTest/kotlin/com/apollographql/cache/normalized/CacheKeyApolloResolverTest.kt b/normalized-cache-incubating/src/commonTest/kotlin/com/apollographql/cache/normalized/CacheKeyResolverTest.kt similarity index 87% rename from normalized-cache-incubating/src/commonTest/kotlin/com/apollographql/cache/normalized/CacheKeyApolloResolverTest.kt rename to normalized-cache-incubating/src/commonTest/kotlin/com/apollographql/cache/normalized/CacheKeyResolverTest.kt index 0fd966f1..4106e09a 100644 --- a/normalized-cache-incubating/src/commonTest/kotlin/com/apollographql/cache/normalized/CacheKeyApolloResolverTest.kt +++ b/normalized-cache-incubating/src/commonTest/kotlin/com/apollographql/cache/normalized/CacheKeyResolverTest.kt @@ -5,11 +5,11 @@ import com.apollographql.apollo.api.CompiledListType import com.apollographql.apollo.api.Executable import com.apollographql.apollo.api.ObjectType import com.apollographql.apollo.exception.CacheMissException -import com.apollographql.cache.normalized.CacheKeyApolloResolverTest.Fixtures.TEST_LIST_FIELD -import com.apollographql.cache.normalized.CacheKeyApolloResolverTest.Fixtures.TEST_SIMPLE_FIELD +import com.apollographql.cache.normalized.CacheKeyResolverTest.Fixtures.TEST_LIST_FIELD +import com.apollographql.cache.normalized.CacheKeyResolverTest.Fixtures.TEST_SIMPLE_FIELD import com.apollographql.cache.normalized.api.CacheHeaders import com.apollographql.cache.normalized.api.CacheKey -import com.apollographql.cache.normalized.api.CacheKeyApolloResolver +import com.apollographql.cache.normalized.api.CacheKeyResolver import com.apollographql.cache.normalized.api.DefaultFieldKeyGenerator import com.apollographql.cache.normalized.api.ResolverContext import kotlin.test.BeforeTest @@ -19,15 +19,15 @@ import kotlin.test.assertFailsWith import kotlin.test.fail -class CacheKeyApolloResolverTest { +class CacheKeyResolverTest { - private lateinit var subject: CacheKeyApolloResolver + private lateinit var subject: CacheKeyResolver lateinit var onCacheKeyForField: (context: ResolverContext) -> CacheKey? lateinit var onListOfCacheKeysForField: (context: ResolverContext) -> List? @BeforeTest fun setup() { - subject = FakeCacheKeyApolloResolver() + subject = FakeCacheKeyResolver() onCacheKeyForField = { _ -> fail("Unexpected call to cacheKeyForField") } @@ -85,7 +85,7 @@ class CacheKeyApolloResolverTest { } } - inner class FakeCacheKeyApolloResolver : CacheKeyApolloResolver() { + inner class FakeCacheKeyResolver : CacheKeyResolver() { override fun cacheKeyForField(context: ResolverContext): CacheKey? { return onCacheKeyForField(context) diff --git a/tests/pagination/src/commonTest/kotlin/ConnectionPaginationTest.kt b/tests/pagination/src/commonTest/kotlin/ConnectionPaginationTest.kt index fa81b6a5..1d72c24a 100644 --- a/tests/pagination/src/commonTest/kotlin/ConnectionPaginationTest.kt +++ b/tests/pagination/src/commonTest/kotlin/ConnectionPaginationTest.kt @@ -5,7 +5,7 @@ import com.apollographql.apollo.testing.internal.runTest import com.apollographql.cache.normalized.ApolloStore import com.apollographql.cache.normalized.api.ConnectionMetadataGenerator import com.apollographql.cache.normalized.api.ConnectionRecordMerger -import com.apollographql.cache.normalized.api.FieldPolicyApolloResolver +import com.apollographql.cache.normalized.api.FieldPolicyCacheResolver import com.apollographql.cache.normalized.api.MemoryCacheFactory import com.apollographql.cache.normalized.api.NormalizedCacheFactory import com.apollographql.cache.normalized.api.TypePolicyCacheKeyGenerator @@ -45,7 +45,7 @@ class ConnectionPaginationTest { normalizedCacheFactory = cacheFactory, cacheKeyGenerator = TypePolicyCacheKeyGenerator, metadataGenerator = ConnectionMetadataGenerator(Pagination.connectionTypes), - apolloResolver = FieldPolicyApolloResolver, + cacheResolver = FieldPolicyCacheResolver, recordMerger = ConnectionRecordMerger ) apolloStore.clearAll() diff --git a/tests/pagination/src/commonTest/kotlin/ConnectionProgrammaticPaginationTest.kt b/tests/pagination/src/commonTest/kotlin/ConnectionProgrammaticPaginationTest.kt index 770c1974..cd162991 100644 --- a/tests/pagination/src/commonTest/kotlin/ConnectionProgrammaticPaginationTest.kt +++ b/tests/pagination/src/commonTest/kotlin/ConnectionProgrammaticPaginationTest.kt @@ -7,7 +7,7 @@ import com.apollographql.cache.normalized.api.ConnectionEmbeddedFieldsProvider import com.apollographql.cache.normalized.api.ConnectionFieldKeyGenerator import com.apollographql.cache.normalized.api.ConnectionMetadataGenerator import com.apollographql.cache.normalized.api.ConnectionRecordMerger -import com.apollographql.cache.normalized.api.FieldPolicyApolloResolver +import com.apollographql.cache.normalized.api.FieldPolicyCacheResolver import com.apollographql.cache.normalized.api.MemoryCacheFactory import com.apollographql.cache.normalized.api.NormalizedCacheFactory import com.apollographql.cache.normalized.api.TypePolicyCacheKeyGenerator @@ -50,7 +50,7 @@ class ConnectionProgrammaticPaginationTest { normalizedCacheFactory = cacheFactory, cacheKeyGenerator = TypePolicyCacheKeyGenerator, metadataGenerator = ConnectionMetadataGenerator(connectionTypes), - apolloResolver = FieldPolicyApolloResolver, + cacheResolver = FieldPolicyCacheResolver, recordMerger = ConnectionRecordMerger, fieldKeyGenerator = ConnectionFieldKeyGenerator(connectionFields), embeddedFieldsProvider = ConnectionEmbeddedFieldsProvider( diff --git a/tests/pagination/src/commonTest/kotlin/ConnectionWithNodesPaginationTest.kt b/tests/pagination/src/commonTest/kotlin/ConnectionWithNodesPaginationTest.kt index 2aed88f4..a543d2f5 100644 --- a/tests/pagination/src/commonTest/kotlin/ConnectionWithNodesPaginationTest.kt +++ b/tests/pagination/src/commonTest/kotlin/ConnectionWithNodesPaginationTest.kt @@ -5,7 +5,7 @@ import com.apollographql.apollo.testing.internal.runTest import com.apollographql.cache.normalized.ApolloStore import com.apollographql.cache.normalized.api.ConnectionMetadataGenerator import com.apollographql.cache.normalized.api.ConnectionRecordMerger -import com.apollographql.cache.normalized.api.FieldPolicyApolloResolver +import com.apollographql.cache.normalized.api.FieldPolicyCacheResolver import com.apollographql.cache.normalized.api.MemoryCacheFactory import com.apollographql.cache.normalized.api.NormalizedCacheFactory import com.apollographql.cache.normalized.api.TypePolicyCacheKeyGenerator @@ -44,7 +44,7 @@ class ConnectionWithNodesPaginationTest { normalizedCacheFactory = cacheFactory, cacheKeyGenerator = TypePolicyCacheKeyGenerator, metadataGenerator = ConnectionMetadataGenerator(Pagination.connectionTypes), - apolloResolver = FieldPolicyApolloResolver, + cacheResolver = FieldPolicyCacheResolver, recordMerger = ConnectionRecordMerger ) apolloStore.clearAll() diff --git a/tests/pagination/src/commonTest/kotlin/CursorBasedPaginationTest.kt b/tests/pagination/src/commonTest/kotlin/CursorBasedPaginationTest.kt index 0b0e6a77..57d6235f 100644 --- a/tests/pagination/src/commonTest/kotlin/CursorBasedPaginationTest.kt +++ b/tests/pagination/src/commonTest/kotlin/CursorBasedPaginationTest.kt @@ -9,7 +9,7 @@ import com.apollographql.cache.normalized.ApolloStore import com.apollographql.cache.normalized.FetchPolicy import com.apollographql.cache.normalized.api.ConnectionMetadataGenerator import com.apollographql.cache.normalized.api.ConnectionRecordMerger -import com.apollographql.cache.normalized.api.FieldPolicyApolloResolver +import com.apollographql.cache.normalized.api.FieldPolicyCacheResolver import com.apollographql.cache.normalized.api.MemoryCacheFactory import com.apollographql.cache.normalized.api.NormalizedCacheFactory import com.apollographql.cache.normalized.api.TypePolicyCacheKeyGenerator @@ -52,7 +52,7 @@ class CursorBasedPaginationTest { normalizedCacheFactory = cacheFactory, cacheKeyGenerator = TypePolicyCacheKeyGenerator, metadataGenerator = ConnectionMetadataGenerator(setOf("UserConnection")), - apolloResolver = FieldPolicyApolloResolver, + cacheResolver = FieldPolicyCacheResolver, recordMerger = ConnectionRecordMerger ) apolloStore.clearAll() @@ -365,7 +365,7 @@ class CursorBasedPaginationTest { normalizedCacheFactory = MemoryCacheFactory(), cacheKeyGenerator = TypePolicyCacheKeyGenerator, metadataGenerator = ConnectionMetadataGenerator(setOf("UserConnection")), - apolloResolver = FieldPolicyApolloResolver, + cacheResolver = FieldPolicyCacheResolver, recordMerger = ConnectionRecordMerger ) .build() diff --git a/tests/pagination/src/commonTest/kotlin/OffsetBasedWithArrayPaginationTest.kt b/tests/pagination/src/commonTest/kotlin/OffsetBasedWithArrayPaginationTest.kt index f421888d..0d6375de 100644 --- a/tests/pagination/src/commonTest/kotlin/OffsetBasedWithArrayPaginationTest.kt +++ b/tests/pagination/src/commonTest/kotlin/OffsetBasedWithArrayPaginationTest.kt @@ -4,7 +4,7 @@ import com.apollographql.apollo.api.Optional import com.apollographql.apollo.api.json.ApolloJsonElement import com.apollographql.apollo.testing.internal.runTest import com.apollographql.cache.normalized.ApolloStore -import com.apollographql.cache.normalized.api.FieldPolicyApolloResolver +import com.apollographql.cache.normalized.api.FieldPolicyCacheResolver import com.apollographql.cache.normalized.api.FieldRecordMerger import com.apollographql.cache.normalized.api.MemoryCacheFactory import com.apollographql.cache.normalized.api.MetadataGenerator @@ -45,7 +45,7 @@ class OffsetBasedWithArrayPaginationTest { normalizedCacheFactory = cacheFactory, cacheKeyGenerator = TypePolicyCacheKeyGenerator, metadataGenerator = OffsetPaginationMetadataGenerator("users"), - apolloResolver = FieldPolicyApolloResolver, + cacheResolver = FieldPolicyCacheResolver, recordMerger = FieldRecordMerger(OffsetPaginationFieldMerger()) ) apolloStore.clearAll() diff --git a/tests/pagination/src/commonTest/kotlin/OffsetBasedWithPageAndInputPaginationTest.kt b/tests/pagination/src/commonTest/kotlin/OffsetBasedWithPageAndInputPaginationTest.kt index e6edfb58..b37005ba 100644 --- a/tests/pagination/src/commonTest/kotlin/OffsetBasedWithPageAndInputPaginationTest.kt +++ b/tests/pagination/src/commonTest/kotlin/OffsetBasedWithPageAndInputPaginationTest.kt @@ -5,11 +5,12 @@ import com.apollographql.apollo.api.CompiledField import com.apollographql.apollo.api.Executable import com.apollographql.apollo.api.Optional import com.apollographql.apollo.api.json.ApolloJsonElement +import com.apollographql.apollo.testing.internal.runTest import com.apollographql.cache.normalized.ApolloStore import com.apollographql.cache.normalized.api.DefaultFieldKeyGenerator import com.apollographql.cache.normalized.api.FieldKeyContext import com.apollographql.cache.normalized.api.FieldKeyGenerator -import com.apollographql.cache.normalized.api.FieldPolicyApolloResolver +import com.apollographql.cache.normalized.api.FieldPolicyCacheResolver import com.apollographql.cache.normalized.api.FieldRecordMerger import com.apollographql.cache.normalized.api.MemoryCacheFactory import com.apollographql.cache.normalized.api.MetadataGenerator @@ -17,7 +18,6 @@ import com.apollographql.cache.normalized.api.MetadataGeneratorContext import com.apollographql.cache.normalized.api.NormalizedCacheFactory import com.apollographql.cache.normalized.api.TypePolicyCacheKeyGenerator import com.apollographql.cache.normalized.sql.SqlNormalizedCacheFactory -import com.apollographql.apollo.testing.internal.runTest import pagination.offsetBasedWithPageAndInput.UsersQuery import pagination.offsetBasedWithPageAndInput.type.buildUser import pagination.offsetBasedWithPageAndInput.type.buildUserPage @@ -52,7 +52,7 @@ class OffsetBasedWithPageAndInputPaginationTest { normalizedCacheFactory = cacheFactory, cacheKeyGenerator = TypePolicyCacheKeyGenerator, metadataGenerator = OffsetPaginationMetadataGenerator("UserPage"), - apolloResolver = FieldPolicyApolloResolver, + cacheResolver = FieldPolicyCacheResolver, recordMerger = FieldRecordMerger(OffsetPaginationFieldMerger()), fieldKeyGenerator = UsersFieldKeyGenerator, ) diff --git a/tests/pagination/src/commonTest/kotlin/OffsetBasedWithPagePaginationTest.kt b/tests/pagination/src/commonTest/kotlin/OffsetBasedWithPagePaginationTest.kt index 5ec5570f..39e7488c 100644 --- a/tests/pagination/src/commonTest/kotlin/OffsetBasedWithPagePaginationTest.kt +++ b/tests/pagination/src/commonTest/kotlin/OffsetBasedWithPagePaginationTest.kt @@ -2,8 +2,9 @@ package pagination import com.apollographql.apollo.api.Optional import com.apollographql.apollo.api.json.ApolloJsonElement +import com.apollographql.apollo.testing.internal.runTest import com.apollographql.cache.normalized.ApolloStore -import com.apollographql.cache.normalized.api.FieldPolicyApolloResolver +import com.apollographql.cache.normalized.api.FieldPolicyCacheResolver import com.apollographql.cache.normalized.api.FieldRecordMerger import com.apollographql.cache.normalized.api.MemoryCacheFactory import com.apollographql.cache.normalized.api.MetadataGenerator @@ -13,7 +14,6 @@ import com.apollographql.cache.normalized.api.Record import com.apollographql.cache.normalized.api.TypePolicyCacheKeyGenerator import com.apollographql.cache.normalized.api.internal.OptimisticNormalizedCache import com.apollographql.cache.normalized.sql.SqlNormalizedCacheFactory -import com.apollographql.apollo.testing.internal.runTest import pagination.offsetBasedWithPage.UsersQuery import pagination.offsetBasedWithPage.type.buildUser import pagination.offsetBasedWithPage.type.buildUserPage @@ -48,7 +48,7 @@ class OffsetBasedWithPagePaginationTest { normalizedCacheFactory = cacheFactory, cacheKeyGenerator = TypePolicyCacheKeyGenerator, metadataGenerator = OffsetPaginationMetadataGenerator("UserPage"), - apolloResolver = FieldPolicyApolloResolver, + cacheResolver = FieldPolicyCacheResolver, recordMerger = FieldRecordMerger(OffsetPaginationFieldMerger()) ) apolloStore.clearAll() diff --git a/tests/sqlite/src/commonTest/kotlin/ExpirationTest.kt b/tests/sqlite/src/commonTest/kotlin/ExpirationTest.kt index 9bcdf5a0..a6d716f6 100644 --- a/tests/sqlite/src/commonTest/kotlin/ExpirationTest.kt +++ b/tests/sqlite/src/commonTest/kotlin/ExpirationTest.kt @@ -12,7 +12,7 @@ import com.apollographql.cache.normalized.api.CacheHeaders import com.apollographql.cache.normalized.api.DefaultRecordMerger import com.apollographql.cache.normalized.api.EmptyMetadataGenerator import com.apollographql.cache.normalized.api.ExpireDateCacheResolver -import com.apollographql.cache.normalized.api.ReceiveDateApolloResolver +import com.apollographql.cache.normalized.api.ReceiveDateCacheResolver import com.apollographql.cache.normalized.api.TypePolicyCacheKeyGenerator import com.apollographql.cache.normalized.api.normalize import com.apollographql.cache.normalized.apolloStore @@ -37,7 +37,7 @@ class ExpirationTest { .normalizedCache( normalizedCacheFactory = SqlNormalizedCacheFactory(name = null, withDates = true), cacheKeyGenerator = TypePolicyCacheKeyGenerator, - apolloResolver = ReceiveDateApolloResolver(maxAge), + cacheResolver = ReceiveDateCacheResolver(maxAge), recordMerger = DefaultRecordMerger, metadataGenerator = EmptyMetadataGenerator, ) @@ -79,7 +79,7 @@ class ExpirationTest { .normalizedCache( normalizedCacheFactory = SqlNormalizedCacheFactory(name = null, withDates = true), cacheKeyGenerator = TypePolicyCacheKeyGenerator, - apolloResolver = ExpireDateCacheResolver() + cacheResolver = ExpireDateCacheResolver() ) .storeExpirationDate(true) .serverUrl(mockServer.url()) From 22c521d41209f93753695284983fb404aa0640d4 Mon Sep 17 00:00:00 2001 From: BoD Date: Thu, 11 Jul 2024 20:12:11 +0200 Subject: [PATCH 3/3] Remove all @ApolloExperimental --- .../com/apollographql/cache/normalized/ApolloStore.kt | 2 -- .../cache/normalized/ClientCacheExtensions.kt | 3 --- .../cache/normalized/api/ApolloCacheHeaders.kt | 4 ---- .../apollographql/cache/normalized/api/CacheKeyResolver.kt | 2 +- .../cache/normalized/api/EmbeddedFieldsProvider.kt | 5 ----- .../cache/normalized/api/FieldKeyGenerator.kt | 5 ----- .../cache/normalized/api/MetadataGenerator.kt | 5 ----- .../com/apollographql/cache/normalized/api/Record.kt | 3 --- .../com/apollographql/cache/normalized/api/RecordMerger.kt | 7 ------- .../cache/normalized/sql/SqlNormalizedCache.kt | 3 --- .../normalized/sql/TrimmableNormalizedCacheFactory.kt | 2 -- 11 files changed, 1 insertion(+), 40 deletions(-) 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 67d9e3d4..c2310683 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,6 +1,5 @@ package com.apollographql.cache.normalized -import com.apollographql.apollo.annotations.ApolloExperimental import com.apollographql.apollo.api.CustomScalarAdapters import com.apollographql.apollo.api.Fragment import com.apollographql.apollo.api.Operation @@ -202,7 +201,6 @@ interface ApolloStore { fun dispose() } -@ApolloExperimental fun ApolloStore( normalizedCacheFactory: NormalizedCacheFactory, cacheKeyGenerator: CacheKeyGenerator = TypePolicyCacheKeyGenerator, 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 3cc2b264..b9396798 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 @@ -6,7 +6,6 @@ import com.apollographql.apollo.ApolloCall import com.apollographql.apollo.ApolloClient import com.apollographql.apollo.annotations.ApolloDeprecatedSince import com.apollographql.apollo.annotations.ApolloDeprecatedSince.Version.v4_0_0 -import com.apollographql.apollo.annotations.ApolloExperimental import com.apollographql.apollo.api.ApolloRequest import com.apollographql.apollo.api.ApolloResponse import com.apollographql.apollo.api.ExecutionContext @@ -334,7 +333,6 @@ fun MutableExecutionOptions.storePartialResponses(storePartialResponses: * * Default: false */ -@ApolloExperimental fun MutableExecutionOptions.storeReceiveDate(storeReceiveDate: Boolean) = addExecutionContext( StoreReceiveDateContext(storeReceiveDate) ) @@ -346,7 +344,6 @@ fun MutableExecutionOptions.storeReceiveDate(storeReceiveDate: Boolean) = * * Default: false */ -@ApolloExperimental fun MutableExecutionOptions.storeExpirationDate(storeExpirationDate: Boolean): T { addExecutionContext(StoreExpirationDateContext(storeExpirationDate)) if (this is ApolloClient.Builder) { diff --git a/normalized-cache-incubating/src/commonMain/kotlin/com/apollographql/cache/normalized/api/ApolloCacheHeaders.kt b/normalized-cache-incubating/src/commonMain/kotlin/com/apollographql/cache/normalized/api/ApolloCacheHeaders.kt index a4fe3301..c487d47b 100644 --- a/normalized-cache-incubating/src/commonMain/kotlin/com/apollographql/cache/normalized/api/ApolloCacheHeaders.kt +++ b/normalized-cache-incubating/src/commonMain/kotlin/com/apollographql/cache/normalized/api/ApolloCacheHeaders.kt @@ -1,7 +1,5 @@ package com.apollographql.cache.normalized.api -import com.apollographql.apollo.annotations.ApolloExperimental - /** * A collection of cache headers that Apollo's implementations of [NormalizedCache] respect. */ @@ -24,12 +22,10 @@ object ApolloCacheHeaders { /** * The value of this header will be stored in the [Record] fields date */ - @ApolloExperimental const val DATE = "apollo-date" /** * How long to accept stale fields */ - @ApolloExperimental const val MAX_STALE = "apollo-max-stale" } diff --git a/normalized-cache-incubating/src/commonMain/kotlin/com/apollographql/cache/normalized/api/CacheKeyResolver.kt b/normalized-cache-incubating/src/commonMain/kotlin/com/apollographql/cache/normalized/api/CacheKeyResolver.kt index 905cc6b1..2d0c5e0c 100644 --- a/normalized-cache-incubating/src/commonMain/kotlin/com/apollographql/cache/normalized/api/CacheKeyResolver.kt +++ b/normalized-cache-incubating/src/commonMain/kotlin/com/apollographql/cache/normalized/api/CacheKeyResolver.kt @@ -6,7 +6,7 @@ import com.apollographql.apollo.api.CompiledNotNullType import com.apollographql.apollo.api.isComposite /** - * An [CacheResolver] that resolves objects and list of objects and falls back to the default resolver for scalar fields. + * A [CacheResolver] that resolves objects and list of objects and falls back to the default resolver for scalar fields. * It is intended to simplify the usage of [CacheResolver] when no special handling is needed for scalar fields. * * Override [cacheKeyForField] to compute a cache key for a field of composite type. diff --git a/normalized-cache-incubating/src/commonMain/kotlin/com/apollographql/cache/normalized/api/EmbeddedFieldsProvider.kt b/normalized-cache-incubating/src/commonMain/kotlin/com/apollographql/cache/normalized/api/EmbeddedFieldsProvider.kt index 256d8cd8..60e65f49 100644 --- a/normalized-cache-incubating/src/commonMain/kotlin/com/apollographql/cache/normalized/api/EmbeddedFieldsProvider.kt +++ b/normalized-cache-incubating/src/commonMain/kotlin/com/apollographql/cache/normalized/api/EmbeddedFieldsProvider.kt @@ -1,6 +1,5 @@ package com.apollographql.cache.normalized.api -import com.apollographql.apollo.annotations.ApolloExperimental import com.apollographql.apollo.api.CompiledNamedType import com.apollographql.apollo.api.InterfaceType import com.apollographql.apollo.api.ObjectType @@ -11,7 +10,6 @@ import com.apollographql.apollo.api.ObjectType * An [EmbeddedFieldsProvider] can be used in conjunction with [RecordMerger] and [MetadataGenerator] to access multiple fields and their metadata in a single * [Record]. */ -@ApolloExperimental interface EmbeddedFieldsProvider { /** * Returns the fields that should be embedded, given a [context]`.parentType`. @@ -23,7 +21,6 @@ interface EmbeddedFieldsProvider { * A context passed to [EmbeddedFieldsProvider.getEmbeddedFields]. * @see [EmbeddedFieldsProvider.getEmbeddedFields] */ -@ApolloExperimental class EmbeddedFieldsContext( val parentType: CompiledNamedType, ) @@ -31,7 +28,6 @@ class EmbeddedFieldsContext( /** * An [EmbeddedFieldsProvider] that returns the fields specified by the `@typePolicy(embeddedFields: "...")` directive. */ -@ApolloExperimental object DefaultEmbeddedFieldsProvider : EmbeddedFieldsProvider { override fun getEmbeddedFields(context: EmbeddedFieldsContext): List { return context.parentType.embeddedFields @@ -48,7 +44,6 @@ private val CompiledNamedType.embeddedFields: List /** * A [Relay connection types](https://relay.dev/graphql/connections.htm#sec-Connection-Types) aware [EmbeddedFieldsProvider]. */ -@ApolloExperimental class ConnectionEmbeddedFieldsProvider( /** * Fields that are a Connection, associated with their parent type. diff --git a/normalized-cache-incubating/src/commonMain/kotlin/com/apollographql/cache/normalized/api/FieldKeyGenerator.kt b/normalized-cache-incubating/src/commonMain/kotlin/com/apollographql/cache/normalized/api/FieldKeyGenerator.kt index d9f66fce..8543b413 100644 --- a/normalized-cache-incubating/src/commonMain/kotlin/com/apollographql/cache/normalized/api/FieldKeyGenerator.kt +++ b/normalized-cache-incubating/src/commonMain/kotlin/com/apollographql/cache/normalized/api/FieldKeyGenerator.kt @@ -1,6 +1,5 @@ package com.apollographql.cache.normalized.api -import com.apollographql.apollo.annotations.ApolloExperimental import com.apollographql.apollo.api.CompiledField import com.apollographql.apollo.api.Executable @@ -13,7 +12,6 @@ import com.apollographql.apollo.api.Executable * A [FieldKeyGenerator] can be used to customize this format, for instance to exclude certain pagination arguments when storing a * connection field. */ -@ApolloExperimental interface FieldKeyGenerator { /** * Returns the field key to use within its parent [Record]. @@ -24,7 +22,6 @@ interface FieldKeyGenerator { /** * Context passed to the [FieldKeyGenerator.getFieldKey] method. */ -@ApolloExperimental class FieldKeyContext( val parentType: String, val field: CompiledField, @@ -37,7 +34,6 @@ class FieldKeyContext( * * @see CompiledField.nameWithArguments */ -@ApolloExperimental object DefaultFieldKeyGenerator : FieldKeyGenerator { override fun getFieldKey(context: FieldKeyContext): String { return context.field.nameWithArguments(context.variables) @@ -48,7 +44,6 @@ object DefaultFieldKeyGenerator : FieldKeyGenerator { * A [FieldKeyGenerator] that generates field keys by excluding * [Relay connection types](https://relay.dev/graphql/connections.htm#sec-Connection-Types) pagination arguments. */ -@ApolloExperimental class ConnectionFieldKeyGenerator(private val connectionFields: Map>) : FieldKeyGenerator { companion object { private val paginationArguments = setOf("first", "last", "before", "after") diff --git a/normalized-cache-incubating/src/commonMain/kotlin/com/apollographql/cache/normalized/api/MetadataGenerator.kt b/normalized-cache-incubating/src/commonMain/kotlin/com/apollographql/cache/normalized/api/MetadataGenerator.kt index 47a411e1..ced6f19f 100644 --- a/normalized-cache-incubating/src/commonMain/kotlin/com/apollographql/cache/normalized/api/MetadataGenerator.kt +++ b/normalized-cache-incubating/src/commonMain/kotlin/com/apollographql/cache/normalized/api/MetadataGenerator.kt @@ -1,6 +1,5 @@ package com.apollographql.cache.normalized.api -import com.apollographql.apollo.annotations.ApolloExperimental import com.apollographql.apollo.api.CompiledField import com.apollographql.apollo.api.Executable import com.apollographql.apollo.api.json.ApolloJsonElement @@ -15,7 +14,6 @@ import com.apollographql.apollo.api.json.ApolloJsonElement * * @see [Record.metadata] */ -@ApolloExperimental interface MetadataGenerator { /** * Returns metadata for the given object. @@ -32,7 +30,6 @@ interface MetadataGenerator { /** * Additional context passed to the [MetadataGenerator.metadataForObject] method. */ -@ApolloExperimental class MetadataGeneratorContext( val field: CompiledField, val variables: Executable.Variables, @@ -49,7 +46,6 @@ class MetadataGeneratorContext( /** * Default [MetadataGenerator] that returns empty metadata. */ -@ApolloExperimental object EmptyMetadataGenerator : MetadataGenerator { override fun metadataForObject(obj: ApolloJsonElement, context: MetadataGeneratorContext): Map = emptyMap() } @@ -61,7 +57,6 @@ object EmptyMetadataGenerator : MetadataGenerator { * * Either `pageInfo.startCursor` and `pageInfo.endCursor`, or `edges.cursor` must be present in the selection. */ -@ApolloExperimental class ConnectionMetadataGenerator(private val connectionTypes: Set) : MetadataGenerator { @Suppress("UNCHECKED_CAST") override fun metadataForObject(obj: ApolloJsonElement, context: MetadataGeneratorContext): Map { diff --git a/normalized-cache-incubating/src/commonMain/kotlin/com/apollographql/cache/normalized/api/Record.kt b/normalized-cache-incubating/src/commonMain/kotlin/com/apollographql/cache/normalized/api/Record.kt index f88ddef2..db827ba7 100644 --- a/normalized-cache-incubating/src/commonMain/kotlin/com/apollographql/cache/normalized/api/Record.kt +++ b/normalized-cache-incubating/src/commonMain/kotlin/com/apollographql/cache/normalized/api/Record.kt @@ -1,6 +1,5 @@ package com.apollographql.cache.normalized.api -import com.apollographql.apollo.annotations.ApolloExperimental import com.apollographql.apollo.annotations.ApolloInternal import com.apollographql.cache.normalized.api.internal.RecordWeigher.calculateBytes import com.benasher44.uuid.Uuid @@ -27,14 +26,12 @@ class Record( val mutationId: Uuid? = null, ) : Map by fields { - @ApolloExperimental var dates: Map? = null private set /** * Arbitrary metadata that can be attached to each field. */ - @ApolloExperimental var metadata: Map> = emptyMap() private set diff --git a/normalized-cache-incubating/src/commonMain/kotlin/com/apollographql/cache/normalized/api/RecordMerger.kt b/normalized-cache-incubating/src/commonMain/kotlin/com/apollographql/cache/normalized/api/RecordMerger.kt index 23c96ae4..d07e0b14 100644 --- a/normalized-cache-incubating/src/commonMain/kotlin/com/apollographql/cache/normalized/api/RecordMerger.kt +++ b/normalized-cache-incubating/src/commonMain/kotlin/com/apollographql/cache/normalized/api/RecordMerger.kt @@ -1,13 +1,11 @@ package com.apollographql.cache.normalized.api -import com.apollographql.apollo.annotations.ApolloExperimental import com.apollographql.apollo.api.json.ApolloJsonElement import com.apollographql.cache.normalized.api.FieldRecordMerger.FieldMerger /** * A merger that merges incoming [Record]s from the network with existing ones in the cache. */ -@ApolloExperimental interface RecordMerger { /** * Merges the incoming Record with the existing Record. @@ -21,7 +19,6 @@ interface RecordMerger { /** * A [RecordMerger] that merges fields by replacing them with the incoming fields. */ -@ApolloExperimental object DefaultRecordMerger : RecordMerger { override fun merge(existing: Record, incoming: Record, newDate: Long?): Pair> { val changedKeys = mutableSetOf() @@ -54,12 +51,10 @@ object DefaultRecordMerger : RecordMerger { /** * A convenience implementation of [RecordMerger] that simplifies the merging of [Record]s by delegating to a [FieldMerger]. */ -@ApolloExperimental class FieldRecordMerger(private val fieldMerger: FieldMerger) : RecordMerger { /** * Used to merge Records field by field. */ - @ApolloExperimental interface FieldMerger { /** * Merges the existing field with the incoming field. @@ -69,7 +64,6 @@ class FieldRecordMerger(private val fieldMerger: FieldMerger) : RecordMerger { fun mergeFields(existing: FieldInfo, incoming: FieldInfo): FieldInfo } - @ApolloExperimental data class FieldInfo( /** * Value of the field being merged. @@ -137,7 +131,6 @@ class FieldRecordMerger(private val fieldMerger: FieldMerger) : RecordMerger { * Note: although `nodes` is not a standard field in Relay, it is often used - see * [this issue on the Relay spec](https://github.com/facebook/relay/issues/3850) that discusses this pattern. */ -@ApolloExperimental val ConnectionRecordMerger = FieldRecordMerger(ConnectionFieldMerger) private object ConnectionFieldMerger : FieldMerger { diff --git a/normalized-cache-sqlite-incubating/src/commonMain/kotlin/com/apollographql/cache/normalized/sql/SqlNormalizedCache.kt b/normalized-cache-sqlite-incubating/src/commonMain/kotlin/com/apollographql/cache/normalized/sql/SqlNormalizedCache.kt index 85466f22..d8eca82d 100644 --- a/normalized-cache-sqlite-incubating/src/commonMain/kotlin/com/apollographql/cache/normalized/sql/SqlNormalizedCache.kt +++ b/normalized-cache-sqlite-incubating/src/commonMain/kotlin/com/apollographql/cache/normalized/sql/SqlNormalizedCache.kt @@ -1,6 +1,5 @@ package com.apollographql.cache.normalized.sql -import com.apollographql.apollo.annotations.ApolloExperimental import com.apollographql.apollo.exception.apolloExceptionHandler import com.apollographql.cache.normalized.api.ApolloCacheHeaders import com.apollographql.cache.normalized.api.ApolloCacheHeaders.EVICT_AFTER_READ @@ -92,7 +91,6 @@ class SqlNormalizedCache internal constructor( return headerValue(ApolloCacheHeaders.DATE)?.toLong() } - @ApolloExperimental override fun merge(record: Record, cacheHeaders: CacheHeaders, recordMerger: RecordMerger): Set { if (cacheHeaders.hasHeader(ApolloCacheHeaders.DO_NOT_STORE) || cacheHeaders.hasHeader(ApolloCacheHeaders.MEMORY_CACHE_ONLY)) { return emptySet() @@ -106,7 +104,6 @@ class SqlNormalizedCache internal constructor( } } - @ApolloExperimental override fun merge(records: Collection, cacheHeaders: CacheHeaders, recordMerger: RecordMerger): Set { if (cacheHeaders.hasHeader(ApolloCacheHeaders.DO_NOT_STORE) || cacheHeaders.hasHeader(ApolloCacheHeaders.MEMORY_CACHE_ONLY)) { return emptySet() diff --git a/normalized-cache-sqlite-incubating/src/jvmMain/kotlin/com/apollographql/cache/normalized/sql/TrimmableNormalizedCacheFactory.kt b/normalized-cache-sqlite-incubating/src/jvmMain/kotlin/com/apollographql/cache/normalized/sql/TrimmableNormalizedCacheFactory.kt index 8412d1b1..10936e1a 100644 --- a/normalized-cache-sqlite-incubating/src/jvmMain/kotlin/com/apollographql/cache/normalized/sql/TrimmableNormalizedCacheFactory.kt +++ b/normalized-cache-sqlite-incubating/src/jvmMain/kotlin/com/apollographql/cache/normalized/sql/TrimmableNormalizedCacheFactory.kt @@ -1,7 +1,6 @@ package com.apollographql.cache.normalized.sql import app.cash.sqldelight.driver.jdbc.sqlite.JdbcSqliteDriver -import com.apollographql.apollo.annotations.ApolloExperimental import com.apollographql.cache.normalized.api.NormalizedCache import com.apollographql.cache.normalized.api.NormalizedCacheFactory import com.apollographql.cache.normalized.sql.internal.Blob2RecordDatabase @@ -18,7 +17,6 @@ import java.io.File * @param maxSize if the size of the database is bigger than [maxSize] (in bytes), it will be trimmed * @param trimFactor the amount of trimming to do */ -@ApolloExperimental class TrimmableNormalizedCacheFactory internal constructor( private val url: String, private val maxSize: Long? = null,