@orpc/standard-server-fetch 0.0.0-next.d16a1b6 → 0.0.0-next.d452413
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 +3 -1
- package/dist/index.d.mts +7 -5
- package/dist/index.d.ts +7 -5
- package/dist/index.mjs +8 -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,6 +55,8 @@ 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.
|
package/dist/index.d.mts
CHANGED
|
@@ -7,19 +7,19 @@ interface ToEventStreamOptions {
|
|
|
7
7
|
*
|
|
8
8
|
* @default true
|
|
9
9
|
*/
|
|
10
|
-
|
|
10
|
+
eventIteratorKeepAliveEnabled?: boolean;
|
|
11
11
|
/**
|
|
12
12
|
* Interval (in milliseconds) between ping comments sent after the last event.
|
|
13
13
|
*
|
|
14
14
|
* @default 5000
|
|
15
15
|
*/
|
|
16
|
-
|
|
16
|
+
eventIteratorKeepAliveInterval?: number;
|
|
17
17
|
/**
|
|
18
18
|
* The content of the ping comment. Must not include newline characters.
|
|
19
19
|
*
|
|
20
20
|
* @default ''
|
|
21
21
|
*/
|
|
22
|
-
|
|
22
|
+
eventIteratorKeepAliveComment?: string;
|
|
23
23
|
}
|
|
24
24
|
declare function toEventStream(iterator: AsyncIterator<unknown | void, unknown | void, void>, options?: ToEventStreamOptions): ReadableStream<Uint8Array>;
|
|
25
25
|
|
|
@@ -44,11 +44,13 @@ declare function toStandardHeaders(headers: Headers, standardHeaders?: StandardH
|
|
|
44
44
|
declare function toFetchHeaders(headers: StandardHeaders, fetchHeaders?: Headers): Headers;
|
|
45
45
|
|
|
46
46
|
declare function toStandardLazyRequest(request: Request): StandardLazyRequest;
|
|
47
|
-
|
|
47
|
+
interface ToFetchRequestOptions extends ToFetchBodyOptions {
|
|
48
|
+
}
|
|
49
|
+
declare function toFetchRequest(request: StandardRequest, options?: ToFetchRequestOptions): Request;
|
|
48
50
|
|
|
49
51
|
interface ToFetchResponseOptions extends ToFetchBodyOptions {
|
|
50
52
|
}
|
|
51
53
|
declare function toFetchResponse(response: StandardResponse, options?: ToFetchResponseOptions): Response;
|
|
52
54
|
declare function toStandardLazyResponse(response: Response): StandardLazyResponse;
|
|
53
55
|
|
|
54
|
-
export { type ToEventStreamOptions, type ToFetchBodyOptions, type ToFetchResponseOptions, toEventIterator, toEventStream, toFetchBody, toFetchHeaders, toFetchRequest, toFetchResponse, toStandardBody, toStandardHeaders, toStandardLazyRequest, toStandardLazyResponse };
|
|
56
|
+
export { type ToEventStreamOptions, type ToFetchBodyOptions, type ToFetchRequestOptions, type ToFetchResponseOptions, toEventIterator, toEventStream, toFetchBody, toFetchHeaders, toFetchRequest, toFetchResponse, toStandardBody, toStandardHeaders, toStandardLazyRequest, toStandardLazyResponse };
|
package/dist/index.d.ts
CHANGED
|
@@ -7,19 +7,19 @@ interface ToEventStreamOptions {
|
|
|
7
7
|
*
|
|
8
8
|
* @default true
|
|
9
9
|
*/
|
|
10
|
-
|
|
10
|
+
eventIteratorKeepAliveEnabled?: boolean;
|
|
11
11
|
/**
|
|
12
12
|
* Interval (in milliseconds) between ping comments sent after the last event.
|
|
13
13
|
*
|
|
14
14
|
* @default 5000
|
|
15
15
|
*/
|
|
16
|
-
|
|
16
|
+
eventIteratorKeepAliveInterval?: number;
|
|
17
17
|
/**
|
|
18
18
|
* The content of the ping comment. Must not include newline characters.
|
|
19
19
|
*
|
|
20
20
|
* @default ''
|
|
21
21
|
*/
|
|
22
|
-
|
|
22
|
+
eventIteratorKeepAliveComment?: string;
|
|
23
23
|
}
|
|
24
24
|
declare function toEventStream(iterator: AsyncIterator<unknown | void, unknown | void, void>, options?: ToEventStreamOptions): ReadableStream<Uint8Array>;
|
|
25
25
|
|
|
@@ -44,11 +44,13 @@ declare function toStandardHeaders(headers: Headers, standardHeaders?: StandardH
|
|
|
44
44
|
declare function toFetchHeaders(headers: StandardHeaders, fetchHeaders?: Headers): Headers;
|
|
45
45
|
|
|
46
46
|
declare function toStandardLazyRequest(request: Request): StandardLazyRequest;
|
|
47
|
-
|
|
47
|
+
interface ToFetchRequestOptions extends ToFetchBodyOptions {
|
|
48
|
+
}
|
|
49
|
+
declare function toFetchRequest(request: StandardRequest, options?: ToFetchRequestOptions): Request;
|
|
48
50
|
|
|
49
51
|
interface ToFetchResponseOptions extends ToFetchBodyOptions {
|
|
50
52
|
}
|
|
51
53
|
declare function toFetchResponse(response: StandardResponse, options?: ToFetchResponseOptions): Response;
|
|
52
54
|
declare function toStandardLazyResponse(response: Response): StandardLazyResponse;
|
|
53
55
|
|
|
54
|
-
export { type ToEventStreamOptions, type ToFetchBodyOptions, type ToFetchResponseOptions, toEventIterator, toEventStream, toFetchBody, toFetchHeaders, toFetchRequest, toFetchResponse, toStandardBody, toStandardHeaders, toStandardLazyRequest, toStandardLazyResponse };
|
|
56
|
+
export { type ToEventStreamOptions, type ToFetchBodyOptions, type ToFetchRequestOptions, type ToFetchResponseOptions, toEventIterator, toEventStream, toFetchBody, toFetchHeaders, toFetchRequest, toFetchResponse, toStandardBody, toStandardHeaders, toStandardLazyRequest, toStandardLazyResponse };
|
package/dist/index.mjs
CHANGED
|
@@ -43,19 +43,19 @@ function toEventIterator(stream) {
|
|
|
43
43
|
return gen();
|
|
44
44
|
}
|
|
45
45
|
function toEventStream(iterator, options = {}) {
|
|
46
|
-
const
|
|
47
|
-
const
|
|
48
|
-
const
|
|
46
|
+
const keepAliveEnabled = options.eventIteratorKeepAliveEnabled ?? true;
|
|
47
|
+
const keepAliveInterval = options.eventIteratorKeepAliveInterval ?? 5e3;
|
|
48
|
+
const keepAliveComment = options.eventIteratorKeepAliveComment ?? "";
|
|
49
49
|
let timeout;
|
|
50
50
|
const stream = new ReadableStream({
|
|
51
51
|
async pull(controller) {
|
|
52
52
|
try {
|
|
53
|
-
if (
|
|
53
|
+
if (keepAliveEnabled) {
|
|
54
54
|
timeout = setInterval(() => {
|
|
55
55
|
controller.enqueue(encodeEventMessage({
|
|
56
|
-
comments: [
|
|
56
|
+
comments: [keepAliveComment]
|
|
57
57
|
}));
|
|
58
|
-
},
|
|
58
|
+
}, keepAliveInterval);
|
|
59
59
|
}
|
|
60
60
|
const value = await iterator.next();
|
|
61
61
|
clearInterval(timeout);
|
|
@@ -198,9 +198,9 @@ function toStandardLazyRequest(request) {
|
|
|
198
198
|
}
|
|
199
199
|
};
|
|
200
200
|
}
|
|
201
|
-
function toFetchRequest(request) {
|
|
201
|
+
function toFetchRequest(request, options = {}) {
|
|
202
202
|
const headers = toFetchHeaders(request.headers);
|
|
203
|
-
const body = toFetchBody(request.body, headers);
|
|
203
|
+
const body = toFetchBody(request.body, headers, options);
|
|
204
204
|
return new Request(request.url, {
|
|
205
205
|
signal: request.signal,
|
|
206
206
|
method: request.method,
|
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.d452413",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://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.d452413",
|
|
27
|
+
"@orpc/standard-server": "0.0.0-next.d452413"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
30
|
"@hono/node-server": "^1.13.8"
|