apache / apache/couchdb-nano

`parseUrl` option is missing from the `Configuration` type in v11

Open
#362 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
689
Forks
167
Avg merge
1h
Merged PRs (30d)
1

Description

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

`lib/nano.d.ts`:

```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:
```js
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

...
```

Contributor guide

Open the contributing guide

Research direction

Start by reading the Configuration interface in lib/nano.d.ts and compare it with the parseUrl handling shown in lib/nano.js and the README configuration documentation. Done means the v11 declaration exposes the existing parseUrl option with documentation consistent with its behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, nodejs, typescript
Domain
api
Issue type
Bug
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
50/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.