UNPKG

@hpcc-js/comms

Version:
40 lines (39 loc) 1.59 kB
import { Cache, Dispatch, IObserverHandle, Message } from "@hpcc-js/util"; import { IConnection, IOptions } from "../connection.ts"; import { StoreService } from "../services/wsStore.ts"; export declare class StoreCache extends Cache<{ BaseUrl: string; Name: string; UserSpecific: boolean; Namespace: string; }, Store> { constructor(); } export declare class ValueChangedMessage extends Message { readonly key: string; value: any; oldValue?: any; constructor(key: string, value: any, oldValue?: any); get canConflate(): boolean; conflate(other: ValueChangedMessage): boolean; void(): boolean; } export declare class Store { protected connection: StoreService; get BaseUrl(): string; readonly Name: string; readonly UserSpecific: boolean; readonly Namespace: string; protected _dispatch: Dispatch<ValueChangedMessage>; static attach(optsConnection: IOptions | IConnection | StoreService, Name: string, Namespace: string, UserSpecific?: boolean): Store; protected constructor(optsConnection: IOptions | IConnection | StoreService, Name: string, Namespace: string, UserSpecific: boolean); private _knownValues; protected create(): void; set(key: string, value: string, broadcast?: boolean): Promise<void>; get(key: string, broadcast?: boolean): Promise<string | undefined>; getAll(broadcast?: boolean): Promise<{ [key: string]: string; }>; delete(key: string, broadcast?: boolean): Promise<void>; monitor(callback: (messages: ValueChangedMessage[]) => void): IObserverHandle; }