Working mutations
All checks were successful
Lint / lint (push) Successful in 14s

This commit is contained in:
Julien Valverdé
2025-03-17 02:15:27 +01:00
parent d56578da8f
commit 8636a28f2f
4 changed files with 34 additions and 9 deletions

View File

@@ -0,0 +1,13 @@
import type * as AsyncData from "@typed/async-data"
import { Effect, type Fiber, type SubscriptionRef } from "effect"
export interface MutationService<K extends readonly unknown[], A, E> {
readonly state: SubscriptionRef.SubscriptionRef<AsyncData.AsyncData<A, E>>
readonly mutate: (...key: K) => Effect.Effect<A, E>
readonly forkMutate: (...key: K) => Effect.Effect<Fiber.RuntimeFiber<A, E>>
}
export const Tag = <const Id extends string>(id: Id) => <
Self, K extends readonly unknown[], A, E = never,
>() => Effect.Tag(id)<Self, MutationService<K, A, E>>()