Add QueryClient
Lint / lint (push) Successful in 39s

This commit is contained in:
Julien Valverdé
2025-12-09 02:24:43 +01:00
parent 563f1c3ba7
commit cb84cf4cfe
5 changed files with 50 additions and 16 deletions
+25
View File
@@ -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)