@@ -1,4 +1,4 @@
|
||||
import { type DateTime, type Duration, Effect, Equal, Equivalence, Hash, HashMap, Pipeable, Predicate, type Scope, SubscriptionRef } from "effect"
|
||||
import { DateTime, Duration, Effect, Equal, Equivalence, Hash, HashMap, Pipeable, Predicate, type Scope, SubscriptionRef } from "effect"
|
||||
import type * as Query from "./Query.js"
|
||||
import type * as Result from "./Result.js"
|
||||
|
||||
@@ -105,3 +105,11 @@ implements Pipeable.Pipeable {
|
||||
}
|
||||
|
||||
export const isQueryClientCacheEntry = (u: unknown): u is QueryClientCacheEntry => Predicate.hasProperty(u, QueryClientCacheEntryTypeId)
|
||||
|
||||
export const isQueryClientCacheEntryStale = (
|
||||
self: QueryClientCacheEntry,
|
||||
staleTime: Duration.DurationInput,
|
||||
): Effect.Effect<boolean> => Effect.andThen(
|
||||
DateTime.now,
|
||||
now => Duration.lessThan(DateTime.distanceDuration(self.createdAt, now), staleTime),
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user