@next-feature/client 0.1.1-beta.6 → 0.1.2-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/index.js CHANGED
@@ -1,4 +1,4 @@
1
- function $t(t, e) {
1
+ function Bt(t, e) {
2
2
  return function() {
3
3
  return t.apply(e, arguments);
4
4
  };
@@ -20,12 +20,12 @@ const wr = Je("string"), L = Je("function"), Vt = Je("number"), Ke = (t) => t !=
20
20
  return !1;
21
21
  const e = vt(t);
22
22
  return (e === null || e === Object.prototype || Object.getPrototypeOf(e) === null) && !(zt in t) && !(He in t);
23
- }, kr = M("Date"), Er = M("File"), Rr = M("Blob"), Sr = M("FileList"), Tr = (t) => Ke(t) && L(t.pipe), Ar = (t) => {
23
+ }, kr = M("Date"), Rr = M("File"), Er = M("Blob"), Sr = M("FileList"), Tr = (t) => Ke(t) && L(t.pipe), Ar = (t) => {
24
24
  let e;
25
25
  return t && (typeof FormData == "function" && t instanceof FormData || L(t.append) && ((e = We(t)) === "formdata" || // detect form-data instance
26
26
  e === "object" && L(t.toString) && t.toString() === "[object FormData]"));
27
27
  }, Or = M("URLSearchParams"), [Cr, Nr, jr, Pr] = ["ReadableStream", "Request", "Response", "Headers"].map(M), Ir = (t) => t.trim ? t.trim() : t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, "");
