@@ -0,0 +1,25 @@
|
||||
import { type HashMap, Pipeable, Predicate, type Subscribable, type SubscriptionRef } from "effect"
|
||||
import type * as Query from "./Query.js"
|
||||
import type * as Result from "./Result.js"
|
||||
|
||||
|
||||
export const QueryClientTypeId: unique symbol = Symbol.for("@effect-fc/QueryClient/QueryClient")
|
||||
export type QueryClientTypeId = typeof QueryClientTypeId
|
||||
|
||||
export interface QueryClient extends Pipeable.Pipeable {
|
||||
readonly [QueryClientTypeId]: QueryClientTypeId
|
||||
|
||||
readonly cache: Subscribable.Subscribable<HashMap.HashMap<Query.Query.AnyKey, Result.Final<unknown, unknown, unknown>>>
|
||||
}
|
||||
|
||||
export class QueryClientImpl extends Pipeable.Class() implements QueryClient {
|
||||
readonly [QueryClientTypeId]: QueryClientTypeId = QueryClientTypeId
|
||||
|
||||
constructor(
|
||||
readonly cache: SubscriptionRef.SubscriptionRef<HashMap.HashMap<Query.Query.AnyKey, Result.Final<unknown, unknown, unknown>>>
|
||||
) {
|
||||
super()
|
||||
}
|
||||
}
|
||||
|
||||
export const isQueryClient = (u: unknown): u is QueryClient => Predicate.hasProperty(u, QueryClientTypeId)
|
||||
Reference in New Issue
Block a user