@orpc/server 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 +15 -17
- package/package.json +10 -10
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,10 +1,10 @@
|
|
|
1
1
|
import { ORPCError } from '@orpc/client';
|
|
2
2
|
import { DEFAULT_BATCH_MAX_SIZE, BATCH_HEADER } from '@orpc/client/plugins';
|
|
3
3
|
export { BATCH_HEADER, DEFAULT_BATCH_MAX_SIZE } from '@orpc/client/plugins';
|
|
4
|
-
import { toArray, value, promiseWithResolvers, isAsyncIteratorObject, isCompressibleContentType, isNoTransformCacheControl, parseAcceptEncodingQualities, isAcceptableEncoding, varyByAcceptEncoding,
|
|
4
|
+
import { toArray, value, promiseWithResolvers, isAsyncIteratorObject, isCompressibleContentType, isNoTransformCacheControl, parseAcceptEncodingQualities, isAcceptableEncoding, varyByAcceptEncoding, anyAbortSignal, override, AsyncIteratorClass, runWithSignal, AbortError, wrapAsyncIterator, wrapReadableStream } from '@orpc/shared';
|
|
5
5
|
import { flattenStandardHeader, parseStandardUrl, generateContentDisposition, mergeStandardHeaders } from '@standard-server/core';
|
|
6
6
|
import { ServerPeer, isPeerMessage, isClientPeerSendMessage, encodePeerMessage } from '@standard-server/peer';
|
|
7
|
-
import { toFetchHeaders, toStandardBody, toStandardHeaders } from '@standard-server/fetch';
|
|
7
|
+
import { toFetchHeaders, toStandardBody, toFetchBody, toStandardHeaders } from '@standard-server/fetch';
|
|
8
8
|
export { R as RequestLimitHandlerPlugin } from '../shared/server.1ExWFMze.mjs';
|
|
9
9
|
|
|
10
10
|
const BATCH_CONTENT_TYPE = "application/vnd.orpc.batch";
|
|
@@ -248,6 +248,7 @@ class BatchHandlerPlugin {
|
|
|
248
248
|
};
|
|
249
249
|
const subrequests = runSubrequests();
|
|
250
250
|
const { batchHeaders, streams } = await lifting;
|
|
251
|
+
const framedHeaders = { ...batchHeaders, "content-type": batchHeaders["content-type"] ?? BATCH_CONTENT_TYPE };
|
|
251
252
|
if (!streams) {
|
|
252
253
|
await subrequests;
|
|
253
254
|
await peer.close();
|
|
@@ -257,8 +258,8 @@ class BatchHandlerPlugin {
|
|
|
257
258
|
matched: true,
|
|
258
259
|
response: {
|
|
259
260
|
status,
|
|
260
|
-
headers:
|
|
261
|
-
body: new Blob(chunks
|
|
261
|
+
headers: framedHeaders,
|
|
262
|
+
body: new Blob(chunks)
|
|
262
263
|
}
|
|
263
264
|
};
|
|
264
265
|
}
|
|
@@ -291,7 +292,7 @@ class BatchHandlerPlugin {
|
|
|
291
292
|
matched: true,
|
|
292
293
|
response: {
|
|
293
294
|
status,
|
|
294
|
-
headers:
|
|
295
|
+
headers: framedHeaders,
|
|
295
296
|
body
|
|
296
297
|
}
|
|
297
298
|
};
|
|
@@ -606,10 +607,7 @@ class ResponseCompressionHandlerPlugin {
|
|
|
606
607
|
response: {
|
|
607
608
|
...response,
|
|
608
609
|
body: body.pipeThrough(new CompressionStream(encoding)),
|
|
609
|
-
headers:
|
|
610
|
-
...toCompressedHeaders(headers, encoding),
|
|
611
|
-
"standard-server": "octet-stream"
|
|
612
|
-
}
|
|
610
|
+
headers: toCompressedHeaders(headers, encoding)
|
|
613
611
|
}
|
|
614
612
|
};
|
|
615
613
|
}
|
|
@@ -626,7 +624,7 @@ class ResponseCompressionHandlerPlugin {
|
|
|
626
624
|
body: body.stream().pipeThrough(new CompressionStream(encoding)),
|
|
627
625
|
headers: {
|
|
628
626
|
...toCompressedHeaders(headers, encoding),
|
|
629
|
-
"standard-server": "file",
|
|
627
|
+
"standard-server": headers["standard-server"] ?? "file",
|
|
630
628
|
"content-type": contentType,
|
|
631
629
|
"content-disposition": contentDisposition
|
|
632
630
|
}
|
|
@@ -671,21 +669,22 @@ class ResponseCompressionHandlerPlugin {
|
|
|
671
669
|
} else if (body instanceof URLSearchParams) {
|
|
672
670
|
const string = body.toString();
|
|
673
671
|
if (string.length * AVG_BYTES_PER_CHAR >= this.threshold) {
|
|
672
|
+
const [, bodyHeaders] = toFetchBody(body, headers);
|
|
674
673
|
return {
|
|
675
674
|
...result,
|
|
676
675
|
response: {
|
|
677
676
|
...response,
|
|
678
677
|
body: new Blob([string]).stream().pipeThrough(new CompressionStream(encoding)),
|
|
679
678
|
headers: {
|
|
680
|
-
...toCompressedHeaders(
|
|
681
|
-
|
|
682
|
-
"
|
|
679
|
+
...toCompressedHeaders(bodyHeaders, encoding),
|
|
680
|
+
// An empty hint rather than none, so the adapter does not hint the compressed stream as `octet-stream`
|
|
681
|
+
"standard-server": bodyHeaders["standard-server"] ?? []
|
|
683
682
|
}
|
|
684
683
|
}
|
|
685
684
|
};
|
|
686
685
|
}
|
|
687
686
|
} else if (body !== void 0 && !isAsyncIteratorObject(body)) {
|
|
688
|
-
const string =
|
|
687
|
+
const [string, bodyHeaders] = toFetchBody(body, headers);
|
|
689
688
|
if (string.length * AVG_BYTES_PER_CHAR >= this.threshold) {
|
|
690
689
|
return {
|
|
691
690
|
...result,
|
|
@@ -693,9 +692,8 @@ class ResponseCompressionHandlerPlugin {
|
|
|
693
692
|
...response,
|
|
694
693
|
body: new Blob([string]).stream().pipeThrough(new CompressionStream(encoding)),
|
|
695
694
|
headers: {
|
|
696
|
-
...toCompressedHeaders(
|
|
697
|
-
"standard-server": []
|
|
698
|
-
"content-type": "application/json"
|
|
695
|
+
...toCompressedHeaders(bodyHeaders, encoding),
|
|
696
|
+
"standard-server": bodyHeaders["standard-server"] ?? []
|
|
699
697
|
}
|
|
700
698
|
}
|
|
701
699
|
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@orpc/server",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "2.0.0-beta.
|
|
4
|
+
"version": "2.0.0-beta.47",
|
|
5
5
|
"description": "Build typesafe APIs with oRPC: RPC and OpenAPI support, middleware, and adapters for Node.js, Bun, Deno, Fetch, Fastify, WebSocket, AWS Lambda, and more",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"funding": [
|
|
@@ -117,15 +117,15 @@
|
|
|
117
117
|
}
|
|
118
118
|
},
|
|
119
119
|
"dependencies": {
|
|
120
|
-
"@orpc/client": "2.0.0-beta.
|
|
121
|
-
"@orpc/contract": "2.0.0-beta.
|
|
122
|
-
"@orpc/shared": "2.0.0-beta.
|
|
123
|
-
"@standard-server/aws-lambda": "~0.
|
|
124
|
-
"@standard-server/core": "~0.
|
|
125
|
-
"@standard-server/fastify": "~0.
|
|
126
|
-
"@standard-server/fetch": "~0.
|
|
127
|
-
"@standard-server/node": "~0.
|
|
128
|
-
"@standard-server/peer": "~0.
|
|
120
|
+
"@orpc/client": "2.0.0-beta.47",
|
|
121
|
+
"@orpc/contract": "2.0.0-beta.47",
|
|
122
|
+
"@orpc/shared": "2.0.0-beta.47",
|
|
123
|
+
"@standard-server/aws-lambda": "~0.13.0",
|
|
124
|
+
"@standard-server/core": "~0.13.0",
|
|
125
|
+
"@standard-server/fastify": "~0.13.0",
|
|
126
|
+
"@standard-server/fetch": "~0.13.0",
|
|
127
|
+
"@standard-server/node": "~0.13.0",
|
|
128
|
+
"@standard-server/peer": "~0.13.0",
|
|
129
129
|
"cookie": "^2.0.1"
|
|
130
130
|
},
|
|
131
131
|
"devDependencies": {
|