@orpc/client 2.0.0-beta.41 → 2.0.0-beta.43

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.
@@ -365,6 +365,9 @@ interface RetryAfterLinkPluginOptions<T extends ClientContext> {
365
365
  * The Retry After Link Plugin automatically retries requests based on server `retry-after` header.
366
366
  * This is particularly useful for handling rate limiting and temporary server unavailability.
367
367
  *
368
+ * @remarks
369
+ * **Note**: Requests with a stream or async iterator body are never retried, since the body cannot be resent.
370
+ *
368
371
  * @see {@link https://orpc.dev/docs/plugins/retry-after | Retry After Plugin}
369
372
  */
370
373
  declare class RetryAfterLinkPlugin<T extends ClientContext> implements StandardLinkPlugin<T> {
@@ -365,6 +365,9 @@ interface RetryAfterLinkPluginOptions<T extends ClientContext> {
365
365
  * The Retry After Link Plugin automatically retries requests based on server `retry-after` header.
366
366
  * This is particularly useful for handling rate limiting and temporary server unavailability.
367
367
  *
368
+ * @remarks
369
+ * **Note**: Requests with a stream or async iterator body are never retried, since the body cannot be resent.
370
+ *
368
371
  * @see {@link https://orpc.dev/docs/plugins/retry-after | Retry After Plugin}
369
372
  */
370
373
  declare class RetryAfterLinkPlugin<T extends ClientContext> implements StandardLinkPlugin<T> {
@@ -180,6 +180,7 @@ class BatchLinkPlugin {
180
180
  return;
181
181
  }
182
182
  isBatchSent = true;
183
+ const outgoingMessages = pendingMessages.filter((message) => openRequestIds.has(message.id));
183
184
  try {
184
185
  const request = {
185
186
  url,
@@ -189,7 +190,7 @@ class BatchLinkPlugin {
189
190
  };
190
191
  if (method === "GET") {
191
192
  const [pathname, search, hash] = parseStandardUrl(url);
192
- const dataParam = `data=${safeEncodeURIComponent(stringifyJSON(pendingMessages))}`;
193
+ const dataParam = `data=${safeEncodeURIComponent(stringifyJSON(outgoingMessages))}`;
193
194
  const newUrl = search ? `${pathname}${search}&${dataParam}${hash ?? ""}` : `${pathname}?${dataParam}${hash ?? ""}`;
194
195
  const maxUrlLength = await value(this.maxUrlLength, subOptionsList);
195
196
  if (newUrl.length > maxUrlLength) {
@@ -204,7 +205,7 @@ class BatchLinkPlugin {
204
205
  }
205
206
  request.url = newUrl;
206
207
  } else {
207
- request.body = pendingMessages;
208
+ request.body = outgoingMessages;
208
209
  }
209
210
  batchResponse = await groupItems[0][0].next({
210
211
  ...subOptionsList[0],
@@ -873,6 +874,10 @@ class RetryAfterLinkPlugin {
873
874
  }
874
875
  init(options) {
875
876
  const interceptor = async (interceptorOptions) => {
877
+ const { body } = interceptorOptions.request;
878
+ if (body instanceof ReadableStream || isAsyncIteratorObject(body)) {
879
+ return interceptorOptions.next();
880
+ }
876
881
  const startTime = Date.now();
877
882
  let attemptCount = 0;
878
883
  while (true) {
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.41",
4
+ "version": "2.0.0-beta.43",
5
5
  "description": "Consume oRPC and OpenAPI APIs with end-to-end type safety over HTTP, WebSocket, or message ports",
6
6
  "license": "MIT",
7
7
  "funding": [
@@ -63,10 +63,10 @@
63
63
  "dist"
64
64
  ],
65
65
  "dependencies": {
66
- "@orpc/shared": "2.0.0-beta.41",
67
- "@standard-server/core": "~0.10.0",
68
- "@standard-server/fetch": "~0.10.0",
69
- "@standard-server/peer": "~0.10.0"
66
+ "@orpc/shared": "2.0.0-beta.43",
67
+ "@standard-server/core": "~0.10.2",
68
+ "@standard-server/fetch": "~0.10.2",
69
+ "@standard-server/peer": "~0.10.2"
70
70
  },
71
71
  "devDependencies": {
72
72
  "@types/ws": "^8.18.1",