Skip to content

Commit 02e940b

Browse files
abisalehalliprasanhaislipabisalehalliprasan
authored
Release 4.0.0 (#114)
* 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 <[email protected]> * 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 <[email protected]> Co-authored-by: abisalehalliprasan <[email protected]>
1 parent 8f05c1d commit 02e940b

File tree

5 files changed

+41
-12
lines changed

5 files changed

+41
-12
lines changed

.travis.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
language: node_js
22

33
node_js:
4-
- 9
5-
- 8
4+
- 10
5+
- 11
6+
- 12
7+
- 14
68

79
before_script:
810
- npm install

CHANGELOG.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,22 @@
11
# Changelog
22

3+
4+
## [4.0.0](https://github.com/intuit/oauth-jsclient/tree/4.0.0)
5+
#### Breaking Changes
6+
- Minimum Node Version >= 10
7+
#### Features
8+
- Supports Minimum Node version 10 and newer ( not backward compatible )
9+
- Moved lower node versions ( node 8,9, node 7, node 6 to 3.x.x. , 2.x.x and 1.x.x release respectively )
10+
- node version 8,9 and higher refer to 3.x.x
11+
- node version 7 and higher refer to 2.x.x
12+
- node version 6 and higher refer to 1.x.x
13+
#### Issues Fixed
14+
- [Adding Transport Override for PDF use case](https://github.com/intuit/oauth-jsclient/pull/98)
15+
16+
#### References
17+
- [PDF Transport](https://github.com/intuit/oauth-jsclient/issues/97)
18+
19+
320
## [3.0.2](https://github.com/intuit/oauth-jsclient/tree/3.0.2)
421
#### Features
522
- [Added support for passing custom authorize URL's](https://github.com/intuit/oauth-jsclient/pull/92)

README.md

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,14 +52,15 @@ implementations which conforms to the specifications.
5252

5353
# Requirements
5454

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

57-
To use in node 6, please use
58-
[[email protected].](https://github.com/intuit/oauth-jsclient/tree/1.5.0)
57+
| Version | Node support |
58+
|----------------------------------------------------------------------------------|-----------------------------------|
59+
| [[email protected]](https://github.com/intuit/oauth-jsclient/tree/1.5.0) | Node 6.x or higher |
60+
| [[email protected]](https://github.com/intuit/oauth-jsclient/tree/2.0.0) | Node 7.x or higher |
61+
| [[email protected]](https://github.com/intuit/oauth-jsclient/tree/3.0.2) | Node 8.x or Node 9.x and higher |
5962

60-
To use in node 7, please use
61-
[[email protected].](https://github.com/intuit/oauth-jsclient/tree/2.0.0). Older node versions are
62-
not supported.
63+
**Note**: Older node versions are not supported.
6364

6465
# Installation
6566

@@ -440,6 +441,13 @@ oauthClient
440441
The client validates the ID Token and returns boolean `true` if validates successfully else it would
441442
throw an exception.
442443

444+
#### Support for PDF format
445+
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:
446+
```
447+
.makeApiCall({ url: `${url}v3/company/${companyID}/invoice/${invoiceNumber}/pdf?minorversion=59` , headers:{'Content-Type': 'application/pdf','Accept':'application/pdf'}, transport: popsicle.createTransport({type: 'buffer'})})
448+
```
449+
The response is an actual buffer( binary BLOB) which could then be saved to the file.
450+
443451
### Auth-Response
444452

445453
The response provided by the client is a wrapped response of the below items which is what we call

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "intuit-oauth",
3-
"version": "3.0.2",
3+
"version": "4.0.0",
44
"description": "Intuit Node.js client for OAuth2.0 and OpenIDConnect",
55
"main": "./src/OAuthClient.js",
66
"scripts": {
@@ -51,7 +51,7 @@
5151
]
5252
},
5353
"engines": {
54-
"node": ">=8.17.0"
54+
"node": ">=10"
5555
},
5656
"repository": {
5757
"type": "git",

src/OAuthClient.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -372,6 +372,7 @@ OAuthClient.prototype.getUserInfo = function getUserInfo() {
372372
OAuthClient.prototype.makeApiCall = function makeApiCall(params) {
373373
return new Promise((resolve) => {
374374
params = params || {};
375+
const transport = params.transport ? params.transport : popsicle.createTransport({ type: "text" });
375376

376377
const headers =
377378
params.headers && typeof params.headers === 'object'
@@ -382,21 +383,22 @@ OAuthClient.prototype.makeApiCall = function makeApiCall(params) {
382383
Accept: AuthResponse._jsonContentType,
383384
'User-Agent': OAuthClient.user_agent,
384385
},
385-
params.headers,
386+
params.headers
386387
)
387388
: Object.assign(
388389
{},
389390
{
390391
Authorization: `Bearer ${this.getToken().access_token}`,
391392
Accept: AuthResponse._jsonContentType,
392393
'User-Agent': OAuthClient.user_agent,
393-
},
394+
}
394395
);
395396

396397
const request = {
397398
url: params.url,
398399
method: params.method || 'GET',
399400
headers,
401+
transport,
400402
};
401403

402404
params.body && (request.body = params.body);

0 commit comments

Comments
 (0)