Skip to content

parseUrl option is missing from the Configuration type in v11 #362

@jbgtmartin

Description

@jbgtmartin

In v11 (11.0.3), the Typescript declaration for nano()'s configuration object is missing the parseUrl parameter.

lib/nano.d.ts:

  /** Nano configuration */
  interface Configuration {
    /** The URL of the CouchDB service, including username and password if required e.g.
     * http://username:password@hostname:port
     */
    url: string;
    /** For cookie authentication */
    cookie?: string;
    /** HTTP Agent options
     * @see README: {@link https://www.npmjs.com/package/nano#pool-size-and-open-sockets}
     */
    agentOptions?: AgentOptions | typeof undici.Agent | typeof undici.MockAgent | typeof undici.Dispatcher;
    /** Logging function 
     * @see README: {@link https://www.npmjs.com/package/nano#logging}
     */
    log?(id: string, args: any): void;
    /** Set to false to prevent parsing of url 
     * @see README: {@link https://www.npmjs.com/package/nano#configuration}
     */
    headers?: object;
    /** Custom request headers
     * @see README: {@link https://www.npmjs.com/package/nano#configuration}
     */
  }

But parseUrl is still used in lib/nano.js, and documented in the README:

module.exports = exports = function dbScope (cfg) {
  let serverScope = {}

  if (typeof cfg === 'string') {
    cfg = { url: cfg }
  }

  assert.strictEqual(typeof cfg, 'object',
    'You must specify the endpoint url when invoking this module')
  assert.ok(/^https?:/.test(cfg.url), 'url is not valid')

  cfg = Object.assign({}, cfg)
  serverScope.config = cfg
  const dummyLogger = () => {}
  const log = typeof cfg.log === 'function' ? cfg.log : dummyLogger
  const parseUrl = 'parseUrl' in cfg ? cfg.parseUrl : true

...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions