@orpc/standard-server-fetch
Advanced tools
Comparing version 0.0.0-next.7e41bc4 to 0.0.0-next.ac2a918
// src/body.ts | ||
import { contentDisposition, isAsyncIteratorObject, parseContentDisposition, parseEmptyableJSON as parseEmptyableJSON2 } from "@orpc/standard-server"; | ||
import { isAsyncIteratorObject, parseEmptyableJSON as parseEmptyableJSON2, stringifyJSON as stringifyJSON2 } from "@orpc/shared"; | ||
import { contentDisposition, parseContentDisposition } from "@orpc/standard-server"; | ||
// src/event-source.ts | ||
import { isTypescriptObject, parseEmptyableJSON, stringifyJSON } from "@orpc/shared"; | ||
import { | ||
@@ -10,4 +12,2 @@ encodeEventMessage, | ||
getEventMeta, | ||
isEventMetaContainer, | ||
parseEmptyableJSON, | ||
UnknownEvent, | ||
@@ -29,3 +29,3 @@ withEventMeta | ||
let message = parseEmptyableJSON(value.data); | ||
if (isEventMetaContainer(message)) { | ||
if (isTypescriptObject(message)) { | ||
message = withEventMeta(message, value); | ||
@@ -45,3 +45,3 @@ } | ||
let done2 = parseEmptyableJSON(value.data); | ||
if (isEventMetaContainer(done2)) { | ||
if (isTypescriptObject(done2)) { | ||
done2 = withEventMeta(done2, value); | ||
@@ -75,3 +75,3 @@ } | ||
event: value.done ? "done" : "message", | ||
data: JSON.stringify(value.value) | ||
data: stringifyJSON(value.value) | ||
})); | ||
@@ -85,3 +85,3 @@ if (value.done) { | ||
event: "error", | ||
data: err instanceof ErrorEvent ? JSON.stringify(err.data) : void 0 | ||
data: err instanceof ErrorEvent ? stringifyJSON(err.data) : void 0 | ||
})); | ||
@@ -132,3 +132,3 @@ controller.close(); | ||
} | ||
if (contentType.startsWith("text/")) { | ||
if (contentType.startsWith("text/plain")) { | ||
return await re.text(); | ||
@@ -169,3 +169,3 @@ } | ||
headers.set("content-type", "application/json"); | ||
return JSON.stringify(body); | ||
return stringifyJSON2(body); | ||
} | ||
@@ -200,3 +200,3 @@ | ||
// src/request.ts | ||
import { once } from "@orpc/standard-server"; | ||
import { once } from "@orpc/shared"; | ||
function toStandardRequest(request) { | ||
@@ -203,0 +203,0 @@ return { |
@@ -1,4 +0,3 @@ | ||
import type { JsonValue } from '@orpc/standard-server'; | ||
export declare function toEventIterator(stream: ReadableStream<Uint8Array>): AsyncGenerator<JsonValue | void, JsonValue | void, void>; | ||
export declare function toEventStream(iterator: AsyncIterator<JsonValue | void, JsonValue | void, void>): ReadableStream<Uint8Array>; | ||
export declare function toEventIterator(stream: ReadableStream<Uint8Array>): AsyncGenerator<unknown | void, unknown | void, void>; | ||
export declare function toEventStream(iterator: AsyncIterator<unknown | void, unknown | void, void>): ReadableStream<Uint8Array>; | ||
//# sourceMappingURL=event-source.d.ts.map |
{ | ||
"name": "@orpc/standard-server-fetch", | ||
"type": "module", | ||
"version": "0.0.0-next.7e41bc4", | ||
"version": "0.0.0-next.ac2a918", | ||
"license": "MIT", | ||
@@ -31,3 +31,4 @@ "homepage": "https://unnoq.com", | ||
"dependencies": { | ||
"@orpc/standard-server": "0.0.0-next.7e41bc4" | ||
"@orpc/shared": "0.0.0-next.ac2a918", | ||
"@orpc/standard-server": "0.0.0-next.ac2a918" | ||
}, | ||
@@ -34,0 +35,0 @@ "devDependencies": { |
10499
2
251
+ Added@orpc/shared@0.0.0-next.ac2a918(transitive)
+ Added@orpc/standard-server@0.0.0-next.ac2a918(transitive)
+ Addedradash@12.1.0(transitive)
- Removed@orpc/standard-server@0.0.0-next.7e41bc4(transitive)