@das-fed/upf-utils 6.4.0-dev.250 → 6.4.0-dev.252

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 (94) hide show
  1. package/api-services/es5.js +2640 -2202
  2. package/api-services/index.js +1964 -1664
  3. package/api-services/index.js.gz +0 -0
  4. package/api-services/modules/app-manage/es5.js +1853 -1403
  5. package/api-services/modules/app-manage/index.js +1432 -1114
  6. package/api-services/modules/app-manage/index.js.gz +0 -0
  7. package/api-services/modules/authentication/es5.js +1853 -1403
  8. package/api-services/modules/authentication/index.js +1432 -1114
  9. package/api-services/modules/authentication/index.js.gz +0 -0
  10. package/api-services/modules/bems/es5.js +1934 -1496
  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 +1853 -1403
  14. package/api-services/modules/contract/index.js +1432 -1114
  15. package/api-services/modules/contract/index.js.gz +0 -0
  16. package/api-services/modules/duty-manage/es5.js +1989 -1563
  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 +1795 -1357
  20. package/api-services/modules/enterpriseright/index.js +1349 -1049
  21. package/api-services/modules/enterpriseright/index.js.gz +0 -0
  22. package/api-services/modules/es5.js +2449 -2011
  23. package/api-services/modules/file/es5.js +2573 -2135
  24. package/api-services/modules/file/index.js +1944 -1644
  25. package/api-services/modules/file/index.js.gz +0 -0
  26. package/api-services/modules/gateway-edge/es5.js +1984 -1558
  27. package/api-services/modules/gateway-edge/index.js +1543 -1261
  28. package/api-services/modules/gateway-edge/index.js.gz +0 -0
  29. package/api-services/modules/index.js +1783 -1483
  30. package/api-services/modules/index.js.gz +0 -0
  31. package/api-services/modules/iot/es5.js +1963 -1528
  32. package/api-services/modules/iot/index.js +1497 -1201
  33. package/api-services/modules/iot/index.js.gz +0 -0
  34. package/api-services/modules/justauth/es5.js +1855 -1405
  35. package/api-services/modules/justauth/index.js +1433 -1115
  36. package/api-services/modules/justauth/index.js.gz +0 -0
  37. package/api-services/modules/knowledge/es5.js +1985 -1559
  38. package/api-services/modules/knowledge/index.js +1547 -1265
  39. package/api-services/modules/knowledge/index.js.gz +0 -0
  40. package/api-services/modules/link/es5.js +1984 -1558
  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 +1982 -1553
  44. package/api-services/modules/permission/index.js +1540 -1254
  45. package/api-services/modules/permission/index.js.gz +0 -0
  46. package/api-services/modules/platformManage/es5.js +1945 -1504
  47. package/api-services/modules/platformManage/index.js +1481 -1177
  48. package/api-services/modules/platformManage/index.js.gz +0 -0
  49. package/api-services/modules/portal/es5.js +1794 -1353
  50. package/api-services/modules/portal/index.js +1347 -1043
  51. package/api-services/modules/portal/index.js.gz +0 -0
  52. package/api-services/modules/space-manage/es5.js +1795 -1357
  53. package/api-services/modules/space-manage/index.js +1349 -1049
  54. package/api-services/modules/space-manage/index.js.gz +0 -0
  55. package/api-services/modules/super-admin/es5.js +1991 -1565
  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 +1856 -1406
  59. package/api-services/modules/supplier/index.js +1434 -1116
  60. package/api-services/modules/supplier/index.js.gz +0 -0
  61. package/api-services/modules/supplychain-manage/es5.js +1930 -1492
  62. package/api-services/modules/supplychain-manage/index.js +1494 -1194
  63. package/api-services/modules/supplychain-manage/index.js.gz +0 -0
  64. package/api-services/modules/systemConfiguration/es5.js +1980 -1554
  65. package/api-services/modules/systemConfiguration/index.js +1537 -1255
  66. package/api-services/modules/systemConfiguration/index.js.gz +0 -0
  67. package/api-services/modules/tool/es5.js +1984 -1558
  68. package/api-services/modules/tool/index.js +1543 -1261
  69. package/api-services/modules/tool/index.js.gz +0 -0
  70. package/api-services/src/create-service/es5.js +1984 -1555
  71. package/api-services/src/create-service/index.js +1545 -1259
  72. package/api-services/src/create-service/index.js.gz +0 -0
  73. package/common-info/es5.js +2608 -2182
  74. package/common-info/getPermissionMethod/es5.js +1899 -1461
  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 +2010 -1728
  78. package/common-info/index.js.gz +0 -0
  79. package/common-tools/timezone-format/es5.d.ts +29 -0
  80. package/common-tools/timezone-format/es5.js +610 -455
  81. package/common-tools/timezone-format/get-iana-data/es5.d.ts +3 -0
  82. package/common-tools/timezone-format/get-iana-data/es5.js +353 -0
  83. package/common-tools/timezone-format/get-iana-data/index.d.ts +3 -0
  84. package/common-tools/timezone-format/get-iana-data/index.js +213 -0
  85. package/common-tools/timezone-format/get-iana-data/index.js.gz +0 -0
  86. package/common-tools/timezone-format/get-iana-data/moment-iana-loader.d.ts +4 -3
  87. package/common-tools/timezone-format/index.d.ts +29 -0
  88. package/common-tools/timezone-format/index.js +425 -322
  89. package/common-tools/timezone-format/index.js.gz +0 -0
  90. package/create-api-service/es5.js +1933 -1495
  91. package/create-api-service/index.js +1500 -1200
  92. package/create-api-service/index.js.gz +0 -0
  93. package/esm-map.json +29 -8
  94. package/package.json +3 -3
