files.com 1.0.414 → 1.0.415

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/_VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.414
1
+ 1.0.415
package/lib/Api.js CHANGED
@@ -28,11 +28,14 @@ var _fetchWithTimeout = function _fetchWithTimeout(url) {
28
28
  var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
29
29
  timeoutSecs = _ref.timeoutSecs,
30
30
  options = (0, _objectWithoutProperties2.default)(_ref, _excluded);
31
+ var timeoutId;
31
32
  return timeoutSecs <= 0 ? (0, _crossFetch.default)(url, options) : Promise.race([(0, _crossFetch.default)(url, options), new Promise(function (_, reject) {
32
- setTimeout(function () {
33
+ timeoutId = setTimeout(function () {
33
34
  return reject(new errors.FilesError('Request timed out'));
34
35
  }, timeoutSecs * 1000);
35
- })]);
36
+ })]).finally(function () {
37
+ return clearTimeout(timeoutId);
38
+ });
36
39
  };
37
40
  var fetchWithRetry = /*#__PURE__*/function () {
38
41
  var _ref2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(url, options) {
package/lib/Files.js CHANGED
@@ -11,7 +11,7 @@ var endpointPrefix = '/api/rest/v1';
11
11
  var apiKey;
12
12
  var baseUrl = 'https://app.files.com';
13
13
  var sessionId = null;
14
- var version = "1.0.414";
14
+ var version = "1.0.415";
15
15
  var userAgent = "Files.com JavaScript SDK v".concat(version);
16
16
  var logLevel = _Logger.LogLevel.INFO;
17
17
  var debugRequest = false;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "files.com",
3
- "version": "1.0.414",
3
+ "version": "1.0.415",
4
4
  "description": "Files.com SDK for JavaScript",
5
5
  "keywords": [
6
6
  "files.com",
package/src/Api.js CHANGED
@@ -5,15 +5,17 @@ import * as errors from './Errors'
5
5
  import Logger from './Logger'
6
6
  import { isEmpty, isObject } from './utils'
7
7
 
8
- const _fetchWithTimeout = (url, { timeoutSecs, ...options } = {}) =>
9
- timeoutSecs <= 0
8
+ const _fetchWithTimeout = (url, { timeoutSecs, ...options } = {}) => {
9
+ let timeoutId
10
+ return timeoutSecs <= 0
10
11
  ? fetch(url, options)
11
12
  : Promise.race([
12
13
  fetch(url, options),
13
14
  new Promise((_, reject) => {
14
- setTimeout(() => reject(new errors.FilesError('Request timed out')), timeoutSecs * 1000)
15
+ timeoutId = setTimeout(() => reject(new errors.FilesError('Request timed out')), timeoutSecs * 1000)
15
16
  })
16
- ])
17
+ ]).finally(() => clearTimeout(timeoutId))
18
+ }
17
19
 
18
20
  const fetchWithRetry = async (url, options, retries = 0) => {
19
21
  const maxRetries = Files.getMaxNetworkRetries()
package/src/Files.js CHANGED
@@ -5,7 +5,7 @@ const endpointPrefix = '/api/rest/v1'
5
5
  let apiKey
6
6
  let baseUrl = 'https://app.files.com'
7
7
  let sessionId = null
8
- let version = "1.0.414"
8
+ let version = "1.0.415"
9
9
  let userAgent = `Files.com JavaScript SDK v${version}`
10
10
 
11
11
  let logLevel = LogLevel.INFO