Comparing version 4.1.1 to 5.0.0
@@ -12,3 +12,3 @@ { | ||
"homepage": "https://github.com/tanepiper/node-bitly", | ||
"version": "4.1.1", | ||
"version": "5.0.0", | ||
"author": { | ||
@@ -51,23 +51,29 @@ "name": "Tane Piper", | ||
"engines": { | ||
"node": ">= 0.12.0" | ||
"node": ">= 8.0.x" | ||
}, | ||
"scripts": { | ||
"compile": "babel --source-maps --out-dir lib/ src/", | ||
"test": "node_modules/.bin/mocha test/ --recursive --compilers js:babel/register", | ||
"coverage": "node_modules/.bin/istanbul cover node_modules/mocha/bin/_mocha -- --compilers js:babel/register --colors --reporter dot test/", | ||
"prepublish": "npm run compile" | ||
"prepublishOnly": "npm test && npm run build", | ||
"test": "VCR_MODE=cache mocha --reporter list src/*.spec.js", | ||
"build": "webpack --config=webpack.config.js" | ||
}, | ||
"devDependencies": { | ||
"babel": "^5.8.29", | ||
"chai": "^3.4.0", | ||
"istanbul": "^0.4.0", | ||
"mocha": "^2.3.3", | ||
"sepia": "^2.0.1" | ||
"babel-core": "^6.26.0", | ||
"babel-loader": "^7.1.2", | ||
"babel-plugin-transform-object-rest-spread": "^6.26.0", | ||
"babel-polyfill": "^6.26.0", | ||
"babel-preset-es2015": "^6.24.1", | ||
"babel-preset-es2017": "^6.24.1", | ||
"chai": "^4.1.2", | ||
"eslint": "^4.10.0", | ||
"mocha": "^4.0.1", | ||
"sepia": "^2.0.2", | ||
"webpack": "^3.8.1", | ||
"webpack-node-externals": "^1.6.0" | ||
}, | ||
"dependencies": { | ||
"boom": "^2.10.0", | ||
"isomorphic-fetch": "^2.2.0", | ||
"request": "^2.83.0", | ||
"request-promise": "^4.2.2", | ||
"valid-url": "^1.0.9" | ||
}, | ||
"main": "lib/bitly.js" | ||
"main": "dist/bitly.js" | ||
} |
# node-bitly - Bitly API for nodejs | ||
[![Build Status](https://secure.travis-ci.org/tanepiper/node-bitly.png)](http://travis-ci.org/tanepiper/node-bitly) | ||
[![CircleCI](https://circleci.com/gh/tanepiper/node-bitly/tree/refactor.svg?style=svg)](https://circleci.com/gh/tanepiper/node-bitly/tree/refactor) | ||
[![NPM version](https://badge.fury.io/js/bitly.png)](http://badge.fury.io/js/bitly) | ||
[![Dependencies](https://david-dm.org/tanepiper/node-bitly.svg)](https://david-dm.org/tanepiper/node-bitly) | ||
This module provides calls to the [Bitly](http://bitly.com) API for [Nodejs](http://nodejs.org). | ||
For more information on the API request and responses visit the [Bitly API docs](http://dev.bitly.com/api.html) | ||
Version 5 of this library only support `Node 8.x.x` and above as it uses `async/await` | ||
### **** Important update from Version 4 onwards **** | ||
From version 4.0 of this library, the callback in methods have been removed and the library only provides | ||
promises for each method response. The library has also been re-written in ES2015/ES6. The transpiled version | ||
is only distributed via NPM, or can be created the command `npm run compile` if you fork the source. Finally | ||
support is no longer provided for `node < 0.12`. | ||
## Installation | ||
@@ -34,27 +30,29 @@ | ||
```js | ||
// For ES2015/ES6 | ||
const BitlyClient = require('bitly'); | ||
const bitly = BitleyClient('<accessToken>'); | ||
import Bitly from 'bitly'; | ||
const myFunc = async(uri = 'https://github.com/tanepiper/node-bitly') => { | ||
try { | ||
return await bitly.shorten(uri); | ||
} catch(e) { | ||
throw e; | ||
} | ||
} | ||
``` | ||
let bitly = new Bitly('<YOUR ACCESS TOKEN>'); | ||
You can also do raw requests to any Bitly endpoint. With this you need to pass the access | ||
token to the method | ||
bitly.shorten('http://nodejs.org', (response) => { | ||
console.log(response); | ||
}, (error) => { | ||
console.log(error); | ||
}); | ||
```js | ||
const BitlyClient = require('bitly'); | ||
const MY_API_TOKEN = '<accessToken>'; | ||
const bitly = BitleyClient(MY_API_TOKEN); | ||
// For ES5 | ||
var Bitly = require('bitly'); | ||
var bitly = new Bitly('<YOUR ACCESS TOKEN>'); | ||
bitly.shorten('https://github.com/tanepiper/node-bitly') | ||
.then(function(response) { | ||
var short_url = response.data.url | ||
// Do something with data | ||
}, function(error) { | ||
throw error; | ||
}); | ||
const myFunc = async(method, data) => { | ||
try { | ||
return await bitly.doRequest({accessToken: MY_API_TOKEN, method, data}); | ||
} catch(e) { | ||
throw e; | ||
} | ||
} | ||
``` | ||
@@ -69,2 +67,3 @@ | ||
* info | ||
* shorten | ||
@@ -75,6 +74,2 @@ * expand | ||
* countries | ||
* bitly_pro_domain | ||
* lookup | ||
* info | ||
* history | ||
* link_edit |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Deprecated
MaintenanceThe maintainer of the package marked it as deprecated. This could indicate that a single version should not be used, or that the package is no longer maintained and any new vulnerabilities will not be fixed.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
34108
11
844
12
1
73
2
+ Addedrequest@^2.83.0
+ Addedrequest-promise@^4.2.2
+ Addedajv@6.12.6(transitive)
+ Addedasn1@0.2.6(transitive)
+ Addedassert-plus@1.0.0(transitive)
+ Addedasynckit@0.4.0(transitive)
+ Addedaws-sign2@0.7.0(transitive)
+ Addedaws4@1.13.2(transitive)
+ Addedbcrypt-pbkdf@1.0.2(transitive)
+ Addedbluebird@3.7.2(transitive)
+ Addedcaseless@0.12.0(transitive)
+ Addedcombined-stream@1.0.8(transitive)
+ Addedcore-util-is@1.0.2(transitive)
+ Addeddashdash@1.14.1(transitive)
+ Addeddelayed-stream@1.0.0(transitive)
+ Addedecc-jsbn@0.1.2(transitive)
+ Addedextend@3.0.2(transitive)
+ Addedextsprintf@1.3.0(transitive)
+ Addedfast-deep-equal@3.1.3(transitive)
+ Addedfast-json-stable-stringify@2.1.0(transitive)
+ Addedforever-agent@0.6.1(transitive)
+ Addedform-data@2.3.3(transitive)
+ Addedgetpass@0.1.7(transitive)
+ Addedhar-schema@2.0.0(transitive)
+ Addedhar-validator@5.1.5(transitive)
+ Addedhttp-signature@1.2.0(transitive)
+ Addedis-typedarray@1.0.0(transitive)
+ Addedisstream@0.1.2(transitive)
+ Addedjsbn@0.1.1(transitive)
+ Addedjson-schema@0.4.0(transitive)
+ Addedjson-schema-traverse@0.4.1(transitive)
+ Addedjson-stringify-safe@5.0.1(transitive)
+ Addedjsprim@1.4.2(transitive)
+ Addedlodash@4.17.21(transitive)
+ Addedmime-db@1.52.0(transitive)
+ Addedmime-types@2.1.35(transitive)
+ Addedoauth-sign@0.9.0(transitive)
+ Addedperformance-now@2.1.0(transitive)
+ Addedpsl@1.15.0(transitive)
+ Addedpunycode@2.3.1(transitive)
+ Addedqs@6.5.3(transitive)
+ Addedrequest@2.88.2(transitive)
+ Addedrequest-promise@4.2.6(transitive)
+ Addedrequest-promise-core@1.1.4(transitive)
+ Addedsafe-buffer@5.2.1(transitive)
+ Addedsshpk@1.18.0(transitive)
+ Addedstealthy-require@1.1.1(transitive)
+ Addedtough-cookie@2.5.0(transitive)
+ Addedtunnel-agent@0.6.0(transitive)
+ Addedtweetnacl@0.14.5(transitive)
+ Addeduri-js@4.4.1(transitive)
+ Addeduuid@3.4.0(transitive)
+ Addedverror@1.10.0(transitive)
- Removedboom@^2.10.0
- Removedisomorphic-fetch@^2.2.0
- Removedboom@2.10.1(transitive)
- Removedencoding@0.1.13(transitive)
- Removedhoek@2.16.3(transitive)
- Removediconv-lite@0.6.3(transitive)
- Removedis-stream@1.1.0(transitive)
- Removedisomorphic-fetch@2.2.1(transitive)
- Removednode-fetch@1.7.3(transitive)
- Removedwhatwg-fetch@3.6.20(transitive)