UNPKG

prostgles-client

Version:

Reactive client for Postgres

30 lines 1.28 kB
import { type DBSchema, type UserLike } from "prostgles-types"; import type { ClientFunctionHandler } from "lib/getMethods"; import type { ManagerOptions, SocketOptions } from "socket.io-client"; import { type InitOptions, type ClientOnReadyParams } from "../prostgles"; export declare const getIO: (throwError?: boolean) => typeof import("socket.io-client").io; type SocketPathOrOptions = Partial<ManagerOptions & SocketOptions>; export type UseProstglesClientProps = Omit<InitOptions<DBSchema>, "onReady" | "socket"> & { /** * Websocket API token */ token?: string; socketOptions?: SocketPathOrOptions; skip?: boolean; }; export type ProstglesClientState<PGC> = { isLoading: true; hasError: false; error?: undefined; } | ({ isLoading: false; hasError: false; error?: undefined; } & PGC) | { isLoading: false; hasError: true; error: unknown; }; export declare const useProstglesClient: <S = void, FuncSchema extends ClientFunctionHandler = ClientFunctionHandler, U extends UserLike = UserLike>({ skip, socketOptions: socketPathOrOptions, endpoint, token, ...initOpts }?: UseProstglesClientProps) => ProstglesClientState<ClientOnReadyParams<S, FuncSchema, U>>; export {}; //# sourceMappingURL=useProstglesClient.d.ts.map