@das-fed/upf-utils 6.4.0-dev.256 → 6.4.0-dev.258
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 +2076 -2504
- package/api-services/index.js +1557 -1843
- package/api-services/index.js.gz +0 -0
- package/api-services/modules/app-manage/es5.js +1493 -1931
- package/api-services/modules/app-manage/index.js +1194 -1494
- package/api-services/modules/app-manage/index.js.gz +0 -0
- package/api-services/modules/authentication/es5.js +1358 -1796
- package/api-services/modules/authentication/index.js +1049 -1349
- package/api-services/modules/authentication/index.js.gz +0 -0
- package/api-services/modules/bems/es5.js +1412 -1860
- package/api-services/modules/bems/index.js +1123 -1437
- package/api-services/modules/bems/index.js.gz +0 -0
- package/api-services/modules/contract/es5.js +1558 -1986
- package/api-services/modules/contract/index.js +1257 -1543
- package/api-services/modules/contract/index.js.gz +0 -0
- package/api-services/modules/duty-manage/es5.js +1362 -1800
- package/api-services/modules/duty-manage/index.js +1053 -1353
- package/api-services/modules/duty-manage/index.js.gz +0 -0
- package/api-services/modules/enterpriseright/es5.js +1493 -1931
- package/api-services/modules/enterpriseright/index.js +1194 -1494
- package/api-services/modules/enterpriseright/index.js.gz +0 -0
- package/api-services/modules/es5.js +2189 -2627
- package/api-services/modules/file/es5.js +2136 -2574
- package/api-services/modules/file/index.js +1644 -1944
- package/api-services/modules/file/index.js.gz +0 -0
- package/api-services/modules/gateway-edge/es5.js +1404 -1854
- package/api-services/modules/gateway-edge/index.js +1114 -1432
- package/api-services/modules/gateway-edge/index.js.gz +0 -0
- package/api-services/modules/index.js +1654 -1954
- package/api-services/modules/index.js.gz +0 -0
- package/api-services/modules/iot/es5.js +1558 -1996
- package/api-services/modules/iot/index.js +1244 -1544
- package/api-services/modules/iot/index.js.gz +0 -0
- package/api-services/modules/justauth/es5.js +1495 -1935
- package/api-services/modules/justauth/index.js +1192 -1496
- package/api-services/modules/justauth/index.js.gz +0 -0
- package/api-services/modules/knowledge/es5.js +1560 -1986
- package/api-services/modules/knowledge/index.js +1265 -1547
- package/api-services/modules/knowledge/index.js.gz +0 -0
- package/api-services/modules/link/es5.js +1559 -1985
- package/api-services/modules/link/index.js +1261 -1543
- package/api-services/modules/link/index.js.gz +0 -0
- package/api-services/modules/permission/es5.js +1404 -1854
- package/api-services/modules/permission/index.js +1114 -1432
- package/api-services/modules/permission/index.js.gz +0 -0
- package/api-services/modules/platformManage/es5.js +1614 -2040
- package/api-services/modules/platformManage/index.js +1304 -1586
- package/api-services/modules/platformManage/index.js.gz +0 -0
- package/api-services/modules/portal/es5.js +1405 -1852
- package/api-services/modules/portal/index.js +1117 -1431
- package/api-services/modules/portal/index.js.gz +0 -0
- package/api-services/modules/space-manage/es5.js +1493 -1931
- package/api-services/modules/space-manage/index.js +1194 -1494
- package/api-services/modules/space-manage/index.js.gz +0 -0
- package/api-services/modules/super-admin/es5.js +1360 -1801
- package/api-services/modules/super-admin/index.js +1046 -1350
- package/api-services/modules/super-admin/index.js.gz +0 -0
- package/api-services/modules/supplier/es5.js +1560 -1986
- package/api-services/modules/supplier/index.js +1257 -1539
- package/api-services/modules/supplier/index.js.gz +0 -0
- package/api-services/modules/supplychain-manage/es5.js +1405 -1852
- package/api-services/modules/supplychain-manage/index.js +1117 -1431
- package/api-services/modules/supplychain-manage/index.js.gz +0 -0
- package/api-services/modules/systemConfiguration/es5.js +1555 -1981
- package/api-services/modules/systemConfiguration/index.js +1255 -1537
- package/api-services/modules/systemConfiguration/index.js.gz +0 -0
- package/api-services/modules/tool/es5.js +1493 -1931
- package/api-services/modules/tool/index.js +1194 -1494
- package/api-services/modules/tool/index.js.gz +0 -0
- package/api-services/src/create-service/es5.js +1495 -1933
- package/api-services/src/create-service/index.js +1199 -1499
- package/api-services/src/create-service/index.js.gz +0 -0
- package/common-info/es5.js +1709 -2147
- package/common-info/getPermissionMethod/es5.js +1866 -2295
- package/common-info/getPermissionMethod/index.js +1504 -1790
- package/common-info/getPermissionMethod/index.js.gz +0 -0
- package/common-info/index.js +1294 -1594
- package/common-info/index.js.gz +0 -0
- package/common-tools/es5.d.ts +0 -1
- package/common-tools/es5.js +0 -9
- package/common-tools/index.d.ts +0 -1
- package/common-tools/index.js +0 -1
- package/common-tools/timezone-format/es5.d.ts +76 -4
- package/common-tools/timezone-format/es5.js +453 -439
- package/common-tools/timezone-format/index.d.ts +76 -4
- package/common-tools/timezone-format/index.js +320 -322
- package/common-tools/timezone-format/index.js.gz +0 -0
- package/create-api-service/es5.js +1496 -1936
- package/create-api-service/index.js +1197 -1501
- package/create-api-service/index.js.gz +0 -0
- package/esm-map.json +13 -13
- package/index.d.ts +0 -1
- package/index.js +0 -1
- package/package.json +3 -3
- package/common-tools/timezone-format/get-iana-data/dayjs-timezone-iana-plugin.d.ts +0 -72
- package/common-tools/timezone-format/get-iana-data/es5.d.ts +0 -3
- package/common-tools/timezone-format/get-iana-data/es5.js +0 -353
- package/common-tools/timezone-format/get-iana-data/iana-api-fetch.d.ts +0 -21
- package/common-tools/timezone-format/get-iana-data/index.d.ts +0 -3
- package/common-tools/timezone-format/get-iana-data/index.js +0 -213
- package/common-tools/timezone-format/get-iana-data/index.js.gz +0 -0
- package/common-tools/timezone-format/get-iana-data/moment-iana-loader.d.ts +0 -30
|
@@ -1,213 +0,0 @@
|
|
|
1
|
-
import "@das-fed/upf-utils/config";
|
|
2
|
-
const A = "/api/admin/basic-application/sys-info/v1/license/time-zone-packed-data";
|
|
3
|
-
function w() {
|
|
4
|
-
if (typeof localStorage > "u")
|
|
5
|
-
return null;
|
|
6
|
-
try {
|
|
7
|
-
return localStorage.getItem("accessToken");
|
|
8
|
-
} catch {
|
|
9
|
-
return null;
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
function z() {
|
|
13
|
-
const n = w();
|
|
14
|
-
if (!(n == null || n === ""))
|
|
15
|
-
return n.trim().startsWith("Bearer ") ? n.trim() : `Bearer ${n.trim()}`;
|
|
16
|
-
}
|
|
17
|
-
function I(n = {}) {
|
|
18
|
-
const t = n.authorization !== void 0 ? n.authorization === "" || n.authorization == null ? void 0 : n.authorization : z(), e = { ...n.headers || {} };
|
|
19
|
-
if (t != null && t !== "" && (e.Authorization = t), Object.keys(e).length !== 0)
|
|
20
|
-
return { headers: e };
|
|
21
|
-
}
|
|
22
|
-
let u = null;
|
|
23
|
-
const h = [
|
|
24
|
-
"utc",
|
|
25
|
-
"uct",
|
|
26
|
-
"zulu",
|
|
27
|
-
"universal",
|
|
28
|
-
"etc/utc",
|
|
29
|
-
"etc/uct",
|
|
30
|
-
"etc/zulu",
|
|
31
|
-
"etc/universal",
|
|
32
|
-
"gmt",
|
|
33
|
-
"gmt0",
|
|
34
|
-
"gmt+0",
|
|
35
|
-
"gmt-0",
|
|
36
|
-
"greenwich",
|
|
37
|
-
"etc/gmt",
|
|
38
|
-
"etc/gmt0",
|
|
39
|
-
"etc/gmt+0",
|
|
40
|
-
"etc/gmt-0",
|
|
41
|
-
"etc/greenwich"
|
|
42
|
-
], g = { u: [1 / 0], o: [0] };
|
|
43
|
-
function m(n) {
|
|
44
|
-
if (!n || typeof n != "object")
|
|
45
|
-
throw new Error("Invalid IANA response: expected an object");
|
|
46
|
-
const t = n;
|
|
47
|
-
if (!Array.isArray(t.zones))
|
|
48
|
-
throw new Error("Invalid IANA response: missing zones array");
|
|
49
|
-
const e = t.links;
|
|
50
|
-
return {
|
|
51
|
-
version: typeof t.version == "string" ? t.version : void 0,
|
|
52
|
-
zones: t.zones,
|
|
53
|
-
links: Array.isArray(e) ? e : []
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
|
-
async function k(n, t) {
|
|
57
|
-
if (typeof fetch != "function")
|
|
58
|
-
throw new Error("fetch is not available. Pass preloadFromApi options.fetchJson.");
|
|
59
|
-
const e = await fetch(n, t);
|
|
60
|
-
if (!e.ok)
|
|
61
|
-
throw new Error(`IANA request failed: ${e.status} ${e.statusText}`);
|
|
62
|
-
return e.json();
|
|
63
|
-
}
|
|
64
|
-
function E(n) {
|
|
65
|
-
return u = m(n), J(u), u;
|
|
66
|
-
}
|
|
67
|
-
function x() {
|
|
68
|
-
return u;
|
|
69
|
-
}
|
|
70
|
-
async function C(n = {}) {
|
|
71
|
-
const t = n.url ?? A, e = I({
|
|
72
|
-
authorization: n.authorization,
|
|
73
|
-
headers: n.headers
|
|
74
|
-
}), o = await (n.fetchJson ?? k)(t, e), a = n.parseResponse ? n.parseResponse(o) : m(o);
|
|
75
|
-
return E(a);
|
|
76
|
-
}
|
|
77
|
-
function L() {
|
|
78
|
-
u = null;
|
|
79
|
-
}
|
|
80
|
-
function p(n) {
|
|
81
|
-
return n > 96 ? n - 87 : n > 64 ? n - 29 : n - 48;
|
|
82
|
-
}
|
|
83
|
-
function v(n) {
|
|
84
|
-
let t = 1, e = 0, r = 0, o = 1;
|
|
85
|
-
const a = n.split("."), i = a[0], c = a[1] || "";
|
|
86
|
-
n.charCodeAt(0) === 45 && (t = -1);
|
|
87
|
-
for (let s = 0; s < i.length; s++) {
|
|
88
|
-
const d = i.charCodeAt(s);
|
|
89
|
-
d !== 45 && (e = 60 * e + p(d));
|
|
90
|
-
}
|
|
91
|
-
for (let s = 0; s < c.length; s++)
|
|
92
|
-
o = o / 60, r += p(c.charCodeAt(s)) * o;
|
|
93
|
-
return (e + r) * t;
|
|
94
|
-
}
|
|
95
|
-
function f(n) {
|
|
96
|
-
const t = [];
|
|
97
|
-
for (const e of n)
|
|
98
|
-
t.push(v(e));
|
|
99
|
-
return t;
|
|
100
|
-
}
|
|
101
|
-
function y(n) {
|
|
102
|
-
const t = n.trim();
|
|
103
|
-
return t ? t.split(" ") : [];
|
|
104
|
-
}
|
|
105
|
-
function T(n) {
|
|
106
|
-
let t = 0;
|
|
107
|
-
const e = [];
|
|
108
|
-
for (const r of n)
|
|
109
|
-
t += r, e.push(Math.round(t * 6e4));
|
|
110
|
-
return e.push(1 / 0), e;
|
|
111
|
-
}
|
|
112
|
-
function N(n, t) {
|
|
113
|
-
const e = [];
|
|
114
|
-
for (const r of t)
|
|
115
|
-
e.push(n[r]);
|
|
116
|
-
return e;
|
|
117
|
-
}
|
|
118
|
-
function l(n) {
|
|
119
|
-
return typeof n == "string" ? n.trim().toLowerCase() : "";
|
|
120
|
-
}
|
|
121
|
-
function P(n) {
|
|
122
|
-
const t = n.split("|");
|
|
123
|
-
if (t.length < 5)
|
|
124
|
-
throw new Error("Invalid packed zone format");
|
|
125
|
-
const e = l(t[0]), r = f(y(t[2])), o = f(t[3].split("")), a = T(f(y(t[4]))), i = N(r, o);
|
|
126
|
-
return {
|
|
127
|
-
name: e,
|
|
128
|
-
rule: {
|
|
129
|
-
u: a,
|
|
130
|
-
o: i
|
|
131
|
-
}
|
|
132
|
-
};
|
|
133
|
-
}
|
|
134
|
-
function j(n, t, e) {
|
|
135
|
-
const r = l(t), o = l(e);
|
|
136
|
-
if (!r || !o) return;
|
|
137
|
-
const a = n[r], i = n[o];
|
|
138
|
-
a && !i ? n[o] = a : i && !a && (n[r] = i);
|
|
139
|
-
}
|
|
140
|
-
function F(n) {
|
|
141
|
-
const t = h.map((e) => n[e]).find(Boolean) || g;
|
|
142
|
-
h.forEach((e) => {
|
|
143
|
-
n[e] || (n[e] = t);
|
|
144
|
-
});
|
|
145
|
-
}
|
|
146
|
-
function J(n) {
|
|
147
|
-
if (!n || !Array.isArray(n.zones))
|
|
148
|
-
throw new TypeError("packed iana data must contain zones array");
|
|
149
|
-
const t = {};
|
|
150
|
-
for (const r of n.zones) {
|
|
151
|
-
const o = P(r);
|
|
152
|
-
t[o.name] = o.rule;
|
|
153
|
-
}
|
|
154
|
-
const e = n.links || [];
|
|
155
|
-
for (const r of e) {
|
|
156
|
-
const o = r.split("|");
|
|
157
|
-
o.length < 2 || j(t, o[0], o[1]);
|
|
158
|
-
}
|
|
159
|
-
return F(t), t;
|
|
160
|
-
}
|
|
161
|
-
function R(n) {
|
|
162
|
-
if (!n || typeof n != "object")
|
|
163
|
-
throw new Error("Invalid IANA response: expected an object");
|
|
164
|
-
const t = n;
|
|
165
|
-
if (!Array.isArray(t.zones))
|
|
166
|
-
throw new Error("Invalid IANA response: missing zones array");
|
|
167
|
-
const e = t.links;
|
|
168
|
-
return {
|
|
169
|
-
version: typeof t.version == "string" ? t.version : void 0,
|
|
170
|
-
zones: t.zones,
|
|
171
|
-
links: Array.isArray(e) ? e : []
|
|
172
|
-
};
|
|
173
|
-
}
|
|
174
|
-
function b(n, t) {
|
|
175
|
-
const e = n == null ? void 0 : n.tz;
|
|
176
|
-
if (!e || typeof e != "object" && typeof e != "function" || typeof e.load != "function")
|
|
177
|
-
throw new Error("moment.tz.load is missing. Import moment-timezone before calling loadIanaData.");
|
|
178
|
-
if (!t || !Array.isArray(t.zones))
|
|
179
|
-
throw new Error("Invalid packed IANA data: zones must be an array");
|
|
180
|
-
e.load(t);
|
|
181
|
-
}
|
|
182
|
-
async function D(n, t) {
|
|
183
|
-
if (typeof fetch != "function")
|
|
184
|
-
throw new Error("fetch is not available. Pass loadIanaFromApi options.fetchJson in Node or polyfill fetch.");
|
|
185
|
-
const e = await fetch(n, t);
|
|
186
|
-
if (!e.ok)
|
|
187
|
-
throw new Error(`IANA request failed: ${e.status} ${e.statusText}`);
|
|
188
|
-
return e.json();
|
|
189
|
-
}
|
|
190
|
-
async function U(n, t, e) {
|
|
191
|
-
let r = A, o = {};
|
|
192
|
-
typeof t == "string" ? (r = t, o = e ?? {}) : t != null && (o = t);
|
|
193
|
-
const a = I({
|
|
194
|
-
authorization: o.authorization,
|
|
195
|
-
headers: o.headers
|
|
196
|
-
}), c = await (o.fetchJson ?? D)(r, a), s = o.parseResponse ? o.parseResponse(c) : R(c);
|
|
197
|
-
return b(n, s), s;
|
|
198
|
-
}
|
|
199
|
-
export {
|
|
200
|
-
A as TIME_ZONE_PACKED_DATA_URL,
|
|
201
|
-
m as assertPackedIanaData,
|
|
202
|
-
R as assertPackedIanaTzData,
|
|
203
|
-
I as buildIanaFetchInit,
|
|
204
|
-
L as clearDayjsIanaCache,
|
|
205
|
-
J as createIanaDbFromPackedData,
|
|
206
|
-
w as getAccessTokenFromLocalStorage,
|
|
207
|
-
x as getCachedDayjsPackedIanaData,
|
|
208
|
-
z as getDefaultIanaAuthorization,
|
|
209
|
-
b as loadIanaData,
|
|
210
|
-
U as loadIanaFromApi,
|
|
211
|
-
C as preloadDayjsIanaFromApi,
|
|
212
|
-
E as preloadDayjsIanaFromData
|
|
213
|
-
};
|
|
Binary file
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 将接口返回的 packed IANA 数据(与 moment-timezone 数据格式一致)注册到当前 moment 实例上。
|
|
3
|
-
* 业务侧须先:`import moment from 'moment'; import 'moment-timezone';`,再传入同一个 `moment`。
|
|
4
|
-
*/
|
|
5
|
-
export interface PackedIanaTzData {
|
|
6
|
-
version?: string;
|
|
7
|
-
zones: string[];
|
|
8
|
-
links?: string[];
|
|
9
|
-
}
|
|
10
|
-
export type MomentTimezoneApi = {
|
|
11
|
-
load: (data: PackedIanaTzData) => void;
|
|
12
|
-
};
|
|
13
|
-
export interface MomentWithTimezone {
|
|
14
|
-
tz: MomentTimezoneApi | (((...args: any[]) => unknown) & MomentTimezoneApi);
|
|
15
|
-
}
|
|
16
|
-
export declare function assertPackedIanaTzData(json: unknown): PackedIanaTzData;
|
|
17
|
-
export declare function loadIanaData(moment: MomentWithTimezone, data: PackedIanaTzData): void;
|
|
18
|
-
export type ParseIanaResponse = (json: unknown) => PackedIanaTzData;
|
|
19
|
-
export type IanaMomentFetchJson = (url: string, init?: RequestInit) => Promise<unknown>;
|
|
20
|
-
export interface LoadIanaFromApiOptions {
|
|
21
|
-
/** 设置请求头 `Authorization`(完整值,如 `Bearer <token>`) */
|
|
22
|
-
authorization?: string;
|
|
23
|
-
/** 额外请求头;与 `authorization` 合并,同名时以 `authorization` 为准 */
|
|
24
|
-
headers?: Record<string, string>;
|
|
25
|
-
/** 自定义请求,默认使用全局 fetch */
|
|
26
|
-
fetchJson?: IanaMomentFetchJson;
|
|
27
|
-
/** 当接口外层有包裹时,在此取出 { version, zones, links } */
|
|
28
|
-
parseResponse?: ParseIanaResponse;
|
|
29
|
-
}
|
|
30
|
-
export declare function loadIanaFromApi(moment: MomentWithTimezone, urlOrOptions?: string | LoadIanaFromApiOptions, maybeOptions?: LoadIanaFromApiOptions): Promise<PackedIanaTzData>;
|