@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 CHANGED
@@ -1,2 +1,2 @@
1
- declare const _default: "3.10.8";
1
+ declare const _default: "3.10.10";
2
2
  export default _default;
package/lib/VERSION.js CHANGED
@@ -1,3 +1,3 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.default = '3.10.8';
3
+ exports.default = '3.10.10';
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
- // TODO:
230
- // The connected app msg only applies to Agent API requests, we should move this to a separate SFAP/Agent API class later.
231
- return (response.statusCode === 401 &&
232
- !response.body.includes('Connected app is not attached to Agent'));
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
  *
package/package.json CHANGED
@@ -10,7 +10,7 @@
10
10
  "database.com"
11
11
  ],
12
12
  "homepage": "http://github.com/jsforce/jsforce",
13
- "version": "3.10.8",
13
+ "version": "3.10.10",
14
14
  "repository": {
15
15
  "type": "git",
16
16
  "url": "git://github.com/jsforce/jsforce.git"