dev-classes 1.3.35 → 1.4.10
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/README.md +12 -20
- package/dist/classes/EventSubscribers/EventSubscribers.js +35 -0
- package/dist/classes/HTTPSApi/HTTPSApi.js +2 -1
- package/dist/classes/HTTPSApi/deps/apiRequest/apiRequest.js +61 -61
- package/dist/classes/NetworkStatusTracker/NetworkStatusTracker.d.ts +30 -0
- package/dist/classes/NetworkStatusTracker/NetworkStatusTracker.js +158 -0
- package/dist/classes/NetworkStatusTracker/NetworkStatusTracker.types.d.ts +22 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +14 -14
- package/package.json +10 -2
- package/dist/classes/ControlAppBySocket/ControlAppBySocket.d.ts +0 -3
- package/dist/classes/ControlAppBySocket/ControlAppBySocket.js +0 -8
- package/dist/classes/SocketApi/SocketApi.d.ts +0 -52
- package/dist/classes/SocketApi/SocketApi.js +0 -127
- package/dist/classes/SocketApi/SocketApi.types.d.ts +0 -9
- package/dist/classes/SocketApi/deps/ConfigInfoConnect/ConfigInfoConnect.d.ts +0 -8
- package/dist/classes/SocketApi/deps/ConfigInfoConnect/ConfigInfoConnect.js +0 -16
- package/dist/classes/SocketApi/deps/ConfigInfoConnect/ConfigInfoConnect.types.d.ts +0 -7
- package/dist/classes/SocketApi/deps/ConfigInfoConnect/ConfigInfoConnect.types.js +0 -1
- package/dist/classes/SocketApi/deps/WsApi/WsApi.d.ts +0 -41
- package/dist/classes/SocketApi/deps/WsApi/WsApi.js +0 -116
- package/dist/classes/SocketApi/deps/WsApi/WsApi.types.d.ts +0 -22
- package/dist/classes/SocketApi/deps/WsApi/WsApi.types.js +0 -1
- package/dist/classes/SocketApi/deps/WsApi/index.d.ts +0 -2
- package/dist/classes/SocketApi/deps/WsApi/index.js +0 -4
- package/dist/classes/SocketApi/index.d.ts +0 -2
- package/dist/classes/SocketApi/index.js +0 -4
- package/dist/classes/Utils/EventSubscribers/EventSubscribers.js +0 -33
- /package/dist/classes/{Utils/EventSubscribers → EventSubscribers}/EventSubscribers.d.ts +0 -0
- /package/dist/classes/{Utils/EventSubscribers → EventSubscribers}/EventSubscribers.types.d.ts +0 -0
- /package/dist/classes/{Utils/EventSubscribers → EventSubscribers}/EventSubscribers.types.js +0 -0
- /package/dist/classes/{Utils/EventSubscribers → EventSubscribers}/index.d.ts +0 -0
- /package/dist/classes/{Utils/EventSubscribers → EventSubscribers}/index.js +0 -0
- /package/dist/classes/{SocketApi/SocketApi.types.js → NetworkStatusTracker/NetworkStatusTracker.types.js} +0 -0
package/README.md
CHANGED
|
@@ -1,24 +1,6 @@
|
|
|
1
1
|
<h3 align="center">SocketApi</h3>
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import { SocketApi } from 'dev-classes';
|
|
5
|
-
|
|
6
|
-
SocketApi.init({
|
|
7
|
-
url: 'wss://...',
|
|
8
|
-
timeReConnect: 5000,
|
|
9
|
-
numberOfRepit: 5,
|
|
10
|
-
isReConnectNetworkOnline: true
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
SocketApi.on('status', (status) => { console.log('onStatus', status); });
|
|
14
|
-
SocketApi.on('msg', (messages) => { console.log('onMessages', messages); });
|
|
15
|
-
SocketApi.on('reConnect', (status) => { console.log('reConnect', status); });
|
|
16
|
-
SocketApi.on('timeOffReConnect', (data) => { console.log('timeOffReConnect', data); });
|
|
17
|
-
|
|
18
|
-
SocketApi.connect();
|
|
19
|
-
//...
|
|
20
|
-
|
|
21
|
-
```
|
|
2
|
+
### !!! Пакет пепеехал в lib-socket-api !!!
|
|
3
|
+
|
|
22
4
|
<h3 align="center">HTTPSApi</h3>
|
|
23
5
|
|
|
24
6
|
```ts
|
|
@@ -252,4 +234,14 @@ MyClass.on('myEvent', (status) => {
|
|
|
252
234
|
})
|
|
253
235
|
MyClass.runTime(2);
|
|
254
236
|
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
<h3 align="center">NetworkStatusTracker</h3>
|
|
240
|
+
|
|
241
|
+
```ts
|
|
242
|
+
// Будущая замена NetworkInformation
|
|
243
|
+
const networkTicker = new NetworkStatusTracker([]);
|
|
244
|
+
networkTicker.startEvents((info) => {
|
|
245
|
+
SocketApi.setNetworkStatus(info);
|
|
246
|
+
});
|
|
255
247
|
```
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
var c = Object.defineProperty;
|
|
2
|
+
var u = (b, s, e) => s in b ? c(b, s, { enumerable: !0, configurable: !0, writable: !0, value: e }) : b[s] = e;
|
|
3
|
+
var t = (b, s, e) => (u(b, typeof s != "symbol" ? s + "" : s, e), e);
|
|
4
|
+
class E {
|
|
5
|
+
constructor(s) {
|
|
6
|
+
t(this, "subscribersEvents", {});
|
|
7
|
+
t(this, "getListNameEvents", () => Object.keys(this.subscribersEvents));
|
|
8
|
+
t(this, "getSubscribers", () => this.subscribersEvents);
|
|
9
|
+
t(this, "subscribe", (s, e) => {
|
|
10
|
+
var r;
|
|
11
|
+
(r = this.subscribersEvents[s]) == null || r.push(e);
|
|
12
|
+
});
|
|
13
|
+
t(this, "unsubscribe", (s, e) => {
|
|
14
|
+
var r;
|
|
15
|
+
this.subscribersEvents[s] && (this.subscribersEvents[s] = (r = this.subscribersEvents[s]) == null ? void 0 : r.filter((i) => i !== e));
|
|
16
|
+
});
|
|
17
|
+
t(this, "publish", (s, e) => {
|
|
18
|
+
var r;
|
|
19
|
+
this.subscribersEvents[s] && ((r = this.subscribersEvents[s]) == null || r.forEach((i) => {
|
|
20
|
+
i(e);
|
|
21
|
+
}));
|
|
22
|
+
});
|
|
23
|
+
t(this, "resetSubscribers", () => {
|
|
24
|
+
const s = Object.entries(this.subscribersEvents);
|
|
25
|
+
for (const [e, r] of s)
|
|
26
|
+
this.subscribersEvents[e] = [];
|
|
27
|
+
});
|
|
28
|
+
s.forEach((e) => {
|
|
29
|
+
this.subscribersEvents[e] = [];
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
export {
|
|
34
|
+
E as EventSubscribers
|
|
35
|
+
};
|
|
@@ -5,7 +5,7 @@ import { NetworkInformation as k } from "../Utils/NetworkInformation/NetworkInfo
|
|
|
5
5
|
import { apiRequest as u } from "./deps/apiRequest/apiRequest.js";
|
|
6
6
|
import { NetworkInformationCordova as g } from "../Utils/NetworkInformation/classes/NetworkInformationCordova.js";
|
|
7
7
|
import { NetworkInformationPC as b } from "../Utils/NetworkInformation/classes/NetworkInformationPC.js";
|
|
8
|
-
import { EventSubscribers as N } from "../
|
|
8
|
+
import { EventSubscribers as N } from "../EventSubscribers/EventSubscribers.js";
|
|
9
9
|
const t = class t {
|
|
10
10
|
static setState(e) {
|
|
11
11
|
t.state = { ...t.state, ...e };
|
|
@@ -42,6 +42,7 @@ const t = class t {
|
|
|
42
42
|
t.events.publish("fetch", n), I(n);
|
|
43
43
|
}).catch((c) => {
|
|
44
44
|
const n = {
|
|
45
|
+
//TODO: Проверить. dataErr не верно возвращает
|
|
45
46
|
isReq: !1,
|
|
46
47
|
isReload: !1,
|
|
47
48
|
keyAction: e,
|
|
@@ -4,7 +4,7 @@ var x = (e, t, n) => (lt(e, typeof t != "symbol" ? t + "" : t, n), n);
|
|
|
4
4
|
import { ErrorsHandler as ft } from "./ErrorsHandler/ErrorsHandler.js";
|
|
5
5
|
import { SaveRequest as Oe } from "./SaveRequest/SaveRequest.js";
|
|
6
6
|
import { Utils as ne } from "../../../Utils/Utils.js";
|
|
7
|
-
function
|
|
7
|
+
function He(e, t) {
|
|
8
8
|
return function() {
|
|
9
9
|
return e.apply(t, arguments);
|
|
10
10
|
};
|
|
@@ -12,25 +12,25 @@ function Ie(e, t) {
|
|
|
12
12
|
const { toString: dt } = Object.prototype, { getPrototypeOf: ye } = Object, X = /* @__PURE__ */ ((e) => (t) => {
|
|
13
13
|
const n = dt.call(t);
|
|
14
14
|
return e[n] || (e[n] = n.slice(8, -1).toLowerCase());
|
|
15
|
-
})(/* @__PURE__ */ Object.create(null)),
|
|
15
|
+
})(/* @__PURE__ */ Object.create(null)), D = (e) => (e = e.toLowerCase(), (t) => X(t) === e), Q = (e) => (t) => typeof t === e, { isArray: _ } = Array, v = Q("undefined");
|
|
16
16
|
function pt(e) {
|
|
17
17
|
return e !== null && !v(e) && e.constructor !== null && !v(e.constructor) && N(e.constructor.isBuffer) && e.constructor.isBuffer(e);
|
|
18
18
|
}
|
|
19
|
-
const
|
|
19
|
+
const qe = D("ArrayBuffer");
|
|
20
20
|
function ht(e) {
|
|
21
21
|
let t;
|
|
22
|
-
return typeof ArrayBuffer < "u" && ArrayBuffer.isView ? t = ArrayBuffer.isView(e) : t = e && e.buffer &&
|
|
22
|
+
return typeof ArrayBuffer < "u" && ArrayBuffer.isView ? t = ArrayBuffer.isView(e) : t = e && e.buffer && qe(e.buffer), t;
|
|
23
23
|
}
|
|
24
24
|
const mt = Q("string"), N = Q("function"), ve = Q("number"), Z = (e) => e !== null && typeof e == "object", yt = (e) => e === !0 || e === !1, J = (e) => {
|
|
25
25
|
if (X(e) !== "object")
|
|
26
26
|
return !1;
|
|
27
27
|
const t = ye(e);
|
|
28
28
|
return (t === null || t === Object.prototype || Object.getPrototypeOf(t) === null) && !(Symbol.toStringTag in e) && !(Symbol.iterator in e);
|
|
29
|
-
}, wt =
|
|
29
|
+
}, wt = D("Date"), gt = D("File"), bt = D("Blob"), Et = D("FileList"), St = (e) => Z(e) && N(e.pipe), Rt = (e) => {
|
|
30
30
|
let t;
|
|
31
31
|
return e && (typeof FormData == "function" && e instanceof FormData || N(e.append) && ((t = X(e)) === "formdata" || // detect form-data instance
|
|
32
32
|
t === "object" && N(e.toString) && e.toString() === "[object FormData]"));
|
|
33
|
-
}, Ot =
|
|
33
|
+
}, Ot = D("URLSearchParams"), [Tt, At, Ct, xt] = ["ReadableStream", "Request", "Response", "Headers"].map(D), Nt = (e) => e.trim ? e.trim() : e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, "");
|
|
34
34
|
function M(e, t, { allOwnKeys: n = !1 } = {}) {
|
|
35
35
|
if (e === null || typeof e > "u")
|
|
36
36
|
return;
|
|
@@ -65,12 +65,12 @@ function ce() {
|
|
|
65
65
|
return t;
|
|
66
66
|
}
|
|
67
67
|
const Pt = (e, t, n, { allOwnKeys: r } = {}) => (M(t, (s, o) => {
|
|
68
|
-
n && N(s) ? e[o] =
|
|
68
|
+
n && N(s) ? e[o] = He(s, n) : e[o] = s;
|
|
69
69
|
}, { allOwnKeys: r }), e), kt = (e) => (e.charCodeAt(0) === 65279 && (e = e.slice(1)), e), Ft = (e, t, n, r) => {
|
|
70
70
|
e.prototype = Object.create(t.prototype, r), e.prototype.constructor = e, Object.defineProperty(e, "super", {
|
|
71
71
|
value: t.prototype
|
|
72
72
|
}), n && Object.assign(e.prototype, n);
|
|
73
|
-
},
|
|
73
|
+
}, Dt = (e, t, n, r) => {
|
|
74
74
|
let s, o, i;
|
|
75
75
|
const c = {};
|
|
76
76
|
if (t = t || {}, e == null)
|
|
@@ -81,7 +81,7 @@ const Pt = (e, t, n, { allOwnKeys: r } = {}) => (M(t, (s, o) => {
|
|
|
81
81
|
e = n !== !1 && ye(e);
|
|
82
82
|
} while (e && (!n || n(e, t)) && e !== Object.prototype);
|
|
83
83
|
return t;
|
|
84
|
-
},
|
|
84
|
+
}, Ut = (e, t, n) => {
|
|
85
85
|
e = String(e), (n === void 0 || n > e.length) && (n = e.length), n -= t.length;
|
|
86
86
|
const r = e.indexOf(t, n);
|
|
87
87
|
return r !== -1 && r === n;
|
|
@@ -110,12 +110,12 @@ const Pt = (e, t, n, { allOwnKeys: r } = {}) => (M(t, (s, o) => {
|
|
|
110
110
|
for (; (n = e.exec(t)) !== null; )
|
|
111
111
|
r.push(n);
|
|
112
112
|
return r;
|
|
113
|
-
},
|
|
113
|
+
}, It = D("HTMLFormElement"), Ht = (e) => e.toLowerCase().replace(
|
|
114
114
|
/[-_\s]([a-z\d])(\w*)/g,
|
|
115
115
|
function(n, r, s) {
|
|
116
116
|
return r.toUpperCase() + s;
|
|
117
117
|
}
|
|
118
|
-
), Te = (({ hasOwnProperty: e }) => (t, n) => e.call(t, n))(Object.prototype),
|
|
118
|
+
), Te = (({ hasOwnProperty: e }) => (t, n) => e.call(t, n))(Object.prototype), qt = D("RegExp"), Je = (e, t) => {
|
|
119
119
|
const n = Object.getOwnPropertyDescriptors(e), r = {};
|
|
120
120
|
M(n, (s, o) => {
|
|
121
121
|
let i;
|
|
@@ -175,7 +175,7 @@ const Wt = (e) => {
|
|
|
175
175
|
return r;
|
|
176
176
|
};
|
|
177
177
|
return n(e, 0);
|
|
178
|
-
}, Kt =
|
|
178
|
+
}, Kt = D("AsyncFunction"), Gt = (e) => e && (Z(e) || N(e)) && N(e.then) && N(e.catch), Ve = ((e, t) => e ? setImmediate : t ? ((n, r) => (B.addEventListener("message", ({ source: s, data: o }) => {
|
|
179
179
|
s === B && o === n && r.length && r.shift()();
|
|
180
180
|
}, !1), (s) => {
|
|
181
181
|
r.push(s), B.postMessage(n, "*");
|
|
@@ -184,7 +184,7 @@ const Wt = (e) => {
|
|
|
184
184
|
N(B.postMessage)
|
|
185
185
|
), Xt = typeof queueMicrotask < "u" ? queueMicrotask.bind(B) : typeof process < "u" && process.nextTick || Ve, a = {
|
|
186
186
|
isArray: _,
|
|
187
|
-
isArrayBuffer:
|
|
187
|
+
isArrayBuffer: qe,
|
|
188
188
|
isBuffer: pt,
|
|
189
189
|
isFormData: Rt,
|
|
190
190
|
isArrayBufferView: ht,
|
|
@@ -201,7 +201,7 @@ const Wt = (e) => {
|
|
|
201
201
|
isDate: wt,
|
|
202
202
|
isFile: gt,
|
|
203
203
|
isBlob: bt,
|
|
204
|
-
isRegExp:
|
|
204
|
+
isRegExp: qt,
|
|
205
205
|
isFunction: N,
|
|
206
206
|
isStream: St,
|
|
207
207
|
isURLSearchParams: Ot,
|
|
@@ -213,21 +213,21 @@ const Wt = (e) => {
|
|
|
213
213
|
trim: Nt,
|
|
214
214
|
stripBOM: kt,
|
|
215
215
|
inherits: Ft,
|
|
216
|
-
toFlatObject:
|
|
216
|
+
toFlatObject: Dt,
|
|
217
217
|
kindOf: X,
|
|
218
|
-
kindOfTest:
|
|
219
|
-
endsWith:
|
|
218
|
+
kindOfTest: D,
|
|
219
|
+
endsWith: Ut,
|
|
220
220
|
toArray: Lt,
|
|
221
221
|
forEachEntry: jt,
|
|
222
222
|
matchAll: _t,
|
|
223
|
-
isHTMLForm:
|
|
223
|
+
isHTMLForm: It,
|
|
224
224
|
hasOwnProperty: Te,
|
|
225
225
|
hasOwnProp: Te,
|
|
226
226
|
// an alias to avoid ESLint no-prototype-builtins detection
|
|
227
227
|
reduceDescriptors: Je,
|
|
228
228
|
freezeMethods: vt,
|
|
229
229
|
toObjectSet: Mt,
|
|
230
|
-
toCamelCase:
|
|
230
|
+
toCamelCase: Ht,
|
|
231
231
|
noop: zt,
|
|
232
232
|
toFiniteNumber: Jt,
|
|
233
233
|
findKey: Me,
|
|
@@ -633,7 +633,7 @@ const Ee = be, hn = a.toObjectSet([
|
|
|
633
633
|
s = i.indexOf(":"), n = i.substring(0, s).trim().toLowerCase(), r = i.substring(s + 1).trim(), !(!n || t[n] && hn[n]) && (n === "set-cookie" ? t[n] ? t[n].push(r) : t[n] = [r] : t[n] = t[n] ? t[n] + ", " + r : r);
|
|
634
634
|
}), t;
|
|
635
635
|
}, Pe = Symbol("internals");
|
|
636
|
-
function
|
|
636
|
+
function q(e) {
|
|
637
637
|
return e && String(e).trim().toLowerCase();
|
|
638
638
|
}
|
|
639
639
|
function $(e) {
|
|
@@ -678,7 +678,7 @@ class ee {
|
|
|
678
678
|
set(t, n, r) {
|
|
679
679
|
const s = this;
|
|
680
680
|
function o(c, f, u) {
|
|
681
|
-
const l =
|
|
681
|
+
const l = q(f);
|
|
682
682
|
if (!l)
|
|
683
683
|
throw new Error("header name must be a non-empty string");
|
|
684
684
|
const m = a.findKey(s, l);
|
|
@@ -697,7 +697,7 @@ class ee {
|
|
|
697
697
|
return this;
|
|
698
698
|
}
|
|
699
699
|
get(t, n) {
|
|
700
|
-
if (t =
|
|
700
|
+
if (t = q(t), t) {
|
|
701
701
|
const r = a.findKey(this, t);
|
|
702
702
|
if (r) {
|
|
703
703
|
const s = this[r];
|
|
@@ -714,7 +714,7 @@ class ee {
|
|
|
714
714
|
}
|
|
715
715
|
}
|
|
716
716
|
has(t, n) {
|
|
717
|
-
if (t =
|
|
717
|
+
if (t = q(t), t) {
|
|
718
718
|
const r = a.findKey(this, t);
|
|
719
719
|
return !!(r && this[r] !== void 0 && (!n || se(this, this[r], r, n)));
|
|
720
720
|
}
|
|
@@ -724,7 +724,7 @@ class ee {
|
|
|
724
724
|
const r = this;
|
|
725
725
|
let s = !1;
|
|
726
726
|
function o(i) {
|
|
727
|
-
if (i =
|
|
727
|
+
if (i = q(i), i) {
|
|
728
728
|
const c = a.findKey(r, i);
|
|
729
729
|
c && (!n || se(r, r[c], c, n)) && (delete r[c], s = !0);
|
|
730
730
|
}
|
|
@@ -783,7 +783,7 @@ class ee {
|
|
|
783
783
|
accessors: {}
|
|
784
784
|
}).accessors, s = this.prototype;
|
|
785
785
|
function o(i) {
|
|
786
|
-
const c =
|
|
786
|
+
const c = q(i);
|
|
787
787
|
r[c] || (bn(s, i), r[c] = !0);
|
|
788
788
|
}
|
|
789
789
|
return a.isArray(t) ? t.forEach(o) : o(t), this;
|
|
@@ -811,10 +811,10 @@ function oe(e, t) {
|
|
|
811
811
|
function et(e) {
|
|
812
812
|
return !!(e && e.__CANCEL__);
|
|
813
813
|
}
|
|
814
|
-
function
|
|
814
|
+
function I(e, t, n) {
|
|
815
815
|
y.call(this, e ?? "canceled", y.ERR_CANCELED, t, n), this.name = "CanceledError";
|
|
816
816
|
}
|
|
817
|
-
a.inherits(
|
|
817
|
+
a.inherits(I, y, {
|
|
818
818
|
__CANCEL__: !0
|
|
819
819
|
});
|
|
820
820
|
function tt(e, t, n) {
|
|
@@ -952,7 +952,7 @@ function Cn(e, t) {
|
|
|
952
952
|
function nt(e, t) {
|
|
953
953
|
return e && !An(t) ? Cn(e, t) : t;
|
|
954
954
|
}
|
|
955
|
-
const
|
|
955
|
+
const De = (e) => e instanceof F ? { ...e } : e;
|
|
956
956
|
function j(e, t) {
|
|
957
957
|
t = t || {};
|
|
958
958
|
const n = {};
|
|
@@ -1012,7 +1012,7 @@ function j(e, t) {
|
|
|
1012
1012
|
socketPath: i,
|
|
1013
1013
|
responseEncoding: i,
|
|
1014
1014
|
validateStatus: c,
|
|
1015
|
-
headers: (u, l) => s(
|
|
1015
|
+
headers: (u, l) => s(De(u), De(l), !0)
|
|
1016
1016
|
};
|
|
1017
1017
|
return a.forEach(Object.keys(Object.assign({}, e, t)), function(l) {
|
|
1018
1018
|
const m = f[l] || s, S = m(e[l], t[l], l);
|
|
@@ -1088,7 +1088,7 @@ const rt = (e) => {
|
|
|
1088
1088
|
}, o === void 0 && i.setContentType(null), "setRequestHeader" in p && a.forEach(i.toJSON(), function(E, A) {
|
|
1089
1089
|
p.setRequestHeader(A, E);
|
|
1090
1090
|
}), a.isUndefined(s.withCredentials) || (p.withCredentials = !!s.withCredentials), c && c !== "json" && (p.responseType = s.responseType), u && ([S, d] = W(u, !0), p.addEventListener("progress", S)), f && p.upload && ([m, R] = W(f), p.upload.addEventListener("progress", m), p.upload.addEventListener("loadend", R)), (s.cancelToken || s.signal) && (l = (O) => {
|
|
1091
|
-
p && (r(!O || O.type ? new
|
|
1091
|
+
p && (r(!O || O.type ? new I(null, e, p) : O), p.abort(), p = null);
|
|
1092
1092
|
}, s.cancelToken && s.cancelToken.subscribe(l), s.signal && (s.signal.aborted ? l() : s.signal.addEventListener("abort", l)));
|
|
1093
1093
|
const b = En(s.url);
|
|
1094
1094
|
if (b && C.protocols.indexOf(b) === -1) {
|
|
@@ -1105,7 +1105,7 @@ const rt = (e) => {
|
|
|
1105
1105
|
if (!s) {
|
|
1106
1106
|
s = !0, c();
|
|
1107
1107
|
const l = u instanceof Error ? u : this.reason;
|
|
1108
|
-
r.abort(l instanceof y ? l : new
|
|
1108
|
+
r.abort(l instanceof y ? l : new I(l instanceof Error ? l.message : l));
|
|
1109
1109
|
}
|
|
1110
1110
|
};
|
|
1111
1111
|
let i = t && setTimeout(() => {
|
|
@@ -1129,10 +1129,10 @@ const rt = (e) => {
|
|
|
1129
1129
|
let r = 0, s;
|
|
1130
1130
|
for (; r < n; )
|
|
1131
1131
|
s = r + t, yield e.slice(r, s), r = s;
|
|
1132
|
-
},
|
|
1133
|
-
for await (const n of
|
|
1132
|
+
}, Dn = async function* (e, t) {
|
|
1133
|
+
for await (const n of Un(e))
|
|
1134
1134
|
yield* Fn(n, t);
|
|
1135
|
-
},
|
|
1135
|
+
}, Un = async function* (e) {
|
|
1136
1136
|
if (e[Symbol.asyncIterator]) {
|
|
1137
1137
|
yield* e;
|
|
1138
1138
|
return;
|
|
@@ -1148,8 +1148,8 @@ const rt = (e) => {
|
|
|
1148
1148
|
} finally {
|
|
1149
1149
|
await t.cancel();
|
|
1150
1150
|
}
|
|
1151
|
-
},
|
|
1152
|
-
const s =
|
|
1151
|
+
}, Ue = (e, t, n, r) => {
|
|
1152
|
+
const s = Dn(e, t);
|
|
1153
1153
|
let o = 0, i, c = (f) => {
|
|
1154
1154
|
i || (i = !0, r && r(f));
|
|
1155
1155
|
};
|
|
@@ -1220,7 +1220,7 @@ const jn = async (e) => {
|
|
|
1220
1220
|
}, _n = async (e, t) => {
|
|
1221
1221
|
const n = a.toFiniteNumber(e.getContentLength());
|
|
1222
1222
|
return n ?? jn(t);
|
|
1223
|
-
},
|
|
1223
|
+
}, In = te && (async (e) => {
|
|
1224
1224
|
let {
|
|
1225
1225
|
url: t,
|
|
1226
1226
|
method: n,
|
|
@@ -1253,7 +1253,7 @@ const jn = async (e) => {
|
|
|
1253
1253
|
p,
|
|
1254
1254
|
W(Fe(f))
|
|
1255
1255
|
);
|
|
1256
|
-
r =
|
|
1256
|
+
r = Ue(A.body, Le, k, L);
|
|
1257
1257
|
}
|
|
1258
1258
|
}
|
|
1259
1259
|
a.isString(m) || (m = m ? "include" : "omit");
|
|
@@ -1271,15 +1271,15 @@ const jn = async (e) => {
|
|
|
1271
1271
|
const O = fe && (u === "stream" || u === "response");
|
|
1272
1272
|
if (fe && (c || O && h)) {
|
|
1273
1273
|
const A = {};
|
|
1274
|
-
["status", "statusText", "headers"].forEach((
|
|
1275
|
-
A[
|
|
1274
|
+
["status", "statusText", "headers"].forEach((H) => {
|
|
1275
|
+
A[H] = b[H];
|
|
1276
1276
|
});
|
|
1277
1277
|
const P = a.toFiniteNumber(b.headers.get("content-length")), [k, L] = c && ke(
|
|
1278
1278
|
P,
|
|
1279
1279
|
W(Fe(c), !0)
|
|
1280
1280
|
) || [];
|
|
1281
1281
|
b = new Response(
|
|
1282
|
-
|
|
1282
|
+
Ue(b.body, Le, k, () => {
|
|
1283
1283
|
L && L(), h && h();
|
|
1284
1284
|
}),
|
|
1285
1285
|
A
|
|
@@ -1308,7 +1308,7 @@ const jn = async (e) => {
|
|
|
1308
1308
|
}), de = {
|
|
1309
1309
|
http: Qt,
|
|
1310
1310
|
xhr: Nn,
|
|
1311
|
-
fetch:
|
|
1311
|
+
fetch: In
|
|
1312
1312
|
};
|
|
1313
1313
|
a.forEach(de, (e, t) => {
|
|
1314
1314
|
if (e) {
|
|
@@ -1319,7 +1319,7 @@ a.forEach(de, (e, t) => {
|
|
|
1319
1319
|
Object.defineProperty(e, "adapterName", { value: t });
|
|
1320
1320
|
}
|
|
1321
1321
|
});
|
|
1322
|
-
const Be = (e) => `- ${e}`,
|
|
1322
|
+
const Be = (e) => `- ${e}`, Hn = (e) => a.isFunction(e) || e === null || e === !1, it = {
|
|
1323
1323
|
getAdapter: (e) => {
|
|
1324
1324
|
e = a.isArray(e) ? e : [e];
|
|
1325
1325
|
const { length: t } = e;
|
|
@@ -1328,7 +1328,7 @@ const Be = (e) => `- ${e}`, In = (e) => a.isFunction(e) || e === null || e === !
|
|
|
1328
1328
|
for (let o = 0; o < t; o++) {
|
|
1329
1329
|
n = e[o];
|
|
1330
1330
|
let i;
|
|
1331
|
-
if (r = n, !
|
|
1331
|
+
if (r = n, !Hn(n) && (r = de[(i = String(n)).toLowerCase()], r === void 0))
|
|
1332
1332
|
throw new y(`Unknown adapter '${i}'`);
|
|
1333
1333
|
if (r)
|
|
1334
1334
|
break;
|
|
@@ -1352,7 +1352,7 @@ const Be = (e) => `- ${e}`, In = (e) => a.isFunction(e) || e === null || e === !
|
|
|
1352
1352
|
};
|
|
1353
1353
|
function ie(e) {
|
|
1354
1354
|
if (e.cancelToken && e.cancelToken.throwIfRequested(), e.signal && e.signal.aborted)
|
|
1355
|
-
throw new
|
|
1355
|
+
throw new I(null, e);
|
|
1356
1356
|
}
|
|
1357
1357
|
function je(e) {
|
|
1358
1358
|
return ie(e), e.headers = F.from(e.headers), e.data = oe.call(
|
|
@@ -1397,7 +1397,7 @@ Se.transitional = function(t, n, r) {
|
|
|
1397
1397
|
)), t ? t(o, i, c) : !0;
|
|
1398
1398
|
};
|
|
1399
1399
|
};
|
|
1400
|
-
function
|
|
1400
|
+
function qn(e, t, n) {
|
|
1401
1401
|
if (typeof e != "object")
|
|
1402
1402
|
throw new y("options must be an object", y.ERR_BAD_OPTION_VALUE);
|
|
1403
1403
|
const r = Object.keys(e);
|
|
@@ -1415,9 +1415,9 @@ function Hn(e, t, n) {
|
|
|
1415
1415
|
}
|
|
1416
1416
|
}
|
|
1417
1417
|
const pe = {
|
|
1418
|
-
assertOptions:
|
|
1418
|
+
assertOptions: qn,
|
|
1419
1419
|
validators: Se
|
|
1420
|
-
},
|
|
1420
|
+
}, U = pe.validators;
|
|
1421
1421
|
class G {
|
|
1422
1422
|
constructor(t) {
|
|
1423
1423
|
this.defaults = t, this.interceptors = {
|
|
@@ -1454,14 +1454,14 @@ class G {
|
|
|
1454
1454
|
typeof t == "string" ? (n = n || {}, n.url = t) : n = t || {}, n = j(this.defaults, n);
|
|
1455
1455
|
const { transitional: r, paramsSerializer: s, headers: o } = n;
|
|
1456
1456
|
r !== void 0 && pe.assertOptions(r, {
|
|
1457
|
-
silentJSONParsing:
|
|
1458
|
-
forcedJSONParsing:
|
|
1459
|
-
clarifyTimeoutError:
|
|
1457
|
+
silentJSONParsing: U.transitional(U.boolean),
|
|
1458
|
+
forcedJSONParsing: U.transitional(U.boolean),
|
|
1459
|
+
clarifyTimeoutError: U.transitional(U.boolean)
|
|
1460
1460
|
}, !1), s != null && (a.isFunction(s) ? n.paramsSerializer = {
|
|
1461
1461
|
serialize: s
|
|
1462
1462
|
} : pe.assertOptions(s, {
|
|
1463
|
-
encode:
|
|
1464
|
-
serialize:
|
|
1463
|
+
encode: U.function,
|
|
1464
|
+
serialize: U.function
|
|
1465
1465
|
}, !0)), n.method = (n.method || this.defaults.method || "get").toLowerCase();
|
|
1466
1466
|
let i = o && a.merge(
|
|
1467
1467
|
o.common,
|
|
@@ -1565,7 +1565,7 @@ class Re {
|
|
|
1565
1565
|
r.unsubscribe(o);
|
|
1566
1566
|
}, i;
|
|
1567
1567
|
}, t(function(o, i, c) {
|
|
1568
|
-
r.reason || (r.reason = new
|
|
1568
|
+
r.reason || (r.reason = new I(o, i, c), n(r.reason));
|
|
1569
1569
|
});
|
|
1570
1570
|
}
|
|
1571
1571
|
/**
|
|
@@ -1693,14 +1693,14 @@ Object.entries(he).forEach(([e, t]) => {
|
|
|
1693
1693
|
});
|
|
1694
1694
|
const Jn = he;
|
|
1695
1695
|
function ct(e) {
|
|
1696
|
-
const t = new V(e), n =
|
|
1696
|
+
const t = new V(e), n = He(V.prototype.request, t);
|
|
1697
1697
|
return a.extend(n, V.prototype, t, { allOwnKeys: !0 }), a.extend(n, t, null, { allOwnKeys: !0 }), n.create = function(s) {
|
|
1698
1698
|
return ct(j(e, s));
|
|
1699
1699
|
}, n;
|
|
1700
1700
|
}
|
|
1701
1701
|
const T = ct(Ee);
|
|
1702
1702
|
T.Axios = V;
|
|
1703
|
-
T.CanceledError =
|
|
1703
|
+
T.CanceledError = I;
|
|
1704
1704
|
T.CancelToken = vn;
|
|
1705
1705
|
T.isCancel = et;
|
|
1706
1706
|
T.VERSION = at;
|
|
@@ -1815,7 +1815,7 @@ x(w, "keyCookie", "AuthCookie"), x(w, "cookieOptions", {}), x(w, "registerReques
|
|
|
1815
1815
|
};
|
|
1816
1816
|
if (window != null && window.cordova && ((S = (m = window == null ? void 0 : window.cordova) == null ? void 0 : m.plugin) != null && S.http)) {
|
|
1817
1817
|
const { http: d } = (R = window == null ? void 0 : window.cordova) == null ? void 0 : R.plugin;
|
|
1818
|
-
d.setDataSerializer("json"), d.setRequestTimeout(Number(c.timeout) / 1e3), w.registerRequest.setList({ url: t, options: c }), d.sendRequest(
|
|
1818
|
+
"Content-Type" in (c == null ? void 0 : c.headers) && ((c == null ? void 0 : c.headers["Content-Type"]) === "multipart/form-data" && d.setDataSerializer("urlencoded"), (c == null ? void 0 : c.headers["Content-Type"]) === "application/json" && d.setDataSerializer("json")), d.setRequestTimeout(Number(c.timeout) / 1e3), w.registerRequest.setList({ url: t, options: c }), d.sendRequest(
|
|
1819
1819
|
t,
|
|
1820
1820
|
c,
|
|
1821
1821
|
(h) => {
|
|
@@ -1830,8 +1830,8 @@ x(w, "keyCookie", "AuthCookie"), x(w, "cookieOptions", {}), x(w, "registerReques
|
|
|
1830
1830
|
message: ""
|
|
1831
1831
|
};
|
|
1832
1832
|
if (P) {
|
|
1833
|
-
const L = JSON.parse(E.trim()),
|
|
1834
|
-
k.message =
|
|
1833
|
+
const L = JSON.parse(E.trim()), H = w.errorsHandler.getErrorMessageFromData(L);
|
|
1834
|
+
k.message = H, k.data = L, p.msg = H;
|
|
1835
1835
|
} else
|
|
1836
1836
|
typeof E == "string" && (k.message = E);
|
|
1837
1837
|
s({ ...l, ...p, errExt: k });
|
|
@@ -1886,7 +1886,7 @@ x(w, "keyCookie", "AuthCookie"), x(w, "cookieOptions", {}), x(w, "registerReques
|
|
|
1886
1886
|
}), x(w, "setCookieOptions", (t) => {
|
|
1887
1887
|
w.cookieOptions = t;
|
|
1888
1888
|
});
|
|
1889
|
-
let
|
|
1889
|
+
let Ie = w;
|
|
1890
1890
|
export {
|
|
1891
|
-
|
|
1891
|
+
Ie as apiRequest
|
|
1892
1892
|
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { NetworkStatusInfoTracker, OnStatusChange, NetworkConstructorConfig } from './NetworkStatusTracker.types';
|
|
2
|
+
|
|
3
|
+
export declare class NetworkStatusTracker {
|
|
4
|
+
private networkInfo;
|
|
5
|
+
private listUrls;
|
|
6
|
+
private state;
|
|
7
|
+
private setState;
|
|
8
|
+
private getState;
|
|
9
|
+
constructor(listUrls: string[]);
|
|
10
|
+
private getFetchOptions;
|
|
11
|
+
private getConnection;
|
|
12
|
+
private getIsNetwork;
|
|
13
|
+
private getTypeNetwork;
|
|
14
|
+
private updateState;
|
|
15
|
+
private controllersEvents;
|
|
16
|
+
private getControllersEvents;
|
|
17
|
+
private setControllersEvents;
|
|
18
|
+
startEvents(onStatusChange: OnStatusChange): void;
|
|
19
|
+
stopEvents(): void;
|
|
20
|
+
private requestByUrls;
|
|
21
|
+
private checkConnection;
|
|
22
|
+
private controllersFetching;
|
|
23
|
+
private getControllersMonitoring;
|
|
24
|
+
private setControllersMonitoring;
|
|
25
|
+
private startFetching;
|
|
26
|
+
private stopFetching;
|
|
27
|
+
checkStatus(onStatusChange?: OnStatusChange, config?: NetworkConstructorConfig): Promise<NetworkStatusInfoTracker>;
|
|
28
|
+
private fetchingNetwork;
|
|
29
|
+
getCurrentState(): NetworkStatusInfoTracker;
|
|
30
|
+
}
|