dev-classes 1.3.15 → 1.3.16

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,9 +1,9 @@
1
- class e {
1
+ class o {
2
2
  handleError(s) {
3
3
  const a = { msg: "", statusCode: 0 };
4
- return "message" in s && (a.msg = s.message), "status" in s && (a.statusCode = s.status), a;
4
+ return "message" in s && (a.msg = s.message), "error" in s && (a.msg = s.error), "status" in s && (a.statusCode = s.status), a;
5
5
  }
6
6
  }
7
7
  export {
8
- e as ErrorsHandler
8
+ o as ErrorsHandler
9
9
  };
@@ -26,7 +26,7 @@ const mt = X("string"), x = X("function"), He = X("number"), Q = (e) => e !== nu
26
26
  return !1;
27
27
  const t = he(e);
28
28
  return (t === null || t === Object.prototype || Object.getPrototypeOf(t) === null) && !(Symbol.toStringTag in e) && !(Symbol.iterator in e);
29
- }, wt = N("Date"), bt = N("File"), gt = N("Blob"), Et = N("FileList"), St = (e) => Q(e) && x(e.pipe), Rt = (e) => {
29
+ }, wt = N("Date"), gt = N("File"), bt = N("Blob"), Et = N("FileList"), St = (e) => Q(e) && x(e.pipe), Rt = (e) => {
30
30
  let t;
31
31
  return e && (typeof FormData == "function" && e instanceof FormData || x(e.append) && ((t = G(e)) === "formdata" || // detect form-data instance
32
32
  t === "object" && x(e.toString) && e.toString() === "[object FormData]"));
@@ -199,8 +199,8 @@ const Wt = (e) => {
199
199
  isHeaders: xt,
200
200
  isUndefined: I,
201
201
  isDate: wt,
202
- isFile: bt,
203
- isBlob: gt,
202
+ isFile: gt,
203
+ isBlob: bt,
204
204
  isRegExp: Ht,
205
205
  isFunction: x,
206
206
  isStream: St,
@@ -348,7 +348,7 @@ function Z(e, t, n) {
348
348
  }
349
349
  return ae(d) ? !0 : (t.append(Ae(h, m, o), u(d)), !1);
350
350
  }
351
- const p = [], b = Object.assign(Yt, {
351
+ const p = [], g = Object.assign(Yt, {
352
352
  defaultVisitor: l,
353
353
  convertValue: u,
354
354
  isVisitable: ae
@@ -363,7 +363,7 @@ function Z(e, t, n) {
363
363
  E,
364
364
  a.isString(R) ? R.trim() : R,
365
365
  m,
366
- b
366
+ g
367
367
  )) === !0 && w(E, m ? m.concat(R) : [R]);
368
368
  }), p.pop();
369
369
  }
@@ -607,7 +607,7 @@ const we = {
607
607
  a.forEach(["delete", "get", "head", "post", "put", "patch"], (e) => {
608
608
  we.headers[e] = {};
609
609
  });
610
- const be = we, hn = a.toObjectSet([
610
+ const ge = we, hn = a.toObjectSet([
611
611
  "age",
612
612
  "authorization",
613
613
  "content-length",
@@ -657,10 +657,10 @@ function ne(e, t, n, r, s) {
657
657
  return r.test(t);
658
658
  }
659
659
  }
660
- function bn(e) {
660
+ function gn(e) {
661
661
  return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g, (t, n, r) => n.toUpperCase() + r);
662
662
  }
663
- function gn(e, t) {
663
+ function bn(e, t) {
664
664
  const n = a.toCamelCase(" " + t);
665
665
  ["get", "set", "has"].forEach((r) => {
666
666
  Object.defineProperty(e, r + n, {
@@ -748,7 +748,7 @@ class Y {
748
748
  n[i] = J(s), delete n[o];
749
749
  return;
750
750
  }
751
- const c = t ? bn(o) : String(o).trim();
751
+ const c = t ? gn(o) : String(o).trim();
752
752
  c !== o && delete n[o], n[c] = J(s), r[c] = !0;
753
753
  }), this;
754
754
  }
@@ -784,7 +784,7 @@ class Y {
784
784
  }).accessors, s = this.prototype;
785
785
  function o(i) {
786
786
  const c = q(i);
787
- r[c] || (gn(s, i), r[c] = !0);
787
+ r[c] || (bn(s, i), r[c] = !0);
788
788
  }
789
789
  return a.isArray(t) ? t.forEach(o) : o(t), this;
790
790
  }
@@ -802,7 +802,7 @@ a.reduceDescriptors(Y.prototype, ({ value: e }, t) => {
802
802
  a.freezeMethods(Y);
803
803
  const P = Y;
804
804
  function re(e, t) {
805
- const n = this || be, r = t || n, s = P.from(r.headers);
805
+ const n = this || ge, r = t || n, s = P.from(r.headers);
806
806
  let o = r.data;
807
807
  return a.forEach(e, function(c) {
808
808
  o = c.call(n, o, s.normalize(), t ? t.status : void 0);
@@ -838,13 +838,13 @@ function Sn(e, t) {
838
838
  return t = t !== void 0 ? t : 1e3, function(f) {
839
839
  const u = Date.now(), l = r[o];
840
840
  i || (i = u), n[s] = f, r[s] = u;
841
- let p = o, b = 0;
841
+ let p = o, g = 0;
842
842
  for (; p !== s; )
843
- b += n[p++], p = p % e;
843
+ g += n[p++], p = p % e;
844
844
  if (s = (s + 1) % e, s === o && (o = (o + 1) % e), u - i < t)
845
845
  return;
846
846
  const w = l && u - l;
847
- return w ? Math.round(b * 1e3 / w) : void 0;
847
+ return w ? Math.round(g * 1e3 / w) : void 0;
848
848
  };
849
849
  }
850
850
  function Rn(e, t) {
@@ -1015,8 +1015,8 @@ function D(e, t) {
1015
1015
  headers: (u, l) => s(Fe(u), Fe(l), !0)
1016
1016
  };
1017
1017
  return a.forEach(Object.keys(Object.assign({}, e, t)), function(l) {
1018
- const p = f[l] || s, b = p(e[l], t[l], l);
1019
- a.isUndefined(b) && p !== c || (n[l] = b);
1018
+ const p = f[l] || s, g = p(e[l], t[l], l);
1019
+ a.isUndefined(g) && p !== c || (n[l] = g);
1020
1020
  }), n;
1021
1021
  }
1022
1022
  const nt = (e) => {
@@ -1045,7 +1045,7 @@ const nt = (e) => {
1045
1045
  const s = nt(e);
1046
1046
  let o = s.data;
1047
1047
  const i = P.from(s.headers).normalize();
1048
- let { responseType: c, onUploadProgress: f, onDownloadProgress: u } = s, l, p, b, w, d;
1048
+ let { responseType: c, onUploadProgress: f, onDownloadProgress: u } = s, l, p, g, w, d;
1049
1049
  function m() {
1050
1050
  w && w(), d && d(), s.cancelToken && s.cancelToken.unsubscribe(l), s.signal && s.signal.removeEventListener("abort", l);
1051
1051
  }
@@ -1087,7 +1087,7 @@ const nt = (e) => {
1087
1087
  )), h = null;
1088
1088
  }, o === void 0 && i.setContentType(null), "setRequestHeader" in h && a.forEach(i.toJSON(), function(k, T) {
1089
1089
  h.setRequestHeader(T, k);
1090
- }), a.isUndefined(s.withCredentials) || (h.withCredentials = !!s.withCredentials), c && c !== "json" && (h.responseType = s.responseType), u && ([b, d] = V(u, !0), h.addEventListener("progress", b)), f && h.upload && ([p, w] = V(f), h.upload.addEventListener("progress", p), h.upload.addEventListener("loadend", w)), (s.cancelToken || s.signal) && (l = (O) => {
1090
+ }), a.isUndefined(s.withCredentials) || (h.withCredentials = !!s.withCredentials), c && c !== "json" && (h.responseType = s.responseType), u && ([g, d] = V(u, !0), h.addEventListener("progress", g)), f && h.upload && ([p, w] = V(f), h.upload.addEventListener("progress", p), h.upload.addEventListener("loadend", w)), (s.cancelToken || s.signal) && (l = (O) => {
1091
1091
  h && (r(!O || O.type ? new _(null, e, h) : O), h.abort(), h = null);
1092
1092
  }, s.cancelToken && s.cancelToken.subscribe(l), s.signal && (s.signal.aborted ? l() : s.signal.addEventListener("abort", l)));
1093
1093
  const R = En(s.url);
@@ -1163,8 +1163,8 @@ const nt = (e) => {
1163
1163
  }
1164
1164
  let p = l.byteLength;
1165
1165
  if (n) {
1166
- let b = o += p;
1167
- n(b);
1166
+ let g = o += p;
1167
+ n(g);
1168
1168
  }
1169
1169
  f.enqueue(new Uint8Array(l));
1170
1170
  } catch (u) {
@@ -1233,7 +1233,7 @@ const jn = async (e) => {
1233
1233
  responseType: u,
1234
1234
  headers: l,
1235
1235
  withCredentials: p = "same-origin",
1236
- fetchOptions: b
1236
+ fetchOptions: g
1237
1237
  } = nt(e);
1238
1238
  u = u ? (u + "").toLowerCase() : "text";
1239
1239
  let w = kn([s, o && o.toAbortSignal()], i), d;
@@ -1259,7 +1259,7 @@ const jn = async (e) => {
1259
1259
  a.isString(p) || (p = p ? "include" : "omit");
1260
1260
  const E = "credentials" in Request.prototype;
1261
1261
  d = new Request(t, {
1262
- ...b,
1262
+ ...g,
1263
1263
  signal: w,
1264
1264
  method: n.toUpperCase(),
1265
1265
  headers: l.normalize().toJSON(),
@@ -1358,7 +1358,7 @@ function De(e) {
1358
1358
  return se(e), e.headers = P.from(e.headers), e.data = re.call(
1359
1359
  e,
1360
1360
  e.transformRequest
1361
- ), ["post", "put", "patch"].indexOf(e.method) !== -1 && e.headers.setContentType("application/x-www-form-urlencoded", !1), ot.getAdapter(e.adapter || be.adapter)(e).then(function(r) {
1361
+ ), ["post", "put", "patch"].indexOf(e.method) !== -1 && e.headers.setContentType("application/x-www-form-urlencoded", !1), ot.getAdapter(e.adapter || ge.adapter)(e).then(function(r) {
1362
1362
  return se(e), r.data = re.call(
1363
1363
  e,
1364
1364
  e.transformResponse,
@@ -1372,14 +1372,14 @@ function De(e) {
1372
1372
  ), r.response.headers = P.from(r.response.headers))), Promise.reject(r);
1373
1373
  });
1374
1374
  }
1375
- const it = "1.7.7", ge = {};
1375
+ const it = "1.7.7", be = {};
1376
1376
  ["object", "boolean", "number", "function", "string", "symbol"].forEach((e, t) => {
1377
- ge[e] = function(r) {
1377
+ be[e] = function(r) {
1378
1378
  return typeof r === e || "a" + (t < 1 ? "n " : " ") + e;
1379
1379
  };
1380
1380
  });
1381
1381
  const je = {};
1382
- ge.transitional = function(t, n, r) {
1382
+ be.transitional = function(t, n, r) {
1383
1383
  function s(o, i) {
1384
1384
  return "[Axios v" + it + "] Transitional option '" + o + "'" + i + (r ? ". " + r : "");
1385
1385
  }
@@ -1416,7 +1416,7 @@ function Hn(e, t, n) {
1416
1416
  }
1417
1417
  const fe = {
1418
1418
  assertOptions: Hn,
1419
- validators: ge
1419
+ validators: be
1420
1420
  }, U = fe.validators;
1421
1421
  class K {
1422
1422
  constructor(t) {
@@ -1482,16 +1482,16 @@ class K {
1482
1482
  this.interceptors.response.forEach(function(m) {
1483
1483
  u.push(m.fulfilled, m.rejected);
1484
1484
  });
1485
- let l, p = 0, b;
1485
+ let l, p = 0, g;
1486
1486
  if (!f) {
1487
1487
  const d = [De.bind(this), void 0];
1488
- for (d.unshift.apply(d, c), d.push.apply(d, u), b = d.length, l = Promise.resolve(n); p < b; )
1488
+ for (d.unshift.apply(d, c), d.push.apply(d, u), g = d.length, l = Promise.resolve(n); p < g; )
1489
1489
  l = l.then(d[p++], d[p++]);
1490
1490
  return l;
1491
1491
  }
1492
- b = c.length;
1492
+ g = c.length;
1493
1493
  let w = n;
1494
- for (p = 0; p < b; ) {
1494
+ for (p = 0; p < g; ) {
1495
1495
  const d = c[p++], m = c[p++];
1496
1496
  try {
1497
1497
  w = d(w);
@@ -1505,7 +1505,7 @@ class K {
1505
1505
  } catch (d) {
1506
1506
  return Promise.reject(d);
1507
1507
  }
1508
- for (p = 0, b = u.length; p < b; )
1508
+ for (p = 0, g = u.length; p < g; )
1509
1509
  l = l.then(u[p++], u[p++]);
1510
1510
  return l;
1511
1511
  }
@@ -1698,7 +1698,7 @@ function at(e) {
1698
1698
  return at(D(e, s));
1699
1699
  }, n;
1700
1700
  }
1701
- const S = at(be);
1701
+ const S = at(ge);
1702
1702
  S.Axios = $;
1703
1703
  S.CanceledError = _;
1704
1704
  S.CancelToken = vn;
@@ -1789,59 +1789,60 @@ function pe(e, t) {
1789
1789
  );
1790
1790
  }
1791
1791
  var oe = pe($n, { path: "/" });
1792
- const g = class g {
1792
+ const b = class b {
1793
1793
  static setErrorsHandler(t) {
1794
- g.errorsHandler = t;
1794
+ b.errorsHandler = t;
1795
1795
  }
1796
1796
  };
1797
- C(g, "keyCookie", "AuthCookie"), C(g, "cookieOptions", {}), C(g, "registerRequest", new Re()), C(g, "registerFailedRequests", new Re()), C(g, "requestUploadToken", null), C(g, "errorsHandler", new lt()), C(g, "setMethodUploadToken", (t) => {
1798
- g.requestUploadToken = t;
1799
- }), C(g, "requestInServer", (t, n = {}) => new Promise((r, s) => {
1797
+ C(b, "keyCookie", "AuthCookie"), C(b, "cookieOptions", {}), C(b, "registerRequest", new Re()), C(b, "registerFailedRequests", new Re()), C(b, "requestUploadToken", null), C(b, "errorsHandler", new lt()), C(b, "setMethodUploadToken", (t) => {
1798
+ b.requestUploadToken = t;
1799
+ }), C(b, "requestInServer", (t, n = {}) => new Promise((r, s) => {
1800
1800
  var u, l, p;
1801
1801
  let o = { url: t, statusCode: 0, data: {}, res: {} };
1802
1802
  const i = { url: t, statusCode: 520, msg: "", isErr: !0, errExt: {} }, c = {
1803
1803
  method: "get",
1804
1804
  headers: {
1805
- cookie: g.getAuthCookies()
1805
+ cookie: b.getAuthCookies()
1806
1806
  },
1807
1807
  timeout: 6e4
1808
1808
  }, f = ft.deepMerge(c, n);
1809
1809
  if (window != null && window.cordova && ((l = (u = window == null ? void 0 : window.cordova) == null ? void 0 : u.plugin) != null && l.http)) {
1810
- const { http: b } = (p = window == null ? void 0 : window.cordova) == null ? void 0 : p.plugin;
1811
- b.setDataSerializer("json"), b.setRequestTimeout(Number(f.timeout) / 1e3), g.registerRequest.setList({ url: t, options: f }), b.sendRequest(
1810
+ const { http: g } = (p = window == null ? void 0 : window.cordova) == null ? void 0 : p.plugin;
1811
+ g.setDataSerializer("json"), g.setRequestTimeout(Number(f.timeout) / 1e3), b.registerRequest.setList({ url: t, options: f }), g.sendRequest(
1812
1812
  t,
1813
1813
  f,
1814
1814
  (w) => {
1815
- g.registerFailedRequests.removeItem(t), g.registerRequest.removeItem(t);
1815
+ console.log("http.sendRequest success: ", w), b.registerFailedRequests.removeItem(t), b.registerRequest.removeItem(t);
1816
1816
  const d = (w == null ? void 0 : w.headers) && w.headers["set-cookie"], m = w.status, h = w == null ? void 0 : w.data;
1817
- o = { ...o, statusCode: m, data: h, res: w }, m === 200 && d && (g.saveToken(d), o.data = { ...o.data, token: d }), r(o);
1817
+ o = { ...o, statusCode: m, data: h, res: w }, m === 200 && d && (b.saveToken(d), o.data = { ...o.data, token: d }), r(o);
1818
1818
  },
1819
1819
  (w) => {
1820
- const d = g.errorsHandler.handleError(w);
1820
+ console.log("http.sendRequest error: ", w);
1821
+ const d = b.errorsHandler.handleError(w);
1821
1822
  s({ ...i, ...d, errExt: w });
1822
1823
  }
1823
1824
  );
1824
1825
  } else
1825
- g.registerRequest.setList({ url: t, options: f }), S({ url: t, ...f }).then((b) => {
1826
- g.registerRequest.removeItem(t);
1827
- const w = b.status, d = b == null ? void 0 : b.data;
1828
- o = { ...o, statusCode: w, data: d, res: b }, r(o);
1829
- }).catch((b) => {
1830
- const w = g.errorsHandler.handleError(b);
1831
- s({ ...i, ...w, errExt: b });
1826
+ b.registerRequest.setList({ url: t, options: f }), S({ url: t, ...f }).then((g) => {
1827
+ b.registerRequest.removeItem(t);
1828
+ const w = g.status, d = g == null ? void 0 : g.data;
1829
+ o = { ...o, statusCode: w, data: d, res: g }, r(o);
1830
+ }).catch((g) => {
1831
+ const w = b.errorsHandler.handleError(g);
1832
+ s({ ...i, ...w, errExt: g });
1832
1833
  });
1833
- })), C(g, "getAuthCookies", () => {
1834
+ })), C(b, "getAuthCookies", () => {
1834
1835
  var n, r, s;
1835
- const { keyCookie: t } = g;
1836
+ const { keyCookie: t } = b;
1836
1837
  if ((r = (n = window == null ? void 0 : window.cordova) == null ? void 0 : n.plugin) != null && r.http) {
1837
1838
  const { http: o } = (s = window == null ? void 0 : window.cordova) == null ? void 0 : s.plugin;
1838
1839
  return o.getCookieString(t);
1839
1840
  }
1840
1841
  return oe.get(t);
1841
- }), C(g, "saveToken", (t) => {
1842
+ }), C(b, "saveToken", (t) => {
1842
1843
  var n, r, s;
1843
1844
  if (t) {
1844
- const { keyCookie: o, cookieOptions: i } = g;
1845
+ const { keyCookie: o, cookieOptions: i } = b;
1845
1846
  if ((r = (n = window == null ? void 0 : window.cordova) == null ? void 0 : n.plugin) != null && r.http) {
1846
1847
  const { http: c } = (s = window == null ? void 0 : window.cordova) == null ? void 0 : s.plugin;
1847
1848
  c.setCookie(o, t, i);
@@ -1849,19 +1850,19 @@ C(g, "keyCookie", "AuthCookie"), C(g, "cookieOptions", {}), C(g, "registerReques
1849
1850
  }
1850
1851
  oe.set(o, t, i);
1851
1852
  }
1852
- }), C(g, "removeAuthCookie", () => {
1853
+ }), C(b, "removeAuthCookie", () => {
1853
1854
  var n, r, s;
1854
- const { keyCookie: t } = g;
1855
+ const { keyCookie: t } = b;
1855
1856
  if ((r = (n = window == null ? void 0 : window.cordova) == null ? void 0 : n.plugin) != null && r.http) {
1856
1857
  const { http: o } = (s = window == null ? void 0 : window.cordova) == null ? void 0 : s.plugin;
1857
1858
  o.clearCookies();
1858
1859
  return;
1859
1860
  }
1860
1861
  oe.remove(t);
1861
- }), C(g, "setCookieOptions", (t) => {
1862
- g.cookieOptions = t;
1862
+ }), C(b, "setCookieOptions", (t) => {
1863
+ b.cookieOptions = t;
1863
1864
  });
1864
- let _e = g;
1865
+ let _e = b;
1865
1866
  export {
1866
1867
  _e as apiRequest
1867
1868
  };
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  },
12
12
  "homepage": "https://github.com/SinGlEBW/dev-classes#readme",
13
13
  "license": "MIT",
14
- "version": "1.3.15",
14
+ "version": "1.3.16",
15
15
  "type": "module",
16
16
  "module": "./dist/index.js",
17
17
  "main": "./dist/index.js",