@das-fed/utils 7.1.0-dev.12 → 7.1.0-dev.13

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.
@@ -5,6 +5,7 @@ declare const getTokenParams: any;
5
5
  declare const getTokenFromCode: () => unknown;
6
6
  declare const getToken: (config: any) => unknown;
7
7
  declare const login: (_params: any) => any;
8
+ declare const refreshToken: (params: any) => unknown;
8
9
  declare const tokenStorage: () => {
9
10
  getData: () => {
10
11
  accessToken: any;
@@ -12,12 +13,13 @@ declare const tokenStorage: () => {
12
13
  refreshToken: any;
13
14
  };
14
15
  save: (data: {
15
- accessToken?: string | null;
16
- exp?: number;
17
- accessTokenExpiredAt?: number;
18
- refreshToken?: string | null;
19
- info?: any;
16
+ accessToken: string | null;
17
+ exp: number;
18
+ accessTokenExpiredAt: number;
19
+ expires_in: number;
20
+ refreshToken: string | null;
21
+ info: any;
20
22
  }) => void;
21
23
  remove: () => void;
22
24
  };
23
- export { getTokenParams, getTokenFromCode, real_uri, getQuery, getToken, tokenStorage, login };
25
+ export { getTokenParams, getTokenFromCode, real_uri, getQuery, getToken, tokenStorage, login, refreshToken };
@@ -243,10 +243,10 @@ const _n = (e) => {
243
243
  asap: kn,
244
244
  isIterable: Pn
245
245
  };
246
- function w(e, t, n, r, o) {
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);
248
248
  }
