@orpc/standard-server-peer 0.0.0-next.dea79a3 → 0.0.0-next.df70448

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 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
@@ -79,9 +79,11 @@ interface AsyncIdQueueCloseOptions {
79
79
  }
80
80
  declare class AsyncIdQueue<T> {
81
81
  private readonly openIds;
82
- private readonly items;
83
- private readonly pendingPulls;
82
+ private readonly queues;
83
+ private readonly waiters;
84
84
  get length(): number;
85
+ get waiterIds(): string[];
86
+ hasBufferedItems(id: string): boolean;
85
87
  open(id: string): void;
86
88
  isOpen(id: string): boolean;
87
89
  push(id: string, item: T): void;
package/dist/index.d.ts CHANGED
@@ -79,9 +79,11 @@ interface AsyncIdQueueCloseOptions {
79
79
  }
80
80
  declare class AsyncIdQueue<T> {
81
81
  private readonly openIds;
82
- private readonly items;
83
- private readonly pendingPulls;
82
+ private readonly queues;
83
+ private readonly waiters;
84
84
  get length(): number;
85
+ get waiterIds(): string[];
86
+ hasBufferedItems(id: string): boolean;
85
87
  open(id: string): void;
86
88
  isOpen(id: string): boolean;
87
89
  push(id: string, item: T): void;
package/dist/index.mjs CHANGED
@@ -1,6 +1,8 @@
1
1
  import { isAsyncIteratorObject, stringifyJSON, readAsBuffer, AsyncIteratorClass, startSpan, runInSpanContext, isTypescriptObject, setSpanError, runWithSpan, SequentialIdGenerator, AsyncIdQueue, getGlobalOtelConfig, clone, AbortError } from '@orpc/shared';
2
2
  import { generateContentDisposition, flattenHeader, getFilenameFromContentDisposition, withEventMeta, ErrorEvent, getEventMeta, isEventIteratorHeaders, HibernationEventIterator } from '@orpc/standard-server';
3
3
 
4
+ const SHORTABLE_ORIGIN = "orpc://localhost";
5
+ const SHORTABLE_ORIGIN_MATCHER = /^orpc:\/\/localhost\//;
4
6
  var MessageType = /* @__PURE__ */ ((MessageType2) => {
5
7
  MessageType2[MessageType2["REQUEST"] = 1] = "REQUEST";
6
8
  MessageType2[MessageType2["RESPONSE"] = 2] = "RESPONSE";
@@ -27,7 +29,7 @@ async function encodeRequestMessage(id, type, payload) {
27
29
  request.headers
28
30
  );
29
31
  const serializedPayload = {
30
- u: request.url.toString().replace(/^orpc:\//, "/"),
32
+ u: request.url.toString().replace(SHORTABLE_ORIGIN_MATCHER, "/"),
31
33
  b: processedBody instanceof Blob ? void 0 : processedBody,
32
34
  h: Object.keys(processedHeaders).length > 0 ? processedHeaders : void 0,
33
35
  m: request.method === "POST" ? void 0 : request.method
@@ -55,7 +57,12 @@ async function decodeRequestMessage(raw) {
55
57
  const payload = message.p;
56
58
  const headers = payload.h ?? {};
57
59
  const body = await deserializeBody(headers, payload.b, buffer);
58
- return [id, 1 /* REQUEST */, { url: new URL(payload.u, "orpc:/"), headers, method: payload.m ?? "POST", body }];
60
+ return [id, 1 /* REQUEST */, {
61
+ url: payload.u.startsWith("/") ? new URL(`${SHORTABLE_ORIGIN}${payload.u}`) : new URL(payload.u),
62
+ headers,
63
+ method: payload.m ?? "POST",
64
+ body
65
+ }];
59
66
  }
60
67
  async function encodeResponseMessage(id, type, payload) {
61
68
  if (type === 3 /* EVENT_ITERATOR */) {
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.dea79a3",
4
+ "version": "0.0.0-next.df70448",
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.dea79a3",
27
- "@orpc/standard-server": "0.0.0-next.dea79a3"
26
+ "@orpc/shared": "0.0.0-next.df70448",
27
+ "@orpc/standard-server": "0.0.0-next.df70448"
28
28
  },
29
29
  "scripts": {
30
30
  "build": "unbuild",