@glodon-aiot/apis 3.0.5 → 3.0.6

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.
@@ -528,7 +528,7 @@ class Y extends b {
528
528
  openWhenHidden: !0,
529
529
  signal: i,
530
530
  onopen(o) {
531
- return console.log("onopen"), o.ok && r != null && r.onopen && r.onopen(), Promise.resolve();
531
+ return o.ok && r != null && r.onopen && r.onopen(), Promise.resolve();
532
532
  },
533
533
  onmessage(o) {
534
534
  if (!o.data && !o.event && !o.id && !o.retry)
@@ -114,7 +114,7 @@ class _ extends k {
114
114
  openWhenHidden: !0,
115
115
  signal: i,
116
116
  onopen(d) {
117
- return console.log("onopen"), d.ok && n != null && n.onopen && n.onopen(), Promise.resolve();
117
+ return d.ok && n != null && n.onopen && n.onopen(), Promise.resolve();
118
118
  },
119
119
  onmessage(d) {
120
120
  if (!d.data.includes('{"code": ')) {
@@ -1,78 +1,78 @@
1
- var g = Object.defineProperty;
2
- var d = Object.getOwnPropertySymbols;
3
- var x = Object.prototype.hasOwnProperty, y = Object.prototype.propertyIsEnumerable;
4
- var u = (o, s, e) => s in o ? g(o, s, { enumerable: !0, configurable: !0, writable: !0, value: e }) : o[s] = e, c = (o, s) => {
5
- for (var e in s || (s = {}))
6
- x.call(s, e) && u(o, e, s[e]);
7
- if (d)
8
- for (var e of d(s))
9
- y.call(s, e) && u(o, e, s[e]);
1
+ var x = Object.defineProperty;
2
+ var l = Object.getOwnPropertySymbols;
3
+ var g = Object.prototype.hasOwnProperty, y = Object.prototype.propertyIsEnumerable;
4
+ var u = (o, s, t) => s in o ? x(o, s, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[s] = t, c = (o, s) => {
5
+ for (var t in s || (s = {}))
6
+ g.call(s, t) && u(o, t, s[t]);
7
+ if (l)
8
+ for (var t of l(s))
9
+ y.call(s, t) && u(o, t, s[t]);
10
10
  return o;
11
11
  };
12
- var n = (o, s, e) => new Promise((t, r) => {
12
+ var n = (o, s, t) => new Promise((e, r) => {
13
13
  var p = (a) => {
14
14
  try {
15
- h(e.next(a));
16
- } catch (l) {
17
- r(l);
15
+ h(t.next(a));
16
+ } catch (d) {
17
+ r(d);
18
18
  }
19
19
  }, i = (a) => {
20
20
  try {
21
- h(e.throw(a));
22
- } catch (l) {
23
- r(l);
21
+ h(t.throw(a));
22
+ } catch (d) {
23
+ r(d);
24
24
  }
25
- }, h = (a) => a.done ? t(a.value) : Promise.resolve(a.value).then(p, i);
26
- h((e = e.apply(o, s)).next());
25
+ }, h = (a) => a.done ? e(a.value) : Promise.resolve(a.value).then(p, i);
26
+ h((t = t.apply(o, s)).next());
27
27
  });
28
28
  class R {
29
- constructor(s, e) {
30
- this.axios = s, this.errorHandler = e;
29
+ constructor(s, t) {
30
+ this.axios = s, this.errorHandler = t;
31
31
  }
32
- get(s, e, t) {
32
+ get(s, t, e) {
33
33
  return n(this, null, function* () {
34
34
  const r = this.axios.get(s, {
35
- params: e
35
+ params: t
36
36
  });
37
- return this.handleResponse(r, t);
37
+ return this.handleResponse(r, e);
38
38
  });
39
39
  }
40
- listPaged(s, e) {
40
+ listPaged(s, t) {
41
41
  return n(this, null, function* () {
42
- const t = this.axios.get(s, {
43
- params: e
42
+ const e = this.axios.get(s, {
43
+ params: t
44
44
  });
45
- return this.handleResponse(t);
45
+ return this.handleResponse(e);
46
46
  });
47
47
  }
48
- list(s, e) {
48
+ list(s, t) {
49
49
  return n(this, null, function* () {
50
- const t = this.axios.get(s, {
51
- params: e
50
+ const e = this.axios.get(s, {
51
+ params: t
52
52
  });
53
- return this.handleResponse(t);
53
+ return this.handleResponse(e);
54
54
  });
55
55
  }
56
- delete(s, e) {
56
+ delete(s, t) {
57
57
  return n(this, null, function* () {
58
- const t = this.axios.delete(s, {
59
- params: e
58
+ const e = this.axios.delete(s, {
59
+ params: t
60
60
  });
61
- return this.handleResponse(t);
61
+ return this.handleResponse(e);
62
62
  });
63
63
  }
64
- post(s, e, t, r) {
64
+ post(s, t, e, r) {
65
65
  return n(this, null, function* () {
66
- const p = this.axios.post(s, e, c({
67
- params: t
66
+ const p = this.axios.post(s, t, c({
67
+ params: e
68
68
  }, r));
69
69
  return this.handleResponse(p);
70
70
  });
71
71
  }
72
- postForm(s, e, t) {
72
+ postForm(s, t, e) {
73
73
  return n(this, null, function* () {
74
- const r = this.axios.post(s, e, {
75
- params: t,
74
+ const r = this.axios.post(s, t, {
75
+ params: e,
76
76
  headers: {
77
77
  "Content-Type": "multipart/form-data"
78
78
  }
@@ -80,31 +80,31 @@ class R {
80
80
  return this.handleResponse(r);
81
81
  });
82
82
  }
83
- patch(s, e, t) {
83
+ patch(s, t, e) {
84
84
  return n(this, null, function* () {
85
- const r = this.axios.patch(s, e, {
86
- params: t
85
+ const r = this.axios.patch(s, t, {
86
+ params: e
87
87
  });
88
88
  return this.handleResponse(r);
89
89
  });
90
90
  }
91
- put(s, e) {
91
+ put(s, t) {
92
92
  return n(this, null, function* () {
93
- const t = this.axios.put(s, e);
94
- return this.handleResponse(t);
93
+ const e = this.axios.put(s, t);
94
+ return this.handleResponse(e);
95
95
  });
96
96
  }
97
- upload(s, e, t) {
97
+ upload(s, t, e) {
98
98
  return n(this, null, function* () {
99
- const r = this.axios.post(s, e, c({}, t));
99
+ const r = this.axios.post(s, t, c({}, e));
100
100
  return this.handleResponse(r);
101
101
  });
102
102
  }
103
- getNonStandard(s, e) {
103
+ getNonStandard(s, t) {
104
104
  return n(this, null, function* () {
105
- const t = this.axios.get(s, e);
105
+ const e = this.axios.get(s, t);
106
106
  try {
107
- const r = yield t;
107
+ const r = yield e;
108
108
  if (r.status === 200)
109
109
  return r;
110
110
  } catch (r) {
@@ -112,11 +112,11 @@ class R {
112
112
  }
113
113
  });
114
114
  }
115
- postNonStandard(s, e, t, r) {
115
+ postNonStandard(s, t, e, r) {
116
116
  return n(this, null, function* () {
117
117
  var h, a;
118
- const i = yield this.axios.post(s, e, c({
119
- params: t
118
+ const i = yield this.axios.post(s, t, c({
119
+ params: e
120
120
  }, r));
121
121
  if (i.status === 200)
122
122
  if ((h = i.data) != null && h.code)
@@ -125,20 +125,20 @@ class R {
125
125
  return i.data;
126
126
  });
127
127
  }
128
- handleResponse(s, e) {
128
+ handleResponse(s, t) {
129
129
  return n(this, null, function* () {
130
130
  try {
131
- const t = yield s;
132
- return this.handleAppError(t.data, e).data;
133
- } catch (t) {
134
- throw this.handleError(t);
131
+ const e = yield s;
132
+ return this.handleAppError(e.data, t).data;
133
+ } catch (e) {
134
+ throw this.handleError(e);
135
135
  }
136
136
  });
137
137
  }
138
- handleAppError(s, e) {
139
- var t;
138
+ handleAppError(s, t) {
139
+ var e;
140
140
  if (s.code < 200 || s.code >= 300)
141
- throw (t = this.errorHandler) != null && t.onAppStatusError ? this.errorHandler.onAppStatusError(s.code, E(s.code, s.message), e) : console.error("未处理应用错误:", s), {
141
+ throw (e = this.errorHandler) != null && e.onAppStatusError ? this.errorHandler.onAppStatusError(s.code, E(s.code, s.message), t) : console.error("未处理应用错误:", s), {
142
142
  isAxiosError: !1,
143
143
  message: s.message
144
144
  };
@@ -146,8 +146,8 @@ class R {
146
146
  }
147
147
  // https://github.com/axios/axios#handling-errors
148
148
  handleError(s) {
149
- var e, t;
150
- return s.response ? (console.log(s.response.data), console.log(s.response.status), console.log(s.response.headers), (e = this.errorHandler) != null && e.onHttpStatusError && (console.log("HTTP 错误", this.errorHandler), this.errorHandler.onHttpStatusError(s.response.status, "", s.response))) : s.request ? (console.log(s.request), (t = this.errorHandler) != null && t.onNetworkError && this.errorHandler.onNetworkError()) : console.error("axios request config error:", s), new Error(s.message);
149
+ var t, e;
150
+ return s.response ? (t = this.errorHandler) != null && t.onHttpStatusError && (console.log("HTTP 错误", this.errorHandler), this.errorHandler.onHttpStatusError(s.response.status, "", s.response)) : s.request ? (console.log(s.request), (e = this.errorHandler) != null && e.onNetworkError && this.errorHandler.onNetworkError()) : console.error("axios request config error:", s), new Error(s.message);
151
151
  }
152
152
  }
153
153
  const f = (o) => o >= 10002 && o <= 10012, E = (o, s) => f(o) ? "数据操作错误" : s || "未知接口错误";