@@ -1,6 +1,7 @@
|
|||||||
import type * as AsyncData from "@typed/async-data"
|
import type * as AsyncData from "@typed/async-data"
|
||||||
import { type Cause, Effect, type Fiber, type Option, type Stream, type SubscriptionRef } from "effect"
|
import { type Cause, Effect, type Fiber, type Option, type Stream, type SubscriptionRef } from "effect"
|
||||||
import * as QueryRunner from "./QueryRunner.js"
|
import * as QueryRunner from "./QueryRunner.js"
|
||||||
|
import * as QueryProgress from "./QueryProgress.js"
|
||||||
|
|
||||||
|
|
||||||
export const Tag = <const Id extends string>(id: Id) => <
|
export const Tag = <const Id extends string>(id: Id) => <
|
||||||
@@ -8,4 +9,16 @@ export const Tag = <const Id extends string>(id: Id) => <
|
|||||||
>() => Effect.Tag(id)<Self, QueryRunner.QueryRunner<K, A, E>>()
|
>() => Effect.Tag(id)<Self, QueryRunner.QueryRunner<K, A, E>>()
|
||||||
|
|
||||||
|
|
||||||
export const Service = <Self>() =>
|
export interface ServiceProps<K extends readonly unknown[], A, E, R> {
|
||||||
|
readonly key: Stream.Stream<K>
|
||||||
|
readonly query: (key: K) => Effect.Effect<A, E, R | QueryProgress.QueryProgress>
|
||||||
|
readonly options?: QueryRunner.RunOptions
|
||||||
|
}
|
||||||
|
|
||||||
|
export const Service = <Self>() => <
|
||||||
|
const Id extends string,
|
||||||
|
K extends readonly unknown[], A, E, R,
|
||||||
|
>(
|
||||||
|
id: Id,
|
||||||
|
props: ServiceProps<K, A, E, R>,
|
||||||
|
) =>
|
||||||
|
|||||||
Reference in New Issue
Block a user