@orpc/standard-server-node 0.0.0-next.d16a1b6 → 0.0.0-next.d3b4900
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 +13 -1
- package/dist/index.d.mts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.mjs +9 -8
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
- **Contract-First Development 📜**: (Optional) Define your API contract upfront and implement it with confidence.
|
|
33
33
|
- **Exceptional Developer Experience ✨**: Enjoy a streamlined workflow with robust typing and clear, in-code documentation.
|
|
34
34
|
- **Multi-Runtime Support 🌍**: Run your code seamlessly on Cloudflare, Deno, Bun, Node.js, and more.
|
|
35
|
-
- **Framework Integrations 🧩**: Supports Tanstack Query (React, Vue), Pinia Colada, and more.
|
|
35
|
+
- **Framework Integrations 🧩**: Supports Tanstack Query (React, Vue, Solid, Svelte), Pinia Colada, and more.
|
|
36
36
|
- **Server Actions ⚡️**: Fully compatible with React Server Actions on Next.js, TanStack Start, and more.
|
|
37
37
|
- **Standard Schema Support 🗂️**: Effortlessly work with Zod, Valibot, ArkType, and others right out of the box.
|
|
38
38
|
- **Fast & Lightweight 💨**: Built on native APIs across all runtimes – optimized for speed and efficiency.
|
|
@@ -55,14 +55,26 @@ You can find the full documentation [here](https://orpc.unnoq.com).
|
|
|
55
55
|
- [@orpc/client](https://www.npmjs.com/package/@orpc/client): Consume your API on the client with type-safety.
|
|
56
56
|
- [@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
57
|
- [@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
|
+
- [@orpc/solid-query](https://www.npmjs.com/package/@orpc/solid-query): Integration with [Solid Query](https://tanstack.com/query/latest/docs/framework/solid/overview).
|
|
59
|
+
- [@orpc/svelte-query](https://www.npmjs.com/package/@orpc/svelte-query): Integration with [Svelte Query](https://tanstack.com/query/latest/docs/framework/svelte/overview).
|
|
58
60
|
- [@orpc/vue-colada](https://www.npmjs.com/package/@orpc/vue-colada): Integration with [Pinia Colada](https://pinia-colada.esm.dev/).
|
|
59
61
|
- [@orpc/openapi](https://www.npmjs.com/package/@orpc/openapi): Generate OpenAPI specs and handle OpenAPI requests.
|
|
60
62
|
- [@orpc/zod](https://www.npmjs.com/package/@orpc/zod): More schemas that [Zod](https://zod.dev/) doesn't support yet.
|
|
63
|
+
- [@orpc/valibot](https://www.npmjs.com/package/@orpc/valibot): OpenAPI spec generation from [Valibot](https://valibot.dev/).
|
|
64
|
+
- [@orpc/arktype](https://www.npmjs.com/package/@orpc/arktype): OpenAPI spec generation from [ArkType](https://arktype.io/).
|
|
61
65
|
|
|
62
66
|
## `@orpc/standard-server-node`
|
|
63
67
|
|
|
64
68
|
[Node.js](https://nodejs.org) server adapter for oRPC.
|
|
65
69
|
|
|
70
|
+
## Sponsors
|
|
71
|
+
|
|
72
|
+
<p align="center">
|
|
73
|
+
<a href="https://cdn.jsdelivr.net/gh/unnoq/unnoq/sponsors.svg">
|
|
74
|
+
<img src='https://cdn.jsdelivr.net/gh/unnoq/unnoq/sponsors.svg'/>
|
|
75
|
+
</a>
|
|
76
|
+
</p>
|
|
77
|
+
|
|
66
78
|
## License
|
|
67
79
|
|
|
68
80
|
Distributed under the MIT License. See [LICENSE](https://github.com/unnoq/orpc/blob/main/LICENSE) for more information.
|
package/dist/index.d.mts
CHANGED
|
@@ -10,19 +10,19 @@ interface ToEventStreamOptions {
|
|
|
10
10
|
*
|
|
11
11
|
* @default true
|
|
12
12
|
*/
|
|
13
|
-
|
|
13
|
+
eventIteratorKeepAliveEnabled?: boolean;
|
|
14
14
|
/**
|
|
15
15
|
* Interval (in milliseconds) between ping comments sent after the last event.
|
|
16
16
|
*
|
|
17
17
|
* @default 5000
|
|
18
18
|
*/
|
|
19
|
-
|
|
19
|
+
eventIteratorKeepAliveInterval?: number;
|
|
20
20
|
/**
|
|
21
21
|
* The content of the ping comment. Must not include newline characters.
|
|
22
22
|
*
|
|
23
23
|
* @default ''
|
|
24
24
|
*/
|
|
25
|
-
|
|
25
|
+
eventIteratorKeepAliveComment?: string;
|
|
26
26
|
}
|
|
27
27
|
declare function toEventStream(iterator: AsyncIterator<unknown | void, unknown | void, void>, options?: ToEventStreamOptions): Readable;
|
|
28
28
|
|
package/dist/index.d.ts
CHANGED
|
@@ -10,19 +10,19 @@ interface ToEventStreamOptions {
|
|
|
10
10
|
*
|
|
11
11
|
* @default true
|
|
12
12
|
*/
|
|
13
|
-
|
|
13
|
+
eventIteratorKeepAliveEnabled?: boolean;
|
|
14
14
|
/**
|
|
15
15
|
* Interval (in milliseconds) between ping comments sent after the last event.
|
|
16
16
|
*
|
|
17
17
|
* @default 5000
|
|
18
18
|
*/
|
|
19
|
-
|
|
19
|
+
eventIteratorKeepAliveInterval?: number;
|
|
20
20
|
/**
|
|
21
21
|
* The content of the ping comment. Must not include newline characters.
|
|
22
22
|
*
|
|
23
23
|
* @default ''
|
|
24
24
|
*/
|
|
25
|
-
|
|
25
|
+
eventIteratorKeepAliveComment?: string;
|
|
26
26
|
}
|
|
27
27
|
declare function toEventStream(iterator: AsyncIterator<unknown | void, unknown | void, void>, options?: ToEventStreamOptions): Readable;
|
|
28
28
|
|
package/dist/index.mjs
CHANGED
|
@@ -44,19 +44,19 @@ function toEventIterator(stream) {
|
|
|
44
44
|
return gen();
|
|
45
45
|
}
|
|
46
46
|
function toEventStream(iterator, options = {}) {
|
|
47
|
-
const
|
|
48
|
-
const
|
|
49
|
-
const
|
|
47
|
+
const keepAliveEnabled = options.eventIteratorKeepAliveEnabled ?? true;
|
|
48
|
+
const keepAliveInterval = options.eventIteratorKeepAliveInterval ?? 5e3;
|
|
49
|
+
const keepAliveComment = options.eventIteratorKeepAliveComment ?? "";
|
|
50
50
|
let timeout;
|
|
51
51
|
const stream = new ReadableStream({
|
|
52
52
|
async pull(controller) {
|
|
53
53
|
try {
|
|
54
|
-
if (
|
|
54
|
+
if (keepAliveEnabled) {
|
|
55
55
|
timeout = setInterval(() => {
|
|
56
56
|
controller.enqueue(encodeEventMessage({
|
|
57
|
-
comments: [
|
|
57
|
+
comments: [keepAliveComment]
|
|
58
58
|
}));
|
|
59
|
-
},
|
|
59
|
+
}, keepAliveInterval);
|
|
60
60
|
}
|
|
61
61
|
const value = await iterator.next();
|
|
62
62
|
clearInterval(timeout);
|
|
@@ -192,16 +192,17 @@ function toAbortSignal(res) {
|
|
|
192
192
|
}
|
|
193
193
|
|
|
194
194
|
function toStandardLazyRequest(req, res) {
|
|
195
|
+
const raw = { adapter: "node", request: req, response: res };
|
|
195
196
|
const method = req.method ?? "GET";
|
|
196
197
|
const protocol = "encrypted" in req.socket && req.socket.encrypted ? "https:" : "http:";
|
|
197
198
|
const host = req.headers.host ?? "localhost";
|
|
198
199
|
const url = new URL(req.originalUrl ?? req.url ?? "/", `${protocol}//${host}`);
|
|
199
200
|
return {
|
|
200
|
-
raw
|
|
201
|
+
raw,
|
|
201
202
|
method,
|
|
202
203
|
url,
|
|
203
204
|
headers: req.headers,
|
|
204
|
-
body: once(() => toStandardBody(
|
|
205
|
+
body: once(() => toStandardBody(raw.request)),
|
|
205
206
|
signal: toAbortSignal(res)
|
|
206
207
|
};
|
|
207
208
|
}
|
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.d3b4900",
|
|
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.d3b4900",
|
|
27
|
+
"@orpc/standard-server": "0.0.0-next.d3b4900"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
30
|
"@types/node": "^22.13.1",
|