diff --git a/packages/extension-query/src/Query.ts b/packages/extension-query/src/Query.ts new file mode 100644 index 0000000..8098466 --- /dev/null +++ b/packages/extension-query/src/Query.ts @@ -0,0 +1,39 @@ +import { Effect, Fiber, Option, type Ref, type SubscriptionRef } from "effect" +import * as AsyncData from "@typed/async-data" + + +export interface QueryRunner { + readonly stateRef: SubscriptionRef.SubscriptionRef> + readonly fiberRef: SubscriptionRef.SubscriptionRef>> + + readonly interrupt: Effect.Effect + readonly fetch: Effect.Effect + readonly refetch: Effect.Effect +} + + +export class Query { + constructor( + private readonly stateRef: SubscriptionRef.SubscriptionRef>, + private readonly fiberRef: SubscriptionRef.SubscriptionRef>>, + ) {} + + private run(effect: Effect.Effect) { + + } + + // interrupt(): Effect.Effect { + // return this.fiberRef.pipe( + // Effect.flatMap(Option.match({ + // onSome: Fiber.interrupt, + // onNone: () => Effect.void, + // })) + // ) + // } + + + + fetch = Effect.gen(this, function*() { + yield* this.interrupt() + }) +}