Skip to content

Commit 0d92a1d

Browse files
garg-muditroot
andauthored
Version 8.0.0-rc2-v2.1-24.2.00.00 release (#363)
Co-authored-by: root <[email protected]>
1 parent 429c522 commit 0d92a1d

File tree

5 files changed

+41
-24
lines changed

5 files changed

+41
-24
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22
See [DocuSign Support Center](https://support.docusign.com/en/releasenotes/) for Product Release Notes.
33

44

5+
## [v8.0.0-rc2] - eSignature API v2.1-24.2.00.00 - 2024-07-19
6+
### Changed
7+
- Converted `defaultHeaders` from a shared global state to a local state within each `ApiClient` instance.
8+
- Fixed the overriding of the Authorization header in `GetUserInfo` when `defaultHeaders` already had an Authorization header.
9+
- Updated the SDK release version.
510
## [v8.0.0-rc1] - eSignature API v2.1-24.2.00.00 - 2024-07-02
611
### Breaking Changes
712

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ This client SDK is provided as open source, which enables you to customize its f
3232
<a id="versionInformation"></a>
3333
### Version Information
3434
- **API version**: v2.1
35-
- **Latest SDK version**: 8.0.0-rc1
35+
- **Latest SDK version**: 8.0.0-rc2
3636

3737
<a id="requirements"></a>
3838
## Requirements

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "docusign-esign",
3-
"version": "8.0.0-rc1",
4-
"description": "DocuSign Node.js API client.",
3+
"version": "8.0.0-rc2",
4+
"description": "Docusign Node.js API client.",
55
"license": "MIT",
66
"main": "src/index.js",
77
"author": "DocuSign Developer Center <[email protected]>",

src/ApiClient.js

Lines changed: 32 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,6 @@
3434
* @type {Array.<String>}
3535
* @default {}
3636
*/
37-
var defaultHeaders = {
38-
"X-DocuSign-SDK": "Node",
39-
"Node-Ver": process.version,
40-
"User-Agent": `Swagger-Codegen/v2.1/8.0.0-rc1/node/${process.version}`,
41-
};
42-
4337
var SCOPE_SIGNATURE = "signature";
4438
var SCOPE_EXTENDED = "extended";
4539
var SCOPE_IMPERSONATION = "impersonation";
@@ -91,6 +85,7 @@
9185
assertion,
9286
oAuthBasePath,
9387
proxy,
88+
defaultHeaders,
9489
callback
9590
) {
9691
const requestConfig = {
@@ -162,6 +157,14 @@
162157
return exports.prototype.OAuth.BasePath.PRODUCTION;
163158
};
164159

160+
const encodeBase64 = (str) => {
161+
if (typeof Buffer !== 'undefined') {
162+
return Buffer.from(str).toString('base64');
163+
} else {
164+
return btoa(unescape(encodeURIComponent(str)));
165+
}
166+
}
167+
165168
/**
166169
* @module ApiClient
167170
*/
@@ -179,7 +182,13 @@
179182
oAuthBasePath: require("./OAuth").BasePath.PRODUCTION,
180183
};
181184

182-
opts = Object.assign({},defaults, opts);
185+
this.defaultHeaders = {
186+
"X-DocuSign-SDK": "Node",
187+
"Node-Ver": process.version,
188+
"User-Agent": `Swagger-Codegen/v2.1/8.0.0-rc2/node/${process.version}`,
189+
};
190+
191+
opts = {...defaults, ...opts};
183192
opts.oAuthBasePath = deriveOAuthBasePathFromRestBasePath(opts.basePath);
184193

185194
/**
@@ -266,7 +275,7 @@
266275
header,
267276
value
268277
) {
269-
defaultHeaders[header] = value;
278+
this.defaultHeaders[header] = value;
270279
};
271280

272281
/**
@@ -276,7 +285,7 @@
276285
if(!token){
277286
throw new Error("Missing the required parameter 'token' when calling setJWTToken.")
278287
}
279-
defaultHeaders["Authorization"] = `Bearer ${token}`;
288+
this.defaultHeaders["Authorization"] = `Bearer ${token}`;
280289
};
281290

282291
/**
@@ -627,7 +636,7 @@
627636
const _headerParams = this.normalizeParams(headerParams);
628637
requestConfig.headers = {
629638
...requestConfig.headers,
630-
...defaultHeaders,
639+
...this.defaultHeaders,
631640
..._headerParams,
632641
};
633642

@@ -878,7 +887,7 @@
878887
/**
879888
* @param clientId OAuth2 client ID: Identifies the client making the request.
880889
* Client applications may be scoped to a limited set of system access.
881-
* @param clientSecret the secret key you generated when you set up the integration in DocuSign Admin console.
890+
* @param clientSecret the secret key you generated when you set up the integration in Docusign Admin console.
882891
* @param code The authorization code that you received from the <i>getAuthorizationUri</i> callback.
883892
* @return OAuthToken object.xx
884893
*/
@@ -898,10 +907,10 @@
898907
code: code,
899908
},
900909
headers = {
901-
Authorization: "Basic " + new Buffer(clientString).toString("base64"),
910+
...this.defaultHeaders,
911+
Authorization: "Basic " + encodeBase64(clientString),
902912
"Cache-Control": "no-store",
903913
Pragma: "no-cache",
904-
...defaultHeaders,
905914
},
906915
OAuthToken = require("./OAuth").OAuthToken;
907916

