Skip to content

Commit

Permalink
Release 4.0.0 (#114)
Browse files Browse the repository at this point in the history
* Update CHANGELOG.md

Update CHANGELOG.md for all releases.

* Adding Transport Override for PDF use case (#98)

* Update CHANGELOG.md (#95)

Update CHANGELOG.md for all releases.

* adding transport

* updating package name and version

* updating to use npm username in package

* fixing behavior and version

* removing package.json changes

Co-authored-by: abisalehalliprasan <38014312+abisalehalliprasan@users.noreply.github.com>

* Test PDF transport changes sdk release 3.0.3

* Release candidate 4.0.0

* Release 4.0.0 README update

Co-authored-by: Greg Haislip <54045190+haislip@users.noreply.github.com>
Co-authored-by: abisalehalliprasan <abisalehalliprasan@intuitdepc017d.corp.intuit.net>
  • Loading branch information
3 people authored May 27, 2021
1 parent 8f05c1d commit 02e940b
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 12 deletions.
6 changes: 4 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
language: node_js

node_js:
- 9
- 8
- 10
- 11
- 12
- 14

before_script:
- npm install
Expand Down
17 changes: 17 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,22 @@
# Changelog


## [4.0.0](https://github.com/intuit/oauth-jsclient/tree/4.0.0)
#### Breaking Changes
- Minimum Node Version >= 10
#### Features
- Supports Minimum Node version 10 and newer ( not backward compatible )
- Moved lower node versions ( node 8,9, node 7, node 6 to 3.x.x. , 2.x.x and 1.x.x release respectively )
- node version 8,9 and higher refer to 3.x.x
- node version 7 and higher refer to 2.x.x
- node version 6 and higher refer to 1.x.x
#### Issues Fixed
- [Adding Transport Override for PDF use case](https://github.com/intuit/oauth-jsclient/pull/98)

#### References
- [PDF Transport](https://github.com/intuit/oauth-jsclient/issues/97)


## [3.0.2](https://github.com/intuit/oauth-jsclient/tree/3.0.2)
#### Features
- [Added support for passing custom authorize URL's](https://github.com/intuit/oauth-jsclient/pull/92)
Expand Down
20 changes: 14 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,15 @@ implementations which conforms to the specifications.

# Requirements

The Node.js client library is tested against the `Node 8 LTS` and newer versions.
The Node.js client library is tested against the `Node 10` and newer versions.

To use in node 6, please use
[intuit-oauth@1.x.](https://github.com/intuit/oauth-jsclient/tree/1.5.0)
| Version | Node support |
|----------------------------------------------------------------------------------|-----------------------------------|
| [intuit-oauth@1.x.x](https://github.com/intuit/oauth-jsclient/tree/1.5.0) | Node 6.x or higher |
| [intuit-oauth@2.x.x](https://github.com/intuit/oauth-jsclient/tree/2.0.0) | Node 7.x or higher |
| [intuit-oauth@3.x.x](https://github.com/intuit/oauth-jsclient/tree/3.0.2) | Node 8.x or Node 9.x and higher |

To use in node 7, please use
[intuit-oauth@2.x.](https://github.com/intuit/oauth-jsclient/tree/2.0.0). Older node versions are
not supported.
**Note**: Older node versions are not supported.

# Installation

Expand Down Expand Up @@ -440,6 +441,13 @@ oauthClient
The client validates the ID Token and returns boolean `true` if validates successfully else it would
throw an exception.
#### Support for PDF format
In order to save the PDF generated from the APIs properly, the correct transport type should be passed into the `makeAPI()`.Below is an example of the same:
```
.makeApiCall({ url: `${url}v3/company/${companyID}/invoice/${invoiceNumber}/pdf?minorversion=59` , headers:{'Content-Type': 'application/pdf','Accept':'application/pdf'}, transport: popsicle.createTransport({type: 'buffer'})})
```
The response is an actual buffer( binary BLOB) which could then be saved to the file.
### Auth-Response
The response provided by the client is a wrapped response of the below items which is what we call
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "intuit-oauth",
"version": "3.0.2",
"version": "4.0.0",
"description": "Intuit Node.js client for OAuth2.0 and OpenIDConnect",
"main": "./src/OAuthClient.js",
"scripts": {
Expand Down Expand Up @@ -51,7 +51,7 @@
]
},
"engines": {
"node": ">=8.17.0"
"node": ">=10"
},
"repository": {
"type": "git",
Expand Down
6 changes: 4 additions & 2 deletions src/OAuthClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,7 @@ OAuthClient.prototype.getUserInfo = function getUserInfo() {
OAuthClient.prototype.makeApiCall = function makeApiCall(params) {
return new Promise((resolve) => {
params = params || {};
const transport = params.transport ? params.transport : popsicle.createTransport({ type: "text" });

const headers =
params.headers && typeof params.headers === 'object'
Expand All @@ -382,21 +383,22 @@ OAuthClient.prototype.makeApiCall = function makeApiCall(params) {
Accept: AuthResponse._jsonContentType,
'User-Agent': OAuthClient.user_agent,
},
params.headers,
params.headers
)
: Object.assign(
{},
{
Authorization: `Bearer ${this.getToken().access_token}`,
Accept: AuthResponse._jsonContentType,
'User-Agent': OAuthClient.user_agent,
},
}
);

const request = {
url: params.url,
method: params.method || 'GET',
headers,
transport,
};

params.body && (request.body = params.body);
Expand Down

0 comments on commit 02e940b

Please sign in to comment.