@orpc/standard-server-fetch 0.0.0-next.8f622a0 → 0.0.0-next.910f96e

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 CHANGED
@@ -53,6 +53,7 @@ You can find the full documentation [here](https://orpc.unnoq.com).
53
53
  - [@orpc/contract](https://www.npmjs.com/package/@orpc/contract): Build your API contract.
54
54
  - [@orpc/server](https://www.npmjs.com/package/@orpc/server): Build your API or implement API contract.
55
55
  - [@orpc/client](https://www.npmjs.com/package/@orpc/client): Consume your API on the client with type-safety.
56
+ - [@orpc/react](https://www.npmjs.com/package/@orpc/react): Utilities for integrating oRPC with React and React Server Actions.
56
57
  - [@orpc/react-query](https://www.npmjs.com/package/@orpc/react-query): Integration with [React Query](https://tanstack.com/query/latest/docs/framework/react/overview).
57
58
  - [@orpc/vue-query](https://www.npmjs.com/package/@orpc/vue-query): Integration with [Vue Query](https://tanstack.com/query/latest/docs/framework/vue/overview).
58
59
  - [@orpc/solid-query](https://www.npmjs.com/package/@orpc/solid-query): Integration with [Solid Query](https://tanstack.com/query/latest/docs/framework/solid/overview).
@@ -67,6 +68,14 @@ You can find the full documentation [here](https://orpc.unnoq.com).
67
68
 
68
69
  [Fetch API](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API) server adapter for oRPC.
69
70
 
71
+ ## Sponsors
72
+
73
+ <p align="center">
74
+ <a href="https://cdn.jsdelivr.net/gh/unnoq/unnoq/sponsors.svg">
75
+ <img src='https://cdn.jsdelivr.net/gh/unnoq/unnoq/sponsors.svg'/>
76
+ </a>
77
+ </p>
78
+
70
79
  ## License
71
80
 
72
81
  Distributed under the MIT License. See [LICENSE](https://github.com/unnoq/orpc/blob/main/LICENSE) for more information.
package/dist/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  import { stringifyJSON, parseEmptyableJSON, isTypescriptObject, isAsyncIteratorObject, once } from '@orpc/shared';
2
- import { EventDecoderStream, encodeEventMessage, getEventMeta, ErrorEvent, withEventMeta, parseContentDisposition, contentDisposition } from '@orpc/standard-server';
2
+ import { EventDecoderStream, encodeEventMessage, getEventMeta, ErrorEvent, withEventMeta, getFilenameFromContentDisposition, generateContentDisposition } from '@orpc/standard-server';
3
3
 
4
4
  function toEventIterator(stream) {
5
5
  const eventStream = stream.pipeThrough(new TextDecoderStream()).pipeThrough(new EventDecoderStream());
@@ -92,15 +92,13 @@ async function toStandardBody(re) {
92
92
  if (!re.body) {
93
93
  return void 0;
94
94
  }
95
- const contentDisposition2 = re.headers.get("content-disposition");
96
- if (contentDisposition2) {
97
- const fileName = parseContentDisposition(contentDisposition2).parameters.filename;
98
- if (typeof fileName === "string") {
99
- const blob2 = await re.blob();
100
- return new File([blob2], fileName, {
101
- type: blob2.type
102
- });
103
- }
95
+ const contentDisposition = re.headers.get("content-disposition");
96
+ if (typeof contentDisposition === "string") {
97
+ const fileName = getFilenameFromContentDisposition(contentDisposition) ?? "blob";
98
+ const blob2 = await re.blob();
99
+ return new File([blob2], fileName, {
100
+ type: blob2.type
101
+ });
104
102
  }
105
103
  const contentType = re.headers.get("content-type");
106
104
  if (!contentType || contentType.startsWith("application/json")) {
@@ -126,6 +124,7 @@ async function toStandardBody(re) {
126
124
  });
127
125
  }
128
126
  function toFetchBody(body, headers, options = {}) {
127
+ const currentContentDisposition = headers.get("content-disposition");
129
128
  headers.delete("content-type");
130
129
  headers.delete("content-disposition");
131
130
  if (body === void 0) {
@@ -136,7 +135,7 @@ function toFetchBody(body, headers, options = {}) {
136
135
  headers.set("content-length", body.size.toString());
137
136
  headers.set(
138
137
  "content-disposition",
139
- contentDisposition(body instanceof File ? body.name : "blob", { type: "inline" })
138
+ currentContentDisposition ?? generateContentDisposition(body instanceof File ? body.name : "blob")
140
139
  );
141
140
  return body;
142
141
  }
@@ -183,7 +182,6 @@ function toFetchHeaders(headers, fetchHeaders = new Headers()) {
183
182
 
184
183
  function toStandardLazyRequest(request) {
185
184
  return {
186
- raw: { request },
187
185
  url: new URL(request.url),
188
186
  signal: request.signal,
189
187
  method: request.method,
@@ -216,7 +214,6 @@ function toFetchResponse(response, options = {}) {
216
214
  }
217
215
  function toStandardLazyResponse(response) {
218
216
  return {
219
- raw: { response },
220
217
  body: once(() => toStandardBody(response)),
221
218
  status: response.status,
222
219
  get headers() {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@orpc/standard-server-fetch",
3
3
  "type": "module",
4
- "version": "0.0.0-next.8f622a0",
4
+ "version": "0.0.0-next.910f96e",
5
5
  "license": "MIT",
6
6
  "homepage": "https://unnoq.com",
7
7
  "repository": {
@@ -23,8 +23,8 @@
23
23
  "dist"
24
24
  ],
25
25
  "dependencies": {
26
- "@orpc/shared": "0.0.0-next.8f622a0",
27
- "@orpc/standard-server": "0.0.0-next.8f622a0"
26
+ "@orpc/standard-server": "0.0.0-next.910f96e",
27
+ "@orpc/shared": "0.0.0-next.910f96e"
28
28
  },
29
29
  "devDependencies": {
30
30
  "@hono/node-server": "^1.13.8"