28
- function Ee(t, e, { allOwnKeys: r = !1 } = {}) {
28
+ function Re(t, e, { allOwnKeys: r = !1 } = {}) {
29
29
  if (t === null || typeof t > "u")
30
30
  return;
31
31
  let n, s;
@@ -55,11 +55,11 @@ function st() {
55
55
  Te(e[i]) && Te(n) ? e[i] = st(e[i], n) : Te(n) ? e[i] = st({}, n) : he(n) ? e[i] = n.slice() : e[i] = n;
56
56
  };
57
57
  for (let n = 0, s = arguments.length; n < s; n++)
58
- arguments[n] && Ee(arguments[n], r);
58
+ arguments[n] && Re(arguments[n], r);
59
59
  return e;
60
60
  }
61
- const Dr = (t, e, r, { allOwnKeys: n } = {}) => (Ee(e, (s, i) => {
62
- r && L(s) ? t[i] = $t(s, r) : t[i] = s;
61
+ const Dr = (t, e, r, { allOwnKeys: n } = {}) => (Re(e, (s, i) => {
62
+ r && L(s) ? t[i] = Bt(s, r) : t[i] = s;
63
63
  }, { allOwnKeys: n }), t), Lr = (t) => (t.charCodeAt(0) === 65279 && (t = t.slice(1)), t), Ur = (t, e, r, n) => {
64
64
  t.prototype = Object.create(e.prototype, n), t.prototype.constructor = t, Object.defineProperty(t, "super", {
65
65
  value: e.prototype
@@ -87,7 +87,7 @@ const Dr = (t, e, r, { allOwnKeys: n } = {}) => (Ee(e, (s, i) => {
87
87
  for (; e-- > 0; )
88
88
  r[e] = t[e];
89
89
  return r;
90
- }, Br = /* @__PURE__ */ ((t) => (e) => t && e instanceof t)(typeof Uint8Array < "u" && vt(Uint8Array)), $r = (t, e) => {
90
+ }, $r = /* @__PURE__ */ ((t) => (e) => t && e instanceof t)(typeof Uint8Array < "u" && vt(Uint8Array)), Br = (t, e) => {
91
91
  const n = (t && t[He]).call(t);
92
92
  let s;
93
93
  for (; (s = n.next()) && !s.done; ) {
@@ -105,9 +105,9 @@ const Dr = (t, e, r, { allOwnKeys: n } = {}) => (Ee(e, (s, i) => {
105
105
  function(r, n, s) {
106
106
  return n.toUpperCase() + s;
107
107
  }
108
- ), Rt = (({ hasOwnProperty: t }) => (e, r) => t.call(e, r))(Object.prototype), Hr = M("RegExp"), Jt = (t, e) => {
108
+ ), Et = (({ hasOwnProperty: t }) => (e, r) => t.call(e, r))(Object.prototype), Hr = M("RegExp"), Jt = (t, e) => {
109
109
  const r = Object.getOwnPropertyDescriptors(t), n = {};
110
- Ee(r, (s, i) => {
110
+ Re(r, (s, i) => {
111
111
  let a;
112
112
  (a = e(s, i, t)) !== !1 && (n[i] = a || s);
113
113
  }), Object.defineProperties(t, n);
@@ -146,7 +146,7 @@ const Yr = (t) => {
146
146
  if (!("toJSON" in n)) {
147
147
  e[s] = n;
148
148
  const i = he(n) ? [] : {};
149
- return Ee(n, (a, o) => {
149
+ return Re(n, (a, o) => {
150
150
  const d = r(a, s + 1);
151
151
  !be(d) && (i[o] = d);
152
152
  }), e[s] = void 0, i;
@@ -179,15 +179,15 @@ const Yr = (t) => {
179
179
  isHeaders: Pr,
180
180
  isUndefined: be,
181
181
  isDate: kr,
182
- isFile: Er,
183
- isBlob: Rr,
182
+ isFile: Rr,
183
+ isBlob: Er,
184
184
  isRegExp: Hr,
185
185
  isFunction: L,
186
186
  isStream: Tr,
187
187
  isURLSearchParams: Or,
188
- isTypedArray: Br,
188
+ isTypedArray: $r,
189
189
  isFileList: Sr,
190
- forEach: Ee,
190
+ forEach: Re,
191
191
  merge: st,
192
192
  extend: Dr,
193
193
  trim: Ir,
@@ -198,11 +198,11 @@ const Yr = (t) => {
198
198
  kindOfTest: M,
199
199
  endsWith: Zr,
200
200
  toArray: Mr,
201
- forEachEntry: $r,
201
+ forEachEntry: Br,
202
202
  matchAll: zr,
203
203
  isHTMLForm: qr,
204
- hasOwnProperty: Rt,
205
- hasOwnProp: Rt,
204
+ hasOwnProperty: Et,
205
+ hasOwnProp: Et,
206
206
  // an alias to avoid ESLint no-prototype-builtins detection
207
207
  reduceDescriptors: Jt,
208
208
  freezeMethods: Wr,
@@ -519,7 +519,7 @@ function vn(t, e, r) {
519
519
  }
520
520
  return (r || JSON.stringify)(t);
521
521
  }
522
- const Re = {
522
+ const Ee = {
523
523
  transitional: tr,
524
524
  adapter: ["xhr", "http", "fetch"],
525
525
  transformRequest: [function(e, r) {
@@ -548,7 +548,7 @@ const Re = {
548
548
  return i || s ? (r.setContentType("application/json", !1), vn(e)) : e;
549
549
  }],
550
550
  transformResponse: [function(e) {
551
- const r = this.transitional || Re.transitional, n = r && r.forcedJSONParsing, s = this.responseType === "json";
551
+ const r = this.transitional || Ee.transitional, n = r && r.forcedJSONParsing, s = this.responseType === "json";
552
552
  if (u.isResponse(e) || u.isReadableStream(e))
553
553
  return e;
554
554
  if (e && u.isString(e) && (n && !this.responseType || s)) {
@@ -586,7 +586,7 @@ const Re = {
586
586
  }
587
587
  };
588
588
  u.forEach(["delete", "get", "head", "post", "put", "patch"], (t) => {
589
- Re.headers[t] = {};
589
+ Ee.headers[t] = {};
590
590
  });
591
591
  const bn = u.toObjectSet([
592
592
  "age",
@@ -638,10 +638,10 @@ function et(t, e, r, n, s) {
638
638
  return n.test(e);
639
639
  }
640
640
  }
641
- function En(t) {
641
+ function Rn(t) {
642
642
  return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g, (e, r, n) => r.toUpperCase() + n);
643
643
  }
644
- function Rn(t, e) {
644
+ function En(t, e) {
645
645
  const r = u.toCamelCase(" " + e);
646
646
  ["get", "set", "has"].forEach((n) => {
647
647
  Object.defineProperty(t, n + r, {
@@ -734,7 +734,7 @@ let U = class {
734
734
  r[a] = Ae(s), delete r[i];
735
735
  return;
736
736
  }
737
- const o = e ? En(i) : String(i).trim();
737
+ const o = e ? Rn(i) : String(i).trim();
738
738
  o !== i && delete r[i], r[o] = Ae(s), n[o] = !0;
739
739
  }), this;
740
740
  }
@@ -773,7 +773,7 @@ let U = class {
773
773
  }).accessors, s = this.prototype;
774
774
  function i(a) {
775
775
  const o = me(a);
776
- n[o] || (Rn(s, a), n[o] = !0);
776
+ n[o] || (En(s, a), n[o] = !0);
777
777
  }
778
778
  return u.isArray(e) ? e.forEach(i) : i(e), this;
779
779
  }
@@ -790,7 +790,7 @@ u.reduceDescriptors(U.prototype, ({ value: t }, e) => {
790
790
  });
791
791
  u.freezeMethods(U);
792
792
  function tt(t, e) {
793
- const r = this || Re, n = e || r, s = U.from(n.headers);
793
+ const r = this || Ee, n = e || r, s = U.from(n.headers);
794
794
  let i = n.data;
795
795
  return u.forEach(t, function(o) {
796
796
  i = o.call(r, i, s.normalize(), e ? e.status : void 0);
@@ -1162,7 +1162,7 @@ Ge && ((t) => {
1162
1162
  });
1163
1163
  });
1164
1164
  })(new Response());
1165
- const Bn = async (t) => {
1165
+ const $n = async (t) => {
1166
1166
  if (t == null)
1167
1167
  return 0;
1168
1168
  if (u.isBlob(t))
@@ -1176,9 +1176,9 @@ const Bn = async (t) => {
1176
1176
  return t.byteLength;
1177
1177
  if (u.isURLSearchParams(t) && (t = t + ""), u.isString(t))
1178
1178
  return (await Zn(t)).byteLength;
1179
- }, $n = async (t, e) => {
1179
+ }, Bn = async (t, e) => {
1180
1180
  const r = u.toFiniteNumber(t.getContentLength());
1181
- return r ?? Bn(e);
1181
+ return r ?? $n(e);
1182
1182
  }, zn = Ge && (async (t) => {
1183
1183
  let {
1184
1184
  url: e,
@@ -1201,7 +1201,7 @@ const Bn = async (t) => {
1201
1201
  });
1202
1202
  let _;
1203
1203
  try {
1204
- if (d && Mn && r !== "get" && r !== "head" && (_ = await $n(l, n)) !== 0) {
1204
+ if (d && Mn && r !== "get" && r !== "head" && (_ = await Bn(l, n)) !== 0) {
1205
1205
  let D = new Request(e, {
1206
1206
  method: "POST",
1207
1207
  body: n,
@@ -1230,8 +1230,8 @@ const Bn = async (t) => {
1230
1230
  const j = ot && (c === "stream" || c === "response");
1231
1231
  if (ot && (o || j && k)) {
1232
1232
  const D = {};
1233
- ["status", "statusText", "headers"].forEach((Et) => {
1234
- D[Et] = N[Et];
1233
+ ["status", "statusText", "headers"].forEach((Rt) => {
1234
+ D[Rt] = N[Rt];
1235
1235
  });
1236
1236
  const X = u.toFiniteNumber(N.headers.get("content-length")), [Q, Se] = o && Ct(
1237
1237
  X,
@@ -1317,7 +1317,7 @@ function Lt(t) {
1317
1317
  return rt(t), t.headers = U.from(t.headers), t.data = tt.call(
1318
1318
  t,
1319
1319
  t.transformRequest
1320
- ), ["post", "put", "patch"].indexOf(t.method) !== -1 && t.headers.setContentType("application/x-www-form-urlencoded", !1), ur.getAdapter(t.adapter || Re.adapter)(t).then(function(n) {
1320
+ ), ["post", "put", "patch"].indexOf(t.method) !== -1 && t.headers.setContentType("application/x-www-form-urlencoded", !1), ur.getAdapter(t.adapter || Ee.adapter)(t).then(function(n) {
1321
1321
  return rt(t), n.data = tt.call(
1322
1322
  t,
1323
1323
  t.transformResponse,
@@ -1379,7 +1379,7 @@ function Vn(t, e, r) {
1379
1379
  const Oe = {
1380
1380
  assertOptions: Vn,
1381
1381
  validators: Ye
1382
- }, B = Oe.validators;
1382
+ }, $ = Oe.validators;
1383
1383
  let te = class {
1384
1384
  constructor(e) {
1385
1385
  this.defaults = e || {}, this.interceptors = {
@@ -1416,17 +1416,17 @@ let te = class {
1416
1416
  typeof e == "string" ? (r = r || {}, r.url = e) : r = e || {}, r = re(this.defaults, r);
1417
1417
  const { transitional: n, paramsSerializer: s, headers: i } = r;
1418
1418
  n !== void 0 && Oe.assertOptions(n, {
1419
- silentJSONParsing: B.transitional(B.boolean),
1420
- forcedJSONParsing: B.transitional(B.boolean),
1421
- clarifyTimeoutError: B.transitional(B.boolean)
1419
+ silentJSONParsing: $.transitional($.boolean),
1420
+ forcedJSONParsing: $.transitional($.boolean),
1421
+ clarifyTimeoutError: $.transitional($.boolean)
1422
1422
  }, !1), s != null && (u.isFunction(s) ? r.paramsSerializer = {
1423
1423
  serialize: s
1424
1424
  } : Oe.assertOptions(s, {
1425
- encode: B.function,
1426
- serialize: B.function
1425
+ encode: $.function,
1426
+ serialize: $.function
1427
1427
  }, !0)), r.allowAbsoluteUrls !== void 0 || (this.defaults.allowAbsoluteUrls !== void 0 ? r.allowAbsoluteUrls = this.defaults.allowAbsoluteUrls : r.allowAbsoluteUrls = !0), Oe.assertOptions(r, {
1428
- baseUrl: B.spelling("baseURL"),
1429
- withXsrfToken: B.spelling("withXSRFToken")
1428
+ baseUrl: $.spelling("baseURL"),
1429
+ withXsrfToken: $.spelling("withXSRFToken")
1430
1430
  }, !0), r.method = (r.method || this.defaults.method || "get").toLowerCase();
1431
1431
  let a = i && u.merge(
1432
1432
  i.common,
@@ -1654,12 +1654,12 @@ Object.entries(ut).forEach(([t, e]) => {
1654
1654
  ut[e] = t;
1655
1655
  });
1656
1656
  function fr(t) {
1657
- const e = new te(t), r = $t(te.prototype.request, e);
1657
+ const e = new te(t), r = Bt(te.prototype.request, e);
1658
1658
  return u.extend(r, te.prototype, e, { allOwnKeys: !0 }), u.extend(r, e, null, { allOwnKeys: !0 }), r.create = function(s) {
1659
1659
  return fr(re(t, s));
1660
1660
  }, r;
1661
1661
  }
1662
- const C = fr(Re);
1662
+ const C = fr(Ee);
1663
1663
  C.Axios = te;
1664
1664
  C.CanceledError = pe;
1665
1665
  C.CancelToken = Hn;
@@ -1680,24 +1680,24 @@ C.getAdapter = ur.getAdapter;
1680
1680
  C.HttpStatusCode = ut;
1681
1681
  C.default = C;
1682
1682
  const {
1683
- Axios: Es,
1683
+ Axios: Ss,
1684
1684
  AxiosError: Kn,
1685
- CanceledError: Rs,
1686
- isCancel: Ss,
1687
- CancelToken: Ts,
1688
- VERSION: As,
1689
- all: Os,
1690
- Cancel: Cs,
1691
- isAxiosError: Ns,
1692
- spread: js,
1693
- toFormData: Ps,
1694
- AxiosHeaders: Is,
1685
+ CanceledError: Ts,
1686
+ isCancel: As,
1687
+ CancelToken: Os,
1688
+ VERSION: Cs,
1689
+ all: Ns,
1690
+ Cancel: js,
1691
+ isAxiosError: Ps,
1692
+ spread: Is,
1693
+ toFormData: Ds,
1694
+ AxiosHeaders: Ls,
1695
1695
  HttpStatusCode: xt,
1696
- formToJSON: Ds,
1697
- getAdapter: Ls,
1698
- mergeConfig: Us
1696
+ formToJSON: Us,
1697
+ getAdapter: Fs,
1698
+ mergeConfig: Zs
1699
1699
  } = C;
1700
- var R;
1700
+ var E;
1701
1701
  (function(t) {
1702
1702
  t.assertEqual = (s) => s;
1703
1703
  function e(s) {
@@ -1732,7 +1732,7 @@ var R;
1732
1732
  return s.map((a) => typeof a == "string" ? `'${a}'` : a).join(i);
1733
1733
  }
1734
1734
  t.joinValues = n, t.jsonStringifyReplacer = (s, i) => typeof i == "bigint" ? i.toString() : i;
1735
- })(R || (R = {}));
1735
+ })(E || (E = {}));
1736
1736
  var Ft;
1737
1737
  (function(t) {
1738
1738
  t.mergeShapes = (e, r) => ({
@@ -1741,7 +1741,7 @@ var Ft;
1741
1741
  // second overwrites first
1742
1742
  });
1743
1743
  })(Ft || (Ft = {}));
1744
- const p = R.arrayToEnum([
1744
+ const p = E.arrayToEnum([
1745
1745
  "string",
1746
1746
  "nan",
1747
1747
  "number",
@@ -1783,7 +1783,7 @@ const p = R.arrayToEnum([
1783
1783
  default:
1784
1784
  return p.unknown;
1785
1785
  }
1786
- }, f = R.arrayToEnum([
1786
+ }, f = E.arrayToEnum([
1787
1787
  "invalid_type",
1788
1788
  "invalid_literal",
1789
1789
  "custom",
@@ -1845,7 +1845,7 @@ class Z extends Error {
1845
1845
  return this.message;
1846
1846
  }
1847
1847
  get message() {
1848
- return JSON.stringify(this.issues, R.jsonStringifyReplacer, 2);
1848
+ return JSON.stringify(this.issues, E.jsonStringifyReplacer, 2);
1849
1849
  }
1850
1850
  get isEmpty() {
1851
1851
  return this.issues.length === 0;
@@ -1868,19 +1868,19 @@ const we = (t, e) => {
1868
1868
  t.received === p.undefined ? r = "Required" : r = `Expected ${t.expected}, received ${t.received}`;
1869
1869
  break;
1870
1870
  case f.invalid_literal:
1871
- r = `Invalid literal value, expected ${JSON.stringify(t.expected, R.jsonStringifyReplacer)}`;
1871
+ r = `Invalid literal value, expected ${JSON.stringify(t.expected, E.jsonStringifyReplacer)}`;
1872
1872
  break;
1873
1873
  case f.unrecognized_keys:
1874
- r = `Unrecognized key(s) in object: ${R.joinValues(t.keys, ", ")}`;
1874
+ r = `Unrecognized key(s) in object: ${E.joinValues(t.keys, ", ")}`;
1875
1875
  break;
1876
1876
  case f.invalid_union:
1877
1877
  r = "Invalid input";
1878
1878
  break;
1879
1879
  case f.invalid_union_discriminator:
1880
- r = `Invalid discriminator value. Expected ${R.joinValues(t.options)}`;
1880
+ r = `Invalid discriminator value. Expected ${E.joinValues(t.options)}`;
1881
1881
  break;
1882
1882
  case f.invalid_enum_value:
1883
- r = `Invalid enum value. Expected ${R.joinValues(t.options)}, received '${t.received}'`;
1883
+ r = `Invalid enum value. Expected ${E.joinValues(t.options)}, received '${t.received}'`;
1884
1884
  break;
1885
1885
  case f.invalid_arguments:
1886
1886
  r = "Invalid function arguments";
@@ -1892,7 +1892,7 @@ const we = (t, e) => {
1892
1892
  r = "Invalid date";
1893
1893
  break;
1894
1894
  case f.invalid_string:
1895
- typeof t.validation == "object" ? "includes" in t.validation ? (r = `Invalid input: must include "${t.validation.includes}"`, typeof t.validation.position == "number" && (r = `${r} at one or more positions greater than or equal to ${t.validation.position}`)) : "startsWith" in t.validation ? r = `Invalid input: must start with "${t.validation.startsWith}"` : "endsWith" in t.validation ? r = `Invalid input: must end with "${t.validation.endsWith}"` : R.assertNever(t.validation) : t.validation !== "regex" ? r = `Invalid ${t.validation}` : r = "Invalid";
1895
+ typeof t.validation == "object" ? "includes" in t.validation ? (r = `Invalid input: must include "${t.validation.includes}"`, typeof t.validation.position == "number" && (r = `${r} at one or more positions greater than or equal to ${t.validation.position}`)) : "startsWith" in t.validation ? r = `Invalid input: must start with "${t.validation.startsWith}"` : "endsWith" in t.validation ? r = `Invalid input: must end with "${t.validation.endsWith}"` : E.assertNever(t.validation) : t.validation !== "regex" ? r = `Invalid ${t.validation}` : r = "Invalid";
1896
1896
  break;
1897
1897
  case f.too_small:
1898
1898
  t.type === "array" ? r = `Array must contain ${t.exact ? "exactly" : t.inclusive ? "at least" : "more than"} ${t.minimum} element(s)` : t.type === "string" ? r = `String must contain ${t.exact ? "exactly" : t.inclusive ? "at least" : "over"} ${t.minimum} character(s)` : t.type === "number" ? r = `Number must be ${t.exact ? "exactly equal to " : t.inclusive ? "greater than or equal to " : "greater than "}${t.minimum}` : t.type === "date" ? r = `Date must be ${t.exact ? "exactly equal to " : t.inclusive ? "greater than or equal to " : "greater than "}${new Date(Number(t.minimum))}` : r = "Invalid input";
@@ -1913,7 +1913,7 @@ const we = (t, e) => {
1913
1913
  r = "Number must be finite";
1914
1914
  break;
1915
1915
  default:
1916
- r = e.defaultError, R.assertNever(t);
1916
+ r = e.defaultError, E.assertNever(t);
1917
1917
  }
1918
1918
  return { message: r };
1919
1919
  };
@@ -2025,7 +2025,7 @@ class z {
2025
2025
  return this._cachedPath.length || (this._key instanceof Array ? this._cachedPath.push(...this._path, ...this._key) : this._cachedPath.push(...this._path, this._key)), this._cachedPath;
2026
2026
  }
2027
2027
  }
2028
- const Bt = (t, e) => {
2028
+ const $t = (t, e) => {
2029
2029
  if (ue(e))
2030
2030
  return { success: !0, data: e.value };
2031
2031
  if (!t.common.issues.length)
@@ -2052,7 +2052,7 @@ function x(t) {
2052
2052
  return a.code === "invalid_enum_value" ? { message: l ?? o.defaultError } : typeof o.data > "u" ? { message: (d = l ?? n) !== null && d !== void 0 ? d : o.defaultError } : a.code !== "invalid_type" ? { message: o.defaultError } : { message: (c = l ?? r) !== null && c !== void 0 ? c : o.defaultError };
2053
2053
  }, description: s };
2054
2054
  }
2055
- class E {
2055
+ class R {
2056
2056
  get description() {
2057
2057
  return this._def.description;
2058
2058
  }
@@ -2112,7 +2112,7 @@ class E {
2112
2112
  data: e,
2113
2113
  parsedType: G(e)
2114
2114
  }, i = this._parseSync({ data: e, path: s.path, parent: s });
2115
- return Bt(s, i);
2115
+ return $t(s, i);
2116
2116
  }
2117
2117
  "~validate"(e) {
2118
2118
  var r, n;
@@ -2166,7 +2166,7 @@ class E {
2166
2166
  data: e,
2167
2167
  parsedType: G(e)
2168
2168
  }, s = this._parse({ data: e, path: n.path, parent: n }), i = await (je(s) ? s : Promise.resolve(s));
2169
- return Bt(n, i);
2169
+ return $t(n, i);
2170
2170
  }
2171
2171
  refine(e, r) {
2172
2172
  const n = (s) => typeof r == "string" || typeof r > "u" ? { message: r } : typeof r == "function" ? r(s) : r;
@@ -2208,7 +2208,7 @@ class E {
2208
2208
  return this.nullable().optional();
2209
2209
  }
2210
2210
  array() {
2211
- return $.create(this);
2211
+ return B.create(this);
2212
2212
  }
2213
2213
  promise() {
2214
2214
  return ke.create(this, this._def);
@@ -2229,7 +2229,7 @@ class E {
2229
2229
  }
2230
2230
  default(e) {
2231
2231
  const r = typeof e == "function" ? e : () => e;
2232
- return new $e({
2232
+ return new Be({
2233
2233
  ...x(this._def),
2234
2234
  innerType: this,
2235
2235
  defaultValue: r,
@@ -2305,7 +2305,7 @@ function ys(t, e) {
2305
2305
  function gs(t, e) {
2306
2306
  return !!((e === "v4" || !e) && os.test(t) || (e === "v6" || !e) && us.test(t));
2307
2307
  }
2308
- class H extends E {
2308
+ class H extends R {
2309
2309
  _parse(e) {
2310
2310
  if (this._def.coerce && (e.data = String(e.data)), this._getType(e) !== p.string) {
2311
2311
  const i = this._getOrReturnCtx(e);
@@ -2457,7 +2457,7 @@ class H extends E {
2457
2457
  validation: "base64url",
2458
2458
  code: f.invalid_string,
2459
2459
  message: i.message
2460
- }), n.dirty()) : R.assertNever(i);
2460
+ }), n.dirty()) : E.assertNever(i);
2461
2461
  return { status: n.value, value: e.data };
2462
2462
  }
2463
2463
  _regex(e, r, n) {
@@ -2696,7 +2696,7 @@ function _s(t, e) {
2696
2696
  const r = (t.toString().split(".")[1] || "").length, n = (e.toString().split(".")[1] || "").length, s = r > n ? r : n, i = parseInt(t.toFixed(s).replace(".", "")), a = parseInt(e.toFixed(s).replace(".", ""));
2697
2697
  return i % a / Math.pow(10, s);
2698
2698
  }
2699
- class le extends E {
2699
+ class le extends R {
2700
2700
  constructor() {
2701
2701
  super(...arguments), this.min = this.gte, this.max = this.lte, this.step = this.multipleOf;
2702
2702
  }
@@ -2712,7 +2712,7 @@ class le extends E {
2712
2712
  let n;
2713
2713
  const s = new I();
2714
2714
  for (const i of this._def.checks)
2715
- i.kind === "int" ? R.isInteger(e.data) || (n = this._getOrReturnCtx(e, n), h(n, {
2715
+ i.kind === "int" ? E.isInteger(e.data) || (n = this._getOrReturnCtx(e, n), h(n, {
2716
2716
  code: f.invalid_type,
2717
2717
  expected: "integer",
2718
2718
  received: "float",
@@ -2738,7 +2738,7 @@ class le extends E {
2738
2738
  }), s.dirty()) : i.kind === "finite" ? Number.isFinite(e.data) || (n = this._getOrReturnCtx(e, n), h(n, {
2739
2739
  code: f.not_finite,
2740
2740
  message: i.message
2741
- }), s.dirty()) : R.assertNever(i);
2741
+ }), s.dirty()) : E.assertNever(i);
2742
2742
  return { status: s.value, value: e.data };
2743
2743
  }
2744
2744
  gte(e, r) {
@@ -2850,7 +2850,7 @@ class le extends E {
2850
2850
  return e;
2851
2851
  }
2852
2852
  get isInt() {
2853
- return !!this._def.checks.find((e) => e.kind === "int" || e.kind === "multipleOf" && R.isInteger(e.value));
2853
+ return !!this._def.checks.find((e) => e.kind === "int" || e.kind === "multipleOf" && E.isInteger(e.value));
2854
2854
  }
2855
2855
  get isFinite() {
2856
2856
  let e = null, r = null;
@@ -2868,7 +2868,7 @@ le.create = (t) => new le({
2868
2868
  coerce: t?.coerce || !1,
2869
2869
  ...x(t)
2870
2870
  });
2871
- class de extends E {
2871
+ class de extends R {
2872
2872
  constructor() {
2873
2873
  super(...arguments), this.min = this.gte, this.max = this.lte;
2874
2874
  }
@@ -2900,7 +2900,7 @@ class de extends E {
2900
2900
  code: f.not_multiple_of,
2901
2901
  multipleOf: i.value,
2902
2902
  message: i.message
2903
- }), s.dirty()) : R.assertNever(i);
2903
+ }), s.dirty()) : E.assertNever(i);
2904
2904
  return { status: s.value, value: e.data };
2905
2905
  }
2906
2906
  _getInvalidInput(e) {
@@ -3004,7 +3004,7 @@ de.create = (t) => {
3004
3004
  ...x(t)
3005
3005
  });
3006
3006
  };
3007
- class ft extends E {
3007
+ class ft extends R {
3008
3008
  _parse(e) {
3009
3009
  if (this._def.coerce && (e.data = !!e.data), this._getType(e) !== p.boolean) {
3010
3010
  const n = this._getOrReturnCtx(e);
@@ -3022,7 +3022,7 @@ ft.create = (t) => new ft({
3022
3022
  coerce: t?.coerce || !1,
3023
3023
  ...x(t)
3024
3024
  });
3025
- class xe extends E {
3025
+ class xe extends R {
3026
3026
  _parse(e) {
3027
3027
  if (this._def.coerce && (e.data = new Date(e.data)), this._getType(e) !== p.date) {
3028
3028
  const i = this._getOrReturnCtx(e);
@@ -3055,7 +3055,7 @@ class xe extends E {
3055
3055
  exact: !1,
3056
3056
  maximum: i.value,
3057
3057
  type: "date"
3058
- }), n.dirty()) : R.assertNever(i);
3058
+ }), n.dirty()) : E.assertNever(i);
3059
3059
  return {
3060
3060
  status: n.value,
3061
3061
  value: new Date(e.data.getTime())
@@ -3100,7 +3100,7 @@ xe.create = (t) => new xe({
3100
3100
  typeName: v.ZodDate,
3101
3101
  ...x(t)
3102
3102
  });
3103
- class ht extends E {
3103
+ class ht extends R {
3104
3104
  _parse(e) {
3105
3105
  if (this._getType(e) !== p.symbol) {
3106
3106
  const n = this._getOrReturnCtx(e);
@@ -3117,7 +3117,7 @@ ht.create = (t) => new ht({
3117
3117
  typeName: v.ZodSymbol,
3118
3118
  ...x(t)
3119
3119
  });
3120
- class Ie extends E {
3120
+ class Ie extends R {
3121
3121
  _parse(e) {
3122
3122
  if (this._getType(e) !== p.undefined) {
3123
3123
  const n = this._getOrReturnCtx(e);
@@ -3134,7 +3134,7 @@ Ie.create = (t) => new Ie({
3134
3134
  typeName: v.ZodUndefined,
3135
3135
  ...x(t)
3136
3136
  });
3137
- class De extends E {
3137
+ class De extends R {
3138
3138
  _parse(e) {
3139
3139
  if (this._getType(e) !== p.null) {
3140
3140
  const n = this._getOrReturnCtx(e);
@@ -3151,7 +3151,7 @@ De.create = (t) => new De({
3151
3151
  typeName: v.ZodNull,
3152
3152
  ...x(t)
3153
3153
  });
3154
- class pt extends E {
3154
+ class pt extends R {
3155
3155
  constructor() {
3156
3156
  super(...arguments), this._any = !0;
3157
3157
  }
@@ -3163,7 +3163,7 @@ pt.create = (t) => new pt({
3163
3163
  typeName: v.ZodAny,
3164
3164
  ...x(t)
3165
3165
  });
3166
- class ce extends E {
3166
+ class ce extends R {
3167
3167
  constructor() {
3168
3168
  super(...arguments), this._unknown = !0;
3169
3169
  }
@@ -3175,7 +3175,7 @@ ce.create = (t) => new ce({
3175
3175
  typeName: v.ZodUnknown,
3176
3176
  ...x(t)
3177
3177
  });
3178
- class Y extends E {
3178
+ class Y extends R {
3179
3179
  _parse(e) {
3180
3180
  const r = this._getOrReturnCtx(e);
3181
3181
  return h(r, {
@@ -3189,7 +3189,7 @@ Y.create = (t) => new Y({
3189
3189
  typeName: v.ZodNever,
3190
3190
  ...x(t)
3191
3191
  });
3192
- class mt extends E {
3192
+ class mt extends R {
3193
3193
  _parse(e) {
3194
3194
  if (this._getType(e) !== p.undefined) {
3195
3195
  const n = this._getOrReturnCtx(e);
@@ -3206,7 +3206,7 @@ mt.create = (t) => new mt({
3206
3206
  typeName: v.ZodVoid,
3207
3207
  ...x(t)
3208
3208
  });
3209
- class $ extends E {
3209
+ class B extends R {
3210
3210
  _parse(e) {
3211
3211
  const { ctx: r, status: n } = this._processInputParams(e), s = this._def;
3212
3212
  if (r.parsedType !== p.array)
@@ -3250,19 +3250,19 @@ class $ extends E {
3250
3250
  return this._def.type;
3251
3251
  }
3252
3252
  min(e, r) {
3253
- return new $({
3253
+ return new B({
3254
3254
  ...this._def,
3255
3255
  minLength: { value: e, message: y.toString(r) }
3256
3256
  });
3257
3257
  }
3258
3258
  max(e, r) {
3259
- return new $({
3259
+ return new B({
3260
3260
  ...this._def,
3261
3261
  maxLength: { value: e, message: y.toString(r) }
3262
3262
  });
3263
3263
  }
3264
3264
  length(e, r) {
3265
- return new $({
3265
+ return new B({
3266
3266
  ...this._def,
3267
3267
  exactLength: { value: e, message: y.toString(r) }
3268
3268
  });
@@ -3271,7 +3271,7 @@ class $ extends E {
3271
3271
  return this.min(1, e);
3272
3272
  }
3273
3273
  }
3274
- $.create = (t, e) => new $({
3274
+ B.create = (t, e) => new B({
3275
3275
  type: t,
3276
3276
  minLength: null,
3277
3277
  maxLength: null,
@@ -3290,19 +3290,19 @@ function ae(t) {
3290
3290
  ...t._def,
3291
3291
  shape: () => e
3292
3292
  });
3293
- } else return t instanceof $ ? new $({
3293
+ } else return t instanceof B ? new B({
3294
3294
  ...t._def,
3295
3295
  type: ae(t.element)
3296
3296
  }) : t instanceof W ? W.create(ae(t.unwrap())) : t instanceof se ? se.create(ae(t.unwrap())) : t instanceof J ? J.create(t.items.map((e) => ae(e))) : t;
3297
3297
  }
3298
- class A extends E {
3298
+ class A extends R {
3299
3299
  constructor() {
3300
3300
  super(...arguments), this._cached = null, this.nonstrict = this.passthrough, this.augment = this.extend;
3301
3301
  }
3302
3302
  _getCached() {
3303
3303
  if (this._cached !== null)
3304
3304
  return this._cached;
3305
- const e = this._def.shape(), r = R.objectKeys(e);
3305
+ const e = this._def.shape(), r = E.objectKeys(e);
3306
3306
  return this._cached = { shape: e, keys: r };
3307
3307
  }
3308
3308
  _parse(e) {
@@ -3509,7 +3509,7 @@ class A extends E {
3509
3509
  }
3510
3510
  pick(e) {
3511
3511
  const r = {};
3512
- return R.objectKeys(e).forEach((n) => {
3512
+ return E.objectKeys(e).forEach((n) => {
3513
3513
  e[n] && this.shape[n] && (r[n] = this.shape[n]);
3514
3514
  }), new A({
3515
3515
  ...this._def,
@@ -3518,7 +3518,7 @@ class A extends E {
3518
3518
  }
3519
3519
  omit(e) {
3520
3520
  const r = {};
3521
- return R.objectKeys(this.shape).forEach((n) => {
3521
+ return E.objectKeys(this.shape).forEach((n) => {
3522
3522
  e[n] || (r[n] = this.shape[n]);
3523
3523
  }), new A({
3524
3524
  ...this._def,
@@ -3533,7 +3533,7 @@ class A extends E {
3533
3533
  }
3534
3534
  partial(e) {
3535
3535
  const r = {};
3536
- return R.objectKeys(this.shape).forEach((n) => {
3536
+ return E.objectKeys(this.shape).forEach((n) => {
3537
3537
  const s = this.shape[n];
3538
3538
  e && !e[n] ? r[n] = s : r[n] = s.optional();
3539
3539
  }), new A({
@@ -3543,7 +3543,7 @@ class A extends E {
3543
3543
  }
3544
3544
  required(e) {
3545
3545
  const r = {};
3546
- return R.objectKeys(this.shape).forEach((n) => {
3546
+ return E.objectKeys(this.shape).forEach((n) => {
3547
3547
  if (e && !e[n])
3548
3548
  r[n] = this.shape[n];
3549
3549
  else {
@@ -3558,7 +3558,7 @@ class A extends E {
3558
3558
  });
3559
3559
  }
3560
3560
  keyof() {
3561
- return yr(R.objectKeys(this.shape));
3561
+ return yr(E.objectKeys(this.shape));
3562
3562
  }
3563
3563
  }
3564
3564
  A.create = (t, e) => new A({
@@ -3582,7 +3582,7 @@ A.lazycreate = (t, e) => new A({
3582
3582
  typeName: v.ZodObject,
3583
3583
  ...x(e)
3584
3584
  });
3585
- class Le extends E {
3585
+ class Le extends R {
3586
3586
  _parse(e) {
3587
3587
  const { ctx: r } = this._processInputParams(e), n = this._def.options;
3588
3588
  function s(i) {
@@ -3655,8 +3655,8 @@ Le.create = (t, e) => new Le({
3655
3655
  typeName: v.ZodUnion,
3656
3656
  ...x(e)
3657
3657
  });
3658
- const V = (t) => t instanceof Ze ? V(t.schema) : t instanceof K ? V(t.innerType()) : t instanceof Me ? [t.value] : t instanceof ne ? t.options : t instanceof Be ? R.objectValues(t.enum) : t instanceof $e ? V(t._def.innerType) : t instanceof Ie ? [void 0] : t instanceof De ? [null] : t instanceof W ? [void 0, ...V(t.unwrap())] : t instanceof se ? [null, ...V(t.unwrap())] : t instanceof gr || t instanceof qe ? V(t.unwrap()) : t instanceof ze ? V(t._def.innerType) : [];
3659
- class kt extends E {
3658
+ const V = (t) => t instanceof Ze ? V(t.schema) : t instanceof K ? V(t.innerType()) : t instanceof Me ? [t.value] : t instanceof ne ? t.options : t instanceof $e ? E.objectValues(t.enum) : t instanceof Be ? V(t._def.innerType) : t instanceof Ie ? [void 0] : t instanceof De ? [null] : t instanceof W ? [void 0, ...V(t.unwrap())] : t instanceof se ? [null, ...V(t.unwrap())] : t instanceof gr || t instanceof qe ? V(t.unwrap()) : t instanceof ze ? V(t._def.innerType) : [];
3659
+ class kt extends R {
3660
3660
  _parse(e) {
3661
3661
  const { ctx: r } = this._processInputParams(e);
3662
3662
  if (r.parsedType !== p.object)
@@ -3723,7 +3723,7 @@ function yt(t, e) {
3723
3723
  if (t === e)
3724
3724
  return { valid: !0, data: t };
3725
3725
  if (r === p.object && n === p.object) {
3726
- const s = R.objectKeys(e), i = R.objectKeys(t).filter((o) => s.indexOf(o) !== -1), a = { ...t, ...e };
3726
+ const s = E.objectKeys(e), i = E.objectKeys(t).filter((o) => s.indexOf(o) !== -1), a = { ...t, ...e };
3727
3727
  for (const o of i) {
3728
3728
  const d = yt(t[o], e[o]);
3729
3729
  if (!d.valid)
@@ -3744,7 +3744,7 @@ function yt(t, e) {
3744
3744
  return { valid: !0, data: s };
3745
3745
  } else return r === p.date && n === p.date && +t == +e ? { valid: !0, data: t } : { valid: !1 };
3746
3746
  }
3747
- class Ue extends E {
3747
+ class Ue extends R {
3748
3748
  _parse(e) {
3749
3749
  const { status: r, ctx: n } = this._processInputParams(e), s = (i, a) => {
3750
3750
  if (Zt(i) || Zt(a))
@@ -3782,7 +3782,7 @@ Ue.create = (t, e, r) => new Ue({
3782
3782
  typeName: v.ZodIntersection,
3783
3783
  ...x(r)
3784
3784
  });
3785
- class J extends E {
3785
+ class J extends R {
3786
3786
  _parse(e) {
3787
3787
  const { status: r, ctx: n } = this._processInputParams(e);
3788
3788
  if (n.parsedType !== p.array)
@@ -3832,7 +3832,7 @@ J.create = (t, e) => {
3832
3832
  ...x(e)
3833
3833
  });
3834
3834
  };
3835
- class Fe extends E {
3835
+ class Fe extends R {
3836
3836
  get keySchema() {
3837
3837
  return this._def.keyType;
3838
3838
  }
@@ -3860,7 +3860,7 @@ class Fe extends E {
3860
3860
  return this._def.valueType;
3861
3861
  }
3862
3862
  static create(e, r, n) {
3863
- return r instanceof E ? new Fe({
3863
+ return r instanceof R ? new Fe({
3864
3864
  keyType: e,
3865
3865
  valueType: r,
3866
3866
  typeName: v.ZodRecord,
@@ -3873,7 +3873,7 @@ class Fe extends E {
3873
3873
  });
3874
3874
  }
3875
3875
  }
3876
- class gt extends E {
3876
+ class gt extends R {
3877
3877
  get keySchema() {
3878
3878
  return this._def.keyType;
3879
3879
  }
@@ -3921,7 +3921,7 @@ gt.create = (t, e, r) => new gt({
3921
3921
  typeName: v.ZodMap,
3922
3922
  ...x(r)
3923
3923
  });
3924
- class fe extends E {
3924
+ class fe extends R {
3925
3925
  _parse(e) {
3926
3926
  const { status: r, ctx: n } = this._processInputParams(e);
3927
3927
  if (n.parsedType !== p.set)
@@ -3985,7 +3985,7 @@ fe.create = (t, e) => new fe({
3985
3985
  typeName: v.ZodSet,
3986
3986
  ...x(e)
3987
3987
  });
3988
- class ve extends E {
3988
+ class ve extends R {
3989
3989
  constructor() {
3990
3990
  super(...arguments), this.validate = this.implement;
3991
3991
  }
@@ -4086,7 +4086,7 @@ class ve extends E {
4086
4086
  });
4087
4087
  }
4088
4088
  }
4089
- class Ze extends E {
4089
+ class Ze extends R {
4090
4090
  get schema() {
4091
4091
  return this._def.getter();
4092
4092
  }
@@ -4100,7 +4100,7 @@ Ze.create = (t, e) => new Ze({
4100
4100
  typeName: v.ZodLazy,
4101
4101
  ...x(e)
4102
4102
  });
4103
- class Me extends E {
4103
+ class Me extends R {
4104
4104
  _parse(e) {
4105
4105
  if (e.data !== this._def.value) {
4106
4106
  const r = this._getOrReturnCtx(e);
@@ -4128,7 +4128,7 @@ function yr(t, e) {
4128
4128
  ...x(e)
4129
4129
  });
4130
4130
  }
4131
- class ne extends E {
4131
+ class ne extends R {
4132
4132
  constructor() {
4133
4133
  super(...arguments), ge.set(this, void 0);
4134
4134
  }
@@ -4136,7 +4136,7 @@ class ne extends E {
4136
4136
  if (typeof e.data != "string") {
4137
4137
  const r = this._getOrReturnCtx(e), n = this._def.values;
4138
4138
  return h(r, {
4139
- expected: R.joinValues(n),
4139
+ expected: E.joinValues(n),
4140
4140
  received: r.parsedType,
4141
4141
  code: f.invalid_type
4142
4142
  }), b;
@@ -4187,22 +4187,22 @@ class ne extends E {
4187
4187
  }
4188
4188
  ge = /* @__PURE__ */ new WeakMap();
4189
4189
  ne.create = yr;
4190
- class Be extends E {
4190
+ class $e extends R {
4191
4191
  constructor() {
4192
4192
  super(...arguments), _e.set(this, void 0);
4193
4193
  }
4194
4194
  _parse(e) {
4195
- const r = R.getValidEnumValues(this._def.values), n = this._getOrReturnCtx(e);
4195
+ const r = E.getValidEnumValues(this._def.values), n = this._getOrReturnCtx(e);
4196
4196
  if (n.parsedType !== p.string && n.parsedType !== p.number) {
4197
- const s = R.objectValues(r);
4197
+ const s = E.objectValues(r);
4198
4198
  return h(n, {
4199
- expected: R.joinValues(s),
4199
+ expected: E.joinValues(s),
4200
4200
  received: n.parsedType,
4201
4201
  code: f.invalid_type
4202
4202
  }), b;
4203
4203
  }
4204
- if (Pe(this, _e) || hr(this, _e, new Set(R.getValidEnumValues(this._def.values))), !Pe(this, _e).has(e.data)) {
4205
- const s = R.objectValues(r);
4204
+ if (Pe(this, _e) || hr(this, _e, new Set(E.getValidEnumValues(this._def.values))), !Pe(this, _e).has(e.data)) {
4205
+ const s = E.objectValues(r);
4206
4206
  return h(n, {
4207
4207
  received: n.data,
4208
4208
  code: f.invalid_enum_value,
@@ -4216,12 +4216,12 @@ class Be extends E {
4216
4216
  }
4217
4217
  }
4218
4218
  _e = /* @__PURE__ */ new WeakMap();
4219
- Be.create = (t, e) => new Be({
4219
+ $e.create = (t, e) => new $e({
4220
4220
  values: t,
4221
4221
  typeName: v.ZodNativeEnum,
4222
4222
  ...x(e)
4223
4223
  });
4224
- class ke extends E {
4224
+ class ke extends R {
4225
4225
  unwrap() {
4226
4226
  return this._def.type;
4227
4227
  }
@@ -4245,7 +4245,7 @@ ke.create = (t, e) => new ke({
4245
4245
  typeName: v.ZodPromise,
4246
4246
  ...x(e)
4247
4247
  });
4248
- class K extends E {
4248
+ class K extends R {
4249
4249
  innerType() {
4250
4250
  return this._def.schema;
4251
4251
  }
@@ -4319,7 +4319,7 @@ class K extends E {
4319
4319
  return { status: r.value, value: o };
4320
4320
  } else
4321
4321
  return this._def.schema._parseAsync({ data: n.data, path: n.path, parent: n }).then((a) => ue(a) ? Promise.resolve(s.transform(a.value, i)).then((o) => ({ status: r.value, value: o })) : a);
4322
- R.assertNever(s);
4322
+ E.assertNever(s);
4323
4323
  }
4324
4324
  }
4325
4325
  K.create = (t, e, r) => new K({
@@ -4334,7 +4334,7 @@ K.createWithPreprocess = (t, e, r) => new K({
4334
4334
  typeName: v.ZodEffects,
4335
4335
  ...x(r)
4336
4336
  });
4337
- class W extends E {
4337
+ class W extends R {
4338
4338
  _parse(e) {
4339
4339
  return this._getType(e) === p.undefined ? F(void 0) : this._def.innerType._parse(e);
4340
4340
  }
@@ -4347,7 +4347,7 @@ W.create = (t, e) => new W({
4347
4347
  typeName: v.ZodOptional,
4348
4348
  ...x(e)
4349
4349
  });
4350
- class se extends E {
4350
+ class se extends R {
4351
4351
  _parse(e) {
4352
4352
  return this._getType(e) === p.null ? F(null) : this._def.innerType._parse(e);
4353
4353
  }
@@ -4360,7 +4360,7 @@ se.create = (t, e) => new se({
4360
4360
  typeName: v.ZodNullable,
4361
4361
  ...x(e)
4362
4362
  });
4363
- class $e extends E {
4363
+ class Be extends R {
4364
4364
  _parse(e) {
4365
4365
  const { ctx: r } = this._processInputParams(e);
4366
4366
  let n = r.data;
@@ -4374,13 +4374,13 @@ class $e extends E {
4374
4374
  return this._def.innerType;
4375
4375
  }
4376
4376
  }
4377
- $e.create = (t, e) => new $e({
4377
+ Be.create = (t, e) => new Be({
4378
4378
  innerType: t,
4379
4379
  typeName: v.ZodDefault,
4380
4380
  defaultValue: typeof e.default == "function" ? e.default : () => e.default,
4381
4381
  ...x(e)
4382
4382
  });
4383
- class ze extends E {
4383
+ class ze extends R {
4384
4384
  _parse(e) {
4385
4385
  const { ctx: r } = this._processInputParams(e), n = {
4386
4386
  ...r,
@@ -4423,7 +4423,7 @@ ze.create = (t, e) => new ze({
4423
4423
  catchValue: typeof e.catch == "function" ? e.catch : () => e.catch,
4424
4424
  ...x(e)
4425
4425
  });
4426
- class _t extends E {
4426
+ class _t extends R {
4427
4427
  _parse(e) {
4428
4428
  if (this._getType(e) !== p.nan) {
4429
4429
  const n = this._getOrReturnCtx(e);
@@ -4440,7 +4440,7 @@ _t.create = (t) => new _t({
4440
4440
  typeName: v.ZodNaN,
4441
4441
  ...x(t)
4442
4442
  });
4443
- class gr extends E {
4443
+ class gr extends R {
4444
4444
  _parse(e) {
4445
4445
  const { ctx: r } = this._processInputParams(e), n = r.data;
4446
4446
  return this._def.type._parse({
@@ -4453,7 +4453,7 @@ class gr extends E {
4453
4453
  return this._def.type;
4454
4454
  }
4455
4455
  }
4456
- class Qe extends E {
4456
+ class Qe extends R {
4457
4457
  _parse(e) {
4458
4458
  const { status: r, ctx: n } = this._processInputParams(e);
4459
4459
  if (n.common.async)
@@ -4493,7 +4493,7 @@ class Qe extends E {
4493
4493
  });
4494
4494
  }
4495
4495
  }
4496
- class qe extends E {
4496
+ class qe extends R {
4497
4497
  _parse(e) {
4498
4498
  const r = this._def.innerType._parse(e), n = (s) => (ue(s) && (s.value = Object.freeze(s.value)), s);
4499
4499
  return je(r) ? r.then((s) => n(s)) : n(r);
@@ -4525,7 +4525,7 @@ pt.create;
4525
4525
  ce.create;
4526
4526
  Y.create;
4527
4527
  mt.create;
4528
- $.create;
4528
+ B.create;
4529
4529
  A.create;
4530
4530
  A.strictCreate;
4531
4531
  Le.create;
@@ -4539,7 +4539,7 @@ ve.create;
4539
4539
  Ze.create;
4540
4540
  Me.create;
4541
4541
  ne.create;
4542
- Be.create;
4542
+ $e.create;
4543
4543
  ke.create;
4544
4544
  K.create;
4545
4545
  W.create;
@@ -4640,10 +4640,10 @@ function ws(t) {
4640
4640
  });
4641
4641
  }), ie.builder().originalError(t).status(xt.BadRequest).message("Validation Error").errors(e).build();
4642
4642
  }
4643
- function Fs(t) {
4643
+ function Ms(t) {
4644
4644
  return t instanceof ie ? t.problemDetail.detail ? t.problemDetail.detail : t.problemDetail.title ? t.problemDetail.title : t.message : t instanceof Error ? t.message : "An unexpected error occurred";
4645
4645
  }
4646
- function Zs(t, e) {
4646
+ function $s(t, e) {
4647
4647
  return t instanceof ie && t.status === e;
4648
4648
  }
4649
4649
  function oe(t) {
@@ -4658,15 +4658,17 @@ function oe(t) {
4658
4658
  const e = new Error("Unknown api error");
4659
4659
  return new Ve(e).instance("handleApiError").build();
4660
4660
  }
4661
- class Ms {
4661
+ const xs = "@next-feature/client", ks = "0.0.1";
4662
+ class Bs {
4662
4663
  constructor(e) {
4663
4664
  this.isRefreshing = !1, this.pendingRequests = [], this.config = {
4664
4665
  timeout: 3e4,
4665
4666
  enableRefreshToken: !1,
4666
- maxRetries: 3,
4667
+ maxRetries: 1,
4667
4668
  retryDelay: 1e3,
4669
+ skipRefreshPaths: [],
4668
4670
  onUnauthorized: async () => {
4669
- console.log("Unauthorized");
4671
+ console.log("[api-client] Unauthorized");
4670
4672
  },
4671
4673
  onRefreshTokenExpired: async () => {
4672
4674
  console.log("Refresh token expired");
@@ -4674,9 +4676,9 @@ class Ms {
4674
4676
  onAuthenticated: async (r) => {
4675
4677
  console.log(
4676
4678
  "[api-client]",
4677
- r.method.toUpperCase(),
4679
+ r.method?.toUpperCase(),
4678
4680
  r.url,
4679
- r.data
4681
+ r.data ?? ""
4680
4682
  );
4681
4683
  },
4682
4684
  onRefreshToken: async () => "",
@@ -4685,7 +4687,8 @@ class Ms {
4685
4687
  baseURL: this.config.baseURL,
4686
4688
  timeout: this.config.timeout,
4687
4689
  headers: {
4688
- "Content-Type": "application/json"
4690
+ "Content-Type": "application/json",
4691
+ "User-Agent": `${xs}:${ks}`
4689
4692
  }
4690
4693
  }), this.setupInterceptors();
4691
4694
  }
@@ -4706,7 +4709,7 @@ class Ms {
4706
4709
  */
4707
4710
  async handleRequestFulfilled(e) {
4708
4711
  try {
4709
- return this.config.onAuthenticated && this.config.onAuthenticated(e), e;
4712
+ return this.config.onAuthenticated && await this.config.onAuthenticated(e), e;
4710
4713
  } catch (r) {
4711
4714
  return console.error("onAuthenticated error on request:", r), e;
4712
4715
  }
@@ -4723,12 +4726,18 @@ class Ms {
4723
4726
  handleResponseFulfilled(e) {
4724
4727
  return e;
4725
4728
  }
4729
+ /**
4730
+ * Check if a path should skip the refresh token logic
4731
+ */
4732
+ shouldSkipRefresh(e) {
4733
+ return !e || !this.config.skipRefreshPaths?.length ? !1 : this.config.skipRefreshPaths.some((r) => r.test(e));
4734
+ }
4726
4735
  /**
4727
4736
  * Handle response errors with retry logic and token refresh
4728
4737
  */
4729
4738
  async handleResponseRejected(e) {
4730
4739
  const r = e.config;
4731
- return r ? e.response?.status === 401 && this.config.enableRefreshToken ? this.handleUnauthorizedError(e, r) : this.shouldRetry(e, r) ? this.retryRequest(r) : Promise.reject(oe(e)) : Promise.reject(oe(e));
4740
+ return r ? e.response?.status === 401 && this.config.enableRefreshToken && !this.shouldSkipRefresh(r.url) ? this.handleUnauthorizedError(e, r) : this.shouldRetry(e, r) ? this.retryRequest(r) : Promise.reject(oe(e)) : Promise.reject(oe(e));
4732
4741
  }
4733
4742
  /**
4734
4743
  * Handle 401 errors with token refresh
@@ -4742,7 +4751,7 @@ class Ms {
4742
4751
  }).then((n) => (r.headers.Authorization = `Bearer ${n}`, this.instance(r))).catch((n) => Promise.reject(oe(n)));
4743
4752
  this.isRefreshing = !0;
4744
4753
  try {
4745
- const n = await this.refreshToken();
4754
+ const n = await this.refreshToken(r);
4746
4755
  return r.headers.Authorization = `Bearer ${n}`, this.processPendingRequests(null, n), this.instance(r);
4747
4756
  } catch (n) {
4748
4757
  return this.processPendingRequests(n, null), this.config.onUnauthorized && await this.config.onUnauthorized(), Promise.reject(oe(e));
@@ -4753,11 +4762,15 @@ class Ms {
4753
4762
  /**
4754
4763
  * Refresh the JWT token using the refresh token
4755
4764
  */
4756
- async refreshToken() {
4765
+ async refreshToken(e) {
4757
4766
  try {
4758
- return this.config.onRefreshToken();
4759
- } catch (e) {
4760
- throw console.error("Token refresh failed:", e), e;
4767
+ const r = await this.config.onRefreshToken();
4768
+ return await this.post("/api/auth/refresh", {
4769
+ refreshToken: r,
4770
+ headers: e.headers
4771
+ });
4772
+ } catch (r) {
4773
+ throw console.error("Token refresh failed:", r), r;
4761
4774
  }
4762
4775
  }
4763
4776
  /**
@@ -4822,10 +4835,10 @@ class Ms {
4822
4835
  }
4823
4836
  }
4824
4837
  export {
4825
- Ms as ApiClient,
4838
+ Bs as ApiClient,
4826
4839
  ie as ApiError,
4827
- Fs as getErrorMessage,
4840
+ Ms as getErrorMessage,
4828
4841
  bs as handleAxiosError,
4829
4842
  ws as handleZodError,
4830
- Zs as isHttpStatus
4843
+ $s as isHttpStatus
4831
4844
  };
package/lib/client.d.ts CHANGED
@@ -25,6 +25,10 @@ export declare class ApiClient {
25
25
  * Pass through successful responses
26
26
  */
27
27
  private handleResponseFulfilled;
28
+ /**
29
+ * Check if a path should skip the refresh token logic
30
+ */
31
+ private shouldSkipRefresh;
28
32
  /**
29
33
  * Handle response errors with retry logic and token refresh
30
34
  */
@@ -0,0 +1,20 @@
1
+ import { z } from 'zod';
2
+ declare const envSchema: z.ZodObject<{
3
+ NODE_ENV: z.ZodEnum<["development", "production"]>;
4
+ CLIENT_API_URL: z.ZodString;
5
+ }, "strip", z.ZodTypeAny, {
6
+ NODE_ENV?: "development" | "production";
7
+ CLIENT_API_URL?: string;
8
+ }, {
9
+ NODE_ENV?: "development" | "production";
10
+ CLIENT_API_URL?: string;
11
+ }>;
12
+ declare global {
13
+ namespace NodeJS {
14
+ interface ProcessEnv extends z.infer<typeof envSchema> {
15
+ }
16
+ }
17
+ }
18
+ export declare const NODE_ENV: "development" | "production" | "test";
19
+ export declare const BACKEND_API_URL: string;
20
+ export {};
@@ -12,6 +12,11 @@ export interface ApiClientConfig {
12
12
  enableRefreshToken?: boolean;
13
13
  maxRetries?: number;
14
14
  retryDelay?: number;
15
+ /**
16
+ * Paths that should skip the refresh token logic on 401.
17
+ * Useful for login/register endpoints that expect 401 as a valid response.
18
+ */
19
+ skipRefreshPaths?: RegExp[];
15
20
  onAuthenticated?: (config: InternalAxiosRequestConfig) => void | Promise<void>;
16
21
  onUnauthorized?: () => void | Promise<void>;
17
22
  onRefreshTokenExpired?: () => void | Promise<void>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@next-feature/client",
3
- "version": "0.1.1-beta.6",
3
+ "version": "0.1.2-1",
4
4
  "main": "./index.js",
5
5
  "types": "./index.d.ts",
6
6
  "exports": {