@jsforce/jsforce-node 3.9.2 → 3.9.4

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.9.2";
1
+ declare const _default: "3.9.4";
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.9.2';
3
+ exports.default = '3.9.4';
package/lib/http-api.d.ts CHANGED
@@ -73,3 +73,4 @@ export declare class HttpApi<S extends Schema> extends EventEmitter {
73
73
  getError(response: HttpResponse, body?: any): Promise<Error>;
74
74
  }
75
75
  export default HttpApi;
76
+ export declare const isBrowser: boolean;
package/lib/http-api.js CHANGED
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.HttpApi = void 0;
6
+ exports.isBrowser = exports.HttpApi = void 0;
7
7
  /**
8
8
  *
9
9
  */
@@ -157,7 +157,10 @@ class HttpApi extends events_1.EventEmitter {
157
157
  }
158
158
  const bodySize = (0, get_body_size_1.getBodySize)(request.body, headers);
159
159
  const cannotHaveBody = ['GET', 'HEAD', 'OPTIONS'].includes(request.method);
160
- if (!cannotHaveBody &&
160
+ // Don't set content-length in browsers as it's not allowed
161
+ const isBrowser = 'window' in globalThis || 'self' in globalThis;
162
+ if (!isBrowser && // Don't set content-length in browsers as it's not allowed
163
+ !cannotHaveBody &&
161
164
  !!request.body &&
162
165
  !('transfer-encoding' in headers) &&
163
166
  !('content-length' in headers) &&
@@ -225,7 +228,8 @@ class HttpApi extends events_1.EventEmitter {
225
228
  isSessionExpired(response) {
226
229
  // TODO:
227
230
  // The connected app msg only applies to Agent API requests, we should move this to a separate SFAP/Agent API class later.
228
- return response.statusCode === 401 && !response.body.includes('Connected app is not attached to Agent');
231
+ return (response.statusCode === 401 &&
232
+ !response.body.includes('Connected app is not attached to Agent'));
229
233
  }
230
234
  /**
231
235
  * Detect error response
@@ -289,7 +293,9 @@ class HttpApi extends events_1.EventEmitter {
289
293
  Check that the org exists and can be reached.
290
294
  See \`error.data\` for the full html response.`, error.errorCode, error.message);
291
295
  }
292
- return error instanceof HttpApiError ? error : new HttpApiError(error.message, error.errorCode, error);
296
+ return error instanceof HttpApiError
297
+ ? error
298
+ : new HttpApiError(error.message, error.errorCode, error);
293
299
  }
294
300
  }
295
301
  exports.HttpApi = HttpApi;
@@ -318,3 +324,4 @@ class HttpApiError extends Error {
318
324
  }
319
325
  }
320
326
  exports.default = HttpApi;
327
+ exports.isBrowser = 'window' in globalThis || 'self' in globalThis;
package/lib/soap.js CHANGED
@@ -1,6 +1,26 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
4
24
  };
5
25
  Object.defineProperty(exports, "__esModule", { value: true });
6
26
  exports.SOAP = exports.castTypeUsingSchema = void 0;
@@ -8,7 +28,7 @@ exports.SOAP = exports.castTypeUsingSchema = void 0;
8
28
  * @file Manages method call to SOAP endpoint
9
29
  * @author Shinichi Tomita <shinichi.tomita@gmail.com>
10
30
  */
11
- const http_api_1 = __importDefault(require("./http-api"));
31
+ const http_api_1 = __importStar(require("./http-api"));
12
32
  const function_1 = require("./util/function");
13
33
  const get_body_size_1 = require("./util/get-body-size");
14
34
  const jwt_1 = require("./util/jwt");
@@ -209,7 +229,8 @@ class SOAP extends http_api_1.default {
209
229
  request.body = this._createEnvelope(request._message);
210
230
  const headers = request.headers || {};
211
231
  const bodySize = (0, get_body_size_1.getBodySize)(request.body, request.headers);
212
- if (request.method === 'POST' &&
232
+ if (!http_api_1.isBrowser && // Don't set content-length in browsers as it's not allowed
233
+ request.method === 'POST' &&
213
234
  !('transfer-encoding' in headers) &&
214
235
  !('content-length' in headers) &&
215
236
  !!bodySize) {
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.9.2",
13
+ "version": "3.9.4",
14
14
  "repository": {
15
15
  "type": "git",
16
16
  "url": "git://github.com/jsforce/jsforce.git"