Package-level declarations

Types

Link copied to clipboard

Implementation of MemoryPressure for Android.

Link copied to clipboard

Implementation of NetworkConnectivity for Android.

Link copied to clipboard
class AndroidWindowVisibility(lifecycleOwner: LifecycleOwner = ProcessLifecycleOwner.get()) : WindowVisibility

Implementation of WindowVisibility for Android.

Link copied to clipboard

Query command for InfiniteQueryKey.

Link copied to clipboard
Link copied to clipboard
open class InfiniteQueryId<T, S>(val namespace: String, val tags: SurrogateKey) : UniqueId

Unique identifier for InfiniteQueryKey.

Link copied to clipboard
interface InfiniteQueryKey<T, S>

InfiniteQueryKey for managing Query associated with id.

Link copied to clipboard
interface InfiniteQueryRef<T, S> : Actor

A reference to an Query for InfiniteQueryKey.

Link copied to clipboard
class InvalidateQueriesFilter(val type: QueryFilterType? = null, val keys: Array<SurrogateKey>? = null, val predicate: (QueryModel<*>) -> Boolean? = null) : QueryFilter

Filter for invalidating queries.

Link copied to clipboard

Implementation of MemoryPressure for iOS.

Link copied to clipboard

Implementation of WindowVisibility for iOS.

Link copied to clipboard
interface Mutation<T> : Actor

Mutation as the base interface for an MutationClient implementations.

Link copied to clipboard
sealed interface MutationAction<out T>

Mutation actions are used to update the mutation state.

Link copied to clipboard
typealias MutationCallback<T> = (Result<T>) -> Unit
Link copied to clipboard
interface MutationClient

A Mutation client, which allows you to make mutations actor and handle MutationKey.

Link copied to clipboard
interface MutationCommand<T>

Mutation command to handle mutation.

Link copied to clipboard
Link copied to clipboard
typealias MutationContentEquals<T> = (oldData: T, newData: T) -> Boolean
Link copied to clipboard
Link copied to clipboard
open class MutationId<T, S>(val namespace: String, val tags: SurrogateKey) : UniqueId

Unique identifier for MutationKey.

Link copied to clipboard
interface MutationKey<T, S>

Interface for mutations key.

Link copied to clipboard
interface MutationModel<out T> : DataModel<T>

Data model for the state handled by MutationKey.

Link copied to clipboard
fun interface MutationNotifier

MutationNotifier is used to notify the mutation result.

Link copied to clipboard

MutationOptions providing settings related to the internal behavior of an Mutation.

Link copied to clipboard

Extension receiver for referencing external instances needed when executing mutate.

Link copied to clipboard
Link copied to clipboard
interface MutationRef<T, S> : Actor

A reference to a Mutation for MutationKey.

Link copied to clipboard
data class MutationState<T> : MutationModel<T>

State for managing the execution result of Mutation.

Link copied to clipboard

The status of the mutation.

Link copied to clipboard
interface Query<T> : Actor

Query as the base interface for an QueryClient implementations.

Link copied to clipboard
sealed interface QueryAction<out T>

Query actions are used to update the query state.

Link copied to clipboard
Link copied to clipboard

Builder for creating a query cache.

Link copied to clipboard
typealias QueryCallback<T> = (Result<T>) -> Unit
Link copied to clipboard
data class QueryChunk<T, S>(val data: T, val param: S)

Data chunk type that holds values in combination with param related to data.

Link copied to clipboard
typealias QueryChunks<T, S> = List<QueryChunk<T, S>>
Link copied to clipboard
interface QueryClient

A Query client, which allows you to make queries actor and handle QueryKey and InfiniteQueryKey.

Link copied to clipboard
interface QueryCommand<T>

Query command to handle query.

Link copied to clipboard
Link copied to clipboard
typealias QueryContentCacheable<T> = (currentData: T) -> Boolean
Link copied to clipboard
typealias QueryContentEquals<T> = (oldData: T, newData: T) -> Boolean
Link copied to clipboard
typealias QueryDispatch<T> = (QueryAction<T>) -> Unit
Link copied to clipboard
Link copied to clipboard

Events occurring in the query.

Link copied to clipboard
sealed class QueryFetchStatus

The fetch status of the query.

Link copied to clipboard
interface QueryFilter

