@das-fed/upf-utils 6.4.0-dev.256 → 6.4.0-dev.257
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 +1385 -1381
- package/api-services/index.js +1071 -1067
- package/api-services/index.js.gz +0 -0
- package/api-services/modules/app-manage/es5.js +1307 -1318
- package/api-services/modules/app-manage/index.js +1069 -1087
- package/api-services/modules/app-manage/index.js.gz +0 -0
- package/api-services/modules/authentication/es5.js +1219 -1218
- package/api-services/modules/authentication/index.js +973 -973
- package/api-services/modules/authentication/index.js.gz +0 -0
- package/api-services/modules/bems/es5.js +748 -754
- package/api-services/modules/bems/index.js +619 -629
- package/api-services/modules/bems/index.js.gz +0 -0
- package/api-services/modules/contract/es5.js +1219 -1218
- package/api-services/modules/contract/index.js +973 -973
- package/api-services/modules/contract/index.js.gz +0 -0
- package/api-services/modules/duty-manage/es5.js +1320 -1307
- package/api-services/modules/duty-manage/index.js +1084 -1066
- package/api-services/modules/duty-manage/index.js.gz +0 -0
- package/api-services/modules/enterpriseright/es5.js +1210 -1209
- package/api-services/modules/enterpriseright/index.js +973 -973
- package/api-services/modules/enterpriseright/index.js.gz +0 -0
- package/api-services/modules/es5.js +1648 -1659
- package/api-services/modules/file/es5.js +1069 -1070
- package/api-services/modules/file/index.js +855 -859
- package/api-services/modules/file/index.js.gz +0 -0
- package/api-services/modules/gateway-edge/es5.js +1297 -1305
- package/api-services/modules/gateway-edge/index.js +1059 -1073
- package/api-services/modules/gateway-edge/index.js.gz +0 -0
- package/api-services/modules/index.js +1315 -1333
- package/api-services/modules/index.js.gz +0 -0
- package/api-services/modules/iot/es5.js +1228 -1227
- package/api-services/modules/iot/index.js +979 -979
- package/api-services/modules/iot/index.js.gz +0 -0
- package/api-services/modules/justauth/es5.js +1309 -1320
- package/api-services/modules/justauth/index.js +1070 -1088
- package/api-services/modules/justauth/index.js.gz +0 -0
- package/api-services/modules/knowledge/es5.js +1319 -1306
- package/api-services/modules/knowledge/index.js +1083 -1065
- package/api-services/modules/knowledge/index.js.gz +0 -0
- package/api-services/modules/link/es5.js +1319 -1306
- package/api-services/modules/link/index.js +1083 -1065
- package/api-services/modules/link/index.js.gz +0 -0
- package/api-services/modules/permission/es5.js +1307 -1318
- package/api-services/modules/permission/index.js +1069 -1087
- package/api-services/modules/permission/index.js.gz +0 -0
- package/api-services/modules/platformManage/es5.js +1230 -1229
- package/api-services/modules/platformManage/index.js +980 -980
- package/api-services/modules/platformManage/index.js.gz +0 -0
- package/api-services/modules/portal/es5.js +1307 -1318
- package/api-services/modules/portal/index.js +1069 -1087
- package/api-services/modules/portal/index.js.gz +0 -0
- package/api-services/modules/space-manage/es5.js +1210 -1209
- package/api-services/modules/space-manage/index.js +973 -973
- package/api-services/modules/space-manage/index.js.gz +0 -0
- package/api-services/modules/super-admin/es5.js +1053 -1055
- package/api-services/modules/super-admin/index.js +859 -863
- package/api-services/modules/super-admin/index.js.gz +0 -0
- package/api-services/modules/supplier/es5.js +1223 -1222
- package/api-services/modules/supplier/index.js +975 -975
- package/api-services/modules/supplier/index.js.gz +0 -0
- package/api-services/modules/supplychain-manage/es5.js +1210 -1209
- package/api-services/modules/supplychain-manage/index.js +973 -973
- package/api-services/modules/supplychain-manage/index.js.gz +0 -0
- package/api-services/modules/systemConfiguration/es5.js +1311 -1298
- package/api-services/modules/systemConfiguration/index.js +1074 -1056
- package/api-services/modules/systemConfiguration/index.js.gz +0 -0
- package/api-services/modules/tool/es5.js +1307 -1318
- package/api-services/modules/tool/index.js +1069 -1087
- package/api-services/modules/tool/index.js.gz +0 -0
- package/api-services/src/create-service/es5.js +1208 -1207
- package/api-services/src/create-service/index.js +972 -972
- package/api-services/src/create-service/index.js.gz +0 -0
- package/common-info/es5.js +1301 -1300
- package/common-info/getPermissionMethod/es5.js +1238 -1240
- package/common-info/getPermissionMethod/index.js +1009 -1013
- package/common-info/getPermissionMethod/index.js.gz +0 -0
- package/common-info/index.js +1051 -1051
- package/common-info/index.js.gz +0 -0
- package/common-tools/timezone-format/es5.d.ts +76 -4
- package/common-tools/timezone-format/es5.js +456 -440
- package/common-tools/timezone-format/index.d.ts +76 -4
- package/common-tools/timezone-format/index.js +322 -322
- package/common-tools/timezone-format/index.js.gz +0 -0
- package/create-api-service/es5.js +1296 -1307
- package/create-api-service/index.js +1058 -1076
- package/create-api-service/index.js.gz +0 -0
- package/esm-map.json +13 -13
- 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
|
Binary file
|
package/esm-map.json
CHANGED
|
@@ -268,17 +268,17 @@
|
|
|
268
268
|
"ensureInjectedIanaTimeZoneData": "/common-tools/timezone-format/index",
|
|
269
269
|
"getBrowserTimeZone": "/common-tools/timezone-format/index",
|
|
270
270
|
"formatLocalDateTimeIntl": "/common-tools/timezone-format/index",
|
|
271
|
-
"assertPackedIanaData": "/common-tools/timezone-format/
|
|
272
|
-
"preloadDayjsIanaFromData": "/common-tools/timezone-format/
|
|
273
|
-
"getCachedDayjsPackedIanaData": "/common-tools/timezone-format/
|
|
274
|
-
"preloadDayjsIanaFromApi": "/common-tools/timezone-format/
|
|
275
|
-
"clearDayjsIanaCache": "/common-tools/timezone-format/
|
|
276
|
-
"createIanaDbFromPackedData": "/common-tools/timezone-format/
|
|
277
|
-
"TIME_ZONE_PACKED_DATA_URL": "/common-tools/timezone-format/
|
|
278
|
-
"getAccessTokenFromLocalStorage": "/common-tools/timezone-format/
|
|
279
|
-
"getDefaultIanaAuthorization": "/common-tools/timezone-format/
|
|
280
|
-
"buildIanaFetchInit": "/common-tools/timezone-format/
|
|
281
|
-
"assertPackedIanaTzData": "/common-tools/timezone-format/
|
|
282
|
-
"loadIanaData": "/common-tools/timezone-format/
|
|
283
|
-
"loadIanaFromApi": "/common-tools/timezone-format/
|
|
271
|
+
"assertPackedIanaData": "/common-tools/timezone-format/index",
|
|
272
|
+
"preloadDayjsIanaFromData": "/common-tools/timezone-format/index",
|
|
273
|
+
"getCachedDayjsPackedIanaData": "/common-tools/timezone-format/index",
|
|
274
|
+
"preloadDayjsIanaFromApi": "/common-tools/timezone-format/index",
|
|
275
|
+
"clearDayjsIanaCache": "/common-tools/timezone-format/index",
|
|
276
|
+
"createIanaDbFromPackedData": "/common-tools/timezone-format/index",
|
|
277
|
+
"TIME_ZONE_PACKED_DATA_URL": "/common-tools/timezone-format/index",
|
|
278
|
+
"getAccessTokenFromLocalStorage": "/common-tools/timezone-format/index",
|
|
279
|
+
"getDefaultIanaAuthorization": "/common-tools/timezone-format/index",
|
|
280
|
+
"buildIanaFetchInit": "/common-tools/timezone-format/index",
|
|
281
|
+
"assertPackedIanaTzData": "/common-tools/timezone-format/index",
|
|
282
|
+
"loadIanaData": "/common-tools/timezone-format/index",
|
|
283
|
+
"loadIanaFromApi": "/common-tools/timezone-format/index"
|
|
284
284
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@das-fed/upf-utils",
|
|
3
|
-
"version": "6.4.0-dev.
|
|
3
|
+
"version": "6.4.0-dev.257",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./index.js",
|
|
@@ -22,8 +22,8 @@
|
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
24
|
"@babel/preset-env": "7.26.0",
|
|
25
|
-
"@das-fed/upf-cli": "6.4.0-dev.
|
|
26
|
-
"@das-fed/upf-web": "6.4.0-dev.
|
|
25
|
+
"@das-fed/upf-cli": "6.4.0-dev.257",
|
|
26
|
+
"@das-fed/upf-web": "6.4.0-dev.257",
|
|
27
27
|
"@rollup/plugin-babel": "6.0.4",
|
|
28
28
|
"@types/js-cookie": "^3.0.6",
|
|
29
29
|
"@types/lodash-es": "^4.17.12",
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
export interface TimeZoneRule {
|
|
2
|
-
u: number[];
|
|
3
|
-
o: number[];
|
|
4
|
-
}
|
|
5
|
-
export interface IanaDb {
|
|
6
|
-
[zone: string]: TimeZoneRule;
|
|
7
|
-
}
|
|
8
|
-
/** `dayjs.extend` 时无需传 IANA 数据;须先 `await plugin.preloadFromApi()`(默认请求内置路径并带 accessToken) */
|
|
9
|
-
export type DayjsTimezoneIanaOption = undefined;
|
|
10
|
-
export interface PackedIanaData {
|
|
11
|
-
version?: string;
|
|
12
|
-
zones: string[];
|
|
13
|
-
links?: string[];
|
|
14
|
-
}
|
|
15
|
-
export type ParsePackedIanaResponse = (json: unknown) => PackedIanaData;
|
|
16
|
-
/** 默认 `fetch` 请求的第二个参数;自定义 `fetchJson` 时也会传入 */
|
|
17
|
-
export type IanaFetchJson = (url: string, init?: RequestInit) => Promise<unknown>;
|
|
18
|
-
export interface PreloadDayjsIanaOptions {
|
|
19
|
-
/** 默认 `/api/admin/basic-application/sys-info/v1/license/time-zone-packed-data`;未传则请求内置地址 */
|
|
20
|
-
url?: string;
|
|
21
|
-
/**
|
|
22
|
-
* 设置 `Authorization`;未传时从 `localStorage.getItem('accessToken')` 生成 `Bearer <token>`。
|
|
23
|
-
* 传 `''` 表示不附加鉴权头。
|
|
24
|
-
*/
|
|
25
|
-
authorization?: string;
|
|
26
|
-
/** 额外请求头;与 `authorization` 合并,同名时以 `authorization` 为准 */
|
|
27
|
-
headers?: Record<string, string>;
|
|
28
|
-
/** 默认使用全局 `fetch`;Node 等环境可传入实现 */
|
|
29
|
-
fetchJson?: IanaFetchJson;
|
|
30
|
-
/** 接口外层包裹时在此解析为 `{ version?, zones, links? }` */
|
|
31
|
-
parseResponse?: ParsePackedIanaResponse;
|
|
32
|
-
}
|
|
33
|
-
type DayjsLike = {
|
|
34
|
-
utc: () => DayjsLike;
|
|
35
|
-
valueOf: () => number;
|
|
36
|
-
utcOffset: (offset: number, keepLocalTime?: boolean) => DayjsLike;
|
|
37
|
-
tz: (zone?: string, keepLocalTime?: boolean) => DayjsLike;
|
|
38
|
-
};
|
|
39
|
-
type DayjsClassLike = {
|
|
40
|
-
prototype: {
|
|
41
|
-
tz?: (zone?: string) => DayjsLike;
|
|
42
|
-
};
|
|
43
|
-
};
|
|
44
|
-
type DayjsFactoryLike = {
|
|
45
|
-
(value?: unknown, format?: string): DayjsLike;
|
|
46
|
-
utc?: (value?: unknown, format?: string) => DayjsLike;
|
|
47
|
-
tz?: DayjsTimezoneFactoryLike;
|
|
48
|
-
};
|
|
49
|
-
type DayjsTimezoneFactoryLike = {
|
|
50
|
-
(value?: unknown, timezoneOrFormat?: string, timezone?: string): DayjsLike;
|
|
51
|
-
setDefault?: (zone: string) => void;
|
|
52
|
-
guess?: () => string;
|
|
53
|
-
};
|
|
54
|
-
type DayjsPlugin = (option: DayjsTimezoneIanaOption | undefined, dayjsClass: DayjsClassLike, dayjsFactory: DayjsFactoryLike) => void;
|
|
55
|
-
export type DayjsTimezoneIanaPlugin = DayjsPlugin & {
|
|
56
|
-
/** 请求接口并解析 packed 数据,写入内部缓存;须在 `dayjs.extend(plugin)` 之前 await 完成 */
|
|
57
|
-
preloadFromApi: (options?: PreloadDayjsIanaOptions) => Promise<PackedIanaData>;
|
|
58
|
-
/** 直接写入已获取的 packed 数据,避免业务层为了复用接口结果再发起请求 */
|
|
59
|
-
preloadFromData: (packedData: PackedIanaData) => PackedIanaData;
|
|
60
|
-
/** 返回最近一次写入的 packed 数据,供公共工具同步已知时区集合 */
|
|
61
|
-
getCachedPackedData: () => PackedIanaData | null;
|
|
62
|
-
/** 清空内部缓存(测试或切换数据源时使用) */
|
|
63
|
-
clearIanaCache: () => void;
|
|
64
|
-
};
|
|
65
|
-
export declare function assertPackedIanaData(json: unknown): PackedIanaData;
|
|
66
|
-
export declare function preloadDayjsIanaFromData(packedData: PackedIanaData): PackedIanaData;
|
|
67
|
-
export declare function getCachedDayjsPackedIanaData(): PackedIanaData | null;
|
|
68
|
-
export declare function preloadDayjsIanaFromApi(options?: PreloadDayjsIanaOptions): Promise<PackedIanaData>;
|
|
69
|
-
export declare function clearDayjsIanaCache(): void;
|
|
70
|
-
export declare function createIanaDbFromPackedData(packedData: PackedIanaData): IanaDb;
|
|
71
|
-
declare const plugin: DayjsTimezoneIanaPlugin;
|
|
72
|
-
export default plugin;
|
|
@@ -1,353 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
function _regenerator() { /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ var e, t, r = "function" == typeof Symbol ? Symbol : {}, n = r.iterator || "@@iterator", o = r.toStringTag || "@@toStringTag"; function i(r, n, o, i) { var c = n && n.prototype instanceof Generator ? n : Generator, u = Object.create(c.prototype); return _regeneratorDefine2(u, "_invoke", function (r, n, o) { var i, c, u, f = 0, p = o || [], y = !1, G = { p: 0, n: 0, v: e, a: d, f: d.bind(e, 4), d: function d(t, r) { return i = t, c = 0, u = e, G.n = r, a; } }; function d(r, n) { for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) { var o, i = p[t], d = G.p, l = i[2]; r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0)); } if (o || r > 1) return a; throw y = !0, n; } return function (o, p, l) { if (f > 1) throw TypeError("Generator is already running"); for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) { i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u); try { if (f = 2, i) { if (c || (o = "next"), t = i[o]) { if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object"); if (!t.done) return t; u = t.value, c < 2 && (c = 0); } else 1 === c && (t = i["return"]) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1); i = e; } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break; } catch (t) { i = e, c = 1, u = t; } finally { f = 1; } } return { value: t, done: y }; }; }(r, o, i), !0), u; } var a = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} t = Object.getPrototypeOf; var c = [][n] ? t(t([][n]())) : (_regeneratorDefine2(t = {}, n, function () { return this; }), t), u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c); function f(e) { return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine2(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine2(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine2(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine2(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine2(u), _regeneratorDefine2(u, o, "Generator"), _regeneratorDefine2(u, n, function () { return this; }), _regeneratorDefine2(u, "toString", function () { return "[object Generator]"; }), (_regenerator = function _regenerator() { return { w: i, m: f }; })(); }
|
|
4
|
-
function _regeneratorDefine2(e, r, n, t) { var i = Object.defineProperty; try { i({}, "", {}); } catch (e) { i = 0; } _regeneratorDefine2 = function _regeneratorDefine(e, r, n, t) { function o(r, n) { _regeneratorDefine2(e, r, function (e) { return this._invoke(r, n, e); }); } r ? i ? i(e, r, { value: n, enumerable: !t, configurable: !t, writable: !t }) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2)); }, _regeneratorDefine2(e, r, n, t); }
|
|
5
|
-
function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
|
|
6
|
-
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
7
|
-
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
8
|
-
function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
|
|
9
|
-
function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
|
|
10
|
-
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
11
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
12
|
-
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
13
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
14
|
-
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
15
|
-
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
16
|
-
require('@das-fed/upf-utils/config/es5');
|
|
17
|
-
var A = "/api/admin/basic-application/sys-info/v1/license/time-zone-packed-data";
|
|
18
|
-
function w() {
|
|
19
|
-
if ((typeof localStorage === "undefined" ? "undefined" : _typeof(localStorage)) > "u") return null;
|
|
20
|
-
try {
|
|
21
|
-
return localStorage.getItem("accessToken");
|
|
22
|
-
} catch (_unused) {
|
|
23
|
-
return null;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
function z() {
|
|
27
|
-
var n = w();
|
|
28
|
-
if (!(n == null || n === "")) return n.trim().startsWith("Bearer ") ? n.trim() : "Bearer ".concat(n.trim());
|
|
29
|
-
}
|
|
30
|
-
function I() {
|
|
31
|
-
var n = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
32
|
-
var t = n.authorization !== undefined ? n.authorization === "" || n.authorization == null ? undefined : n.authorization : z(),
|
|
33
|
-
e = _objectSpread({}, n.headers || {});
|
|
34
|
-
if (t != null && t !== "" && (e.Authorization = t), Object.keys(e).length !== 0) return {
|
|
35
|
-
headers: e
|
|
36
|
-
};
|
|
37
|
-
}
|
|
38
|
-
var u = null;
|
|
39
|
-
var h = ["utc", "uct", "zulu", "universal", "etc/utc", "etc/uct", "etc/zulu", "etc/universal", "gmt", "gmt0", "gmt+0", "gmt-0", "greenwich", "etc/gmt", "etc/gmt0", "etc/gmt+0", "etc/gmt-0", "etc/greenwich"],
|
|
40
|
-
g = {
|
|
41
|
-
u: [1 / 0],
|
|
42
|
-
o: [0]
|
|
43
|
-
};
|
|
44
|
-
function m(n) {
|
|
45
|
-
if (!n || _typeof(n) != "object") throw new Error("Invalid IANA response: expected an object");
|
|
46
|
-
var t = n;
|
|
47
|
-
if (!Array.isArray(t.zones)) throw new Error("Invalid IANA response: missing zones array");
|
|
48
|
-
var e = t.links;
|
|
49
|
-
return {
|
|
50
|
-
version: typeof t.version == "string" ? t.version : undefined,
|
|
51
|
-
zones: t.zones,
|
|
52
|
-
links: Array.isArray(e) ? e : []
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
|
-
function k(_x, _x2) {
|
|
56
|
-
return _k.apply(this, arguments);
|
|
57
|
-
}
|
|
58
|
-
function _k() {
|
|
59
|
-
_k = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(n, t) {
|
|
60
|
-
var e;
|
|
61
|
-
return _regenerator().w(function (_context) {
|
|
62
|
-
while (1) switch (_context.n) {
|
|
63
|
-
case 0:
|
|
64
|
-
if (!(typeof fetch != "function")) {
|
|
65
|
-
_context.n = 1;
|
|
66
|
-
break;
|
|
67
|
-
}
|
|
68
|
-
throw new Error("fetch is not available. Pass preloadFromApi options.fetchJson.");
|
|
69
|
-
case 1:
|
|
70
|
-
_context.n = 2;
|
|
71
|
-
return fetch(n, t);
|
|
72
|
-
case 2:
|
|
73
|
-
e = _context.v;
|
|
74
|
-
if (e.ok) {
|
|
75
|
-
_context.n = 3;
|
|
76
|
-
break;
|
|
77
|
-
}
|
|
78
|
-
throw new Error("IANA request failed: ".concat(e.status, " ").concat(e.statusText));
|
|
79
|
-
case 3:
|
|
80
|
-
return _context.a(2, e.json());
|
|
81
|
-
}
|
|
82
|
-
}, _callee);
|
|
83
|
-
}));
|
|
84
|
-
return _k.apply(this, arguments);
|
|
85
|
-
}
|
|
86
|
-
function E(n) {
|
|
87
|
-
return u = m(n), J(u), u;
|
|
88
|
-
}
|
|
89
|
-
function x() {
|
|
90
|
-
return u;
|
|
91
|
-
}
|
|
92
|
-
function C() {
|
|
93
|
-
return _C.apply(this, arguments);
|
|
94
|
-
}
|
|
95
|
-
function _C() {
|
|
96
|
-
_C = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2() {
|
|
97
|
-
var _n$url, _n$fetchJson;
|
|
98
|
-
var n,
|
|
99
|
-
t,
|
|
100
|
-
e,
|
|
101
|
-
o,
|
|
102
|
-
a,
|
|
103
|
-
_args2 = arguments;
|
|
104
|
-
return _regenerator().w(function (_context2) {
|
|
105
|
-
while (1) switch (_context2.n) {
|
|
106
|
-
case 0:
|
|
107
|
-
n = _args2.length > 0 && _args2[0] !== undefined ? _args2[0] : {};
|
|
108
|
-
t = (_n$url = n.url) !== null && _n$url !== void 0 ? _n$url : A;
|
|
109
|
-
e = I({
|
|
110
|
-
authorization: n.authorization,
|
|
111
|
-
headers: n.headers
|
|
112
|
-
});
|
|
113
|
-
_context2.n = 1;
|
|
114
|
-
return ((_n$fetchJson = n.fetchJson) !== null && _n$fetchJson !== void 0 ? _n$fetchJson : k)(t, e);
|
|
115
|
-
case 1:
|
|
116
|
-
o = _context2.v;
|
|
117
|
-
a = n.parseResponse ? n.parseResponse(o) : m(o);
|
|
118
|
-
return _context2.a(2, E(a));
|
|
119
|
-
}
|
|
120
|
-
}, _callee2);
|
|
121
|
-
}));
|
|
122
|
-
return _C.apply(this, arguments);
|
|
123
|
-
}
|
|
124
|
-
function L() {
|
|
125
|
-
u = null;
|
|
126
|
-
}
|
|
127
|
-
function p(n) {
|
|
128
|
-
return n > 96 ? n - 87 : n > 64 ? n - 29 : n - 48;
|
|
129
|
-
}
|
|
130
|
-
function v(n) {
|
|
131
|
-
var t = 1,
|
|
132
|
-
e = 0,
|
|
133
|
-
r = 0,
|
|
134
|
-
o = 1;
|
|
135
|
-
var a = n.split("."),
|
|
136
|
-
i = a[0],
|
|
137
|
-
c = a[1] || "";
|
|
138
|
-
n.charCodeAt(0) === 45 && (t = -1);
|
|
139
|
-
for (var s = 0; s < i.length; s++) {
|
|
140
|
-
var d = i.charCodeAt(s);
|
|
141
|
-
d !== 45 && (e = 60 * e + p(d));
|
|
142
|
-
}
|
|
143
|
-
for (var _s = 0; _s < c.length; _s++) o = o / 60, r += p(c.charCodeAt(_s)) * o;
|
|
144
|
-
return (e + r) * t;
|
|
145
|
-
}
|
|
146
|
-
function f(n) {
|
|
147
|
-
var t = [];
|
|
148
|
-
var _iterator = _createForOfIteratorHelper(n),
|
|
149
|
-
_step;
|
|
150
|
-
try {
|
|
151
|
-
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
152
|
-
var e = _step.value;
|
|
153
|
-
t.push(v(e));
|
|
154
|
-
}
|
|
155
|
-
} catch (err) {
|
|
156
|
-
_iterator.e(err);
|
|
157
|
-
} finally {
|
|
158
|
-
_iterator.f();
|
|
159
|
-
}
|
|
160
|
-
return t;
|
|
161
|
-
}
|
|
162
|
-
function y(n) {
|
|
163
|
-
var t = n.trim();
|
|
164
|
-
return t ? t.split(" ") : [];
|
|
165
|
-
}
|
|
166
|
-
function T(n) {
|
|
167
|
-
var t = 0;
|
|
168
|
-
var e = [];
|
|
169
|
-
var _iterator2 = _createForOfIteratorHelper(n),
|
|
170
|
-
_step2;
|
|
171
|
-
try {
|
|
172
|
-
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
173
|
-
var r = _step2.value;
|
|
174
|
-
t += r, e.push(Math.round(t * 6e4));
|
|
175
|
-
}
|
|
176
|
-
} catch (err) {
|
|
177
|
-
_iterator2.e(err);
|
|
178
|
-
} finally {
|
|
179
|
-
_iterator2.f();
|
|
180
|
-
}
|
|
181
|
-
return e.push(1 / 0), e;
|
|
182
|
-
}
|
|
183
|
-
function N(n, t) {
|
|
184
|
-
var e = [];
|
|
185
|
-
var _iterator3 = _createForOfIteratorHelper(t),
|
|
186
|
-
_step3;
|
|
187
|
-
try {
|
|
188
|
-
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
|
189
|
-
var r = _step3.value;
|
|
190
|
-
e.push(n[r]);
|
|
191
|
-
}
|
|
192
|
-
} catch (err) {
|
|
193
|
-
_iterator3.e(err);
|
|
194
|
-
} finally {
|
|
195
|
-
_iterator3.f();
|
|
196
|
-
}
|
|
197
|
-
return e;
|
|
198
|
-
}
|
|
199
|
-
function l(n) {
|
|
200
|
-
return typeof n == "string" ? n.trim().toLowerCase() : "";
|
|
201
|
-
}
|
|
202
|
-
function P(n) {
|
|
203
|
-
var t = n.split("|");
|
|
204
|
-
if (t.length < 5) throw new Error("Invalid packed zone format");
|
|
205
|
-
var e = l(t[0]),
|
|
206
|
-
r = f(y(t[2])),
|
|
207
|
-
o = f(t[3].split("")),
|
|
208
|
-
a = T(f(y(t[4]))),
|
|
209
|
-
i = N(r, o);
|
|
210
|
-
return {
|
|
211
|
-
name: e,
|
|
212
|
-
rule: {
|
|
213
|
-
u: a,
|
|
214
|
-
o: i
|
|
215
|
-
}
|
|
216
|
-
};
|
|
217
|
-
}
|
|
218
|
-
function j(n, t, e) {
|
|
219
|
-
var r = l(t),
|
|
220
|
-
o = l(e);
|
|
221
|
-
if (!r || !o) return;
|
|
222
|
-
var a = n[r],
|
|
223
|
-
i = n[o];
|
|
224
|
-
a && !i ? n[o] = a : i && !a && (n[r] = i);
|
|
225
|
-
}
|
|
226
|
-
function F(n) {
|
|
227
|
-
var t = h.map(function (e) {
|
|
228
|
-
return n[e];
|
|
229
|
-
}).find(Boolean) || g;
|
|
230
|
-
h.forEach(function (e) {
|
|
231
|
-
n[e] || (n[e] = t);
|
|
232
|
-
});
|
|
233
|
-
}
|
|
234
|
-
function J(n) {
|
|
235
|
-
if (!n || !Array.isArray(n.zones)) throw new TypeError("packed iana data must contain zones array");
|
|
236
|
-
var t = {};
|
|
237
|
-
var _iterator4 = _createForOfIteratorHelper(n.zones),
|
|
238
|
-
_step4;
|
|
239
|
-
try {
|
|
240
|
-
for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
|
|
241
|
-
var r = _step4.value;
|
|
242
|
-
var o = P(r);
|
|
243
|
-
t[o.name] = o.rule;
|
|
244
|
-
}
|
|
245
|
-
} catch (err) {
|
|
246
|
-
_iterator4.e(err);
|
|
247
|
-
} finally {
|
|
248
|
-
_iterator4.f();
|
|
249
|
-
}
|
|
250
|
-
var e = n.links || [];
|
|
251
|
-
var _iterator5 = _createForOfIteratorHelper(e),
|
|
252
|
-
_step5;
|
|
253
|
-
try {
|
|
254
|
-
for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
|
|
255
|
-
var _r = _step5.value;
|
|
256
|
-
var _o = _r.split("|");
|
|
257
|
-
_o.length < 2 || j(t, _o[0], _o[1]);
|
|
258
|
-
}
|
|
259
|
-
} catch (err) {
|
|
260
|
-
_iterator5.e(err);
|
|
261
|
-
} finally {
|
|
262
|
-
_iterator5.f();
|
|
263
|
-
}
|
|
264
|
-
return F(t), t;
|
|
265
|
-
}
|
|
266
|
-
function R(n) {
|
|
267
|
-
if (!n || _typeof(n) != "object") throw new Error("Invalid IANA response: expected an object");
|
|
268
|
-
var t = n;
|
|
269
|
-
if (!Array.isArray(t.zones)) throw new Error("Invalid IANA response: missing zones array");
|
|
270
|
-
var e = t.links;
|
|
271
|
-
return {
|
|
272
|
-
version: typeof t.version == "string" ? t.version : undefined,
|
|
273
|
-
zones: t.zones,
|
|
274
|
-
links: Array.isArray(e) ? e : []
|
|
275
|
-
};
|
|
276
|
-
}
|
|
277
|
-
function b(n, t) {
|
|
278
|
-
var e = n == null ? undefined : n.tz;
|
|
279
|
-
if (!e || _typeof(e) != "object" && typeof e != "function" || typeof e.load != "function") throw new Error("moment.tz.load is missing. Import moment-timezone before calling loadIanaData.");
|
|
280
|
-
if (!t || !Array.isArray(t.zones)) throw new Error("Invalid packed IANA data: zones must be an array");
|
|
281
|
-
e.load(t);
|
|
282
|
-
}
|
|
283
|
-
function D(_x3, _x4) {
|
|
284
|
-
return _D.apply(this, arguments);
|
|
285
|
-
}
|
|
286
|
-
function _D() {
|
|
287
|
-
_D = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(n, t) {
|
|
288
|
-
var e;
|
|
289
|
-
return _regenerator().w(function (_context3) {
|
|
290
|
-
while (1) switch (_context3.n) {
|
|
291
|
-
case 0:
|
|
292
|
-
if (!(typeof fetch != "function")) {
|
|
293
|
-
_context3.n = 1;
|
|
294
|
-
break;
|
|
295
|
-
}
|
|
296
|
-
throw new Error("fetch is not available. Pass loadIanaFromApi options.fetchJson in Node or polyfill fetch.");
|
|
297
|
-
case 1:
|
|
298
|
-
_context3.n = 2;
|
|
299
|
-
return fetch(n, t);
|
|
300
|
-
case 2:
|
|
301
|
-
e = _context3.v;
|
|
302
|
-
if (e.ok) {
|
|
303
|
-
_context3.n = 3;
|
|
304
|
-
break;
|
|
305
|
-
}
|
|
306
|
-
throw new Error("IANA request failed: ".concat(e.status, " ").concat(e.statusText));
|
|
307
|
-
case 3:
|
|
308
|
-
return _context3.a(2, e.json());
|
|
309
|
-
}
|
|
310
|
-
}, _callee3);
|
|
311
|
-
}));
|
|
312
|
-
return _D.apply(this, arguments);
|
|
313
|
-
}
|
|
314
|
-
function U(_x5, _x6, _x7) {
|
|
315
|
-
return _U.apply(this, arguments);
|
|
316
|
-
}
|
|
317
|
-
function _U() {
|
|
318
|
-
_U = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4(n, t, e) {
|
|
319
|
-
var _o$fetchJson;
|
|
320
|
-
var r, o, a, c, s;
|
|
321
|
-
return _regenerator().w(function (_context4) {
|
|
322
|
-
while (1) switch (_context4.n) {
|
|
323
|
-
case 0:
|
|
324
|
-
r = A, o = {};
|
|
325
|
-
typeof t == "string" ? (r = t, o = e !== null && e !== void 0 ? e : {}) : t != null && (o = t);
|
|
326
|
-
a = I({
|
|
327
|
-
authorization: o.authorization,
|
|
328
|
-
headers: o.headers
|
|
329
|
-
});
|
|
330
|
-
_context4.n = 1;
|
|
331
|
-
return ((_o$fetchJson = o.fetchJson) !== null && _o$fetchJson !== void 0 ? _o$fetchJson : D)(r, a);
|
|
332
|
-
case 1:
|
|
333
|
-
c = _context4.v;
|
|
334
|
-
s = o.parseResponse ? o.parseResponse(c) : R(c);
|
|
335
|
-
return _context4.a(2, (b(n, s), s));
|
|
336
|
-
}
|
|
337
|
-
}, _callee4);
|
|
338
|
-
}));
|
|
339
|
-
return _U.apply(this, arguments);
|
|
340
|
-
}
|
|
341
|
-
exports.TIME_ZONE_PACKED_DATA_URL = A;
|
|
342
|
-
exports.assertPackedIanaData = m;
|
|
343
|
-
exports.assertPackedIanaTzData = R;
|
|
344
|
-
exports.buildIanaFetchInit = I;
|
|
345
|
-
exports.clearDayjsIanaCache = L;
|
|
346
|
-
exports.createIanaDbFromPackedData = J;
|
|
347
|
-
exports.getAccessTokenFromLocalStorage = w;
|
|
348
|
-
exports.getCachedDayjsPackedIanaData = x;
|
|
349
|
-
exports.getDefaultIanaAuthorization = z;
|
|
350
|
-
exports.loadIanaData = b;
|
|
351
|
-
exports.loadIanaFromApi = U;
|
|
352
|
-
exports.preloadDayjsIanaFromApi = C;
|
|
353
|
-
exports.preloadDayjsIanaFromData = E;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 内置 IANA packed 数据接口路径(与网关 / 前端 base 拼接)。
|
|
3
|
-
*/
|
|
4
|
-
export declare const TIME_ZONE_PACKED_DATA_URL: string;
|
|
5
|
-
/**
|
|
6
|
-
* 从浏览器 localStorage 读取 accessToken(非浏览器或无此项时返回 null)。
|
|
7
|
-
*/
|
|
8
|
-
export declare function getAccessTokenFromLocalStorage(): string | null;
|
|
9
|
-
/**
|
|
10
|
-
* 默认 Authorization:`Bearer <accessToken>`;若 token 已含 `Bearer ` 则原样使用。
|
|
11
|
-
*/
|
|
12
|
-
export declare function getDefaultIanaAuthorization(): string | undefined;
|
|
13
|
-
/**
|
|
14
|
-
* 构造 IANA 接口请求的 fetch init(Authorization 与其它头)。
|
|
15
|
-
* - 未传 `authorization` 时,自动使用 `localStorage.getItem('accessToken')` 生成 `Authorization`。
|
|
16
|
-
* - 传入 `authorization: ''` 表示不附加 Authorization(用于测试等场景)。
|
|
17
|
-
*/
|
|
18
|
-
export declare function buildIanaFetchInit(options?: {
|
|
19
|
-
authorization?: string;
|
|
20
|
-
headers?: Record<string, string>;
|
|
21
|
-
}): RequestInit | undefined;
|