@das-fed/upf-utils 6.4.0-dev.209 → 6.4.0-dev.210
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/api-services/es5.js +1438 -1450
- package/api-services/index.js +1172 -1185
- package/api-services/index.js.gz +0 -0
- package/api-services/modules/app-manage/es5.js +940 -931
- package/api-services/modules/app-manage/index.js +769 -750
- package/api-services/modules/app-manage/index.js.gz +0 -0
- package/api-services/modules/authentication/es5.js +2 -2
- package/api-services/modules/authentication/index.js +7 -2
- package/api-services/modules/authentication/index.js.gz +0 -0
- package/api-services/modules/bems/es5.js +2 -2
- package/api-services/modules/bems/index.js +7 -2
- package/api-services/modules/bems/index.js.gz +0 -0
- package/api-services/modules/contract/es5.js +955 -967
- package/api-services/modules/contract/index.js +775 -788
- package/api-services/modules/contract/index.js.gz +0 -0
- package/api-services/modules/duty-manage/es5.js +824 -827
- package/api-services/modules/duty-manage/index.js +641 -640
- package/api-services/modules/duty-manage/index.js.gz +0 -0
- package/api-services/modules/enterpriseright/es5.js +2 -2
- package/api-services/modules/enterpriseright/index.js +7 -2
- package/api-services/modules/enterpriseright/index.js.gz +0 -0
- package/api-services/modules/es5.js +2 -2
- package/api-services/modules/file/es5.js +2 -2
- package/api-services/modules/file/index.js +7 -2
- package/api-services/modules/file/index.js.gz +0 -0
- package/api-services/modules/gateway-edge/es5.js +967 -955
- package/api-services/modules/gateway-edge/index.js +793 -770
- package/api-services/modules/gateway-edge/index.js.gz +0 -0
- package/api-services/modules/index.js +7 -2
- package/api-services/modules/index.js.gz +0 -0
- package/api-services/modules/iot/es5.js +960 -972
- package/api-services/modules/iot/index.js +775 -788
- package/api-services/modules/iot/index.js.gz +0 -0
- package/api-services/modules/justauth/es5.js +801 -803
- package/api-services/modules/justauth/index.js +625 -624
- package/api-services/modules/justauth/index.js.gz +0 -0
- package/api-services/modules/knowledge/es5.js +2 -2
- package/api-services/modules/knowledge/index.js +7 -2
- package/api-services/modules/knowledge/index.js.gz +0 -0
- package/api-services/modules/link/es5.js +931 -940
- package/api-services/modules/link/index.js +755 -764
- package/api-services/modules/link/index.js.gz +0 -0
- package/api-services/modules/permission/es5.js +2 -2
- package/api-services/modules/permission/index.js +7 -2
- package/api-services/modules/permission/index.js.gz +0 -0
- package/api-services/modules/platformManage/es5.js +953 -941
- package/api-services/modules/platformManage/index.js +777 -754
- package/api-services/modules/platformManage/index.js.gz +0 -0
- package/api-services/modules/portal/es5.js +967 -955
- package/api-services/modules/portal/index.js +793 -770
- package/api-services/modules/portal/index.js.gz +0 -0
- package/api-services/modules/space-manage/es5.js +2 -2
- package/api-services/modules/space-manage/index.js +7 -2
- package/api-services/modules/space-manage/index.js.gz +0 -0
- package/api-services/modules/super-admin/es5.js +970 -982
- package/api-services/modules/super-admin/index.js +787 -800
- package/api-services/modules/super-admin/index.js.gz +0 -0
- package/api-services/modules/supplier/es5.js +552 -552
- package/api-services/modules/supplier/index.js +501 -496
- package/api-services/modules/supplier/index.js.gz +0 -0
- package/api-services/modules/supplychain-manage/es5.js +955 -967
- package/api-services/modules/supplychain-manage/index.js +775 -788
- package/api-services/modules/supplychain-manage/index.js.gz +0 -0
- package/api-services/modules/systemConfiguration/es5.js +2 -2
- package/api-services/modules/systemConfiguration/index.js +7 -2
- package/api-services/modules/systemConfiguration/index.js.gz +0 -0
- package/api-services/modules/tool/es5.js +2 -2
- package/api-services/modules/tool/index.js +7 -2
- package/api-services/modules/tool/index.js.gz +0 -0
- package/api-services/src/create-service/es5.js +929 -938
- package/api-services/src/create-service/index.js +754 -763
- package/api-services/src/create-service/index.js.gz +0 -0
- package/common-info/es5.js +24 -22
- package/common-info/getInfoFromUrl/es5.js +40 -40
- package/common-info/getInfoFromUrl/index.js +36 -36
- package/common-info/getInfoFromUrl/index.js.gz +0 -0
- package/common-info/index.js +21 -17
- package/common-info/index.js.gz +0 -0
- package/common-info/set-personal-info/es5.js +22 -22
- package/common-info/set-personal-info/index.js +25 -20
- package/common-info/set-personal-info/index.js.gz +0 -0
- package/common-tools/extract-file-name/es5.js +2 -2
- package/common-tools/extract-file-name/index.js +7 -2
- package/common-tools/extract-file-name/index.js.gz +0 -0
- package/common-tools/handle-data/es5.js +118 -111
- package/common-tools/handle-data/index.js +89 -86
- package/common-tools/handle-data/index.js.gz +0 -0
- package/create-api-service/check-token/es5.js +127 -125
- package/create-api-service/check-token/index.js +123 -118
- package/create-api-service/check-token/index.js.gz +0 -0
- package/create-api-service/es5.js +953 -965
- package/create-api-service/index.js +774 -787
- package/create-api-service/index.js.gz +0 -0
- package/create-api-service/sso/es5.js +3 -3
- package/create-api-service/sso/index.js +8 -3
- package/create-api-service/sso/index.js.gz +0 -0
- package/curring-http/es5.js +2 -2
- package/curring-http/index.js +7 -2
- package/curring-http/index.js.gz +0 -0
- package/package.json +4 -4
- package/pinyin-first-character/es5.js +1 -1
- package/pinyin-first-character/index.js +1 -1
- package/pinyin-first-character/index.js.gz +0 -0
- package/webSocket-service/es5.js +53 -41
- package/webSocket-service/index.js +50 -40
- package/webSocket-service/index.js.gz +0 -0
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import { getConfig as
|
|
2
|
-
const
|
|
3
|
-
var
|
|
4
|
-
return (((
|
|
5
|
-
},
|
|
6
|
-
const
|
|
1
|
+
import { getConfig as F } from "@das-fed/upf-utils/config";
|
|
2
|
+
const _ = (u) => u === null || typeof u > "u" || u === "", S = (u) => {
|
|
3
|
+
var r;
|
|
4
|
+
return (((r = F()) == null ? void 0 : r.systemLangList) || ["zh-CN", "en-US", "zh-MO"]).includes(u);
|
|
5
|
+
}, z = async (u) => {
|
|
6
|
+
const k = u || {};
|
|
7
7
|
let {
|
|
8
|
-
currentLang:
|
|
9
|
-
baseUrl:
|
|
10
|
-
appName:
|
|
8
|
+
currentLang: r = "zh-CN",
|
|
9
|
+
baseUrl: l = "/",
|
|
10
|
+
appName: g = "jc",
|
|
11
11
|
isPullFrontEnd: L = !0,
|
|
12
12
|
isPullBack: N = !1,
|
|
13
|
-
isDasUI:
|
|
14
|
-
fallbackBaseUrl:
|
|
15
|
-
} =
|
|
16
|
-
(typeof
|
|
17
|
-
let
|
|
18
|
-
Array.isArray(
|
|
19
|
-
const
|
|
13
|
+
isDasUI: D = !1,
|
|
14
|
+
fallbackBaseUrl: c = ""
|
|
15
|
+
} = k;
|
|
16
|
+
(typeof r != "string" || !r) && (r = "zh-CN");
|
|
17
|
+
let d = [];
|
|
18
|
+
Array.isArray(g) ? (d = g.filter((a) => typeof a == "string" && a), d.length === 0 && (d = ["jc"])) : typeof g == "string" && g ? d = [g] : d = ["jc"], typeof l != "string" && (l = "/"), l || (l = "/"), l.endsWith("/") || (l = l + "/"), typeof c != "string" && (c = ""), c && !c.endsWith("/") && (c = c + "/");
|
|
19
|
+
const w = {
|
|
20
20
|
frontEnd: null,
|
|
21
21
|
// 统一格式:{ appName1: data1, appName2: data2, ... }
|
|
22
22
|
dasUiEnd: null,
|
|
@@ -24,113 +24,116 @@ const M = (f) => f === null || typeof f > "u" || f === "", z = (f) => {
|
|
|
24
24
|
// 统一格式:{ appName1: data1, appName2: data2, ... }
|
|
25
25
|
};
|
|
26
26
|
let m = !1;
|
|
27
|
-
const
|
|
28
|
-
const
|
|
27
|
+
const E = async (a, o, h = "zh-CN", i = "资源") => {
|
|
28
|
+
const p = async (s) => {
|
|
29
29
|
try {
|
|
30
30
|
if (typeof window < "u" && typeof window.fetch == "function") {
|
|
31
|
-
const
|
|
32
|
-
return !
|
|
31
|
+
const n = await window.fetch(s, { cache: "no-cache" });
|
|
32
|
+
return !n || !n.ok ? (console.warn(`[fetchText] ${i} HTTP 错误:`, n == null ? void 0 : n.status, n == null ? void 0 : n.statusText), null) : await n.text();
|
|
33
33
|
} else
|
|
34
|
-
return await new Promise((
|
|
34
|
+
return await new Promise((n) => {
|
|
35
35
|
try {
|
|
36
36
|
const t = new XMLHttpRequest();
|
|
37
|
-
t.open("GET",
|
|
38
|
-
t.readyState === 4 &&
|
|
37
|
+
t.open("GET", s, !0), t.onreadystatechange = function() {
|
|
38
|
+
t.readyState === 4 && n(t.status >= 200 && t.status < 300 ? t.responseText : null);
|
|
39
39
|
}, t.onerror = function() {
|
|
40
|
-
|
|
40
|
+
n(null);
|
|
41
41
|
}, t.send();
|
|
42
42
|
} catch {
|
|
43
|
-
|
|
43
|
+
n(null);
|
|
44
44
|
}
|
|
45
45
|
});
|
|
46
46
|
} catch {
|
|
47
47
|
return null;
|
|
48
48
|
}
|
|
49
|
-
},
|
|
50
|
-
if (!
|
|
51
|
-
return null;
|
|
52
|
-
const t =
|
|
49
|
+
}, O = (s) => {
|
|
50
|
+
if (!s || typeof s != "string")
|
|
51
|
+
return console.warn("[parseEsmDefault] 输入无效:", typeof s), null;
|
|
52
|
+
const t = s.replace(/^\uFEFF/, "").trim();
|
|
53
53
|
if (t.startsWith("{"))
|
|
54
54
|
try {
|
|
55
55
|
const e = JSON.parse(t);
|
|
56
56
|
if (e && typeof e == "object")
|
|
57
57
|
return e;
|
|
58
|
-
} catch {
|
|
58
|
+
} catch (e) {
|
|
59
|
+
console.warn("[parseEsmDefault] 纯 JSON 解析失败:", e);
|
|
59
60
|
}
|
|
60
|
-
const
|
|
61
|
-
if (!
|
|
62
|
-
return null;
|
|
61
|
+
const j = t.match(/export\s+default\s*/);
|
|
62
|
+
if (!j || j.index === void 0)
|
|
63
|
+
return console.warn("[parseEsmDefault] 未找到 export default,且非纯 JSON 格式"), null;
|
|
63
64
|
try {
|
|
64
|
-
let e = t.substring(
|
|
65
|
+
let e = t.substring(j.index);
|
|
65
66
|
if (e = e.replace(/\/\*[\s\S]*?\*\//g, "").replace(/(^|\n)\s*\/\/.*(?=\n|$)/g, "$1").trim(), e = e.replace(/^\s*export\s+default\s*/, "").replace(/;?\s*$/, "").trim(), !e)
|
|
66
|
-
return null;
|
|
67
|
+
return console.warn("[parseEsmDefault] 清理后内容为空"), null;
|
|
67
68
|
try {
|
|
68
|
-
const
|
|
69
|
-
if (
|
|
70
|
-
return
|
|
71
|
-
} catch {
|
|
69
|
+
const y = new Function(`return ${e}`)();
|
|
70
|
+
if (y && typeof y == "object")
|
|
71
|
+
return y;
|
|
72
|
+
} catch (f) {
|
|
73
|
+
console.warn("[parseEsmDefault] Function 构造器失败:", f);
|
|
72
74
|
}
|
|
73
75
|
try {
|
|
74
|
-
const
|
|
75
|
-
if (
|
|
76
|
-
return null;
|
|
77
|
-
let
|
|
78
|
-
|
|
79
|
-
const
|
|
80
|
-
if (
|
|
81
|
-
return
|
|
82
|
-
} catch {
|
|
76
|
+
const f = e.indexOf("{"), y = e.lastIndexOf("}");
|
|
77
|
+
if (f === -1 || y === -1 || y <= f)
|
|
78
|
+
return console.warn("[parseEsmDefault] JSON 解析:未找到对象结构"), null;
|
|
79
|
+
let $ = e.slice(f, y + 1);
|
|
80
|
+
$ = $.replace(/([{,]\s*)([a-zA-Z_$][a-zA-Z0-9_$]*)\s*:/g, '$1"$2":'), $ = $.replace(/'([^'\\]*(\\.[^'\\]*)*)'/g, '"$1"'), $ = $.replace(/,\s*([}\]])/g, "$1");
|
|
81
|
+
const x = JSON.parse($);
|
|
82
|
+
if (x && typeof x == "object")
|
|
83
|
+
return x;
|
|
84
|
+
} catch (f) {
|
|
85
|
+
console.warn("[parseEsmDefault] JSON 解析失败:", f);
|
|
83
86
|
}
|
|
84
87
|
return null;
|
|
85
|
-
} catch {
|
|
86
|
-
return null;
|
|
88
|
+
} catch (e) {
|
|
89
|
+
return console.error("[parseEsmDefault] 异常:", e), null;
|
|
87
90
|
}
|
|
88
|
-
},
|
|
89
|
-
if (!
|
|
90
|
-
const
|
|
91
|
-
if (!
|
|
92
|
-
return null;
|
|
93
|
-
const t =
|
|
94
|
-
return t !== null && typeof t == "object" ? t : null;
|
|
95
|
-
},
|
|
96
|
-
if (
|
|
97
|
-
return
|
|
98
|
-
if (
|
|
99
|
-
const
|
|
100
|
-
if (
|
|
101
|
-
return i;
|
|
91
|
+
}, b = async (s) => {
|
|
92
|
+
if (!s) return null;
|
|
93
|
+
const n = await p(s);
|
|
94
|
+
if (!n)
|
|
95
|
+
return console.warn(`[tryLoad] ${i} HTTP 请求失败:`, s), null;
|
|
96
|
+
const t = O(n);
|
|
97
|
+
return t !== null && typeof t == "object" ? t : (console.warn(`[tryLoad] ${i} 解析失败:`, s), null);
|
|
98
|
+
}, U = await b(a);
|
|
99
|
+
if (U)
|
|
100
|
+
return U;
|
|
101
|
+
if (console.warn(`[loadWithFallback] ${i} - 主地址失败,尝试回退地址`), o && S(h)) {
|
|
102
|
+
const s = await b(o);
|
|
103
|
+
if (s)
|
|
104
|
+
return console.warn(`[loadWithFallback] ${i} - 回退地址成功`), s;
|
|
102
105
|
}
|
|
103
|
-
return null;
|
|
106
|
+
return console.error(`[loadWithFallback] ${i} - 所有地址都失败`), null;
|
|
104
107
|
};
|
|
105
108
|
if (L) {
|
|
106
|
-
const
|
|
107
|
-
for (const
|
|
108
|
-
const
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
`前端业务语言资源(${
|
|
109
|
+
const a = {};
|
|
110
|
+
for (const o of d) {
|
|
111
|
+
const h = `${l}front-end/i18n/front-end-page/${o}_${r}.js`, i = c ? `${c}front-end/i18n/front-end-page/${o}_${r}.js` : void 0, p = await E(
|
|
112
|
+
h,
|
|
113
|
+
i,
|
|
114
|
+
r,
|
|
115
|
+
`前端业务语言资源(${o})`
|
|
113
116
|
);
|
|
114
|
-
|
|
117
|
+
p && (a[o] = p, m = !0);
|
|
115
118
|
}
|
|
116
|
-
Object.keys(
|
|
119
|
+
Object.keys(a).length > 0 && (w.frontEnd = a);
|
|
117
120
|
}
|
|
118
121
|
if (N) {
|
|
119
|
-
const
|
|
120
|
-
for (const
|
|
121
|
-
const
|
|
122
|
-
|
|
122
|
+
const a = {};
|
|
123
|
+
for (const o of d) {
|
|
124
|
+
const h = `${l}front-end/i18n/return-msg/${o}_${r}.js`, i = c ? `${c}front-end/i18n/return-msg/${o}_${r}.js` : void 0, p = await E(h, i, r, `后端语言资源(${o})`);
|
|
125
|
+
p && (a[o] = p, m = !0);
|
|
123
126
|
}
|
|
124
|
-
Object.keys(
|
|
127
|
+
Object.keys(a).length > 0 && (w.backMsg = a);
|
|
125
128
|
}
|
|
126
|
-
if (
|
|
127
|
-
const
|
|
128
|
-
|
|
129
|
+
if (D) {
|
|
130
|
+
const a = `${l}front-end/i18n/front-end-page/dasui_${r}.js`, o = c ? `${c}front-end/i18n/front-end-page/dasui_${r}.js` : void 0;
|
|
131
|
+
w.dasUiEnd = await E(a, o, r, "UI组件库语言资源"), w.dasUiEnd && (m = !0);
|
|
129
132
|
}
|
|
130
|
-
return
|
|
133
|
+
return m || console.warn("语言包加载失败"), w;
|
|
131
134
|
};
|
|
132
135
|
export {
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
+
z as handleI18nData,
|
|
137
|
+
S as isCurrentLangInSysLang,
|
|
138
|
+
_ as isEmpty
|
|
136
139
|
};
|
|
Binary file
|