@kohost/api-client 3.0.2 → 3.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/esm/defs.js CHANGED
@@ -437,7 +437,7 @@ var require_axios = __commonJS({
437
437
  __name(bind, "bind");
438
438
  var { toString } = Object.prototype;
439
439
  var { getPrototypeOf } = Object;
440
- var kindOf = ((cache) => (thing) => {
440
+ var kindOf = /* @__PURE__ */ ((cache) => (thing) => {
441
441
  const str = toString.call(thing);
442
442
  return cache[str] || (cache[str] = str.slice(8, -1).toLowerCase());
443
443
  })(/* @__PURE__ */ Object.create(null));
@@ -621,7 +621,7 @@ var require_axios = __commonJS({
621
621
  }
622
622
  return arr;
623
623
  }, "toArray");
624
- var isTypedArray = ((TypedArray) => {
624
+ var isTypedArray = /* @__PURE__ */ ((TypedArray) => {
625
625
  return (thing) => {
626
626
  return TypedArray && thing instanceof TypedArray;
627
627
  };
@@ -1632,47 +1632,34 @@ var require_axios = __commonJS({
1632
1632
  __name(settle, "settle");
1633
1633
  var cookies = platform.hasStandardBrowserEnv ? (
1634
1634
  // Standard browser envs support document.cookie
1635
- (/* @__PURE__ */ __name(function standardBrowserEnv() {
1636
- return {
1637
- write: /* @__PURE__ */ __name(function write(name, value, expires, path, domain, secure) {
1638
- const cookie = [];
1639
- cookie.push(name + "=" + encodeURIComponent(value));
1640
- if (utils$1.isNumber(expires)) {
1641
- cookie.push("expires=" + new Date(expires).toGMTString());
1642
- }
1643
- if (utils$1.isString(path)) {
1644
- cookie.push("path=" + path);
1645
- }
1646
- if (utils$1.isString(domain)) {
1647
- cookie.push("domain=" + domain);
1648
- }
1649
- if (secure === true) {
1650
- cookie.push("secure");
1651
- }
1652
- document.cookie = cookie.join("; ");
1653
- }, "write"),
1654
- read: /* @__PURE__ */ __name(function read(name) {
1655
- const match = document.cookie.match(new RegExp("(^|;\\s*)(" + name + ")=([^;]*)"));
1656
- return match ? decodeURIComponent(match[3]) : null;
1657
- }, "read"),
1658
- remove: /* @__PURE__ */ __name(function remove(name) {
1659
- this.write(name, "", Date.now() - 864e5);
1660
- }, "remove")
1661
- };
1662
- }, "standardBrowserEnv"))()
1635
+ {
1636
+ write(name, value, expires, path, domain, secure) {
1637
+ const cookie = [name + "=" + encodeURIComponent(value)];
1638
+ utils$1.isNumber(expires) && cookie.push("expires=" + new Date(expires).toGMTString());
1639
+ utils$1.isString(path) && cookie.push("path=" + path);
1640
+ utils$1.isString(domain) && cookie.push("domain=" + domain);
1641
+ secure === true && cookie.push("secure");
1642
+ document.cookie = cookie.join("; ");
1643
+ },
1644
+ read(name) {
1645
+ const match = document.cookie.match(new RegExp("(^|;\\s*)(" + name + ")=([^;]*)"));
1646
+ return match ? decodeURIComponent(match[3]) : null;
1647
+ },
1648
+ remove(name) {
1649
+ this.write(name, "", Date.now() - 864e5);
1650
+ }
1651
+ }
1663
1652
  ) : (
1664
- // Non standard browser env (web workers, react-native) lack needed support.
1665
- (/* @__PURE__ */ __name(function nonStandardBrowserEnv() {
1666
- return {
1667
- write: /* @__PURE__ */ __name(function write() {
1668
- }, "write"),
1669
- read: /* @__PURE__ */ __name(function read() {
1670
- return null;
1671
- }, "read"),
1672
- remove: /* @__PURE__ */ __name(function remove() {
1673
- }, "remove")
1674
- };
1675
- }, "nonStandardBrowserEnv"))()
1653
+ // Non-standard browser env (web workers, react-native) lack needed support.
1654
+ {
1655
+ write() {
1656
+ },
1657
+ read() {
1658
+ return null;
1659
+ },
1660
+ remove() {
1661
+ }
1662
+ }
1676
1663
  );
1677
1664
  function isAbsoluteURL(url) {
1678
1665
  return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(url);
@@ -1797,7 +1784,7 @@ var require_axios = __commonJS({
1797
1784
  return new Promise(/* @__PURE__ */ __name(function dispatchXhrRequest(resolve, reject) {
1798
1785
  let requestData = config.data;
1799
1786
  const requestHeaders = AxiosHeaders$1.from(config.headers).normalize();
1800
- const responseType = config.responseType;
1787
+ let { responseType, withXSRFToken } = config;
1801
1788
  let onCanceled;
1802
1789
  function done() {
1803
1790
  if (config.cancelToken) {
@@ -1891,9 +1878,12 @@ var require_axios = __commonJS({
1891
1878
  request = null;
1892
1879
  }, "handleTimeout");
1893
1880
  if (platform.hasStandardBrowserEnv) {
1894
- const xsrfValue = isURLSameOrigin(fullPath) && config.xsrfCookieName && cookies.read(config.xsrfCookieName);
1895
- if (xsrfValue) {
1896
- requestHeaders.set(config.xsrfHeaderName, xsrfValue);
1881
+ withXSRFToken && utils$1.isFunction(withXSRFToken) && (withXSRFToken = withXSRFToken(config));
1882
+ if (withXSRFToken || withXSRFToken !== false && isURLSameOrigin(fullPath)) {
1883
+ const xsrfValue = config.xsrfHeaderName && config.xsrfCookieName && cookies.read(config.xsrfCookieName);
1884
+ if (xsrfValue) {
1885
+ requestHeaders.set(config.xsrfHeaderName, xsrfValue);
1886
+ }
1897
1887
  }
1898
1888
  }
1899
1889
  requestData === void 0 && requestHeaders.setContentType(null);
@@ -2088,6 +2078,7 @@ var require_axios = __commonJS({
2088
2078
  timeout: defaultToConfig2,
2089
2079
  timeoutMessage: defaultToConfig2,
2090
2080
  withCredentials: defaultToConfig2,
2081
+ withXSRFToken: defaultToConfig2,
2091
2082
  adapter: defaultToConfig2,
2092
2083
  responseType: defaultToConfig2,
2093
2084
  xsrfCookieName: defaultToConfig2,
@@ -2115,7 +2106,7 @@ var require_axios = __commonJS({
2115
2106
  return config;
2116
2107
  }
2117
2108
  __name(mergeConfig, "mergeConfig");
2118
- var VERSION = "1.6.1";
2109
+ var VERSION = "1.6.2";
2119
2110
  var validators$1 = {};
2120
2111
  ["object", "boolean", "number", "function", "string", "symbol"].forEach((type, i) => {
2121
2112
  validators$1[type] = /* @__PURE__ */ __name(function validator2(thing) {