import { remote_live_stream } from "./internal/live.js"; import type { RemoteFailure } from "./remote/shared.js"; import { Effect, Stream } from "effect"; declare const live_operator: unique symbol; type RemoteLivePipe = { (): RemoteLiveStream; (ab: LiveFactory["status"]): Stream.Stream; (ab: LiveFactory["reconnect"]): Effect.Effect, never>; (ab: LiveFactory["status"], bc: (_: Stream.Stream) => B): B; (ab: LiveFactory["reconnect"], bc: (_: Effect.Effect, never>) => B): B; (ab: LiveFactory["status"], bc: (_: Stream.Stream) => B, cd: (_: B) => C): C; (ab: LiveFactory["reconnect"], bc: (_: Effect.Effect, never>) => B, cd: (_: B) => C): C; (ab: (_: Stream.Stream, never>) => Stream.Stream, never>): RemoteLiveStream; (ab: (_: Stream.Stream, never>) => B): B; (ab: (_: Stream.Stream, never>) => B, bc: (_: B) => C): C; (ab: (_: Stream.Stream, never>) => B, bc: (_: B) => C, cd: (_: C) => D): D; }; /** * Stream returned by `Query.live` remote functions. * * @example * ```ts * const Time = GetTime(); * const Label = Time.pipe(Stream.map((time) => time.toISOString())); * ``` * * @since 3.4.8 */ export type RemoteLiveStream = Omit, never>, "pipe"> & { readonly [remote_live_stream]: true; readonly pipe: RemoteLivePipe; }; /** * Transport state exposed separately from the data stream. * * @example * ```ts * const Status = GetTime().pipe(Live.status); * ``` * * @since 3.4.8 */ export type LiveStatus = { readonly _tag: "Idle"; } | { readonly _tag: "Connecting"; } | { readonly _tag: "Open"; } | { readonly _tag: "Failed"; readonly cause: unknown; } | { readonly _tag: "Closed"; }; /** * Public live stream control helpers. * * @example * ```ts * yield* GetNotifications().pipe(Live.reconnect); * ``` * * @since 3.4.8 */ export interface LiveFactory { readonly status: { readonly [live_operator]: true; /** * Creates a stream of transport status updates for a remote live stream. * * @example * ```ts * const Status = GetTime().pipe(Live.status); * ``` * * @param stream - Remote live stream whose transport status should be read. * @returns A stream of transport status snapshots. */ (stream: RemoteLiveStream): Stream.Stream; }; readonly reconnect: { readonly [live_operator]: true; /** * Reconnects the transport behind a remote live stream. * * @example * ```ts * yield* GetNotifications().pipe(Live.reconnect); * ``` * * @param stream - Remote live stream whose transport should reconnect. * @returns An Effect that completes after the reconnect request is sent. */ (stream: RemoteLiveStream): Effect.Effect, never>; }; } export declare function make_remote_live_stream(resource: unknown, on_error: (error: unknown) => RemoteFailure, encode_snapshot?: (value: unknown) => string): RemoteLiveStream; export declare function make_failed_remote_live_stream(error: unknown, on_error: (error: unknown) => RemoteFailure): RemoteLiveStream; /** * Remote live transport helpers. * * @since 3.4.8 */ export declare const Live: LiveFactory; export declare function get_native_remote_live_resource(value: unknown): unknown | undefined; export {};