@orpc/client 2.0.0-beta.13 → 2.0.0-beta.15
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 +1 -1
- package/dist/adapters/fetch/index.d.mts +3 -3
- package/dist/adapters/fetch/index.d.ts +3 -3
- package/dist/adapters/fetch/index.mjs +2 -2
- package/dist/adapters/message-port/index.d.mts +2 -2
- package/dist/adapters/message-port/index.d.ts +2 -2
- package/dist/adapters/message-port/index.mjs +2 -2
- package/dist/adapters/standard/index.d.mts +3 -3
- package/dist/adapters/standard/index.d.ts +3 -3
- package/dist/adapters/standard/index.mjs +2 -2
- package/dist/adapters/websocket/index.d.mts +2 -2
- package/dist/adapters/websocket/index.d.ts +2 -2
- package/dist/adapters/websocket/index.mjs +2 -2
- package/dist/index.d.mts +12 -46
- package/dist/index.d.ts +12 -46
- package/dist/index.mjs +4 -35
- package/dist/plugins/index.d.mts +4 -6
- package/dist/plugins/index.d.ts +4 -6
- package/dist/plugins/index.mjs +6 -8
- package/dist/shared/{client.Cby_-GGh.d.mts → client.8f4DNmdE.d.mts} +1 -1
- package/dist/shared/{client.8ug8I-zu.d.mts → client.BBZBQID8.d.mts} +2 -2
- package/dist/shared/{client.8ug8I-zu.d.ts → client.BBZBQID8.d.ts} +2 -2
- package/dist/shared/{client.CPF3hX6O.d.ts → client.BMKYqpdy.d.ts} +1 -1
- package/dist/shared/{client.BN52ep3E.mjs → client.BRJnOJ0R.mjs} +4 -4
- package/dist/shared/{client.D3TIIok6.mjs → client.DqYwRDUO.mjs} +4 -4
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -107,7 +107,6 @@ Like what we build over at [middleapi](https://github.com/middleapi)? You can he
|
|
|
107
107
|
</tr>
|
|
108
108
|
<tr>
|
|
109
109
|
<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>
|
|
110
|
-
<td align="center"><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&v=4" width="139" alt="Peter Adam"/><br />Peter Adam</a></td>
|
|
111
110
|
<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&v=4" width="139" alt="Ryan Soderberg"/><br />Ryan Soderberg</a></td>
|
|
112
111
|
<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&v=4" width="139" alt="shota"/><br />shota</a></td>
|
|
113
112
|
</tr>
|
|
@@ -168,6 +167,7 @@ Like what we build over at [middleapi](https://github.com/middleapi)? You can he
|
|
|
168
167
|
<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&v=4" width="32" height="32" alt="Lê Cao Nguyên" /></a>
|
|
169
168
|
<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&v=4" width="32" height="32" alt="Robert Soriano" /></a>
|
|
170
169
|
<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>
|
|
170
|
+
<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&v=4" width="32" height="32" alt="Peter Adam" /></a>
|
|
171
171
|
<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>
|
|
172
172
|
<a href="https://github.com/NovakAnton?ref=orpc" target="_blank" rel="noopener" title="Novak Antonijevic"><img src="https://avatars.githubusercontent.com/u/157126729?u=ae49fa22292d55c0434ff0ca008206155b18663b&v=4" width="32" height="32" alt="Novak Antonijevic" /></a>
|
|
173
173
|
<a href="https://github.com/laduniestu?ref=orpc" target="_blank" rel="noopener" title="Laduni Estu Syalwa"><img src="https://avatars.githubusercontent.com/u/44757637?u=a2fc1ea8f7d827a96721176f79d30592d1c48059&v=4" width="32" height="32" alt="Laduni Estu Syalwa" /></a>
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { C as ClientContext, a as ClientOptions } from '../../shared/client.
|
|
1
|
+
import { C as ClientContext, a as ClientOptions } from '../../shared/client.BBZBQID8.mjs';
|
|
2
2
|
import { Value, Promisable, Interceptor } from '@orpc/shared';
|
|
3
3
|
import { StandardRequest, StandardLazyResponse } from '@standardserver/core';
|
|
4
4
|
import { ToFetchBodyOptions } from '@standardserver/fetch';
|
|
5
|
-
import { S as StandardLinkTransport, c as StandardLinkPlugin, a as StandardLink, b as StandardLinkOptions } from '../../shared/client.
|
|
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
7
|
import '../../shared/client.BdItY5DT.mjs';
|
|
8
8
|
|
|
@@ -21,7 +21,7 @@ interface FetchLinkTransportOptions<T extends ClientContext> {
|
|
|
21
21
|
*/
|
|
22
22
|
origin?: Value<Promisable<`https://${string}` | `http://${string}` | ({} & string) | undefined>, [options: ClientOptions<T>, path: string[]]>;
|
|
23
23
|
/**
|
|
24
|
-
* Options for how to convert the Standard Request to a Fetch Request, like event
|
|
24
|
+
* Options for how to convert the Standard Request to a Fetch Request, like event stream options, etc.
|
|
25
25
|
*/
|
|
26
26
|
toFetchRequest?: undefined | ToFetchBodyOptions;
|
|
27
27
|
/**
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { C as ClientContext, a as ClientOptions } from '../../shared/client.
|
|
1
|
+
import { C as ClientContext, a as ClientOptions } from '../../shared/client.BBZBQID8.js';
|
|
2
2
|
import { Value, Promisable, Interceptor } from '@orpc/shared';
|
|
3
3
|
import { StandardRequest, StandardLazyResponse } from '@standardserver/core';
|
|
4
4
|
import { ToFetchBodyOptions } from '@standardserver/fetch';
|
|
5
|
-
import { S as StandardLinkTransport, c as StandardLinkPlugin, a as StandardLink, b as StandardLinkOptions } from '../../shared/client.
|
|
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
7
|
import '../../shared/client.BdItY5DT.js';
|
|
8
8
|
|
|
@@ -21,7 +21,7 @@ interface FetchLinkTransportOptions<T extends ClientContext> {
|
|
|
21
21
|
*/
|
|
22
22
|
origin?: Value<Promisable<`https://${string}` | `http://${string}` | ({} & string) | undefined>, [options: ClientOptions<T>, path: string[]]>;
|
|
23
23
|
/**
|
|
24
|
-
* Options for how to convert the Standard Request to a Fetch Request, like event
|
|
24
|
+
* Options for how to convert the Standard Request to a Fetch Request, like event stream options, etc.
|
|
25
25
|
*/
|
|
26
26
|
toFetchRequest?: undefined | ToFetchBodyOptions;
|
|
27
27
|
/**
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { sortPlugins, value, intercept } from '@orpc/shared';
|
|
2
2
|
import { toFetchBody, toFetchHeaders, toStandardLazyResponse } from '@standardserver/fetch';
|
|
3
|
-
import { S as StandardLink, R as RPCLinkCodec } from '../../shared/client.
|
|
3
|
+
import { S as StandardLink, R as RPCLinkCodec } from '../../shared/client.BRJnOJ0R.mjs';
|
|
4
4
|
import '@standardserver/core';
|
|
5
5
|
import '../../shared/client.Dnfj8jnT.mjs';
|
|
6
|
-
import '../../shared/client.
|
|
6
|
+
import '../../shared/client.DqYwRDUO.mjs';
|
|
7
7
|
|
|
8
8
|
class CompositeFetchLinkTransportPlugin {
|
|
9
9
|
constructor(plugins = []) {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { C as ClientContext, a as ClientOptions } from '../../shared/client.
|
|
1
|
+
import { C as ClientContext, a as ClientOptions } from '../../shared/client.BBZBQID8.mjs';
|
|
2
2
|
import { Value, Promisable } from '@orpc/shared';
|
|
3
3
|
import { StandardRequest, StandardLazyResponse } from '@standardserver/core';
|
|
4
4
|
import { ClientPeer, EncodePeerMessageOptions, DecodePeerMessageOptions } from '@standardserver/peer';
|
|
5
|
-
import { S as StandardLinkTransport, a as StandardLink, b as StandardLinkOptions } from '../../shared/client.
|
|
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
7
|
import '../../shared/client.BdItY5DT.mjs';
|
|
8
8
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { C as ClientContext, a as ClientOptions } from '../../shared/client.
|
|
1
|
+
import { C as ClientContext, a as ClientOptions } from '../../shared/client.BBZBQID8.js';
|
|
2
2
|
import { Value, Promisable } from '@orpc/shared';
|
|
3
3
|
import { StandardRequest, StandardLazyResponse } from '@standardserver/core';
|
|
4
4
|
import { ClientPeer, EncodePeerMessageOptions, DecodePeerMessageOptions } from '@standardserver/peer';
|
|
5
|
-
import { S as StandardLinkTransport, a as StandardLink, b as StandardLinkOptions } from '../../shared/client.
|
|
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
7
|
import '../../shared/client.BdItY5DT.js';
|
|
8
8
|
|
|
@@ -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.
|
|
3
|
+
import { S as StandardLink, R as RPCLinkCodec } from '../../shared/client.BRJnOJ0R.mjs';
|
|
4
4
|
import '@standardserver/core';
|
|
5
5
|
import '@standardserver/fetch';
|
|
6
6
|
import '../../shared/client.Dnfj8jnT.mjs';
|
|
7
|
-
import '../../shared/client.
|
|
7
|
+
import '../../shared/client.DqYwRDUO.mjs';
|
|
8
8
|
|
|
9
9
|
function postMessagePortMessage(port, data, transfer) {
|
|
10
10
|
if (transfer) {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { f as StandardLinkCodec, g as StandardLinkCodecDecodedResponse } from '../../shared/client.
|
|
2
|
-
export { C as CompositeStandardLinkPlugin, a as StandardLink, h as StandardLinkInterceptor, e as StandardLinkInterceptorOptions, b as StandardLinkOptions, c as StandardLinkPlugin, S as StandardLinkTransport, i as StandardLinkTransportInterceptor, d as StandardLinkTransportInterceptorOptions } from '../../shared/client.
|
|
1
|
+
import { f as StandardLinkCodec, g as StandardLinkCodecDecodedResponse } from '../../shared/client.8f4DNmdE.mjs';
|
|
2
|
+
export { C as CompositeStandardLinkPlugin, a as StandardLink, h as StandardLinkInterceptor, e as StandardLinkInterceptorOptions, b as StandardLinkOptions, c as StandardLinkPlugin, S as StandardLinkTransport, i as StandardLinkTransportInterceptor, d as StandardLinkTransportInterceptorOptions } from '../../shared/client.8f4DNmdE.mjs';
|
|
3
3
|
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
|
-
import { C as ClientContext, a as ClientOptions } from '../../shared/client.
|
|
6
|
+
import { C as ClientContext, a as ClientOptions } from '../../shared/client.BBZBQID8.mjs';
|
|
7
7
|
import { e as RPCSerializer } from '../../shared/client.BdItY5DT.mjs';
|
|
8
8
|
|
|
9
9
|
interface RPCLinkCodecOptions<T extends ClientContext> {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { f as StandardLinkCodec, g as StandardLinkCodecDecodedResponse } from '../../shared/client.
|
|
2
|
-
export { C as CompositeStandardLinkPlugin, a as StandardLink, h as StandardLinkInterceptor, e as StandardLinkInterceptorOptions, b as StandardLinkOptions, c as StandardLinkPlugin, S as StandardLinkTransport, i as StandardLinkTransportInterceptor, d as StandardLinkTransportInterceptorOptions } from '../../shared/client.
|
|
1
|
+
import { f as StandardLinkCodec, g as StandardLinkCodecDecodedResponse } from '../../shared/client.BMKYqpdy.js';
|
|
2
|
+
export { C as CompositeStandardLinkPlugin, a as StandardLink, h as StandardLinkInterceptor, e as StandardLinkInterceptorOptions, b as StandardLinkOptions, c as StandardLinkPlugin, S as StandardLinkTransport, i as StandardLinkTransportInterceptor, d as StandardLinkTransportInterceptorOptions } from '../../shared/client.BMKYqpdy.js';
|
|
3
3
|
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
|
-
import { C as ClientContext, a as ClientOptions } from '../../shared/client.
|
|
6
|
+
import { C as ClientContext, a as ClientOptions } from '../../shared/client.BBZBQID8.js';
|
|
7
7
|
import { e as RPCSerializer } from '../../shared/client.BdItY5DT.js';
|
|
8
8
|
|
|
9
9
|
interface RPCLinkCodecOptions<T extends ClientContext> {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { C as CompositeStandardLinkPlugin, R as RPCLinkCodec, S as StandardLink } from '../../shared/client.
|
|
1
|
+
export { C as CompositeStandardLinkPlugin, R as RPCLinkCodec, S as StandardLink } from '../../shared/client.BRJnOJ0R.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.
|
|
6
|
+
import '../../shared/client.DqYwRDUO.mjs';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { C as ClientContext, a as ClientOptions } from '../../shared/client.
|
|
1
|
+
import { C as ClientContext, a as ClientOptions } from '../../shared/client.BBZBQID8.mjs';
|
|
2
2
|
import { Promisable } from '@orpc/shared';
|
|
3
3
|
import { StandardRequest, StandardLazyResponse } from '@standardserver/core';
|
|
4
4
|
import { EncodePeerMessageOptions, DecodePeerMessageOptions } from '@standardserver/peer';
|
|
5
|
-
import { S as StandardLinkTransport, a as StandardLink, b as StandardLinkOptions } from '../../shared/client.
|
|
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
7
|
import '../../shared/client.BdItY5DT.mjs';
|
|
8
8
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { C as ClientContext, a as ClientOptions } from '../../shared/client.
|
|
1
|
+
import { C as ClientContext, a as ClientOptions } from '../../shared/client.BBZBQID8.js';
|
|
2
2
|
import { Promisable } from '@orpc/shared';
|
|
3
3
|
import { StandardRequest, StandardLazyResponse } from '@standardserver/core';
|
|
4
4
|
import { EncodePeerMessageOptions, DecodePeerMessageOptions } from '@standardserver/peer';
|
|
5
|
-
import { S as StandardLinkTransport, a as StandardLink, b as StandardLinkOptions } from '../../shared/client.
|
|
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
7
|
import '../../shared/client.BdItY5DT.js';
|
|
8
8
|
|
|
@@ -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.
|
|
3
|
+
import { S as StandardLink, R as RPCLinkCodec } from '../../shared/client.BRJnOJ0R.mjs';
|
|
4
4
|
import '@standardserver/core';
|
|
5
5
|
import '@standardserver/fetch';
|
|
6
6
|
import '../../shared/client.Dnfj8jnT.mjs';
|
|
7
|
-
import '../../shared/client.
|
|
7
|
+
import '../../shared/client.DqYwRDUO.mjs';
|
|
8
8
|
|
|
9
9
|
const WEBSOCKET_CONNECTING = 0;
|
|
10
10
|
const WEBSOCKET_OPEN = 1;
|
package/dist/index.d.mts
CHANGED
|
@@ -1,15 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
3
|
-
import {
|
|
4
|
-
export {
|
|
1
|
+
import { WrapAsyncIteratorOptions, AsyncIteratorClass, Interceptor, PromiseWithError, ThrowableError, Promisable } from '@orpc/shared';
|
|
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
|
+
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
|
+
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
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';
|
|
6
6
|
export { ErrorEvent, EventMeta, getEventMeta, unwrapEvent, withEventMeta } from '@standardserver/core';
|
|
7
7
|
|
|
8
|
-
declare function
|
|
9
|
-
declare function toORPCError<T>(error: T): Extract<T, AnyORPCError> | ORPCError<'INTERNAL_SERVER_ERROR', undefined>;
|
|
10
|
-
declare function isORPCErrorJson(json: unknown): json is ORPCErrorJSON<ORPCErrorCode, unknown>;
|
|
11
|
-
declare function createORPCErrorFromJson<TCode extends ORPCErrorCode, TData>(json: ORPCErrorJSON<TCode, TData>, options?: ErrorOptions): ORPCError<TCode, TData>;
|
|
12
|
-
declare function cloneORPCError<T extends ORPCErrorCode, TData>(error: ORPCError<T, TData>): ORPCError<T, TData>;
|
|
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>;
|
|
13
9
|
|
|
14
10
|
interface ORPCClientInterceptorOptions<TClientContext extends ClientContext, TInput> extends ClientOptions<TClientContext> {
|
|
15
11
|
path: string[];
|
|
@@ -74,35 +70,6 @@ type SafeResult<TOutput, TError> = [error: null, data: TOutput, inferableError:
|
|
|
74
70
|
* }
|
|
75
71
|
*/
|
|
76
72
|
declare function safe<TOutput, TError = ThrowableError>(promise: PromiseWithError<TOutput, TError>): Promise<SafeResult<TOutput, TError>>;
|
|
77
|
-
interface ConsumeEventIteratorOptions<T, TReturn, TError> {
|
|
78
|
-
/**
|
|
79
|
-
* Called on each event
|
|
80
|
-
*/
|
|
81
|
-
onEvent: (event: T) => void;
|
|
82
|
-
/**
|
|
83
|
-
* Called once error happens
|
|
84
|
-
*/
|
|
85
|
-
onError?: (error: TError) => void;
|
|
86
|
-
/**
|
|
87
|
-
* Called once event iterator is done
|
|
88
|
-
*
|
|
89
|
-
* @info If iterator is canceled, `undefined` can be passed on success
|
|
90
|
-
*/
|
|
91
|
-
onSuccess?: (value: TReturn | undefined) => void;
|
|
92
|
-
/**
|
|
93
|
-
* Called once after onError or onSuccess
|
|
94
|
-
*
|
|
95
|
-
* @info If iterator is canceled, `undefined` can be passed on success
|
|
96
|
-
*/
|
|
97
|
-
onFinish?: (state: [error: TError, data: undefined, isSuccess: false] | [error: null, data: TReturn | undefined, isSuccess: true]) => void;
|
|
98
|
-
}
|
|
99
|
-
/**
|
|
100
|
-
* Consumes an event iterator with lifecycle callbacks
|
|
101
|
-
*
|
|
102
|
-
* @warning If no `onError` or `onFinish` is provided, error will be thrown into unhandled rejection channel.
|
|
103
|
-
* @return unsubscribe callback
|
|
104
|
-
*/
|
|
105
|
-
declare function consumeEventIterator<T, TReturn, TError = ThrowableError>(iterator: AsyncIterator<T, TReturn> | PromiseWithError<AsyncIterator<T, TReturn>, TError>, options: ConsumeEventIteratorOptions<T, TReturn, TError>): () => Promise<void>;
|
|
106
73
|
|
|
107
74
|
type SafeClient<T extends AnyNestedClient> = T extends Client<infer UContext, infer UInput, infer UOutput, infer UError> ? (...rest: ClientRest<UContext, UInput>) => Promise<SafeResult<UOutput, UError>> : {
|
|
108
75
|
[K in keyof T]: T[K] extends AnyNestedClient ? SafeClient<T[K]> : never;
|
|
@@ -144,12 +111,11 @@ declare class DynamicLink<TClientContext extends ClientContext> implements Clien
|
|
|
144
111
|
call(path: string[], input: unknown, options: ClientOptions<TClientContext>): Promise<unknown>;
|
|
145
112
|
}
|
|
146
113
|
|
|
147
|
-
declare function
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
declare const isDefinedError: typeof isInferableError;
|
|
114
|
+
declare function isInferableError<T>(error: T): error is Extract<T, AnyORPCError>;
|
|
115
|
+
declare function toORPCError<T>(error: T): Extract<T, AnyORPCError> | ORPCError<'INTERNAL_SERVER_ERROR', undefined>;
|
|
116
|
+
declare function isORPCErrorJson(json: unknown): json is ORPCErrorJSON<ORPCErrorCode, unknown>;
|
|
117
|
+
declare function createORPCErrorFromJson<TCode extends ORPCErrorCode, TData>(json: ORPCErrorJSON<TCode, TData>, options?: ErrorOptions): ORPCError<TCode, TData>;
|
|
118
|
+
declare function cloneORPCError<T extends ORPCErrorCode, TData>(error: ORPCError<T, TData>): ORPCError<T, TData>;
|
|
153
119
|
|
|
154
|
-
export { AnyNestedClient, AnyORPCError, Client, ClientContext, ClientLink, ClientOptions, ClientRest, DynamicLink, FriendlyClientOptions, InferClientContext, InferClientError, ORPCError, ORPCErrorCode, ORPCErrorJSON, RECURSIVE_CLIENT_UNWRAP_KEYS, cloneORPCError,
|
|
155
|
-
export type {
|
|
120
|
+
export { AnyNestedClient, AnyORPCError, Client, ClientContext, ClientLink, ClientOptions, ClientRest, DynamicLink, FriendlyClientOptions, InferClientContext, InferClientError, ORPCError, ORPCErrorCode, ORPCErrorJSON, RECURSIVE_CLIENT_UNWRAP_KEYS, cloneORPCError, createORPCClient, createORPCErrorFromJson, createSafeClient, isInferableError as isDefinedError, isInferableError, isORPCErrorJson, resolveClientRest, resolveFriendlyClientOptions, safe, toORPCError, wrapAsyncIteratorPreservingEventMeta };
|
|
121
|
+
export type { ORPCClientInterceptor, ORPCClientInterceptorOptions, ORPCClientOptions, ORPCClientScoped, ORPCClientScopedOptions, SafeClient, SafeResult };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,15 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
3
|
-
import {
|
|
4
|
-
export {
|
|
1
|
+
import { WrapAsyncIteratorOptions, AsyncIteratorClass, Interceptor, PromiseWithError, ThrowableError, Promisable } from '@orpc/shared';
|
|
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
|
+
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
|
+
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
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';
|
|
6
6
|
export { ErrorEvent, EventMeta, getEventMeta, unwrapEvent, withEventMeta } from '@standardserver/core';
|
|
7
7
|
|
|
8
|
-
declare function
|
|
9
|
-
declare function toORPCError<T>(error: T): Extract<T, AnyORPCError> | ORPCError<'INTERNAL_SERVER_ERROR', undefined>;
|
|
10
|
-
declare function isORPCErrorJson(json: unknown): json is ORPCErrorJSON<ORPCErrorCode, unknown>;
|
|
11
|
-
declare function createORPCErrorFromJson<TCode extends ORPCErrorCode, TData>(json: ORPCErrorJSON<TCode, TData>, options?: ErrorOptions): ORPCError<TCode, TData>;
|
|
12
|
-
declare function cloneORPCError<T extends ORPCErrorCode, TData>(error: ORPCError<T, TData>): ORPCError<T, TData>;
|
|
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>;
|
|
13
9
|
|
|
14
10
|
interface ORPCClientInterceptorOptions<TClientContext extends ClientContext, TInput> extends ClientOptions<TClientContext> {
|
|
15
11
|
path: string[];
|
|
@@ -74,35 +70,6 @@ type SafeResult<TOutput, TError> = [error: null, data: TOutput, inferableError:
|
|
|
74
70
|
* }
|
|
75
71
|
*/
|
|
76
72
|
declare function safe<TOutput, TError = ThrowableError>(promise: PromiseWithError<TOutput, TError>): Promise<SafeResult<TOutput, TError>>;
|
|
77
|
-
interface ConsumeEventIteratorOptions<T, TReturn, TError> {
|
|
78
|
-
/**
|
|
79
|
-
* Called on each event
|
|
80
|
-
*/
|
|
81
|
-
onEvent: (event: T) => void;
|
|
82
|
-
/**
|
|
83
|
-
* Called once error happens
|
|
84
|
-
*/
|
|
85
|
-
onError?: (error: TError) => void;
|
|
86
|
-
/**
|
|
87
|
-
* Called once event iterator is done
|
|
88
|
-
*
|
|
89
|
-
* @info If iterator is canceled, `undefined` can be passed on success
|
|
90
|
-
*/
|
|
91
|
-
onSuccess?: (value: TReturn | undefined) => void;
|
|
92
|
-
/**
|
|
93
|
-
* Called once after onError or onSuccess
|
|
94
|
-
*
|
|
95
|
-
* @info If iterator is canceled, `undefined` can be passed on success
|
|
96
|
-
*/
|
|
97
|
-
onFinish?: (state: [error: TError, data: undefined, isSuccess: false] | [error: null, data: TReturn | undefined, isSuccess: true]) => void;
|
|
98
|
-
}
|
|
99
|
-
/**
|
|
100
|
-
* Consumes an event iterator with lifecycle callbacks
|
|
101
|
-
*
|
|
102
|
-
* @warning If no `onError` or `onFinish` is provided, error will be thrown into unhandled rejection channel.
|
|
103
|
-
* @return unsubscribe callback
|
|
104
|
-
*/
|
|
105
|
-
declare function consumeEventIterator<T, TReturn, TError = ThrowableError>(iterator: AsyncIterator<T, TReturn> | PromiseWithError<AsyncIterator<T, TReturn>, TError>, options: ConsumeEventIteratorOptions<T, TReturn, TError>): () => Promise<void>;
|
|
106
73
|
|
|
107
74
|
type SafeClient<T extends AnyNestedClient> = T extends Client<infer UContext, infer UInput, infer UOutput, infer UError> ? (...rest: ClientRest<UContext, UInput>) => Promise<SafeResult<UOutput, UError>> : {
|
|
108
75
|
[K in keyof T]: T[K] extends AnyNestedClient ? SafeClient<T[K]> : never;
|
|
@@ -144,12 +111,11 @@ declare class DynamicLink<TClientContext extends ClientContext> implements Clien
|
|
|
144
111
|
call(path: string[], input: unknown, options: ClientOptions<TClientContext>): Promise<unknown>;
|
|
145
112
|
}
|
|
146
113
|
|
|
147
|
-
declare function
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
declare const isDefinedError: typeof isInferableError;
|
|
114
|
+
declare function isInferableError<T>(error: T): error is Extract<T, AnyORPCError>;
|
|
115
|
+
declare function toORPCError<T>(error: T): Extract<T, AnyORPCError> | ORPCError<'INTERNAL_SERVER_ERROR', undefined>;
|
|
116
|
+
declare function isORPCErrorJson(json: unknown): json is ORPCErrorJSON<ORPCErrorCode, unknown>;
|
|
117
|
+
declare function createORPCErrorFromJson<TCode extends ORPCErrorCode, TData>(json: ORPCErrorJSON<TCode, TData>, options?: ErrorOptions): ORPCError<TCode, TData>;
|
|
118
|
+
declare function cloneORPCError<T extends ORPCErrorCode, TData>(error: ORPCError<T, TData>): ORPCError<T, TData>;
|
|
153
119
|
|
|
154
|
-
export { AnyNestedClient, AnyORPCError, Client, ClientContext, ClientLink, ClientOptions, ClientRest, DynamicLink, FriendlyClientOptions, InferClientContext, InferClientError, ORPCError, ORPCErrorCode, ORPCErrorJSON, RECURSIVE_CLIENT_UNWRAP_KEYS, cloneORPCError,
|
|
155
|
-
export type {
|
|
120
|
+
export { AnyNestedClient, AnyORPCError, Client, ClientContext, ClientLink, ClientOptions, ClientRest, DynamicLink, FriendlyClientOptions, InferClientContext, InferClientError, ORPCError, ORPCErrorCode, ORPCErrorJSON, RECURSIVE_CLIENT_UNWRAP_KEYS, cloneORPCError, createORPCClient, createORPCErrorFromJson, createSafeClient, isInferableError as isDefinedError, isInferableError, isORPCErrorJson, resolveClientRest, resolveFriendlyClientOptions, safe, toORPCError, wrapAsyncIteratorPreservingEventMeta };
|
|
121
|
+
export type { ORPCClientInterceptor, ORPCClientInterceptorOptions, ORPCClientOptions, ORPCClientScoped, ORPCClientScopedOptions, SafeClient, SafeResult };
|
package/dist/index.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { a as isInferableError } from './shared/client.
|
|
2
|
-
export { b as RPCJsonSerializer, R as RPCSerializer, d as cloneORPCError, c as createORPCErrorFromJson, i as isORPCErrorJson, t as toORPCError, w as
|
|
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';
|
|
3
3
|
import { getOrBind, toArray, intercept, isTypescriptObject } from '@orpc/shared';
|
|
4
|
-
export { AsyncIteratorClass, asyncIteratorToStream as eventIteratorToStream, asyncIteratorToUnproxiedDataStream as eventIteratorToUnproxiedDataStream, onError, onFinish, onStart, onSuccess,
|
|
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';
|
|
6
6
|
export { ErrorEvent, getEventMeta, unwrapEvent, withEventMeta } from '@standardserver/core';
|
|
7
7
|
|
|
@@ -66,35 +66,6 @@ async function safe(promise) {
|
|
|
66
66
|
);
|
|
67
67
|
}
|
|
68
68
|
}
|
|
69
|
-
function consumeEventIterator(iterator, options) {
|
|
70
|
-
void (async () => {
|
|
71
|
-
let onFinishState;
|
|
72
|
-
try {
|
|
73
|
-
const resolvedIterator = await iterator;
|
|
74
|
-
while (true) {
|
|
75
|
-
const { done, value } = await resolvedIterator.next();
|
|
76
|
-
if (done) {
|
|
77
|
-
const realValue = value;
|
|
78
|
-
onFinishState = [null, realValue, true];
|
|
79
|
-
options.onSuccess?.(realValue);
|
|
80
|
-
break;
|
|
81
|
-
}
|
|
82
|
-
options.onEvent(value);
|
|
83
|
-
}
|
|
84
|
-
} catch (error) {
|
|
85
|
-
onFinishState = [error, void 0, false];
|
|
86
|
-
if (!options.onError && !options.onFinish) {
|
|
87
|
-
throw error;
|
|
88
|
-
}
|
|
89
|
-
options.onError?.(error);
|
|
90
|
-
} finally {
|
|
91
|
-
options.onFinish?.(onFinishState);
|
|
92
|
-
}
|
|
93
|
-
})();
|
|
94
|
-
return async () => {
|
|
95
|
-
await (await iterator)?.return?.();
|
|
96
|
-
};
|
|
97
|
-
}
|
|
98
69
|
|
|
99
70
|
function createORPCClient(link, { path = [], ...options } = {}) {
|
|
100
71
|
const procedureClient = (...rest) => {
|
|
@@ -149,6 +120,4 @@ class DynamicLink {
|
|
|
149
120
|
}
|
|
150
121
|
}
|
|
151
122
|
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
export { DynamicLink, RECURSIVE_CLIENT_UNWRAP_KEYS, consumeEventIterator, createORPCClient, createSafeClient, isDefinedError, isInferableError, resolveClientRest, resolveFriendlyClientOptions, safe };
|
|
123
|
+
export { DynamicLink, RECURSIVE_CLIENT_UNWRAP_KEYS, createORPCClient, createSafeClient, isInferableError as isDefinedError, isInferableError, resolveClientRest, resolveFriendlyClientOptions, safe };
|
package/dist/plugins/index.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Value, Promisable } from '@orpc/shared';
|
|
2
2
|
import { StandardUrl, StandardHeaders, StandardRequest, StandardLazyResponse } from '@standardserver/core';
|
|
3
|
-
import { C as ClientContext } from '../shared/client.
|
|
4
|
-
import { c as StandardLinkPlugin, d as StandardLinkTransportInterceptorOptions, b as StandardLinkOptions, e as StandardLinkInterceptorOptions } from '../shared/client.
|
|
3
|
+
import { C as ClientContext } from '../shared/client.BBZBQID8.mjs';
|
|
4
|
+
import { c as StandardLinkPlugin, d as StandardLinkTransportInterceptorOptions, b as StandardLinkOptions, e as StandardLinkInterceptorOptions } from '../shared/client.8f4DNmdE.mjs';
|
|
5
5
|
|
|
6
6
|
type BatchLinkPluginMode = 'streaming' | 'buffered';
|
|
7
7
|
interface BatchLinkPluginGroup<T extends ClientContext> {
|
|
@@ -153,7 +153,7 @@ interface RetryLinkPluginAttemptOptions<T extends RetryLinkPluginContext> extend
|
|
|
153
153
|
interface RetryLinkPluginContext {
|
|
154
154
|
/**
|
|
155
155
|
* Maximum retry attempts before throwing.
|
|
156
|
-
* Use `Number.POSITIVE_INFINITY` for infinite retries (e.g. for
|
|
156
|
+
* Use `Number.POSITIVE_INFINITY` for infinite retries (e.g. for AsyncIteratorObject).
|
|
157
157
|
*
|
|
158
158
|
* @default 0
|
|
159
159
|
*/
|
|
@@ -182,8 +182,6 @@ interface RetryLinkPluginOptions<_T extends RetryLinkPluginContext> {
|
|
|
182
182
|
*/
|
|
183
183
|
default?: RetryLinkPluginContext | undefined;
|
|
184
184
|
}
|
|
185
|
-
declare class RetryLinkPluginInvalidEventIteratorRetryResponse extends Error {
|
|
186
|
-
}
|
|
187
185
|
declare class RetryLinkPlugin<T extends RetryLinkPluginContext & ClientContext> implements StandardLinkPlugin<T> {
|
|
188
186
|
private readonly defaultRetry;
|
|
189
187
|
private readonly defaultRetryDelay;
|
|
@@ -238,5 +236,5 @@ declare class RetryAfterLinkPlugin<T extends ClientContext> implements StandardL
|
|
|
238
236
|
init(options: StandardLinkOptions<T>): StandardLinkOptions<T>;
|
|
239
237
|
}
|
|
240
238
|
|
|
241
|
-
export { BatchLinkPlugin, BatchLinkPluginError, DedupeLinkPlugin, RetryAfterLinkPlugin, RetryLinkPlugin
|
|
239
|
+
export { BatchLinkPlugin, BatchLinkPluginError, DedupeLinkPlugin, RetryAfterLinkPlugin, RetryLinkPlugin };
|
|
242
240
|
export type { BatchLinkPluginGroup, BatchLinkPluginMode, BatchLinkPluginOptions, DedupeLinkPluginGroup, DedupeLinkPluginOptions, RetryAfterLinkPluginOptions, RetryLinkPluginAttemptOptions, RetryLinkPluginContext, RetryLinkPluginOptions };
|
package/dist/plugins/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Value, Promisable } from '@orpc/shared';
|
|
2
2
|
import { StandardUrl, StandardHeaders, StandardRequest, StandardLazyResponse } from '@standardserver/core';
|
|
3
|
-
import { C as ClientContext } from '../shared/client.
|
|
4
|
-
import { c as StandardLinkPlugin, d as StandardLinkTransportInterceptorOptions, b as StandardLinkOptions, e as StandardLinkInterceptorOptions } from '../shared/client.
|
|
3
|
+
import { C as ClientContext } from '../shared/client.BBZBQID8.js';
|
|
4
|
+
import { c as StandardLinkPlugin, d as StandardLinkTransportInterceptorOptions, b as StandardLinkOptions, e as StandardLinkInterceptorOptions } from '../shared/client.BMKYqpdy.js';
|
|
5
5
|
|
|
6
6
|
type BatchLinkPluginMode = 'streaming' | 'buffered';
|
|
7
7
|
interface BatchLinkPluginGroup<T extends ClientContext> {
|
|
@@ -153,7 +153,7 @@ interface RetryLinkPluginAttemptOptions<T extends RetryLinkPluginContext> extend
|
|
|
153
153
|
interface RetryLinkPluginContext {
|
|
154
154
|
/**
|
|
155
155
|
* Maximum retry attempts before throwing.
|
|
156
|
-
* Use `Number.POSITIVE_INFINITY` for infinite retries (e.g. for
|
|
156
|
+
* Use `Number.POSITIVE_INFINITY` for infinite retries (e.g. for AsyncIteratorObject).
|
|
157
157
|
*
|
|
158
158
|
* @default 0
|
|
159
159
|
*/
|
|
@@ -182,8 +182,6 @@ interface RetryLinkPluginOptions<_T extends RetryLinkPluginContext> {
|
|
|
182
182
|
*/
|
|
183
183
|
default?: RetryLinkPluginContext | undefined;
|
|
184
184
|
}
|
|
185
|
-
declare class RetryLinkPluginInvalidEventIteratorRetryResponse extends Error {
|
|
186
|
-
}
|
|
187
185
|
declare class RetryLinkPlugin<T extends RetryLinkPluginContext & ClientContext> implements StandardLinkPlugin<T> {
|
|
188
186
|
private readonly defaultRetry;
|
|
189
187
|
private readonly defaultRetryDelay;
|
|
@@ -238,5 +236,5 @@ declare class RetryAfterLinkPlugin<T extends ClientContext> implements StandardL
|
|
|
238
236
|
init(options: StandardLinkOptions<T>): StandardLinkOptions<T>;
|
|
239
237
|
}
|
|
240
238
|
|
|
241
|
-
export { BatchLinkPlugin, BatchLinkPluginError, DedupeLinkPlugin, RetryAfterLinkPlugin, RetryLinkPlugin
|
|
239
|
+
export { BatchLinkPlugin, BatchLinkPluginError, DedupeLinkPlugin, RetryAfterLinkPlugin, RetryLinkPlugin };
|
|
242
240
|
export type { BatchLinkPluginGroup, BatchLinkPluginMode, BatchLinkPluginOptions, DedupeLinkPluginGroup, DedupeLinkPluginOptions, RetryAfterLinkPluginOptions, RetryLinkPluginAttemptOptions, RetryLinkPluginContext, RetryLinkPluginOptions };
|
package/dist/plugins/index.mjs
CHANGED
|
@@ -387,8 +387,6 @@ function shouldDedupe(items) {
|
|
|
387
387
|
return items.length >= 2;
|
|
388
388
|
}
|
|
389
389
|
|
|
390
|
-
class RetryLinkPluginInvalidEventIteratorRetryResponse extends Error {
|
|
391
|
-
}
|
|
392
390
|
class RetryLinkPlugin {
|
|
393
391
|
defaultRetry;
|
|
394
392
|
defaultRetryDelay;
|
|
@@ -484,13 +482,13 @@ class RetryLinkPlugin {
|
|
|
484
482
|
const meta = getEventMeta(error);
|
|
485
483
|
lastEventId = meta?.id ?? lastEventId;
|
|
486
484
|
lastEventRetry = meta?.retry ?? lastEventRetry;
|
|
487
|
-
const
|
|
488
|
-
if (!isAsyncIteratorObject(
|
|
489
|
-
throw new
|
|
490
|
-
"RetryLinkPlugin: Expected an
|
|
485
|
+
const asyncIteratorObject = await callNext({ error });
|
|
486
|
+
if (!isAsyncIteratorObject(asyncIteratorObject)) {
|
|
487
|
+
throw new TypeError(
|
|
488
|
+
"RetryLinkPlugin: Expected an AsyncIteratorObject, got a different type."
|
|
491
489
|
);
|
|
492
490
|
}
|
|
493
|
-
current =
|
|
491
|
+
current = asyncIteratorObject;
|
|
494
492
|
if (isIteratorAborted) {
|
|
495
493
|
await current.return?.();
|
|
496
494
|
throw error;
|
|
@@ -571,4 +569,4 @@ function parseRetryAfterHeader(value2) {
|
|
|
571
569
|
return void 0;
|
|
572
570
|
}
|
|
573
571
|
|
|
574
|
-
export { BatchLinkPlugin, BatchLinkPluginError, DedupeLinkPlugin, RetryAfterLinkPlugin, RetryLinkPlugin
|
|
572
|
+
export { BatchLinkPlugin, BatchLinkPluginError, DedupeLinkPlugin, RetryAfterLinkPlugin, RetryLinkPlugin };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Promisable, OrderablePlugin, Interceptor } from '@orpc/shared';
|
|
2
2
|
import { StandardRequest, StandardLazyResponse } from '@standardserver/core';
|
|
3
|
-
import { C as ClientContext, a as ClientOptions, A as AnyORPCError, b as ClientLink } from './client.
|
|
3
|
+
import { C as ClientContext, a as ClientOptions, A as AnyORPCError, b as ClientLink } from './client.BBZBQID8.mjs';
|
|
4
4
|
|
|
5
5
|
type StandardLinkCodecDecodedResponse = {
|
|
6
6
|
kind: 'output';
|
|
@@ -163,5 +163,5 @@ interface ORPCErrorJSON<TCode extends string, TData> extends Pick<ORPCError<TCod
|
|
|
163
163
|
type AnyORPCError = ORPCError<any, any>;
|
|
164
164
|
type AnyORPCErrorJSON = ORPCErrorJSON<any, any>;
|
|
165
165
|
|
|
166
|
-
export { ORPCError as
|
|
167
|
-
export type { AnyORPCError as A, ClientContext as C, FriendlyClientOptions as F, InferClientContext as I, NestedClient as N, ORPCErrorCode as O, ClientOptions as a, ClientLink as b,
|
|
166
|
+
export { ORPCError as g, COMMON_ERROR_STATUS_MAP as j };
|
|
167
|
+
export type { AnyORPCError as A, ClientContext as C, FriendlyClientOptions as F, InferClientContext as I, NestedClient as N, ORPCErrorCode as O, ClientOptions as a, ClientLink as b, AnyNestedClient as c, InferClientError as d, Client as e, ClientRest as f, ORPCErrorJSON as h, AnyORPCErrorJSON as i, InferClientBodyInputs as k, InferClientBodyOutputs as l, InferClientErrors as m, InferClientInputs as n, InferClientOutputs as o, ORPCErrorOptions as p };
|
|
@@ -163,5 +163,5 @@ interface ORPCErrorJSON<TCode extends string, TData> extends Pick<ORPCError<TCod
|
|
|
163
163
|
type AnyORPCError = ORPCError<any, any>;
|
|
164
164
|
type AnyORPCErrorJSON = ORPCErrorJSON<any, any>;
|
|
165
165
|
|
|
166
|
-
export { ORPCError as
|
|
167
|
-
export type { AnyORPCError as A, ClientContext as C, FriendlyClientOptions as F, InferClientContext as I, NestedClient as N, ORPCErrorCode as O, ClientOptions as a, ClientLink as b,
|
|
166
|
+
export { ORPCError as g, COMMON_ERROR_STATUS_MAP as j };
|
|
167
|
+
export type { AnyORPCError as A, ClientContext as C, FriendlyClientOptions as F, InferClientContext as I, NestedClient as N, ORPCErrorCode as O, ClientOptions as a, ClientLink as b, AnyNestedClient as c, InferClientError as d, Client as e, ClientRest as f, ORPCErrorJSON as h, AnyORPCErrorJSON as i, InferClientBodyInputs as k, InferClientBodyOutputs as l, InferClientErrors as m, InferClientInputs as n, InferClientOutputs as o, ORPCErrorOptions as p };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Promisable, OrderablePlugin, Interceptor } from '@orpc/shared';
|
|
2
2
|
import { StandardRequest, StandardLazyResponse } from '@standardserver/core';
|
|
3
|
-
import { C as ClientContext, a as ClientOptions, A as AnyORPCError, b as ClientLink } from './client.
|
|
3
|
+
import { C as ClientContext, a as ClientOptions, A as AnyORPCError, b as ClientLink } from './client.BBZBQID8.js';
|
|
4
4
|
|
|
5
5
|
type StandardLinkCodecDecodedResponse = {
|
|
6
6
|
kind: 'output';
|
|
@@ -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.
|
|
5
|
+
import { R as RPCSerializer, i as isORPCErrorJson, c as createORPCErrorFromJson } from './client.DqYwRDUO.mjs';
|
|
6
6
|
|
|
7
7
|
class CompositeStandardLinkPlugin {
|
|
8
8
|
name = "~composite";
|
|
@@ -38,7 +38,7 @@ class StandardLink {
|
|
|
38
38
|
span?.setAttribute("rpc.system", ORPC_NAME);
|
|
39
39
|
span?.setAttribute("rpc.method", path.join("."));
|
|
40
40
|
if (isAsyncIteratorObject(input)) {
|
|
41
|
-
input = override(input, traceAsyncIterator("
|
|
41
|
+
input = override(input, traceAsyncIterator("consume_async_iterator_object_input", input));
|
|
42
42
|
}
|
|
43
43
|
return intercept(this.interceptors, { ...options, path, input }, async ({ path: path2, input: input2, ...options2 }) => {
|
|
44
44
|
const otel = getOpenTelemetryConfig();
|
|
@@ -80,7 +80,7 @@ class StandardLink {
|
|
|
80
80
|
}
|
|
81
81
|
const output = decodedResult.output;
|
|
82
82
|
if (isAsyncIteratorObject(output)) {
|
|
83
|
-
return override(output, traceAsyncIterator("
|
|
83
|
+
return override(output, traceAsyncIterator("consume_async_iterator_object_output", output));
|
|
84
84
|
}
|
|
85
85
|
return output;
|
|
86
86
|
});
|
|
@@ -139,7 +139,7 @@ class RPCLinkCodec {
|
|
|
139
139
|
};
|
|
140
140
|
}
|
|
141
141
|
async decodeResponse(response) {
|
|
142
|
-
const isOk = response.status
|
|
142
|
+
const isOk = response.status < 400;
|
|
143
143
|
const body = await response.resolveBody();
|
|
144
144
|
const deserialized = await (async () => {
|
|
145
145
|
try {
|
|
@@ -40,7 +40,7 @@ function cloneORPCError(error) {
|
|
|
40
40
|
return cloned;
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
-
function
|
|
43
|
+
function wrapAsyncIteratorPreservingEventMeta(iterator, { mapResult, mapError, ...rest }) {
|
|
44
44
|
return wrapAsyncIterator(iterator, {
|
|
45
45
|
...rest,
|
|
46
46
|
mapResult: mapResult && (async (result) => {
|
|
@@ -271,7 +271,7 @@ class RPCSerializer {
|
|
|
271
271
|
return data;
|
|
272
272
|
}
|
|
273
273
|
if (isAsyncIteratorObject(data)) {
|
|
274
|
-
return
|
|
274
|
+
return wrapAsyncIteratorPreservingEventMeta(data, {
|
|
275
275
|
mapResult: (result) => {
|
|
276
276
|
if (result.value === void 0) {
|
|
277
277
|
return result;
|
|
@@ -304,7 +304,7 @@ class RPCSerializer {
|
|
|
304
304
|
return data;
|
|
305
305
|
}
|
|
306
306
|
if (isAsyncIteratorObject(data)) {
|
|
307
|
-
return
|
|
307
|
+
return wrapAsyncIteratorPreservingEventMeta(data, {
|
|
308
308
|
mapResult: (result) => {
|
|
309
309
|
if (result.value === void 0) {
|
|
310
310
|
return result;
|
|
@@ -340,4 +340,4 @@ class RPCSerializer {
|
|
|
340
340
|
}
|
|
341
341
|
}
|
|
342
342
|
|
|
343
|
-
export { RPCSerializer as R, isInferableError as a, RPCJsonSerializer as b, createORPCErrorFromJson as c, cloneORPCError as d, isORPCErrorJson as i, toORPCError as t,
|
|
343
|
+
export { RPCSerializer as R, isInferableError as a, RPCJsonSerializer as b, createORPCErrorFromJson as c, cloneORPCError as d, isORPCErrorJson as i, toORPCError as t, wrapAsyncIteratorPreservingEventMeta as w };
|
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.
|
|
4
|
+
"version": "2.0.0-beta.15",
|
|
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.0.
|
|
54
|
-
"@standardserver/fetch": "^0.0.
|
|
55
|
-
"@standardserver/peer": "^0.0.
|
|
56
|
-
"@orpc/shared": "2.0.0-beta.
|
|
53
|
+
"@standardserver/core": "^0.0.32",
|
|
54
|
+
"@standardserver/fetch": "^0.0.32",
|
|
55
|
+
"@standardserver/peer": "^0.0.32",
|
|
56
|
+
"@orpc/shared": "2.0.0-beta.15"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
59
|
"zod": "^4.4.3"
|