@orpc/standard-server-fetch 0.0.0-next.7e41bc4 → 0.0.0-next.cc4cb21
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.js +7 -7
- package/dist/src/event-source.d.ts +2 -3
- package/package.json +3 -2
package/dist/index.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
// src/body.ts
|
|
2
|
-
import {
|
|
2
|
+
import { isAsyncIteratorObject, parseEmptyableJSON as parseEmptyableJSON2 } from "@orpc/shared";
|
|
3
|
+
import { contentDisposition, parseContentDisposition } from "@orpc/standard-server";
|
|
3
4
|
|
|
4
5
|
// src/event-source.ts
|
|
6
|
+
import { isTypescriptObject, parseEmptyableJSON } from "@orpc/shared";
|
|
5
7
|
import {
|
|
6
8
|
encodeEventMessage,
|
|
7
9
|
ErrorEvent,
|
|
8
10
|
EventDecoderStream,
|
|
9
11
|
getEventMeta,
|
|
10
|
-
isEventMetaContainer,
|
|
11
|
-
parseEmptyableJSON,
|
|
12
12
|
UnknownEvent,
|
|
13
13
|
withEventMeta
|
|
14
14
|
} from "@orpc/standard-server";
|
|
@@ -25,7 +25,7 @@ function toEventIterator(stream) {
|
|
|
25
25
|
switch (value.event) {
|
|
26
26
|
case "message": {
|
|
27
27
|
let message = parseEmptyableJSON(value.data);
|
|
28
|
-
if (
|
|
28
|
+
if (isTypescriptObject(message)) {
|
|
29
29
|
message = withEventMeta(message, value);
|
|
30
30
|
}
|
|
31
31
|
yield message;
|
|
@@ -40,7 +40,7 @@ function toEventIterator(stream) {
|
|
|
40
40
|
}
|
|
41
41
|
case "done": {
|
|
42
42
|
let done2 = parseEmptyableJSON(value.data);
|
|
43
|
-
if (
|
|
43
|
+
if (isTypescriptObject(done2)) {
|
|
44
44
|
done2 = withEventMeta(done2, value);
|
|
45
45
|
}
|
|
46
46
|
return done2;
|
|
@@ -124,7 +124,7 @@ async function toStandardBody(re) {
|
|
|
124
124
|
if (contentType.startsWith("text/event-stream")) {
|
|
125
125
|
return toEventIterator(re.body);
|
|
126
126
|
}
|
|
127
|
-
if (contentType.startsWith("text/")) {
|
|
127
|
+
if (contentType.startsWith("text/plain")) {
|
|
128
128
|
return await re.text();
|
|
129
129
|
}
|
|
130
130
|
const blob = await re.blob();
|
|
@@ -190,7 +190,7 @@ function toFetchHeaders(headers, fetchHeaders = new Headers()) {
|
|
|
190
190
|
}
|
|
191
191
|
|
|
192
192
|
// src/request.ts
|
|
193
|
-
import { once } from "@orpc/
|
|
193
|
+
import { once } from "@orpc/shared";
|
|
194
194
|
function toStandardRequest(request) {
|
|
195
195
|
return {
|
|
196
196
|
raw: { request },
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
export declare function
|
|
3
|
-
export declare function toEventStream(iterator: AsyncIterator<JsonValue | void, JsonValue | void, void>): ReadableStream<Uint8Array>;
|
|
1
|
+
export declare function toEventIterator(stream: ReadableStream<Uint8Array>): AsyncGenerator<unknown | void, unknown | void, void>;
|
|
2
|
+
export declare function toEventStream(iterator: AsyncIterator<unknown | void, unknown | void, void>): ReadableStream<Uint8Array>;
|
|
4
3
|
//# sourceMappingURL=event-source.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@orpc/standard-server-fetch",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.0-next.
|
|
4
|
+
"version": "0.0.0-next.cc4cb21",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://unnoq.com",
|
|
7
7
|
"repository": {
|
|
@@ -28,7 +28,8 @@
|
|
|
28
28
|
"dist"
|
|
29
29
|
],
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@orpc/
|
|
31
|
+
"@orpc/shared": "0.0.0-next.cc4cb21",
|
|
32
|
+
"@orpc/standard-server": "0.0.0-next.cc4cb21"
|
|
32
33
|
},
|
|
33
34
|
"devDependencies": {
|
|
34
35
|
"@hono/node-server": "^1.13.8"
|