heyujie
2021-05-24 4885600ecc369aa2e30a65de8dd7a410f13c34df
node_modules/mqtt/types/lib/client.d.ts
@@ -19,6 +19,18 @@
   *  is the granted qos level on it, may return 128 on error
   */
  qos: QoS | number
  /*
  * no local flag
  * */
  nl?: boolean,
  /*
  * Retain As Published flag
  * */
  rap?: boolean,
  /*
  * Retain Handling option
  * */
  rh?: number
}
export interface ISubscriptionRequest {
  /**
@@ -29,12 +41,29 @@
   *  is the granted qos level on it
   */
  qos: QoS
  /*
  * no local flag
  * */
  nl?: boolean,
  /*
  * Retain As Published flag
  * */
  rap?: boolean,
  /*
  * Retain Handling option
  * */
  rh?: number
}
export interface ISubscriptionMap {
  /**
   * object which has topic names as object keys and as value the QoS, like {'test1': 0, 'test2': 1}.
   * object which has topic names as object keys and as value the options, like {'test1': {qos: 0}, 'test2': {qos: 2}}.
   */
  [topic: string]: QoS
  [topic: string]: {
    qos: QoS,
    nl?: boolean,
    rap?: boolean,
    rh?: number
  }
}
export declare type ClientSubscribeCallback = (err: Error, granted: ISubscriptionGrant[]) => void
@@ -89,9 +118,12 @@
   * @param {Object}    [opts] - publish options, includes:
   *   @param {Number}  [opts.qos] - qos level to publish on
   *   @param {Boolean} [opts.retain] - whether or not to retain the message
   *   @param {Function}[opts.cbStorePut] - function(){}
   *       called when message is put into `outgoingStore`
   *
   * @param {Function} [callback] - function(err){}
   *    called when publish succeeds or fails
   *
   * @returns {Client} this - for chaining
   * @api public
   *
@@ -133,24 +165,27 @@
   * unsubscribe - unsubscribe from topic(s)
   *
   * @param {String, Array} topic - topics to unsubscribe from
   * @param {Object} opts - opts of unsubscribe
   * @param {Function} [callback] - callback fired on unsuback
   * @returns {MqttClient} this - for chaining
   * @api public
   * @example client.unsubscribe('topic')
   * @example client.unsubscribe('topic', console.log)
   * @example client.unsubscribe('topic', opts, console.log)
   */
  public unsubscribe (topic: string | string[], callback?: PacketCallback): this
  public unsubscribe (topic: string | string[], opts?: Object, callback?: PacketCallback): this
  /**
   * end - close connection
   *
   * @returns {MqttClient} this - for chaining
   * @param {Boolean} force - do not wait for all in-flight messages to be acked
   * @param {Object} opts - opts disconnect
   * @param {Function} cb - called when the client has been closed
   *
   * @api public
   */
  public end (force?: boolean, cb?: CloseCallback): this
  public end (force?: boolean, opts?: Object, cb?: CloseCallback): this
  /**
   * removeOutgoingMessage - remove a message in outgoing store