Interface for filtering side effect queries by QueryMutableClient.

Link copied to clipboard

Query management categories for filtering.

Link copied to clipboard
open class QueryId<T>(val namespace: String, val tags: SurrogateKey) : UniqueId

Unique identifier for QueryKey.

Link copied to clipboard
Link copied to clipboard
interface QueryKey<T>

QueryKey for managing Query associated with id.

Link copied to clipboard
interface QueryModel<out T> : DataModel<T>

Data model for the state handled by QueryKey or InfiniteQueryKey.

Link copied to clipboard

Interface for causing side effects on Query under the control of QueryClient.

Link copied to clipboard

QueryOptions providing settings related to the internal behavior of an Query.

Link copied to clipboard
Link copied to clipboard

Interface for directly accessing retrieved Query data by QueryClient.

Link copied to clipboard
interface QueryReceiver

Extension receiver for referencing external instances needed when executing query.

Link copied to clipboard
typealias QueryRecoverData<T> = (error: Throwable) -> T
Link copied to clipboard
Link copied to clipboard
interface QueryRef<T> : Actor

A reference to an Query for QueryKey.

Link copied to clipboard
data class QueryState<T> : QueryModel<T>

State for managing the execution result of Query.

Link copied to clipboard

The status of the query.

Link copied to clipboard
class RemoveQueriesFilter(val type: QueryFilterType? = null, val keys: Array<SurrogateKey>? = null, val predicate: (QueryModel<*>) -> Boolean? = null) : QueryFilter

Filter for removing queries.

Link copied to clipboard
class ResumeQueriesFilter(val keys: Array<SurrogateKey>? = null, val predicate: (QueryModel<*>) -> Boolean) : QueryFilter

Filter for resuming queries.

Link copied to clipboard

The subscriber status of the subscription.

Link copied to clipboard
interface Subscription<T> : Actor

Subscription as the base interface for an SubscriptionClient implementations.

Link copied to clipboard
sealed interface SubscriptionAction<out T>

Subscription actions are used to update the subscription state.

Link copied to clipboard

Builder for creating a subscription cache.

Link copied to clipboard

A Subscription client, which allows you to make subscriptions actor and handle SubscriptionKey.

Link copied to clipboard

Subscription command to handle subscription.

Link copied to clipboard
Link copied to clipboard
typealias SubscriptionContentCacheable<T> = (currentData: T) -> Boolean
Link copied to clipboard
typealias SubscriptionContentEquals<T> = (oldData: T, newData: T) -> Boolean
Link copied to clipboard
Link copied to clipboard
open class SubscriptionId<T>(val namespace: String, val tags: SurrogateKey) : UniqueId

Unique identifier for SubscriptionKey.

Link copied to clipboard
interface SubscriptionKey<T>

SubscriptionKey for managing Subscription associated with id.

Link copied to clipboard
interface SubscriptionModel<out T> : DataModel<T>

Data model for the state handled by SubscriptionKey.

Link copied to clipboard

SubscriptionOptions providing settings related to the internal behavior of an Subscription.

Link copied to clipboard

Extension receiver for referencing external instances needed when receiving subscription.

Link copied to clipboard
typealias SubscriptionRecoverData<T> = (error: Throwable) -> T
Link copied to clipboard
interface SubscriptionRef<T> : Actor

A reference to an Subscription for SubscriptionKey.

Link copied to clipboard

State for managing the execution result of Subscription.

Link copied to clipboard

The received status of the subscription.

Link copied to clipboard

Implementation of the SwrClient interface.

Link copied to clipboard

An enhanced version of SwrCache that integrates SwrClientPlus into SwrCache.

Link copied to clipboard
Link copied to clipboard
interface SwrCachePolicy
Link copied to clipboard
class SwrCacheScope(parent: Job? = null) : CoroutineScope

CoroutineScope with limited concurrency for SwrCache and SwrCachePlus.

Link copied to clipboard

An all-in-one SwrClient integrating MutationClient and QueryClient for library users.

Link copied to clipboard

An enhanced version of SwrClient that integrates SubscriptionClient into SwrClient.

Link copied to clipboard
Link copied to clipboard

Implementation of WindowVisibility for WasmJs.

Properties

Link copied to clipboard

Returns the data of all chunks.

Functions

