@das-fed/utils 7.0.10 → 7.0.11

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.
Binary file
@@ -183,7 +183,7 @@ const On = (e) => {
183
183
  }))(`axios@${Math.random()}`, []) : (n) => setTimeout(n))(
184
184
  typeof setImmediate == "function",
185
185
  A(U.postMessage)
186
- ), xn = typeof queueMicrotask < "u" ? queueMicrotask.bind(U) : typeof process < "u" && process.nextTick || ft, kn = (e) => e != null && A(e[oe]), a = {
186
+ ), xn = typeof queueMicrotask < "u" ? queueMicrotask.bind(U) : typeof process < "u" && process.nextTick || ft, Cn = (e) => e != null && A(e[oe]), a = {
187
187
  isArray: v,
188
188
  isArrayBuffer: it,
189
189
  isBuffer: J,
@@ -241,7 +241,7 @@ const On = (e) => {
241
241
  isThenable: _n,
242
242
  setImmediate: ft,
243
243
  asap: xn,
244
- isIterable: kn
244
+ isIterable: Cn
245
245
  };
246
246
  function y(e, t, n, r, o) {
247
247
  Error.call(this), Error.captureStackTrace ? Error.captureStackTrace(this, this.constructor) : this.stack = new Error().stack, this.message = e, this.name = "AxiosError", t && (this.code = t), n && (this.config = n), r && (this.request = r), o && (this.response = o, this.status = o.status ? o.status : null);
@@ -293,7 +293,7 @@ y.from = (e, t, n, r, o, s) => {
293
293
  return f !== Error.prototype;
294
294
  }, (c) => c !== "isAxiosError"), y.call(i, e.message, t, n, r, o), i.cause = e, i.name = e.name, s && Object.assign(i, s), i;
295
295
  };
296
- const Cn = null;
296
+ const kn = null;
297
297
  function we(e) {
298
298
  return a.isPlainObject(e) || a.isArray(e);
299
299
  }
