dev-classes 1.3.13 → 1.3.14
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.
|
@@ -15,5 +15,6 @@ export declare class HTTPSApi {
|
|
|
15
15
|
static on: <K extends "fetch">(name: K, cb: HTTPSApi_Events[K]) => void;
|
|
16
16
|
static off: <K extends "fetch">(name: K, cb: HTTPSApi_Events[K]) => void;
|
|
17
17
|
static request<Result, Req extends RequestPayloadHTTPSApi = RequestPayloadHTTPSApi>({ keyAction, request }: Req): Promise<FetchInfoHTTPSApi<Result>>;
|
|
18
|
-
static
|
|
18
|
+
static removeAuthCookie: () => void;
|
|
19
|
+
static getAuthCookies: () => any;
|
|
19
20
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
var
|
|
2
|
-
var v = (i, e, r) => e in i ?
|
|
1
|
+
var w = Object.defineProperty;
|
|
2
|
+
var v = (i, e, r) => e in i ? w(i, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : i[e] = r;
|
|
3
3
|
var s = (i, e, r) => (v(i, typeof e != "symbol" ? e + "" : e, r), r);
|
|
4
|
-
import { NetworkInformation as
|
|
5
|
-
import { apiRequest as
|
|
6
|
-
import { NetworkInformationCordova as
|
|
7
|
-
import { NetworkInformationPC as
|
|
8
|
-
import { EventSubscribers as
|
|
4
|
+
import { NetworkInformation as k } from "../Utils/NetworkInformation/NetworkInformation.js";
|
|
5
|
+
import { apiRequest as u } from "./deps/apiRequest/apiRequest.js";
|
|
6
|
+
import { NetworkInformationCordova as g } from "../Utils/NetworkInformation/classes/NetworkInformationCordova.js";
|
|
7
|
+
import { NetworkInformationPC as b } from "../Utils/NetworkInformation/classes/NetworkInformationPC.js";
|
|
8
|
+
import { EventSubscribers as N } from "../Utils/EventSubscribers/EventSubscribers.js";
|
|
9
9
|
const t = class t {
|
|
10
10
|
static setState(e) {
|
|
11
11
|
t.state = { ...t.state, ...e };
|
|
@@ -17,8 +17,8 @@ const t = class t {
|
|
|
17
17
|
return t.state.isNetworkStatus;
|
|
18
18
|
}
|
|
19
19
|
static request({ keyAction: e, request: r }) {
|
|
20
|
-
const { url: f, ...
|
|
21
|
-
return new Promise((
|
|
20
|
+
const { url: f, ...h } = r;
|
|
21
|
+
return new Promise((I, l) => {
|
|
22
22
|
t.getIsInit() || t.init();
|
|
23
23
|
const o = t.getIsNetwork(), a = {
|
|
24
24
|
url: f,
|
|
@@ -30,7 +30,7 @@ const t = class t {
|
|
|
30
30
|
isReload: !1
|
|
31
31
|
};
|
|
32
32
|
if (t.events.publish("fetch", a), o) {
|
|
33
|
-
|
|
33
|
+
u.requestInServer(f, h).then((c) => {
|
|
34
34
|
const n = {
|
|
35
35
|
isReq: !1,
|
|
36
36
|
isReload: !0,
|
|
@@ -39,7 +39,7 @@ const t = class t {
|
|
|
39
39
|
msg: "",
|
|
40
40
|
...c
|
|
41
41
|
};
|
|
42
|
-
t.events.publish("fetch", n),
|
|
42
|
+
t.events.publish("fetch", n), I(n);
|
|
43
43
|
}).catch((c) => {
|
|
44
44
|
const n = {
|
|
45
45
|
isReq: !1,
|
|
@@ -47,21 +47,18 @@ const t = class t {
|
|
|
47
47
|
keyAction: e,
|
|
48
48
|
...c
|
|
49
49
|
};
|
|
50
|
-
t.events.publish("fetch", n),
|
|
50
|
+
t.events.publish("fetch", n), l(n);
|
|
51
51
|
});
|
|
52
52
|
return;
|
|
53
53
|
}
|
|
54
|
-
t.events.publish("fetch", a),
|
|
54
|
+
t.events.publish("fetch", a), l(a);
|
|
55
55
|
});
|
|
56
56
|
}
|
|
57
|
-
static removeCookie() {
|
|
58
|
-
l.removeAuthCookie();
|
|
59
|
-
}
|
|
60
57
|
};
|
|
61
58
|
s(t, "state", {
|
|
62
59
|
isInit: !1,
|
|
63
60
|
isNetworkStatus: navigator.onLine
|
|
64
|
-
}), s(t, "internet", new
|
|
61
|
+
}), s(t, "internet", new k([new b(), new g()])), s(t, "events", new N(["fetch"])), s(t, "online", () => {
|
|
65
62
|
t.setState({ isNetworkStatus: !0 });
|
|
66
63
|
}), s(t, "offline", () => {
|
|
67
64
|
t.setState({ isNetworkStatus: !1 });
|
|
@@ -74,7 +71,7 @@ s(t, "state", {
|
|
|
74
71
|
t.internet.run((e) => {
|
|
75
72
|
e ? t.online() : t.offline();
|
|
76
73
|
}), t.setState({ isInit: !0 });
|
|
77
|
-
}), s(t, "on", t.events.subscribe), s(t, "off", t.events.unsubscribe);
|
|
74
|
+
}), s(t, "on", t.events.subscribe), s(t, "off", t.events.unsubscribe), s(t, "removeAuthCookie", u.removeAuthCookie), s(t, "getAuthCookies", u.getAuthCookies);
|
|
78
75
|
let m = t;
|
|
79
76
|
export {
|
|
80
77
|
m as HTTPSApi
|
|
@@ -27,7 +27,7 @@ export declare class apiRequest {
|
|
|
27
27
|
private static errorsHandler;
|
|
28
28
|
static setMethodUploadToken: (cb: RequestUploadToken_F) => void;
|
|
29
29
|
static requestInServer: <ResT = any, T extends object = ResolveRequestInServer_P<ResT>>(url: string, options?: RequestOptions_P) => Promise<T>;
|
|
30
|
-
static
|
|
30
|
+
static getAuthCookies: () => any;
|
|
31
31
|
static saveToken: (token: string) => void;
|
|
32
32
|
static removeAuthCookie: () => void;
|
|
33
33
|
static setCookieOptions: (options: CookieAttributes) => void;
|
|
@@ -1794,7 +1794,7 @@ const g = class g {
|
|
|
1794
1794
|
g.errorsHandler = t;
|
|
1795
1795
|
}
|
|
1796
1796
|
};
|
|
1797
|
-
C(g, "keyCookie", "
|
|
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
1798
|
g.requestUploadToken = t;
|
|
1799
1799
|
}), C(g, "requestInServer", (t, n = {}) => new Promise((r, s) => {
|
|
1800
1800
|
var u, l, p;
|
|
@@ -1802,7 +1802,7 @@ C(g, "keyCookie", "Token"), C(g, "cookieOptions", {}), C(g, "registerRequest", n
|
|
|
1802
1802
|
const i = { url: t, statusCode: 520, msg: "", isErr: !0, errExt: {} }, c = {
|
|
1803
1803
|
method: "get",
|
|
1804
1804
|
headers: {
|
|
1805
|
-
cookie: g.
|
|
1805
|
+
cookie: g.getAuthCookies()
|
|
1806
1806
|
},
|
|
1807
1807
|
timeout: 6e4
|
|
1808
1808
|
}, f = ft.deepMerge(c, n);
|
|
@@ -1830,7 +1830,7 @@ C(g, "keyCookie", "Token"), C(g, "cookieOptions", {}), C(g, "registerRequest", n
|
|
|
1830
1830
|
const w = g.errorsHandler.handleError(b);
|
|
1831
1831
|
s({ ...i, ...w, errExt: b });
|
|
1832
1832
|
});
|
|
1833
|
-
})), C(g, "
|
|
1833
|
+
})), C(g, "getAuthCookies", () => {
|
|
1834
1834
|
var n, r, s;
|
|
1835
1835
|
const { keyCookie: t } = g;
|
|
1836
1836
|
if ((r = (n = window == null ? void 0 : window.cordova) == null ? void 0 : n.plugin) != null && r.http) {
|