@orpc/standard-server-node 0.0.0-next.f9e0a4c → 0.0.0-next.f9e5dec
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 +5 -1
- package/dist/index.d.mts +4 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.mjs +7 -4
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -17,6 +17,9 @@
|
|
|
17
17
|
<a href="https://discord.gg/TXEbwRBvQn">
|
|
18
18
|
<img alt="Discord" src="https://img.shields.io/discord/1308966753044398161?color=7389D8&label&logo=discord&logoColor=ffffff" />
|
|
19
19
|
</a>
|
|
20
|
+
<a href="https://deepwiki.com/unnoq/orpc">
|
|
21
|
+
<img src="https://deepwiki.com/badge.svg" alt="Ask DeepWiki">
|
|
22
|
+
</a>
|
|
20
23
|
</div>
|
|
21
24
|
|
|
22
25
|
<h3 align="center">Typesafe APIs Made Simple 🪄</h3>
|
|
@@ -31,7 +34,7 @@
|
|
|
31
34
|
- **📘 First-Class OpenAPI**: Built-in support that fully adheres to the OpenAPI standard.
|
|
32
35
|
- **📝 Contract-First Development**: Optionally define your API contract before implementation.
|
|
33
36
|
- **🔍 First-Class OpenTelemetry**: Seamlessly integrate with OpenTelemetry for observability.
|
|
34
|
-
- **⚙️ Framework Integrations**: Seamlessly integrate with TanStack Query (React, Vue, Solid, Svelte, Angular), Pinia Colada, and more.
|
|
37
|
+
- **⚙️ Framework Integrations**: Seamlessly integrate with TanStack Query (React, Vue, Solid, Svelte, Angular), SWR, Pinia Colada, and more.
|
|
35
38
|
- **🚀 Server Actions**: Fully compatible with React Server Actions on Next.js, TanStack Start, and other platforms.
|
|
36
39
|
- **🔠 Standard Schema Support**: Works out of the box with Zod, Valibot, ArkType, and other schema validators.
|
|
37
40
|
- **🗃️ Native Types**: Supports native types like Date, File, Blob, BigInt, URL, and more.
|
|
@@ -54,6 +57,7 @@ You can find the full documentation [here](https://orpc.unnoq.com).
|
|
|
54
57
|
- [@orpc/nest](https://www.npmjs.com/package/@orpc/nest): Deeply integrate oRPC with [NestJS](https://nestjs.com/).
|
|
55
58
|
- [@orpc/react](https://www.npmjs.com/package/@orpc/react): Utilities for integrating oRPC with React and React Server Actions.
|
|
56
59
|
- [@orpc/tanstack-query](https://www.npmjs.com/package/@orpc/tanstack-query): [TanStack Query](https://tanstack.com/query/latest) integration.
|
|
60
|
+
- [@orpc/experimental-react-swr](https://www.npmjs.com/package/@orpc/experimental-react-swr): [SWR](https://swr.vercel.app/) integration.
|
|
57
61
|
- [@orpc/vue-colada](https://www.npmjs.com/package/@orpc/vue-colada): Integration with [Pinia Colada](https://pinia-colada.esm.dev/).
|
|
58
62
|
- [@orpc/hey-api](https://www.npmjs.com/package/@orpc/hey-api): [Hey API](https://heyapi.dev/) integration.
|
|
59
63
|
- [@orpc/zod](https://www.npmjs.com/package/@orpc/zod): More schemas that [Zod](https://zod.dev/) doesn't support yet.
|
package/dist/index.d.mts
CHANGED
|
@@ -17,6 +17,10 @@ type NodeHttpRequest = (IncomingMessage | Http2ServerRequest) & {
|
|
|
17
17
|
* This is useful for `express.js` middleware.
|
|
18
18
|
*/
|
|
19
19
|
originalUrl?: string;
|
|
20
|
+
/**
|
|
21
|
+
* Prefer parsed body if it is available.
|
|
22
|
+
*/
|
|
23
|
+
body?: unknown;
|
|
20
24
|
};
|
|
21
25
|
type NodeHttpResponse = ServerResponse | Http2ServerResponse;
|
|
22
26
|
|
package/dist/index.d.ts
CHANGED
|
@@ -17,6 +17,10 @@ type NodeHttpRequest = (IncomingMessage | Http2ServerRequest) & {
|
|
|
17
17
|
* This is useful for `express.js` middleware.
|
|
18
18
|
*/
|
|
19
19
|
originalUrl?: string;
|
|
20
|
+
/**
|
|
21
|
+
* Prefer parsed body if it is available.
|
|
22
|
+
*/
|
|
23
|
+
body?: unknown;
|
|
20
24
|
};
|
|
21
25
|
type NodeHttpResponse = ServerResponse | Http2ServerResponse;
|
|
22
26
|
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Readable } from 'node:stream';
|
|
2
|
-
import { runWithSpan, parseEmptyableJSON, isAsyncIteratorObject, stringifyJSON, AbortError, once } from '@orpc/shared';
|
|
2
|
+
import { runWithSpan, parseEmptyableJSON, isAsyncIteratorObject, stringifyJSON, AbortError, guard, once } from '@orpc/shared';
|
|
3
3
|
import { getFilenameFromContentDisposition, flattenHeader, generateContentDisposition } from '@orpc/standard-server';
|
|
4
4
|
import { toEventIterator as toEventIterator$1, toEventStream as toEventStream$1 } from '@orpc/standard-server-fetch';
|
|
5
5
|
|
|
@@ -11,6 +11,9 @@ function toEventStream(iterator, options = {}) {
|
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
function toStandardBody(req, options = {}) {
|
|
14
|
+
if (req.body !== void 0) {
|
|
15
|
+
return Promise.resolve(req.body);
|
|
16
|
+
}
|
|
14
17
|
return runWithSpan({ name: "parse_standard_body", signal: options.signal }, async () => {
|
|
15
18
|
const contentDisposition = req.headers["content-disposition"];
|
|
16
19
|
const contentType = req.headers["content-type"];
|
|
@@ -107,9 +110,9 @@ function toAbortSignal(stream) {
|
|
|
107
110
|
|
|
108
111
|
function toStandardUrl(req) {
|
|
109
112
|
const protocol = "encrypted" in req.socket && req.socket.encrypted ? "https:" : "http:";
|
|
110
|
-
const
|
|
111
|
-
const
|
|
112
|
-
return
|
|
113
|
+
const origin = guard(() => new URL(`${protocol}//${req.headers.host ?? "localhost"}`).origin) ?? `${protocol}//localhost`;
|
|
114
|
+
const path = req.originalUrl ?? req.url ?? "/";
|
|
115
|
+
return new URL(`${origin}${path.startsWith("/") ? "" : "/"}${path}`);
|
|
113
116
|
}
|
|
114
117
|
|
|
115
118
|
function toStandardLazyRequest(req, res) {
|
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.f9e5dec",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://orpc.unnoq.com",
|
|
7
7
|
"repository": {
|
|
@@ -23,9 +23,9 @@
|
|
|
23
23
|
"dist"
|
|
24
24
|
],
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@orpc/shared": "0.0.0-next.
|
|
27
|
-
"@orpc/standard-server": "0.0.0-next.
|
|
28
|
-
"@orpc/standard-server
|
|
26
|
+
"@orpc/shared": "0.0.0-next.f9e5dec",
|
|
27
|
+
"@orpc/standard-server-fetch": "0.0.0-next.f9e5dec",
|
|
28
|
+
"@orpc/standard-server": "0.0.0-next.f9e5dec"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"@types/node": "^22.15.30",
|