@@ -340,10 +340,10 @@ function ae(e, t, n) {
340
340
  if (a.endsWith(m, "{}"))
341
341
  m = r ? m : m.slice(0, -2), p = JSON.stringify(p);
342
342
  else if (a.isArray(p) && Pn(p) || (a.isFileList(p) || a.endsWith(m, "[]")) && (E = a.toArray(p)))
343
- return m = ht(m), E.forEach(function(R, C) {
343
+ return m = ht(m), E.forEach(function(R, k) {
344
344
  !(a.isUndefined(R) || R === null) && t.append(
345
345
  // eslint-disable-next-line no-nested-ternary
346
- i === !0 ? Ne([m], C, s) : i === null ? m : m + "[]",
346
+ i === !0 ? Ne([m], k, s) : i === null ? m : m + "[]",
347
347
  l(R)
348
348
  );
349
349
  }), !1;
@@ -388,10 +388,10 @@ function Fe(e) {
388
388
  return t[r];
389
389
  });
390
390
  }
391
- function ke(e, t) {
391
+ function Ce(e, t) {
392
392
  this._pairs = [], e && ae(e, this, t);
393
393
  }
394
- const mt = ke.prototype;
394
+ const mt = Ce.prototype;
395
395
  mt.append = function(t, n) {
396
396
  this._pairs.push([t, n]);
397
397
  };
@@ -415,7 +415,7 @@ function yt(e, t, n) {
415
415
  });
416
416
  const o = n && n.serialize;
417
417
  let s;
418
- if (o ? s = o(t, n) : s = a.isURLSearchParams(t) ? t.toString() : new ke(t, n).toString(r), s) {
418
+ if (o ? s = o(t, n) : s = a.isURLSearchParams(t) ? t.toString() : new Ce(t, n).toString(r), s) {
419
419
  const i = e.indexOf("#");
420
420
  i !== -1 && (e = e.slice(0, i)), e += (e.indexOf("?") === -1 ? "?" : "&") + s;
421
421
  }
@@ -479,7 +479,7 @@ const wt = {
479
479
  silentJSONParsing: !0,
480
480
  forcedJSONParsing: !0,
481
481
  clarifyTimeoutError: !1
482
- }, Nn = typeof URLSearchParams < "u" ? URLSearchParams : ke, Fn = typeof FormData < "u" ? FormData : null, Dn = typeof Blob < "u" ? Blob : null, vn = {
482
+ }, Nn = typeof URLSearchParams < "u" ? URLSearchParams : Ce, Fn = typeof FormData < "u" ? FormData : null, Dn = typeof Blob < "u" ? Blob : null, vn = {
483
483
  isBrowser: !0,
484
484
  classes: {
485
485
  URLSearchParams: Nn,
@@ -487,10 +487,10 @@ const wt = {
487
487
  Blob: Dn
488
488
  },
489
489
  protocols: ["http", "https", "file", "blob", "url", "data"]
490
- }, Ce = typeof window < "u" && typeof document < "u", ge = typeof navigator == "object" && navigator || void 0, In = Ce && (!ge || ["ReactNative", "NativeScript", "NS"].indexOf(ge.product) < 0), Bn = typeof WorkerGlobalScope < "u" && // eslint-disable-next-line no-undef
491
- self instanceof WorkerGlobalScope && typeof self.importScripts == "function", jn = Ce && window.location.href || "http://localhost", qn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
490
+ }, ke = typeof window < "u" && typeof document < "u", ge = typeof navigator == "object" && navigator || void 0, In = ke && (!ge || ["ReactNative", "NativeScript", "NS"].indexOf(ge.product) < 0), Bn = typeof WorkerGlobalScope < "u" && // eslint-disable-next-line no-undef
491
+ self instanceof WorkerGlobalScope && typeof self.importScripts == "function", jn = ke && window.location.href || "http://localhost", qn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
492
492
  __proto__: null,
493
- hasBrowserEnv: Ce,
493
+ hasBrowserEnv: ke,
494
494
  hasStandardBrowserEnv: In,
495
495
  hasStandardBrowserWebWorkerEnv: Bn,
496
496
  navigator: ge,
@@ -1061,16 +1061,16 @@ const Rt = (e) => {
1061
1061
  }, h.onerror = function() {
1062
1062
  r(new y("Network Error", y.ERR_NETWORK, e, h)), h = null;
1063
1063
  }, h.ontimeout = function() {
1064
- let C = o.timeout ? "timeout of " + o.timeout + "ms exceeded" : "timeout exceeded";
1064
+ let k = o.timeout ? "timeout of " + o.timeout + "ms exceeded" : "timeout exceeded";
1065
1065
  const O = o.transitional || wt;
1066
- o.timeoutErrorMessage && (C = o.timeoutErrorMessage), r(new y(
1067
- C,
1066
+ o.timeoutErrorMessage && (k = o.timeoutErrorMessage), r(new y(
1067
+ k,
1068
1068
  O.clarifyTimeoutError ? y.ETIMEDOUT : y.ECONNABORTED,
1069
1069
  e,
1070
1070
  h
1071
1071
  )), h = null;
1072
- }, s === void 0 && i.setContentType(null), "setRequestHeader" in h && a.forEach(i.toJSON(), function(C, O) {
1073
- h.setRequestHeader(O, C);
1072
+ }, s === void 0 && i.setContentType(null), "setRequestHeader" in h && a.forEach(i.toJSON(), function(k, O) {
1073
+ h.setRequestHeader(O, k);
1074
1074
  }), a.isUndefined(o.withCredentials) || (h.withCredentials = !!o.withCredentials), c && c !== "json" && (h.responseType = o.responseType), l && ([w, p] = ne(l, !0), h.addEventListener("progress", w)), f && h.upload && ([d, g] = ne(f), h.upload.addEventListener("progress", d), h.upload.addEventListener("loadend", g)), (o.cancelToken || o.signal) && (u = (R) => {
1075
1075
  h && (r(!R || R.type ? new I(null, e, h) : R), h.abort(), h = null);
1076
1076
  }, o.cancelToken && o.cancelToken.subscribe(u), o.signal && (o.signal.aborted ? u() : o.signal.addEventListener("abort", u)));
@@ -1270,10 +1270,10 @@ const dr = async (e) => {
1270
1270
  );
1271
1271
  }
1272
1272
  l = l || "text";
1273
- let C = await re[a.findKey(re, l) || "text"](S, e);
1273
+ let k = await re[a.findKey(re, l) || "text"](S, e);
1274
1274
  return !R && m && m(), await new Promise((O, P) => {
1275
1275
  Et(O, P, {
1276
- data: C,
1276
+ data: k,
1277
1277
  headers: _.from(S.headers),
1278
1278
  status: S.status,
1279
1279
  statusText: S.statusText,
@@ -1290,7 +1290,7 @@ const dr = async (e) => {
1290
1290
  ) : y.from(E, E && E.code, e, p);
1291
1291
  }
1292
1292
  }), Ee = {
1293
- http: Cn,
1293
+ http: kn,
1294
1294
  xhr: sr,
1295
1295
  fetch: hr
1296
1296
  };
@@ -1399,7 +1399,7 @@ function yr(e, t, n) {
1399
1399
  const ee = {
1400
1400
  assertOptions: yr,
1401
1401
  validators: ue
1402
- }, k = ee.validators;
1402
+ }, C = ee.validators;
1403
1403
  let N = class {
1404
1404
  constructor(t) {
1405
1405
  this.defaults = t || {}, this.interceptors = {
@@ -1436,17 +1436,17 @@ let N = class {
1436
1436
  typeof t == "string" ? (n = n || {}, n.url = t) : n = t || {}, n = F(this.defaults, n);
1437
1437
  const { transitional: r, paramsSerializer: o, headers: s } = n;
1438
1438
  r !== void 0 && ee.assertOptions(r, {
1439
- silentJSONParsing: k.transitional(k.boolean),
1440
- forcedJSONParsing: k.transitional(k.boolean),
1441
- clarifyTimeoutError: k.transitional(k.boolean)
1439
+ silentJSONParsing: C.transitional(C.boolean),
1440
+ forcedJSONParsing: C.transitional(C.boolean),
1441
+ clarifyTimeoutError: C.transitional(C.boolean)
1442
1442
  }, !1), o != null && (a.isFunction(o) ? n.paramsSerializer = {
1443
1443
  serialize: o
1444
1444
  } : ee.assertOptions(o, {
1445
- encode: k.function,
1446
- serialize: k.function
1445
+ encode: C.function,
1446
+ serialize: C.function
1447
1447
  }, !0)), n.allowAbsoluteUrls !== void 0 || (this.defaults.allowAbsoluteUrls !== void 0 ? n.allowAbsoluteUrls = this.defaults.allowAbsoluteUrls : n.allowAbsoluteUrls = !0), ee.assertOptions(n, {
1448
- baseUrl: k.spelling("baseURL"),
1449
- withXsrfToken: k.spelling("withXSRFToken")
1448
+ baseUrl: C.spelling("baseURL"),
1449
+ withXsrfToken: C.spelling("withXSRFToken")
1450
1450
  }, !0), n.method = (n.method || this.defaults.method || "get").toLowerCase();
1451
1451
  let i = s && a.merge(
1452
1452
  s.common,
@@ -1673,13 +1673,13 @@ const Se = {
1673
1673
  Object.entries(Se).forEach(([e, t]) => {
1674
1674
  Se[t] = e;
1675
1675
  });
1676
- function kt(e) {
1676
+ function Ct(e) {
1677
1677
  const t = new N(e), n = ot(N.prototype.request, t);
1678
1678
  return a.extend(n, N.prototype, t, { allOwnKeys: !0 }), a.extend(n, t, null, { allOwnKeys: !0 }), n.create = function(o) {
1679
- return kt(F(e, o));
1679
+ return Ct(F(e, o));
1680
1680
  }, n;
1681
1681
  }
1682
- const b = kt(K);
1682
+ const b = Ct(K);
1683
1683
  b.Axios = N;
1684
1684
  b.CanceledError = I;
1685
1685
  b.CancelToken = wr;
@@ -1788,9 +1788,9 @@ function Re(e, t) {
1788
1788
  );
1789
1789
  }
1790
1790
  var Sr = Re(Er, { path: "/" }), Je;
1791
- const Ct = typeof window < "u", Rr = (e) => typeof e == "string", Ve = () => +Date.now(), Te = () => {
1791
+ const kt = typeof window < "u", Rr = (e) => typeof e == "string", Ve = () => +Date.now(), Te = () => {
1792
1792
  };
1793
- Ct && ((Je = window == null ? void 0 : window.navigator) != null && Je.userAgent) && /iP(ad|hone|od)/.test(window.navigator.userAgent);
1793
+ kt && ((Je = window == null ? void 0 : window.navigator) != null && Je.userAgent) && /iP(ad|hone|od)/.test(window.navigator.userAgent);
1794
1794
  function Pe(e) {
1795
1795
  return typeof e == "function" ? e() : Dt(e);
1796
1796
  }
@@ -1827,7 +1827,7 @@ function xr(e) {
1827
1827
  const n = Pe(e);
1828
1828
  return (t = n == null ? void 0 : n.$el) != null ? t : n;
1829
1829
  }
1830
- const Pt = Ct ? window : void 0;
1830
+ const Pt = kt ? window : void 0;
1831
1831
  function We(...e) {
1832
1832
  let t, n, r, o;
1833
1833
  if (Rr(e[0]) || Array.isArray(e[0]) ? ([n, r, o] = e, t = Pt) : [t, n, r, o] = e, !t)
@@ -1844,12 +1844,12 @@ function We(...e) {
1844
1844
  }
1845
1845
  const Ke = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}, Qe = "__vueuse_ssr_handlers__";
1846
1846
  Ke[Qe] = Ke[Qe] || {};
1847
- const kr = ["mousemove", "mousedown", "resize", "keydown", "touchstart", "wheel"], Cr = 6e4;
1848
- function Pr(e = Cr, t = {}) {
1847
+ const Cr = ["mousemove", "mousedown", "resize", "keydown", "touchstart", "wheel"], kr = 6e4;
1848
+ function Pr(e = kr, t = {}) {
1849
1849
  const {
1850
1850
  initialState: n = !1,
1851
1851
  listenForVisibilityChange: r = !0,
1852
- events: o = kr,
1852
+ events: o = Cr,
1853
1853
  window: s = Pt,
1854
1854
  eventFilter: i = Or(50)
1855
1855
  } = t, c = te(n), f = te(Ve());
@@ -1933,7 +1933,7 @@ let Ut = (e = 21) => {
1933
1933
  }
1934
1934
  return t;
1935
1935
  };
1936
- const G = (e) => new URL(location.href).searchParams.get(e), D = {
1936
+ const j = (e) => new URL(location.href).searchParams.get(e), D = {
1937
1937
  oauth: "/api/justauth/oauth-server/v1/visitor/oauth/authorize",
1938
1938
  // 重定向到登录页
1939
1939
  logoutCurpage: "/api/justauth/oauth-server/v1/visitor/logout-curpage",
@@ -1964,7 +1964,7 @@ const G = (e) => new URL(location.href).searchParams.get(e), D = {
1964
1964
  localStorage.getItem("idelTime") && Ft(Number(localStorage.getItem("idelTime")));
1965
1965
  let tt = "";
1966
1966
  const jr = async () => {
1967
- const e = G("code") || "", t = G("redirect_url") || "/", n = G("kingdee_token") || "", r = G("loginType") || "";
1967
+ const e = j("code") || "", t = j("redirect_url") || "/", n = j("kingdee_token") || "", r = j("loginType") || "";
1968
1968
  if (r && localStorage.setItem("loginType", r), !e) return H();
1969
1969
  if (e === tt)
1970
1970
  return et(["code", "state", "kingdee_token", "redirect_url"]), window.__isAutoCloseApp = !1, window.location.replace(decodeURIComponent(t)), H();
@@ -2009,14 +2009,14 @@ const jr = async () => {
2009
2009
  } catch {
2010
2010
  return le({ ...M, redirect_uri: q });
2011
2011
  }
2012
- }, j = te(!1), mo = async (e) => {
2012
+ }, G = te(!1), mo = async (e) => {
2013
2013
  if (e.public) return "";
2014
2014
  if (Nt.value)
2015
2015
  return le({ ...M, redirect_uri: q });
2016
- if (j.value)
2016
+ if (G.value)
2017
2017
  return await new Promise(async (r) => {
2018
2018
  Ae(
2019
- () => j.value,
2019
+ () => G.value,
2020
2020
  (o) => {
2021
2021
  if (!o) {
2022
2022
  const s = H();
@@ -2025,15 +2025,16 @@ const jr = async () => {
2025
2025
  }
2026
2026
  );
2027
2027
  });
2028
- const { accessTokenExpiredAt: t } = z().getData();
2029
- let n = H();
2030
- j.value = !0;
2028
+ let t = H();
2029
+ const { accessTokenExpiredAt: n } = z().getData();
2030
+ G.value = !0;
2031
2031
  try {
2032
- typeof t == "number" && t > 0 && +/* @__PURE__ */ new Date() + 6e4 > t && (n = await Hr(M)), n = await jr(), j.value = !1;
2032
+ j("code") || "" ? t = await jr() : typeof n == "number" && n > 0 && +/* @__PURE__ */ new Date() + 6e4 > n && (t = await Hr(M));
2033
2033
  } catch {
2034
- j.value = !1;
2034
+ } finally {
2035
+ G.value = !1;
2035
2036
  }
2036
- return n;
2037
+ return t;
2037
2038
  }, qr = () => {
2038
2039
  let e = !1;
2039
2040
  return localStorage.getItem("thirdLogouSource") === "zhongshen" && (e = !0), e;
@@ -2121,7 +2122,7 @@ const Hr = async (e) => {
2121
2122
  }
2122
2123
  });
2123
2124
  export {
2124
- G as getQuery,
2125
+ j as getQuery,
2125
2126
  mo as getToken,
2126
2127
  jr as getTokenFromCode,
2127
2128
  M as getTokenParams,
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@das-fed/utils",
3
- "version": "7.0.10",
3
+ "version": "7.0.11",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "main": "./index.js",
@@ -9,7 +9,7 @@
9
9
  "license": "ISC",
10
10
  "dependencies": {
11
11
  "@antv/x6": "^2.18.1",
12
- "@das-fed/utils": "7.0.10",
12
+ "@das-fed/utils": "7.0.11",
13
13
  "@vue/shared": "^3.4.21",
14
14
  "@vueuse/core": "^9.6.0",
15
15
  "axios": "^1.6.7",
@@ -21,8 +21,8 @@
21
21
  "vue": "^3.4.21"
22
22
  },
23
23
  "devDependencies": {
24
- "@das-fed/cli": "7.0.10",
25
- "@das-fed/web": "7.0.10",
24
+ "@das-fed/cli": "7.0.11",
25
+ "@das-fed/web": "7.0.11",
26
26
  "@types/js-cookie": "^3.0.6",
27
27
  "@types/lodash-es": "^4.17.12",
28
28
  "@types/qs": "^6.9.15",