@orpc/client 2.0.0-beta.21 → 2.0.0-beta.23

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
@@ -109,11 +109,10 @@ Like what we build over at [middleapi](https://github.com/middleapi)? You can he
109
109
  <td align="center"><a href="https://github.com/valerii15298?ref=orpc" target="_blank" rel="noopener" title="Valerii Petryniak"><img src="https://avatars.githubusercontent.com/u/44531564?u=88ac74d9bacd20401518441907acad21063cd397&amp;v=4" width="139" alt="Valerii Petryniak"/><br />Valerii Petryniak</a></td>
110
110
  <td align="center"><a href="https://github.com/letstri?ref=orpc" target="_blank" rel="noopener" title="Valerii Strilets"><img src="https://avatars.githubusercontent.com/u/13253748?u=c7b10399ccc8f8081e24db94ec32cd9858e86ac3&amp;v=4" width="139" alt="Valerii Strilets"/><br />Valerii Strilets</a></td>
111
111
  <td align="center"><a href="https://github.com/K-Mistele?ref=orpc" target="_blank" rel="noopener" title="Kyle Mistele"><img src="https://avatars.githubusercontent.com/u/18430555?u=3afebeb81de666e35aaac3ed46f14159d7603ffb&amp;v=4" width="139" alt="Kyle Mistele"/><br />Kyle Mistele</a></td>
112
- <td align="center"><a href="https://github.com/R44VC0RP?ref=orpc" target="_blank" rel="noopener" title="Ryan Vogel"><img src="https://avatars.githubusercontent.com/u/89211796?u=1857347b9787d8d8a7ea5bfc333f96be92d5a683&amp;v=4" width="139" alt="Ryan Vogel"/><br />Ryan Vogel</a></td>
113
112
  <td align="center"><a href="https://github.com/christ12938?ref=orpc" target="_blank" rel="noopener" title="christ12938"><img src="https://avatars.githubusercontent.com/u/25758598?v=4" width="139" alt="christ12938"/><br />christ12938</a></td>
113
+ <td align="center"><a href="https://github.com/Ryanjso?ref=orpc" target="_blank" rel="noopener" title="Ryan Soderberg"><img src="https://avatars.githubusercontent.com/u/39172778?u=5ed913c31d57e7221b75784abcad48c7ebddde27&amp;v=4" width="139" alt="Ryan Soderberg"/><br />Ryan Soderberg</a></td>
114
114
  </tr>
115
115
  <tr>
116
- <td align="center"><a href="https://github.com/Ryanjso?ref=orpc" target="_blank" rel="noopener" title="Ryan Soderberg"><img src="https://avatars.githubusercontent.com/u/39172778?u=5ed913c31d57e7221b75784abcad48c7ebddde27&amp;v=4" width="139" alt="Ryan Soderberg"/><br />Ryan Soderberg</a></td>
117
116
  <td align="center"><a href="https://github.com/itigoore01?ref=orpc" target="_blank" rel="noopener" title="shota"><img src="https://avatars.githubusercontent.com/u/11831107?u=c976a6dc7e055eb026304c46c99100ed22b0c8e0&amp;v=4" width="139" alt="shota"/><br />shota</a></td>
118
117
  </tr>
119
118
  </table>
@@ -123,24 +122,23 @@ Like what we build over at [middleapi](https://github.com/middleapi)? You can he
123
122
  <table>
124
123
  <tr>
125
124
  <td align="center"><a href="https://github.com/rhinodavid?ref=orpc" target="_blank" rel="noopener" title="David Walsh"><img src="https://avatars.githubusercontent.com/u/5778036?u=b5521f07d2f88c3db2a0dae62b5f2f8357214af0&amp;v=4" width="119" alt="David Walsh"/><br />David Walsh</a></td>
126
- <td align="center"><a href="https://github.com/Nic13Gamer?ref=orpc" target="_blank" rel="noopener" title="Nicholas"><img src="https://avatars.githubusercontent.com/u/54724556?u=56a7ab430ce7a80d648ab6eba051d454a818ed0b&amp;v=4" width="119" alt="Nicholas"/><br />Nicholas</a></td>
127
125
  <td align="center"><a href="https://github.com/Robbe95?ref=orpc" target="_blank" rel="noopener" title="Robbe Vaes"><img src="https://avatars.githubusercontent.com/u/44748019?u=e0232402c045ad4eac7cbd217f1f47e083103b89&amp;v=4" width="119" alt="Robbe Vaes"/><br />Robbe Vaes</a></td>
128
126
  <td align="center"><a href="https://github.com/aidansunbury?ref=orpc" target="_blank" rel="noopener" title="Aidan Sunbury"><img src="https://avatars.githubusercontent.com/u/64103161?v=4" width="119" alt="Aidan Sunbury"/><br />Aidan Sunbury</a></td>
129
127
  <td align="center"><a href="https://github.com/soonoo?ref=orpc" target="_blank" rel="noopener" title="soonoo"><img src="https://avatars.githubusercontent.com/u/5436405?u=5d0b4aa955c87e30e6bda7f0cccae5402da99528&amp;v=4" width="119" alt="soonoo"/><br />soonoo</a></td>
130
128
  <td align="center"><a href="https://github.com/kporten?ref=orpc" target="_blank" rel="noopener" title="Kevin Porten"><img src="https://avatars.githubusercontent.com/u/1839345?u=dc2263d5cfe0d927ce1a0be04a1d55dd6b55405c&amp;v=4" width="119" alt="Kevin Porten"/><br />Kevin Porten</a></td>
131
129
  <td align="center"><a href="https://github.com/pumpkinlink?ref=orpc" target="_blank" rel="noopener" title="Denis"><img src="https://avatars.githubusercontent.com/u/11864620?u=5f47bbe6c65d0f6f5cf011021490238e4b0593d0&amp;v=4" width="119" alt="Denis"/><br />Denis</a></td>
130
+ <td align="center"><a href="https://github.com/christopher-kapic?ref=orpc" target="_blank" rel="noopener" title="Christopher Kapic"><img src="https://avatars.githubusercontent.com/u/59740769?u=e7ad4b72b5bf6c9eb1644c26dbf3332a8f987377&amp;v=4" width="119" alt="Christopher Kapic"/><br />Christopher Kapic</a></td>
132
131
  </tr>
133
132
  <tr>
134
- <td align="center"><a href="https://github.com/christopher-kapic?ref=orpc" target="_blank" rel="noopener" title="Christopher Kapic"><img src="https://avatars.githubusercontent.com/u/59740769?u=e7ad4b72b5bf6c9eb1644c26dbf3332a8f987377&amp;v=4" width="119" alt="Christopher Kapic"/><br />Christopher Kapic</a></td>
135
133
  <td align="center"><a href="https://github.com/thomasballinger?ref=orpc" target="_blank" rel="noopener" title="Tom Ballinger"><img src="https://avatars.githubusercontent.com/u/458879?u=4b045ac75d721b6ac2b42a74d7d37f61f0414031&amp;v=4" width="119" alt="Tom Ballinger"/><br />Tom Ballinger</a></td>
136
134
  <td align="center"><a href="https://github.com/SSam0419?ref=orpc" target="_blank" rel="noopener" title="Sam"><img src="https://avatars.githubusercontent.com/u/102863520?u=3c89611f549d5070be232eb4532f690c8f2e7a65&amp;v=4" width="119" alt="Sam"/><br />Sam</a></td>
137
135
  <td align="center"><a href="https://github.com/Titoine?ref=orpc" target="_blank" rel="noopener" title="Titoine"><img src="https://avatars.githubusercontent.com/u/3514286?u=1bb1e86b0c99c8a1121372e56d51a177eea12191&amp;v=4" width="119" alt="Titoine"/><br />Titoine</a></td>
138
136
  <td align="center"><a href="https://github.com/Mnigos?ref=orpc" target="_blank" rel="noopener" title="Igor Makowski"><img src="https://avatars.githubusercontent.com/u/56691628?u=ee8c879478f7c151b9156aef6c74243fa3e247a8&amp;v=4" width="119" alt="Igor Makowski"/><br />Igor Makowski</a></td>
139
137
  <td align="center"><a href="https://github.com/hanayashiki?ref=orpc" target="_blank" rel="noopener" title="hanayashiki"><img src="https://avatars.githubusercontent.com/u/26056783?u=06c3b9205a16fd41a871e82da1cc2a09306d53f5&amp;v=4" width="119" alt="hanayashiki"/><br />hanayashiki</a></td>
140
138
  <td align="center"><a href="https://github.com/ldub?ref=orpc" target="_blank" rel="noopener" title="Lev Dubinets"><img src="https://avatars.githubusercontent.com/u/3114081?u=f547f5d5012cab54851f1b1ad72d10e537f78fc2&amp;v=4" width="119" alt="Lev Dubinets"/><br />Lev Dubinets</a></td>
139
+ <td align="center"><a href="https://github.com/mr-kelly?ref=orpc" target="_blank" rel="noopener" title="Kelly Peilin Chan"><img src="https://avatars.githubusercontent.com/u/520852?u=6b0f7105f694e7b5cacf410a3f04c7044b469dc8&amp;v=4" width="119" alt="Kelly Peilin Chan"/><br />Kelly Peilin Chan</a></td>
141
140
  </tr>
142
141
  <tr>
143
- <td align="center"><a href="https://github.com/mr-kelly?ref=orpc" target="_blank" rel="noopener" title="Kelly Peilin Chan"><img src="https://avatars.githubusercontent.com/u/520852?u=6b0f7105f694e7b5cacf410a3f04c7044b469dc8&amp;v=4" width="119" alt="Kelly Peilin Chan"/><br />Kelly Peilin Chan</a></td>
144
142
  <td align="center"><a href="https://github.com/piscis?ref=orpc" target="_blank" rel="noopener" title="Alex"><img src="https://avatars.githubusercontent.com/u/326163?u=b245f368bd940cf51d08c0b6bf55f8257f359437&amp;v=4" width="119" alt="Alex"/><br />Alex</a></td>
145
143
  <td align="center"><a href="https://github.com/finom?ref=orpc" target="_blank" rel="noopener" title="Andrey Gubanov"><img src="https://avatars.githubusercontent.com/u/1082083?u=29e91400dbd4a9c217048a8f59562c4f740498e6&amp;v=4" width="119" alt="Andrey Gubanov"/><br />Andrey Gubanov</a></td>
146
144
  </tr>
@@ -173,6 +171,7 @@ Like what we build over at [middleapi](https://github.com/middleapi)? You can he
173
171
  <a href="https://github.com/nguyenlc1993?ref=orpc" target="_blank" rel="noopener" title="Lê Cao Nguyên"><img src="https://avatars.githubusercontent.com/u/13871971?u=83c8b69d9e35b589c4e1f066cc113b1d9461386f&amp;v=4" width="32" height="32" alt="Lê Cao Nguyên" /></a>
174
172
  <a href="https://github.com/wobsoriano?ref=orpc" target="_blank" rel="noopener" title="Robert Soriano"><img src="https://avatars.githubusercontent.com/u/13049130?u=6d72104182e7c9ed25934815313fb69107332111&amp;v=4" width="32" height="32" alt="Robert Soriano" /></a>
175
173
  <a href="https://github.com/andrewpeters9?ref=orpc" target="_blank" rel="noopener" title="Andrew Peters"><img src="https://avatars.githubusercontent.com/u/36251325?v=4" width="32" height="32" alt="Andrew Peters" /></a>
174
+ <a href="https://github.com/R44VC0RP?ref=orpc" target="_blank" rel="noopener" title="Ryan Vogel"><img src="https://avatars.githubusercontent.com/u/89211796?u=1857347b9787d8d8a7ea5bfc333f96be92d5a683&amp;v=4" width="32" height="32" alt="Ryan Vogel" /></a>
176
175
  <a href="https://github.com/SKostyukovich?ref=orpc" target="_blank" rel="noopener" title="SKostyukovich"><img src="https://avatars.githubusercontent.com/u/10700067?v=4" width="32" height="32" alt="SKostyukovich" /></a>
177
176
  <a href="https://github.com/peter-adam-dy?ref=orpc" target="_blank" rel="noopener" title="Peter Adam"><img src="https://avatars.githubusercontent.com/u/132129459?u=4f3dbbb3b443990b56acb7d6a5d11ed2c555f6db&amp;v=4" width="32" height="32" alt="Peter Adam" /></a>
178
177
  <a href="https://github.com/FabworksHQ?ref=orpc" target="_blank" rel="noopener" title="Fabworks"><img src="https://avatars.githubusercontent.com/u/160179500?v=4" width="32" height="32" alt="Fabworks" /></a>
@@ -185,6 +184,7 @@ Like what we build over at [middleapi](https://github.com/middleapi)? You can he
185
184
  <a href="https://github.com/nattstack?ref=orpc" target="_blank" rel="noopener" title="natt"><img src="https://avatars.githubusercontent.com/u/31426677?u=fa9dbb8b3e66eb0ea3c88db5dc07f31c8c5418fe&amp;v=4" width="32" height="32" alt="natt" /></a>
186
185
  <a href="https://github.com/ChromeGG?ref=orpc" target="_blank" rel="noopener" title="Adam Tkaczyk"><img src="https://avatars.githubusercontent.com/u/39050595?u=a58ca6042a6950e94e6e92442db76ef584279bc0&amp;v=4" width="32" height="32" alt="Adam Tkaczyk" /></a>
187
186
  <a href="https://github.com/plancraft?ref=orpc" target="_blank" rel="noopener" title="plancraft"><img src="https://avatars.githubusercontent.com/u/46482287?v=4" width="32" height="32" alt="plancraft" /></a>
187
+ <a href="https://github.com/Nic13Gamer?ref=orpc" target="_blank" rel="noopener" title="Nicholas"><img src="https://avatars.githubusercontent.com/u/54724556?u=56a7ab430ce7a80d648ab6eba051d454a818ed0b&amp;v=4" width="32" height="32" alt="Nicholas" /></a>
188
188
  </p>
189
189
 
190
190
  ## References
@@ -4,7 +4,7 @@ import { StandardRequest, StandardLazyResponse } from '@standardserver/core';
4
4
  import { ToFetchBodyOptions } from '@standardserver/fetch';
5
5
  import { S as StandardLinkTransport, c as StandardLinkPlugin, a as StandardLink, b as StandardLinkOptions } from '../../shared/client.8f4DNmdE.mjs';
6
6
  import { RPCLinkCodecOptions } from '../standard/index.mjs';
7
- import '../../shared/client.BdItY5DT.mjs';
7
+ import '../../shared/client.Dlxz9Qw5.mjs';
8
8
 
9
9
  interface FetchLinkTransportFetchInterceptorOptions<T extends ClientContext> extends ClientOptions<T> {
10
10
  path: string[];
@@ -4,7 +4,7 @@ import { StandardRequest, StandardLazyResponse } from '@standardserver/core';
4
4
  import { ToFetchBodyOptions } from '@standardserver/fetch';
5
5
  import { S as StandardLinkTransport, c as StandardLinkPlugin, a as StandardLink, b as StandardLinkOptions } from '../../shared/client.BMKYqpdy.js';
6
6
  import { RPCLinkCodecOptions } from '../standard/index.js';
7
- import '../../shared/client.BdItY5DT.js';
7
+ import '../../shared/client.Dlxz9Qw5.js';
8
8
 
9
9
  interface FetchLinkTransportFetchInterceptorOptions<T extends ClientContext> extends ClientOptions<T> {
10
10
  path: string[];
@@ -1,9 +1,9 @@
1
1
  import { sortPlugins, value, intercept, once } from '@orpc/shared';
2
2
  import { toFetchBody, toFetchHeaders, toStandardLazyResponse } from '@standardserver/fetch';
3
- import { S as StandardLink, R as RPCLinkCodec } from '../../shared/client.BRJnOJ0R.mjs';
3
+ import { S as StandardLink, R as RPCLinkCodec } from '../../shared/client.Bl4junIW.mjs';
4
4
  import '@standardserver/core';
5
5
  import '../../shared/client.Dnfj8jnT.mjs';
6
- import '../../shared/client.DqYwRDUO.mjs';
6
+ import '../../shared/client.DQpq_Sdn.mjs';
7
7
 
8
8
  class CompositeFetchLinkTransportPlugin {
9
9
  constructor(plugins = []) {
@@ -4,7 +4,7 @@ import { StandardRequest, StandardLazyResponse } from '@standardserver/core';
4
4
  import { ClientPeer, EncodePeerMessageOptions, DecodePeerMessageOptions } from '@standardserver/peer';
5
5
  import { S as StandardLinkTransport, a as StandardLink, b as StandardLinkOptions } from '../../shared/client.8f4DNmdE.mjs';
6
6
  import { RPCLinkCodecOptions } from '../standard/index.mjs';
7
- import '../../shared/client.BdItY5DT.mjs';
7
+ import '../../shared/client.Dlxz9Qw5.mjs';
8
8
 
9
9
  /**
10
10
  * The message port used by electron in main process
@@ -4,7 +4,7 @@ import { StandardRequest, StandardLazyResponse } from '@standardserver/core';
4
4
  import { ClientPeer, EncodePeerMessageOptions, DecodePeerMessageOptions } from '@standardserver/peer';
5
5
  import { S as StandardLinkTransport, a as StandardLink, b as StandardLinkOptions } from '../../shared/client.BMKYqpdy.js';
6
6
  import { RPCLinkCodecOptions } from '../standard/index.js';
7
- import '../../shared/client.BdItY5DT.js';
7
+ import '../../shared/client.Dlxz9Qw5.js';
8
8
 
9
9
  /**
10
10
  * The message port used by electron in main process
@@ -1,10 +1,10 @@
1
1
  import { value } from '@orpc/shared';
2
2
  import { ClientPeer, encodePeerMessage, decodePeerMessage, isServerPeerSendMessage, isPeerMessage } from '@standardserver/peer';
3
- import { S as StandardLink, R as RPCLinkCodec } from '../../shared/client.BRJnOJ0R.mjs';
3
+ import { S as StandardLink, R as RPCLinkCodec } from '../../shared/client.Bl4junIW.mjs';
4
4
  import '@standardserver/core';
5
5
  import '@standardserver/fetch';
6
6
  import '../../shared/client.Dnfj8jnT.mjs';
7
- import '../../shared/client.DqYwRDUO.mjs';
7
+ import '../../shared/client.DQpq_Sdn.mjs';
8
8
 
9
9
  function postMessagePortMessage(port, data, transfer) {
10
10
  if (transfer) {
@@ -4,7 +4,7 @@ import { Value, Promisable } from '@orpc/shared';
4
4
  import { StandardUrl, StandardHeaders, StandardRequest, StandardLazyResponse } from '@standardserver/core';
5
5
  export { StandardBody, StandardBodyHint, StandardHeaders, StandardLazyRequest, StandardLazyResponse, StandardMethod, StandardRequest, StandardResponse, StandardUrl } from '@standardserver/core';
6
6
  import { C as ClientContext, a as ClientOptions } from '../../shared/client.BBZBQID8.mjs';
7
- import { e as RPCSerializer } from '../../shared/client.BdItY5DT.mjs';
7
+ import { e as RPCSerializer } from '../../shared/client.Dlxz9Qw5.mjs';
8
8
 
9
9
  interface RPCLinkCodecOptions<T extends ClientContext> {
10
10
  /**
@@ -4,7 +4,7 @@ import { Value, Promisable } from '@orpc/shared';
4
4
  import { StandardUrl, StandardHeaders, StandardRequest, StandardLazyResponse } from '@standardserver/core';
5
5
  export { StandardBody, StandardBodyHint, StandardHeaders, StandardLazyRequest, StandardLazyResponse, StandardMethod, StandardRequest, StandardResponse, StandardUrl } from '@standardserver/core';
6
6
  import { C as ClientContext, a as ClientOptions } from '../../shared/client.BBZBQID8.js';
7
- import { e as RPCSerializer } from '../../shared/client.BdItY5DT.js';
7
+ import { e as RPCSerializer } from '../../shared/client.Dlxz9Qw5.js';
8
8
 
9
9
  interface RPCLinkCodecOptions<T extends ClientContext> {
10
10
  /**
@@ -1,6 +1,6 @@
1
- export { C as CompositeStandardLinkPlugin, R as RPCLinkCodec, S as StandardLink } from '../../shared/client.BRJnOJ0R.mjs';
1
+ export { C as CompositeStandardLinkPlugin, R as RPCLinkCodec, S as StandardLink } from '../../shared/client.Bl4junIW.mjs';
2
2
  import '@orpc/shared';
3
3
  import '@standardserver/core';
4
4
  import '@standardserver/fetch';
5
5
  import '../../shared/client.Dnfj8jnT.mjs';
6
- import '../../shared/client.DqYwRDUO.mjs';
6
+ import '../../shared/client.DQpq_Sdn.mjs';
@@ -4,7 +4,7 @@ import { StandardRequest, StandardLazyResponse } from '@standardserver/core';
4
4
  import { EncodePeerMessageOptions, DecodePeerMessageOptions } from '@standardserver/peer';
5
5
  import { S as StandardLinkTransport, a as StandardLink, b as StandardLinkOptions } from '../../shared/client.8f4DNmdE.mjs';
6
6
  import { RPCLinkCodecOptions } from '../standard/index.mjs';
7
- import '../../shared/client.BdItY5DT.mjs';
7
+ import '../../shared/client.Dlxz9Qw5.mjs';
8
8
 
9
9
  type WebSocketLike = Pick<WebSocket, 'addEventListener' | 'removeEventListener' | 'send' | 'readyState'>;
10
10
  interface WebSocketLinkTransportAttemptInfo {
@@ -4,7 +4,7 @@ import { StandardRequest, StandardLazyResponse } from '@standardserver/core';
4
4
  import { EncodePeerMessageOptions, DecodePeerMessageOptions } from '@standardserver/peer';
5
5
  import { S as StandardLinkTransport, a as StandardLink, b as StandardLinkOptions } from '../../shared/client.BMKYqpdy.js';
6
6
  import { RPCLinkCodecOptions } from '../standard/index.js';
7
- import '../../shared/client.BdItY5DT.js';
7
+ import '../../shared/client.Dlxz9Qw5.js';
8
8
 
9
9
  type WebSocketLike = Pick<WebSocket, 'addEventListener' | 'removeEventListener' | 'send' | 'readyState'>;
10
10
  interface WebSocketLinkTransportAttemptInfo {
@@ -1,10 +1,10 @@
1
1
  import { runWithSignal, AbortError, sleep, promiseWithResolvers, sequential, loadBytes, toStringOrBytes } from '@orpc/shared';
2
2
  import { ClientPeer, encodePeerMessage, decodePeerMessage, isServerPeerSendMessage } from '@standardserver/peer';
3
- import { S as StandardLink, R as RPCLinkCodec } from '../../shared/client.BRJnOJ0R.mjs';
3
+ import { S as StandardLink, R as RPCLinkCodec } from '../../shared/client.Bl4junIW.mjs';
4
4
  import '@standardserver/core';
5
5
  import '@standardserver/fetch';
6
6
  import '../../shared/client.Dnfj8jnT.mjs';
7
- import '../../shared/client.DqYwRDUO.mjs';
7
+ import '../../shared/client.DQpq_Sdn.mjs';
8
8
 
9
9
  const WEBSOCKET_CONNECTING = 0;
10
10
  const WEBSOCKET_OPEN = 1;
package/dist/index.d.mts CHANGED
@@ -2,7 +2,7 @@ import { WrapAsyncIteratorOptions, AsyncIteratorClass, Interceptor, PromiseWithE
2
2
  export { AsyncCleanupFn, AsyncIteratorClass, AsyncIteratorClassNextFn, MaybeOptionalOptions, PromiseWithError, Registry, ThrowableError, 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';
3
3
  import { C as ClientContext, a as ClientOptions, c as AnyNestedClient, I as InferClientContext, d as InferClientError, e as Client, b as ClientLink, A as AnyORPCError, f as ClientRest, F as FriendlyClientOptions, O as ORPCErrorCode, g as ORPCError, h as ORPCErrorJSON } from './shared/client.BBZBQID8.mjs';
4
4
  export { i as AnyORPCErrorJSON, j as COMMON_ERROR_STATUS_MAP, k as InferClientBodyInputs, l as InferClientBodyOutputs, m as InferClientErrors, n as InferClientInputs, o as InferClientOutputs, N as NestedClient, p as ORPCErrorOptions } from './shared/client.BBZBQID8.mjs';
5
- export { R as RPCJsonSerialization, a as RPCJsonSerializationMeta, b as RPCJsonSerializer, c as RPCJsonSerializerHandler, d as RPCJsonSerializerOptions, e as RPCSerializer, f as RPCSerializerOptions, g as RPCSerializerSerializeOptions } from './shared/client.BdItY5DT.mjs';
5
+ export { R as RPCJsonSerialization, a as RPCJsonSerializationMeta, b as RPCJsonSerializer, c as RPCJsonSerializerHandler, d as RPCJsonSerializerOptions, e as RPCSerializer, f as RPCSerializerOptions, g as RPCSerializerSerializeOptions } from './shared/client.Dlxz9Qw5.mjs';
6
6
  export { ErrorEvent, EventMeta, getEventMeta, unwrapEvent, withEventMeta } from '@standardserver/core';
7
7
 
8
8
  declare function wrapAsyncIteratorPreservingEventMeta<TYield, TReturn, TMappedYield = TYield, TMappedReturn = TReturn>(iterator: AsyncIterator<TYield, TReturn>, { mapResult, mapError, ...rest }: WrapAsyncIteratorOptions<TYield, TReturn, TMappedYield, TMappedReturn>): AsyncIteratorClass<TMappedYield, TMappedReturn>;
package/dist/index.d.ts CHANGED
@@ -2,7 +2,7 @@ import { WrapAsyncIteratorOptions, AsyncIteratorClass, Interceptor, PromiseWithE
2
2
  export { AsyncCleanupFn, AsyncIteratorClass, AsyncIteratorClassNextFn, MaybeOptionalOptions, PromiseWithError, Registry, ThrowableError, 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';
3
3
  import { C as ClientContext, a as ClientOptions, c as AnyNestedClient, I as InferClientContext, d as InferClientError, e as Client, b as ClientLink, A as AnyORPCError, f as ClientRest, F as FriendlyClientOptions, O as ORPCErrorCode, g as ORPCError, h as ORPCErrorJSON } from './shared/client.BBZBQID8.js';
4
4
  export { i as AnyORPCErrorJSON, j as COMMON_ERROR_STATUS_MAP, k as InferClientBodyInputs, l as InferClientBodyOutputs, m as InferClientErrors, n as InferClientInputs, o as InferClientOutputs, N as NestedClient, p as ORPCErrorOptions } from './shared/client.BBZBQID8.js';
5
- export { R as RPCJsonSerialization, a as RPCJsonSerializationMeta, b as RPCJsonSerializer, c as RPCJsonSerializerHandler, d as RPCJsonSerializerOptions, e as RPCSerializer, f as RPCSerializerOptions, g as RPCSerializerSerializeOptions } from './shared/client.BdItY5DT.js';
5
+ export { R as RPCJsonSerialization, a as RPCJsonSerializationMeta, b as RPCJsonSerializer, c as RPCJsonSerializerHandler, d as RPCJsonSerializerOptions, e as RPCSerializer, f as RPCSerializerOptions, g as RPCSerializerSerializeOptions } from './shared/client.Dlxz9Qw5.js';
6
6
  export { ErrorEvent, EventMeta, getEventMeta, unwrapEvent, withEventMeta } from '@standardserver/core';
7
7
 
8
8
  declare function wrapAsyncIteratorPreservingEventMeta<TYield, TReturn, TMappedYield = TYield, TMappedReturn = TReturn>(iterator: AsyncIterator<TYield, TReturn>, { mapResult, mapError, ...rest }: WrapAsyncIteratorOptions<TYield, TReturn, TMappedYield, TMappedReturn>): AsyncIteratorClass<TMappedYield, TMappedReturn>;
package/dist/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
- import { a as isInferableError } from './shared/client.DqYwRDUO.mjs';
2
- export { b as RPCJsonSerializer, R as RPCSerializer, d as cloneORPCError, c as createORPCErrorFromJson, i as isORPCErrorJson, t as toORPCError, w as wrapAsyncIteratorPreservingEventMeta } from './shared/client.DqYwRDUO.mjs';
1
+ import { a as isInferableError } from './shared/client.DQpq_Sdn.mjs';
2
+ export { b as RPCJsonSerializer, R as RPCSerializer, d as cloneORPCError, c as createORPCErrorFromJson, i as isORPCErrorJson, t as toORPCError, w as wrapAsyncIteratorPreservingEventMeta } from './shared/client.DQpq_Sdn.mjs';
3
3
  import { getOrBind, 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, O as ORPCError } from './shared/client.Dnfj8jnT.mjs';
@@ -2,7 +2,7 @@ import { sortPlugins, runWithSpan, ORPC_NAME, isAsyncIteratorObject, override, t
2
2
  import { mergeStandardHeaders, parseStandardUrl } from '@standardserver/core';
3
3
  import { toStandardHeaders } from '@standardserver/fetch';
4
4
  import { O as ORPCError } from './client.Dnfj8jnT.mjs';
5
- import { R as RPCSerializer, i as isORPCErrorJson, c as createORPCErrorFromJson } from './client.DqYwRDUO.mjs';
5
+ import { R as RPCSerializer, i as isORPCErrorJson, c as createORPCErrorFromJson } from './client.DQpq_Sdn.mjs';
6
6
 
7
7
  class CompositeStandardLinkPlugin {
8
8
  name = "~composite";
@@ -1,4 +1,4 @@
1
- import { isPlainObject, wrapAsyncIterator, isTypescriptObject, isAsyncIteratorObject, stringifyJSON } from '@orpc/shared';
1
+ import { isPlainObject, wrapAsyncIterator, isTypescriptObject, NullProtoObj, isAsyncIteratorObject, stringifyJSON } from '@orpc/shared';
2
2
  import { getEventMeta, withEventMeta, ErrorEvent } from '@standardserver/core';
3
3
  import { O as ORPCError } from './client.Dnfj8jnT.mjs';
4
4
 
@@ -66,7 +66,7 @@ function wrapAsyncIteratorPreservingEventMeta(iterator, { mapResult, mapError, .
66
66
  });
67
67
  }
68
68
 
69
- const REGEX_STRING_PATTERN = /^\/(.*)\/([a-z]*)$/;
69
+ const REGEX_STRING_PATTERN = /^\/([\s\S]*)\/([a-z]*)$/;
70
70
  const DEFAULT_RPC_JSON_SERIALIZER_HANDLERS = {
71
71
  undefined: {
72
72
  condition(data) {
@@ -169,49 +169,140 @@ const DEFAULT_RPC_JSON_SERIALIZER_HANDLERS = {
169
169
  };
170
170
  class RPCJsonSerializer {
171
171
  handlers;
172
+ inlineBuiltInHandlers;
173
+ handlerEntries;
172
174
  omitUndefinedProperties;
173
175
  constructor(options = {}) {
174
- this.handlers = {
175
- ...DEFAULT_RPC_JSON_SERIALIZER_HANDLERS,
176
- ...options.handlers
177
- };
178
176
  this.omitUndefinedProperties = options.omitUndefinedProperties !== false;
177
+ this.handlers = Object.assign(new NullProtoObj(), DEFAULT_RPC_JSON_SERIALIZER_HANDLERS);
178
+ const customHandlers = options.handlers;
179
+ if (customHandlers === void 0) {
180
+ this.inlineBuiltInHandlers = true;
181
+ return;
182
+ }
183
+ let inlineBuiltInHandlers = true;
184
+ let handlerEntries = [];
185
+ for (const key in customHandlers) {
186
+ const handler = customHandlers[key];
187
+ this.handlers[key] = handler;
188
+ if (inlineBuiltInHandlers && key in DEFAULT_RPC_JSON_SERIALIZER_HANDLERS) {
189
+ inlineBuiltInHandlers = false;
190
+ }
191
+ if (inlineBuiltInHandlers && handler !== void 0) {
192
+ handlerEntries.push([key, handler]);
193
+ }
194
+ }
195
+ if (!inlineBuiltInHandlers) {
196
+ handlerEntries = [];
197
+ for (const key in this.handlers) {
198
+ const handler = this.handlers[key];
199
+ if (handler !== void 0) {
200
+ handlerEntries.push([key, handler]);
201
+ }
202
+ }
203
+ }
204
+ this.inlineBuiltInHandlers = inlineBuiltInHandlers;
205
+ this.handlerEntries = handlerEntries;
179
206
  }
180
207
  serialize(data) {
181
- const [json, meta_, maps, blobs] = this.serializeValue(data, [], [], [], []);
182
- const meta = meta_.length === 0 ? void 0 : meta_;
208
+ let meta = [];
209
+ const maps = [];
210
+ const blobs = [];
211
+ const json = this.serializeValue(data, [], meta, maps, blobs);
212
+ meta = meta.length === 0 ? void 0 : meta;
183
213
  if (maps.length === 0) {
184
214
  return { json, meta };
185
215
  }
186
216
  return { json, meta, maps, blobs };
187
217
  }
218
+ /**
219
+ * `segments` is a shared mutable stack (push/pop while walking),
220
+ * so it must be copied before being stored in `meta` or `maps`.
221
+ */
188
222
  serializeValue(data, segments, meta, maps, blobs) {
189
- for (const key in this.handlers) {
190
- const handler = this.handlers[key];
191
- if (handler && handler.condition(data)) {
192
- const serialized = handler.serialize(data);
193
- if (handler.isTerminal) {
194
- meta.push([key, ...segments]);
195
- return [serialized, meta, maps, blobs];
223
+ if (this.inlineBuiltInHandlers) {
224
+ switch (typeof data) {
225
+ case "string":
226
+ case "boolean":
227
+ return data;
228
+ case "number":
229
+ if (Number.isNaN(data)) {
230
+ meta.push(["nan", ...segments]);
231
+ return null;
232
+ }
233
+ return data;
234
+ case "undefined":
235
+ meta.push(["undefined", ...segments]);
236
+ return null;
237
+ case "bigint":
238
+ meta.push(["bigint", ...segments]);
239
+ return data.toString();
240
+ case "object": {
241
+ if (data === null) {
242
+ return data;
243
+ }
244
+ if (data instanceof Date) {
245
+ meta.push(["date", ...segments]);
246
+ return Number.isNaN(data.getTime()) ? null : data.toISOString();
247
+ }
248
+ if (data instanceof URL) {
249
+ meta.push(["url", ...segments]);
250
+ return data.toString();
251
+ }
252
+ if (data instanceof RegExp) {
253
+ meta.push(["regexp", ...segments]);
254
+ return data.toString();
255
+ }
256
+ if (data instanceof Set) {
257
+ const result = this.serializeValue(Array.from(data), segments, meta, maps, blobs);
258
+ meta.push(["set", ...segments]);
259
+ return result;
260
+ }
261
+ if (data instanceof Map) {
262
+ const result = this.serializeValue(Array.from(data.entries()), segments, meta, maps, blobs);
263
+ meta.push(["map", ...segments]);
264
+ return result;
265
+ }
266
+ }
267
+ }
268
+ }
269
+ const handlerEntries = this.handlerEntries;
270
+ if (handlerEntries) {
271
+ for (let i = 0; i < handlerEntries.length; i++) {
272
+ const entry = handlerEntries[i];
273
+ const handler = entry[1];
274
+ if (handler.condition(data)) {
275
+ const serialized = handler.serialize(data);
276
+ if (handler.isTerminal) {
277
+ meta.push([entry[0], ...segments]);
278
+ if (serialized instanceof Blob) {
279
+ maps.push(segments.slice());
280
+ blobs.push(serialized);
281
+ }
282
+ return serialized;
283
+ }
284
+ const result = this.serializeValue(serialized, segments, meta, maps, blobs);
285
+ meta.push([entry[0], ...segments]);
286
+ return result;
196
287
  }
197
- const result = this.serializeValue(serialized, segments, meta, maps, blobs);
198
- meta.push([key, ...segments]);
199
- return result;
200
288
  }
201
289
  }
202
290
  if (data instanceof Blob) {
203
- maps.push(segments);
291
+ maps.push(segments.slice());
204
292
  blobs.push(data);
205
- return [data, meta, maps, blobs];
293
+ return data;
206
294
  }
207
295
  if (Array.isArray(data)) {
208
- const json = data.map((v, i) => {
209
- return this.serializeValue(v, [...segments, i], meta, maps, blobs)[0];
210
- });
211
- return [json, meta, maps, blobs];
296
+ const json = [];
297
+ for (let i = 0; i < data.length; i++) {
298
+ segments.push(i);
299
+ json.push(this.serializeValue(data[i], segments, meta, maps, blobs));
300
+ segments.pop();
301
+ }
302
+ return json;
212
303
  }
213
304
  if (isPlainObject(data)) {
214
- const json = {};
305
+ const json = new NullProtoObj();
215
306
  for (const k in data) {
216
307
  const v = data[k];
217
308
  if (k === "toJSON" && typeof v === "function") {
@@ -220,41 +311,46 @@ class RPCJsonSerializer {
220
311
  if (v === void 0 && this.omitUndefinedProperties) {
221
312
  continue;
222
313
  }
223
- json[k] = this.serializeValue(v, [...segments, k], meta, maps, blobs)[0];
314
+ segments.push(k);
315
+ json[k] = this.serializeValue(v, segments, meta, maps, blobs);
316
+ segments.pop();
224
317
  }
225
- return [json, meta, maps, blobs];
318
+ return json;
226
319
  }
227
- return [data, meta, maps, blobs];
320
+ return data;
228
321
  }
229
322
  deserialize(serialized) {
230
323
  const ref = { data: serialized.json };
231
324
  if (serialized.blobs?.length) {
232
- serialized.maps.forEach((segments, i) => {
325
+ for (let i = 0; i < serialized.maps.length; i++) {
326
+ const segments = serialized.maps[i];
233
327
  let currentRef = ref;
234
328
  let preSegment = "data";
235
- segments.forEach((segment) => {
329
+ for (let j = 0; j < segments.length; j++) {
236
330
  currentRef = currentRef[preSegment];
237
- preSegment = segment;
331
+ preSegment = segments[j];
238
332
  if (!Object.hasOwn(currentRef, preSegment)) {
239
333
  throw new Error(`Security error: Invalid serialized data. Segment "${preSegment}" does not exist.`);
240
334
  }
241
- });
335
+ }
242
336
  currentRef[preSegment] = serialized.blobs[i];
243
- });
337
+ }
244
338
  }
245
- serialized.meta?.forEach((item) => {
246
- const type = item[0];
247
- let currentRef = ref;
248
- let preSegment = "data";
249
- for (let i = 1; i < item.length; i++) {
250
- currentRef = currentRef[preSegment];
251
- preSegment = item[i];
252
- if (!Object.hasOwn(currentRef, preSegment)) {
253
- throw new Error(`Security error: Invalid serialized data. Segment "${preSegment}" does not exist.`);
339
+ if (serialized.meta) {
340
+ for (const item of serialized.meta) {
341
+ const type = item[0];
342
+ let currentRef = ref;
343
+ let preSegment = "data";
344
+ for (let i = 1; i < item.length; i++) {
345
+ currentRef = currentRef[preSegment];
346
+ preSegment = item[i];
347
+ if (!Object.hasOwn(currentRef, preSegment)) {
348
+ throw new Error(`Security error: Invalid serialized data. Segment "${preSegment}" does not exist.`);
349
+ }
254
350
  }
351
+ currentRef[preSegment] = this.handlers[type].deserialize(currentRef[preSegment]);
255
352
  }
256
- currentRef[preSegment] = this.handlers[type].deserialize(currentRef[preSegment]);
257
- });
353
+ }
258
354
  return ref.data;
259
355
  }
260
356
  }
@@ -276,18 +372,18 @@ class RPCSerializer {
276
372
  if (result.value === void 0) {
277
373
  return result;
278
374
  }
279
- return { done: result.done, value: this.serializeValue(result.value, options) };
375
+ return { done: result.done, value: this.serializeValue(result.value, false) };
280
376
  },
281
377
  mapError: (e) => new ErrorEvent(
282
- this.serializeValue(toORPCError(e).toJSON(), { ...options, useFormDataForBlobFields: false }),
378
+ this.serializeValue(toORPCError(e).toJSON(), false),
283
379
  { cause: e }
284
380
  )
285
381
  });
286
382
  }
287
- return this.serializeValue(data, options);
288
- }
289
- serializeValue(data, options) {
290
383
  const useFormDataForBlobs = options.useFormDataForBlobFields ?? this.defaultSerializeOptions?.useFormDataForBlobFields ?? true;
384
+ return this.serializeValue(data, useFormDataForBlobs);
385
+ }
386
+ serializeValue(data, useFormDataForBlobs) {
291
387
  const { json, meta, maps, blobs } = this.jsonSerializer.serialize(data);
292
388
  if (!useFormDataForBlobs || !blobs?.length) {
293
389
  return { json, meta };
@@ -75,9 +75,15 @@ interface RPCJsonSerializerOptions {
75
75
  }
76
76
  declare class RPCJsonSerializer {
77
77
  private readonly handlers;
78
+ private readonly inlineBuiltInHandlers;
79
+ private readonly handlerEntries;
78
80
  private readonly omitUndefinedProperties;
79
81
  constructor(options?: RPCJsonSerializerOptions);
80
82
  serialize(data: unknown): RPCJsonSerialization;
83
+ /**
84
+ * `segments` is a shared mutable stack (push/pop while walking),
85
+ * so it must be copied before being stored in `meta` or `maps`.
86
+ */
81
87
  private serializeValue;
82
88
  deserialize(serialized: RPCJsonSerialization): unknown;
83
89
  }
@@ -75,9 +75,15 @@ interface RPCJsonSerializerOptions {
75
75
  }
76
76
  declare class RPCJsonSerializer {
77
77
  private readonly handlers;
78
+ private readonly inlineBuiltInHandlers;
79
+ private readonly handlerEntries;
78
80
  private readonly omitUndefinedProperties;
79
81
  constructor(options?: RPCJsonSerializerOptions);
80
82
  serialize(data: unknown): RPCJsonSerialization;
83
+ /**
84
+ * `segments` is a shared mutable stack (push/pop while walking),
85
+ * so it must be copied before being stored in `meta` or `maps`.
86
+ */
81
87
  private serializeValue;
82
88
  deserialize(serialized: RPCJsonSerialization): unknown;
83
89
  }
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.21",
4
+ "version": "2.0.0-beta.23",
5
5
  "license": "MIT",
6
6
  "homepage": "https://orpc.dev",
7
7
  "repository": {
@@ -50,10 +50,10 @@
50
50
  "dist"
51
51
  ],
52
52
  "dependencies": {
53
- "@standardserver/core": "^0.5.0",
54
- "@standardserver/fetch": "^0.5.0",
55
- "@standardserver/peer": "^0.5.0",
56
- "@orpc/shared": "2.0.0-beta.21"
53
+ "@standardserver/core": "^0.6.0",
54
+ "@standardserver/fetch": "^0.6.0",
55
+ "@standardserver/peer": "^0.6.0",
56
+ "@orpc/shared": "2.0.0-beta.23"
57
57
  },
58
58
  "devDependencies": {
59
59
  "zod": "^4.4.3"