Link copied to clipboard
inline fun <T, S> buildChunks(builderAction: MutableList<QueryChunk<T, S>>.() -> Unit): QueryChunks<T, S>

Builds a list of chunks using the provided builderAction.

Link copied to clipboard
fun <T, S> buildInfiniteQueryKey(id: InfiniteQueryId<T, S>, fetch: suspend QueryReceiver.(param: S) -> T, initialParam: () -> S, loadMoreParam: (QueryChunks<T, S>) -> S?): InfiniteQueryKey<T, S>

Function for building implementations of InfiniteQueryKey using Kotlin Delegation.

Link copied to clipboard
fun <T, S> buildMutationKey(id: MutationId<T, S> = MutationId.auto(), mutate: suspend MutationReceiver.(variable: S) -> T): MutationKey<T, S>

Function for building implementations of MutationKey using Kotlin Delegation.

Link copied to clipboard
fun <T> buildQueryKey(id: QueryId<T>, fetch: suspend QueryReceiver.() -> T): QueryKey<T>

Function for building implementations of QueryKey using Kotlin Delegation.

Link copied to clipboard
fun <T> buildSubscriptionKey(id: SubscriptionId<T> = SubscriptionId.auto(), subscribe: SubscriptionReceiver.() -> Flow<T>): SubscriptionKey<T>

Function for building implementations of SubscriptionKey using Kotlin Delegation.

Link copied to clipboard
inline fun <T, S, U, E> QueryChunks<T, S>.chunked(transform: (QueryChunk<T, S>) -> Iterable<U>, selector: (U) -> E): List<E>

Transforms all chunk data with transform and returns the extracted data using selector.

Link copied to clipboard
fun SubscriptionOptions.copy(gcTime: Duration = this.gcTime, errorEquals: (Throwable, Throwable) -> Boolean? = this.errorEquals, onError: (ErrorRecord, SubscriptionModel<*>) -> Unit? = this.onError, shouldSuppressErrorRelay: (ErrorRecord, SubscriptionModel<*>) -> Boolean? = this.shouldSuppressErrorRelay, keepAliveTime: Duration = this.keepAliveTime, logger: LoggerFn? = this.logger, shouldRetry: (Throwable) -> Boolean = this.shouldRetry, retryCount: Int = this.retryCount, retryInitialInterval: Duration = this.retryInitialInterval, retryMaxInterval: Duration = this.retryMaxInterval, retryMultiplier: Double = this.retryMultiplier, retryRandomizationFactor: Double = this.retryRandomizationFactor, retryRandomizer: Random = this.retryRandomizer): SubscriptionOptions

Copies the current SubscriptionOptions with the specified settings.

fun MutationOptions.copy(isOneShot: Boolean = this.isOneShot, isStrictMode: Boolean = this.isStrictMode, errorEquals: (Throwable, Throwable) -> Boolean? = this.errorEquals, onError: (ErrorRecord, MutationModel<*>) -> Unit? = this.onError, shouldSuppressErrorRelay: (ErrorRecord, MutationModel<*>) -> Boolean? = this.shouldSuppressErrorRelay, shouldExecuteEffectSynchronously: Boolean = this.shouldExecuteEffectSynchronously, keepAliveTime: Duration = this.keepAliveTime, logger: LoggerFn? = this.logger, shouldRetry: (Throwable) -> Boolean = this.shouldRetry, retryCount: Int = this.retryCount, retryInitialInterval: Duration = this.retryInitialInterval, retryMaxInterval: Duration = this.retryMaxInterval, retryMultiplier: Double = this.retryMultiplier, retryRandomizationFactor: Double = this.retryRandomizationFactor, retryRandomizer: Random = this.retryRandomizer): MutationOptions

Copies the current MutationOptions with the specified settings.

