@orpc/standard-server-peer 0.0.0-next.e000d9a → 0.0.0-next.e05ad8a
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 -7
- package/dist/index.d.mts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.mjs +16 -12
- package/package.json +3 -3
package/README.md
CHANGED
@@ -30,7 +30,7 @@
|
|
30
30
|
- **🔗 End-to-End Type Safety**: Ensure type-safe inputs, outputs, and errors from client to server.
|
31
31
|
- **📘 First-Class OpenAPI**: Built-in support that fully adheres to the OpenAPI standard.
|
32
32
|
- **📝 Contract-First Development**: Optionally define your API contract before implementation.
|
33
|
-
- **⚙️ Framework Integrations**: Seamlessly integrate with TanStack Query (React, Vue, Solid, Svelte), Pinia Colada, and more.
|
33
|
+
- **⚙️ Framework Integrations**: Seamlessly integrate with TanStack Query (React, Vue, Solid, Svelte, Angular), Pinia Colada, and more.
|
34
34
|
- **🚀 Server Actions**: Fully compatible with React Server Actions on Next.js, TanStack Start, and other platforms.
|
35
35
|
- **🔠 Standard Schema Support**: Works out of the box with Zod, Valibot, ArkType, and other schema validators.
|
36
36
|
- **🗃️ Native Types**: Supports native types like Date, File, Blob, BigInt, URL, and more.
|
@@ -49,14 +49,12 @@ You can find the full documentation [here](https://orpc.unnoq.com).
|
|
49
49
|
- [@orpc/contract](https://www.npmjs.com/package/@orpc/contract): Build your API contract.
|
50
50
|
- [@orpc/server](https://www.npmjs.com/package/@orpc/server): Build your API or implement API contract.
|
51
51
|
- [@orpc/client](https://www.npmjs.com/package/@orpc/client): Consume your API on the client with type-safety.
|
52
|
-
- [@orpc/
|
52
|
+
- [@orpc/openapi](https://www.npmjs.com/package/@orpc/openapi): Generate OpenAPI specs and handle OpenAPI requests.
|
53
|
+
- [@orpc/nest](https://www.npmjs.com/package/@orpc/nest): Deeply integrate oRPC with [NestJS](https://nestjs.com/).
|
53
54
|
- [@orpc/react](https://www.npmjs.com/package/@orpc/react): Utilities for integrating oRPC with React and React Server Actions.
|
54
|
-
- [@orpc/
|
55
|
-
- [@orpc/vue-query](https://www.npmjs.com/package/@orpc/vue-query): Integration with [Vue Query](https://tanstack.com/query/latest/docs/framework/vue/overview).
|
56
|
-
- [@orpc/solid-query](https://www.npmjs.com/package/@orpc/solid-query): Integration with [Solid Query](https://tanstack.com/query/latest/docs/framework/solid/overview).
|
57
|
-
- [@orpc/svelte-query](https://www.npmjs.com/package/@orpc/svelte-query): Integration with [Svelte Query](https://tanstack.com/query/latest/docs/framework/svelte/overview).
|
55
|
+
- [@orpc/tanstack-query](https://www.npmjs.com/package/@orpc/tanstack-query): [TanStack Query](https://tanstack.com/query/latest) integration.
|
58
56
|
- [@orpc/vue-colada](https://www.npmjs.com/package/@orpc/vue-colada): Integration with [Pinia Colada](https://pinia-colada.esm.dev/).
|
59
|
-
- [@orpc/
|
57
|
+
- [@orpc/hey-api](https://www.npmjs.com/package/@orpc/hey-api): [Hey API](https://heyapi.dev/) integration.
|
60
58
|
- [@orpc/zod](https://www.npmjs.com/package/@orpc/zod): More schemas that [Zod](https://zod.dev/) doesn't support yet.
|
61
59
|
- [@orpc/valibot](https://www.npmjs.com/package/@orpc/valibot): OpenAPI spec generation from [Valibot](https://valibot.dev/).
|
62
60
|
- [@orpc/arktype](https://www.npmjs.com/package/@orpc/arktype): OpenAPI spec generation from [ArkType](https://arktype.io/).
|
package/dist/index.d.mts
CHANGED
@@ -1,7 +1,7 @@
|
|
1
|
-
import { Promisable, AsyncIdQueueCloseOptions as AsyncIdQueueCloseOptions$1,
|
1
|
+
import { Promisable, AsyncIdQueueCloseOptions as AsyncIdQueueCloseOptions$1, AsyncIteratorClassCleanupFn, AsyncIteratorClass } from '@orpc/shared';
|
2
2
|
import { StandardRequest, StandardResponse, EventMeta, StandardHeaders } from '@orpc/standard-server';
|
3
3
|
|
4
|
-
type EncodedMessage = string | ArrayBufferLike
|
4
|
+
type EncodedMessage = string | ArrayBufferLike;
|
5
5
|
interface EncodedMessageSendFn {
|
6
6
|
(message: EncodedMessage): Promisable<void>;
|
7
7
|
}
|
@@ -63,7 +63,7 @@ declare function isEventIteratorHeaders(headers: StandardHeaders): boolean;
|
|
63
63
|
|
64
64
|
interface AsyncIdQueueCloseOptions {
|
65
65
|
id?: number;
|
66
|
-
reason?:
|
66
|
+
reason?: unknown;
|
67
67
|
}
|
68
68
|
declare class AsyncIdQueue<T> {
|
69
69
|
private readonly openIds;
|
@@ -78,7 +78,7 @@ declare class AsyncIdQueue<T> {
|
|
78
78
|
assertOpen(id: number): void;
|
79
79
|
}
|
80
80
|
|
81
|
-
declare function toEventIterator(queue: AsyncIdQueue<EventIteratorPayload>, id: number, cleanup:
|
81
|
+
declare function toEventIterator(queue: AsyncIdQueue<EventIteratorPayload>, id: number, cleanup: AsyncIteratorClassCleanupFn): AsyncIteratorClass<unknown>;
|
82
82
|
declare function resolveEventIterator(iterator: AsyncIterator<any>, callback: (payload: EventIteratorPayload) => Promise<'next' | 'abort'>): Promise<void>;
|
83
83
|
|
84
84
|
interface ServerPeerCloseOptions extends AsyncIdQueueCloseOptions$1 {
|
package/dist/index.d.ts
CHANGED
@@ -1,7 +1,7 @@
|
|
1
|
-
import { Promisable, AsyncIdQueueCloseOptions as AsyncIdQueueCloseOptions$1,
|
1
|
+
import { Promisable, AsyncIdQueueCloseOptions as AsyncIdQueueCloseOptions$1, AsyncIteratorClassCleanupFn, AsyncIteratorClass } from '@orpc/shared';
|
2
2
|
import { StandardRequest, StandardResponse, EventMeta, StandardHeaders } from '@orpc/standard-server';
|
3
3
|
|
4
|
-
type EncodedMessage = string | ArrayBufferLike
|
4
|
+
type EncodedMessage = string | ArrayBufferLike;
|
5
5
|
interface EncodedMessageSendFn {
|
6
6
|
(message: EncodedMessage): Promisable<void>;
|
7
7
|
}
|
@@ -63,7 +63,7 @@ declare function isEventIteratorHeaders(headers: StandardHeaders): boolean;
|
|
63
63
|
|
64
64
|
interface AsyncIdQueueCloseOptions {
|
65
65
|
id?: number;
|
66
|
-
reason?:
|
66
|
+
reason?: unknown;
|
67
67
|
}
|
68
68
|
declare class AsyncIdQueue<T> {
|
69
69
|
private readonly openIds;
|
@@ -78,7 +78,7 @@ declare class AsyncIdQueue<T> {
|
|
78
78
|
assertOpen(id: number): void;
|
79
79
|
}
|
80
80
|
|
81
|
-
declare function toEventIterator(queue: AsyncIdQueue<EventIteratorPayload>, id: number, cleanup:
|
81
|
+
declare function toEventIterator(queue: AsyncIdQueue<EventIteratorPayload>, id: number, cleanup: AsyncIteratorClassCleanupFn): AsyncIteratorClass<unknown>;
|
82
82
|
declare function resolveEventIterator(iterator: AsyncIterator<any>, callback: (payload: EventIteratorPayload) => Promise<'next' | 'abort'>): Promise<void>;
|
83
83
|
|
84
84
|
interface ServerPeerCloseOptions extends AsyncIdQueueCloseOptions$1 {
|
package/dist/index.mjs
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
import { isAsyncIteratorObject, stringifyJSON,
|
2
|
-
import { flattenHeader, getFilenameFromContentDisposition, generateContentDisposition, withEventMeta, ErrorEvent, getEventMeta } from '@orpc/standard-server';
|
1
|
+
import { isAsyncIteratorObject, stringifyJSON, AsyncIteratorClass, isTypescriptObject, SequentialIdGenerator, AsyncIdQueue } from '@orpc/shared';
|
2
|
+
import { flattenHeader, getFilenameFromContentDisposition, generateContentDisposition, withEventMeta, ErrorEvent, getEventMeta, experimental_HibernationEventIterator } from '@orpc/standard-server';
|
3
3
|
|
4
4
|
var MessageType = /* @__PURE__ */ ((MessageType2) => {
|
5
5
|
MessageType2[MessageType2["REQUEST"] = 1] = "REQUEST";
|
@@ -172,7 +172,7 @@ async function encodeRawMessage(data, blobData) {
|
|
172
172
|
new TextEncoder().encode(json),
|
173
173
|
new Uint8Array([JSON_AND_BINARY_DELIMITER]),
|
174
174
|
blobData
|
175
|
-
]);
|
175
|
+
]).arrayBuffer();
|
176
176
|
}
|
177
177
|
async function decodeRawMessage(raw) {
|
178
178
|
if (typeof raw === "string") {
|
@@ -188,12 +188,12 @@ async function decodeRawMessage(raw) {
|
|
188
188
|
const blobData = buffer.slice(delimiterIndex + 1);
|
189
189
|
return {
|
190
190
|
json: JSON.parse(jsonPart),
|
191
|
-
blobData
|
191
|
+
blobData: blobData.buffer
|
192
192
|
};
|
193
193
|
}
|
194
194
|
|
195
195
|
function toEventIterator(queue, id, cleanup) {
|
196
|
-
return
|
196
|
+
return new AsyncIteratorClass(async () => {
|
197
197
|
const item = await queue.pull(id);
|
198
198
|
switch (item.event) {
|
199
199
|
case "message": {
|
@@ -415,13 +415,17 @@ class ServerPeer {
|
|
415
415
|
}
|
416
416
|
await this.send(id, MessageType.RESPONSE, response).then(async () => {
|
417
417
|
if (!signal.aborted && isAsyncIteratorObject(response.body)) {
|
418
|
-
|
419
|
-
|
420
|
-
|
421
|
-
|
422
|
-
|
423
|
-
|
424
|
-
|
418
|
+
if (response.body instanceof experimental_HibernationEventIterator) {
|
419
|
+
response.body.hibernationCallback?.(id);
|
420
|
+
} else {
|
421
|
+
await resolveEventIterator(response.body, async (payload) => {
|
422
|
+
if (signal.aborted) {
|
423
|
+
return "abort";
|
424
|
+
}
|
425
|
+
await this.send(id, MessageType.EVENT_ITERATOR, payload);
|
426
|
+
return "next";
|
427
|
+
});
|
428
|
+
}
|
425
429
|
}
|
426
430
|
this.close({ id, abort: false });
|
427
431
|
}).catch((reason) => {
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "@orpc/standard-server-peer",
|
3
3
|
"type": "module",
|
4
|
-
"version": "0.0.0-next.
|
4
|
+
"version": "0.0.0-next.e05ad8a",
|
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/
|
27
|
-
"@orpc/
|
26
|
+
"@orpc/standard-server": "0.0.0-next.e05ad8a",
|
27
|
+
"@orpc/shared": "0.0.0-next.e05ad8a"
|
28
28
|
},
|
29
29
|
"scripts": {
|
30
30
|
"build": "unbuild",
|