@defjs/core 0.0.0-test-004 → 0.0.0-test-005
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 +5 -1
- package/index.min.js +20 -20
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -330,7 +330,11 @@ function defineRequest(method, endpoint) {
|
|
|
330
330
|
let doRequestOptions;
|
|
331
331
|
switch (args.length) {
|
|
332
332
|
case 1: {
|
|
333
|
-
|
|
333
|
+
if (requiredInput) {
|
|
334
|
+
input = args[0];
|
|
335
|
+
} else {
|
|
336
|
+
doRequestOptions = args[0];
|
|
337
|
+
}
|
|
334
338
|
break;
|
|
335
339
|
}
|
|
336
340
|
case 2: {
|
package/index.min.js
CHANGED
|
@@ -190,17 +190,17 @@ function fe(e) {
|
|
|
190
190
|
function ge(e, t) {
|
|
191
191
|
let r = !1, n, c = [], i = "json", h, b = "body", o = !1, l = [], f;
|
|
192
192
|
const a = () => {
|
|
193
|
-
let s, p,
|
|
193
|
+
let s, p, E;
|
|
194
194
|
return {
|
|
195
|
-
doRequest: async (...
|
|
195
|
+
doRequest: async (...m) => {
|
|
196
196
|
let g, w;
|
|
197
|
-
switch (
|
|
197
|
+
switch (m.length) {
|
|
198
198
|
case 1: {
|
|
199
|
-
w =
|
|
199
|
+
r ? g = m[0] : w = m[0];
|
|
200
200
|
break;
|
|
201
201
|
}
|
|
202
202
|
case 2: {
|
|
203
|
-
g =
|
|
203
|
+
g = m[0], w = m[1];
|
|
204
204
|
break;
|
|
205
205
|
}
|
|
206
206
|
}
|
|
@@ -210,7 +210,7 @@ function ge(e, t) {
|
|
|
210
210
|
for (const k of l)
|
|
211
211
|
k(g);
|
|
212
212
|
const y = w?.timeout || 0;
|
|
213
|
-
w?.abort ?
|
|
213
|
+
w?.abort ? E = w.abort : y > 0 && (E = AbortSignal.timeout(y));
|
|
214
214
|
const v = M(w?.client) ? w.client : ye(), S = Q(v), L = {
|
|
215
215
|
host: S?.host,
|
|
216
216
|
method: e,
|
|
@@ -225,7 +225,7 @@ function ge(e, t) {
|
|
|
225
225
|
uploadProgress: s,
|
|
226
226
|
downloadProgress: p,
|
|
227
227
|
timeout: y,
|
|
228
|
-
abort:
|
|
228
|
+
abort: E
|
|
229
229
|
}, D = w?.handler || S?.handler || ce();
|
|
230
230
|
if (!D)
|
|
231
231
|
throw X;
|
|
@@ -250,11 +250,11 @@ function ge(e, t) {
|
|
|
250
250
|
}
|
|
251
251
|
},
|
|
252
252
|
getInitValue: () => fe(n),
|
|
253
|
-
setUploadProgress: (
|
|
254
|
-
s =
|
|
253
|
+
setUploadProgress: (m) => {
|
|
254
|
+
s = m;
|
|
255
255
|
},
|
|
256
|
-
setDownloadProgress: (
|
|
257
|
-
p =
|
|
256
|
+
setDownloadProgress: (m) => {
|
|
257
|
+
p = m;
|
|
258
258
|
}
|
|
259
259
|
};
|
|
260
260
|
};
|
|
@@ -309,8 +309,8 @@ async function de(e, t, r) {
|
|
|
309
309
|
let o, l, f, a;
|
|
310
310
|
const s = b(r, t()), p = j(t);
|
|
311
311
|
await V([...p.validators, ...p.asyncValidator], s);
|
|
312
|
-
for (const [
|
|
313
|
-
switch (
|
|
312
|
+
for (const [E, d] of p.alias)
|
|
313
|
+
switch (E) {
|
|
314
314
|
case u.Query: {
|
|
315
315
|
if (!d)
|
|
316
316
|
throw P;
|
|
@@ -352,12 +352,12 @@ async function de(e, t, r) {
|
|
|
352
352
|
if (J(t) && n(r)) {
|
|
353
353
|
let o = /* @__PURE__ */ new Map(), l = new URLSearchParams(), f = new Headers(), a = new URLSearchParams(), s = new FormData();
|
|
354
354
|
const p = {};
|
|
355
|
-
let
|
|
355
|
+
let E, d;
|
|
356
356
|
for (const [N, _] of Object.entries(t)) {
|
|
357
357
|
const R = j(_);
|
|
358
|
-
for (const [
|
|
358
|
+
for (const [m, g] of R.alias) {
|
|
359
359
|
const w = g || N, y = b(r[N], _());
|
|
360
|
-
switch (await V([...R.validators, ...R.asyncValidator], y),
|
|
360
|
+
switch (await V([...R.validators, ...R.asyncValidator], y), m) {
|
|
361
361
|
case u.Json: {
|
|
362
362
|
Object.defineProperty(p, w, {
|
|
363
363
|
value: y,
|
|
@@ -384,7 +384,7 @@ async function de(e, t, r) {
|
|
|
384
384
|
break;
|
|
385
385
|
}
|
|
386
386
|
case u.Body: {
|
|
387
|
-
|
|
387
|
+
E = y, d = u.Body;
|
|
388
388
|
break;
|
|
389
389
|
}
|
|
390
390
|
}
|
|
@@ -392,7 +392,7 @@ async function de(e, t, r) {
|
|
|
392
392
|
}
|
|
393
393
|
switch (e.endpoint = F(e.endpoint, o), e.queryParams = l, e.headers = f, d) {
|
|
394
394
|
case u.Body:
|
|
395
|
-
e.body =
|
|
395
|
+
e.body = E;
|
|
396
396
|
break;
|
|
397
397
|
case u.Form:
|
|
398
398
|
e.body = s;
|
|
@@ -444,10 +444,10 @@ async function we(e) {
|
|
|
444
444
|
const { ok: i, headers: h, status: b, statusText: o, url: l } = c, f = ee(h), a = te(h);
|
|
445
445
|
let s = null;
|
|
446
446
|
if (c.body) {
|
|
447
|
-
const p = [],
|
|
447
|
+
const p = [], E = c.body.getReader();
|
|
448
448
|
let d = 0;
|
|
449
449
|
for (; ; ) {
|
|
450
|
-
const { done: _, value: R } = await
|
|
450
|
+
const { done: _, value: R } = await E.read();
|
|
451
451
|
if (_)
|
|
452
452
|
break;
|
|
453
453
|
p.push(R), d += R.length, t?.({
|