@orpc/client 1.14.9 → 1.14.11
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 +52 -68
- package/dist/adapters/fetch/index.d.mts +54 -35
- package/dist/adapters/fetch/index.d.ts +54 -35
- package/dist/adapters/fetch/index.mjs +74 -27
- package/dist/adapters/message-port/index.d.mts +25 -30
- package/dist/adapters/message-port/index.d.ts +25 -30
- package/dist/adapters/message-port/index.mjs +39 -30
- package/dist/adapters/standard/index.d.mts +59 -9
- package/dist/adapters/standard/index.d.ts +59 -9
- package/dist/adapters/standard/index.mjs +5 -5
- package/dist/adapters/websocket/index.d.mts +113 -21
- package/dist/adapters/websocket/index.d.ts +113 -21
- package/dist/adapters/websocket/index.mjs +95 -37
- package/dist/index.d.mts +75 -184
- package/dist/index.d.ts +75 -184
- package/dist/index.mjs +74 -63
- package/dist/plugins/index.d.mts +191 -122
- package/dist/plugins/index.d.ts +191 -122
- package/dist/plugins/index.mjs +627 -281
- package/dist/shared/client.8f4DNmdE.d.mts +96 -0
- package/dist/shared/client.BBZBQID8.d.mts +167 -0
- package/dist/shared/client.BBZBQID8.d.ts +167 -0
- package/dist/shared/client.BMKYqpdy.d.ts +96 -0
- package/dist/shared/client.BRJnOJ0R.mjs +174 -0
- package/dist/shared/client.BdItY5DT.d.mts +111 -0
- package/dist/shared/client.BdItY5DT.d.ts +111 -0
- package/dist/shared/client.Dnfj8jnT.mjs +92 -0
- package/dist/shared/client.DqYwRDUO.mjs +343 -0
- package/package.json +7 -7
- package/dist/shared/client.2jUAqzYU.d.ts +0 -45
- package/dist/shared/client.B3pNRBih.d.ts +0 -91
- package/dist/shared/client.BFAVy68H.d.mts +0 -91
- package/dist/shared/client.BLtwTQUg.mjs +0 -40
- package/dist/shared/client.CFQL4ewg.mjs +0 -174
- package/dist/shared/client.CpCa3si8.d.mts +0 -45
- package/dist/shared/client.D2nvAALa.mjs +0 -404
- package/dist/shared/client.i2uoJbEp.d.mts +0 -83
- package/dist/shared/client.i2uoJbEp.d.ts +0 -83
package/dist/plugins/index.d.ts
CHANGED
|
@@ -1,168 +1,253 @@
|
|
|
1
1
|
import { Value, Promisable } from '@orpc/shared';
|
|
2
|
-
import { StandardHeaders, StandardRequest, StandardLazyResponse } from '@
|
|
3
|
-
import {
|
|
4
|
-
import { b as
|
|
5
|
-
import { S as StandardLinkClientInterceptorOptions, a as StandardLinkPlugin, b as StandardLinkOptions, c as StandardLinkInterceptorOptions } from '../shared/client.2jUAqzYU.js';
|
|
2
|
+
import { StandardUrl, StandardHeaders, StandardRequest, StandardLazyResponse } from '@standardserver/core';
|
|
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';
|
|
6
5
|
|
|
6
|
+
type BatchLinkPluginMode = 'streaming' | 'buffered';
|
|
7
7
|
interface BatchLinkPluginGroup<T extends ClientContext> {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
/**
|
|
9
|
+
* Determines whether a request should be included in this batch group.
|
|
10
|
+
* Requests will be evaluated against each group's condition in order,
|
|
11
|
+
* and included in the first group whose condition returns true.
|
|
12
|
+
* If no group's condition returns true, the request will not be batched.
|
|
13
|
+
*/
|
|
14
|
+
condition: Value<boolean, [options: StandardLinkTransportInterceptorOptions<T>]>;
|
|
15
|
+
/**
|
|
16
|
+
* The client context applied to requests in this batch group for the remainder of the link chain.
|
|
17
|
+
*/
|
|
18
|
+
context: Value<T, [items: [StandardLinkTransportInterceptorOptions<T>, ...StandardLinkTransportInterceptorOptions<T>[]]]>;
|
|
19
|
+
/**
|
|
20
|
+
* The path segments applied to requests in this batch group for the remainder of the link chain.
|
|
21
|
+
*
|
|
22
|
+
* @default []
|
|
23
|
+
*/
|
|
24
|
+
path?: Value<string[], [items: [StandardLinkTransportInterceptorOptions<T>, ...StandardLinkTransportInterceptorOptions<T>[]]]>;
|
|
25
|
+
}
|
|
26
|
+
declare class BatchLinkPluginError extends TypeError {
|
|
12
27
|
}
|
|
13
28
|
interface BatchLinkPluginOptions<T extends ClientContext> {
|
|
14
|
-
groups:
|
|
29
|
+
groups: [BatchLinkPluginGroup<T>, ...BatchLinkPluginGroup<T>[]];
|
|
30
|
+
/**
|
|
31
|
+
* Filters requests to batch.
|
|
32
|
+
*
|
|
33
|
+
* @default () => true
|
|
34
|
+
*/
|
|
35
|
+
filter?: Value<boolean, [options: StandardLinkTransportInterceptorOptions<T>]>;
|
|
15
36
|
/**
|
|
16
37
|
* The maximum number of requests in the batch.
|
|
17
38
|
*
|
|
18
39
|
* @default 10
|
|
19
40
|
*/
|
|
20
|
-
maxSize?: Value<Promisable<number>, [
|
|
41
|
+
maxSize?: Value<Promisable<number>, [subOptionsList: [StandardLinkTransportInterceptorOptions<T>, ...StandardLinkTransportInterceptorOptions<T>[]]]>;
|
|
21
42
|
/**
|
|
22
43
|
* The batch response mode.
|
|
23
44
|
*
|
|
24
45
|
* @default 'streaming'
|
|
25
46
|
*/
|
|
26
|
-
mode?: Value<
|
|
47
|
+
mode?: Value<BatchLinkPluginMode, [subOptionsList: [StandardLinkTransportInterceptorOptions<T>, ...StandardLinkTransportInterceptorOptions<T>[]]]>;
|
|
27
48
|
/**
|
|
28
|
-
*
|
|
49
|
+
* URL for the batch request.
|
|
29
50
|
*
|
|
30
|
-
* @default
|
|
51
|
+
* @default URL of the first subrequest in the batch + '/__batch__'
|
|
31
52
|
*/
|
|
32
|
-
url?: Value<Promisable<
|
|
53
|
+
url?: Value<Promisable<StandardUrl>, [subOptionsList: [StandardLinkTransportInterceptorOptions<T>, ...StandardLinkTransportInterceptorOptions<T>[]]]>;
|
|
33
54
|
/**
|
|
34
|
-
* The maximum length of the URL
|
|
55
|
+
* The maximum length of the URL that runtime supports,
|
|
56
|
+
* if exceeded, the batch will be split into smaller batches and sent sequentially.
|
|
57
|
+
*
|
|
58
|
+
* This only applies to GET batch requests where the batch data is sent via URL query parameter.
|
|
35
59
|
*
|
|
36
60
|
* @default 2083
|
|
37
61
|
*/
|
|
38
|
-
maxUrlLength?: Value<Promisable<number>, [
|
|
62
|
+
maxUrlLength?: Value<Promisable<number>, [subOptionsList: [StandardLinkTransportInterceptorOptions<T>, ...StandardLinkTransportInterceptorOptions<T>[]]]>;
|
|
39
63
|
/**
|
|
40
|
-
*
|
|
64
|
+
* Headers used for the batch request.
|
|
41
65
|
*
|
|
42
|
-
* @default
|
|
66
|
+
* @default Common headers among all subrequests in the batch.
|
|
43
67
|
*/
|
|
44
|
-
headers?: Value<Promisable<StandardHeaders>, [
|
|
68
|
+
headers?: Value<Promisable<StandardHeaders>, [subOptionsList: [StandardLinkTransportInterceptorOptions<T>, ...StandardLinkTransportInterceptorOptions<T>[]]]>;
|
|
45
69
|
/**
|
|
46
|
-
* Map the batch
|
|
70
|
+
* Map each subrequest in the batch before it is sent.
|
|
47
71
|
*
|
|
48
|
-
* @default Removes headers that are duplicated
|
|
72
|
+
* @default Removes headers that are duplicated with the batch headers
|
|
49
73
|
*/
|
|
50
|
-
|
|
51
|
-
batchUrl: URL;
|
|
52
|
-
batchHeaders: StandardHeaders;
|
|
53
|
-
}) => StandardRequest;
|
|
74
|
+
mapSubrequest?: (subOptions: StandardLinkTransportInterceptorOptions<T>, partialBatchRequest: Pick<StandardRequest, 'url' | 'headers'>) => StandardRequest;
|
|
54
75
|
/**
|
|
55
|
-
*
|
|
76
|
+
* Maps each subresponse before returning the final response.
|
|
56
77
|
*
|
|
57
|
-
* @default
|
|
78
|
+
* @default Low-priority merges headers from the batch response into each subresponse.
|
|
58
79
|
*/
|
|
59
|
-
|
|
80
|
+
mapSubresponse?: (subResponse: StandardLazyResponse, batchResponse: StandardLazyResponse, subOptions: StandardLinkTransportInterceptorOptions<T>) => StandardLazyResponse;
|
|
60
81
|
}
|
|
61
|
-
/**
|
|
62
|
-
* The Batch Requests Plugin allows you to combine multiple requests and responses into a single batch,
|
|
63
|
-
* reducing the overhead of sending each one separately.
|
|
64
|
-
*
|
|
65
|
-
* @see {@link https://orpc.dev/docs/plugins/batch-requests Batch Requests Plugin Docs}
|
|
66
|
-
*/
|
|
67
82
|
declare class BatchLinkPlugin<T extends ClientContext> implements StandardLinkPlugin<T> {
|
|
68
|
-
|
|
83
|
+
name: string;
|
|
69
84
|
private readonly groups;
|
|
85
|
+
private readonly filter;
|
|
70
86
|
private readonly maxSize;
|
|
87
|
+
private readonly mode;
|
|
71
88
|
private readonly batchUrl;
|
|
72
89
|
private readonly maxUrlLength;
|
|
73
90
|
private readonly batchHeaders;
|
|
74
|
-
private readonly
|
|
75
|
-
private readonly
|
|
76
|
-
private readonly
|
|
77
|
-
private pending;
|
|
78
|
-
order: number;
|
|
91
|
+
private readonly mapSubrequest;
|
|
92
|
+
private readonly mapSubresponse;
|
|
93
|
+
private readonly queue;
|
|
79
94
|
constructor(options: NoInfer<BatchLinkPluginOptions<T>>);
|
|
80
|
-
init(options: StandardLinkOptions<T>):
|
|
95
|
+
init(options: StandardLinkOptions<T>): StandardLinkOptions<T>;
|
|
96
|
+
private processPendingBatches;
|
|
97
|
+
private executeBatch;
|
|
81
98
|
}
|
|
82
99
|
|
|
83
|
-
interface
|
|
84
|
-
condition
|
|
100
|
+
interface DedupeLinkPluginGroup<T extends ClientContext> {
|
|
101
|
+
condition: Value<boolean, [options: StandardLinkTransportInterceptorOptions<T>]>;
|
|
85
102
|
/**
|
|
86
103
|
* The context used for the rest of the request lifecycle.
|
|
87
104
|
*/
|
|
88
|
-
context: T
|
|
105
|
+
context: Value<T, [
|
|
106
|
+
items: [
|
|
107
|
+
StandardLinkTransportInterceptorOptions<T>,
|
|
108
|
+
StandardLinkTransportInterceptorOptions<T>,
|
|
109
|
+
...StandardLinkTransportInterceptorOptions<T>[]
|
|
110
|
+
]
|
|
111
|
+
]>;
|
|
89
112
|
}
|
|
90
|
-
interface
|
|
113
|
+
interface DedupeLinkPluginOptions<T extends ClientContext> {
|
|
91
114
|
/**
|
|
92
115
|
* To enable deduplication, a request must match at least one defined group.
|
|
93
116
|
* Requests that fall into the same group are considered for deduplication together.
|
|
94
117
|
*/
|
|
95
|
-
groups:
|
|
118
|
+
groups: [DedupeLinkPluginGroup<T>, ...DedupeLinkPluginGroup<T>[]];
|
|
96
119
|
/**
|
|
97
|
-
* Filters requests to dedupe
|
|
120
|
+
* Filters requests to dedupe.
|
|
98
121
|
*
|
|
99
|
-
* @default (
|
|
122
|
+
* @default ({ request }) => request.method === 'GET'
|
|
123
|
+
*/
|
|
124
|
+
filter?: Value<boolean, [options: StandardLinkTransportInterceptorOptions<T>]>;
|
|
125
|
+
}
|
|
126
|
+
declare class DedupeLinkPlugin<T extends ClientContext> implements StandardLinkPlugin<T> {
|
|
127
|
+
name: string;
|
|
128
|
+
before: string[];
|
|
129
|
+
private readonly groups;
|
|
130
|
+
private readonly filter;
|
|
131
|
+
private readonly queue;
|
|
132
|
+
constructor(options: NoInfer<DedupeLinkPluginOptions<T>>);
|
|
133
|
+
init(options: StandardLinkOptions<T>): StandardLinkOptions<T>;
|
|
134
|
+
private enqueue;
|
|
135
|
+
private processPendingRequests;
|
|
136
|
+
private execute;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
interface RequestCompressionLinkPluginOptions<_T extends ClientContext> {
|
|
140
|
+
/**
|
|
141
|
+
* The compression scheme to use for request compression.
|
|
142
|
+
*
|
|
143
|
+
* @default 'gzip'
|
|
144
|
+
*/
|
|
145
|
+
encoding?: 'gzip' | 'deflate' | 'deflate-raw';
|
|
146
|
+
/**
|
|
147
|
+
* The minimum request size in bytes required to trigger compression.
|
|
148
|
+
* Requests smaller than this threshold will not be compressed to avoid overhead.
|
|
149
|
+
* If the request size cannot be determined, compression will still be applied.
|
|
150
|
+
*
|
|
151
|
+
* @default 1024 (1KB)
|
|
152
|
+
*/
|
|
153
|
+
threshold?: number;
|
|
154
|
+
}
|
|
155
|
+
declare class RequestCompressionLinkPlugin<T extends ClientContext> implements StandardLinkPlugin<T> {
|
|
156
|
+
name: string;
|
|
157
|
+
/**
|
|
158
|
+
* Compression should be done after batching, to compress the final request
|
|
100
159
|
*/
|
|
101
|
-
|
|
160
|
+
after: string[];
|
|
161
|
+
private readonly encoding;
|
|
162
|
+
private readonly threshold;
|
|
163
|
+
constructor(options?: RequestCompressionLinkPluginOptions<T>);
|
|
164
|
+
init(options: StandardLinkOptions<T>): StandardLinkOptions<T>;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
interface ResponseCompressionLinkPluginOptions<_T extends ClientContext> {
|
|
168
|
+
/**
|
|
169
|
+
* Compression schemes to advertise via Accept-Encoding, in preference order.
|
|
170
|
+
* Only schemes that can be decompressed by this plugin should be listed.
|
|
171
|
+
*
|
|
172
|
+
* @default ['gzip', 'deflate']
|
|
173
|
+
*/
|
|
174
|
+
encodings?: readonly ('gzip' | 'deflate' | 'deflate-raw')[];
|
|
102
175
|
}
|
|
103
176
|
/**
|
|
104
|
-
*
|
|
177
|
+
* Advertises Accept-Encoding on requests and decompresses response bodies
|
|
178
|
+
* based on the Content-Encoding header. Works at the standard link level,
|
|
179
|
+
* so it supports all adapters.
|
|
105
180
|
*
|
|
106
|
-
* @see {@link https://orpc.dev/docs/plugins/
|
|
181
|
+
* @see {@link https://orpc.dev/docs/plugins/response-compression Response Compression Plugin Docs}
|
|
107
182
|
*/
|
|
108
|
-
declare class
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
183
|
+
declare class ResponseCompressionLinkPlugin<T extends ClientContext> implements StandardLinkPlugin<T> {
|
|
184
|
+
name: string;
|
|
185
|
+
/**
|
|
186
|
+
* Decompression should wrap the final batch response instead of sub-responses.
|
|
187
|
+
*/
|
|
188
|
+
after: string[];
|
|
189
|
+
private readonly encodings;
|
|
190
|
+
constructor(options?: ResponseCompressionLinkPluginOptions<T>);
|
|
191
|
+
init(options: StandardLinkOptions<T>): StandardLinkOptions<T>;
|
|
113
192
|
}
|
|
114
193
|
|
|
115
|
-
interface
|
|
194
|
+
interface RetryLinkPluginAttemptOptions<T extends RetryLinkPluginContext> extends StandardLinkInterceptorOptions<T> {
|
|
195
|
+
/**
|
|
196
|
+
* Latest retry delay advertised by the server via event metadata.
|
|
197
|
+
*/
|
|
116
198
|
lastEventRetry: number | undefined;
|
|
117
|
-
|
|
199
|
+
/**
|
|
200
|
+
* Current retry attempt number, starting at 1.
|
|
201
|
+
*/
|
|
202
|
+
attempt: number;
|
|
203
|
+
/**
|
|
204
|
+
* Error that triggered this retry attempt.
|
|
205
|
+
*/
|
|
118
206
|
error: unknown;
|
|
119
207
|
}
|
|
120
|
-
interface
|
|
208
|
+
interface RetryLinkPluginContext {
|
|
121
209
|
/**
|
|
122
|
-
* Maximum retry attempts before throwing
|
|
123
|
-
* Use `Number.POSITIVE_INFINITY` for infinite retries (e.g
|
|
210
|
+
* Maximum retry attempts before throwing.
|
|
211
|
+
* Use `Number.POSITIVE_INFINITY` for infinite retries (e.g. for AsyncIteratorObject).
|
|
124
212
|
*
|
|
125
213
|
* @default 0
|
|
126
214
|
*/
|
|
127
|
-
retry?: Value<Promisable<number>, [StandardLinkInterceptorOptions<
|
|
215
|
+
retry?: Value<Promisable<number>, [Omit<StandardLinkInterceptorOptions<RetryLinkPluginContext>, 'next'>]>;
|
|
128
216
|
/**
|
|
129
217
|
* Delay (in ms) before retrying.
|
|
130
218
|
*
|
|
219
|
+
* @info Why 2000ms? The EventSource spec suggests a default retry delay of 2 seconds if it doesn't specify
|
|
131
220
|
* @default (o) => o.lastEventRetry ?? 2000
|
|
132
221
|
*/
|
|
133
|
-
retryDelay?: Value<Promisable<number>, [
|
|
222
|
+
retryDelay?: Value<Promisable<number>, [RetryLinkPluginAttemptOptions<RetryLinkPluginContext>]>;
|
|
134
223
|
/**
|
|
135
|
-
* Determine
|
|
224
|
+
* Determine whether to retry.
|
|
136
225
|
*
|
|
137
226
|
* @default true
|
|
138
227
|
*/
|
|
139
|
-
shouldRetry?: Value<Promisable<boolean>, [
|
|
228
|
+
shouldRetry?: Value<Promisable<boolean>, [RetryLinkPluginAttemptOptions<RetryLinkPluginContext>]>;
|
|
140
229
|
/**
|
|
141
|
-
*
|
|
230
|
+
* Hook called before each retry. Can return a cleanup callback.
|
|
142
231
|
*/
|
|
143
|
-
onRetry?: (options:
|
|
144
|
-
}
|
|
145
|
-
declare class ClientRetryPluginInvalidEventIteratorRetryResponse extends Error {
|
|
232
|
+
onRetry?: (options: RetryLinkPluginAttemptOptions<RetryLinkPluginContext>) => void | ((isSuccess: boolean) => void);
|
|
146
233
|
}
|
|
147
|
-
interface
|
|
148
|
-
|
|
234
|
+
interface RetryLinkPluginOptions<_T extends RetryLinkPluginContext> {
|
|
235
|
+
/**
|
|
236
|
+
* Default retry options. Can be overridden by individual calls via the context.
|
|
237
|
+
*/
|
|
238
|
+
default?: RetryLinkPluginContext | undefined;
|
|
149
239
|
}
|
|
150
|
-
|
|
151
|
-
* The Client Retry Plugin enables retrying client calls when errors occur.
|
|
152
|
-
*
|
|
153
|
-
* @see {@link https://orpc.dev/docs/plugins/client-retry Client Retry Plugin Docs}
|
|
154
|
-
*/
|
|
155
|
-
declare class ClientRetryPlugin<T extends ClientRetryPluginContext> implements StandardLinkPlugin<T> {
|
|
240
|
+
declare class RetryLinkPlugin<T extends RetryLinkPluginContext & ClientContext> implements StandardLinkPlugin<T> {
|
|
156
241
|
private readonly defaultRetry;
|
|
157
242
|
private readonly defaultRetryDelay;
|
|
158
243
|
private readonly defaultShouldRetry;
|
|
159
244
|
private readonly defaultOnRetry;
|
|
160
|
-
|
|
161
|
-
constructor(options?:
|
|
162
|
-
init(options: StandardLinkOptions<T>):
|
|
245
|
+
name: string;
|
|
246
|
+
constructor(options?: RetryLinkPluginOptions<T>);
|
|
247
|
+
init(options: StandardLinkOptions<T>): StandardLinkOptions<T>;
|
|
163
248
|
}
|
|
164
249
|
|
|
165
|
-
interface
|
|
250
|
+
interface RetryAfterLinkPluginOptions<T extends ClientContext> {
|
|
166
251
|
/**
|
|
167
252
|
* Override condition to determine whether to retry or not.
|
|
168
253
|
*
|
|
@@ -170,7 +255,7 @@ interface RetryAfterPluginOptions<T extends ClientContext> {
|
|
|
170
255
|
*/
|
|
171
256
|
condition?: Value<boolean, [
|
|
172
257
|
response: StandardLazyResponse,
|
|
173
|
-
options:
|
|
258
|
+
options: StandardLinkTransportInterceptorOptions<T>
|
|
174
259
|
]>;
|
|
175
260
|
/**
|
|
176
261
|
* Maximum attempts before giving up retries.
|
|
@@ -179,7 +264,7 @@ interface RetryAfterPluginOptions<T extends ClientContext> {
|
|
|
179
264
|
*/
|
|
180
265
|
maxAttempts?: Value<number, [
|
|
181
266
|
response: StandardLazyResponse,
|
|
182
|
-
options:
|
|
267
|
+
options: StandardLinkTransportInterceptorOptions<T>
|
|
183
268
|
]>;
|
|
184
269
|
/**
|
|
185
270
|
* Maximum timeout in milliseconds to wait before giving up retries.
|
|
@@ -188,62 +273,46 @@ interface RetryAfterPluginOptions<T extends ClientContext> {
|
|
|
188
273
|
*/
|
|
189
274
|
timeout?: Value<number, [
|
|
190
275
|
response: StandardLazyResponse,
|
|
191
|
-
options:
|
|
276
|
+
options: StandardLinkTransportInterceptorOptions<T>
|
|
192
277
|
]>;
|
|
193
278
|
}
|
|
194
279
|
/**
|
|
195
|
-
* The Retry After Plugin automatically retries requests based on server `
|
|
280
|
+
* The Retry After Link Plugin automatically retries requests based on server `retry-after` header.
|
|
196
281
|
* This is particularly useful for handling rate limiting and temporary server unavailability.
|
|
197
282
|
*
|
|
198
283
|
* @see {@link https://orpc.dev/docs/plugins/retry-after Retry After Plugin Docs}
|
|
199
284
|
*/
|
|
200
|
-
declare class
|
|
285
|
+
declare class RetryAfterLinkPlugin<T extends ClientContext> implements StandardLinkPlugin<T> {
|
|
201
286
|
private readonly condition;
|
|
202
287
|
private readonly maxAttempts;
|
|
203
288
|
private readonly timeout;
|
|
204
|
-
|
|
205
|
-
constructor(options?:
|
|
206
|
-
init(options: StandardLinkOptions<T>):
|
|
207
|
-
private parseRetryAfterHeader;
|
|
208
|
-
private delayExecution;
|
|
289
|
+
name: string;
|
|
290
|
+
constructor(options?: RetryAfterLinkPluginOptions<T>);
|
|
291
|
+
init(options: StandardLinkOptions<T>): StandardLinkOptions<T>;
|
|
209
292
|
}
|
|
210
293
|
|
|
211
|
-
interface
|
|
294
|
+
interface TimeoutLinkPluginOptions<T extends ClientContext> {
|
|
212
295
|
/**
|
|
213
|
-
*
|
|
214
|
-
*
|
|
215
|
-
* @default 'x-csrf-token'
|
|
296
|
+
* Timeout in milliseconds before the request is aborted.
|
|
297
|
+
* Use `null` or `undefined` to disable the timeout.
|
|
216
298
|
*/
|
|
217
|
-
|
|
218
|
-
/**
|
|
219
|
-
* The value of the header to check.
|
|
220
|
-
*
|
|
221
|
-
* @default 'orpc'
|
|
222
|
-
*
|
|
223
|
-
*/
|
|
224
|
-
headerValue?: Value<Promisable<string>, [options: StandardLinkClientInterceptorOptions<T>]>;
|
|
225
|
-
/**
|
|
226
|
-
* Exclude a procedure from the plugin.
|
|
227
|
-
*
|
|
228
|
-
* @default false
|
|
229
|
-
*/
|
|
230
|
-
exclude?: Value<Promisable<boolean>, [options: StandardLinkClientInterceptorOptions<T>]>;
|
|
299
|
+
timeout: Value<number | null | undefined, [options: StandardLinkInterceptorOptions<T>]>;
|
|
231
300
|
}
|
|
232
301
|
/**
|
|
233
|
-
*
|
|
234
|
-
* It helps ensure that requests to your procedures originate from JavaScript code,
|
|
235
|
-
* not from other sources like standard HTML forms or direct browser navigation.
|
|
302
|
+
* The Timeout Link Plugin aborts requests that exceed a configured timeout with an `AbortError`.
|
|
236
303
|
*
|
|
237
|
-
* @see {@link https://orpc.dev/docs/plugins/
|
|
304
|
+
* @see {@link https://orpc.dev/docs/plugins/timeout Timeout Plugin Docs}
|
|
238
305
|
*/
|
|
239
|
-
declare class
|
|
240
|
-
private readonly
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
306
|
+
declare class TimeoutLinkPlugin<T extends ClientContext> implements StandardLinkPlugin<T> {
|
|
307
|
+
private readonly timeout;
|
|
308
|
+
name: string;
|
|
309
|
+
/**
|
|
310
|
+
* Should abort if the total retry time exceeds the configured timeout
|
|
311
|
+
*/
|
|
312
|
+
after: string[];
|
|
313
|
+
constructor(options: NoInfer<TimeoutLinkPluginOptions<T>>);
|
|
314
|
+
init(options: StandardLinkOptions<T>): StandardLinkOptions<T>;
|
|
246
315
|
}
|
|
247
316
|
|
|
248
|
-
export { BatchLinkPlugin,
|
|
249
|
-
export type { BatchLinkPluginGroup, BatchLinkPluginOptions,
|
|
317
|
+
export { BatchLinkPlugin, BatchLinkPluginError, DedupeLinkPlugin, RequestCompressionLinkPlugin, ResponseCompressionLinkPlugin, RetryAfterLinkPlugin, RetryLinkPlugin, TimeoutLinkPlugin };
|
|
318
|
+
export type { BatchLinkPluginGroup, BatchLinkPluginMode, BatchLinkPluginOptions, DedupeLinkPluginGroup, DedupeLinkPluginOptions, RequestCompressionLinkPluginOptions, ResponseCompressionLinkPluginOptions, RetryAfterLinkPluginOptions, RetryLinkPluginAttemptOptions, RetryLinkPluginContext, RetryLinkPluginOptions, TimeoutLinkPluginOptions };
|