npm-api
Advanced tools
Comparing version 0.4.13 to 1.0.0
237
index.js
@@ -1,18 +0,11 @@ | ||
/*! | ||
* npm-api <https://github.com/doowb/npm-api> | ||
* | ||
* Copyright (c) 2015-2017, Brian Woodward. | ||
* Released under the MIT License. | ||
*/ | ||
'use strict'; | ||
var Base = require('base').namespace('cache'); | ||
var utils = require('./lib/utils'); | ||
var List = require('./lib/list'); | ||
var View = require('./lib/view'); | ||
var Repo = require('./lib/models/repo'); | ||
var Maintainer = require('./lib/models/maintainer'); | ||
var Memory = require('./lib/stores/memory'); | ||
const List = require('./lib/list'); | ||
const View = require('./lib/view'); | ||
const Repo = require('./lib/models/repo'); | ||
const Maintainer = require('./lib/models/maintainer'); | ||
const define = (obj, name, value) => Reflect.defineProperty(obj, name, { value }); | ||
let cache = null; | ||
/** | ||
@@ -22,3 +15,3 @@ * NpmApi constructor. Create an instance to work with maintainer and repository information. | ||
* ```js | ||
* var npm = new NpmApi(); | ||
* let npm = new NpmApi(); | ||
* ``` | ||
@@ -28,126 +21,130 @@ * @api public | ||
function NpmApi(options) { | ||
if (!(this instanceof NpmApi)) { | ||
return new NpmApi(options); | ||
class NpmApi { | ||
constructor(options = {}) { | ||
this.options = { ...options }; | ||
this.reset(); | ||
define(this, 'List', List); | ||
define(this, 'View', View); | ||
define(this, 'Repo', Repo); | ||
define(this, 'Maintainer', Maintainer); | ||
} | ||
Base.call(this, null, options); | ||
this.is('npmapi'); | ||
this.use(utils.plugin()); | ||
this.use(utils.option()); | ||
reset() { | ||
cache = new Map(); | ||
cache.set('lists', new Map()); | ||
cache.set('views', new Map()); | ||
cache.set('repos', new Map()); | ||
cache.set('maintainers', new Map()); | ||
} | ||
this.define('List', List); | ||
this.define('View', View); | ||
this.define('Repo', Repo); | ||
this.define('Maintainer', Maintainer); | ||
use(fn) { | ||
fn.call(this, this, this.options); | ||
} | ||
var store = typeof this.options.store === 'undefined' ? new Memory() : this.options.store; | ||
this.define('store', store); | ||
} | ||
/** | ||
* Create a new instance of `View` or get an existing instance to work | ||
* with npm couchdb views. | ||
* | ||
* ```js | ||
* var view = npm.view('byUser'); | ||
* ``` | ||
* | ||
* @param {String} `name` Name of the couchdb view to work with. | ||
* @return {Object} `View` instance | ||
* @api public | ||
*/ | ||
/** | ||
* Extend `Base` | ||
*/ | ||
view(name) { | ||
let views = cache.get('views'); | ||
if (views.has(name)) { | ||
return views.get(name); | ||
} | ||
Base.extend(NpmApi); | ||
let view = new View(name); | ||
views.set(name, view); | ||
return view; | ||
} | ||
/** | ||
* Create a new instance of `View` or get an existing instance to work | ||
* with npm couchdb views. | ||
* | ||
* ```js | ||
* var view = npm.view('byUser'); | ||
* ``` | ||
* | ||
* @param {String} `name` Name of the couchdb view to work with. | ||
* @return {Object} `View` instance | ||
* @api public | ||
*/ | ||
/** | ||
* Create a new instance of `List` or get an existing instance to work | ||
* with npm couchdb list. | ||
* | ||
* ```js | ||
* var list = npm.list('sortCount', 'byUser'); | ||
* ``` | ||
* | ||
* @param {String} `name` Name of the couchdb list to work with. | ||
* @param {String|Object} `view` Name or instance of a `view` to work with. | ||
* @return {Object} `List` instance | ||
* @api public | ||
*/ | ||
NpmApi.prototype.view = function(name) { | ||
if (this.has(['views', name])) { | ||
return this.get(['views', name]); | ||
} | ||
var view = new View(name); | ||
this.set(['views', name], view); | ||
return view; | ||
}; | ||
list(name, view) { | ||
let lists = cache.get('lists'); | ||
let viewName = view; | ||
if (typeof view === 'object') { | ||
viewName = view.name; | ||
} | ||
/** | ||
* Create a new instance of `List` or get an existing instance to work | ||
* with npm couchdb list. | ||
* | ||
* ```js | ||
* var list = npm.list('sortCount', 'byUser'); | ||
* ``` | ||
* | ||
* @param {String} `name` Name of the couchdb list to work with. | ||
* @param {String|Object} `view` Name or instance of a `view` to work with. | ||
* @return {Object} `List` instance | ||
* @api public | ||
*/ | ||
let key = `${viewName}.${name}`; | ||
if (lists.has(key)) { | ||
return lists.get(key); | ||
} | ||
NpmApi.prototype.list = function(name, view) { | ||
var viewName = view; | ||
if (typeof view === 'object') { | ||
viewName = view.name; | ||
} | ||
if (typeof view === 'string') { | ||
view = this.view(view); | ||
} | ||
if (this.has(['lists', viewName, name])) { | ||
return this.get(['lists', viewName, name]); | ||
let list = new List(name, view); | ||
lists.set(key, list); | ||
return list; | ||
} | ||
if (typeof view === 'string') { | ||
view = this.view(view); | ||
} | ||
/** | ||
* Create an instance of a `repo` to work with. | ||
* | ||
* ```js | ||
* var repo = npm.repo('micromatch'); | ||
* ``` | ||
* | ||
* @param {String} `name` Name of the repo as it's published to npm. | ||
* @return {Object} Instance of a `Repo` model to work with. | ||
* @api public | ||
*/ | ||
var list = new List(name, view); | ||
this.set(['lists', viewName, name], list); | ||
return list; | ||
}; | ||
repo(name) { | ||
let repos = cache.get('repos'); | ||
if (repos.has(name)) { | ||
return repos.get(name); | ||
} | ||
/** | ||
* Create an instance of a `repo` to work with. | ||
* | ||
* ```js | ||
* var repo = npm.repo('micromatch'); | ||
* ``` | ||
* | ||
* @param {String} `name` Name of the repo as it's published to npm. | ||
* @return {Object} Instance of a `Repo` model to work with. | ||
* @api public | ||
*/ | ||
NpmApi.prototype.repo = function(name) { | ||
var escaped = name.split('.').join('\\\\.'); | ||
if (this.has(['repos', escaped])) { | ||
return this.get(['repos', escaped]); | ||
let repo = new Repo(name); | ||
repos.set(name, repo); | ||
return repo; | ||
} | ||
var repo = new Repo(name, this.store); | ||
this.set(['repos', escaped], repo); | ||
this.run(repo); | ||
return repo; | ||
}; | ||
/** | ||
* Create an instance of a `maintainer` to work with. | ||
* | ||
* ```js | ||
* var maintainer = npm.maintainer('doowb'); | ||
* ``` | ||
* | ||
* @param {String} `name` Npm username of the maintainer. | ||
* @return {Object} Instance of a `Maintainer` model to work with. | ||
* @api public | ||
*/ | ||
/** | ||
* Create an instance of a `maintainer` to work with. | ||
* | ||
* ```js | ||
* var maintainer = npm.maintainer('doowb'); | ||
* ``` | ||
* | ||
* @param {String} `name` Npm username of the maintainer. | ||
* @return {Object} Instance of a `Maintainer` model to work with. | ||
* @api public | ||
*/ | ||
NpmApi.prototype.maintainer = function(name) { | ||
if (this.has(['maintainers', name])) { | ||
return this.get(['maintainers', name]); | ||
maintainer(name) { | ||
let maintainers = cache.get('maintainers'); | ||
if (maintainers.has(name)) { | ||
return maintainers.get(name); | ||
} | ||
let maintainer = new Maintainer(name); | ||
maintainers.set(name, maintainer); | ||
return maintainer; | ||
} | ||
var maintainer = new Maintainer(name, this.store); | ||
this.set(['maintainers', name], maintainer); | ||
this.run(maintainer); | ||
return maintainer; | ||
}; | ||
} | ||
@@ -154,0 +151,0 @@ /** |
@@ -1,8 +0,1 @@ | ||
/*! | ||
* npm-api <https://github.com/doowb/npm-api> | ||
* | ||
* Copyright (c) 2016, Brian Woodward. | ||
* Licensed under the MIT License. | ||
*/ | ||
'use strict'; | ||
@@ -9,0 +2,0 @@ |
@@ -1,13 +0,6 @@ | ||
/*! | ||
* npm-api <https://github.com/doowb/npm-api> | ||
* | ||
* Copyright (c) 2016, Brian Woodward. | ||
* Licensed under the MIT License. | ||
*/ | ||
'use strict'; | ||
var url = require('url'); | ||
var utils = require('./utils'); | ||
var config = require('./config'); | ||
const url = require('url'); | ||
const utils = require('./utils'); | ||
const config = require('./config'); | ||
@@ -18,3 +11,3 @@ /** | ||
* ```js | ||
* var list = new List('dependedUpon', view); | ||
* let list = new List('dependedUpon', view); | ||
* ``` | ||
@@ -28,34 +21,24 @@ * | ||
function List (name, view) { | ||
if (!(this instanceof List)) { | ||
return new List(name, view); | ||
class List { | ||
constructor(name, view) { | ||
this.name = name; | ||
this.view = view; | ||
this.config = utils.clone(config); | ||
this.config.pathname += '/_list/' + this.view.name + '/' + this.name; | ||
} | ||
this.name = name; | ||
this.view = view; | ||
this.config = utils.clone(config); | ||
this.config.pathname += '/_list/' + this.view.name + '/' + this.name; | ||
} | ||
/** | ||
* Query the couchdb list with the provided parameters. | ||
* | ||
* ```js | ||
* list.query({ key: JSON.stringify(['micromatch']) }) | ||
* .then(function(results) { | ||
* console.log(results); | ||
* }, function(err) { | ||
* console.log(err); | ||
* }); | ||
* ``` | ||
* @param {Object} `params` URL query parameters to pass along to the couchdb list. | ||
* @return {Promise} Results of the query when promise is resolved. | ||
* @api public | ||
*/ | ||
/** | ||
* Query the couchdb list with the provided parameters. | ||
* | ||
* ```js | ||
* let results = await list.query({ key: JSON.stringify(['micromatch']) }) | ||
* ``` | ||
* @param {Object} `params` URL query parameters to pass along to the couchdb list. | ||
* @return {Promise} Results of the query when promise is resolved. | ||
* @api public | ||
*/ | ||
List.prototype.query = function(params) { | ||
params = params || {}; | ||
return utils.co(function* (self) { | ||
return yield new Promise(function(resolve, reject) { | ||
utils.request(self.url(params), function (err, response, body) { | ||
query(params = {}) { | ||
return new Promise(async(resolve, reject) => { | ||
utils.request(this.url(params), (err, response, body) => { | ||
if (err) return reject(err); | ||
@@ -71,16 +54,16 @@ var res = {}; | ||
}); | ||
}, this); | ||
}; | ||
} | ||
/** | ||
* Build a formatted url with the provided parameters. | ||
* | ||
* @param {Object} `params` URL query parameters. | ||
* @return {String} formatted url string | ||
* @api public | ||
*/ | ||
/** | ||
* Build a formatted url with the provided parameters. | ||
* | ||
* @param {Object} `query` URL query parameters. | ||
* @return {String} formatted url string | ||
* @api public | ||
*/ | ||
List.prototype.url = function(params) { | ||
return url.format(utils.merge({}, this.config, {query: params || {}})); | ||
}; | ||
url(query = {}) { | ||
return url.format({ ...this.config, query }); | ||
} | ||
} | ||
@@ -87,0 +70,0 @@ /** |
@@ -1,17 +0,9 @@ | ||
/*! | ||
* npm-api <https://github.com/doowb/npm-api> | ||
* | ||
* Copyright (c) 2016, Brian Woodward. | ||
* Licensed under the MIT License. | ||
*/ | ||
'use strict'; | ||
var Base = require('base').namespace('cache'); | ||
var utils = require('../utils'); | ||
var List = require('../list'); | ||
var View = require('../view'); | ||
var Registry = require('../registry'); | ||
var Memory = require('../stores/memory'); | ||
const List = require('../list'); | ||
const View = require('../view'); | ||
const Registry = require('../registry'); | ||
const define = (obj, name, value) => Reflect.defineProperty(obj, name, { value }); | ||
/** | ||
@@ -24,25 +16,17 @@ * Base model to include common plugins. | ||
function BaseModel(store) { | ||
if (!(this instanceof BaseModel)) { | ||
return new BaseModel(store); | ||
class BaseModel { | ||
constructor(options = {}) { | ||
this.options = { ...options }; | ||
this.cache = new Map(); | ||
define(this, 'List', List); | ||
define(this, 'View', View); | ||
define(this, 'Registry', Registry); | ||
} | ||
Base.call(this); | ||
this.options = this.options || {}; | ||
this.cache = this.cache || {}; | ||
this.use(utils.option()); | ||
this.use(utils.plugin()); | ||
this.define('List', List); | ||
this.define('View', View); | ||
this.define('Registry', Registry); | ||
this.define('store', store || new Memory()); | ||
use(fn) { | ||
fn.call(this, this, this.options); | ||
} | ||
} | ||
/** | ||
* Extend `Base` | ||
*/ | ||
Base.extend(BaseModel); | ||
/** | ||
* Exposes `BaseModel` | ||
@@ -49,0 +33,0 @@ */ |
@@ -1,12 +0,6 @@ | ||
/*! | ||
* npm-api <https://github.com/doowb/npm-api> | ||
* | ||
* Copyright (c) 2016, Brian Woodward. | ||
* Licensed under the MIT License. | ||
*/ | ||
'use strict'; | ||
var utils = require('../utils'); | ||
var Base = require('./base'); | ||
const Base = require('./base'); | ||
const utils = require('../utils'); | ||
const config = require('../config'); | ||
@@ -17,53 +11,52 @@ /** | ||
* ```js | ||
* var maintainer = new Maintainer('doowb'); | ||
* const maintainer = new Maintainer('doowb'); | ||
* ``` | ||
* | ||
* @param {String} `name` Name of the npm maintainer to get information about. | ||
* @param {Object} `store` Optional cache store instance for caching results. Defaults to a memory store. | ||
* @api public | ||
*/ | ||
function Maintainer (name, store) { | ||
if (!(this instanceof Maintainer)) { | ||
return new Maintainer(name); | ||
class Maintainer extends Base { | ||
constructor(name) { | ||
super(); | ||
this.name = name; | ||
this.config = utils.clone(config); | ||
} | ||
Base.call(this, store); | ||
this.is('maintainer'); | ||
this.name = name; | ||
} | ||
/** | ||
* Extend `Base` | ||
*/ | ||
/** | ||
* Get the repositories owned by this maintainer. | ||
* | ||
* ```js | ||
* maintainer.repos() | ||
* .then(function(repos) { | ||
* console.log(repos); | ||
* }, function(err) { | ||
* console.error(err); | ||
* }); | ||
* ``` | ||
* | ||
* @return {Promise} Returns array of repository names when promise resolves. | ||
* @api public | ||
*/ | ||
Base.extend(Maintainer); | ||
async repos() { | ||
if (!this.cache.has('repos')) { | ||
let from = 0; | ||
let size = 250; | ||
let url = `${this.config.registry}-/v1/search?text=maintainer:${this.name}&size=${size}`; | ||
let results = []; | ||
await utils.paged(url, (_, res, acc) => { | ||
let { objects, total } = res.data; | ||
results.push(...objects); | ||
if (total >= (from + size)) { | ||
from += size; | ||
return `${url}&from=${from}`; | ||
} | ||
}); | ||
/** | ||
* Get the repositories owned by this maintainer. | ||
* | ||
* ```js | ||
* maintainer.repos() | ||
* .then(function(repos) { | ||
* console.log(repos); | ||
* }, function(err) { | ||
* console.error(err); | ||
* }); | ||
* ``` | ||
* | ||
* @return {Promise} Returns array of repository names when promise resolves. | ||
* @api public | ||
*/ | ||
Maintainer.prototype.repos = function() { | ||
return utils.co(function* (self) { | ||
if (!self.cache.repos) { | ||
var view = new self.View('byUser'); | ||
var results = yield view.query({key: JSON.stringify(self.name)}); | ||
self.cache.repos = results.map(function (repo) { | ||
return repo.value; | ||
}); | ||
this.cache.set('repos', results.map(obj => obj.package.name)); | ||
} | ||
return self.cache.repos; | ||
}, this); | ||
}; | ||
return this.cache.get('repos'); | ||
} | ||
} | ||
@@ -70,0 +63,0 @@ /** |
@@ -1,13 +0,5 @@ | ||
/*! | ||
* npm-api <https://github.com/doowb/npm-api> | ||
* | ||
* Copyright (c) 2016, Brian Woodward. | ||
* Licensed under the MIT License. | ||
*/ | ||
'use strict'; | ||
var Base = require('./base'); | ||
var utils = require('../utils'); | ||
var downloads = require('../plugins/downloads'); | ||
const Base = require('./base'); | ||
const downloads = require('../plugins/downloads'); | ||
@@ -18,76 +10,64 @@ /** | ||
* ```js | ||
* var repo = new Repo('micromatch'); | ||
* const repo = new Repo('micromatch'); | ||
* ``` | ||
* | ||
* @param {String} `name` Name of the npm repo to get information about. | ||
* @param {Object} `store` Optional cache store instance for caching results. Defaults to a memory store. | ||
* @api public | ||
*/ | ||
function Repo (name, store) { | ||
if (!(this instanceof Repo)) { | ||
return new Repo(name); | ||
class Repo extends Base { | ||
constructor(name) { | ||
super(); | ||
this.name = name; | ||
this.use(downloads()); | ||
} | ||
Base.call(this, store); | ||
this.is('repo'); | ||
this.name = name; | ||
this.use(downloads()); | ||
} | ||
/** | ||
* Extend `Base` | ||
*/ | ||
/** | ||
* Get the repo's published package.json. | ||
* | ||
* ```js | ||
* repo.package() | ||
* .then(function(pkg) { | ||
* console.log(pkg); | ||
* }, function(err) { | ||
* console.error(err); | ||
* }); | ||
* ``` | ||
* @return {Promise} Returns the package.json object when promise resolves. | ||
* @api public | ||
*/ | ||
Base.extend(Repo); | ||
async package(version = 'latest') { | ||
let key = `pkg-${version}`; | ||
/** | ||
* Get the repo's published package.json. | ||
* | ||
* ```js | ||
* repo.package() | ||
* .then(function(pkg) { | ||
* console.log(pkg); | ||
* }, function(err) { | ||
* console.error(err); | ||
* }); | ||
* ``` | ||
* @return {Promise} Returns the package.json object when promise resolves. | ||
* @api public | ||
*/ | ||
Repo.prototype.package = function(version) { | ||
return utils.co(function* (self) { | ||
version = version || 'latest'; | ||
if (!self.has('pkg-' + version)) { | ||
var registry = new self.Registry(); | ||
var results = yield registry.get(self.name); | ||
var pkg = version === 'all' | ||
if (!this.cache.has(key)) { | ||
let registry = new this.Registry(); | ||
let results = await registry.get(this.name); | ||
let pkg = version === 'all' | ||
? results | ||
: (results.versions[version] || results.versions[results['dist-tags'][version]]); | ||
self.set('pkg-' + version, pkg); | ||
this.cache.set(key, pkg); | ||
} | ||
return self.get('pkg-' + version); | ||
}, this); | ||
}; | ||
return this.cache.get(key); | ||
} | ||
/** | ||
* Get the repo's published package.json value for the specified version. | ||
* | ||
* ```js | ||
* repo.version('0.2.0') | ||
* .then(function(pkg) { | ||
* console.log(pkg); | ||
* }, function(err) { | ||
* console.error(err); | ||
* }); | ||
* ``` | ||
* @param {String} `version` Specific version to retrieve. | ||
* @return {Promise} Returns the package.json object for the specified version when promise resolves. | ||
* @api public | ||
*/ | ||
/** | ||
* Get the repo's published package.json value for the specified version. | ||
* | ||
* ```js | ||
* repo.version('0.2.0') | ||
* .then(function(pkg) { | ||
* console.log(pkg); | ||
* }, function(err) { | ||
* console.error(err); | ||
* }); | ||
* ``` | ||
* @param {String} `version` Specific version to retrieve. | ||
* @return {Promise} Returns the package.json object for the specified version when promise resolves. | ||
* @api public | ||
*/ | ||
Repo.prototype.version = function(version) { | ||
return utils.co(function* (self) { | ||
var pkg = yield self.package('all'); | ||
async version(version) { | ||
let pkg = await this.package('all'); | ||
if (pkg['dist-tags'][version]) { | ||
@@ -100,69 +80,66 @@ version = pkg['dist-tags'][version]; | ||
return pkg.versions[version]; | ||
}, this); | ||
}; | ||
} | ||
/** | ||
* Get the repo's dependencies for the specified version. | ||
* | ||
* ```js | ||
* repo.dependencies() | ||
* .then(function(dependencies) { | ||
* console.log(dependencies); | ||
* }, function(err) { | ||
* console.error(err); | ||
* }); | ||
* ``` | ||
* @param {String} `version` Specific version to retrieve. Defaults to `latest`. | ||
* @return {Promise} Returns the dependencies object for the specified version when promise resolves. | ||
* @api public | ||
*/ | ||
/** | ||
* Get the repo's dependencies for the specified version. | ||
* | ||
* ```js | ||
* repo.dependencies() | ||
* .then(function(dependencies) { | ||
* console.log(dependencies); | ||
* }, function(err) { | ||
* console.error(err); | ||
* }); | ||
* ``` | ||
* @param {String} `version` Specific version to retrieve. Defaults to `latest`. | ||
* @return {Promise} Returns the dependencies object for the specified version when promise resolves. | ||
* @api public | ||
*/ | ||
Repo.prototype.dependencies = function(version) { | ||
return this.prop('dependencies', version); | ||
}; | ||
dependencies(version) { | ||
return this.prop('dependencies', version); | ||
} | ||
/** | ||
* Get the repo's devDependencies for the specified version. | ||
* | ||
* ```js | ||
* repo.devDependencies() | ||
* .then(function(devDependencies) { | ||
* console.log(devDependencies); | ||
* }, function(err) { | ||
* console.error(err); | ||
* }); | ||
* ``` | ||
* @param {String} `version` Specific version to retrieve. Defaults to `latest`. | ||
* @return {Promise} Returns the devDependencies object for the specified version when promise resolves. | ||
* @api public | ||
*/ | ||
/** | ||
* Get the repo's devDependencies for the specified version. | ||
* | ||
* ```js | ||
* repo.devDependencies() | ||
* .then(function(devDependencies) { | ||
* console.log(devDependencies); | ||
* }, function(err) { | ||
* console.error(err); | ||
* }); | ||
* ``` | ||
* @param {String} `version` Specific version to retrieve. Defaults to `latest`. | ||
* @return {Promise} Returns the devDependencies object for the specified version when promise resolves. | ||
* @api public | ||
*/ | ||
Repo.prototype.devDependencies = function(version) { | ||
return this.prop('devDependencies', version); | ||
}; | ||
devDependencies(version) { | ||
return this.prop('devDependencies', version); | ||
} | ||
/** | ||
* Get the specified property from the repo's package.json for the specified version. | ||
* | ||
* ```js | ||
* repo.prop('author') | ||
* .then(function(author) { | ||
* console.log(author); | ||
* }, function(err) { | ||
* console.error(err); | ||
* }); | ||
* ``` | ||
* @param {String} `prop` Name of the property to get. | ||
* @param {String} `version` Specific version to retrieve. Defaults to `latest`. | ||
* @return {Promise} Returns the property for the specified version when promise resolves. | ||
* @api public | ||
*/ | ||
/** | ||
* Get the specified property from the repo's package.json for the specified version. | ||
* | ||
* ```js | ||
* repo.prop('author') | ||
* .then(function(author) { | ||
* console.log(author); | ||
* }, function(err) { | ||
* console.error(err); | ||
* }); | ||
* ``` | ||
* @param {String} `prop` Name of the property to get. | ||
* @param {String} `version` Specific version to retrieve. Defaults to `latest`. | ||
* @return {Promise} Returns the property for the specified version when promise resolves. | ||
* @api public | ||
*/ | ||
Repo.prototype.prop = function(prop, version) { | ||
version = version || 'latest'; | ||
return utils.co(function* (self) { | ||
var pkg = yield self.version(version); | ||
async prop(prop, version = 'latest') { | ||
let pkg = await this.version(version); | ||
return pkg[prop]; | ||
}, this); | ||
}; | ||
} | ||
} | ||
@@ -169,0 +146,0 @@ /** |
@@ -1,84 +0,65 @@ | ||
/*! | ||
* npm-api <https://github.com/doowb/npm-api> | ||
* | ||
* Copyright (c) 2016, Brian Woodward. | ||
* Licensed under the MIT License. | ||
*/ | ||
'use strict'; | ||
var path = require('path'); | ||
var utils = require('../utils'); | ||
const utils = require('../utils'); | ||
const define = (obj, name, value) => Reflect.defineProperty(obj, name, { value }); | ||
module.exports = function (options) { | ||
return function (app) { | ||
module.exports = (options = {}) => { | ||
return function() { | ||
let log = (...args) => { | ||
if (this.options.verbose === true || options.verbose === true) { | ||
console.log(...args); | ||
} | ||
}; | ||
var log = function() { | ||
if ((this.options && this.options.verbose === true) || | ||
(options && options.verbose === true)) { | ||
console.log.apply(console, arguments); | ||
define(this, 'total', async() => { | ||
if (!this.cache.has('total')) { | ||
let results = await this.downloads(); | ||
this.cache.set('total', utils.stats.calc.total(results)); | ||
} | ||
}.bind(this); | ||
app.define('total', function() { | ||
return utils.co(function* (self) { | ||
if (typeof self.cache.total === 'undefined') { | ||
var results = yield self.downloads(); | ||
self.cache.total = utils.stats.calc.total(results); | ||
} | ||
return self.cache.total; | ||
}, this); | ||
return this.cache.get('total'); | ||
}); | ||
app.define('last', function(n) { | ||
return utils.co(function* (self) { | ||
var key = 'last-' + n; | ||
if (typeof self.cache[key] === 'undefined') { | ||
var results = yield self.downloads(); | ||
self.cache[key] = utils.stats.calc.last(n, results); | ||
} | ||
return self.cache[key]; | ||
}, this); | ||
define(this, 'last', async(n) => { | ||
let key = 'last-' + n; | ||
if (!this.cache.has(key)) { | ||
let results = await this.downloads(); | ||
this.cache.set(key, utils.stats.calc.last(n, results)); | ||
} | ||
return this.cache.get(key); | ||
}); | ||
app.define('downloads', function(start) { | ||
return utils.co(function* (self) { | ||
var end = self.option('end') ? | ||
utils.moment(self.option('end')) : | ||
utils.moment.utc().subtract(1, 'days'); | ||
define(this, 'downloads', (start = '2005-01-01') => { | ||
let end = this.options.end | ||
? utils.moment(this.options.end) | ||
: utils.moment.utc().subtract(1, 'days'); | ||
start = start || '2005-01-01'; | ||
start = utils.moment(start); | ||
var downloads = []; | ||
return yield new Promise(function(resolve, reject) { | ||
log('getting downloads for "' + self.name + '"'); | ||
utils.stats.get(start, end, self.name) | ||
.on('data', function (data) { | ||
downloads.push(data); | ||
}) | ||
.on('error', function(err) { | ||
log('ERROR: [' + self.name + ']'); | ||
log(err); | ||
}) | ||
.on('end', function () { | ||
downloads.sort(function(a, b) { | ||
if (a.day < b.day) return 1; | ||
if (a.day > b.day) return -1; | ||
return 0; | ||
}); | ||
var results = []; | ||
downloads.forEach(function(download) { | ||
if (results.filter(function(d) { | ||
return d.day === download.day; | ||
}).length === 0) { | ||
results.push(download); | ||
} | ||
}); | ||
resolve(results); | ||
start = utils.moment(start); | ||
let downloads = []; | ||
return new Promise((resolve, reject) => { | ||
log('getting downloads for "' + this.name + '"'); | ||
utils.stats.get(start, end, this.name) | ||
.on('data', (data) => { | ||
downloads.push(data); | ||
}) | ||
.on('error', (err) => { | ||
log('ERROR: [' + this.name + ']'); | ||
log(err); | ||
}) | ||
.on('end', () => { | ||
downloads.sort((a, b) => { | ||
if (a.day < b.day) return 1; | ||
if (a.day > b.day) return -1; | ||
return 0; | ||
}); | ||
}); | ||
}, this); | ||
let results = []; | ||
downloads.forEach(download => { | ||
if (!results.find(d => d.day === download.day)) { | ||
results.push(download); | ||
} | ||
}); | ||
resolve(results); | ||
}); | ||
}); | ||
}); | ||
}; | ||
}; |
@@ -1,13 +0,5 @@ | ||
/*! | ||
* npm-api <https://github.com/doowb/npm-api> | ||
* | ||
* Copyright (c) 2016, Brian Woodward. | ||
* Licensed under the MIT License. | ||
*/ | ||
'use strict'; | ||
var url = require('url'); | ||
var utils = require('./utils'); | ||
var config = require('./config'); | ||
const utils = require('./utils'); | ||
const config = require('./config'); | ||
@@ -18,3 +10,3 @@ /** | ||
* ```js | ||
* var registry = new Registry(); | ||
* const registry = new Registry(); | ||
* ``` | ||
@@ -26,33 +18,24 @@ * | ||
function Registry () { | ||
if (!(this instanceof Registry)) { | ||
return new Registry(); | ||
class Registry { | ||
constructor() { | ||
this.config = utils.clone(config); | ||
} | ||
this.config = utils.clone(config); | ||
} | ||
/** | ||
* Get the package.json for the specified repository. | ||
* | ||
* ```js | ||
* registry.get('micromatch') | ||
* .then(function(results) { | ||
* console.log(results); | ||
* }, function(err) { | ||
* console.log(err); | ||
* }); | ||
* ``` | ||
* @param {String} `name` Repository name to get. | ||
* @return {Promise} Results of the query when promise is resolved. | ||
* @api public | ||
*/ | ||
/** | ||
* Get the package.json for the specified repository. | ||
* | ||
* ```js | ||
* let results = await registry.get('micromatch') | ||
* ``` | ||
* @param {String} `name` Repository name to get. | ||
* @return {Promise} Results of the query when promise is resolved. | ||
* @api public | ||
*/ | ||
Registry.prototype.get = function(name) { | ||
return utils.co(function* (self) { | ||
return yield new Promise(function(resolve, reject) { | ||
var pkg = ''; | ||
utils.request.get(self.url(name), function(err, res, body) { | ||
get(name) { | ||
return new Promise((resolve, reject) => { | ||
utils.request.get(this.url(name), (err, res, body) => { | ||
if (err) return reject(err); | ||
try { | ||
var data = JSON.parse(body); | ||
let data = JSON.parse(body); | ||
resolve(data); | ||
@@ -64,19 +47,19 @@ } catch (err) { | ||
}); | ||
}, this); | ||
}; | ||
} | ||
/** | ||
* Build a formatted url | ||
* | ||
* @param {String} `name` Repo name. | ||
* @return {String} formatted url string | ||
* @api public | ||
*/ | ||
/** | ||
* Build a formatted url | ||
* | ||
* @param {String} `name` Repo name. | ||
* @return {String} formatted url string | ||
* @api public | ||
*/ | ||
Registry.prototype.url = function(name) { | ||
if (name[0] === '@' && name.indexOf('/') !== -1) { | ||
name = '@' + encodeURIComponent(name.slice(1)); | ||
url(name) { | ||
if (name[0] === '@' && name.indexOf('/') !== -1) { | ||
name = '@' + encodeURIComponent(name.slice(1)); | ||
} | ||
return this.config.registry + name; | ||
} | ||
return this.config.registry += name; | ||
}; | ||
} | ||
@@ -83,0 +66,0 @@ /** |
@@ -1,62 +0,13 @@ | ||
/*! | ||
* npm-api <https://github.com/doowb/npm-api> | ||
* | ||
* Copyright (c) 2016, Brian Woodward. | ||
* Licensed under the MIT License. | ||
*/ | ||
'use strict'; | ||
/** | ||
* Module dependencies | ||
*/ | ||
const utils = module.exports = {}; | ||
const define = (name, get) => Reflect.defineProperty(utils, name, { get }); | ||
var utils = require('lazy-cache')(require); | ||
define('clone', () => require('clone-deep')); | ||
define('JSONStream', () => require('JSONStream')); | ||
define('moment', () => require('moment')); | ||
define('paged', () => require('paged-request')); | ||
define('request', () => require('request')); | ||
define('stats', () => require('download-stats')); | ||
/** | ||
* Temporarily re-assign `require` to trick browserify and | ||
* webpack into reconizing lazy dependencies. | ||
* | ||
* This tiny bit of ugliness has the huge dual advantage of | ||
* only loading modules that are actually called at some | ||
* point in the lifecycle of the application, whilst also | ||
* allowing browserify and webpack to find modules that | ||
* are depended on but never actually called. | ||
*/ | ||
var fn = require; | ||
require = utils; | ||
/** | ||
* Lazily required module dependencies | ||
*/ | ||
require('base-option', 'option'); | ||
require('base-plugins', 'plugin'); | ||
require('clone-deep', 'clone'); | ||
require('co'); | ||
require('data-store', 'store'); | ||
require('download-stats', 'stats'); | ||
require('get-value', 'get'); | ||
require('JSONStream', 'JSONStream'); | ||
require('merge-deep', 'merge'); | ||
require('moment'); | ||
require('request'); | ||
require('set-value', 'set'); | ||
/** | ||
* Restore `require` | ||
*/ | ||
require = fn; | ||
utils.arrayify = function(val) { | ||
if (!val) return []; | ||
return Array.isArray(val) ? val : [val]; | ||
}; | ||
/** | ||
* Expose `utils` modules | ||
*/ | ||
module.exports = utils; | ||
utils.arrayify = val => val ? (Array.isArray(val) ? val : [val]) : []; |
137
lib/view.js
@@ -1,13 +0,6 @@ | ||
/*! | ||
* npm-api <https://github.com/doowb/npm-api> | ||
* | ||
* Copyright (c) 2016, Brian Woodward. | ||
* Licensed under the MIT License. | ||
*/ | ||
'use strict'; | ||
var url = require('url'); | ||
var utils = require('./utils'); | ||
var config = require('./config'); | ||
const url = require('url'); | ||
const utils = require('./utils'); | ||
const config = require('./config'); | ||
@@ -18,3 +11,3 @@ /** | ||
* ```js | ||
* var view = new View('dependedUpon'); | ||
* const view = new View('dependedUpon'); | ||
* ``` | ||
@@ -27,37 +20,32 @@ * | ||
function View (name) { | ||
if (!(this instanceof View)) { | ||
return new View(name); | ||
class View { | ||
constructor(name) { | ||
this.name = name; | ||
this.config = utils.clone(config); | ||
this.config.pathname += '/_view/' + this.name; | ||
} | ||
this.name = name; | ||
this.config = utils.clone(config); | ||
this.config.pathname += '/_view/' + this.name; | ||
} | ||
/** | ||
* Query the couchdb view with the provided parameters. | ||
* | ||
* ```js | ||
* view.query({ group_level: 2, startkey: JSON.stringify(['micromatch']), endkey: JSON.stringify(['micromatch', {}])}) | ||
* .then(function(results) { | ||
* console.log(results); | ||
* }, function(err) { | ||
* console.log(err); | ||
* }); | ||
* ``` | ||
* @param {Object} `params` URL query parameters to pass along to the couchdb view. | ||
* @return {Promise} Results of the query when promise is resolved. | ||
* @api public | ||
*/ | ||
/** | ||
* Query the couchdb view with the provided parameters. | ||
* | ||
* ```js | ||
* let results = await view.query({ | ||
* group_level: 2, | ||
* startkey: JSON.stringify(['micromatch']), | ||
* endkey: JSON.stringify(['micromatch', {}]) | ||
* }); | ||
* ``` | ||
* @param {Object} `params` URL query parameters to pass along to the couchdb view. | ||
* @return {Promise} Results of the query when promise is resolved. | ||
* @api public | ||
*/ | ||
View.prototype.query = function(params) { | ||
return utils.co(function* (self) { | ||
params = params || {}; | ||
return yield new Promise(function(resolve, reject) { | ||
var items = []; | ||
var header = {}; | ||
utils.request(self.url(params)) | ||
query(params = {}) { | ||
return new Promise((resolve, reject) => { | ||
let items = []; | ||
let header = {}; | ||
utils.request(this.url(params)) | ||
.once('error', reject) | ||
.pipe(utils.JSONStream.parse('rows.*')) | ||
.on('header', function(data) { | ||
.on('header', (data) => { | ||
header = data; | ||
@@ -68,44 +56,47 @@ if (header.error) { | ||
}) | ||
.on('data', function (data) { | ||
.on('data', (data) => { | ||
items.push(data); | ||
}) | ||
.once('error', reject) | ||
.once('end', function () { | ||
.once('end', () => { | ||
resolve(items); | ||
}); | ||
}); | ||
}, this); | ||
}; | ||
} | ||
/** | ||
* Query the couchdb view with the provided parameters and return a stream of results. | ||
* | ||
* ```js | ||
* view.stream({ group_level: 2, startkey: JSON.stringify(['micromatch']), endkey: JSON.stringify(['micromatch', {}])}) | ||
* .on('data', function(data) { | ||
* console.log(data); | ||
* }); | ||
* ``` | ||
* @param {Object} `params` URL query parameters to pass along to the couchdb view. | ||
* @return {Stream} Streaming results of the query. | ||
* @api public | ||
*/ | ||
/** | ||
* Query the couchdb view with the provided parameters and return a stream of results. | ||
* | ||
* ```js | ||
* view.stream({ | ||
* group_level: 2, | ||
* startkey: JSON.stringify(['micromatch']), | ||
* endkey: JSON.stringify(['micromatch', {}]) | ||
* }) | ||
* .on('data', (data) => { | ||
* console.log(data); | ||
* }); | ||
* ``` | ||
* @param {Object} `params` URL query parameters to pass along to the couchdb view. | ||
* @return {Stream} Streaming results of the query. | ||
* @api public | ||
*/ | ||
View.prototype.stream = function(params) { | ||
params = params || {}; | ||
return utils.request(this.url(params)) | ||
.pipe(utils.JSONStream.parse('rows.*')); | ||
}; | ||
stream(params = {}) { | ||
return utils.request(this.url(params)) | ||
.pipe(utils.JSONStream.parse('rows.*')); | ||
} | ||
/** | ||
* Build a formatted url with the provided parameters. | ||
* | ||
* @param {Object} `params` URL query parameters. | ||
* @return {String} formatted url string | ||
* @api public | ||
*/ | ||
/** | ||
* Build a formatted url with the provided parameters. | ||
* | ||
* @param {Object} `query` URL query parameters. | ||
* @return {String} formatted url string | ||
* @api public | ||
*/ | ||
View.prototype.url = function(params) { | ||
return url.format(utils.merge({}, this.config, {query: params || {}})); | ||
}; | ||
url(query = {}) { | ||
return url.format({ ...this.config, query }); | ||
} | ||
} | ||
@@ -112,0 +103,0 @@ /** |
{ | ||
"name": "npm-api", | ||
"description": "Base class for retrieving data from the npm registry.", | ||
"version": "0.4.13", | ||
"version": "1.0.0", | ||
"homepage": "https://github.com/doowb/npm-api", | ||
"author": "Brian Woodward (https://github.com/doowb)", | ||
"contributors": [ | ||
"0xflotus (https://github.com/0xflotus)", | ||
"Brian Woodward (https://twitter.com/doowb)", | ||
"Nachman Berkowitz (https://github.com/NachmanBerkowitz)" | ||
], | ||
"repository": "doowb/npm-api", | ||
@@ -18,3 +23,3 @@ "bugs": { | ||
"engines": { | ||
"node": ">=0.10.0" | ||
"node": ">=10.0" | ||
}, | ||
@@ -24,22 +29,2 @@ "scripts": { | ||
}, | ||
"dependencies": { | ||
"JSONStream": "^1.2.1", | ||
"base": "^0.11.1", | ||
"base-option": "^0.8.4", | ||
"base-plugins": "^0.4.13", | ||
"clone-deep": "^0.2.4", | ||
"co": "^4.6.0", | ||
"data-store": "^0.16.1", | ||
"download-stats": "^0.3.4", | ||
"get-value": "^2.0.6", | ||
"lazy-cache": "^2.0.2", | ||
"merge-deep": "^3.0.0", | ||
"moment": "^2.16.0", | ||
"request": "^2.78.0", | ||
"set-value": "^0.4.0" | ||
}, | ||
"devDependencies": { | ||
"gulp-format-md": "^0.1.11", | ||
"mocha": "^3.1.2" | ||
}, | ||
"keywords": [ | ||
@@ -81,3 +66,15 @@ "api", | ||
} | ||
}, | ||
"devDependencies": { | ||
"gulp-format-md": "^2.0.0", | ||
"mocha": "^6.1.4" | ||
}, | ||
"dependencies": { | ||
"JSONStream": "^1.3.5", | ||
"clone-deep": "^4.0.1", | ||
"download-stats": "^0.3.4", | ||
"moment": "^2.24.0", | ||
"paged-request": "^2.0.1", | ||
"request": "^2.88.0" | ||
} | ||
} |
@@ -1,2 +0,2 @@ | ||
# npm-api [![NPM version](https://img.shields.io/npm/v/npm-api.svg?style=flat)](https://www.npmjs.com/package/npm-api) [![NPM monthly downloads](https://img.shields.io/npm/dm/npm-api.svg?style=flat)](https://npmjs.org/package/npm-api) [![NPM total downloads](https://img.shields.io/npm/dt/npm-api.svg?style=flat)](https://npmjs.org/package/npm-api) [![Linux Build Status](https://img.shields.io/travis/doowb/npm-api.svg?style=flat&label=Travis)](https://travis-ci.org/doowb/npm-api) [![Windows Build Status](https://img.shields.io/appveyor/ci/doowb/npm-api.svg?style=flat&label=AppVeyor)](https://ci.appveyor.com/project/doowb/npm-api) | ||
# npm-api [![NPM version](https://img.shields.io/npm/v/npm-api.svg?style=flat)](https://www.npmjs.com/package/npm-api) [![NPM monthly downloads](https://img.shields.io/npm/dm/npm-api.svg?style=flat)](https://npmjs.org/package/npm-api) [![NPM total downloads](https://img.shields.io/npm/dt/npm-api.svg?style=flat)](https://npmjs.org/package/npm-api) [![Linux Build Status](https://img.shields.io/travis/doowb/npm-api.svg?style=flat&label=Travis)](https://travis-ci.org/doowb/npm-api) | ||
@@ -3,0 +3,0 @@ > Base class for retrieving data from the npm registry. |
Sorry, the diff of this file is not supported yet
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
6
0
1
30287
13
636
+ Addedpaged-request@^2.0.1
+ Addedaxios@0.21.4(transitive)
+ Addedclone-deep@4.0.1(transitive)
+ Addedfollow-redirects@1.15.6(transitive)
+ Addedkind-of@6.0.3(transitive)
+ Addedpaged-request@2.0.2(transitive)
+ Addedshallow-clone@3.0.1(transitive)
- Removedbase@^0.11.1
- Removedbase-option@^0.8.4
- Removedbase-plugins@^0.4.13
- Removedco@^4.6.0
- Removeddata-store@^0.16.1
- Removedget-value@^2.0.6
- Removedlazy-cache@^2.0.2
- Removedmerge-deep@^3.0.0
- Removedset-value@^0.4.0
- Removedarr-flatten@1.1.0(transitive)
- Removedarr-union@3.1.0(transitive)
- Removedassign-symbols@1.0.0(transitive)
- Removedbalanced-match@1.0.2(transitive)
- Removedbase@0.11.2(transitive)
- Removedbase-option@0.8.4(transitive)
- Removedbase-plugins@0.4.13(transitive)
- Removedbrace-expansion@1.1.11(transitive)
- Removedcache-base@0.8.51.0.1(transitive)
- Removedcall-bind@1.0.7(transitive)
- Removedclass-utils@0.3.6(transitive)
- Removedclone-deep@0.2.4(transitive)
- Removedco@4.6.0(transitive)
- Removedcollection-visit@0.2.31.0.0(transitive)
- Removedcomponent-emitter@1.3.1(transitive)
- Removedconcat-map@0.0.1(transitive)
- Removedcopy-descriptor@0.1.1(transitive)
- Removedcwd@0.9.1(transitive)
- Removeddata-store@0.16.1(transitive)
- Removeddebug@2.6.9(transitive)
- Removeddefine-data-property@1.1.4(transitive)
- Removeddefine-property@0.2.51.0.0(transitive)
- Removedes-define-property@1.0.0(transitive)
- Removedes-errors@1.3.0(transitive)
- Removedexpand-tilde@1.2.2(transitive)
- Removedextend-shallow@2.0.13.0.2(transitive)
- Removedfile-name@0.1.0(transitive)
- Removedfind-file-up@0.1.3(transitive)
- Removedfind-pkg@0.1.2(transitive)
- Removedfor-in@0.1.81.0.2(transitive)
- Removedfor-own@0.1.5(transitive)
- Removedfs-exists-sync@0.1.0(transitive)
- Removedfs.realpath@1.0.0(transitive)
- Removedfunction-bind@1.1.2(transitive)
- Removedget-intrinsic@1.2.4(transitive)
- Removedget-value@2.0.6(transitive)
- Removedgit-config-path@1.0.1(transitive)
- Removedgit-repo-name@0.6.0(transitive)
- Removedglob@7.2.3(transitive)
- Removedglobal-modules@0.2.3(transitive)
- Removedglobal-prefix@0.1.5(transitive)
- Removedgopd@1.0.1(transitive)
- Removedgraceful-fs@4.2.11(transitive)
- Removedhas-own-deep@0.1.4(transitive)
- Removedhas-property-descriptors@1.0.2(transitive)
- Removedhas-proto@1.0.3(transitive)
- Removedhas-symbols@1.0.3(transitive)
- Removedhas-tostringtag@1.0.2(transitive)
- Removedhas-value@0.3.11.0.0(transitive)
- Removedhas-values@0.1.41.0.0(transitive)
- Removedhasown@2.0.2(transitive)
- Removedhomedir-polyfill@1.0.3(transitive)
- Removedinflight@1.0.6(transitive)
- Removedinherits@2.0.4(transitive)
- Removedini@1.3.8(transitive)
- Removedis-accessor-descriptor@1.0.1(transitive)
- Removedis-arguments@1.1.1(transitive)
- Removedis-data-descriptor@1.0.1(transitive)
- Removedis-descriptor@0.1.71.0.3(transitive)
- Removedis-extendable@0.1.11.0.1(transitive)
- Removedis-number@3.0.0(transitive)
- Removedis-registered@0.1.5(transitive)
- Removedis-valid-app@0.2.1(transitive)
- Removedis-valid-instance@0.2.0(transitive)
- Removedis-windows@0.2.0(transitive)
- Removedisarray@1.0.0(transitive)
- Removedisexe@2.0.0(transitive)
- Removedisobject@2.1.0(transitive)
- Removedkind-of@2.0.14.0.0(transitive)
- Removedlazy-cache@0.2.71.0.4(transitive)
- Removedmap-visit@0.1.51.0.0(transitive)
- Removedmerge-deep@3.0.3(transitive)
- Removedminimatch@3.1.2(transitive)
- Removedminimist@1.2.8(transitive)
- Removedmixin-deep@1.3.2(transitive)
- Removedmixin-object@2.0.1(transitive)
- Removedmkdirp@0.5.6(transitive)
- Removedms@2.0.0(transitive)
- Removedobject-copy@0.1.0(transitive)
- Removedobject-visit@0.3.41.0.1(transitive)
- Removedonce@1.4.0(transitive)
- Removedoption-cache@3.5.0(transitive)
- Removedos-homedir@1.0.2(transitive)
- Removedparse-git-config@1.1.1(transitive)
- Removedparse-passwd@1.0.0(transitive)
- Removedpascalcase@0.1.1(transitive)
- Removedpath-is-absolute@1.0.1(transitive)
- Removedproject-name@0.2.6(transitive)
- Removedremote-origin-url@0.5.3(transitive)
- Removedresolve-dir@0.1.1(transitive)
- Removedrimraf@2.7.1(transitive)
- Removedset-function-length@1.2.2(transitive)
- Removedset-value@0.3.30.4.32.0.1(transitive)
- Removedshallow-clone@0.1.2(transitive)
- Removedsplit-string@3.1.0(transitive)
- Removedstatic-extend@0.1.2(transitive)
- Removedto-object-path@0.2.0(transitive)
- Removedunion-value@0.2.41.0.1(transitive)
- Removedunset-value@0.1.21.0.0(transitive)
- Removedwhich@1.3.1(transitive)
- Removedwrappy@1.0.2(transitive)
UpdatedJSONStream@^1.3.5
Updatedclone-deep@^4.0.1
Updatedmoment@^2.24.0
Updatedrequest@^2.88.0