diff --git a/lib/db.js b/lib/db.js index a1fe32c..c967f63 100644 --- a/lib/db.js +++ b/lib/db.js @@ -1,13 +1,27 @@ -const Tapable = require('tapable') +const Tapable = require("tapable"); class DB extends Tapable { constructor() { // TODO + super(); + this.options = options || {}; } request() { // TODO + options && Object.assign(this.options, options); + this.applyPlugins("options", this.options); + const opt = this.applyPluginsWaterfall("options", this.options); + return this.applyPluginsBailResult("endpoint", opt) + .then((res) => { + if (this.applyPluginsBailResult("judge", res)) { + return Promise.reject(res); + } else { + return Promise.resolve(res); + } + }) + .catch((error) => Promise.reject(error)); } } -module.exports = DB \ No newline at end of file +module.exports = DB;