@orpc/standard-server-fetch
Advanced tools
Comparing version 0.0.0-next.7e41bc4 to 0.0.0-next.92faaf9
// 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,5 +12,2 @@ encodeEventMessage, | ||
getEventMeta, | ||
isEventMetaContainer, | ||
parseEmptyableJSON, | ||
UnknownEvent, | ||
withEventMeta | ||
@@ -29,3 +28,3 @@ } from "@orpc/standard-server"; | ||
let message = parseEmptyableJSON(value.data); | ||
if (isEventMetaContainer(message)) { | ||
if (isTypescriptObject(message)) { | ||
message = withEventMeta(message, value); | ||
@@ -45,3 +44,3 @@ } | ||
let done2 = parseEmptyableJSON(value.data); | ||
if (isEventMetaContainer(done2)) { | ||
if (isTypescriptObject(done2)) { | ||
done2 = withEventMeta(done2, value); | ||
@@ -51,10 +50,2 @@ } | ||
} | ||
default: { | ||
let error = new UnknownEvent({ | ||
message: `Unknown event: ${value.event}`, | ||
data: parseEmptyableJSON(value.data) | ||
}); | ||
error = withEventMeta(error, value); | ||
throw error; | ||
} | ||
} | ||
@@ -76,3 +67,3 @@ } | ||
event: value.done ? "done" : "message", | ||
data: JSON.stringify(value.value) | ||
data: stringifyJSON(value.value) | ||
})); | ||
@@ -86,3 +77,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 | ||
})); | ||
@@ -133,3 +124,3 @@ controller.close(); | ||
} | ||
if (contentType.startsWith("text/")) { | ||
if (contentType.startsWith("text/plain")) { | ||
return await re.text(); | ||
@@ -170,3 +161,3 @@ } | ||
headers.set("content-type", "application/json"); | ||
return JSON.stringify(body); | ||
return stringifyJSON2(body); | ||
} | ||
@@ -201,3 +192,3 @@ | ||
// src/request.ts | ||
import { once } from "@orpc/standard-server"; | ||
import { once } from "@orpc/shared"; | ||
function toStandardRequest(request) { | ||
@@ -204,0 +195,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.92faaf9", | ||
"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.92faaf9", | ||
"@orpc/standard-server": "0.0.0-next.92faaf9" | ||
}, | ||
@@ -34,0 +35,0 @@ "devDependencies": { |
No README
QualityPackage does not have a README. This may indicate a failed publish or a low quality package.
Found 1 instance in 1 package
14477
10
1
69
2
242
+ Added@orpc/shared@0.0.0-next.92faaf9(transitive)
+ Added@orpc/standard-server@0.0.0-next.92faaf9(transitive)
+ Addedradash@12.1.0(transitive)
- Removed@orpc/standard-server@0.0.0-next.7e41bc4(transitive)