@@ -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;
@@ -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
+ };
@@ -7,10 +7,11 @@ export interface PackedIanaTzData {
7
7
  zones: string[];
8
8
  links?: string[];
9
9
  }
10
+ export type MomentTimezoneApi = {
11
+ load: (data: PackedIanaTzData) => void;
12
+ };
10
13
  export interface MomentWithTimezone {
11
- tz: {
12
- load: (data: PackedIanaTzData) => void;
13
- };
14
+ tz: MomentTimezoneApi | (((...args: any[]) => unknown) & MomentTimezoneApi);
14
15
  }
15
16
  export declare function assertPackedIanaTzData(json: unknown): PackedIanaTzData;
16
17
  export declare function loadIanaData(moment: MomentWithTimezone, data: PackedIanaTzData): void;
@@ -94,9 +94,21 @@ export interface FormatLocalDateTimeOptions {
94
94
  /** 未传 timeZone 时是否读取 sessionStorage/客户端时区。默认 false,兼容旧 toLocalDate。 */
95
95
  useClientTimeZone?: boolean;
96
96
  }
97
+ export interface FormatLocalDateTimeIntlOptions {
98
+ /** 目标 IANA 时区;为空时读取浏览器当前时区。 */
99
+ timeZone?: string | null;
100
+ /** 输出格式,默认 YYYY-MM-DD HH:mm:ss。 */
101
+ format?: string;
102
+ /** Intl locale,默认 zh-CN,保证中后台测试文案稳定。 */
103
+ locale?: string;
104
+ }
97
105
  export interface ApplyIanaTimeZoneOptions {
98
106
  /** 指定默认时区,后续 dayjs.tz(value) 可直接使用。 */
99
107
  defaultTimeZone?: string;
108
+ /** 运行期快照来源:接口数据为 iana,随包数据或本地兜底为 fallback。 */
109
+ runtimeSource?: IanaTimeZoneDataSource;
110
+ /** 是否把 packed 数据写到 window 快照,供 iframe 子应用复用。默认 true。 */
111
+ writeRuntimeSnapshot?: boolean;
100
112
  }
101
113
  export interface LoadIanaTimeZoneOptions extends PreloadDayjsIanaOptions, ApplyIanaTimeZoneOptions {
102
114
  }
@@ -104,6 +116,11 @@ export interface ApplyIanaTimeZoneResult {
104
116
  data: PackedIanaData;
105
117
  knownTimeZones: string[];
106
118
  }
