@defjs/core 0.0.0-test-0007 → 0.0.0-test-0008
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/index.d.ts +1 -1
- package/dist/index.js +6 -6
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -248,7 +248,7 @@ export type RequestRefWithInput<T> = T extends RequestRef<unknown, infer Input>
|
|
|
248
248
|
export declare function doRequest<Ref extends RequestRef>(ref: RequestRefWithInput<Ref> extends true ? never : Ref, options?: DoRequestOptions): Promise<RequestRefOutput<Ref>>;
|
|
249
249
|
export declare function doRequest<Ref extends RequestRef>(ref: RequestRefWithInput<Ref> extends true ? Ref : never, input: RequestRefInput<Ref>, options?: DoRequestOptions): Promise<RequestRefOutput<Ref>>;
|
|
250
250
|
export type HttpHandler = (req: HttpRequest) => Promise<HttpResponse<unknown>>;
|
|
251
|
-
export declare
|
|
251
|
+
export declare function fetchHandler(httpRequest: HttpRequest): Promise<HttpResponse<unknown>>;
|
|
252
252
|
export interface ClientOptions {
|
|
253
253
|
host: string;
|
|
254
254
|
interceptors?: InterceptorFn[];
|
package/dist/index.js
CHANGED
|
@@ -273,7 +273,8 @@ async function fillRequestFromField(request, fieldOrFieldGroup, input) {
|
|
|
273
273
|
case 1 /* Json */:
|
|
274
274
|
Object.defineProperty(json, valueKey, {
|
|
275
275
|
value,
|
|
276
|
-
writable: true
|
|
276
|
+
writable: true,
|
|
277
|
+
enumerable: true
|
|
277
278
|
});
|
|
278
279
|
break;
|
|
279
280
|
case 2 /* Query */:
|
|
@@ -495,15 +496,15 @@ function getContentLength(headers) {
|
|
|
495
496
|
}
|
|
496
497
|
return num;
|
|
497
498
|
}
|
|
498
|
-
async function
|
|
499
|
+
async function fetchHandler(httpRequest) {
|
|
500
|
+
const { downloadProgress } = httpRequest;
|
|
499
501
|
const request2 = createRequest(httpRequest);
|
|
500
|
-
const downloadProgress = httpRequest.downloadProgress;
|
|
501
502
|
let response2;
|
|
502
503
|
try {
|
|
503
504
|
response2 = await (globalThis || window).fetch(request2);
|
|
504
505
|
} catch (error) {
|
|
505
506
|
throw makeResponse({
|
|
506
|
-
error: error instanceof Error ? error : new Error("
|
|
507
|
+
error: error instanceof Error ? error : new Error("Network Error"),
|
|
507
508
|
url: request2.url
|
|
508
509
|
});
|
|
509
510
|
}
|
|
@@ -531,7 +532,7 @@ async function _request(httpRequest) {
|
|
|
531
532
|
body = parseBody(httpRequest, response2, chunksAll);
|
|
532
533
|
} catch (error) {
|
|
533
534
|
throw makeResponse({
|
|
534
|
-
error: error instanceof Error ? error : new Error("
|
|
535
|
+
error: error instanceof Error ? error : new Error("Parse response body error"),
|
|
535
536
|
url,
|
|
536
537
|
status,
|
|
537
538
|
statusText,
|
|
@@ -549,7 +550,6 @@ async function _request(httpRequest) {
|
|
|
549
550
|
});
|
|
550
551
|
}
|
|
551
552
|
var FETCH_CONFIG_KEY = makeHttpContextToken(() => ({}));
|
|
552
|
-
var fetchHandler = _request;
|
|
553
553
|
// src/client.ts
|
|
554
554
|
function isClient(value) {
|
|
555
555
|
return typeof value === "object" && value !== null && CLIENT in value;
|