@orpc/standard-server-node 0.0.0-next.904b0c2 → 0.0.0-next.910f96e
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/README.md +1 -0
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.mjs +8 -12
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -53,6 +53,7 @@ You can find the full documentation [here](https://orpc.unnoq.com).
|
|
|
53
53
|
- [@orpc/contract](https://www.npmjs.com/package/@orpc/contract): Build your API contract.
|
|
54
54
|
- [@orpc/server](https://www.npmjs.com/package/@orpc/server): Build your API or implement API contract.
|
|
55
55
|
- [@orpc/client](https://www.npmjs.com/package/@orpc/client): Consume your API on the client with type-safety.
|
|
56
|
+
- [@orpc/react](https://www.npmjs.com/package/@orpc/react): Utilities for integrating oRPC with React and React Server Actions.
|
|
56
57
|
- [@orpc/react-query](https://www.npmjs.com/package/@orpc/react-query): Integration with [React Query](https://tanstack.com/query/latest/docs/framework/react/overview).
|
|
57
58
|
- [@orpc/vue-query](https://www.npmjs.com/package/@orpc/vue-query): Integration with [Vue Query](https://tanstack.com/query/latest/docs/framework/vue/overview).
|
|
58
59
|
- [@orpc/solid-query](https://www.npmjs.com/package/@orpc/solid-query): Integration with [Solid Query](https://tanstack.com/query/latest/docs/framework/solid/overview).
|
package/dist/index.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { StandardBody, StandardHeaders, StandardLazyRequest, StandardResponse } from '@orpc/standard-server';
|
|
2
1
|
import { Readable } from 'node:stream';
|
|
3
2
|
import { IncomingMessage, ServerResponse } from 'node:http';
|
|
4
3
|
import { Http2ServerRequest, Http2ServerResponse } from 'node:http2';
|
|
4
|
+
import { StandardBody, StandardHeaders, StandardLazyRequest, StandardResponse } from '@orpc/standard-server';
|
|
5
5
|
|
|
6
6
|
declare function toEventIterator(stream: Readable): AsyncGenerator<unknown | void, unknown | void, void>;
|
|
7
7
|
interface ToEventStreamOptions {
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { StandardBody, StandardHeaders, StandardLazyRequest, StandardResponse } from '@orpc/standard-server';
|
|
2
1
|
import { Readable } from 'node:stream';
|
|
3
2
|
import { IncomingMessage, ServerResponse } from 'node:http';
|
|
4
3
|
import { Http2ServerRequest, Http2ServerResponse } from 'node:http2';
|
|
4
|
+
import { StandardBody, StandardHeaders, StandardLazyRequest, StandardResponse } from '@orpc/standard-server';
|
|
5
5
|
|
|
6
6
|
declare function toEventIterator(stream: Readable): AsyncGenerator<unknown | void, unknown | void, void>;
|
|
7
7
|
interface ToEventStreamOptions {
|
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Readable } from 'node:stream';
|
|
2
|
-
import { stringifyJSON, parseEmptyableJSON, isTypescriptObject, isAsyncIteratorObject, once } from '@orpc/shared';
|
|
3
|
-
import { EventDecoderStream, encodeEventMessage, getEventMeta, ErrorEvent, withEventMeta,
|
|
2
|
+
import { stringifyJSON, parseEmptyableJSON, isTypescriptObject, toArray, isAsyncIteratorObject, once } from '@orpc/shared';
|
|
3
|
+
import { EventDecoderStream, encodeEventMessage, getEventMeta, ErrorEvent, withEventMeta, getFilenameFromContentDisposition, generateContentDisposition } from '@orpc/standard-server';
|
|
4
4
|
|
|
5
5
|
function toEventIterator(stream) {
|
|
6
6
|
const eventStream = Readable.toWeb(stream).pipeThrough(new TextDecoderStream()).pipeThrough(new EventDecoderStream());
|
|
@@ -94,13 +94,11 @@ async function toStandardBody(req) {
|
|
|
94
94
|
if (method === "GET" || method === "HEAD") {
|
|
95
95
|
return void 0;
|
|
96
96
|
}
|
|
97
|
-
const
|
|
97
|
+
const contentDisposition = req.headers["content-disposition"];
|
|
98
98
|
const contentType = req.headers["content-type"];
|
|
99
|
-
if (
|
|
100
|
-
const fileName =
|
|
101
|
-
|
|
102
|
-
return _streamToFile(req, fileName, contentType ?? "");
|
|
103
|
-
}
|
|
99
|
+
if (typeof contentDisposition === "string") {
|
|
100
|
+
const fileName = getFilenameFromContentDisposition(contentDisposition) ?? "blob";
|
|
101
|
+
return _streamToFile(req, fileName, contentType ?? "");
|
|
104
102
|
}
|
|
105
103
|
if (!contentType || contentType.startsWith("application/json")) {
|
|
106
104
|
const text = await _streamToString(req);
|
|
@@ -122,6 +120,7 @@ async function toStandardBody(req) {
|
|
|
122
120
|
return _streamToFile(req, "blob", contentType);
|
|
123
121
|
}
|
|
124
122
|
function toNodeHttpBody(body, headers, options = {}) {
|
|
123
|
+
const currentContentDisposition = toArray(headers["content-disposition"])[0];
|
|
125
124
|
delete headers["content-type"];
|
|
126
125
|
delete headers["content-disposition"];
|
|
127
126
|
if (body === void 0) {
|
|
@@ -130,10 +129,7 @@ function toNodeHttpBody(body, headers, options = {}) {
|
|
|
130
129
|
if (body instanceof Blob) {
|
|
131
130
|
headers["content-type"] = body.type;
|
|
132
131
|
headers["content-length"] = body.size.toString();
|
|
133
|
-
headers["content-disposition"] =
|
|
134
|
-
body instanceof File ? body.name : "blob",
|
|
135
|
-
{ type: "inline" }
|
|
136
|
-
);
|
|
132
|
+
headers["content-disposition"] = currentContentDisposition ?? generateContentDisposition(body instanceof File ? body.name : "blob");
|
|
137
133
|
return Readable.fromWeb(body.stream());
|
|
138
134
|
}
|
|
139
135
|
if (body instanceof FormData) {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@orpc/standard-server-node",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.0-next.
|
|
4
|
+
"version": "0.0.0-next.910f96e",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://orpc.unnoq.com",
|
|
7
7
|
"repository": {
|
|
@@ -23,8 +23,8 @@
|
|
|
23
23
|
"dist"
|
|
24
24
|
],
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@orpc/shared": "0.0.0-next.
|
|
27
|
-
"@orpc/standard-server": "0.0.0-next.
|
|
26
|
+
"@orpc/shared": "0.0.0-next.910f96e",
|
|
27
|
+
"@orpc/standard-server": "0.0.0-next.910f96e"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
30
|
"@types/node": "^22.13.1",
|