@orpc/client 2.0.0-beta.46 → 2.0.0-beta.47
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 +6 -3
- package/dist/plugins/index.mjs +12 -12
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -156,10 +156,11 @@ Like what we build over at [middleapi](https://github.com/middleapi)? You can he
|
|
|
156
156
|
<td align="center"><a href="https://github.com/christ12938?ref=middleapi&utm_source=middleapi&utm_medium=sponsor" target="_blank" rel="noopener sponsored" title="christ12938"><img src="https://avatars.githubusercontent.com/u/25758598?v=4" width="167" alt="christ12938"/><br />christ12938</a></td>
|
|
157
157
|
<td align="center"><a href="https://github.com/Ryanjso?ref=middleapi&utm_source=middleapi&utm_medium=sponsor" target="_blank" rel="noopener sponsored" title="Ryan Soderberg"><img src="https://avatars.githubusercontent.com/u/39172778?u=5ed913c31d57e7221b75784abcad48c7ebddde27&v=4" width="167" alt="Ryan Soderberg"/><br />Ryan Soderberg</a></td>
|
|
158
158
|
<td align="center"><a href="https://github.com/itigoore01?ref=middleapi&utm_source=middleapi&utm_medium=sponsor" target="_blank" rel="noopener sponsored" title="shota"><img src="https://avatars.githubusercontent.com/u/11831107?u=c976a6dc7e055eb026304c46c99100ed22b0c8e0&v=4" width="167" alt="shota"/><br />shota</a></td>
|
|
159
|
+
<td align="center"><a href="https://github.com/Nic13Gamer?ref=middleapi&utm_source=middleapi&utm_medium=sponsor" target="_blank" rel="noopener sponsored" title="Nicholas"><img src="https://avatars.githubusercontent.com/u/54724556?u=56a7ab430ce7a80d648ab6eba051d454a818ed0b&v=4" width="167" alt="Nicholas"/><br />Nicholas</a></td>
|
|
159
160
|
<td align="center"><a href="https://github.com/ellis-driscoll?ref=middleapi&utm_source=middleapi&utm_medium=sponsor" target="_blank" rel="noopener sponsored" title="Ellis Driscoll"><img src="https://avatars.githubusercontent.com/u/70685966?u=c5f95bc33b5991d9744abe00052542e4a2ed3cb9&v=4" width="167" alt="Ellis Driscoll"/><br />Ellis Driscoll</a></td>
|
|
160
|
-
<td align="center"><a href="https://github.com/hoangbn?ref=middleapi&utm_source=middleapi&utm_medium=sponsor" target="_blank" rel="noopener sponsored" title="Hoang Nguyen"><img src="https://avatars.githubusercontent.com/u/38968280?u=c90084c6de65c56facabab7ba13a72a49ddbc3e4&v=4" width="167" alt="Hoang Nguyen"/><br />Hoang Nguyen</a></td>
|
|
161
161
|
</tr>
|
|
162
162
|
<tr>
|
|
163
|
+
<td align="center"><a href="https://github.com/hoangbn?ref=middleapi&utm_source=middleapi&utm_medium=sponsor" target="_blank" rel="noopener sponsored" title="Hoang Nguyen"><img src="https://avatars.githubusercontent.com/u/38968280?u=c90084c6de65c56facabab7ba13a72a49ddbc3e4&v=4" width="167" alt="Hoang Nguyen"/><br />Hoang Nguyen</a></td>
|
|
163
164
|
<td align="center"><a href="https://opencollective.com/guest-ac41de3b?ref=middleapi&utm_source=middleapi&utm_medium=sponsor" target="_blank" rel="noopener sponsored" title="Orestis Ioannou"><img src="https://images.opencollective.com/guest-ac41de3b/avatar/460.png" width="167" alt="Orestis Ioannou"/><br />Orestis Ioannou</a></td>
|
|
164
165
|
<td align="center"><a href="https://automatio.ai/?ref=middleapi&utm_source=middleapi&utm_medium=sponsor" target="_blank" rel="noopener sponsored" title="Stefan Smiljkovic"><img src="https://avatars.githubusercontent.com/u/1984909?u=b7bf5bc40ed49df3c22f69d2da7b8d78709c49ed&v=4" width="167" alt="Stefan Smiljkovic"/><br />Stefan Smiljkovic</a></td>
|
|
165
166
|
</tr>
|
|
@@ -198,7 +199,7 @@ Like what we build over at [middleapi](https://github.com/middleapi)? You can he
|
|
|
198
199
|
</tr>
|
|
199
200
|
</table>
|
|
200
201
|
|
|
201
|
-
With thanks to [
|
|
202
|
+
With thanks to [39 past sponsors](https://orpc.dev/sponsors#past-sponsors) who helped get oRPC here.
|
|
202
203
|
|
|
203
204
|
## Open Source Programs
|
|
204
205
|
|
|
@@ -206,7 +207,9 @@ With thanks to [40 past sponsors](https://orpc.dev/sponsors#past-sponsors) who h
|
|
|
206
207
|
|
|
207
208
|
<table>
|
|
208
209
|
<tr>
|
|
209
|
-
<td align="center"><a href="https://claude.com/contact-sales/claude-for-oss" target="_blank" rel="noopener" title="Claude for Open Source"><img src="https://cdn.simpleicons.org/claude" width="64" alt="Claude"/><br />Claude
|
|
210
|
+
<td align="center"><a href="https://claude.com/contact-sales/claude-for-oss" target="_blank" rel="noopener" title="Claude for Open Source"><img src="https://cdn.simpleicons.org/claude" width="64" alt="Claude"/><br />Claude</a></td>
|
|
211
|
+
<td align="center"><a href="https://pullfrog.com/for-oss" target="_blank" rel="noopener" title="Pullfrog for OSS"><img src="https://avatars.githubusercontent.com/in/1768019?s=128&v=4" width="64" alt="Pullfrog"/><br />Pullfrog</a></td>
|
|
212
|
+
<td align="center"><a href="https://macroscope.com/open-source" target="_blank" rel="noopener" title="Macroscope for Open Source"><img src="https://avatars.githubusercontent.com/in/900172?s=128&v=4" width="64" alt="Macroscope"/><br />Macroscope</a></td>
|
|
210
213
|
</tr>
|
|
211
214
|
</table>
|
|
212
215
|
|
package/dist/plugins/index.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { toArray, value, splitInHalf, promiseWithResolvers, safeEncodeURIComponent, stringifyJSON, once, isAsyncIteratorObject, defer, captureAsyncContext, loadBytes, allAbortSignal, runWithSignal, replicateAsyncIterator, replicateReadableStream, wrapAsyncIterator, throwIfAborted, isCompressibleContentType, override, AsyncIteratorClass, sleep, AbortError, anyAbortSignal } from '@orpc/shared';
|
|
2
2
|
import { parseStandardUrl, flattenStandardHeader, generateContentDisposition, getEventMeta } from '@standard-server/core';
|
|
3
3
|
import { ClientPeer, isPeerMessage, isServerPeerSendMessage, decodePeerMessage } from '@standard-server/peer';
|
|
4
|
-
import { toFetchHeaders, toStandardBody } from '@standard-server/fetch';
|
|
4
|
+
import { toFetchBody, toFetchHeaders, toStandardBody } from '@standard-server/fetch';
|
|
5
5
|
import { O as ORPCError, R as ResponseError, C as COMMON_ERROR_STATUS_MAP } from '../shared/client.LF04eOvL.mjs';
|
|
6
6
|
|
|
7
7
|
const BATCH_HEADER = "orpc-batch";
|
|
@@ -548,7 +548,6 @@ class RequestCompressionLinkPlugin {
|
|
|
548
548
|
body: compressedStream,
|
|
549
549
|
headers: {
|
|
550
550
|
...request.headers,
|
|
551
|
-
"standard-server": "octet-stream",
|
|
552
551
|
"content-length": [],
|
|
553
552
|
"content-encoding": this.encoding
|
|
554
553
|
}
|
|
@@ -556,7 +555,8 @@ class RequestCompressionLinkPlugin {
|
|
|
556
555
|
});
|
|
557
556
|
}
|
|
558
557
|
} else if (request.body instanceof Blob) {
|
|
559
|
-
|
|
558
|
+
const contentType = request.headers["content-type"] ?? request.body.type;
|
|
559
|
+
if ((!Number.isFinite(request.body.size) || request.body.size >= this.threshold) && this.isCompressibleContentType(flattenStandardHeader(contentType), interceptorOptions)) {
|
|
560
560
|
const compressedStream = request.body.stream().pipeThrough(new CompressionStream(this.encoding));
|
|
561
561
|
const contentDisposition = request.headers["content-disposition"] ?? generateContentDisposition(
|
|
562
562
|
request.body instanceof File ? request.body.name : "blob"
|
|
@@ -568,8 +568,8 @@ class RequestCompressionLinkPlugin {
|
|
|
568
568
|
body: compressedStream,
|
|
569
569
|
headers: {
|
|
570
570
|
...request.headers,
|
|
571
|
-
"standard-server": "file",
|
|
572
|
-
"content-type":
|
|
571
|
+
"standard-server": request.headers["standard-server"] ?? "file",
|
|
572
|
+
"content-type": contentType,
|
|
573
573
|
"content-length": [],
|
|
574
574
|
"content-disposition": contentDisposition,
|
|
575
575
|
"content-encoding": this.encoding
|
|
@@ -618,15 +618,16 @@ class RequestCompressionLinkPlugin {
|
|
|
618
618
|
const string = request.body.toString();
|
|
619
619
|
if (string.length * AVG_BYTES_PER_CHAR >= this.threshold) {
|
|
620
620
|
const compressedStream = new Blob([string]).stream().pipeThrough(new CompressionStream(this.encoding));
|
|
621
|
+
const [, bodyHeaders] = toFetchBody(request.body, request.headers);
|
|
621
622
|
return next({
|
|
622
623
|
...interceptorOptions,
|
|
623
624
|
request: {
|
|
624
625
|
...interceptorOptions.request,
|
|
625
626
|
body: compressedStream,
|
|
626
627
|
headers: {
|
|
627
|
-
...
|
|
628
|
-
|
|
629
|
-
"
|
|
628
|
+
...bodyHeaders,
|
|
629
|
+
// An empty hint rather than none, so the adapter does not hint the compressed stream as `octet-stream`
|
|
630
|
+
"standard-server": bodyHeaders["standard-server"] ?? [],
|
|
630
631
|
"content-length": [],
|
|
631
632
|
"content-encoding": this.encoding
|
|
632
633
|
}
|
|
@@ -634,7 +635,7 @@ class RequestCompressionLinkPlugin {
|
|
|
634
635
|
});
|
|
635
636
|
}
|
|
636
637
|
} else if (request.body !== void 0 && !isAsyncIteratorObject(request.body)) {
|
|
637
|
-
const string =
|
|
638
|
+
const [string, bodyHeaders] = toFetchBody(request.body, request.headers);
|
|
638
639
|
if (string.length * AVG_BYTES_PER_CHAR >= this.threshold) {
|
|
639
640
|
const compressedStream = new Blob([string]).stream().pipeThrough(new CompressionStream(this.encoding));
|
|
640
641
|
return next({
|
|
@@ -643,9 +644,8 @@ class RequestCompressionLinkPlugin {
|
|
|
643
644
|
...interceptorOptions.request,
|
|
644
645
|
body: compressedStream,
|
|
645
646
|
headers: {
|
|
646
|
-
...
|
|
647
|
-
"standard-server": [],
|
|
648
|
-
"content-type": "application/json",
|
|
647
|
+
...bodyHeaders,
|
|
648
|
+
"standard-server": bodyHeaders["standard-server"] ?? [],
|
|
649
649
|
"content-length": [],
|
|
650
650
|
"content-encoding": this.encoding
|
|
651
651
|
}
|
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.47",
|
|
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.
|
|
67
|
-
"@standard-server/core": "~0.
|
|
68
|
-
"@standard-server/fetch": "~0.
|
|
69
|
-
"@standard-server/peer": "~0.
|
|
66
|
+
"@orpc/shared": "2.0.0-beta.47",
|
|
67
|
+
"@standard-server/core": "~0.13.0",
|
|
68
|
+
"@standard-server/fetch": "~0.13.0",
|
|
69
|
+
"@standard-server/peer": "~0.13.0"
|
|
70
70
|
},
|
|
71
71
|
"devDependencies": {
|
|
72
72
|
"@types/ws": "^8.18.2",
|