249
- c.inherits(w, Error, {
249
+ c.inherits(y, Error, {
250
250
  toJSON: function() {
251
251
  return {
252
252
  // Standard
@@ -267,7 +267,7 @@ c.inherits(w, Error, {
267
267
  };
268
268
  }
269
269
  });
270
- const ht = w.prototype, mt = {};
270
+ const ht = y.prototype, mt = {};
271
271
  [
272
272
  "ERR_BAD_OPTION_VALUE",
273
273
  "ERR_BAD_OPTION",
@@ -285,13 +285,13 @@ const ht = w.prototype, mt = {};
285
285
  ].forEach((e) => {
286
286
  mt[e] = { value: e };
287
287
  });
288
- Object.defineProperties(w, mt);
288
+ Object.defineProperties(y, mt);
289
289
  Object.defineProperty(ht, "isAxiosError", { value: !0 });
290
- w.from = (e, t, n, r, o, s) => {
290
+ y.from = (e, t, n, r, o, s) => {
291
291
  const i = Object.create(ht);
292
292
  return c.toFlatObject(e, i, function(f) {
293
293
  return f !== Error.prototype;
294
- }, (a) => a !== "isAxiosError"), w.call(i, e.message, t, n, r, o), i.cause = e, i.name = e.name, s && Object.assign(i, s), i;
294
+ }, (a) => a !== "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
296
  const Ln = null;
297
297
  function ge(e) {
@@ -318,8 +318,8 @@ function ue(e, t, n) {
318
318
  metaTokens: !0,
319
319
  dots: !1,
320
320
  indexes: !1
321
- }, !1, function(y, h) {
322
- return !c.isUndefined(h[y]);
321
+ }, !1, function(m, h) {
322
+ return !c.isUndefined(h[m]);
323
323
  });
324
324
  const r = n.metaTokens, o = n.visitor || l, s = n.dots, i = n.indexes, f = (n.Blob || typeof Blob < "u" && Blob) && c.isSpecCompliantForm(t);
325
325
  if (!c.isFunction(o))
@@ -331,42 +331,42 @@ function ue(e, t, n) {
331
331
  if (c.isBoolean(p))
332
332
  return p.toString();
333
333
  if (!f && c.isBlob(p))
334
- throw new w("Blob is not supported. Use a Buffer instead.");
334
+ throw new y("Blob is not supported. Use a Buffer instead.");
335
335
  return c.isArrayBuffer(p) || c.isTypedArray(p) ? f && typeof Blob == "function" ? new Blob([p]) : Buffer.from(p) : p;
336
336
  }
337
- function l(p, y, h) {
337
+ function l(p, m, h) {
338
338
  let E = p;
339
339
  if (p && !h && typeof p == "object") {
340
- if (c.endsWith(y, "{}"))
341
- y = r ? y : y.slice(0, -2), p = JSON.stringify(p);
342
- else if (c.isArray(p) && Un(p) || (c.isFileList(p) || c.endsWith(y, "[]")) && (E = c.toArray(p)))
343
- return y = yt(y), E.forEach(function(S, k) {
340
+ if (c.endsWith(m, "{}"))
341
+ m = r ? m : m.slice(0, -2), p = JSON.stringify(p);
342
+ else if (c.isArray(p) && Un(p) || (c.isFileList(p) || c.endsWith(m, "[]")) && (E = c.toArray(p)))
343
+ return m = yt(m), E.forEach(function(S, k) {
344
344
  !(c.isUndefined(S) || S === null) && t.append(
345
345
  // eslint-disable-next-line no-nested-ternary
346
- i === !0 ? De([y], k, s) : i === null ? y : y + "[]",
346
+ i === !0 ? De([m], k, s) : i === null ? m : m + "[]",
347
347
  u(S)
348
348
  );
349
349
  }), !1;
350
350
  }
351
- return ge(p) ? !0 : (t.append(De(h, y, s), u(p)), !1);
351
+ return ge(p) ? !0 : (t.append(De(h, m, s), u(p)), !1);
352
352
  }
353
- const d = [], m = Object.assign(Nn, {
353
+ const d = [], w = Object.assign(Nn, {
354
354
  defaultVisitor: l,
355
355
  convertValue: u,
356
356
  isVisitable: ge
357
357
  });
358
- function g(p, y) {
358
+ function g(p, m) {
359
359
  if (!c.isUndefined(p)) {
360
360
  if (d.indexOf(p) !== -1)
361
- throw Error("Circular reference detected in " + y.join("."));
361
+ throw Error("Circular reference detected in " + m.join("."));
362
362
  d.push(p), c.forEach(p, function(E, R) {
363
363
  (!(c.isUndefined(E) || E === null) && o.call(
364
364
  t,
365
365
  E,
366
366
  c.isString(R) ? R.trim() : R,
367
- y,
368
- m
369
- )) === !0 && g(E, y ? y.concat(R) : [R]);
367
+ m,
368
+ w
369
+ )) === !0 && g(E, m ? m.concat(R) : [R]);
370
370
  }), d.pop();
371
371
  }
372
372
  }
@@ -582,7 +582,7 @@ const Q = {
582
582
  return JSON.parse(t);
583
583
  } catch (a) {
584
584
  if (i)
585
- throw a.name === "SyntaxError" ? w.from(a, w.ERR_BAD_RESPONSE, this, null, this.response) : a;
585
+ throw a.name === "SyntaxError" ? y.from(a, y.ERR_BAD_RESPONSE, this, null, this.response) : a;
586
586
  }
587
587
  }
588
588
  return t;
@@ -825,16 +825,16 @@ function Rt(e) {
825
825
  return !!(e && e.__CANCEL__);
826
826
  }
827
827
  function M(e, t, n) {
828
- w.call(this, e ?? "canceled", w.ERR_CANCELED, t, n), this.name = "CanceledError";
828
+ y.call(this, e ?? "canceled", y.ERR_CANCELED, t, n), this.name = "CanceledError";
829
829
  }
830
- c.inherits(M, w, {
830
+ c.inherits(M, y, {
831
831
  __CANCEL__: !0
832
832
  });
833
833
  function St(e, t, n) {
834
834
  const r = n.config.validateStatus;
835
- !n.status || !r || r(n.status) ? e(n) : t(new w(
835
+ !n.status || !r || r(n.status) ? e(n) : t(new y(
836
836
  "Request failed with status code " + n.status,
837
- [w.ERR_BAD_REQUEST, w.ERR_BAD_RESPONSE][Math.floor(n.status / 100) - 4],
837
+ [y.ERR_BAD_REQUEST, y.ERR_BAD_RESPONSE][Math.floor(n.status / 100) - 4],
838
838
  n.config,
839
839
  n.request,
840
840
  n
@@ -851,13 +851,13 @@ function er(e, t) {
851
851
  return t = t !== void 0 ? t : 1e3, function(f) {
852
852
  const u = Date.now(), l = r[s];
853
853
  i || (i = u), n[o] = f, r[o] = u;
854
- let d = s, m = 0;
854
+ let d = s, w = 0;
855
855
  for (; d !== o; )
856
- m += n[d++], d = d % e;
856
+ w += n[d++], d = d % e;
857
857
  if (o = (o + 1) % e, o === s && (s = (s + 1) % e), u - i < t)
858
858
  return;
859
859
  const g = l && u - l;
860
- return g ? Math.round(m * 1e3 / g) : void 0;
860
+ return g ? Math.round(w * 1e3 / g) : void 0;
861
861
  };
862
862
  }
863
863
  function tr(e, t) {
@@ -942,14 +942,14 @@ const Me = (e) => e instanceof _ ? { ...e } : e;
942
942
  function B(e, t) {
943
943
  t = t || {};
944
944
  const n = {};
945
- function r(u, l, d, m) {
946
- return c.isPlainObject(u) && c.isPlainObject(l) ? c.merge.call({ caseless: m }, u, l) : c.isPlainObject(l) ? c.merge({}, l) : c.isArray(l) ? l.slice() : l;
945
+ function r(u, l, d, w) {
946
+ return c.isPlainObject(u) && c.isPlainObject(l) ? c.merge.call({ caseless: w }, u, l) : c.isPlainObject(l) ? c.merge({}, l) : c.isArray(l) ? l.slice() : l;
947
947
  }
948
- function o(u, l, d, m) {
948
+ function o(u, l, d, w) {
949
949
  if (c.isUndefined(l)) {
950
950
  if (!c.isUndefined(u))
951
- return r(void 0, u, d, m);
952
- } else return r(u, l, d, m);
951
+ return r(void 0, u, d, w);
952
+ } else return r(u, l, d, w);
953
953
  }
954
954
  function s(u, l) {
955
955
  if (!c.isUndefined(l))
@@ -999,8 +999,8 @@ function B(e, t) {
999
999
  headers: (u, l, d) => o(Me(u), Me(l), d, !0)
1000
1000
  };
1001
1001
  return c.forEach(Object.keys({ ...e, ...t }), function(l) {
1002
- const d = f[l] || o, m = d(e[l], t[l], l);
1003
- c.isUndefined(m) && d !== a || (n[l] = m);
1002
+ const d = f[l] || o, w = d(e[l], t[l], l);
1003
+ c.isUndefined(w) && d !== a || (n[l] = w);
1004
1004
  }), n;
1005
1005
  }
1006
1006
  const Ot = (e) => {
@@ -1029,8 +1029,8 @@ const Ot = (e) => {
1029
1029
  const o = Ot(e);
1030
1030
  let s = o.data;
1031
1031
  const i = _.from(o.headers).normalize();
1032
- let { responseType: a, onUploadProgress: f, onDownloadProgress: u } = o, l, d, m, g, p;
1033
- function y() {
1032
+ let { responseType: a, onUploadProgress: f, onDownloadProgress: u } = o, l, d, w, g, p;
1033
+ function m() {
1034
1034
  g && g(), p && p(), o.cancelToken && o.cancelToken.unsubscribe(l), o.signal && o.signal.removeEventListener("abort", l);
1035
1035
  }
1036
1036
  let h = new XMLHttpRequest();
@@ -1049,34 +1049,34 @@ const Ot = (e) => {
1049
1049
  request: h
1050
1050
  };
1051
1051
  St(function(F) {
1052
- n(F), y();
1052
+ n(F), m();
1053
1053
  }, function(F) {
1054
- r(F), y();
1054
+ r(F), m();
1055
1055
  }, O), h = null;
1056
1056
  }
1057
1057
  "onloadend" in h ? h.onloadend = E : h.onreadystatechange = function() {
1058
1058
  !h || h.readyState !== 4 || h.status === 0 && !(h.responseURL && h.responseURL.indexOf("file:") === 0) || setTimeout(E);
1059
1059
  }, h.onabort = function() {
1060
- h && (r(new w("Request aborted", w.ECONNABORTED, e, h)), h = null);
1060
+ h && (r(new y("Request aborted", y.ECONNABORTED, e, h)), h = null);
1061
1061
  }, h.onerror = function() {
1062
- r(new w("Network Error", w.ERR_NETWORK, e, h)), h = null;
1062
+ r(new y("Network Error", y.ERR_NETWORK, e, h)), h = null;
1063
1063
  }, h.ontimeout = function() {
1064
1064
  let k = o.timeout ? "timeout of " + o.timeout + "ms exceeded" : "timeout exceeded";
1065
1065
  const O = o.transitional || bt;
1066
- o.timeoutErrorMessage && (k = o.timeoutErrorMessage), r(new w(
1066
+ o.timeoutErrorMessage && (k = o.timeoutErrorMessage), r(new y(
1067
1067
  k,
1068
- O.clarifyTimeoutError ? w.ETIMEDOUT : w.ECONNABORTED,
1068
+ O.clarifyTimeoutError ? y.ETIMEDOUT : y.ECONNABORTED,
1069
1069
  e,
1070
1070
  h
1071
1071
  )), h = null;
1072
1072
  }, s === void 0 && i.setContentType(null), "setRequestHeader" in h && c.forEach(i.toJSON(), function(k, O) {
1073
1073
  h.setRequestHeader(O, k);
1074
- }), c.isUndefined(o.withCredentials) || (h.withCredentials = !!o.withCredentials), a && a !== "json" && (h.responseType = o.responseType), u && ([m, p] = re(u, !0), h.addEventListener("progress", m)), f && h.upload && ([d, g] = re(f), h.upload.addEventListener("progress", d), h.upload.addEventListener("loadend", g)), (o.cancelToken || o.signal) && (l = (S) => {
1074
+ }), c.isUndefined(o.withCredentials) || (h.withCredentials = !!o.withCredentials), a && a !== "json" && (h.responseType = o.responseType), u && ([w, p] = re(u, !0), h.addEventListener("progress", w)), f && h.upload && ([d, g] = re(f), h.upload.addEventListener("progress", d), h.upload.addEventListener("loadend", g)), (o.cancelToken || o.signal) && (l = (S) => {
1075
1075
  h && (r(!S || S.type ? new M(null, e, h) : S), h.abort(), h = null);
1076
1076
  }, o.cancelToken && o.cancelToken.subscribe(l), o.signal && (o.signal.aborted ? l() : o.signal.addEventListener("abort", l)));
1077
1077
  const R = Yn(o.url);
1078
1078
  if (R && T.protocols.indexOf(R) === -1) {
1079
- r(new w("Unsupported protocol " + R + ":", w.ERR_BAD_REQUEST, e));
1079
+ r(new y("Unsupported protocol " + R + ":", y.ERR_BAD_REQUEST, e));
1080
1080
  return;
1081
1081
  }
1082
1082
  h.send(s || null);
@@ -1089,11 +1089,11 @@ const Ot = (e) => {
1089
1089
  if (!o) {
1090
1090
  o = !0, a();
1091
1091
  const l = u instanceof Error ? u : this.reason;
1092
- r.abort(l instanceof w ? l : new M(l instanceof Error ? l.message : l));
1092
+ r.abort(l instanceof y ? l : new M(l instanceof Error ? l.message : l));
1093
1093
  }
1094
1094
  };
1095
1095
  let i = t && setTimeout(() => {
1096
- i = null, s(new w(`timeout ${t} of ms exceeded`, w.ETIMEDOUT));
1096
+ i = null, s(new y(`timeout ${t} of ms exceeded`, y.ETIMEDOUT));
1097
1097
  }, t);
1098
1098
  const a = () => {
1099
1099
  e && (i && clearTimeout(i), i = null, e.forEach((u) => {
@@ -1147,8 +1147,8 @@ const Ot = (e) => {
1147
1147
  }
1148
1148
  let d = l.byteLength;
1149
1149
  if (n) {
1150
- let m = s += d;
1151
- n(m);
1150
+ let w = s += d;
1151
+ n(w);
1152
1152
  }
1153
1153
  f.enqueue(new Uint8Array(l));
1154
1154
  } catch (u) {
@@ -1183,7 +1183,7 @@ const Ot = (e) => {
1183
1183
  le && ((e) => {
1184
1184
  ["text", "arrayBuffer", "blob", "formData", "stream"].forEach((t) => {
1185
1185
  !oe[t] && (oe[t] = c.isFunction(e[t]) ? (n) => n[t]() : (n, r) => {
1186
- throw new w(`Response type '${t}' is not supported`, w.ERR_NOT_SUPPORT, r);
1186
+ throw new y(`Response type '${t}' is not supported`, y.ERR_NOT_SUPPORT, r);
1187
1187
  });
1188
1188
  });
1189
1189
  })(new Response());
@@ -1217,11 +1217,11 @@ const hr = async (e) => {
1217
1217
  responseType: u,
1218
1218
  headers: l,
1219
1219
  withCredentials: d = "same-origin",
1220
- fetchOptions: m
1220
+ fetchOptions: w
1221
1221
  } = Ot(e);
1222
1222
  u = u ? (u + "").toLowerCase() : "text";
1223
1223
  let g = cr([o, s && s.toAbortSignal()], i), p;
1224
- const y = g && g.unsubscribe && (() => {
1224
+ const m = g && g.unsubscribe && (() => {
1225
1225
  g.unsubscribe();
1226
1226
  });
1227
1227
  let h;
@@ -1243,7 +1243,7 @@ const hr = async (e) => {
1243
1243
  c.isString(d) || (d = d ? "include" : "omit");
1244
1244
  const E = "credentials" in Request.prototype;
1245
1245
  p = new Request(t, {
1246
- ...m,
1246
+ ...w,
1247
1247
  signal: g,
1248
1248
  method: n.toUpperCase(),
1249
1249
  headers: l.normalize().toJSON(),
@@ -1251,9 +1251,9 @@ const hr = async (e) => {
1251
1251
  duplex: "half",
1252
1252
  credentials: E ? d : void 0
1253
1253
  });
1254
- let R = await fetch(p, m);
1254
+ let R = await fetch(p, w);
1255
1255
  const S = Ee && (u === "stream" || u === "response");
1256
- if (Ee && (a || S && y)) {
1256
+ if (Ee && (a || S && m)) {
1257
1257
  const O = {};
1258
1258
  ["status", "statusText", "headers"].forEach((Ne) => {
1259
1259
  O[Ne] = R[Ne];
@@ -1264,14 +1264,14 @@ const hr = async (e) => {
1264
1264
  ) || [];
1265
1265
  R = new Response(
1266
1266
  He(R.body, $e, F, () => {
1267
- X && X(), y && y();
1267
+ X && X(), m && m();
1268
1268
  }),
1269
1269
  O
1270
1270
  );
1271
1271
  }
1272
1272
  u = u || "text";
1273
1273
  let k = await oe[c.findKey(oe, u) || "text"](R, e);
1274
- return !S && y && y(), await new Promise((O, P) => {
1274
+ return !S && m && m(), await new Promise((O, P) => {
1275
1275
  St(O, P, {
1276
1276
  data: k,
1277
1277
  headers: _.from(R.headers),
@@ -1282,12 +1282,12 @@ const hr = async (e) => {
1282
1282
  });
1283
1283
  });
1284
1284
  } catch (E) {
1285
- throw y && y(), E && E.name === "TypeError" && /Load failed|fetch/i.test(E.message) ? Object.assign(
1286
- new w("Network Error", w.ERR_NETWORK, e, p),
1285
+ throw m && m(), E && E.name === "TypeError" && /Load failed|fetch/i.test(E.message) ? Object.assign(
1286
+ new y("Network Error", y.ERR_NETWORK, e, p),
1287
1287
  {
1288
1288
  cause: E.cause || E
1289
1289
  }
1290
- ) : w.from(E, E && E.code, e, p);
1290
+ ) : y.from(E, E && E.code, e, p);
1291
1291
  }
1292
1292
  }), Re = {
1293
1293
  http: Ln,
@@ -1313,7 +1313,7 @@ const ze = (e) => `- ${e}`, wr = (e) => c.isFunction(e) || e === null || e === !
1313
1313
  n = e[s];
1314
1314
  let i;
1315
1315
  if (r = n, !wr(n) && (r = Re[(i = String(n)).toLowerCase()], r === void 0))
1316
- throw new w(`Unknown adapter '${i}'`);
1316
+ throw new y(`Unknown adapter '${i}'`);
1317
1317
  if (r)
1318
1318
  break;
1319
1319
  o[i || "#" + s] = r;
@@ -1325,7 +1325,7 @@ const ze = (e) => `- ${e}`, wr = (e) => c.isFunction(e) || e === null || e === !
1325
1325
  let i = t ? s.length > 1 ? `since :
1326
1326
  ` + s.map(ze).join(`
1327
1327
  `) : " " + ze(s[0]) : "as no adapter specified";
1328
- throw new w(
1328
+ throw new y(
1329
1329
  "There is no suitable adapter to dispatch the request " + i,
1330
1330
  "ERR_NOT_SUPPORT"
1331
1331
  );
@@ -1369,9 +1369,9 @@ fe.transitional = function(t, n, r) {
1369
1369
  }
1370
1370
  return (s, i, a) => {
1371
1371
  if (t === !1)
1372
- throw new w(
1372
+ throw new y(
1373
1373
  o(i, " has been removed" + (n ? " in " + n : "")),
1374
- w.ERR_DEPRECATED
1374
+ y.ERR_DEPRECATED
1375
1375
  );
1376
1376
  return n && !Ve[i] && (Ve[i] = !0), t ? t(s, i, a) : !0;
1377
1377
  };
@@ -1381,7 +1381,7 @@ fe.spelling = function(t) {
1381
1381
  };
1382
1382
  function gr(e, t, n) {
1383
1383
  if (typeof e != "object")
1384
- throw new w("options must be an object", w.ERR_BAD_OPTION_VALUE);
1384
+ throw new y("options must be an object", y.ERR_BAD_OPTION_VALUE);
1385
1385
  const r = Object.keys(e);
1386
1386
  let o = r.length;
1387
1387
  for (; o-- > 0; ) {
@@ -1389,11 +1389,11 @@ function gr(e, t, n) {
1389
1389
  if (i) {
1390
1390
  const a = e[s], f = a === void 0 || i(a, s, e);
1391
1391
  if (f !== !0)
1392
- throw new w("option " + s + " must be " + f, w.ERR_BAD_OPTION_VALUE);
1392
+ throw new y("option " + s + " must be " + f, y.ERR_BAD_OPTION_VALUE);
1393
1393
  continue;
1394
1394
  }
1395
1395
  if (n !== !0)
1396
- throw new w("Unknown option " + s, w.ERR_BAD_OPTION);
1396
+ throw new y("Unknown option " + s, y.ERR_BAD_OPTION);
1397
1397
  }
1398
1398
  }
1399
1399
  const te = {
@@ -1460,28 +1460,28 @@ let I = class {
1460
1460
  ), n.headers = _.concat(i, s);
1461
1461
  const a = [];
1462
1462
  let f = !0;
1463
- this.interceptors.request.forEach(function(y) {
1464
- typeof y.runWhen == "function" && y.runWhen(n) === !1 || (f = f && y.synchronous, a.unshift(y.fulfilled, y.rejected));
1463
+ this.interceptors.request.forEach(function(m) {
1464
+ typeof m.runWhen == "function" && m.runWhen(n) === !1 || (f = f && m.synchronous, a.unshift(m.fulfilled, m.rejected));
1465
1465
  });
1466
1466
  const u = [];
1467
- this.interceptors.response.forEach(function(y) {
1468
- u.push(y.fulfilled, y.rejected);
1467
+ this.interceptors.response.forEach(function(m) {
1468
+ u.push(m.fulfilled, m.rejected);
1469
1469
  });
1470
- let l, d = 0, m;
1470
+ let l, d = 0, w;
1471
1471
  if (!f) {
1472
1472
  const p = [Je.bind(this), void 0];
1473
- for (p.unshift(...a), p.push(...u), m = p.length, l = Promise.resolve(n); d < m; )
1473
+ for (p.unshift(...a), p.push(...u), w = p.length, l = Promise.resolve(n); d < w; )
1474
1474
  l = l.then(p[d++], p[d++]);
1475
1475
  return l;
1476
1476
  }
1477
- m = a.length;
1477
+ w = a.length;
1478
1478
  let g = n;
1479
- for (d = 0; d < m; ) {
1480
- const p = a[d++], y = a[d++];
1479
+ for (d = 0; d < w; ) {
1480
+ const p = a[d++], m = a[d++];
1481
1481
  try {
1482
1482
  g = p(g);
1483
1483
  } catch (h) {
1484
- y.call(this, h);
1484
+ m.call(this, h);
1485
1485
  break;
1486
1486
  }
1487
1487
  }
@@ -1490,7 +1490,7 @@ let I = class {
1490
1490
  } catch (p) {
1491
1491
  return Promise.reject(p);
1492
1492
  }
1493
- for (d = 0, m = u.length; d < m; )
1493
+ for (d = 0, w = u.length; d < w; )
1494
1494
  l = l.then(u[d++], u[d++]);
1495
1495
  return l;
1496
1496
  }
@@ -1686,7 +1686,7 @@ b.CancelToken = br;
1686
1686
  b.isCancel = Rt;
1687
1687
  b.VERSION = Ct;
1688
1688
  b.toFormData = ue;
1689
- b.AxiosError = w;
1689
+ b.AxiosError = y;
1690
1690
  b.Cancel = b.CanceledError;
1691
1691
  b.all = function(t) {
1692
1692
  return Promise.all(t);
@@ -1808,12 +1808,12 @@ function _r(e, t = !0, n = !0, r = !1) {
1808
1808
  s && (clearTimeout(s), s = void 0, a(), a = Oe);
1809
1809
  };
1810
1810
  return (d) => {
1811
- const m = Ue(e), g = Date.now() - o, p = () => f = d();
1812
- return u(), m <= 0 ? (o = Date.now(), p()) : (g > m && (n || !i) ? (o = Date.now(), p()) : t && (f = new Promise((y, h) => {
1813
- a = r ? h : y, s = setTimeout(() => {
1814
- o = Date.now(), i = !0, y(p()), u();
1815
- }, Math.max(0, m - g));
1816
- })), !n && !s && (s = setTimeout(() => i = !0, m)), i = !1, f);
1811
+ const w = Ue(e), g = Date.now() - o, p = () => f = d();
1812
+ return u(), w <= 0 ? (o = Date.now(), p()) : (g > w && (n || !i) ? (o = Date.now(), p()) : t && (f = new Promise((m, h) => {
1813
+ a = r ? h : m, s = setTimeout(() => {
1814
+ o = Date.now(), i = !0, m(p()), u();
1815
+ }, Math.max(0, w - g));
1816
+ })), !n && !s && (s = setTimeout(() => i = !0, w)), i = !1, f);
1817
1817
  };
1818
1818
  }
1819
1819
  function xr(e) {
@@ -1835,8 +1835,8 @@ function Qe(...e) {
1835
1835
  Array.isArray(n) || (n = [n]), Array.isArray(r) || (r = [r]);
1836
1836
  const s = [], i = () => {
1837
1837
  s.forEach((l) => l()), s.length = 0;
1838
- }, a = (l, d, m, g) => (l.addEventListener(d, m, g), () => l.removeEventListener(d, m, g)), f = xe(() => [kr(t), Ue(o)], ([l, d]) => {
1839
- i(), l && s.push(...n.flatMap((m) => r.map((g) => a(l, m, g, d))));
1838
+ }, a = (l, d, w, g) => (l.addEventListener(d, w, g), () => l.removeEventListener(d, w, g)), f = xe(() => [kr(t), Ue(o)], ([l, d]) => {
1839
+ i(), l && s.push(...n.flatMap((w) => r.map((g) => a(l, w, g, d))));
1840
1840
  }, { immediate: !0, flush: "post" }), u = () => {
1841
1841
  f(), i();
1842
1842
  };
@@ -1859,8 +1859,8 @@ function Ur(e = Lr, t = {}) {
1859
1859
  });
1860
1860
  if (s) {
1861
1861
  const d = s.document;
1862
- for (const m of o)
1863
- Qe(s, m, l, { passive: !0 });
1862
+ for (const w of o)
1863
+ Qe(s, w, l, { passive: !0 });
1864
1864
  r && Qe(d, "visibilitychange", () => {
1865
1865
  d.hidden || l();
1866
1866
  });
@@ -2051,16 +2051,17 @@ const Hr = async () => {
2051
2051
  }
2052
2052
  }
2053
2053
  );
2054
- const { access_token: a = "", refresh_token: f = "", exp: u = 0, refresh_exp: l = 0 } = s.data, d = {
2054
+ const { access_token: a = "", refresh_token: f = "", exp: u = 0, refresh_exp: l = 0, expires_in: d = 0 } = s.data, w = {
2055
2055
  accessToken: a,
2056
2056
  exp: Number(u),
2057
2057
  accessTokenExpiredAt: Number(u),
2058
2058
  refreshToken: f,
2059
+ expires_in: Number(d),
2059
2060
  info: s.data
2060
2061
  };
2061
- J().save(d), await st(a);
2062
- const m = Number(l) - (/* @__PURE__ */ new Date()).getTime();
2063
- return m && m > 0 && (It(m), m && localStorage.setItem("idelTime", m.toString())), t && (window.__isAutoCloseApp = !1, window.location.replace(decodeURIComponent(t))), a;
2062
+ J().save(w), await st(a);
2063
+ const g = Number(l) - (/* @__PURE__ */ new Date()).getTime();
2064
+ return g && g > 0 && (It(g), g && localStorage.setItem("idelTime", g.toString())), t && (window.__isAutoCloseApp = !1, window.location.replace(decodeURIComponent(t))), a;
2064
2065
  } catch {
2065
2066
  return v({ ...N, redirect_uri: U });
2066
2067
  }
@@ -2158,14 +2159,15 @@ const Jr = async (e) => {
2158
2159
  nonce: Ft()
2159
2160
  }
2160
2161
  }
2161
- ), { access_token: o = "", refresh_token: s = "", exp: i = 0 } = r.data, a = {
2162
+ ), { access_token: o = "", refresh_token: s = "", exp: i = 0, expires_in: a = 0 } = r.data, f = {
2162
2163
  accessToken: o,
2163
2164
  exp: Number(i),
2164
2165
  accessTokenExpiredAt: Number(i),
2166
+ expires_in: Number(a),
2165
2167
  refreshToken: s,
2166
2168
  info: r.data
2167
2169
  };
2168
- return J().save(a), await st(o), o;
2170
+ return J().save(f), await st(o), o;
2169
2171
  } catch {
2170
2172
  return v({ ...e, redirect_uri: U });
2171
2173
  }
@@ -2179,6 +2181,7 @@ const Jr = async (e) => {
2179
2181
  Ht(e.accessToken ?? "", {
2180
2182
  exp: e.exp,
2181
2183
  accessTokenExpiredAt: e.accessTokenExpiredAt,
2184
+ expires_in: e.expires_in,
2182
2185
  refreshToken: e.refreshToken
2183
2186
  }), zt(e);
2184
2187
  },
@@ -2193,5 +2196,6 @@ export {
2193
2196
  N as getTokenParams,
2194
2197
  v as login,
2195
2198
  U as real_uri,
2199
+ Jr as refreshToken,
2196
2200
  J as tokenStorage
2197
2201
  };
Binary file
package/esm-map.json CHANGED
@@ -143,5 +143,6 @@
143
143
  "calcTextWidth": "/common-tools/calc-text-width/index",
144
144
  "getFileExtension": "/common-tools/get-file-extension/index",
145
145
  "getLanguages": "/common-info/index",
146
- "appendQueryParams": "/common-tools/get-url-params/index"
146
+ "appendQueryParams": "/common-tools/get-url-params/index",
147
+ "refreshToken": "/create-api-service/sso/index"
147
148
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@das-fed/utils",
3
- "version": "7.1.0-dev.12",
3
+ "version": "7.1.0-dev.13",
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.1.0-dev.12",
12
+ "@das-fed/utils": "7.1.0-dev.13",
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.1.0-dev.12",
25
- "@das-fed/web": "7.1.0-dev.12",
24
+ "@das-fed/cli": "7.1.0-dev.13",
25
+ "@das-fed/web": "7.1.0-dev.13",
26
26
  "@types/js-cookie": "^3.0.6",
27
27
  "@types/lodash-es": "^4.17.12",
28
28
  "@types/qs": "^6.9.15",
@@ -1,8 +1,9 @@
1
+ declare const expKey = "exp";
1
2
  declare const accessTokenExpiredAtKey = "accessTokenExpiredAt";
3
+ declare const expiresInKey = "expires_in";
2
4
  declare const refreshTokenKey = "refreshToken";
3
5
  declare const redirectUriKey = "redirectUri";
4
6
  declare const accessTokenInfoKey = "tokenInfo";
5
- declare const expKey = "exp";
6
7
  /**
7
8
  * 获取token
8
9
  * @returns token
@@ -11,7 +12,7 @@ export declare const getAccessToken: () => string;
11
12
  /**
12
13
  * 获取tokenInfo相关信息
13
14
  */
14
- type TokenInfoKey = typeof accessTokenExpiredAtKey | typeof refreshTokenKey | typeof redirectUriKey | typeof accessTokenInfoKey | typeof expKey;
15
+ type TokenInfoKey = typeof accessTokenExpiredAtKey | typeof refreshTokenKey | typeof redirectUriKey | typeof accessTokenInfoKey | typeof expKey | typeof expiresInKey;
15
16
  export declare const getAccessTokenInfo: (key: TokenInfoKey) => any;
16
17
  /**
17
18
  * 存入token、tokenInfo