119
+ export type IanaTimeZoneDataSource = 'iana' | 'fallback';
120
+ export interface RuntimeIanaTimeZoneDataSnapshot extends PackedIanaData {
121
+ source: IanaTimeZoneDataSource;
122
+ timestamp: number;
123
+ }
107
124
  export interface LoadMomentIanaTimeZoneOptions extends LoadIanaFromApiOptions {
108
125
  url?: string;
109
126
  }
@@ -132,6 +149,14 @@ export interface ClientTimeZoneRef {
132
149
  }
133
150
  export declare const TIMEZONE_CHANGE_EVENT = "timezonechange";
134
151
  export declare const UPF_TIMEZONE_MESSAGE_TYPE = "__UPF_TIMEZONE_CHANGE__";
152
+ export declare const UPF_IANA_TIMEZONE_DATA_KEY = "__UPF_IANA_TIMEZONE_DATA__";
153
+ export declare const IANA_TIMEZONE_DATA_CHANGE_EVENT = "ianatimezonedatachange";
154
+ export declare const setRuntimeIanaTimeZoneDataSnapshot: (data: PackedIanaData, options?: {
155
+ source?: IanaTimeZoneDataSource;
156
+ dispatchEvent?: boolean;
157
+ }) => RuntimeIanaTimeZoneDataSnapshot | null;
158
+ export declare const getRuntimeIanaTimeZoneDataSnapshot: () => RuntimeIanaTimeZoneDataSnapshot | null;
159
+ export declare const readInjectedParentIanaTimeZoneDataSnapshot: () => RuntimeIanaTimeZoneDataSnapshot | null;
135
160
  export declare const clientTimeZone: ClientTimeZoneRef;
136
161
  export declare const isKnownTimeZone: (timeZone?: string | null) => any;
137
162
  export declare const rebuildKnownTimeZoneIds: (data: Pick<PackedIanaData, "zones" | "links">) => any;
@@ -141,6 +166,7 @@ export declare const loadDayjsIanaTimeZoneData: (options?: LoadIanaTimeZoneOptio
141
166
  export declare const applyMomentIanaTimeZoneData: (moment: MomentWithTimezone, data: PackedIanaTzData) => PackedIanaTzData;
142
167
  export declare const loadMomentIanaTimeZoneData: (moment: MomentWithTimezone, options?: LoadMomentIanaTimeZoneOptions) => unknown;
143
168
  export declare const setDefaultTimeZone: (timeZone?: string | null) => boolean;
169
+ export declare const ensureInjectedIanaTimeZoneData: () => Promise<ApplyIanaTimeZoneResult | null>;
144
170
  export declare const setClientTimeZone: (timeZone?: string | null, options?: SetClientTimeZoneOptions) => any;
145
171
  export declare const syncClientTimeZone: (source?: string) => any;
146
172
  export declare const onClientTimeZoneChange: (handler: ClientTimeZoneChangeHandler) => () => any;
@@ -152,6 +178,9 @@ export declare const getZoneUtcOffset: (value: TimeValue, timeZone?: string | nu
152
178
  export declare const formatInTimeZone: (value?: TimeValue, timeZone?: string | null, format?: string) => any;
153
179
  export declare const formatLocalDateTime: (value?: TimeValue, options?: FormatLocalDateTimeOptions | string) => string;
154
180
  export declare const toLocalDate: (value?: TimeValue, format?: string, options?: Omit<FormatLocalDateTimeOptions, "format">) => string;
181
+ export declare const getBrowserTimeZone: () => any;
182
+ export declare function formatLocalDateTimeIntl(value?: TimeValue, timeZone?: string | null, format?: string, locale?: string): string;
183
+ export declare function formatLocalDateTimeIntl(value?: TimeValue, options?: FormatLocalDateTimeIntlOptions): string;
155
184
  export declare const formatTimeZoneOffsetLabel: (value?: TimeValue, timeZone?: string | null) => string;
156
185
  export declare const resolveUtcOffsetFallback: (option: Pick<TimeZoneOption, "timeZoneId" | "baseUtcOffsetText" | "currentUtcOffsetText">, referenceDate?: Date) => string;
157
186
  export declare const timeZoneHasDST: (timeZone?: string | null, value?: TimeValue) => boolean;