bump package version to 1.0.1
[squeep-amqp-helper] / lib / base.js
index 0805d07dff2b4ccf4f30a03e404f8a1bb1eba0d7..6dc5ecb1b2ecc453d1457270172e39c66daede44 100644 (file)
@@ -12,16 +12,21 @@ const _fileScope = fileScope(__filename);
 
 class Base {
   /**
-   * @param {Console} logger
-   * @param {Object} options
-   * @param {String} options.url
-   * @param {Number=} options.prefetch
-   * @param {Object=} options.socketOptions
-   * @param {Boolean=} options.socketOptions.noDelay
-   * @param {Number=} options.socketOptions.timeout
-   * @param {Boolean=} options.socketOptions.keepAlive
-   * @param {Number=} options.socketOptions.keepAliveDelay
-   * @param {Object=} options.socketOptions.clientProperties
+   * @typedef {object} ConsoleLike
+   * @property {Function} debug log debug
+   * @property {Function} error log error
+   */
+  /**
+   * @param {ConsoleLike} logger logger instance
+   * @param {object} options options
+   * @param {string} options.url connection url
+   * @param {number=} options.prefetch prefetch
+   * @param {object=} options.socketOptions socket options
+   * @param {boolean=} options.socketOptions.noDelay no delay
+   * @param {number=} options.socketOptions.timeout timeout
+   * @param {boolean=} options.socketOptions.keepAlive keep alive
+   * @param {number=} options.socketOptions.keepAliveDelay keep alive delay
+   * @param {object=} options.socketOptions.clientProperties client properties
    */
   constructor(logger, options) {
     this.logger = logger;
@@ -193,9 +198,8 @@ class Base {
    * Note:
    * - RabbitMQ does not currently support creating quorum queues with message-ttl.
    * - amqplib does not provide an API to set a ttl policy on the retry queue
-   * @see {@link policyCommand}
-   * 
-   * @param {String} name
+   * @see policyCommand
+   * @param {string} name name
    */
   async establishAMQPPlumbing(name) {
     const _scope = _fileScope('establishAMQPPlumbing');
@@ -274,7 +278,7 @@ class Base {
 
   /**
    * Minimal health-check, connection is writable.
-   * @returns {Boolean}
+   * @returns {boolean} status
    */
   health() {
     return !!this?.connection?.connection?.stream?.writable;
@@ -282,6 +286,8 @@ class Base {
 
   /**
    * Generate an example cli command to create a retry-queue policy.
+   * @param {string} name name
+   * @returns {string} policy command
    */
   policyCommand(name) {
     const settings = {