@upcoming/bee-js 0.5.0 → 0.5.1

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.
@@ -1,32 +1,13 @@
1
1
  "use strict";
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;
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
24
4
  };
25
5
  Object.defineProperty(exports, "__esModule", { value: true });
26
6
  exports.http = exports.DEFAULT_HTTP_CONFIG = void 0;
27
- const axios_1 = __importStar(require("axios"));
7
+ const axios_1 = __importDefault(require("axios"));
28
8
  const cafe_utility_1 = require("cafe-utility");
29
9
  const index_1 = require("../index");
10
+ const { AxiosError } = axios_1.default;
30
11
  const MAX_FAILED_ATTEMPTS = 100000;
31
12
  const DELAY_FAST = 200;
32
13
  const DELAY_SLOW = 1000;
@@ -62,7 +43,7 @@ async function http(options, config) {
62
43
  return response;
63
44
  }
64
45
  catch (e) {
65
- if (e instanceof axios_1.AxiosError) {
46
+ if (e instanceof AxiosError) {
66
47
  if (e.code === 'ECONNABORTED' && options.endlesslyRetry) {
67
48
  failedAttempts++;
68
49
  await cafe_utility_1.System.sleepMillis(failedAttempts < DELAY_THRESHOLD ? DELAY_FAST : DELAY_SLOW);