/// import { Readable } from 'stream'; import * as parser from './parser'; interface Options { clean: boolean; } /** * es6-map can preserve insertion order even if ES version is older. * * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map#Description * It should be noted that a Map which is a map of an object, especially * a dictionary of dictionaries, will only map to the object's insertion * order. In ES2015 this is ordered for objects but for older versions of * ES, this may be random and not ordered. * */ interface Callback { (e?: Error, d?: any): void; } export default class Store { private _inflights; readonly options: Options; /** * In-memory implementation of the message store * This can actually be saved into files. * * @param {Object} [options] - store options */ constructor(options?: Options); /** * Adds a packet to the store, a packet is * anything that has a messageId property. * */ put(packet: parser.Packet, cb: Callback): this; /** * Creates a stream with all the packets in the store * */ createStream(): Readable; /** * deletes a packet from the store. */ del(packet: parser.Packet, cb: Callback): this; /** * get a packet from the store. */ get(packet: parser.Packet, cb: Callback): this; /** * Close the store */ close(cb?: Callback): void; } export {};