cloudant / nodejs-cloudant

Cloudant Node.js client library
Apache License 2.0
255 stars 90 forks source link

Export BasePlugin #408

Closed wrumsby closed 5 years ago

wrumsby commented 5 years ago

Checklist

Description

Fixes #407

Approach

Expose BasePlugin on the Cloudant factory method so that it can be imported directly from @cloudant/cloudant.

This means that custom plugin authors do not need to require @cloudant/cloudant/plugins/base.

Schema & API Changes

BasePlugin is now part of the public API, e.g.

const Cloudant = require('@cloudant/cloudant');

// Cloudant.BasePlugin is now exported meaning that
// BasePlugin is part of the public API

class MyPlugin extends Cloudant.BasePlugin {
  ...
}

const cloudant = Cloudant({ ..., plugins: [MyPlugin] });

TypeScript types also updated to reflect this and types for BasePlugin have been added so that plugin authors can more easily implement plugins in TypeScript.

Security and Privacy

No change

Testing

Modified existing test for TypeScript types.

Monitoring and Logging

No change

bessbd commented 5 years ago

Thank you for the change, @wrumsby

Thank you for the review, @emlaver and @smithsz

I'm about to merge this