fun QueryOptions.copy(staleTime: Duration = this.staleTime, gcTime: Duration = this.gcTime, prefetchWindowTime: Duration = this.prefetchWindowTime, errorEquals: (Throwable, Throwable) -> Boolean? = this.errorEquals, pauseDurationAfter: (Throwable) -> Duration?? = this.pauseDurationAfter, revalidateOnReconnect: Boolean = this.revalidateOnReconnect, revalidateOnFocus: Boolean = this.revalidateOnFocus, onError: (ErrorRecord, QueryModel<*>) -> Unit? = this.onError, shouldSuppressErrorRelay: (ErrorRecord, QueryModel<*>) -> Boolean? = this.shouldSuppressErrorRelay, keepAliveTime: Duration = this.keepAliveTime, logger: LoggerFn? = this.logger, shouldRetry: (Throwable) -> Boolean = this.shouldRetry, retryCount: Int = this.retryCount, retryInitialInterval: Duration = this.retryInitialInterval, retryMaxInterval: Duration = this.retryMaxInterval, retryMultiplier: Double = this.retryMultiplier, retryRandomizationFactor: Double = this.retryRandomizationFactor, retryRandomizer: Random = this.retryRandomizer): QueryOptions

Copies the current QueryOptions with the specified settings.

Link copied to clipboard
Link copied to clipboard

Creates a QueryReducer function.

Link copied to clipboard
Link copied to clipboard
inline suspend fun <T, S> QueryCommand.Context<QueryChunks<T, S>>.dispatchFetchChunksResult(key: InfiniteQueryKey<T, S>, variable: S, marker: Marker, noinline callback: QueryCallback<QueryChunks<T, S>>?)

Dispatches the result of fetching data for the InfiniteQueryKey.

Link copied to clipboard

Dispatches the fetch failure.

Link copied to clipboard
inline suspend fun <T> QueryCommand.Context<T>.dispatchFetchResult(key: QueryKey<T>, marker: Marker, noinline callback: QueryCallback<T>?)

Dispatches the fetch result.

Link copied to clipboard
fun <T> QueryCommand.Context<T>.dispatchFetchSuccess(data: T, contentEquals: QueryContentEquals<T>? = null)

Dispatches the fetch success.

Link copied to clipboard

Dispatches the mutate failure.

Link copied to clipboard
inline suspend fun <T, S> MutationCommand.Context<T>.dispatchMutateResult(key: MutationKey<T, S>, variable: S, marker: Marker, noinline callback: MutationCallback<T>?)

Dispatches the mutation result.

Link copied to clipboard

Dispatches the mutate success.

Link copied to clipboard

Dispatches the failure result of the subscription.

Link copied to clipboard

Dispatches the success result of the subscription.

Link copied to clipboard

Dispatches the result of the subscription.

Link copied to clipboard
inline suspend fun <T, S> QueryCommand.Context<QueryChunks<T, S>>.dispatchRevalidateChunksResult(key: InfiniteQueryKey<T, S>, chunks: QueryChunks<T, S>, marker: Marker, noinline callback: QueryCallback<QueryChunks<T, S>>?)

Dispatches the result of revalidating data for the InfiniteQueryKey.

Link copied to clipboard

Returns an empty list of chunks.

Link copied to clipboard
suspend fun <T> QueryCommand.Context<T>.fetch(key: QueryKey<T>, retryFn: RetryFn<T> = options.exponentialBackOff(onRetry = onRetryCallback(key.id))): Result<T>

Fetches the data.

suspend fun <T, S> QueryCommand.Context<QueryChunks<T, S>>.fetch(key: InfiniteQueryKey<T, S>, variable: S, retryFn: RetryFn<T> = options.exponentialBackOff(onRetry = onRetryCallback(key.id))): Result<T>

Fetches data for the InfiniteQueryKey using the value of variable.

Link copied to clipboard

Creates a new InfiniteQueryRef instance.

Link copied to clipboard
fun <T, R> QueryState.Companion.merge(states: Array<QueryState<T>>, transform: (List<T>) -> R): QueryState<R>
fun <T1, T2, R> QueryState.Companion.merge(state1: QueryState<T1>, state2: QueryState<T2>, transform: (T1, T2) -> R): QueryState<R>
fun <T1, T2, T3, R> QueryState.Companion.merge(state1: QueryState<T1>, state2: QueryState<T2>, state3: QueryState<T3>, transform: (T1, T2, T3) -> R): QueryState<R>

Merges multiple QueryState instances into a single QueryState instance.

Link copied to clipboard
fun <T, S> QueryChunks<List<T>, S>.modifyData(match: (T) -> Boolean, edit: T.() -> T): QueryChunks<List<T>, S>

Modifies the data of all chunks that match the condition.