@@ -947,10 +956,10 @@
947956
if(!accessToken) throw new Error("Error accessToken is required", null);
948957

949958
var headers = {
959+
...this.defaultHeaders,
950960
Authorization: "Bearer " + accessToken,
951961
"Cache-Control": "no-store",
952962
Pragma: "no-cache",
953-
...defaultHeaders,
954963
};
955964

956965
const requestConfig = {
@@ -1001,7 +1010,7 @@
10011010
* Helper method to build the OAuth JWT grant uri (used once to get a user consent for impersonation)
10021011
* @param clientId OAuth2 client ID
10031012
* @param redirectURI OAuth2 redirect uri
1004-
* @param oAuthBasePath DocuSign OAuth base path (account-d.docusign.com for the developer sandbox
1013+
* @param oAuthBasePath Docusign OAuth base path (account-d.docusign.com for the developer sandbox
10051014
* and account.docusign.com for the production platform)
10061015
* @returns {string} the OAuth JWT grant uri as a String
10071016
*/
@@ -1029,12 +1038,12 @@
10291038

10301039
/**
10311040
* @deprecated since version 4.1.0
1032-
* Configures the current instance of ApiClient with a fresh OAuth JWT access token from DocuSign
1041+
* Configures the current instance of ApiClient with a fresh OAuth JWT access token from Docusign
10331042
* @param privateKeyFilename the filename of the RSA private key
1034-
* @param oAuthBasePath DocuSign OAuth base path (account-d.docusign.com for the developer sandbox
1043+
* @param oAuthBasePath Docusign OAuth base path (account-d.docusign.com for the developer sandbox
10351044
* and account.docusign.com for the production platform)
1036-
* @param clientId DocuSign OAuth Client Id (AKA Integrator Key)
1037-
* @param userId DocuSign user Id to be impersonated (This is a UUID)
1045+
* @param clientId Docusign OAuth Client Id (AKA Integrator Key)
1046+
* @param userId Docusign user Id to be impersonated (This is a UUID)
10381047
* @param expiresIn in seconds for the token time-to-live
10391048
* @param callback the callback function.
10401049
*/
@@ -1072,10 +1081,10 @@
10721081
method: "post",
10731082
url: "/oauth/token",
10741083
headers: {
1084+
...this.defaultHeaders,
10751085
"Content-Type": "application/x-www-form-urlencoded",
10761086
"Cache-Control": "no-store",
10771087
Pragma: "no-cache",
1078-
...defaultHeaders,
10791088
},
10801089
timeout: this.timeout,
10811090
data: {
@@ -1124,6 +1133,7 @@
11241133
assertion,
11251134
this.oAuthBasePath,
11261135
this.proxy,
1136+
this.defaultHeaders,
11271137
callback
11281138
);
11291139
};
@@ -1150,6 +1160,7 @@
11501160
assertion,
11511161
this.oAuthBasePath,
11521162
this.proxy,
1163+
this.defaultHeaders,
11531164
callback
11541165
);
11551166
};
@@ -1174,6 +1185,7 @@
11741185
assertion,
11751186
this.oAuthBasePath,
11761187
this.proxy,
1188+
this.defaultHeaders,
11771189
callback
11781190
);
11791191
};

src/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
'use strict';
2121

2222
/**
23-
* DocuSign Node.js API client..<br>
23+
* Docusign Node.js API client..<br>
2424
* The <code>index</code> module provides access to constructors for all the classes which comprise the public API.
2525
* <p>
2626
* An AMD (recommended!) or CommonJS application will generally do something equivalent to the following:

0 commit comments

Comments
 (0)