prostgles-client
Version:
Reactive client for Postgres
22 lines • 1.03 kB
TypeScript
import { type SubscriptionChannels, type SubscriptionHandler } from "prostgles-types";
import { type AnyFunction, type CoreParams, type InitOptions } from "./prostgles";
export type Subscription = CoreParams & {
lastData: any;
onCall: AnyFunction;
handlers: AnyFunction[];
errorHandlers: (AnyFunction | undefined)[];
unsubChannel: string;
reAttach: () => Promise<void>;
};
type Subscriptions = {
[key: string]: Subscription;
};
export declare const getSubscriptionHandler: (initOpts: Pick<InitOptions, "socket" | "onDebug">) => {
addSub: (dbo: any, params: CoreParams, onChange: AnyFunction, _onError?: AnyFunction) => Promise<SubscriptionHandler>;
subscriptions: Subscriptions;
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