Link copied to clipboard
suspend fun <T, S> MutationCommand.Context<T>.mutate(key: MutationKey<T, S>, variable: S, retryFn: RetryFn<T> = options.exponentialBackOff(onRetry = onRetryCallback(key.id))): Result<T>

Mutates the data.

Link copied to clipboard
fun MutationOptions(isOneShot: Boolean = MutationOptions.isOneShot, isStrictMode: Boolean = MutationOptions.isStrictMode, errorEquals: (Throwable, Throwable) -> Boolean? = MutationOptions.errorEquals, onError: (ErrorRecord, MutationModel<*>) -> Unit? = MutationOptions.onError, shouldSuppressErrorRelay: (ErrorRecord, MutationModel<*>) -> Boolean? = MutationOptions.shouldSuppressErrorRelay, shouldExecuteEffectSynchronously: Boolean = MutationOptions.shouldExecuteEffectSynchronously, keepAliveTime: Duration = MutationOptions.keepAliveTime, logger: LoggerFn? = MutationOptions.logger, shouldRetry: (Throwable) -> Boolean = MutationOptions.shouldRetry, retryCount: Int = MutationOptions.retryCount, retryInitialInterval: Duration = MutationOptions.retryInitialInterval, retryMaxInterval: Duration = MutationOptions.retryMaxInterval, retryMultiplier: Double = MutationOptions.retryMultiplier, retryRandomizationFactor: Double = MutationOptions.retryRandomizationFactor, retryRandomizer: Random = MutationOptions.retryRandomizer): MutationOptions

Creates a new MutationOptions with the specified settings.

Link copied to clipboard
fun <T, S> MutationRef(key: MutationKey<T, S>, marker: Marker, mutation: Mutation<T>): MutationRef<T, S>

Creates a new MutationRef instance.

Link copied to clipboard
fun QueryCache(capacity: Int = 50): QueryCache

Creates a new query cache.

Link copied to clipboard
fun QueryCacheBuilder(capacity: Int = 50, block: QueryCacheBuilder.() -> Unit): QueryCache

Creates a new query cache with the specified capacity and applies the block to the builder.

Link copied to clipboard
fun QueryOptions(staleTime: Duration = QueryOptions.staleTime, gcTime: Duration = QueryOptions.gcTime, prefetchWindowTime: Duration = QueryOptions.prefetchWindowTime, errorEquals: (Throwable, Throwable) -> Boolean? = QueryOptions.errorEquals, pauseDurationAfter: (Throwable) -> Duration?? = QueryOptions.pauseDurationAfter, revalidateOnReconnect: Boolean = QueryOptions.revalidateOnReconnect, revalidateOnFocus: Boolean = QueryOptions.revalidateOnFocus, onError: (ErrorRecord, QueryModel<*>) -> Unit? = QueryOptions.onError, shouldSuppressErrorRelay: (ErrorRecord, QueryModel<*>) -> Boolean? = QueryOptions.shouldSuppressErrorRelay, keepAliveTime: Duration = QueryOptions.keepAliveTime, logger: LoggerFn? = QueryOptions.logger, shouldRetry: (Throwable) -> Boolean = QueryOptions.shouldRetry, retryCount: Int = QueryOptions.retryCount, retryInitialInterval: Duration = QueryOptions.retryInitialInterval, retryMaxInterval: Duration = QueryOptions.retryMaxInterval, retryMultiplier: Double = QueryOptions.retryMultiplier, retryRandomizationFactor: Double = QueryOptions.retryRandomizationFactor, retryRandomizer: Random = QueryOptions.retryRandomizer): QueryOptions

Creates a new QueryOptions with the specified settings.

Link copied to clipboard
fun <T> QueryRef(key: QueryKey<T>, marker: Marker, query: Query<T>): QueryRef<T>

Creates a new QueryRef instance.

Link copied to clipboard
Link copied to clipboard

Reports the query error.

Link copied to clipboard

Reports the subscription error.

Link copied to clipboard

Revalidates the data for the InfiniteQueryKey using the value of chunks.

Link copied to clipboard
fun <T> QueryCommand.Context<T>.shouldFetch(revision: String? = null): Boolean

Determines whether a fetch operation is necessary based on the current state.

Link copied to clipboard

Determines whether a mutation operation is necessary based on the current state.

