prostgles-client
Version:
Reactive client for Postgres
22 lines • 1.06 kB
TypeScript
import { type AnyObject, type SubscriptionChannels, type SubscriptionHandler } from "prostgles-types";
import { type AnyFunction, type CoreParams, type InitOptions } from "./prostgles";
type OnChange = (data: AnyObject[], err?: any) => void;
export type Subscription = CoreParams & {
lastData: any;
onCall: (data: {
data: AnyObject[];
err?: unknown;
}) => void;
handlers: OnChange[];
unsubChannel: string;
reAttach: () => Promise<void>;
};
export declare const getSubscriptionHandler: (initOpts: Pick<InitOptions, "socket" | "onDebug">) => {
addSub: (dbo: any, params: CoreParams, onChange: AnyFunction, _onError?: AnyFunction) => Promise<SubscriptionHandler>;
subscriptions: Map<string, Subscription>;
addServerSub: ({ tableName, command, param1, param2, }: CoreParams) => Promise<SubscriptionChannels>;
_unsubscribe: (channelName: string, unsubChannel: string, handler: AnyFunction) => Promise<true>;
reAttachAll: () => Promise<void>;
};
export {};
//# sourceMappingURL=getSubscriptionHandler.d.ts.map