/** * Connects typed RPC clients to atoms. * * The service created here exposes a flattened RPC client plus atom-based query * and mutation helpers. Query atoms call RPCs and track asynchronous or * streaming results, while mutations run RPC calls that can invalidate * reactivity keys after success. Query atoms can also use request headers, * time-to-live settings, and serialization keys for hydration. * * @stability unstable * @since 4.0.0 */ import * as Context from "../Context.ts"; import * as Duration from "../Duration.ts"; import * as Effect from "../Effect.ts"; import * as Headers from "../http/Headers.ts"; import * as Layer from "../Layer.ts"; import type * as Rpc from "../rpc/Rpc.ts"; import * as RpcClient from "../rpc/RpcClient.ts"; import { RpcClientError } from "../rpc/RpcClientError.ts"; import type * as RpcGroup from "../rpc/RpcGroup.ts"; import type { RequestId } from "../rpc/RpcMessage.ts"; import * as RpcSchema from "../rpc/RpcSchema.ts"; import type { Scope } from "../Scope.ts"; import type { NoInfer } from "../Types.ts"; import * as AsyncResult from "./AsyncResult.ts"; import * as Atom from "./Atom.ts"; import * as Reactivity from "./Reactivity.ts"; /** * A `Context.Service` for a flattened RPC client integrated with atom reactivity. * * **Details** * * It exposes the RPC client, an atom runtime, mutation helpers that return `AtomResultFn`s, and query helpers that * return atoms or pull atoms for RPC results. * * @stability unstable * @category services * @since 4.0.0 */ export interface AtomRpcClient extends Context.Service> { new (_: never): Context.ServiceClass.Shape>; readonly runtime: Atom.AtomRuntime; readonly mutation: >(arg: Tag) => Rpcs extends Rpc.Rpc ? [_Success] extends [RpcSchema.Stream] ? never : Atom.AtomResultFn<{ readonly payload: Rpc.PayloadConstructor; readonly reactivityKeys?: Reactivity.KeysInput | undefined; readonly headers?: Headers.Input | undefined; }, _Success["Type"], _Error["Type"] | RpcClientError | _Middleware["error"]["Type"] | _Middleware["~ClientError"]> : never; readonly query: >(tag: Tag, payload: Rpc.PayloadConstructor>, options?: { readonly headers?: Headers.Input | undefined; readonly reactivityKeys?: Reactivity.KeysInput | undefined; readonly timeToLive?: Duration.Input | undefined; readonly serializationKey?: string | undefined; }) => Rpcs extends Rpc.Rpc ? [_Success] extends [RpcSchema.Stream] ? Atom.Writable, void> : Atom.Atom> : never; } declare global { interface ErrorConstructor { stackTraceLimit: number; } } /** * Creates a `Context.Service` class for an RPC client backed by an atom runtime. * * **Details** * * The options provide the RPC group, protocol layer, tracing options, request id generation, optional custom client * effect, and runtime factory used by the query and mutation helpers. * * @stability unstable * @category constructors * @since 4.0.0 */ export declare const Service: () => > | Rpc.ServicesClient>>(id: Id, options: { readonly group: RpcGroup.RpcGroup; readonly protocol: Layer.Layer, Scope>, ER> | ((get: Atom.AtomContext) => Layer.Layer, Scope>, ER>); readonly spanPrefix?: string | undefined; readonly spanAttributes?: Record | undefined; readonly generateRequestId?: (() => RequestId) | undefined; readonly disableTracing?: boolean | undefined; readonly makeEffect?: Effect.Effect, never, RM> | undefined; readonly runtime?: Atom.RuntimeFactory | undefined; }) => AtomRpcClient; //# sourceMappingURL=AtomRpc.d.ts.map