Link copied to clipboard

Determines whether query processing needs to be paused based on error.

Link copied to clipboard

Creates a new subscription cache.

Link copied to clipboard

Creates a new subscription cache with the specified capacity and applies the block to the builder.

Link copied to clipboard
fun SubscriptionOptions(gcTime: Duration = SubscriptionOptions.gcTime, errorEquals: (Throwable, Throwable) -> Boolean? = SubscriptionOptions.errorEquals, onError: (ErrorRecord, SubscriptionModel<*>) -> Unit? = SubscriptionOptions.onError, shouldSuppressErrorRelay: (ErrorRecord, SubscriptionModel<*>) -> Boolean? = SubscriptionOptions.shouldSuppressErrorRelay, keepAliveTime: Duration = SubscriptionOptions.keepAliveTime, logger: LoggerFn? = SubscriptionOptions.logger, shouldRetry: (Throwable) -> Boolean = SubscriptionOptions.shouldRetry, retryCount: Int = SubscriptionOptions.retryCount, retryInitialInterval: Duration = SubscriptionOptions.retryInitialInterval, retryMaxInterval: Duration = SubscriptionOptions.retryMaxInterval, retryMultiplier: Double = SubscriptionOptions.retryMultiplier, retryRandomizationFactor: Double = SubscriptionOptions.retryRandomizationFactor, retryRandomizer: Random = SubscriptionOptions.retryRandomizer): SubscriptionOptions

Creates a new SubscriptionOptions with the specified settings.

Link copied to clipboard
fun <T> SubscriptionRef(key: SubscriptionKey<T>, marker: Marker, subscription: Subscription<T>): SubscriptionRef<T>

Creates a new SubscriptionRef instance.

Link copied to clipboard
fun SwrCachePlusPolicy(coroutineScope: CoroutineScope, mainDispatcher: CoroutineDispatcher = Dispatchers.Main, mutationOptions: MutationOptions = MutationOptions, mutationReceiver: MutationReceiver = MutationReceiver, queryOptions: QueryOptions = QueryOptions, queryReceiver: QueryReceiver = QueryReceiver, queryCache: QueryCache = QueryCache(), subscriptionOptions: SubscriptionOptions = SubscriptionOptions, subscriptionReceiver: SubscriptionReceiver = SubscriptionReceiver, subscriptionCache: SubscriptionCache = SubscriptionCache(), batchSchedulerFactory: BatchSchedulerFactory = BatchSchedulerFactory.default(mainDispatcher), errorRelay: ErrorRelay? = null, memoryPressure: MemoryPressure = MemoryPressure, networkConnectivity: NetworkConnectivity = NetworkConnectivity, networkResumeAfterDelay: Duration = 2.seconds, networkResumeQueriesFilter: ResumeQueriesFilter = ResumeQueriesFilter( predicate = { it.isFailure } ), windowVisibility: WindowVisibility = WindowVisibility, windowResumeQueriesFilter: ResumeQueriesFilter = ResumeQueriesFilter( predicate = { it.isStaled() } )): SwrCachePlusPolicy

Creates a new instance of SwrCachePlusPolicy.

Link copied to clipboard
fun SwrCachePolicy(coroutineScope: CoroutineScope, mainDispatcher: CoroutineDispatcher = Dispatchers.Main, mutationOptions: MutationOptions = MutationOptions, mutationReceiver: MutationReceiver = MutationReceiver, queryOptions: QueryOptions = QueryOptions, queryReceiver: QueryReceiver = QueryReceiver, queryCache: QueryCache = QueryCache(), batchSchedulerFactory: BatchSchedulerFactory = BatchSchedulerFactory.default(mainDispatcher), errorRelay: ErrorRelay? = null, memoryPressure: MemoryPressure = MemoryPressure, networkConnectivity: NetworkConnectivity = NetworkConnectivity, networkResumeAfterDelay: Duration = 2.seconds, networkResumeQueriesFilter: ResumeQueriesFilter = ResumeQueriesFilter( predicate = { it.isFailure } ), windowVisibility: WindowVisibility = WindowVisibility, windowResumeQueriesFilter: ResumeQueriesFilter = ResumeQueriesFilter( predicate = { it.isStaled() } )): SwrCachePolicy

Create a new SwrCachePolicy instance.