@das-fed/upf-utils 6.4.0-dev.261 → 6.4.0-dev.262

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.
Files changed (105) hide show
  1. package/api-services/es5.js +2181 -1743
  2. package/api-services/index.js +1526 -1226
  3. package/api-services/index.js.gz +0 -0
  4. package/api-services/modules/app-manage/es5.js +1933 -1493
  5. package/api-services/modules/app-manage/index.js +1495 -1191
  6. package/api-services/modules/app-manage/index.js.gz +0 -0
  7. package/api-services/modules/authentication/es5.js +1795 -1360
  8. package/api-services/modules/authentication/index.js +1349 -1053
  9. package/api-services/modules/authentication/index.js.gz +0 -0
  10. package/api-services/modules/bems/es5.js +1935 -1497
  11. package/api-services/modules/bems/index.js +1497 -1197
  12. package/api-services/modules/bems/index.js.gz +0 -0
  13. package/api-services/modules/contract/es5.js +1931 -1493
  14. package/api-services/modules/contract/index.js +1494 -1194
  15. package/api-services/modules/contract/index.js.gz +0 -0
  16. package/api-services/modules/duty-manage/es5.js +1990 -1564
  17. package/api-services/modules/duty-manage/index.js +1547 -1265
  18. package/api-services/modules/duty-manage/index.js.gz +0 -0
  19. package/api-services/modules/enterpriseright/es5.js +1985 -1559
  20. package/api-services/modules/enterpriseright/index.js +1543 -1261
  21. package/api-services/modules/enterpriseright/index.js.gz +0 -0
  22. package/api-services/modules/es5.js +2627 -2189
  23. package/api-services/modules/file/es5.js +2562 -2112
  24. package/api-services/modules/file/index.js +1938 -1620
  25. package/api-services/modules/file/index.js.gz +0 -0
  26. package/api-services/modules/gateway-edge/es5.js +1796 -1358
  27. package/api-services/modules/gateway-edge/index.js +1349 -1049
  28. package/api-services/modules/gateway-edge/index.js.gz +0 -0
  29. package/api-services/modules/index.js +1954 -1654
  30. package/api-services/modules/index.js.gz +0 -0
  31. package/api-services/modules/iot/es5.js +2024 -1574
  32. package/api-services/modules/iot/index.js +1576 -1258
  33. package/api-services/modules/iot/index.js.gz +0 -0
  34. package/api-services/modules/justauth/es5.js +1987 -1561
  35. package/api-services/modules/justauth/index.js +1544 -1262
  36. package/api-services/modules/justauth/index.js.gz +0 -0
  37. package/api-services/modules/knowledge/es5.js +1984 -1555
  38. package/api-services/modules/knowledge/index.js +1544 -1258
  39. package/api-services/modules/knowledge/index.js.gz +0 -0
  40. package/api-services/modules/link/es5.js +1985 -1559
  41. package/api-services/modules/link/index.js +1543 -1261
  42. package/api-services/modules/link/index.js.gz +0 -0
  43. package/api-services/modules/permission/es5.js +1933 -1493
  44. package/api-services/modules/permission/index.js +1495 -1191
  45. package/api-services/modules/permission/index.js.gz +0 -0
  46. package/api-services/modules/platformManage/es5.js +2039 -1611
  47. package/api-services/modules/platformManage/index.js +1586 -1300
  48. package/api-services/modules/platformManage/index.js.gz +0 -0
  49. package/api-services/modules/portal/es5.js +1795 -1360
  50. package/api-services/modules/portal/index.js +1349 -1053
  51. package/api-services/modules/portal/index.js.gz +0 -0
  52. package/api-services/modules/space-manage/es5.js +1985 -1559
  53. package/api-services/modules/space-manage/index.js +1543 -1261
  54. package/api-services/modules/space-manage/index.js.gz +0 -0
  55. package/api-services/modules/super-admin/es5.js +1992 -1566
  56. package/api-services/modules/super-admin/index.js +1546 -1264
  57. package/api-services/modules/super-admin/index.js.gz +0 -0
  58. package/api-services/modules/supplier/es5.js +1986 -1560
  59. package/api-services/modules/supplier/index.js +1539 -1257
  60. package/api-services/modules/supplier/index.js.gz +0 -0
  61. package/api-services/modules/supplychain-manage/es5.js +1854 -1404
  62. package/api-services/modules/supplychain-manage/index.js +1432 -1114
  63. package/api-services/modules/supplychain-manage/index.js.gz +0 -0
  64. package/api-services/modules/systemConfiguration/es5.js +1982 -1554
  65. package/api-services/modules/systemConfiguration/index.js +1537 -1251
  66. package/api-services/modules/systemConfiguration/index.js.gz +0 -0
  67. package/api-services/modules/tool/es5.js +1854 -1404
  68. package/api-services/modules/tool/index.js +1432 -1114
  69. package/api-services/modules/tool/index.js.gz +0 -0
  70. package/api-services/src/create-service/es5.js +1933 -1495
  71. package/api-services/src/create-service/index.js +1499 -1199
  72. package/api-services/src/create-service/index.js.gz +0 -0
  73. package/common-info/es5.js +2359 -1914
  74. package/common-info/getPermissionMethod/es5.js +1900 -1462
  75. package/common-info/getPermissionMethod/index.js +1416 -1116
  76. package/common-info/getPermissionMethod/index.js.gz +0 -0
  77. package/common-info/index.js +1795 -1485
  78. package/common-info/index.js.gz +0 -0
  79. package/common-tools/es5.d.ts +1 -0
  80. package/common-tools/es5.js +9 -0
  81. package/common-tools/index.d.ts +1 -0
  82. package/common-tools/index.js +1 -0
  83. package/common-tools/timezone-format/es5.d.ts +4 -76
  84. package/common-tools/timezone-format/es5.js +439 -453
  85. package/common-tools/timezone-format/get-iana-data/es5.d.ts +3 -0
  86. package/common-tools/timezone-format/get-iana-data/es5.js +353 -0
  87. package/common-tools/timezone-format/get-iana-data/iana-api-fetch.d.ts +3 -0
  88. package/common-tools/timezone-format/get-iana-data/index.d.ts +3 -0
  89. package/common-tools/timezone-format/get-iana-data/index.js +213 -0
  90. package/common-tools/timezone-format/get-iana-data/index.js.gz +0 -0
  91. package/common-tools/timezone-format/index.d.ts +4 -76
  92. package/common-tools/timezone-format/index.js +322 -320
  93. package/common-tools/timezone-format/index.js.gz +0 -0
  94. package/create-api-service/es5.js +1986 -1557
  95. package/create-api-service/index.js +1546 -1260
  96. package/create-api-service/index.js.gz +0 -0
  97. package/esm-map.json +7 -18
  98. package/index.d.ts +1 -0
  99. package/index.js +1 -0
  100. package/package.json +3 -3
  101. package/theme/es5.d.ts +8 -22
  102. package/theme/es5.js +354 -367
  103. package/theme/index.d.ts +8 -22
  104. package/theme/index.js +255 -276
  105. package/theme/index.js.gz +0 -0
