@orpc/client 2.0.0-beta.35 → 2.0.0-beta.36

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
@@ -46,29 +46,30 @@ You can read the documentation [here](https://orpc.dev).
46
46
 
47
47
  **Built-in features**
48
48
 
49
- | Package | Purpose | Docs |
50
- | -------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------- |
51
- | [@orpc/publisher](https://www.npmjs.com/package/@orpc/publisher) | Pub/Sub with memory, Redis, and Upstash adapters. | [Publisher](https://orpc.dev/docs/helpers/publisher) |
52
- | [@orpc/ratelimit](https://www.npmjs.com/package/@orpc/ratelimit) | Rate limiting with memory, Redis, and Upstash adapters. | [Rate Limit](https://orpc.dev/docs/helpers/ratelimit) |
53
- | [@orpc/hibernation](https://www.npmjs.com/package/@orpc/hibernation) | Leverage Hibernation APIs like [Cloudflare's Hibernation WebSocket](https://developers.cloudflare.com/durable-objects/best-practices/websockets/#durable-objects-hibernation-websocket-api). | [Hibernation](https://orpc.dev/docs/integrations/hibernation) |
54
- | [@orpc/json-schema](https://www.npmjs.com/package/@orpc/json-schema) | Smart coercion for OpenAPI requests. | [Smart Coercion](https://orpc.dev/docs/plugins/smart-coercion) |
49
+ | Package | Purpose | Docs |
50
+ | -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------- |
51
+ | [@orpc/publisher](https://www.npmjs.com/package/@orpc/publisher) | Pub/Sub with memory, Redis, and Upstash adapters. | [Publisher](https://orpc.dev/docs/helpers/publisher) |
52
+ | [@orpc/ratelimit](https://www.npmjs.com/package/@orpc/ratelimit) | Rate limiting with memory, Redis, and Upstash adapters. | [Rate Limit](https://orpc.dev/docs/helpers/ratelimit) |
53
+ | [@orpc/experimental-lock](https://www.npmjs.com/package/@orpc/experimental-lock) | Locking with memory, Redis, and Upstash adapters. | [Lock](https://orpc.dev/docs/helpers/lock) |
54
+ | [@orpc/hibernation](https://www.npmjs.com/package/@orpc/hibernation) | Leverage Hibernation APIs like [Cloudflare's Hibernation WebSocket](https://developers.cloudflare.com/durable-objects/best-practices/websockets/#durable-objects-hibernation-websocket-api). | [Hibernation](https://orpc.dev/docs/integrations/hibernation) |
55
+ | [@orpc/json-schema](https://www.npmjs.com/package/@orpc/json-schema) | Smart coercion for OpenAPI requests. | [Smart Coercion](https://orpc.dev/docs/plugins/smart-coercion) |
55
56
 
56
57
  **Framework & ecosystem integrations**
57
58
 
58
- | Package | Purpose | Docs |
59
- | ------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
60
- | [@orpc/next](https://www.npmjs.com/package/@orpc/next) | Integrate with [Next.js Server Functions](https://nextjs.org/docs/app/getting-started/mutating-data). | [Next.js](https://orpc.dev/docs/integrations/next) |
61
- | [@orpc/ai-sdk](https://www.npmjs.com/package/@orpc/ai-sdk) | Turn contracts and procedures into [AI SDK](https://ai-sdk.dev/) tools. | [AI SDK](https://orpc.dev/docs/integrations/ai-sdk) |
62
- | [@orpc/tanstack-query](https://www.npmjs.com/package/@orpc/tanstack-query) | Integrate with [TanStack Query](https://tanstack.com/query/latest). | [TanStack Query](https://orpc.dev/docs/integrations/tanstack-query) |
63
- | [@orpc/pinia-colada](https://www.npmjs.com/package/@orpc/pinia-colada) | Integrate with [Pinia Colada](https://pinia-colada.esm.dev/). | [Pinia Colada](https://orpc.dev/docs/integrations/pinia-colada) |
64
- | [@orpc/swr](https://www.npmjs.com/package/@orpc/swr) | Integrate with [SWR](https://swr.vercel.app/). | [SWR](https://orpc.dev/docs/integrations/swr) |
65
- | [@orpc/experimental-msw](https://www.npmjs.com/package/@orpc/experimental-msw) | Mock procedures with [Mock Service Worker](https://mswjs.io/). | [MSW](https://orpc.dev/docs/integrations/msw) |
66
- | [@orpc/experimental-effect](https://www.npmjs.com/package/@orpc/experimental-effect) | Integrate with [Effect](https://effect.website/). | [Effect](https://orpc.dev/docs/integrations/effect) |
67
- | [@orpc/nest](https://www.npmjs.com/package/@orpc/nest) | Implement your contract with [NestJS](https://nestjs.com/). | [NestJS](https://orpc.dev/docs/integrations/nest) |
68
- | [@orpc/node](https://www.npmjs.com/package/@orpc/node) | [Node.js](https://nodejs.org/) plugins for static file serving and large uploads. | [Static File](https://orpc.dev/docs/plugins/static-file), [Tmp File Upload](https://orpc.dev/docs/plugins/tmp-file-upload), [Batch Response Compression](https://orpc.dev/docs/plugins/batch-response-compression) |
69
- | [@orpc/bun](https://www.npmjs.com/package/@orpc/bun) | Adapters for [Bun's Redis](https://bun.sh/). | [Publisher](https://orpc.dev/docs/helpers/publisher), [Rate Limit](https://orpc.dev/docs/helpers/ratelimit) |
70
- | [@orpc/cloudflare](https://www.npmjs.com/package/@orpc/cloudflare) | Adapters for [Cloudflare Workers](https://developers.cloudflare.com/workers/). | [Publisher](https://orpc.dev/docs/helpers/publisher), [Rate Limit](https://orpc.dev/docs/helpers/ratelimit), [Traces](https://orpc.dev/docs/integrations/cloudflare-traces) |
71
- | [@orpc/trpc](https://www.npmjs.com/package/@orpc/trpc) | Reuse existing [tRPC](https://trpc.io/) routers within oRPC. | [tRPC](https://orpc.dev/docs/integrations/trpc) |
59
+ | Package | Purpose | Docs |
60
+ | ------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
61
+ | [@orpc/next](https://www.npmjs.com/package/@orpc/next) | Integrate with [Next.js Server Functions](https://nextjs.org/docs/app/getting-started/mutating-data). | [Next.js](https://orpc.dev/docs/integrations/next) |
62
+ | [@orpc/ai-sdk](https://www.npmjs.com/package/@orpc/ai-sdk) | Turn contracts and procedures into [AI SDK](https://ai-sdk.dev/) tools. | [AI SDK](https://orpc.dev/docs/integrations/ai-sdk) |
63
+ | [@orpc/tanstack-query](https://www.npmjs.com/package/@orpc/tanstack-query) | Integrate with [TanStack Query](https://tanstack.com/query/latest). | [TanStack Query](https://orpc.dev/docs/integrations/tanstack-query) |
64
+ | [@orpc/pinia-colada](https://www.npmjs.com/package/@orpc/pinia-colada) | Integrate with [Pinia Colada](https://pinia-colada.esm.dev/). | [Pinia Colada](https://orpc.dev/docs/integrations/pinia-colada) |
65
+ | [@orpc/swr](https://www.npmjs.com/package/@orpc/swr) | Integrate with [SWR](https://swr.vercel.app/). | [SWR](https://orpc.dev/docs/integrations/swr) |
66
+ | [@orpc/experimental-msw](https://www.npmjs.com/package/@orpc/experimental-msw) | Mock procedures with [Mock Service Worker](https://mswjs.io/). | [MSW](https://orpc.dev/docs/integrations/msw) |
67
+ | [@orpc/experimental-effect](https://www.npmjs.com/package/@orpc/experimental-effect) | Integrate with [Effect](https://effect.website/). | [Effect](https://orpc.dev/docs/integrations/effect) |
68
+ | [@orpc/nest](https://www.npmjs.com/package/@orpc/nest) | Implement your contract with [NestJS](https://nestjs.com/). | [NestJS](https://orpc.dev/docs/integrations/nest) |
69
+ | [@orpc/node](https://www.npmjs.com/package/@orpc/node) | [Node.js](https://nodejs.org/) plugins for static file serving and large uploads. | [Static File](https://orpc.dev/docs/plugins/static-file), [Tmp File Upload](https://orpc.dev/docs/plugins/tmp-file-upload), [Batch Response Compression](https://orpc.dev/docs/plugins/batch-response-compression) |
70
+ | [@orpc/bun](https://www.npmjs.com/package/@orpc/bun) | Adapters for [Bun's Redis](https://bun.sh/). | [Publisher](https://orpc.dev/docs/helpers/publisher), [Rate Limit](https://orpc.dev/docs/helpers/ratelimit), [Lock](https://orpc.dev/docs/helpers/lock) |
71
+ | [@orpc/cloudflare](https://www.npmjs.com/package/@orpc/cloudflare) | Adapters for [Cloudflare Workers](https://developers.cloudflare.com/workers/). | [Publisher](https://orpc.dev/docs/helpers/publisher), [Rate Limit](https://orpc.dev/docs/helpers/ratelimit), [Lock](https://orpc.dev/docs/helpers/lock), [Traces](https://orpc.dev/docs/integrations/cloudflare-traces) |
72
+ | [@orpc/trpc](https://www.npmjs.com/package/@orpc/trpc) | Reuse existing [tRPC](https://trpc.io/) routers within oRPC. | [tRPC](https://orpc.dev/docs/integrations/trpc) |
72
73
 
73
74
  **Observability**
74
75
 
@@ -94,6 +95,14 @@ Like what we build over at [middleapi](https://github.com/middleapi)? You can he
94
95
  </tr>
95
96
  </table>
96
97
 
98
+ ### Special Sponsors
99
+
100
+ <table>
101
+ <tr>
102
+ <td align="center"><a href="http://twitter.com/rauchg?ref=middleapi&amp;utm_source=middleapi&amp;utm_medium=sponsor" target="_blank" rel="noopener sponsored" title="Guillermo Rauch"><img src="https://avatars.githubusercontent.com/u/13041?u=1ee8d111657cdd02ff6d253df00978d17ee6d722&amp;v=4" width="279" alt="Guillermo Rauch"/><br />Guillermo Rauch</a></td>
103
+ </tr>
104
+ </table>
105
+
97
106
  ### Organization Sponsors
98
107
 
99
108
  <table>
@@ -1,8 +1,8 @@
1
1
  import { sortPlugins, value, intercept, once } from '@orpc/shared';
2
2
  import { toFetchBody, toFetchHeaders, toStandardLazyResponse } from '@standard-server/fetch';
3
- import { S as StandardLink, R as RPCLinkCodec } from '../../shared/client.BOUKaeVg.mjs';
3
+ import { S as StandardLink, R as RPCLinkCodec } from '../../shared/client.DmnKF1vQ.mjs';
4
4
  import '@standard-server/core';
5
- import '../../shared/client.Cik8dxOF.mjs';
5
+ import '../../shared/client.BcRcwiif.mjs';
6
6
  import '../../shared/client.Dtv1JPkU.mjs';
7
7
 
8
8
  class CompositeFetchLinkTransportPlugin {
@@ -1,9 +1,9 @@
1
1
  import { value } from '@orpc/shared';
2
2
  import { ClientPeer, encodePeerMessage, decodePeerMessage, isServerPeerSendMessage, isPeerMessage } from '@standard-server/peer';
3
- import { S as StandardLink, R as RPCLinkCodec } from '../../shared/client.BOUKaeVg.mjs';
3
+ import { S as StandardLink, R as RPCLinkCodec } from '../../shared/client.DmnKF1vQ.mjs';
4
4
  import '@standard-server/core';
5
5
  import '@standard-server/fetch';
6
- import '../../shared/client.Cik8dxOF.mjs';
6
+ import '../../shared/client.BcRcwiif.mjs';
7
7
  import '../../shared/client.Dtv1JPkU.mjs';
8
8
 
9
9
  function postMessagePortMessage(port, data, transfer) {
@@ -1,6 +1,6 @@
1
- export { C as CompositeStandardLinkPlugin, R as RPCLinkCodec, S as StandardLink } from '../../shared/client.BOUKaeVg.mjs';
1
+ export { C as CompositeStandardLinkPlugin, R as RPCLinkCodec, S as StandardLink } from '../../shared/client.DmnKF1vQ.mjs';
2
2
  import '@orpc/shared';
3
3
  import '@standard-server/core';
4
4
  import '@standard-server/fetch';
5
- import '../../shared/client.Cik8dxOF.mjs';
5
+ import '../../shared/client.BcRcwiif.mjs';
6
6
  import '../../shared/client.Dtv1JPkU.mjs';
@@ -1,9 +1,9 @@
1
1
  import { runWithSignal, AbortError, sleep, promiseWithResolvers, sequential, loadBytes, toStringOrBytes } from '@orpc/shared';
2
2
  import { ClientPeer, encodePeerMessage, decodePeerMessage, isServerPeerSendMessage } from '@standard-server/peer';
3
- import { S as StandardLink, R as RPCLinkCodec } from '../../shared/client.BOUKaeVg.mjs';
3
+ import { S as StandardLink, R as RPCLinkCodec } from '../../shared/client.DmnKF1vQ.mjs';
4
4
  import '@standard-server/core';
5
5
  import '@standard-server/fetch';
6
- import '../../shared/client.Cik8dxOF.mjs';
6
+ import '../../shared/client.BcRcwiif.mjs';
7
7
  import '../../shared/client.Dtv1JPkU.mjs';
8
8
 
9
9
  const WEBSOCKET_CONNECTING = 0;
package/dist/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
- import { b as isDefinedError } from './shared/client.Cik8dxOF.mjs';
2
- export { d as RPCJsonSerializer, R as RPCSerializer, e as cloneORPCError, a as createORPCErrorFromJson, c as createORPCErrorFromMalformedResponse, i as isORPCErrorJson, t as toORPCError, w as wrapAsyncIteratorPreservingEventMeta } from './shared/client.Cik8dxOF.mjs';
1
+ import { b as isDefinedError } from './shared/client.BcRcwiif.mjs';
2
+ export { d as RPCJsonSerializer, R as RPCSerializer, e as cloneORPCError, a as createORPCErrorFromJson, c as createORPCErrorFromMalformedResponse, i as isORPCErrorJson, t as toORPCError, w as wrapAsyncIteratorPreservingEventMeta } from './shared/client.BcRcwiif.mjs';
3
3
  import { toArray, intercept, isTypescriptObject } from '@orpc/shared';
4
4
  export { AsyncIteratorClass, asyncIteratorToStream, asyncIteratorToUnproxiedDataStream, consumeAsyncIterator, consumeAsyncIterator as consumeEventIterator, asyncIteratorToStream as eventIteratorToStream, asyncIteratorToUnproxiedDataStream as eventIteratorToUnproxiedDataStream, onAsyncIteratorObjectError, onError, onFinish, onReadableStreamError, onStart, onSuccess, streamToAsyncIteratorObject, streamToAsyncIteratorObject as streamToEventIterator } from '@orpc/shared';
5
5
  export { C as COMMON_ERROR_STATUS_MAP, M as MalformedResponseError, O as ORPCError } from './shared/client.Dtv1JPkU.mjs';
@@ -1,4 +1,4 @@
1
- import { toArray, value, splitInHalf, stringifyJSON, once, isAsyncIteratorObject, defer, loadBytes, allAbortSignal, replicateAsyncIterator, replicateReadableStream, isCompressibleContentType, override, AsyncIteratorClass, sleep, AbortError, anyAbortSignal } from '@orpc/shared';
1
+ import { toArray, value, splitInHalf, safeEncodeURIComponent, stringifyJSON, once, isAsyncIteratorObject, defer, loadBytes, allAbortSignal, replicateAsyncIterator, replicateReadableStream, isCompressibleContentType, override, AsyncIteratorClass, sleep, AbortError, anyAbortSignal } from '@orpc/shared';
2
2
  import { parseStandardUrl, flattenStandardHeader, generateContentDisposition, getEventMeta } from '@standard-server/core';
3
3
  import { ClientPeer, isServerPeerSendMessage, decodePeerMessage } from '@standard-server/peer';
4
4
  import { toFetchHeaders, toStandardBody } from '@standard-server/fetch';
@@ -138,7 +138,7 @@ class BatchLinkPlugin {
138
138
  };
139
139
  if (method === "GET") {
140
140
  const [pathname, search, hash] = parseStandardUrl(url);
141
- const dataParam = `data=${encodeURIComponent(stringifyJSON(pendingMessages))}`;
141
+ const dataParam = `data=${safeEncodeURIComponent(stringifyJSON(pendingMessages))}`;
142
142
  const newUrl = search ? `${pathname}${search}&${dataParam}${hash ?? ""}` : `${pathname}?${dataParam}${hash ?? ""}`;
143
143
  const maxUrlLength = await value(this.maxUrlLength, subOptionsList);
144
144
  if (newUrl.length > maxUrlLength) {
@@ -203,8 +203,7 @@ class RPCJsonSerializer {
203
203
  }
204
204
  let inlineBuiltInHandlers = true;
205
205
  let handlerEntries = [];
206
- for (const key in customHandlers) {
207
- const handler = customHandlers[key];
206
+ for (const [key, handler] of Object.entries(customHandlers)) {
208
207
  this.handlers[key] = handler;
209
208
  if (inlineBuiltInHandlers && key in DEFAULT_RPC_JSON_SERIALIZER_HANDLERS) {
210
209
  inlineBuiltInHandlers = false;
@@ -215,8 +214,7 @@ class RPCJsonSerializer {
215
214
  }
216
215
  if (!inlineBuiltInHandlers) {
217
216
  handlerEntries = [];
218
- for (const key in this.handlers) {
219
- const handler = this.handlers[key];
217
+ for (const [key, handler] of Object.entries(this.handlers)) {
220
218
  if (handler !== void 0) {
221
219
  handlerEntries.push([key, handler]);
222
220
  }
@@ -324,8 +322,7 @@ class RPCJsonSerializer {
324
322
  }
325
323
  if (isPlainObject(data)) {
326
324
  const json = new NullProtoObj();
327
- for (const k in data) {
328
- const v = data[k];
325
+ for (const [k, v] of Object.entries(data)) {
329
326
  if (k === "toJSON" && typeof v === "function") {
330
327
  continue;
331
328
  }
@@ -1,7 +1,7 @@
1
1
  import { sortPlugins, runWithSpan, ORPC_NAME, getTracer, isAsyncIteratorObject, override, traceAsyncIterator, traceReadableStream, intercept, value, pathToHttpPath, stringifyJSON } from '@orpc/shared';
2
2
  import { mergeStandardHeaders, parseStandardUrl } from '@standard-server/core';
3
3
  import { toStandardHeaders } from '@standard-server/fetch';
4
- import { R as RPCSerializer, c as createORPCErrorFromMalformedResponse, i as isORPCErrorJson, a as createORPCErrorFromJson } from './client.Cik8dxOF.mjs';
4
+ import { R as RPCSerializer, c as createORPCErrorFromMalformedResponse, i as isORPCErrorJson, a as createORPCErrorFromJson } from './client.BcRcwiif.mjs';
5
5
 
6
6
  class CompositeStandardLinkPlugin {
7
7
  name = "~composite";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@orpc/client",
3
3
  "type": "module",
4
- "version": "2.0.0-beta.35",
4
+ "version": "2.0.0-beta.36",
5
5
  "description": "Consume oRPC and OpenAPI APIs with end-to-end type safety over HTTP, WebSocket, or message ports",
6
6
  "license": "MIT",
7
7
  "funding": [
@@ -63,7 +63,7 @@
63
63
  "dist"
64
64
  ],
65
65
  "dependencies": {
66
- "@orpc/shared": "2.0.0-beta.35",
66
+ "@orpc/shared": "2.0.0-beta.36",
67
67
  "@standard-server/core": "~0.9.0",
68
68
  "@standard-server/fetch": "~0.9.0",
69
69
  "@standard-server/peer": "~0.9.0"