@orpc/client 2.0.0-beta.44 → 2.0.0-beta.46
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 +100 -62
- package/dist/adapters/fetch/index.d.mts +3 -3
- package/dist/adapters/fetch/index.d.ts +3 -3
- package/dist/adapters/fetch/index.mjs +3 -3
- 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 +3 -3
- package/dist/adapters/standard/index.d.mts +8 -8
- package/dist/adapters/standard/index.d.ts +8 -8
- package/dist/adapters/standard/index.mjs +3 -3
- package/dist/adapters/websocket/index.d.mts +9 -9
- package/dist/adapters/websocket/index.d.ts +9 -9
- package/dist/adapters/websocket/index.mjs +3 -3
- package/dist/index.d.mts +10 -11
- package/dist/index.d.ts +10 -11
- package/dist/index.mjs +4 -4
- package/dist/plugins/index.d.mts +51 -38
- package/dist/plugins/index.d.ts +51 -38
- package/dist/plugins/index.mjs +17 -10
- package/dist/shared/{client.DZHZRyR6.d.mts → client.BoHJeq15.d.mts} +30 -12
- package/dist/shared/{client.DZHZRyR6.d.ts → client.BoHJeq15.d.ts} +30 -12
- package/dist/shared/{client.B7P_ugvl.mjs → client.CKQeJJ2U.mjs} +9 -4
- package/dist/shared/{client.BPa_Mmuh.d.mts → client.DqIWeNhQ.d.mts} +7 -8
- package/dist/shared/{client.BPa_Mmuh.d.ts → client.DqIWeNhQ.d.ts} +7 -8
- package/dist/shared/{client.CHH2CNMj.d.ts → client.JBJwBhR8.d.ts} +5 -11
- package/dist/shared/{client.CrHurHrq.mjs → client.LF04eOvL.mjs} +10 -4
- package/dist/shared/{client.BLfXUpyF.mjs → client._wG5INmC.mjs} +16 -17
- package/dist/shared/{client.BzAY7ZC2.d.mts → client.euYjjcFz.d.mts} +5 -11
- package/package.json +6 -6
|
@@ -4,7 +4,7 @@ import { StandardRequest, StandardLazyResponse } from '@standard-server/core';
|
|
|
4
4
|
import { EncodePeerMessageOptions, DecodePeerMessageOptions } from '@standard-server/peer';
|
|
5
5
|
import { StandardLinkTransport, StandardLink, StandardLinkOptions } from '../standard/index.mjs';
|
|
6
6
|
import { RPCLinkCodecOptions } from '../standard/index.mjs';
|
|
7
|
-
import '../../shared/client.
|
|
7
|
+
import '../../shared/client.DqIWeNhQ.mjs';
|
|
8
8
|
|
|
9
9
|
type WebSocketLike = Pick<WebSocket, 'addEventListener' | 'removeEventListener' | 'send' | 'readyState'>;
|
|
10
10
|
interface WebSocketLinkTransportAttemptInfo {
|
|
@@ -33,7 +33,7 @@ interface WebSocketLinkTransportReconnectOptions {
|
|
|
33
33
|
*
|
|
34
34
|
* @default info => info.attempt === 1 ? 0 : 2_000
|
|
35
35
|
*/
|
|
36
|
-
delay?:
|
|
36
|
+
delay?: ((info: WebSocketLinkTransportAttemptInfo) => number) | undefined;
|
|
37
37
|
/**
|
|
38
38
|
* Maximum number of consecutive failed attempts before giving up.
|
|
39
39
|
* When reached, calls waiting for the connection fail, and the next
|
|
@@ -42,7 +42,7 @@ interface WebSocketLinkTransportReconnectOptions {
|
|
|
42
42
|
*
|
|
43
43
|
* @default Infinity
|
|
44
44
|
*/
|
|
45
|
-
maxAttempt?:
|
|
45
|
+
maxAttempt?: number | undefined;
|
|
46
46
|
/**
|
|
47
47
|
* Maximum number of connection attempts over the transport's lifetime,
|
|
48
48
|
* successful ones included (see `totalAttempt`).
|
|
@@ -50,7 +50,7 @@ interface WebSocketLinkTransportReconnectOptions {
|
|
|
50
50
|
*
|
|
51
51
|
* @default Infinity
|
|
52
52
|
*/
|
|
53
|
-
maxTotalAttempt?:
|
|
53
|
+
maxTotalAttempt?: number | undefined;
|
|
54
54
|
/**
|
|
55
55
|
* Whether to proactively reconnect right after the socket closes,
|
|
56
56
|
* rather than waiting for the next call to trigger reconnection.
|
|
@@ -58,7 +58,7 @@ interface WebSocketLinkTransportReconnectOptions {
|
|
|
58
58
|
*
|
|
59
59
|
* @default { enabled: false }
|
|
60
60
|
*/
|
|
61
|
-
onClose?:
|
|
61
|
+
onClose?: {
|
|
62
62
|
/**
|
|
63
63
|
* Whether to proactively reconnect right after the socket closes,
|
|
64
64
|
* rather than waiting for the next call to trigger reconnection.
|
|
@@ -72,8 +72,8 @@ interface WebSocketLinkTransportReconnectOptions {
|
|
|
72
72
|
*
|
|
73
73
|
* @default 0
|
|
74
74
|
*/
|
|
75
|
-
delay?: number;
|
|
76
|
-
};
|
|
75
|
+
delay?: number | undefined;
|
|
76
|
+
} | undefined;
|
|
77
77
|
}
|
|
78
78
|
interface WebSocketLinkTransportOptions<_T extends ClientContext> {
|
|
79
79
|
/**
|
|
@@ -87,13 +87,13 @@ interface WebSocketLinkTransportOptions<_T extends ClientContext> {
|
|
|
87
87
|
*
|
|
88
88
|
* @default false
|
|
89
89
|
*/
|
|
90
|
-
connectOnInit?:
|
|
90
|
+
connectOnInit?: boolean | undefined;
|
|
91
91
|
/**
|
|
92
92
|
* Reconnection behavior when the connection is lost.
|
|
93
93
|
*
|
|
94
94
|
* @default { enabled: false }
|
|
95
95
|
*/
|
|
96
|
-
reconnect?:
|
|
96
|
+
reconnect?: WebSocketLinkTransportReconnectOptions | undefined;
|
|
97
97
|
/**
|
|
98
98
|
* Options for encoding peer messages. such as `prefix` for distinguishing messages on the same channel..
|
|
99
99
|
*/
|
|
@@ -4,7 +4,7 @@ import { StandardRequest, StandardLazyResponse } from '@standard-server/core';
|
|
|
4
4
|
import { EncodePeerMessageOptions, DecodePeerMessageOptions } from '@standard-server/peer';
|
|
5
5
|
import { StandardLinkTransport, StandardLink, StandardLinkOptions } from '../standard/index.js';
|
|
6
6
|
import { RPCLinkCodecOptions } from '../standard/index.js';
|
|
7
|
-
import '../../shared/client.
|
|
7
|
+
import '../../shared/client.DqIWeNhQ.js';
|
|
8
8
|
|
|
9
9
|
type WebSocketLike = Pick<WebSocket, 'addEventListener' | 'removeEventListener' | 'send' | 'readyState'>;
|
|
10
10
|
interface WebSocketLinkTransportAttemptInfo {
|
|
@@ -33,7 +33,7 @@ interface WebSocketLinkTransportReconnectOptions {
|
|
|
33
33
|
*
|
|
34
34
|
* @default info => info.attempt === 1 ? 0 : 2_000
|
|
35
35
|
*/
|
|
36
|
-
delay?:
|
|
36
|
+
delay?: ((info: WebSocketLinkTransportAttemptInfo) => number) | undefined;
|
|
37
37
|
/**
|
|
38
38
|
* Maximum number of consecutive failed attempts before giving up.
|
|
39
39
|
* When reached, calls waiting for the connection fail, and the next
|
|
@@ -42,7 +42,7 @@ interface WebSocketLinkTransportReconnectOptions {
|
|
|
42
42
|
*
|
|
43
43
|
* @default Infinity
|
|
44
44
|
*/
|
|
45
|
-
maxAttempt?:
|
|
45
|
+
maxAttempt?: number | undefined;
|
|
46
46
|
/**
|
|
47
47
|
* Maximum number of connection attempts over the transport's lifetime,
|
|
48
48
|
* successful ones included (see `totalAttempt`).
|
|
@@ -50,7 +50,7 @@ interface WebSocketLinkTransportReconnectOptions {
|
|
|
50
50
|
*
|
|
51
51
|
* @default Infinity
|
|
52
52
|
*/
|
|
53
|
-
maxTotalAttempt?:
|
|
53
|
+
maxTotalAttempt?: number | undefined;
|
|
54
54
|
/**
|
|
55
55
|
* Whether to proactively reconnect right after the socket closes,
|
|
56
56
|
* rather than waiting for the next call to trigger reconnection.
|
|
@@ -58,7 +58,7 @@ interface WebSocketLinkTransportReconnectOptions {
|
|
|
58
58
|
*
|
|
59
59
|
* @default { enabled: false }
|
|
60
60
|
*/
|
|
61
|
-
onClose?:
|
|
61
|
+
onClose?: {
|
|
62
62
|
/**
|
|
63
63
|
* Whether to proactively reconnect right after the socket closes,
|
|
64
64
|
* rather than waiting for the next call to trigger reconnection.
|
|
@@ -72,8 +72,8 @@ interface WebSocketLinkTransportReconnectOptions {
|
|
|
72
72
|
*
|
|
73
73
|
* @default 0
|
|
74
74
|
*/
|
|
75
|
-
delay?: number;
|
|
76
|
-
};
|
|
75
|
+
delay?: number | undefined;
|
|
76
|
+
} | undefined;
|
|
77
77
|
}
|
|
78
78
|
interface WebSocketLinkTransportOptions<_T extends ClientContext> {
|
|
79
79
|
/**
|
|
@@ -87,13 +87,13 @@ interface WebSocketLinkTransportOptions<_T extends ClientContext> {
|
|
|
87
87
|
*
|
|
88
88
|
* @default false
|
|
89
89
|
*/
|
|
90
|
-
connectOnInit?:
|
|
90
|
+
connectOnInit?: boolean | undefined;
|
|
91
91
|
/**
|
|
92
92
|
* Reconnection behavior when the connection is lost.
|
|
93
93
|
*
|
|
94
94
|
* @default { enabled: false }
|
|
95
95
|
*/
|
|
96
|
-
reconnect?:
|
|
96
|
+
reconnect?: WebSocketLinkTransportReconnectOptions | undefined;
|
|
97
97
|
/**
|
|
98
98
|
* Options for encoding peer messages. such as `prefix` for distinguishing messages on the same channel..
|
|
99
99
|
*/
|
|
@@ -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 '@standard-server/peer';
|
|
3
|
-
import { S as StandardLink, R as RPCLinkCodec } from '../../shared/client.
|
|
3
|
+
import { S as StandardLink, R as RPCLinkCodec } from '../../shared/client.CKQeJJ2U.mjs';
|
|
4
4
|
import '@standard-server/core';
|
|
5
5
|
import '@standard-server/fetch';
|
|
6
|
-
import '../../shared/client.
|
|
7
|
-
import '../../shared/client.
|
|
6
|
+
import '../../shared/client.LF04eOvL.mjs';
|
|
7
|
+
import '../../shared/client._wG5INmC.mjs';
|
|
8
8
|
|
|
9
9
|
const WEBSOCKET_CONNECTING = 0;
|
|
10
10
|
const WEBSOCKET_OPEN = 1;
|
package/dist/index.d.mts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { WrapAsyncIteratorOptions, AsyncIteratorClass, Interceptor, PromiseWithError, ThrowableError, Promisable } from '@orpc/shared';
|
|
2
2
|
export { AsyncCleanupFn, AsyncIteratorClass, AsyncIteratorClassNextFn, PromiseWithError as ClientPromiseResult, 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,
|
|
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, M as MalformedResponseError, p as MalformedResponseErrorOptions, N as NestedClient, q as ORPCErrorOptions } from './shared/client.
|
|
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.
|
|
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, O as ORPCErrorCode, g as ORPCErrorJSON, h as ORPCError } from './shared/client.BoHJeq15.mjs';
|
|
4
|
+
export { i as AnyORPCErrorJSON, j as COMMON_ERROR_STATUS_MAP, F as FriendlyClientOptions, k as InferClientBodyInputs, l as InferClientBodyOutputs, m as InferClientErrors, n as InferClientInputs, o as InferClientOutputs, M as MalformedResponseError, p as MalformedResponseErrorOptions, N as NestedClient, q as ORPCErrorOptions, R as ResponseError, r as ResponseErrorOptions } from './shared/client.BoHJeq15.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.DqIWeNhQ.mjs';
|
|
6
6
|
export { ErrorEvent, EventMeta, StandardBody, StandardBodyHint, StandardHeaders, StandardLazyRequest, StandardLazyResponse, StandardMethod, StandardRequest, StandardResponse, StandardUrl, getEventMeta, unwrapEvent, withEventMeta } from '@standard-server/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>;
|
|
@@ -16,26 +16,26 @@ interface ORPCClientScopedOptions<TClientContext extends ClientContext, TInput,
|
|
|
16
16
|
/**
|
|
17
17
|
* Interceptors that wrap the entire client call lifecycle.
|
|
18
18
|
*/
|
|
19
|
-
interceptors?: ORPCClientInterceptor<TClientContext, TInput, TOutput, TError>[];
|
|
19
|
+
interceptors?: ORPCClientInterceptor<TClientContext, TInput, TOutput, TError>[] | undefined;
|
|
20
20
|
}
|
|
21
21
|
type ORPCClientScoped<T extends AnyNestedClient> = T extends Client<infer UClientContext, infer UInput, infer UOutput, infer UError> ? ORPCClientScopedOptions<UClientContext, UInput, UOutput, UError> : {
|
|
22
|
-
[K in keyof T]?: T[K] extends AnyNestedClient ? ORPCClientScoped<T[K]> : never;
|
|
22
|
+
[K in keyof T]?: (T[K] extends AnyNestedClient ? ORPCClientScoped<T[K]> : never) | undefined;
|
|
23
23
|
};
|
|
24
24
|
interface ORPCClientOptions<T extends AnyNestedClient> {
|
|
25
25
|
/**
|
|
26
26
|
* Use as base path for all procedure, useful when you only want to call a subset of the procedure.
|
|
27
27
|
*/
|
|
28
|
-
path?: string[];
|
|
28
|
+
path?: string[] | undefined;
|
|
29
29
|
/**
|
|
30
30
|
* Interceptors that wrap the entire client call lifecycle, applied to every procedure call.
|
|
31
31
|
*/
|
|
32
|
-
interceptors?: ORPCClientInterceptor<InferClientContext<T>, unknown, unknown, InferClientError<T>>[];
|
|
32
|
+
interceptors?: ORPCClientInterceptor<InferClientContext<T>, unknown, unknown, InferClientError<T>>[] | undefined;
|
|
33
33
|
/**
|
|
34
34
|
* Per-procedure options following the shape of the router.
|
|
35
35
|
* Allows fine-grained configuration (e.g. additional interceptors) for individual procedures
|
|
36
36
|
* without affecting the rest of the router.
|
|
37
37
|
*/
|
|
38
|
-
scoped?: ORPCClientScoped<T
|
|
38
|
+
scoped?: ORPCClientScoped<T> | undefined;
|
|
39
39
|
}
|
|
40
40
|
/**
|
|
41
41
|
* Creates a fully typed oRPC client from a link.
|
|
@@ -46,7 +46,6 @@ interface ORPCClientOptions<T extends AnyNestedClient> {
|
|
|
46
46
|
*/
|
|
47
47
|
declare function createORPCClient<T extends AnyNestedClient>(link: ClientLink<InferClientContext<T>>, { path, ...options }?: NoInfer<ORPCClientOptions<T>>): T;
|
|
48
48
|
|
|
49
|
-
declare function resolveFriendlyClientOptions<T extends ClientContext>(options: FriendlyClientOptions<T>): ClientOptions<T>;
|
|
50
49
|
declare function resolveClientRest<TClientContext extends ClientContext, TInput>(rest: ClientRest<TClientContext, TInput>): [input: TInput, options: ClientOptions<TClientContext>];
|
|
51
50
|
type SafeResult<TOutput, TError> = [error: null, data: TOutput, definedError: null, isSuccess: true] & {
|
|
52
51
|
error: null;
|
|
@@ -107,7 +106,7 @@ declare function createSafeClient<T extends AnyNestedClient>(client: T): SafeCli
|
|
|
107
106
|
* proxy for them can cause unexpected behavior, compatibility issues, or
|
|
108
107
|
* infinite proxy chains.
|
|
109
108
|
*/
|
|
110
|
-
declare const RECURSIVE_CLIENT_UNWRAP_KEYS: Set<
|
|
109
|
+
declare const RECURSIVE_CLIENT_UNWRAP_KEYS: Set<PropertyKey>;
|
|
111
110
|
|
|
112
111
|
/**
|
|
113
112
|
* DynamicLink provides a way to dynamically resolve and delegate calls to other ClientLinks
|
|
@@ -141,5 +140,5 @@ declare function createORPCErrorFromJson<TCode extends ORPCErrorCode, TData>(jso
|
|
|
141
140
|
*/
|
|
142
141
|
declare function cloneORPCError<T extends AnyORPCError>(error: T): T;
|
|
143
142
|
|
|
144
|
-
export { AnyNestedClient, AnyORPCError, Client, ClientContext, ClientLink, ClientOptions, ClientRest, DynamicLink,
|
|
143
|
+
export { AnyNestedClient, AnyORPCError, Client, ClientContext, ClientLink, ClientOptions, ClientRest, DynamicLink, InferClientContext, InferClientError, InferClientError as InferClientErrorUnion, ORPCError, ORPCErrorCode, ORPCErrorJSON, RECURSIVE_CLIENT_UNWRAP_KEYS, cloneORPCError, createORPCClient, createORPCErrorFromJson, createSafeClient, isDefinedError, isORPCErrorJson, resolveClientRest, safe, toORPCError, wrapAsyncIteratorPreservingEventMeta };
|
|
145
144
|
export type { ORPCClientInterceptor, ORPCClientInterceptorOptions, ORPCClientOptions, ORPCClientScoped, ORPCClientScopedOptions, SafeClient, SafeResult };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { WrapAsyncIteratorOptions, AsyncIteratorClass, Interceptor, PromiseWithError, ThrowableError, Promisable } from '@orpc/shared';
|
|
2
2
|
export { AsyncCleanupFn, AsyncIteratorClass, AsyncIteratorClassNextFn, PromiseWithError as ClientPromiseResult, 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,
|
|
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, M as MalformedResponseError, p as MalformedResponseErrorOptions, N as NestedClient, q as ORPCErrorOptions } from './shared/client.
|
|
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.
|
|
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, O as ORPCErrorCode, g as ORPCErrorJSON, h as ORPCError } from './shared/client.BoHJeq15.js';
|
|
4
|
+
export { i as AnyORPCErrorJSON, j as COMMON_ERROR_STATUS_MAP, F as FriendlyClientOptions, k as InferClientBodyInputs, l as InferClientBodyOutputs, m as InferClientErrors, n as InferClientInputs, o as InferClientOutputs, M as MalformedResponseError, p as MalformedResponseErrorOptions, N as NestedClient, q as ORPCErrorOptions, R as ResponseError, r as ResponseErrorOptions } from './shared/client.BoHJeq15.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.DqIWeNhQ.js';
|
|
6
6
|
export { ErrorEvent, EventMeta, StandardBody, StandardBodyHint, StandardHeaders, StandardLazyRequest, StandardLazyResponse, StandardMethod, StandardRequest, StandardResponse, StandardUrl, getEventMeta, unwrapEvent, withEventMeta } from '@standard-server/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>;
|
|
@@ -16,26 +16,26 @@ interface ORPCClientScopedOptions<TClientContext extends ClientContext, TInput,
|
|
|
16
16
|
/**
|
|
17
17
|
* Interceptors that wrap the entire client call lifecycle.
|
|
18
18
|
*/
|
|
19
|
-
interceptors?: ORPCClientInterceptor<TClientContext, TInput, TOutput, TError>[];
|
|
19
|
+
interceptors?: ORPCClientInterceptor<TClientContext, TInput, TOutput, TError>[] | undefined;
|
|
20
20
|
}
|
|
21
21
|
type ORPCClientScoped<T extends AnyNestedClient> = T extends Client<infer UClientContext, infer UInput, infer UOutput, infer UError> ? ORPCClientScopedOptions<UClientContext, UInput, UOutput, UError> : {
|
|
22
|
-
[K in keyof T]?: T[K] extends AnyNestedClient ? ORPCClientScoped<T[K]> : never;
|
|
22
|
+
[K in keyof T]?: (T[K] extends AnyNestedClient ? ORPCClientScoped<T[K]> : never) | undefined;
|
|
23
23
|
};
|
|
24
24
|
interface ORPCClientOptions<T extends AnyNestedClient> {
|
|
25
25
|
/**
|
|
26
26
|
* Use as base path for all procedure, useful when you only want to call a subset of the procedure.
|
|
27
27
|
*/
|
|
28
|
-
path?: string[];
|
|
28
|
+
path?: string[] | undefined;
|
|
29
29
|
/**
|
|
30
30
|
* Interceptors that wrap the entire client call lifecycle, applied to every procedure call.
|
|
31
31
|
*/
|
|
32
|
-
interceptors?: ORPCClientInterceptor<InferClientContext<T>, unknown, unknown, InferClientError<T>>[];
|
|
32
|
+
interceptors?: ORPCClientInterceptor<InferClientContext<T>, unknown, unknown, InferClientError<T>>[] | undefined;
|
|
33
33
|
/**
|
|
34
34
|
* Per-procedure options following the shape of the router.
|
|
35
35
|
* Allows fine-grained configuration (e.g. additional interceptors) for individual procedures
|
|
36
36
|
* without affecting the rest of the router.
|
|
37
37
|
*/
|
|
38
|
-
scoped?: ORPCClientScoped<T
|
|
38
|
+
scoped?: ORPCClientScoped<T> | undefined;
|
|
39
39
|
}
|
|
40
40
|
/**
|
|
41
41
|
* Creates a fully typed oRPC client from a link.
|
|
@@ -46,7 +46,6 @@ interface ORPCClientOptions<T extends AnyNestedClient> {
|
|
|
46
46
|
*/
|
|
47
47
|
declare function createORPCClient<T extends AnyNestedClient>(link: ClientLink<InferClientContext<T>>, { path, ...options }?: NoInfer<ORPCClientOptions<T>>): T;
|
|
48
48
|
|
|
49
|
-
declare function resolveFriendlyClientOptions<T extends ClientContext>(options: FriendlyClientOptions<T>): ClientOptions<T>;
|
|
50
49
|
declare function resolveClientRest<TClientContext extends ClientContext, TInput>(rest: ClientRest<TClientContext, TInput>): [input: TInput, options: ClientOptions<TClientContext>];
|
|
51
50
|
type SafeResult<TOutput, TError> = [error: null, data: TOutput, definedError: null, isSuccess: true] & {
|
|
52
51
|
error: null;
|
|
@@ -107,7 +106,7 @@ declare function createSafeClient<T extends AnyNestedClient>(client: T): SafeCli
|
|
|
107
106
|
* proxy for them can cause unexpected behavior, compatibility issues, or
|
|
108
107
|
* infinite proxy chains.
|
|
109
108
|
*/
|
|
110
|
-
declare const RECURSIVE_CLIENT_UNWRAP_KEYS: Set<
|
|
109
|
+
declare const RECURSIVE_CLIENT_UNWRAP_KEYS: Set<PropertyKey>;
|
|
111
110
|
|
|
112
111
|
/**
|
|
113
112
|
* DynamicLink provides a way to dynamically resolve and delegate calls to other ClientLinks
|
|
@@ -141,5 +140,5 @@ declare function createORPCErrorFromJson<TCode extends ORPCErrorCode, TData>(jso
|
|
|
141
140
|
*/
|
|
142
141
|
declare function cloneORPCError<T extends AnyORPCError>(error: T): T;
|
|
143
142
|
|
|
144
|
-
export { AnyNestedClient, AnyORPCError, Client, ClientContext, ClientLink, ClientOptions, ClientRest, DynamicLink,
|
|
143
|
+
export { AnyNestedClient, AnyORPCError, Client, ClientContext, ClientLink, ClientOptions, ClientRest, DynamicLink, InferClientContext, InferClientError, InferClientError as InferClientErrorUnion, ORPCError, ORPCErrorCode, ORPCErrorJSON, RECURSIVE_CLIENT_UNWRAP_KEYS, cloneORPCError, createORPCClient, createORPCErrorFromJson, createSafeClient, isDefinedError, isORPCErrorJson, resolveClientRest, safe, toORPCError, wrapAsyncIteratorPreservingEventMeta };
|
|
145
144
|
export type { ORPCClientInterceptor, ORPCClientInterceptorOptions, ORPCClientOptions, ORPCClientScoped, ORPCClientScopedOptions, SafeClient, SafeResult };
|
package/dist/index.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { a as isDefinedError } 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 wrapAsyncIteratorPreservingEventMeta } from './shared/client.
|
|
1
|
+
import { a as isDefinedError } from './shared/client._wG5INmC.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._wG5INmC.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
|
-
export { C as COMMON_ERROR_STATUS_MAP, M as MalformedResponseError, O as ORPCError } from './shared/client.
|
|
5
|
+
export { C as COMMON_ERROR_STATUS_MAP, M as MalformedResponseError, O as ORPCError, R as ResponseError } from './shared/client.LF04eOvL.mjs';
|
|
6
6
|
export { ErrorEvent, getEventMeta, unwrapEvent, withEventMeta } from '@standard-server/core';
|
|
7
7
|
|
|
8
8
|
const RECURSIVE_CLIENT_UNWRAP_KEYS = /* @__PURE__ */ new Set([
|
|
@@ -144,4 +144,4 @@ class DynamicLink {
|
|
|
144
144
|
}
|
|
145
145
|
}
|
|
146
146
|
|
|
147
|
-
export { DynamicLink, RECURSIVE_CLIENT_UNWRAP_KEYS, createORPCClient, createSafeClient, isDefinedError, resolveClientRest,
|
|
147
|
+
export { DynamicLink, RECURSIVE_CLIENT_UNWRAP_KEYS, createORPCClient, createSafeClient, isDefinedError, resolveClientRest, safe };
|
package/dist/plugins/index.d.mts
CHANGED
|
@@ -3,7 +3,19 @@ import { StandardUrl, StandardHeaders, StandardRequest, StandardLazyResponse } f
|
|
|
3
3
|
import { ClientContext } from '../index.mjs';
|
|
4
4
|
import { StandardLinkPlugin, StandardLinkTransportInterceptorOptions, StandardLinkOptions, StandardLinkInterceptorOptions } from '../adapters/standard/index.mjs';
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
/**
|
|
7
|
+
* Header that marks a request as a batch, set by the Batch Link Plugin and detected by the Batch Handler Plugin.
|
|
8
|
+
* Nothing between the client and server, such as a CORS policy or proxy, should block or strip it.
|
|
9
|
+
*
|
|
10
|
+
* @see {@link https://orpc.dev/docs/plugins/batch#setup | Batch Plugin - Setup}
|
|
11
|
+
*/
|
|
12
|
+
declare const BATCH_HEADER = "orpc-batch";
|
|
13
|
+
/**
|
|
14
|
+
* Default `maxSize` of both the Batch Link Plugin and the Batch Handler Plugin.
|
|
15
|
+
*
|
|
16
|
+
* @see {@link https://orpc.dev/docs/plugins/batch#max-size | Batch Plugin - Max Size}
|
|
17
|
+
*/
|
|
18
|
+
declare const DEFAULT_BATCH_MAX_SIZE = 10;
|
|
7
19
|
interface BatchLinkPluginGroup<T extends ClientContext> {
|
|
8
20
|
/**
|
|
9
21
|
* Determines whether a request should be included in this batch group.
|
|
@@ -21,7 +33,7 @@ interface BatchLinkPluginGroup<T extends ClientContext> {
|
|
|
21
33
|
*
|
|
22
34
|
* @default []
|
|
23
35
|
*/
|
|
24
|
-
path?: Value<string[], [items: [StandardLinkTransportInterceptorOptions<T>, ...StandardLinkTransportInterceptorOptions<T>[]]]
|
|
36
|
+
path?: Value<string[], [items: [StandardLinkTransportInterceptorOptions<T>, ...StandardLinkTransportInterceptorOptions<T>[]]]> | undefined;
|
|
25
37
|
}
|
|
26
38
|
interface BatchLinkPluginOptions<T extends ClientContext> {
|
|
27
39
|
groups: [BatchLinkPluginGroup<T>, ...BatchLinkPluginGroup<T>[]];
|
|
@@ -30,20 +42,22 @@ interface BatchLinkPluginOptions<T extends ClientContext> {
|
|
|
30
42
|
*
|
|
31
43
|
* @default () => true
|
|
32
44
|
*/
|
|
33
|
-
filter?: Value<boolean, [options: StandardLinkTransportInterceptorOptions<T>]
|
|
45
|
+
filter?: Value<boolean, [options: StandardLinkTransportInterceptorOptions<T>]> | undefined;
|
|
34
46
|
/**
|
|
35
47
|
* Only requests with the same scope are batched together.
|
|
36
48
|
* On the server, return a value unique to the incoming request so different users never share a batch.
|
|
37
49
|
*
|
|
38
50
|
* @default () => undefined
|
|
39
51
|
*/
|
|
40
|
-
scope?: (options: StandardLinkTransportInterceptorOptions<T>) => unknown;
|
|
52
|
+
scope?: ((options: StandardLinkTransportInterceptorOptions<T>) => unknown) | undefined;
|
|
41
53
|
/**
|
|
42
|
-
* The maximum number of requests in the batch.
|
|
54
|
+
* The maximum number of requests in the batch. Larger batches are split.
|
|
55
|
+
* Keep it at or below the server Batch Handler Plugin's `maxSize`, which rejects larger batches with a `413`.
|
|
43
56
|
*
|
|
44
|
-
* @default 10
|
|
57
|
+
* @default DEFAULT_BATCH_MAX_SIZE (10)
|
|
58
|
+
* @see {@link https://orpc.dev/docs/plugins/batch#max-size | Batch Plugin - Max Size}
|
|
45
59
|
*/
|
|
46
|
-
maxSize?: Value<Promisable<number>, [subOptionsList: [StandardLinkTransportInterceptorOptions<T>, ...StandardLinkTransportInterceptorOptions<T>[]]]
|
|
60
|
+
maxSize?: Value<Promisable<number>, [subOptionsList: [StandardLinkTransportInterceptorOptions<T>, ...StandardLinkTransportInterceptorOptions<T>[]]]> | undefined;
|
|
47
61
|
/**
|
|
48
62
|
* How long (in ms) to wait for more requests before sending the batch,
|
|
49
63
|
* counted from the first queued request.
|
|
@@ -51,20 +65,13 @@ interface BatchLinkPluginOptions<T extends ClientContext> {
|
|
|
51
65
|
*
|
|
52
66
|
* @default 0
|
|
53
67
|
*/
|
|
54
|
-
wait?: number;
|
|
55
|
-
/**
|
|
56
|
-
* The batch response mode.
|
|
57
|
-
* A `buffered` batch still streams once a procedure in it returns a stream.
|
|
58
|
-
*
|
|
59
|
-
* @default 'streaming'
|
|
60
|
-
*/
|
|
61
|
-
mode?: Value<BatchLinkPluginMode, [subOptionsList: [StandardLinkTransportInterceptorOptions<T>, ...StandardLinkTransportInterceptorOptions<T>[]]]>;
|
|
68
|
+
wait?: number | undefined;
|
|
62
69
|
/**
|
|
63
70
|
* URL for the batch request.
|
|
64
71
|
*
|
|
65
72
|
* @default URL of the first subrequest in the batch + '/__batch__'
|
|
66
73
|
*/
|
|
67
|
-
url?: Value<Promisable<StandardUrl>, [subOptionsList: [StandardLinkTransportInterceptorOptions<T>, ...StandardLinkTransportInterceptorOptions<T>[]]]
|
|
74
|
+
url?: Value<Promisable<StandardUrl>, [subOptionsList: [StandardLinkTransportInterceptorOptions<T>, ...StandardLinkTransportInterceptorOptions<T>[]]]> | undefined;
|
|
68
75
|
/**
|
|
69
76
|
* The maximum length of the URL that runtime supports,
|
|
70
77
|
* if exceeded, the batch will be split into smaller batches and sent sequentially.
|
|
@@ -73,25 +80,25 @@ interface BatchLinkPluginOptions<T extends ClientContext> {
|
|
|
73
80
|
*
|
|
74
81
|
* @default 2083
|
|
75
82
|
*/
|
|
76
|
-
maxUrlLength?: Value<Promisable<number>, [subOptionsList: [StandardLinkTransportInterceptorOptions<T>, ...StandardLinkTransportInterceptorOptions<T>[]]]
|
|
83
|
+
maxUrlLength?: Value<Promisable<number>, [subOptionsList: [StandardLinkTransportInterceptorOptions<T>, ...StandardLinkTransportInterceptorOptions<T>[]]]> | undefined;
|
|
77
84
|
/**
|
|
78
85
|
* Headers used for the batch request.
|
|
79
86
|
*
|
|
80
87
|
* @default Common headers among all subrequests in the batch.
|
|
81
88
|
*/
|
|
82
|
-
headers?: Value<Promisable<StandardHeaders>, [subOptionsList: [StandardLinkTransportInterceptorOptions<T>, ...StandardLinkTransportInterceptorOptions<T>[]]]
|
|
89
|
+
headers?: Value<Promisable<StandardHeaders>, [subOptionsList: [StandardLinkTransportInterceptorOptions<T>, ...StandardLinkTransportInterceptorOptions<T>[]]]> | undefined;
|
|
83
90
|
/**
|
|
84
91
|
* Map each subrequest in the batch before it is sent.
|
|
85
92
|
*
|
|
86
93
|
* @default Removes headers that are duplicated with the batch headers
|
|
87
94
|
*/
|
|
88
|
-
mapSubrequest?: (subOptions: StandardLinkTransportInterceptorOptions<T>, partialBatchRequest: Pick<StandardRequest, 'url' | 'headers'>) => StandardRequest;
|
|
95
|
+
mapSubrequest?: ((subOptions: StandardLinkTransportInterceptorOptions<T>, partialBatchRequest: Pick<StandardRequest, 'url' | 'headers'>) => StandardRequest) | undefined;
|
|
89
96
|
/**
|
|
90
97
|
* Maps each subresponse before returning the final response.
|
|
91
98
|
*
|
|
92
99
|
* @default Low-priority merges headers from the batch response into each subresponse.
|
|
93
100
|
*/
|
|
94
|
-
mapSubresponse?: (subResponse: StandardLazyResponse, batchResponse: StandardLazyResponse, subOptions: StandardLinkTransportInterceptorOptions<T>) => StandardLazyResponse;
|
|
101
|
+
mapSubresponse?: ((subResponse: StandardLazyResponse, batchResponse: StandardLazyResponse, subOptions: StandardLinkTransportInterceptorOptions<T>) => StandardLazyResponse) | undefined;
|
|
95
102
|
}
|
|
96
103
|
/**
|
|
97
104
|
* Combines multiple client requests into a single batch request
|
|
@@ -109,7 +116,6 @@ declare class BatchLinkPlugin<T extends ClientContext> implements StandardLinkPl
|
|
|
109
116
|
private readonly scope;
|
|
110
117
|
private readonly maxSize;
|
|
111
118
|
private readonly wait;
|
|
112
|
-
private readonly mode;
|
|
113
119
|
private readonly batchUrl;
|
|
114
120
|
private readonly maxUrlLength;
|
|
115
121
|
private readonly batchHeaders;
|
|
@@ -152,14 +158,14 @@ interface DedupeLinkPluginOptions<T extends ClientContext> {
|
|
|
152
158
|
*
|
|
153
159
|
* @default ({ request }) => request.method === 'GET' || request.method === 'QUERY'
|
|
154
160
|
*/
|
|
155
|
-
filter?: Value<boolean, [options: StandardLinkTransportInterceptorOptions<T>]
|
|
161
|
+
filter?: Value<boolean, [options: StandardLinkTransportInterceptorOptions<T>]> | undefined;
|
|
156
162
|
/**
|
|
157
163
|
* Only requests with the same scope are deduplicated together.
|
|
158
164
|
* On the server, return a value unique to the incoming request so different users never share a response.
|
|
159
165
|
*
|
|
160
166
|
* @default () => undefined
|
|
161
167
|
*/
|
|
162
|
-
scope?: (options: StandardLinkTransportInterceptorOptions<T>) => unknown;
|
|
168
|
+
scope?: ((options: StandardLinkTransportInterceptorOptions<T>) => unknown) | undefined;
|
|
163
169
|
/**
|
|
164
170
|
* How long (in ms) to wait for more identical requests before sending,
|
|
165
171
|
* counted from the first queued request.
|
|
@@ -167,7 +173,7 @@ interface DedupeLinkPluginOptions<T extends ClientContext> {
|
|
|
167
173
|
*
|
|
168
174
|
* @default 0
|
|
169
175
|
*/
|
|
170
|
-
wait?: number;
|
|
176
|
+
wait?: number | undefined;
|
|
171
177
|
}
|
|
172
178
|
/**
|
|
173
179
|
* Prevents redundant requests by deduplicating similar in-flight requests,
|
|
@@ -196,7 +202,7 @@ interface RequestCompressionLinkPluginOptions<T extends ClientContext> {
|
|
|
196
202
|
*
|
|
197
203
|
* @default 'gzip'
|
|
198
204
|
*/
|
|
199
|
-
encoding?: 'gzip' | 'deflate' | 'deflate-raw';
|
|
205
|
+
encoding?: 'gzip' | 'deflate' | 'deflate-raw' | undefined;
|
|
200
206
|
/**
|
|
201
207
|
* The minimum request size in bytes required to trigger compression.
|
|
202
208
|
* Requests smaller than this threshold will not be compressed to avoid overhead.
|
|
@@ -204,7 +210,7 @@ interface RequestCompressionLinkPluginOptions<T extends ClientContext> {
|
|
|
204
210
|
*
|
|
205
211
|
* @default 1024 (1KB)
|
|
206
212
|
*/
|
|
207
|
-
threshold?: number;
|
|
213
|
+
threshold?: number | undefined;
|
|
208
214
|
/**
|
|
209
215
|
* Determines whether a request with the given Content-Type should be compressed.
|
|
210
216
|
* Only consulted for binary transfers (streams, files, and file form-data parts).
|
|
@@ -212,7 +218,7 @@ interface RequestCompressionLinkPluginOptions<T extends ClientContext> {
|
|
|
212
218
|
*
|
|
213
219
|
* @default isCompressibleContentType (covers common text-based formats)
|
|
214
220
|
*/
|
|
215
|
-
isCompressibleContentType?: (contentType: string | null | undefined, options: StandardLinkTransportInterceptorOptions<T>) => boolean;
|
|
221
|
+
isCompressibleContentType?: ((contentType: string | null | undefined, options: StandardLinkTransportInterceptorOptions<T>) => boolean) | undefined;
|
|
216
222
|
}
|
|
217
223
|
/**
|
|
218
224
|
* Compresses request bodies before sending them to the server,
|
|
@@ -240,7 +246,7 @@ interface ResponseCompressionLinkPluginOptions<_T extends ClientContext> {
|
|
|
240
246
|
*
|
|
241
247
|
* @default ['gzip', 'deflate']
|
|
242
248
|
*/
|
|
243
|
-
encodings?: readonly ('gzip' | 'deflate' | 'deflate-raw')[];
|
|
249
|
+
encodings?: readonly ('gzip' | 'deflate' | 'deflate-raw')[] | undefined;
|
|
244
250
|
}
|
|
245
251
|
/**
|
|
246
252
|
* Advertises Accept-Encoding on requests and decompresses response bodies
|
|
@@ -287,7 +293,7 @@ interface RetryLinkPluginContext {
|
|
|
287
293
|
*
|
|
288
294
|
* @default 0
|
|
289
295
|
*/
|
|
290
|
-
retry?: Value<Promisable<number>, [Omit<StandardLinkInterceptorOptions<RetryLinkPluginContext>, 'next'>]
|
|
296
|
+
retry?: Value<Promisable<number>, [Omit<StandardLinkInterceptorOptions<RetryLinkPluginContext>, 'next'>]> | undefined;
|
|
291
297
|
/**
|
|
292
298
|
* Delay (in ms) before retrying.
|
|
293
299
|
*
|
|
@@ -296,17 +302,17 @@ interface RetryLinkPluginContext {
|
|
|
296
302
|
*
|
|
297
303
|
* @default (o) => o.lastEventRetry ?? 2000
|
|
298
304
|
*/
|
|
299
|
-
retryDelay?: Value<Promisable<number>, [RetryLinkPluginAttemptOptions<RetryLinkPluginContext>]
|
|
305
|
+
retryDelay?: Value<Promisable<number>, [RetryLinkPluginAttemptOptions<RetryLinkPluginContext>]> | undefined;
|
|
300
306
|
/**
|
|
301
307
|
* Determine whether to retry.
|
|
302
308
|
*
|
|
303
|
-
* @default
|
|
309
|
+
* @default (o) => isRetryableError(o.error)
|
|
304
310
|
*/
|
|
305
|
-
shouldRetry?: Value<Promisable<boolean>, [RetryLinkPluginAttemptOptions<RetryLinkPluginContext>]
|
|
311
|
+
shouldRetry?: Value<Promisable<boolean>, [RetryLinkPluginAttemptOptions<RetryLinkPluginContext>]> | undefined;
|
|
306
312
|
/**
|
|
307
313
|
* Hook called before each retry. Can return a cleanup callback.
|
|
308
314
|
*/
|
|
309
|
-
onRetry?: (options: RetryLinkPluginAttemptOptions<RetryLinkPluginContext>) => void | ((isSuccess: boolean) => void);
|
|
315
|
+
onRetry?: ((options: RetryLinkPluginAttemptOptions<RetryLinkPluginContext>) => void | ((isSuccess: boolean) => void)) | undefined;
|
|
310
316
|
}
|
|
311
317
|
interface RetryLinkPluginOptions<_T extends RetryLinkPluginContext> {
|
|
312
318
|
/**
|
|
@@ -314,6 +320,13 @@ interface RetryLinkPluginOptions<_T extends RetryLinkPluginContext> {
|
|
|
314
320
|
*/
|
|
315
321
|
default?: RetryLinkPluginContext | undefined;
|
|
316
322
|
}
|
|
323
|
+
/**
|
|
324
|
+
* Default `shouldRetry` check of `RetryLinkPlugin`. Returns `false` only for errors
|
|
325
|
+
* from a 4xx response other than `408` and `429`.
|
|
326
|
+
*
|
|
327
|
+
* @see {@link https://orpc.dev/docs/plugins/retry#client-error-responses | Retry Plugin - Client Error Responses}
|
|
328
|
+
*/
|
|
329
|
+
declare function isRetryableError(error: unknown): boolean;
|
|
317
330
|
/**
|
|
318
331
|
* Automatically retries failed requests based on customizable retry strategies,
|
|
319
332
|
* improving the resilience of your application.
|
|
@@ -342,7 +355,7 @@ interface RetryAfterLinkPluginOptions<T extends ClientContext> {
|
|
|
342
355
|
condition?: Value<boolean, [
|
|
343
356
|
response: StandardLazyResponse,
|
|
344
357
|
options: StandardLinkTransportInterceptorOptions<T>
|
|
345
|
-
]
|
|
358
|
+
]> | undefined;
|
|
346
359
|
/**
|
|
347
360
|
* Maximum attempts before giving up retries.
|
|
348
361
|
*
|
|
@@ -351,7 +364,7 @@ interface RetryAfterLinkPluginOptions<T extends ClientContext> {
|
|
|
351
364
|
maxAttempts?: Value<number, [
|
|
352
365
|
response: StandardLazyResponse,
|
|
353
366
|
options: StandardLinkTransportInterceptorOptions<T>
|
|
354
|
-
]
|
|
367
|
+
]> | undefined;
|
|
355
368
|
/**
|
|
356
369
|
* Maximum timeout in milliseconds to wait before giving up retries.
|
|
357
370
|
*
|
|
@@ -360,7 +373,7 @@ interface RetryAfterLinkPluginOptions<T extends ClientContext> {
|
|
|
360
373
|
timeout?: Value<number, [
|
|
361
374
|
response: StandardLazyResponse,
|
|
362
375
|
options: StandardLinkTransportInterceptorOptions<T>
|
|
363
|
-
]
|
|
376
|
+
]> | undefined;
|
|
364
377
|
}
|
|
365
378
|
/**
|
|
366
379
|
* The Retry After Link Plugin automatically retries requests based on server `retry-after` header.
|
|
@@ -403,5 +416,5 @@ declare class TimeoutLinkPlugin<T extends ClientContext> implements StandardLink
|
|
|
403
416
|
init(options: StandardLinkOptions<T>): StandardLinkOptions<T>;
|
|
404
417
|
}
|
|
405
418
|
|
|
406
|
-
export { BatchLinkPlugin, RetryLinkPlugin as ClientRetryPlugin, DedupeLinkPlugin, DedupeLinkPlugin as DedupeRequestsPlugin, RequestCompressionLinkPlugin, ResponseCompressionLinkPlugin, RetryAfterLinkPlugin, RetryAfterLinkPlugin as RetryAfterPlugin, RetryLinkPlugin, TimeoutLinkPlugin };
|
|
407
|
-
export type { BatchLinkPluginGroup,
|
|
419
|
+
export { BATCH_HEADER, BatchLinkPlugin, RetryLinkPlugin as ClientRetryPlugin, DEFAULT_BATCH_MAX_SIZE, DedupeLinkPlugin, DedupeLinkPlugin as DedupeRequestsPlugin, RequestCompressionLinkPlugin, ResponseCompressionLinkPlugin, RetryAfterLinkPlugin, RetryAfterLinkPlugin as RetryAfterPlugin, RetryLinkPlugin, TimeoutLinkPlugin, isRetryableError };
|
|
420
|
+
export type { BatchLinkPluginGroup, BatchLinkPluginOptions, RetryLinkPluginContext as ClientRetryPluginContext, DedupeLinkPluginGroup, DedupeLinkPluginOptions, RequestCompressionLinkPluginOptions, ResponseCompressionLinkPluginOptions, RetryAfterLinkPluginOptions, RetryLinkPluginAttemptOptions, RetryLinkPluginContext, RetryLinkPluginOptions, TimeoutLinkPluginOptions };
|