@@ -0,0 +1,3 @@
1
+ export * from './dayjs-timezone-iana-plugin';
2
+ export * from './iana-api-fetch';
3
+ export * from './moment-iana-loader';
@@ -0,0 +1,353 @@
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,3 +1,6 @@
1
+ /**
2
+ * 内置 IANA packed 数据接口路径(与网关 / 前端 base 拼接)。
3
+ */
1
4
  export declare const TIME_ZONE_PACKED_DATA_URL: string;
2
5
  /**
3
6
  * 从浏览器 localStorage 读取 accessToken(非浏览器或无此项时返回 null)。
@@ -0,0 +1,3 @@
1
+ export * from './dayjs-timezone-iana-plugin';
2
+ export * from './iana-api-fetch';
3
+ export * from './moment-iana-loader';
@@ -0,0 +1,213 @@
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
+ };
@@ -1,80 +1,9 @@
1
1
  import { Dayjs } from 'dayjs';
2
+ import { default as dayjsTimezoneIanaPlugin, PackedIanaData, PreloadDayjsIanaOptions } from './get-iana-data/dayjs-timezone-iana-plugin';
3
+ import { loadIanaData as loadMomentIanaData, loadIanaFromApi as loadMomentIanaFromApi, LoadIanaFromApiOptions, MomentWithTimezone, PackedIanaTzData } from './get-iana-data/moment-iana-loader';
2
4
 
3
- export interface TimeZoneRule {
4
- u: number[];
5
- o: number[];
6
- }
7
- export interface IanaDb {
8
- [zone: string]: TimeZoneRule;
9
- }
10
- export type DayjsTimezoneIanaOption = undefined;
11
- export interface PackedIanaData {
12
- version?: string;
13
- zones: string[];
14
- links?: string[];
15
- }
16
- export type ParsePackedIanaResponse = (json: unknown) => PackedIanaData;
17
- export type IanaFetchJson = (url: string, init?: RequestInit) => Promise<unknown>;
18
- export interface PreloadDayjsIanaOptions {
19
- /** 默认请求内置 IANA packed 数据接口;可传自定义地址覆盖。 */
20
- url?: string;
21
- /** 设置 Authorization;传空字符串表示不附加鉴权头。 */
22
- authorization?: string;
23
- /** 额外请求头;与 authorization 合并,同名时以 authorization 为准。 */
24
- headers?: Record<string, string>;
25
- /** 默认使用全局 fetch;Node 等环境可传入实现。 */
26
- fetchJson?: IanaFetchJson;
27
- /** 接口外层包裹时在此解析为 packed IANA 数据。 */
28
- parseResponse?: ParsePackedIanaResponse;
29
- }
30
- export type DayjsTimezoneIanaPlugin = ((option?: DayjsTimezoneIanaOption, dayjsClass?: unknown, dayjsFactory?: unknown) => void) & {
31
- preloadFromApi: (options?: PreloadDayjsIanaOptions) => Promise<PackedIanaData>;
32
- preloadFromData: (packedData: PackedIanaData) => PackedIanaData;
33
- getCachedPackedData: () => PackedIanaData | null;
34
- clearIanaCache: () => void;
35
- };
36
- export interface PackedIanaTzData {
37
- version?: string;
38
- zones: string[];
39
- links?: string[];
40
- }
41
- export type MomentTimezoneApi = {
42
- load: (data: PackedIanaTzData) => void;
43
- };
44
- export interface MomentWithTimezone {
45
- tz: MomentTimezoneApi | (((...args: any[]) => unknown) & MomentTimezoneApi);
46
- }
47
- export type ParseIanaResponse = (json: unknown) => PackedIanaTzData;
48
- export type IanaMomentFetchJson = (url: string, init?: RequestInit) => Promise<unknown>;
49
- export interface LoadIanaFromApiOptions {
50
- /** 设置请求头 Authorization。 */
51
- authorization?: string;
52
- /** 额外请求头;与 authorization 合并,同名时以 authorization 为准。 */
53
- headers?: Record<string, string>;
54
- /** 自定义请求,默认使用全局 fetch。 */
55
- fetchJson?: IanaMomentFetchJson;
56
- /** 当接口外层有包裹时,在此取出 packed IANA 数据。 */
57
- parseResponse?: ParseIanaResponse;
58
- }
59
- export declare const dayjsTimezoneIanaPlugin: DayjsTimezoneIanaPlugin;
60
- export declare const assertPackedIanaData: (json: unknown) => PackedIanaData;
61
- export declare const preloadDayjsIanaFromData: (packedData: PackedIanaData) => PackedIanaData;
62
- export declare const getCachedDayjsPackedIanaData: () => PackedIanaData | null;
63
- export declare const preloadDayjsIanaFromApi: (options?: PreloadDayjsIanaOptions) => Promise<PackedIanaData>;
64
- export declare const clearDayjsIanaCache: () => void;
65
- export declare const createIanaDbFromPackedData: (packedData: PackedIanaData) => IanaDb;
66
- export declare const TIME_ZONE_PACKED_DATA_URL: string;
67
- export declare const getAccessTokenFromLocalStorage: () => string | null;
68
- export declare const getDefaultIanaAuthorization: () => string | undefined;
69
- export declare const buildIanaFetchInit: (options?: {
70
- authorization?: string;
71
- headers?: Record<string, string>;
72
- }) => RequestInit | undefined;
73
- export declare const assertPackedIanaTzData: (json: unknown) => PackedIanaTzData;
74
- export declare const loadMomentIanaData: (moment: MomentWithTimezone, data: PackedIanaTzData) => void;
75
- export declare const loadIanaData: (moment: MomentWithTimezone, data: PackedIanaTzData) => void;
76
- export declare const loadMomentIanaFromApi: (moment: MomentWithTimezone, urlOrOptions?: string | LoadIanaFromApiOptions, maybeOptions?: LoadIanaFromApiOptions) => Promise<PackedIanaTzData>;
77
- export declare const loadIanaFromApi: (moment: MomentWithTimezone, urlOrOptions?: string | LoadIanaFromApiOptions, maybeOptions?: LoadIanaFromApiOptions) => Promise<PackedIanaTzData>;
5
+ export * from './get-iana-data';
6
+ export { dayjsTimezoneIanaPlugin, loadMomentIanaData, loadMomentIanaFromApi };
78
7
  export type TimeValue = string | number | Date | Dayjs | null | undefined;
79
8
  export type TimeZoneFlag = number | string | null | undefined;
80
9
  export type TimeZoneDateLibrary = 'dayjs' | 'moment';
@@ -260,4 +189,3 @@ export declare const isDaylightSavingTime: (timeZone?: string | null, value?: Ti
260
189
  export declare const buildTimeZoneDisplayOptions: (options: TimeZoneOption[], referenceDate?: Date) => TimeZoneDisplayOption[];
261
190
  export declare const formatClientLocalDateTimeLine: (value: TimeValue, timeZone?: string | null, options?: FormatClientLocalDateTimeLineOptions) => any;
262
191
  export declare const getTimeZoneDisplayInfo: (options?: TimeZoneDisplayOptions) => TimeZoneDisplayResult;
263
- export {};