@seayoo-web/request 2.0.6 → 2.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/dist/index.cjs +2 -2
  2. package/dist/index.js +61 -61
  3. package/dist/node.cjs +1 -1
  4. package/dist/node.js +12 -12
  5. package/dist/{request.fetch-BS5HgpwU.cjs → request.fetch-CMHsH_k5.cjs} +1 -1
  6. package/dist/{request.fetch-CLhjvjtM.js → request.fetch-qLDV6Xdq.js} +1 -1
  7. package/dist/{version-DjQ2Y-bj.js → version-DNvZe-sl.js} +158 -148
  8. package/dist/version-DgNkLRed.cjs +2 -0
  9. package/dist/wx.cjs +1 -1
  10. package/dist/wx.js +13 -13
  11. package/package.json +29 -38
  12. package/{dist → types}/index.d.ts +14 -12
  13. package/{dist → types}/node.d.ts +11 -11
  14. package/types/version.d.ts +1 -0
  15. package/{dist → types}/wx.d.ts +9 -9
  16. package/Migeration.md +0 -7
  17. package/dist/version-jIPGFudi.cjs +0 -2
  18. package/dist/version.d.ts +0 -1
  19. package/{dist → types}/inc/cache.d.ts +0 -0
  20. package/{dist → types}/inc/config.d.ts +0 -0
  21. package/{dist → types}/inc/detect.d.ts +0 -0
  22. package/{dist → types}/inc/guard.d.ts +1 -1
  23. package/{dist → types}/inc/jsonp.d.ts +0 -0
  24. package/{dist → types}/inc/main.d.ts +0 -0
  25. package/{dist → types}/inc/option.d.ts +1 -1
  26. package/{dist → types}/inc/request.fetch.d.ts +0 -0
  27. package/{dist → types}/inc/request.node.d.ts +0 -0
  28. package/{dist → types}/inc/request.wx.d.ts +0 -0
  29. package/{dist → types}/inc/request.xhr.d.ts +0 -0
  30. package/{dist → types}/inc/response.d.ts +0 -0
  31. package/{dist → types}/inc/retry.d.ts +1 -1
  32. package/{dist → types}/inc/rule.d.ts +0 -0
  33. package/{dist → types}/inc/sentry.d.ts +0 -0
  34. package/{dist → types}/inc/type.d.ts +1 -1
