@standardserver/fetch 0.0.20 → 0.0.22
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.mts +1 -5
- package/dist/index.d.ts +1 -5
- package/dist/index.mjs +4 -4
- package/package.json +3 -3
package/dist/index.d.mts
CHANGED
|
@@ -81,11 +81,7 @@ declare function toFetchHeaders(standardHeaders: StandardHeaders): Headers;
|
|
|
81
81
|
*/
|
|
82
82
|
declare function toStandardLazyRequest(request: Request): StandardLazyRequest;
|
|
83
83
|
|
|
84
|
-
interface ToFetchResponseOptions {
|
|
85
|
-
/**
|
|
86
|
-
* Options for body conversion, like event iterator options, etc.
|
|
87
|
-
*/
|
|
88
|
-
body?: ToFetchBodyOptions;
|
|
84
|
+
interface ToFetchResponseOptions extends ToFetchBodyOptions {
|
|
89
85
|
}
|
|
90
86
|
declare function toFetchResponse(standardResponse: StandardResponse, options?: ToFetchResponseOptions): Response;
|
|
91
87
|
declare function toStandardLazyResponse(response: Response): StandardLazyResponse;
|
package/dist/index.d.ts
CHANGED
|
@@ -81,11 +81,7 @@ declare function toFetchHeaders(standardHeaders: StandardHeaders): Headers;
|
|
|
81
81
|
*/
|
|
82
82
|
declare function toStandardLazyRequest(request: Request): StandardLazyRequest;
|
|
83
83
|
|
|
84
|
-
interface ToFetchResponseOptions {
|
|
85
|
-
/**
|
|
86
|
-
* Options for body conversion, like event iterator options, etc.
|
|
87
|
-
*/
|
|
88
|
-
body?: ToFetchBodyOptions;
|
|
84
|
+
interface ToFetchResponseOptions extends ToFetchBodyOptions {
|
|
89
85
|
}
|
|
90
86
|
declare function toFetchResponse(standardResponse: StandardResponse, options?: ToFetchResponseOptions): Response;
|
|
91
87
|
declare function toStandardLazyResponse(response: Response): StandardLazyResponse;
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { EventStreamDecoderStream, withEventMeta,
|
|
1
|
+
import { EventStreamDecoderStream, withEventMeta, ErrorEvent, encodeEventStreamMessage, unwrapEvent, getEventMeta, getFilenameFromContentDisposition, generateContentDisposition } from '@standardserver/core';
|
|
2
2
|
import { AsyncIteratorClass, parseEmptyableJSON, isTypescriptObject, stringifyJSON, AbortError, isAsyncIteratorObject } from '@standardserver/shared';
|
|
3
3
|
|
|
4
4
|
function toEventIterator(stream) {
|
|
@@ -26,7 +26,7 @@ function toEventIterator(stream) {
|
|
|
26
26
|
return { done: false, value: message };
|
|
27
27
|
}
|
|
28
28
|
case "error": {
|
|
29
|
-
let error = new
|
|
29
|
+
let error = new ErrorEvent(parseEmptyableJSON(value.data));
|
|
30
30
|
error = withEventMeta(error, value);
|
|
31
31
|
throw error;
|
|
32
32
|
}
|
|
@@ -94,7 +94,7 @@ function toEventStream(iterator, options = {}) {
|
|
|
94
94
|
if (cancelled) {
|
|
95
95
|
return;
|
|
96
96
|
}
|
|
97
|
-
if (err instanceof
|
|
97
|
+
if (err instanceof ErrorEvent) {
|
|
98
98
|
controller.enqueue(encodeEventStreamMessage({
|
|
99
99
|
...getEventMeta(err),
|
|
100
100
|
event: "error",
|
|
@@ -249,7 +249,7 @@ function toStandardLazyRequest(request) {
|
|
|
249
249
|
}
|
|
250
250
|
|
|
251
251
|
function toFetchResponse(standardResponse, options = {}) {
|
|
252
|
-
const [body, standardHeaders] = toFetchBody(standardResponse.body, standardResponse.headers, options
|
|
252
|
+
const [body, standardHeaders] = toFetchBody(standardResponse.body, standardResponse.headers, options);
|
|
253
253
|
const response = new Response(body, {
|
|
254
254
|
headers: toFetchHeaders(standardHeaders),
|
|
255
255
|
status: standardResponse.status
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@standardserver/fetch",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.22",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://standardserver.dev",
|
|
7
7
|
"repository": {
|
|
@@ -22,8 +22,8 @@
|
|
|
22
22
|
"dist"
|
|
23
23
|
],
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@standardserver/core": "0.0.
|
|
26
|
-
"@standardserver/shared": "0.0.
|
|
25
|
+
"@standardserver/core": "0.0.22",
|
|
26
|
+
"@standardserver/shared": "0.0.22"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"@hono/node-server": "^2.0.1"
|