@jsforce/jsforce-node 3.9.3 → 3.9.5

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.3";
1
+ declare const _default: "3.9.5";
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.3';
3
+ exports.default = '3.9.5';
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
  */
@@ -159,7 +159,7 @@ class HttpApi extends events_1.EventEmitter {
159
159
  const cannotHaveBody = ['GET', 'HEAD', 'OPTIONS'].includes(request.method);
160
160
  // Don't set content-length in browsers as it's not allowed
161
161
  const isBrowser = 'window' in globalThis || 'self' in globalThis;
162
- if (!isBrowser &&
162
+ if (!isBrowser && // Don't set content-length in browsers as it's not allowed
163
163
  !cannotHaveBody &&
164
164
  !!request.body &&
165
165
  !('transfer-encoding' in headers) &&
@@ -324,3 +324,4 @@ class HttpApiError extends Error {
324
324
  }
325
325
  }
326
326
  exports.default = HttpApi;
327
+ exports.isBrowser = 'window' in globalThis || 'self' in globalThis;
package/lib/request.js CHANGED
@@ -166,8 +166,12 @@ async function startFetchRequest(request, options, input, output, emitter, count
166
166
  }
167
167
  };
168
168
  let res;
169
+ // Timeout after 60s without a response
170
+ //
171
+ // node-fetch's default timeout is 0 and jsforce consumers can't set this when calling `Connection` methods so we set a long default at the fetch wrapper level.
172
+ const fetchTimeout = options.timeout ?? 60000;
169
173
  try {
170
- res = await (0, request_helper_1.executeWithTimeout)(fetchWithRetries, options.timeout, () => controller.abort());
174
+ res = await (0, request_helper_1.executeWithTimeout)(fetchWithRetries, fetchTimeout, () => controller.abort());
171
175
  }
172
176
  catch (err) {
173
177
  emitter.emit('error', err);
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.3",
13
+ "version": "3.9.5",
14
14
  "repository": {
15
15
  "type": "git",
16
16
  "url": "git://github.com/jsforce/jsforce.git"