@jsforce/jsforce-node 3.10.8 → 3.10.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/VERSION.d.ts +1 -1
- package/lib/VERSION.js +1 -1
- package/lib/http-api.js +16 -4
- package/lib/oauth2.d.ts +8 -0
- package/package.json +1 -1
package/lib/VERSION.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: "3.10.
|
|
1
|
+
declare const _default: "3.10.10";
|
|
2
2
|
export default _default;
|
package/lib/VERSION.js
CHANGED
package/lib/http-api.js
CHANGED
|
@@ -226,10 +226,22 @@ class HttpApi extends events_1.EventEmitter {
|
|
|
226
226
|
* @protected
|
|
227
227
|
*/
|
|
228
228
|
isSessionExpired(response) {
|
|
229
|
-
//
|
|
230
|
-
//
|
|
231
|
-
|
|
232
|
-
|
|
229
|
+
// REST API status codes: https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/errorcodes.htm
|
|
230
|
+
//
|
|
231
|
+
// "401 - The session ID or OAuth token used has expired or is invalid. The response body contains the message and errorCode."
|
|
232
|
+
if (response.statusCode === 401) {
|
|
233
|
+
// Known list of 401 responses that shouldn't be considered as "session expired".
|
|
234
|
+
//
|
|
235
|
+
// These usualy come from an CA/ECA, OAuth, IP restriction change in the org that block connections, we need to skip these
|
|
236
|
+
// org jsforce will enter into an infinite loop trying to get a valid token.
|
|
237
|
+
const responsesToSkip = ['Connected app is not attached to Agent', 'This session is not valid for use with the REST API'];
|
|
238
|
+
for (const p of responsesToSkip) {
|
|
239
|
+
if (response.body.includes(p))
|
|
240
|
+
return false;
|
|
241
|
+
}
|
|
242
|
+
return true;
|
|
243
|
+
}
|
|
244
|
+
return false;
|
|
233
245
|
}
|
|
234
246
|
/**
|
|
235
247
|
* Detect error response
|
package/lib/oauth2.d.ts
CHANGED
|
@@ -24,6 +24,14 @@ export type AuthzRequestParams = {
|
|
|
24
24
|
};
|
|
25
25
|
export type TokenResponse = {
|
|
26
26
|
token_type: 'Bearer';
|
|
27
|
+
/**
|
|
28
|
+
* Space-separated list of OAuth scopes associated with the access token
|
|
29
|
+
*
|
|
30
|
+
* For the OAuth 2.0 Web Server Flow, this can be a subset of the registered scopes if specified when requesting the auth code.
|
|
31
|
+
*
|
|
32
|
+
* See: https://help.salesforce.com/s/articleView?id=xcloud.remoteaccess_oauth_tokens_scopes.htm&type=5
|
|
33
|
+
*/
|
|
34
|
+
scope: string;
|
|
27
35
|
/**
|
|
28
36
|
* Identity URL
|
|
29
37
|
*
|