@orpc/standard-server-node 0.0.0-next.d0e429d → 0.0.0-next.d17ef5e
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 +14 -2
- package/dist/index.d.mts +56 -0
- package/dist/index.d.ts +56 -0
- package/dist/{index.js → index.mjs} +19 -44
- package/package.json +7 -12
- package/dist/src/body.d.ts +0 -14
- package/dist/src/event-source.d.ts +0 -24
- package/dist/src/index.d.ts +0 -7
- package/dist/src/request.d.ts +0 -4
- package/dist/src/response.d.ts +0 -7
- package/dist/src/signal.d.ts +0 -3
- package/dist/src/types.d.ts +0 -11
package/README.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<div align="center">
|
|
2
|
-
<image align="center" src="https://orpc.unnoq.com/logo.webp" width=280 />
|
|
2
|
+
<image align="center" src="https://orpc.unnoq.com/logo.webp" width=280 alt="oRPC logo" />
|
|
3
3
|
</div>
|
|
4
4
|
|
|
5
5
|
<h1></h1>
|
|
@@ -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
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { StandardBody, StandardHeaders, StandardLazyRequest, StandardResponse } from '@orpc/standard-server';
|
|
2
|
+
import { Readable } from 'node:stream';
|
|
3
|
+
import { IncomingMessage, ServerResponse } from 'node:http';
|
|
4
|
+
import { Http2ServerRequest, Http2ServerResponse } from 'node:http2';
|
|
5
|
+
|
|
6
|
+
declare function toEventIterator(stream: Readable): AsyncGenerator<unknown | void, unknown | void, void>;
|
|
7
|
+
interface ToEventStreamOptions {
|
|
8
|
+
/**
|
|
9
|
+
* If true, a ping comment is sent periodically to keep the connection alive.
|
|
10
|
+
*
|
|
11
|
+
* @default true
|
|
12
|
+
*/
|
|
13
|
+
eventIteratorKeepAliveEnabled?: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Interval (in milliseconds) between ping comments sent after the last event.
|
|
16
|
+
*
|
|
17
|
+
* @default 5000
|
|
18
|
+
*/
|
|
19
|
+
eventIteratorKeepAliveInterval?: number;
|
|
20
|
+
/**
|
|
21
|
+
* The content of the ping comment. Must not include newline characters.
|
|
22
|
+
*
|
|
23
|
+
* @default ''
|
|
24
|
+
*/
|
|
25
|
+
eventIteratorKeepAliveComment?: string;
|
|
26
|
+
}
|
|
27
|
+
declare function toEventStream(iterator: AsyncIterator<unknown | void, unknown | void, void>, options?: ToEventStreamOptions): Readable;
|
|
28
|
+
|
|
29
|
+
type NodeHttpRequest = (IncomingMessage | Http2ServerRequest) & {
|
|
30
|
+
/**
|
|
31
|
+
* Replace `req.url` with `req.originalUrl` when `req.originalUrl` is available.
|
|
32
|
+
* This is useful for `express.js` middleware.
|
|
33
|
+
*/
|
|
34
|
+
originalUrl?: string;
|
|
35
|
+
};
|
|
36
|
+
type NodeHttpResponse = ServerResponse | Http2ServerResponse;
|
|
37
|
+
|
|
38
|
+
declare function toStandardBody(req: NodeHttpRequest): Promise<StandardBody>;
|
|
39
|
+
interface ToNodeHttpBodyOptions extends ToEventStreamOptions {
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* @param body
|
|
43
|
+
* @param headers - WARNING: The headers can be changed by the function and effects on the original headers.
|
|
44
|
+
* @param options
|
|
45
|
+
*/
|
|
46
|
+
declare function toNodeHttpBody(body: StandardBody, headers: StandardHeaders, options?: ToNodeHttpBodyOptions): Readable | undefined | string;
|
|
47
|
+
|
|
48
|
+
declare function toStandardLazyRequest(req: NodeHttpRequest, res: NodeHttpResponse): StandardLazyRequest;
|
|
49
|
+
|
|
50
|
+
interface SendStandardResponseOptions extends ToNodeHttpBodyOptions {
|
|
51
|
+
}
|
|
52
|
+
declare function sendStandardResponse(res: NodeHttpResponse, standardResponse: StandardResponse, options?: SendStandardResponseOptions): Promise<void>;
|
|
53
|
+
|
|
54
|
+
declare function toAbortSignal(res: NodeHttpResponse): AbortSignal;
|
|
55
|
+
|
|
56
|
+
export { type NodeHttpRequest, type NodeHttpResponse, type SendStandardResponseOptions, type ToEventStreamOptions, type ToNodeHttpBodyOptions, sendStandardResponse, toAbortSignal, toEventIterator, toEventStream, toNodeHttpBody, toStandardBody, toStandardLazyRequest };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { StandardBody, StandardHeaders, StandardLazyRequest, StandardResponse } from '@orpc/standard-server';
|
|
2
|
+
import { Readable } from 'node:stream';
|
|
3
|
+
import { IncomingMessage, ServerResponse } from 'node:http';
|
|
4
|
+
import { Http2ServerRequest, Http2ServerResponse } from 'node:http2';
|
|
5
|
+
|
|
6
|
+
declare function toEventIterator(stream: Readable): AsyncGenerator<unknown | void, unknown | void, void>;
|
|
7
|
+
interface ToEventStreamOptions {
|
|
8
|
+
/**
|
|
9
|
+
* If true, a ping comment is sent periodically to keep the connection alive.
|
|
10
|
+
*
|
|
11
|
+
* @default true
|
|
12
|
+
*/
|
|
13
|
+
eventIteratorKeepAliveEnabled?: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Interval (in milliseconds) between ping comments sent after the last event.
|
|
16
|
+
*
|
|
17
|
+
* @default 5000
|
|
18
|
+
*/
|
|
19
|
+
eventIteratorKeepAliveInterval?: number;
|
|
20
|
+
/**
|
|
21
|
+
* The content of the ping comment. Must not include newline characters.
|
|
22
|
+
*
|
|
23
|
+
* @default ''
|
|
24
|
+
*/
|
|
25
|
+
eventIteratorKeepAliveComment?: string;
|
|
26
|
+
}
|
|
27
|
+
declare function toEventStream(iterator: AsyncIterator<unknown | void, unknown | void, void>, options?: ToEventStreamOptions): Readable;
|
|
28
|
+
|
|
29
|
+
type NodeHttpRequest = (IncomingMessage | Http2ServerRequest) & {
|
|
30
|
+
/**
|
|
31
|
+
* Replace `req.url` with `req.originalUrl` when `req.originalUrl` is available.
|
|
32
|
+
* This is useful for `express.js` middleware.
|
|
33
|
+
*/
|
|
34
|
+
originalUrl?: string;
|
|
35
|
+
};
|
|
36
|
+
type NodeHttpResponse = ServerResponse | Http2ServerResponse;
|
|
37
|
+
|
|
38
|
+
declare function toStandardBody(req: NodeHttpRequest): Promise<StandardBody>;
|
|
39
|
+
interface ToNodeHttpBodyOptions extends ToEventStreamOptions {
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* @param body
|
|
43
|
+
* @param headers - WARNING: The headers can be changed by the function and effects on the original headers.
|
|
44
|
+
* @param options
|
|
45
|
+
*/
|
|
46
|
+
declare function toNodeHttpBody(body: StandardBody, headers: StandardHeaders, options?: ToNodeHttpBodyOptions): Readable | undefined | string;
|
|
47
|
+
|
|
48
|
+
declare function toStandardLazyRequest(req: NodeHttpRequest, res: NodeHttpResponse): StandardLazyRequest;
|
|
49
|
+
|
|
50
|
+
interface SendStandardResponseOptions extends ToNodeHttpBodyOptions {
|
|
51
|
+
}
|
|
52
|
+
declare function sendStandardResponse(res: NodeHttpResponse, standardResponse: StandardResponse, options?: SendStandardResponseOptions): Promise<void>;
|
|
53
|
+
|
|
54
|
+
declare function toAbortSignal(res: NodeHttpResponse): AbortSignal;
|
|
55
|
+
|
|
56
|
+
export { type NodeHttpRequest, type NodeHttpResponse, type SendStandardResponseOptions, type ToEventStreamOptions, type ToNodeHttpBodyOptions, sendStandardResponse, toAbortSignal, toEventIterator, toEventStream, toNodeHttpBody, toStandardBody, toStandardLazyRequest };
|
|
@@ -1,18 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { contentDisposition, parseContentDisposition } from "@orpc/standard-server";
|
|
1
|
+
import { Readable } from 'node:stream';
|
|
2
|
+
import { stringifyJSON, parseEmptyableJSON, isTypescriptObject, isAsyncIteratorObject, once } from '@orpc/shared';
|
|
3
|
+
import { EventDecoderStream, encodeEventMessage, getEventMeta, ErrorEvent, withEventMeta, parseContentDisposition, contentDisposition } from '@orpc/standard-server';
|
|
5
4
|
|
|
6
|
-
// src/event-source.ts
|
|
7
|
-
import { Readable } from "node:stream";
|
|
8
|
-
import { isTypescriptObject, parseEmptyableJSON, stringifyJSON } from "@orpc/shared";
|
|
9
|
-
import {
|
|
10
|
-
encodeEventMessage,
|
|
11
|
-
ErrorEvent,
|
|
12
|
-
EventDecoderStream,
|
|
13
|
-
getEventMeta,
|
|
14
|
-
withEventMeta
|
|
15
|
-
} from "@orpc/standard-server";
|
|
16
5
|
function toEventIterator(stream) {
|
|
17
6
|
const eventStream = Readable.toWeb(stream).pipeThrough(new TextDecoderStream()).pipeThrough(new EventDecoderStream());
|
|
18
7
|
const reader = eventStream.getReader();
|
|
@@ -55,19 +44,19 @@ function toEventIterator(stream) {
|
|
|
55
44
|
return gen();
|
|
56
45
|
}
|
|
57
46
|
function toEventStream(iterator, options = {}) {
|
|
58
|
-
const
|
|
59
|
-
const
|
|
60
|
-
const
|
|
47
|
+
const keepAliveEnabled = options.eventIteratorKeepAliveEnabled ?? true;
|
|
48
|
+
const keepAliveInterval = options.eventIteratorKeepAliveInterval ?? 5e3;
|
|
49
|
+
const keepAliveComment = options.eventIteratorKeepAliveComment ?? "";
|
|
61
50
|
let timeout;
|
|
62
51
|
const stream = new ReadableStream({
|
|
63
52
|
async pull(controller) {
|
|
64
53
|
try {
|
|
65
|
-
if (
|
|
54
|
+
if (keepAliveEnabled) {
|
|
66
55
|
timeout = setInterval(() => {
|
|
67
56
|
controller.enqueue(encodeEventMessage({
|
|
68
|
-
comments: [
|
|
57
|
+
comments: [keepAliveComment]
|
|
69
58
|
}));
|
|
70
|
-
},
|
|
59
|
+
}, keepAliveInterval);
|
|
71
60
|
}
|
|
72
61
|
const value = await iterator.next();
|
|
73
62
|
clearInterval(timeout);
|
|
@@ -100,7 +89,6 @@ function toEventStream(iterator, options = {}) {
|
|
|
100
89
|
return Readable.fromWeb(stream);
|
|
101
90
|
}
|
|
102
91
|
|
|
103
|
-
// src/body.ts
|
|
104
92
|
async function toStandardBody(req) {
|
|
105
93
|
const method = req.method ?? "GET";
|
|
106
94
|
if (method === "GET" || method === "HEAD") {
|
|
@@ -116,7 +104,7 @@ async function toStandardBody(req) {
|
|
|
116
104
|
}
|
|
117
105
|
if (!contentType || contentType.startsWith("application/json")) {
|
|
118
106
|
const text = await _streamToString(req);
|
|
119
|
-
return
|
|
107
|
+
return parseEmptyableJSON(text);
|
|
120
108
|
}
|
|
121
109
|
if (contentType.startsWith("multipart/form-data")) {
|
|
122
110
|
return _streamToFormData(req, contentType);
|
|
@@ -146,12 +134,12 @@ function toNodeHttpBody(body, headers, options = {}) {
|
|
|
146
134
|
body instanceof File ? body.name : "blob",
|
|
147
135
|
{ type: "inline" }
|
|
148
136
|
);
|
|
149
|
-
return
|
|
137
|
+
return Readable.fromWeb(body.stream());
|
|
150
138
|
}
|
|
151
139
|
if (body instanceof FormData) {
|
|
152
140
|
const response = new Response(body);
|
|
153
141
|
headers["content-type"] = response.headers.get("content-type");
|
|
154
|
-
return
|
|
142
|
+
return Readable.fromWeb(response.body);
|
|
155
143
|
}
|
|
156
144
|
if (body instanceof URLSearchParams) {
|
|
157
145
|
headers["content-type"] = "application/x-www-form-urlencoded";
|
|
@@ -164,7 +152,7 @@ function toNodeHttpBody(body, headers, options = {}) {
|
|
|
164
152
|
return toEventStream(body, options);
|
|
165
153
|
}
|
|
166
154
|
headers["content-type"] = "application/json";
|
|
167
|
-
return
|
|
155
|
+
return stringifyJSON(body);
|
|
168
156
|
}
|
|
169
157
|
function _streamToFormData(stream, contentType) {
|
|
170
158
|
const response = new Response(stream, {
|
|
@@ -189,10 +177,6 @@ async function _streamToFile(stream, fileName, contentType) {
|
|
|
189
177
|
return new File(chunks, fileName, { type: contentType });
|
|
190
178
|
}
|
|
191
179
|
|
|
192
|
-
// src/request.ts
|
|
193
|
-
import { once } from "@orpc/shared";
|
|
194
|
-
|
|
195
|
-
// src/signal.ts
|
|
196
180
|
function toAbortSignal(res) {
|
|
197
181
|
const controller = new AbortController();
|
|
198
182
|
res.on("close", () => {
|
|
@@ -207,23 +191,22 @@ function toAbortSignal(res) {
|
|
|
207
191
|
return controller.signal;
|
|
208
192
|
}
|
|
209
193
|
|
|
210
|
-
|
|
211
|
-
|
|
194
|
+
function toStandardLazyRequest(req, res) {
|
|
195
|
+
const raw = { adapter: "node", request: req, response: res };
|
|
212
196
|
const method = req.method ?? "GET";
|
|
213
197
|
const protocol = "encrypted" in req.socket && req.socket.encrypted ? "https:" : "http:";
|
|
214
198
|
const host = req.headers.host ?? "localhost";
|
|
215
199
|
const url = new URL(req.originalUrl ?? req.url ?? "/", `${protocol}//${host}`);
|
|
216
200
|
return {
|
|
217
|
-
raw
|
|
201
|
+
raw,
|
|
218
202
|
method,
|
|
219
203
|
url,
|
|
220
204
|
headers: req.headers,
|
|
221
|
-
body: once(() => toStandardBody(
|
|
205
|
+
body: once(() => toStandardBody(raw.request)),
|
|
222
206
|
signal: toAbortSignal(res)
|
|
223
207
|
};
|
|
224
208
|
}
|
|
225
209
|
|
|
226
|
-
// src/response.ts
|
|
227
210
|
function sendStandardResponse(res, standardResponse, options = {}) {
|
|
228
211
|
return new Promise((resolve, reject) => {
|
|
229
212
|
res.on("error", reject);
|
|
@@ -245,13 +228,5 @@ function sendStandardResponse(res, standardResponse, options = {}) {
|
|
|
245
228
|
}
|
|
246
229
|
});
|
|
247
230
|
}
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
toAbortSignal,
|
|
251
|
-
toEventIterator,
|
|
252
|
-
toEventStream,
|
|
253
|
-
toNodeHttpBody,
|
|
254
|
-
toStandardBody,
|
|
255
|
-
toStandardRequest
|
|
256
|
-
};
|
|
257
|
-
//# sourceMappingURL=index.js.map
|
|
231
|
+
|
|
232
|
+
export { sendStandardResponse, toAbortSignal, toEventIterator, toEventStream, toNodeHttpBody, toStandardBody, toStandardLazyRequest };
|
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.d17ef5e",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://orpc.unnoq.com",
|
|
7
7
|
"repository": {
|
|
@@ -14,22 +14,17 @@
|
|
|
14
14
|
],
|
|
15
15
|
"exports": {
|
|
16
16
|
".": {
|
|
17
|
-
"types": "./dist/
|
|
18
|
-
"import": "./dist/index.
|
|
19
|
-
"default": "./dist/index.
|
|
20
|
-
},
|
|
21
|
-
"./🔒/*": {
|
|
22
|
-
"types": "./dist/src/*.d.ts"
|
|
17
|
+
"types": "./dist/index.d.mts",
|
|
18
|
+
"import": "./dist/index.mjs",
|
|
19
|
+
"default": "./dist/index.mjs"
|
|
23
20
|
}
|
|
24
21
|
},
|
|
25
22
|
"files": [
|
|
26
|
-
"!**/*.map",
|
|
27
|
-
"!**/*.tsbuildinfo",
|
|
28
23
|
"dist"
|
|
29
24
|
],
|
|
30
25
|
"dependencies": {
|
|
31
|
-
"@orpc/shared": "0.0.0-next.
|
|
32
|
-
"@orpc/standard-server": "0.0.0-next.
|
|
26
|
+
"@orpc/shared": "0.0.0-next.d17ef5e",
|
|
27
|
+
"@orpc/standard-server": "0.0.0-next.d17ef5e"
|
|
33
28
|
},
|
|
34
29
|
"devDependencies": {
|
|
35
30
|
"@types/node": "^22.13.1",
|
|
@@ -37,7 +32,7 @@
|
|
|
37
32
|
"supertest": "^7.0.0"
|
|
38
33
|
},
|
|
39
34
|
"scripts": {
|
|
40
|
-
"build": "
|
|
35
|
+
"build": "unbuild",
|
|
41
36
|
"build:watch": "pnpm run build --watch",
|
|
42
37
|
"type:check": "tsc -b"
|
|
43
38
|
}
|
package/dist/src/body.d.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type { StandardBody, StandardHeaders } from '@orpc/standard-server';
|
|
2
|
-
import type { ToEventStreamOptions } from './event-source';
|
|
3
|
-
import type { NodeHttpRequest } from './types';
|
|
4
|
-
import { Readable } from 'node:stream';
|
|
5
|
-
export declare function toStandardBody(req: NodeHttpRequest): Promise<StandardBody>;
|
|
6
|
-
export interface ToNodeHttpBodyOptions extends ToEventStreamOptions {
|
|
7
|
-
}
|
|
8
|
-
/**
|
|
9
|
-
* @param body
|
|
10
|
-
* @param headers - WARNING: The headers can be changed by the function and effects on the original headers.
|
|
11
|
-
* @param options
|
|
12
|
-
*/
|
|
13
|
-
export declare function toNodeHttpBody(body: StandardBody, headers: StandardHeaders, options?: ToNodeHttpBodyOptions): Readable | undefined | string;
|
|
14
|
-
//# sourceMappingURL=body.d.ts.map
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { Readable } from 'node:stream';
|
|
2
|
-
export declare function toEventIterator(stream: Readable): AsyncGenerator<unknown | void, unknown | void, void>;
|
|
3
|
-
export interface ToEventStreamOptions {
|
|
4
|
-
/**
|
|
5
|
-
* If true, a ping comment is sent periodically to keep the connection alive.
|
|
6
|
-
*
|
|
7
|
-
* @default true
|
|
8
|
-
*/
|
|
9
|
-
eventSourcePingEnabled?: boolean;
|
|
10
|
-
/**
|
|
11
|
-
* Interval (in milliseconds) between ping comments sent after the last event.
|
|
12
|
-
*
|
|
13
|
-
* @default 5000
|
|
14
|
-
*/
|
|
15
|
-
eventSourcePingInterval?: number;
|
|
16
|
-
/**
|
|
17
|
-
* The content of the ping comment. Must not include newline characters.
|
|
18
|
-
*
|
|
19
|
-
* @default ''
|
|
20
|
-
*/
|
|
21
|
-
eventSourcePingContent?: string;
|
|
22
|
-
}
|
|
23
|
-
export declare function toEventStream(iterator: AsyncIterator<unknown | void, unknown | void, void>, options?: ToEventStreamOptions): Readable;
|
|
24
|
-
//# sourceMappingURL=event-source.d.ts.map
|
package/dist/src/index.d.ts
DELETED
package/dist/src/request.d.ts
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import type { StandardRequest } from '@orpc/standard-server';
|
|
2
|
-
import type { NodeHttpRequest, NodeHttpResponse } from './types';
|
|
3
|
-
export declare function toStandardRequest(req: NodeHttpRequest, res: NodeHttpResponse): StandardRequest;
|
|
4
|
-
//# sourceMappingURL=request.d.ts.map
|
package/dist/src/response.d.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { StandardResponse } from '@orpc/standard-server';
|
|
2
|
-
import type { ToNodeHttpBodyOptions } from './body';
|
|
3
|
-
import type { NodeHttpResponse } from './types';
|
|
4
|
-
export interface SendStandardResponseOptions extends ToNodeHttpBodyOptions {
|
|
5
|
-
}
|
|
6
|
-
export declare function sendStandardResponse(res: NodeHttpResponse, standardResponse: StandardResponse, options?: SendStandardResponseOptions): Promise<void>;
|
|
7
|
-
//# sourceMappingURL=response.d.ts.map
|
package/dist/src/signal.d.ts
DELETED
package/dist/src/types.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { IncomingMessage, ServerResponse } from 'node:http';
|
|
2
|
-
import type { Http2ServerRequest, Http2ServerResponse } from 'node:http2';
|
|
3
|
-
export type NodeHttpRequest = (IncomingMessage | Http2ServerRequest) & {
|
|
4
|
-
/**
|
|
5
|
-
* Replace `req.url` with `req.originalUrl` when `req.originalUrl` is available.
|
|
6
|
-
* This is useful for `express.js` middleware.
|
|
7
|
-
*/
|
|
8
|
-
originalUrl?: string;
|
|
9
|
-
};
|
|
10
|
-
export type NodeHttpResponse = ServerResponse | Http2ServerResponse;
|
|
11
|
-
//# sourceMappingURL=types.d.ts.map
|