package/dist/index.cjs CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("./version-jIPGFudi.cjs"),y=require("./request.fetch-BS5HgpwU.cjs"),m=async function(t,o,e){return s.handleResponse(await s.retryRequest(p,t,o,e),t,o,e)};async function q(t,o,e,n){const r=e==null?void 0:e.body,i=(e==null?void 0:e.method)==="PUT"?"PUT":"POST";if(o instanceof Blob){const d=new s.RequestGlobalConfig(n),f=await p(t,d,{...e,method:i,body:o});return s.handleResponse(f,t,d,e)}const c=new FormData,u={...o};r instanceof Object&&Object.entries(r).forEach(([d,f])=>{f instanceof Blob?u[d]=f:Array.isArray(f)?f.forEach((a,g)=>{c.append(`${d}[${g}]`,String(a))}):c.append(d,String(f))});for(const d in u)c.append(d,u[d]);const b=new s.RequestGlobalConfig(n),w=await p(t,b,{...e,method:i,body:c});return s.handleResponse(w,t,b,e)}const p=async function(t,o,e){const n=await s.convertOptions(t,o,e),r=n.method,i=e==null?void 0:e.onUploadProgress,c=s.vt(n.url,n.params);return await new Promise(u=>{let b=null,w=!1;const d=function(){w||(a.abort(),w=!0)};function f(){b!==null&&clearTimeout(b),n.abort&&n.abort.removeEventListener("abort",d)}const a=new XMLHttpRequest;if(a.open(r,c,!0),i){let g=1;a.upload.addEventListener("progress",h=>{g=h.total,i({total:h.total,loaded:h.loaded})}),a.addEventListener("load",()=>{i({loaded:g,total:g})})}a.addEventListener("load",()=>{f(),u({url:c,method:r,status:a.status,statusText:a.statusText,headers:H(a),body:r==="HEAD"?"":a.responseText})}),a.addEventListener("error",g=>{f(),u({url:c,method:r,status:-1,statusText:"Unknown",body:"",rawError:g})},!0),a.addEventListener("abort",()=>{f(),u({url:c,method:r,status:-1,statusText:"Aborted",body:""})}),Object.entries(n.headers).forEach(([g,h])=>{a.setRequestHeader(g,h)}),n.credentials==="include"&&(a.withCredentials=!0),a.send(n.body||void 0),n.abort&&n.abort.addEventListener("abort",d),n.timeout>0&&(b=setTimeout(d,n.timeout))})};function H(t){const o={};if(!t)return o;const e=t.getAllResponseHeaders();return e&&e!=="null"&&e.replace(/\r/g,"").split(`
2
- `).forEach(n=>{const r=n.trim();if(!r)return;const i=r.split(":"),c=i[0].trim();c&&(o[c]=(i[1]||"").trim())}),o}async function E(t,o,e={}){const n=window;"callback"in e||(e.callback="jsonxData"+Math.random().toString(16).slice(2));const r=e.callback+"";if(!t)return null;const i=s.vt(t,e,!0);return new Promise(c=>{n[r]=function(u){if(r in window&&delete n[r],o(u))return u;console.warn("response type check faild",t,u),c(null)},s.Ee(i).catch(function(){c(null),delete n[r]})})}async function T(t,o,e={}){const n=window;return"var"in e||(e.var="jsonxData"+Math.random().toString(16).slice(2)),t?await s.Ee(s.vt(t,e,!0)).then(()=>{const r=n[e.var+""];return o(r)?r:(console.warn("response type check faild",t,r),null)}).catch(()=>null):null}const v=async function(t,o,e){return await q(t,o,e,{baseURL:l.getConfig("baseURL"),logHandler:l.getConfig("logHandler"),errorHandler:l.getConfig("errorHandler"),requestTransformer:l.getConfig("requestTransformer"),messageHandler:l.getConfig("messageHandler"),responseHandler:l.getConfig("responseHandler")})};function R(t){if(!s.Support.window)throw new Error("Default Module Only Support In Browser");return s.Support.fetch?new s.NetRequestHandler(y.fetchRequest,t):new s.NetRequestHandler(m,t)}const l=R(),C=l.setConfig,S=l.request,x=l.head,j=l.get,L=l.post,U=l.del,k=l.put,D=l.patch;exports.getResponseRulesDescription=s.getResponseRulesDescription;exports.version=s.version;exports.NetRequest=R;exports.del=U;exports.get=j;exports.head=x;exports.jsonp=E;exports.jsonx=T;exports.patch=D;exports.post=L;exports.put=k;exports.request=S;exports.setGlobalConfig=C;exports.upload=v;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("./version-DgNkLRed.cjs"),y=require("./request.fetch-CMHsH_k5.cjs"),m=async function(t,o,e){return s.handleResponse(await s.retryRequest(p,t,o,e),t,o,e)};async function q(t,o,e,n){const r=e==null?void 0:e.body,d=(e==null?void 0:e.method)==="PUT"?"PUT":"POST";if(o instanceof Blob){const i=new s.RequestGlobalConfig(n),f=await p(t,i,{...e,method:d,body:o});return s.handleResponse(f,t,i,e)}const c=new FormData,u={...o};r instanceof Object&&Object.entries(r).forEach(([i,f])=>{f instanceof Blob?u[i]=f:Array.isArray(f)?f.forEach((a,g)=>{c.append(`${i}[${g}]`,String(a))}):c.append(i,String(f))});for(const i in u)c.append(i,u[i]);const b=new s.RequestGlobalConfig(n),w=await p(t,b,{...e,method:d,body:c});return s.handleResponse(w,t,b,e)}const p=async function(t,o,e){const n=await s.convertOptions(t,o,e),r=n.method,d=e==null?void 0:e.onUploadProgress,c=s.Wt(n.url,n.params);return await new Promise(u=>{let b=null,w=!1;const i=function(){w||(a.abort(),w=!0)};function f(){b!==null&&clearTimeout(b),n.abort&&n.abort.removeEventListener("abort",i)}const a=new XMLHttpRequest;if(a.open(r,c,!0),d){let g=1;a.upload.addEventListener("progress",h=>{g=h.total,d({total:h.total,loaded:h.loaded})}),a.addEventListener("load",()=>{d({loaded:g,total:g})})}a.addEventListener("load",()=>{f(),u({url:c,method:r,status:a.status,statusText:a.statusText,headers:H(a),body:r==="HEAD"?"":a.responseText})}),a.addEventListener("error",g=>{f(),u({url:c,method:r,status:-1,statusText:"Unknown",body:"",rawError:g})},!0),a.addEventListener("abort",()=>{f(),u({url:c,method:r,status:-1,statusText:"Aborted",body:""})}),Object.entries(n.headers).forEach(([g,h])=>{a.setRequestHeader(g,h)}),n.credentials==="include"&&(a.withCredentials=!0),a.send(n.body||void 0),n.abort&&n.abort.addEventListener("abort",i),n.timeout>0&&(b=setTimeout(i,n.timeout))})};function H(t){const o={};if(!t)return o;const e=t.getAllResponseHeaders();return e&&e!=="null"&&e.replace(/\r/g,"").split(`
2
+ `).forEach(n=>{const r=n.trim();if(!r)return;const d=r.split(":"),c=d[0].trim();c&&(o[c]=(d[1]||"").trim())}),o}async function E(t,o,e={}){const n=window;"callback"in e||(e.callback="jsonxData"+Math.random().toString(16).slice(2));const r=e.callback+"";if(!t)return null;const d=s.Wt(t,e,!0);return new Promise(c=>{n[r]=function(u){if(r in window&&delete n[r],o(u))return u;console.warn("response type check faild",t,u),c(null)},s.Ee(d).catch(function(){c(null),delete n[r]})})}async function T(t,o,e={}){const n=window;return"var"in e||(e.var="jsonxData"+Math.random().toString(16).slice(2)),t?await s.Ee(s.Wt(t,e,!0)).then(()=>{const r=n[e.var+""];return o(r)?r:(console.warn("response type check faild",t,r),null)}).catch(()=>null):null}const C=async function(t,o,e){return await q(t,o,e,{baseURL:l.getConfig("baseURL"),logHandler:l.getConfig("logHandler"),errorHandler:l.getConfig("errorHandler"),requestTransformer:l.getConfig("requestTransformer"),messageHandler:l.getConfig("messageHandler"),responseHandler:l.getConfig("responseHandler")})};function R(t){if(!s.Support.window)throw new Error("Default Module Only Support In Browser");return s.Support.fetch?new s.NetRequestHandler(y.fetchRequest,t):new s.NetRequestHandler(m,t)}const l=R(),S=l.setConfig,v=l.request,x=l.head,j=l.get,L=l.post,U=l.del,k=l.put,D=l.patch;exports.getResponseRulesDescription=s.getResponseRulesDescription;exports.version=s.version;exports.NetRequest=R;exports.del=U;exports.get=j;exports.head=x;exports.jsonp=E;exports.jsonx=T;exports.patch=D;exports.post=L;exports.put=k;exports.request=v;exports.setGlobalConfig=S;exports.upload=C;
package/dist/index.js CHANGED
@@ -1,66 +1,66 @@
1
- import { h as w, r as q, R as y, c as T, v as p, E as H, S as R, N as E } from "./version-DjQ2Y-bj.js";
2
- import { g as I, a as J } from "./version-DjQ2Y-bj.js";
3
- import { f as x } from "./request.fetch-CLhjvjtM.js";
4
- const v = async function(t, a, e) {
5
- return w(await q(m, t, a, e), t, a, e);
1
+ import { h as w, r as q, R as y, c as T, W as p, E as H, S as R, N as E } from "./version-DNvZe-sl.js";
2
+ import { g as z, v as I } from "./version-DNvZe-sl.js";
3
+ import { f as x } from "./request.fetch-qLDV6Xdq.js";
4
+ const C = async function(t, o, e) {
5
+ return w(await q(m, t, o, e), t, o, e);
6
6
  };
7
- async function C(t, a, e, n) {
8
- const r = e == null ? void 0 : e.body, d = (e == null ? void 0 : e.method) === "PUT" ? "PUT" : "POST";
9
- if (a instanceof Blob) {
7
+ async function L(t, o, e, n) {
8
+ const r = e == null ? void 0 : e.body, i = (e == null ? void 0 : e.method) === "PUT" ? "PUT" : "POST";
9
+ if (o instanceof Blob) {
10
10
  const l = new y(n), u = await m(t, l, {
11
11
  ...e,
12
- method: d,
13
- body: a
12
+ method: i,
13
+ body: o
14
14
  });
15
15
  return w(u, t, l, e);
16
16
  }
17
- const s = new FormData(), i = { ...a };
17
+ const s = new FormData(), d = { ...o };
18
18
  r instanceof Object && Object.entries(r).forEach(([l, u]) => {
19
- u instanceof Blob ? i[l] = u : Array.isArray(u) ? u.forEach((o, f) => {
20
- s.append(`${l}[${f}]`, String(o));
19
+ u instanceof Blob ? d[l] = u : Array.isArray(u) ? u.forEach((a, f) => {
20
+ s.append(`${l}[${f}]`, String(a));
21
21
  }) : s.append(l, String(u));
22
22
  });
23
- for (const l in i)
24
- s.append(l, i[l]);
23
+ for (const l in d)
24
+ s.append(l, d[l]);
25
25
  const b = new y(n), h = await m(t, b, {
26
26
  ...e,
27
- method: d,
27
+ method: i,
28
28
  body: s
29
29
  });
30
30
  return w(h, t, b, e);
31
31
  }
32
- const m = async function(t, a, e) {
33
- const n = await T(t, a, e), r = n.method, d = e == null ? void 0 : e.onUploadProgress, s = p(n.url, n.params);
34
- return await new Promise((i) => {
32
+ const m = async function(t, o, e) {
33
+ const n = await T(t, o, e), r = n.method, i = e == null ? void 0 : e.onUploadProgress, s = p(n.url, n.params);
34
+ return await new Promise((d) => {
35
35
  let b = null, h = !1;
36
36
  const l = function() {
37
- h || (o.abort(), h = !0);
37
+ h || (a.abort(), h = !0);
38
38
  };
39
39
  function u() {
40
40
  b !== null && clearTimeout(b), n.abort && n.abort.removeEventListener("abort", l);
41
41
  }
42
- const o = new XMLHttpRequest();
43
- if (o.open(r, s, !0), d) {
42
+ const a = new XMLHttpRequest();
43
+ if (a.open(r, s, !0), i) {
44
44
  let f = 1;
45
- o.upload.addEventListener("progress", (g) => {
46
- f = g.total, d({ total: g.total, loaded: g.loaded });
47
- }), o.addEventListener("load", () => {
48
- d({ loaded: f, total: f });
45
+ a.upload.addEventListener("progress", (g) => {
46
+ f = g.total, i({ total: g.total, loaded: g.loaded });
47
+ }), a.addEventListener("load", () => {
48
+ i({ loaded: f, total: f });
49
49
  });
50
50
  }
51
- o.addEventListener("load", () => {
52
- u(), i({
51
+ a.addEventListener("load", () => {
52
+ u(), d({
53
53
  url: s,
54
54
  method: r,
55
- status: o.status,
56
- statusText: o.statusText,
57
- headers: L(o),
58
- body: r === "HEAD" ? "" : o.responseText
55
+ status: a.status,
56
+ statusText: a.statusText,
57
+ headers: S(a),
58
+ body: r === "HEAD" ? "" : a.responseText
59
59
  });
60
- }), o.addEventListener(
60
+ }), a.addEventListener(
61
61
  "error",
62
62
  (f) => {
63
- u(), i({
63
+ u(), d({
64
64
  url: s,
65
65
  method: r,
66
66
  status: -1,
@@ -70,8 +70,8 @@ const m = async function(t, a, e) {
70
70
  });
71
71
  },
72
72
  !0
73
- ), o.addEventListener("abort", () => {
74
- u(), i({
73
+ ), a.addEventListener("abort", () => {
74
+ u(), d({
75
75
  url: s,
76
76
  method: r,
77
77
  status: -1,
@@ -79,50 +79,50 @@ const m = async function(t, a, e) {
79
79
  body: ""
80
80
  });
81
81
  }), Object.entries(n.headers).forEach(([f, g]) => {
82
- o.setRequestHeader(f, g);
83
- }), n.credentials === "include" && (o.withCredentials = !0), o.send(n.body || void 0), n.abort && n.abort.addEventListener("abort", l), n.timeout > 0 && (b = setTimeout(l, n.timeout));
82
+ a.setRequestHeader(f, g);
83
+ }), n.credentials === "include" && (a.withCredentials = !0), a.send(n.body || void 0), n.abort && n.abort.addEventListener("abort", l), n.timeout > 0 && (b = setTimeout(l, n.timeout));
84
84
  });
85
85
  };
86
- function L(t) {
87
- const a = {};
86
+ function S(t) {
87
+ const o = {};
88
88
  if (!t)
89
- return a;
89
+ return o;
90
90
  const e = t.getAllResponseHeaders();
91
91
  return e && e !== "null" && e.replace(/\r/g, "").split(`
92
92
  `).forEach((n) => {
93
93
  const r = n.trim();
94
94
  if (!r)
95
95
  return;
96
- const d = r.split(":"), s = d[0].trim();
97
- s && (a[s] = (d[1] || "").trim());
98
- }), a;
96
+ const i = r.split(":"), s = i[0].trim();
97
+ s && (o[s] = (i[1] || "").trim());
98
+ }), o;
99
99
  }
100
- async function j(t, a, e = {}) {
100
+ async function j(t, o, e = {}) {
101
101
  const n = window;
102
102
  "callback" in e || (e.callback = "jsonxData" + Math.random().toString(16).slice(2));
103
103
  const r = e.callback + "";
104
104
  if (!t)
105
105
  return null;
106
- const d = p(t, e, !0);
106
+ const i = p(t, e, !0);
107
107
  return new Promise((s) => {
108
- n[r] = function(i) {
109
- if (r in window && delete n[r], a(i))
110
- return i;
111
- console.warn("response type check faild", t, i), s(null);
112
- }, H(d).catch(function() {
108
+ n[r] = function(d) {
109
+ if (r in window && delete n[r], o(d))
110
+ return d;
111
+ console.warn("response type check faild", t, d), s(null);
112
+ }, H(i).catch(function() {
113
113
  s(null), delete n[r];
114
114
  });
115
115
  });
116
116
  }
117
- async function D(t, a, e = {}) {
117
+ async function D(t, o, e = {}) {
118
118
  const n = window;
119
119
  return "var" in e || (e.var = "jsonxData" + Math.random().toString(16).slice(2)), t ? await H(p(t, e, !0)).then(() => {
120
120
  const r = n[e.var + ""];
121
- return a(r) ? r : (console.warn("response type check faild", t, r), null);
121
+ return o(r) ? r : (console.warn("response type check faild", t, r), null);
122
122
  }).catch(() => null) : null;
123
123
  }
124
- const O = async function(t, a, e) {
125
- return await C(t, a, e, {
124
+ const O = async function(t, o, e) {
125
+ return await L(t, o, e, {
126
126
  baseURL: c.getConfig("baseURL"),
127
127
  logHandler: c.getConfig("logHandler"),
128
128
  errorHandler: c.getConfig("errorHandler"),
@@ -131,17 +131,17 @@ const O = async function(t, a, e) {
131
131
  responseHandler: c.getConfig("responseHandler")
132
132
  });
133
133
  };
134
- function S(t) {
134
+ function v(t) {
135
135
  if (!R.window)
136
136
  throw new Error("Default Module Only Support In Browser");
137
- return R.fetch ? new E(x, t) : new E(v, t);
137
+ return R.fetch ? new E(x, t) : new E(C, t);
138
138
  }
139
- const c = S(), P = c.setConfig, A = c.request, M = c.head, N = c.get, B = c.post, X = c.del, F = c.put, G = c.patch;
139
+ const c = v(), P = c.setConfig, A = c.request, M = c.head, N = c.get, B = c.post, X = c.del, F = c.put, G = c.patch;
140
140
  export {
141
- S as NetRequest,
141
+ v as NetRequest,
142
142
  X as del,
143
143
  N as get,
144
- I as getResponseRulesDescription,
144
+ z as getResponseRulesDescription,
145
145
  M as head,
146
146
  j as jsonp,
147
147
  D as jsonx,
@@ -151,5 +151,5 @@ export {
151
151
  A as request,
152
152
  P as setGlobalConfig,
153
153
  O as upload,
154
- J as version
154
+ I as version
155
155
  };
package/dist/node.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const y=require("node:http"),R=require("node:https"),e=require("./version-jIPGFudi.cjs"),g=require("./request.fetch-BS5HgpwU.cjs"),w=async function(o,a,c){return e.handleResponse(await e.retryRequest(S,o,a,c),o,a,c)},S=async function(o,a,c){const t=await e.convertOptions(o,a,c);if(!e.K(t.url))return{url:t.url,method:t.method,status:-1,statusText:"URLFormatError",headers:{},body:""};const f=/^https:\/\//i.test(t.url)?R:y,u=new URL(t.url),i=t.params;i instanceof Object&&Object.keys(i).forEach(r=>u.searchParams.set(r,i[r]));const q=t.method==="HEAD";return new Promise(r=>{const d=f.request(u,{headers:t.headers,method:t.method,timeout:t.timeout>0?t.timeout:void 0},function(s){const p=[];s.on("data",h=>p.push(h)),s.on("end",()=>{const h=e.fromEntries(Object.entries(s.headers).map(([b,m])=>[b.toLowerCase(),Array.isArray(m)?m.join(","):m]));r({url:u.toString(),method:t.method,status:s.statusCode||-1,statusText:s.statusMessage||"Unknown",headers:h,body:q?"":Buffer.concat(p).toString("utf-8")})})});d.on("error",s=>{r({url:u.toString(),method:t.method,status:-1,statusText:"Unknown",body:"",rawError:s})}),d.on("timeout",()=>{r({url:u.toString(),method:t.method,status:-1,statusText:"Timeout",body:""})}),t.body&&d.write(t.body),d.end()})};function l(o){return e.Support.fetch?new e.NetRequestHandler(g.fetchRequest,o):new e.NetRequestHandler(w,o)}const n=l(),T=n.setConfig,j=n.head,C=n.get,E=n.post,N=n.del,O=n.put,U=n.patch;exports.version=e.version;exports.NetRequest=l;exports.del=N;exports.get=C;exports.head=j;exports.patch=U;exports.post=E;exports.put=O;exports.setGlobalConfig=T;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./version-DgNkLRed.cjs"),y=require("./request.fetch-CMHsH_k5.cjs"),R=require("node:http"),g=require("node:https"),w=async function(o,a,c){return e.handleResponse(await e.retryRequest(S,o,a,c),o,a,c)},S=async function(o,a,c){const t=await e.convertOptions(o,a,c);if(!e.K(t.url))return{url:t.url,method:t.method,status:-1,statusText:"URLFormatError",headers:{},body:""};const f=/^https:\/\//i.test(t.url)?g:R,u=new URL(t.url),i=t.params;i instanceof Object&&Object.keys(i).forEach(r=>u.searchParams.set(r,i[r]));const q=t.method==="HEAD";return new Promise(r=>{const d=f.request(u,{headers:t.headers,method:t.method,timeout:t.timeout>0?t.timeout:void 0},function(s){const p=[];s.on("data",h=>p.push(h)),s.on("end",()=>{const h=e.fromEntries(Object.entries(s.headers).map(([b,m])=>[b.toLowerCase(),Array.isArray(m)?m.join(","):m]));r({url:u.toString(),method:t.method,status:s.statusCode||-1,statusText:s.statusMessage||"Unknown",headers:h,body:q?"":Buffer.concat(p).toString("utf-8")})})});d.on("error",s=>{r({url:u.toString(),method:t.method,status:-1,statusText:"Unknown",body:"",rawError:s})}),d.on("timeout",()=>{r({url:u.toString(),method:t.method,status:-1,statusText:"Timeout",body:""})}),t.body&&d.write(t.body),d.end()})};function l(o){return e.Support.fetch?new e.NetRequestHandler(y.fetchRequest,o):new e.NetRequestHandler(w,o)}const n=l(),T=n.setConfig,j=n.head,C=n.get,E=n.post,N=n.del,O=n.put,U=n.patch;exports.version=e.version;exports.NetRequest=l;exports.del=N;exports.get=C;exports.head=j;exports.patch=U;exports.post=E;exports.put=O;exports.setGlobalConfig=T;
package/dist/node.js CHANGED
@@ -1,13 +1,13 @@
1
- import y from "node:http";
2
- import R from "node:https";
3
- import { h as w, r as q, c as g, K as x, f as S, S as E, N as p } from "./version-DjQ2Y-bj.js";
4
- import { a as z } from "./version-DjQ2Y-bj.js";
5
- import { f as T } from "./request.fetch-CLhjvjtM.js";
1
+ import { h as y, r as R, c as w, K as q, f as g, N as p, S as x } from "./version-DNvZe-sl.js";
2
+ import { v } from "./version-DNvZe-sl.js";
3
+ import { f as S } from "./request.fetch-qLDV6Xdq.js";
4
+ import E from "node:http";
5
+ import T from "node:https";
6
6
  const U = async function(e, a, u) {
7
- return w(await q(j, e, a, u), e, a, u);
7
+ return y(await R(j, e, a, u), e, a, u);
8
8
  }, j = async function(e, a, u) {
9
- const t = await g(e, a, u);
10
- if (!x(t.url))
9
+ const t = await w(e, a, u);
10
+ if (!q(t.url))
11
11
  return {
12
12
  url: t.url,
13
13
  method: t.method,
@@ -16,7 +16,7 @@ const U = async function(e, a, u) {
16
16
  headers: {},
17
17
  body: ""
18
18
  };
19
- const f = /^https:\/\//i.test(t.url) ? R : y, n = new URL(t.url), d = t.params;
19
+ const f = /^https:\/\//i.test(t.url) ? T : E, n = new URL(t.url), d = t.params;
20
20
  d instanceof Object && Object.keys(d).forEach((r) => n.searchParams.set(r, d[r]));
21
21
  const b = t.method === "HEAD";
22
22
  return new Promise((r) => {
@@ -30,7 +30,7 @@ const U = async function(e, a, u) {
30
30
  function(o) {
31
31
  const h = [];
32
32
  o.on("data", (i) => h.push(i)), o.on("end", () => {
33
- const i = S(
33
+ const i = g(
34
34
  Object.entries(o.headers).map(([l, m]) => [l.toLowerCase(), Array.isArray(m) ? m.join(",") : m])
35
35
  );
36
36
  r({
@@ -65,7 +65,7 @@ const U = async function(e, a, u) {
65
65
  });
66
66
  };
67
67
  function C(e) {
68
- return E.fetch ? new p(T, e) : new p(U, e);
68
+ return x.fetch ? new p(S, e) : new p(U, e);
69
69
  }
70
70
  const s = C(), H = s.setConfig, k = s.head, P = s.get, B = s.post, D = s.del, F = s.put, G = s.patch;
71
71
  export {
@@ -77,5 +77,5 @@ export {
77
77
  B as post,
78
78
  F as put,
79
79
  H as setGlobalConfig,
80
- z as version
80
+ v as version
81
81
  };
@@ -1 +1 @@
1
- "use strict";const r=require("./version-jIPGFudi.cjs"),f=async function(a,n,i){return r.handleResponse(await r.retryRequest(w,a,n,i),a,n,i)},w=async function(a,n,i){const t=await r.convertOptions(a,n,i),o=new URL(t.url),u=t.params;u instanceof Object&&Object.keys(u).forEach(e=>o.searchParams.set(e,u[e]));const s=r.Support.AbortController?new AbortController:null;function c(){s&&!s.signal.aborted&&s.abort()}t.abort&&t.abort.addEventListener("abort",c);const h=t.timeout>0?setTimeout(c,t.timeout):null,l=t.method==="HEAD";return await fetch(o,{method:t.method,headers:Object.keys(t.headers).length>0?new Headers(t.headers):void 0,body:t.body,credentials:t.credentials,signal:s==null?void 0:s.signal,redirect:"follow"}).then(async e=>{const d=l?"":await e.text().catch(m=>m),b=r.fromEntries([...e.headers.entries()]);return d instanceof Error?{url:o.toString(),method:t.method,status:e.status,statusText:e.statusText||"Unknown",body:"",headers:b,rawError:d}:{url:o.toString(),method:t.method,status:e.status,statusText:e.statusText,headers:b,body:d}}).catch(e=>({url:o.toString(),method:t.method,status:-1,statusText:s!=null&&s.signal.aborted?"Aborted":"Unknown",body:"",rawError:e})).finally(()=>{h!==null&&clearTimeout(h),t.abort&&t.abort.removeEventListener("abort",c)})};exports.fetchRequest=f;
1
+ "use strict";const r=require("./version-DgNkLRed.cjs"),f=async function(a,n,i){return r.handleResponse(await r.retryRequest(w,a,n,i),a,n,i)},w=async function(a,n,i){const t=await r.convertOptions(a,n,i),o=new URL(t.url),u=t.params;u instanceof Object&&Object.keys(u).forEach(e=>o.searchParams.set(e,u[e]));const s=r.Support.AbortController?new AbortController:null;function c(){s&&!s.signal.aborted&&s.abort()}t.abort&&t.abort.addEventListener("abort",c);const h=t.timeout>0?setTimeout(c,t.timeout):null,l=t.method==="HEAD";return await fetch(o,{method:t.method,headers:Object.keys(t.headers).length>0?new Headers(t.headers):void 0,body:t.body,credentials:t.credentials,signal:s==null?void 0:s.signal,redirect:"follow"}).then(async e=>{const d=l?"":await e.text().catch(m=>m),b=r.fromEntries([...e.headers.entries()]);return d instanceof Error?{url:o.toString(),method:t.method,status:e.status,statusText:e.statusText||"Unknown",body:"",headers:b,rawError:d}:{url:o.toString(),method:t.method,status:e.status,statusText:e.statusText,headers:b,body:d}}).catch(e=>({url:o.toString(),method:t.method,status:-1,statusText:s!=null&&s.signal.aborted?"Aborted":"Unknown",body:"",rawError:e})).finally(()=>{h!==null&&clearTimeout(h),t.abort&&t.abort.removeEventListener("abort",c)})};exports.fetchRequest=f;
@@ -1,4 +1,4 @@
1
- import { h as l, r as f, c as w, S as y, f as p } from "./version-DjQ2Y-bj.js";
1
+ import { h as l, r as f, c as w, S as y, f as p } from "./version-DNvZe-sl.js";
2
2
  const x = async function(o, r, n) {
3
3
  return l(await f(E, o, r, n), o, r, n);
4
4
  }, E = async function(o, r, n) {