@shjjs/visual-ui 3.0.21 → 3.0.22

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,71 +1,82 @@
1
- import { SHJDatasourceV2 as g } from "../index.mjs";
2
- import { httpRequest as o } from "../utils/request.mjs";
3
- import { DataSourceUtils as r } from "../utils/utils.mjs";
4
- const H = async (c, b, i) => {
5
- const e = c?.id, l = c?.source?.api, s = (d) => {
6
- i(r.noneData(d));
7
- };
8
- if (!l || !e)
9
- return s(e || "");
10
- const {
11
- isHeaders: h,
12
- isBody: P,
13
- headers: U,
14
- contentType: p,
15
- url: v,
16
- postParam: D,
17
- type: E,
18
- isUseEnv: y = !0
19
- } = l;
20
- try {
21
- const T = r.getEnvironments().envBaseUrl ?? "", S = y ? T : "", V = r.replaceStringVariables(v), n = h ? r.replaceObjectVariables(U) : {}, u = P ? r.replaceObjectVariables(D) : {}, t = S + V;
22
- if (!t)
23
- return s(e);
24
- let a;
25
- switch (E) {
26
- case "GET":
27
- a = o.get(t, { headers: n });
28
- break;
29
- case "POST":
30
- a = o.post(
31
- t,
32
- u,
33
- { headers: n },
34
- p
35
- );
36
- break;
37
- case "PUT":
38
- a = o.put(
39
- t,
40
- u,
41
- { headers: n },
42
- p
43
- );
44
- break;
45
- case "DELETE":
46
- a = o.delete(t, {
47
- headers: n
48
- });
49
- break;
50
- default:
51
- return s(e);
52
- }
53
- const m = await a;
54
- if (m.status === 200) {
55
- const f = await g.processData(
56
- c.source,
57
- m.data,
58
- e,
59
- b
60
- );
61
- f ? i(f) : s(e);
62
- } else
63
- s(e);
64
- } catch {
65
- s(e);
66
- }
67
- };
68
- export {
69
- o as httpRequest,
70
- H as parseAPIPort
71
- };
1
+ import { SHJDatasourceV2 as w } from "../index.mjs";
2
+ import { httpRequest as c } from "../utils/request.mjs";
3
+ import { DataSourceUtils as i } from "../utils/utils.mjs";
4
+ function T(s) {
5
+ const [p, l = ""] = s.split("?"), e = new URLSearchParams();
6
+ new URLSearchParams(l).forEach((t, d) => {
7
+ t.trim() && e.append(d, t);
8
+ });
9
+ const n = e.toString();
10
+ return n ? `${p}?${n}` : p;
11
+ }
12
+ const G = async (s, p, l) => {
13
+ const e = s?.id, n = s?.source?.api, t = (f) => {
14
+ l(i.noneData(f));
15
+ };
16
+ if (!n || !e)
17
+ return t(e || "");
18
+ const {
19
+ isHeaders: d,
20
+ isBody: U,
21
+ headers: b,
22
+ contentType: m,
23
+ url: E,
24
+ postParam: S,
25
+ type: y,
26
+ isUseEnv: D = !0,
27
+ isGetFilterURL: L = !0
28
+ } = n;
29
+ try {
30
+ const R = i.getEnvironments().envBaseUrl ?? "", g = D ? R : "", v = i.replaceStringVariables(E), o = d ? i.replaceObjectVariables(b) : {}, h = U ? i.replaceObjectVariables(S) : {}, a = g + v;
31
+ if (!a)
32
+ return t(e);
33
+ let r;
34
+ switch (y) {
35
+ case "GET":
36
+ L ? r = c.get(T(a), {
37
+ headers: o
38
+ }) : r = c.get(a, { headers: o });
39
+ break;
40
+ case "POST":
41
+ r = c.post(
42
+ a,
43
+ h,
44
+ { headers: o },
45
+ m
46
+ );
47
+ break;
48
+ case "PUT":
49
+ r = c.put(
50
+ a,
51
+ h,
52
+ { headers: o },
53
+ m
54
+ );
55
+ break;
56
+ case "DELETE":
57
+ r = c.delete(a, {
58
+ headers: o
59
+ });
60
+ break;
61
+ default:
62
+ return t(e);
63
+ }
64
+ const u = await r;
65
+ if (u.status === 200) {
66
+ const P = await w.processData(
67
+ s.source,
68
+ u.data,
69
+ e,
70
+ p
71
+ );
72
+ P ? l(P) : t(e);
73
+ } else
74
+ t(e);
75
+ } catch {
76
+ t(e);
77
+ }
78
+ };
79
+ export {
80
+ c as httpRequest,
81
+ G as parseAPIPort
82
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shjjs/visual-ui",
3
- "version": "3.0.21",
3
+ "version": "3.0.22",
4
4
  "description": "国产自研零代码可视化源码工具",
5
5
  "keywords": [
6
6
  "three",