@orpc/standard-server-fetch 0.0.0-next.ff68fdb → 0.0.0-next.ff7ad2e

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
@@ -21,28 +21,24 @@
21
21
 
22
22
  <h3 align="center">Typesafe APIs Made Simple 🪄</h3>
23
23
 
24
- **oRPC is a powerful combination of RPC and OpenAPI**, makes it easy to build APIs that are end-to-end type-safe and adhere to OpenAPI standards, ensuring a smooth and enjoyable developer experience.
24
+ **oRPC is a powerful combination of RPC and OpenAPI**, makes it easy to build APIs that are end-to-end type-safe and adhere to OpenAPI standards
25
25
 
26
26
  ---
27
27
 
28
28
  ## Highlights
29
29
 
30
- - **End-to-End Type Safety 🔒**: Ensure complete type safety from inputs to outputs and errors, bridging server and client seamlessly.
31
- - **First-Class OpenAPI 📄**: Adheres to the OpenAPI standard out of the box, ensuring seamless integration and comprehensive API documentation.
32
- - **Contract-First Development 📜**: (Optional) Define your API contract upfront and implement it with confidence.
33
- - **Exceptional Developer Experience ✨**: Enjoy a streamlined workflow with robust typing and clear, in-code documentation.
34
- - **Multi-Runtime Support 🌍**: Run your code seamlessly on Cloudflare, Deno, Bun, Node.js, and more.
35
- - **Framework Integrations 🧩**: Supports Tanstack Query (React, Vue, Solid, Svelte), Pinia Colada, and more.
36
- - **Server Actions ⚡️**: Fully compatible with React Server Actions on Next.js, TanStack Start, and more.
37
- - **Standard Schema Support 🗂️**: Effortlessly work with Zod, Valibot, ArkType, and others right out of the box.
38
- - **Fast & Lightweight 💨**: Built on native APIs across all runtimes – optimized for speed and efficiency.
39
- - **Native Types 📦**: Enjoy built-in support for Date, File, Blob, BigInt, URL and more with no extra setup.
40
- - **Lazy Router ⏱️**: Improve cold start times with our lazy routing feature.
41
- - **SSE & Streaming 📡**: Provides SSE and streaming features – perfect for real-time notifications and AI-powered streaming responses.
42
- - **Reusability 🔄**: Write once and reuse your code across multiple purposes effortlessly.
43
- - **Extendability 🔌**: Easily enhance oRPC with plugins, middleware, and interceptors.
44
- - **Reliability 🛡️**: Well-tested, fully TypeScript, production-ready, and MIT licensed for peace of mind.
45
- - **Simplicity 💡**: Enjoy straightforward, clean code with no hidden magic.
30
+ - **🔗 End-to-End Type Safety**: Ensure type-safe inputs, outputs, and errors from client to server.
31
+ - **📘 First-Class OpenAPI**: Built-in support that fully adheres to the OpenAPI standard.
32
+ - **📝 Contract-First Development**: Optionally define your API contract before implementation.
33
+ - **🔍 First-Class OpenTelemetry**: Seamlessly integrate with OpenTelemetry for observability.
34
+ - **⚙️ Framework Integrations**: Seamlessly integrate with TanStack Query (React, Vue, Solid, Svelte, Angular), SWR, Pinia Colada, and more.
35
+ - **🚀 Server Actions**: Fully compatible with React Server Actions on Next.js, TanStack Start, and other platforms.
36
+ - **🔠 Standard Schema Support**: Works out of the box with Zod, Valibot, ArkType, and other schema validators.
37
+ - **🗃️ Native Types**: Supports native types like Date, File, Blob, BigInt, URL, and more.
38
+ - **⏱️ Lazy Router**: Enhance cold start times with our lazy routing feature.
39
+ - **📡 SSE & Streaming**: Enjoy full type-safe support for SSE and streaming.
40
+ - **🌍 Multi-Runtime Support**: Fast and lightweight on Cloudflare, Deno, Bun, Node.js, and beyond.
41
+ - **🔌 Extendability**: Easily extend functionality with plugins, middleware, and interceptors.
46
42
 
47
43
  ## Documentation
48
44
 
@@ -53,18 +49,30 @@ You can find the full documentation [here](https://orpc.unnoq.com).
53
49
  - [@orpc/contract](https://www.npmjs.com/package/@orpc/contract): Build your API contract.
54
50
  - [@orpc/server](https://www.npmjs.com/package/@orpc/server): Build your API or implement API contract.
55
51
  - [@orpc/client](https://www.npmjs.com/package/@orpc/client): Consume your API on the client with type-safety.
56
- - [@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
- - [@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
- - [@orpc/solid-query](https://www.npmjs.com/package/@orpc/solid-query): Integration with [Solid Query](https://tanstack.com/query/latest/docs/framework/solid/overview).
59
- - [@orpc/svelte-query](https://www.npmjs.com/package/@orpc/svelte-query): Integration with [Svelte Query](https://tanstack.com/query/latest/docs/framework/svelte/overview).
60
- - [@orpc/vue-colada](https://www.npmjs.com/package/@orpc/vue-colada): Integration with [Pinia Colada](https://pinia-colada.esm.dev/).
61
52
  - [@orpc/openapi](https://www.npmjs.com/package/@orpc/openapi): Generate OpenAPI specs and handle OpenAPI requests.
53
+ - [@orpc/otel](https://www.npmjs.com/package/@orpc/otel): [OpenTelemetry](https://opentelemetry.io/) integration for observability.
54
+ - [@orpc/nest](https://www.npmjs.com/package/@orpc/nest): Deeply integrate oRPC with [NestJS](https://nestjs.com/).
55
+ - [@orpc/react](https://www.npmjs.com/package/@orpc/react): Utilities for integrating oRPC with React and React Server Actions.
56
+ - [@orpc/tanstack-query](https://www.npmjs.com/package/@orpc/tanstack-query): [TanStack Query](https://tanstack.com/query/latest) integration.
57
+ - [@orpc/experimental-react-swr](https://www.npmjs.com/package/@orpc/experimental-react-swr): [SWR](https://swr.vercel.app/) integration.
58
+ - [@orpc/vue-colada](https://www.npmjs.com/package/@orpc/vue-colada): Integration with [Pinia Colada](https://pinia-colada.esm.dev/).
59
+ - [@orpc/hey-api](https://www.npmjs.com/package/@orpc/hey-api): [Hey API](https://heyapi.dev/) integration.
62
60
  - [@orpc/zod](https://www.npmjs.com/package/@orpc/zod): More schemas that [Zod](https://zod.dev/) doesn't support yet.
61
+ - [@orpc/valibot](https://www.npmjs.com/package/@orpc/valibot): OpenAPI spec generation from [Valibot](https://valibot.dev/).
62
+ - [@orpc/arktype](https://www.npmjs.com/package/@orpc/arktype): OpenAPI spec generation from [ArkType](https://arktype.io/).
63
63
 
64
64
  ## `@orpc/standard-server-fetch`
65
65
 
66
66
  [Fetch API](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API) server adapter for oRPC.
67
67
 
68
+ ## Sponsors
69
+
70
+ <p align="center">
71
+ <a href="https://cdn.jsdelivr.net/gh/unnoq/unnoq/sponsors.svg">
72
+ <img src='https://cdn.jsdelivr.net/gh/unnoq/unnoq/sponsors.svg'/>
73
+ </a>
74
+ </p>
75
+
68
76
  ## License
69
77
 
70
78
  Distributed under the MIT License. See [LICENSE](https://github.com/unnoq/orpc/blob/main/LICENSE) for more information.
package/dist/index.d.mts CHANGED
@@ -1,6 +1,9 @@
1
1
  import { StandardBody, StandardHeaders, StandardLazyRequest, StandardRequest, StandardResponse, StandardLazyResponse } from '@orpc/standard-server';
2
+ import { SetSpanErrorOptions, AsyncIteratorClass } from '@orpc/shared';
2
3
 
3
- declare function toEventIterator(stream: ReadableStream<Uint8Array>): AsyncGenerator<unknown | void, unknown | void, void>;
4
+ interface ToEventIteratorOptions extends SetSpanErrorOptions {
5
+ }
6
+ declare function toEventIterator(stream: ReadableStream<Uint8Array> | null, options?: ToEventIteratorOptions): AsyncIteratorClass<unknown>;
4
7
  interface ToEventStreamOptions {
5
8
  /**
6
9
  * If true, a ping comment is sent periodically to keep the connection alive.
@@ -23,7 +26,9 @@ interface ToEventStreamOptions {
23
26
  }
24
27
  declare function toEventStream(iterator: AsyncIterator<unknown | void, unknown | void, void>, options?: ToEventStreamOptions): ReadableStream<Uint8Array>;
25
28
 
26
- declare function toStandardBody(re: Request | Response): Promise<StandardBody>;
29
+ interface ToStandardBodyOptions extends ToEventIteratorOptions {
30
+ }
31
+ declare function toStandardBody(re: Request | Response, options?: ToStandardBodyOptions): Promise<StandardBody>;
27
32
  interface ToFetchBodyOptions extends ToEventStreamOptions {
28
33
  }
29
34
  /**
@@ -51,6 +56,9 @@ declare function toFetchRequest(request: StandardRequest, options?: ToFetchReque
51
56
  interface ToFetchResponseOptions extends ToFetchBodyOptions {
52
57
  }
53
58
  declare function toFetchResponse(response: StandardResponse, options?: ToFetchResponseOptions): Response;
54
- declare function toStandardLazyResponse(response: Response): StandardLazyResponse;
59
+ interface ToStandardLazyResponseOptions extends ToStandardBodyOptions {
60
+ }
61
+ declare function toStandardLazyResponse(response: Response, options?: ToStandardLazyResponseOptions): StandardLazyResponse;
55
62
 
56
- export { type ToEventStreamOptions, type ToFetchBodyOptions, type ToFetchRequestOptions, type ToFetchResponseOptions, toEventIterator, toEventStream, toFetchBody, toFetchHeaders, toFetchRequest, toFetchResponse, toStandardBody, toStandardHeaders, toStandardLazyRequest, toStandardLazyResponse };
63
+ export { toEventIterator, toEventStream, toFetchBody, toFetchHeaders, toFetchRequest, toFetchResponse, toStandardBody, toStandardHeaders, toStandardLazyRequest, toStandardLazyResponse };
64
+ export type { ToEventIteratorOptions, ToEventStreamOptions, ToFetchBodyOptions, ToFetchRequestOptions, ToFetchResponseOptions, ToStandardBodyOptions, ToStandardLazyResponseOptions };
package/dist/index.d.ts CHANGED
@@ -1,6 +1,9 @@
1
1
  import { StandardBody, StandardHeaders, StandardLazyRequest, StandardRequest, StandardResponse, StandardLazyResponse } from '@orpc/standard-server';
2
+ import { SetSpanErrorOptions, AsyncIteratorClass } from '@orpc/shared';
2
3
 
3
- declare function toEventIterator(stream: ReadableStream<Uint8Array>): AsyncGenerator<unknown | void, unknown | void, void>;
4
+ interface ToEventIteratorOptions extends SetSpanErrorOptions {
5
+ }
6
+ declare function toEventIterator(stream: ReadableStream<Uint8Array> | null, options?: ToEventIteratorOptions): AsyncIteratorClass<unknown>;
4
7
  interface ToEventStreamOptions {
5
8
  /**
6
9
  * If true, a ping comment is sent periodically to keep the connection alive.
@@ -23,7 +26,9 @@ interface ToEventStreamOptions {
23
26
  }
24
27
  declare function toEventStream(iterator: AsyncIterator<unknown | void, unknown | void, void>, options?: ToEventStreamOptions): ReadableStream<Uint8Array>;
25
28
 
26
- declare function toStandardBody(re: Request | Response): Promise<StandardBody>;
29
+ interface ToStandardBodyOptions extends ToEventIteratorOptions {
30
+ }
31
+ declare function toStandardBody(re: Request | Response, options?: ToStandardBodyOptions): Promise<StandardBody>;
27
32
  interface ToFetchBodyOptions extends ToEventStreamOptions {
28
33
  }
29
34
  /**
@@ -51,6 +56,9 @@ declare function toFetchRequest(request: StandardRequest, options?: ToFetchReque
51
56
  interface ToFetchResponseOptions extends ToFetchBodyOptions {
52
57
  }
53
58
  declare function toFetchResponse(response: StandardResponse, options?: ToFetchResponseOptions): Response;
54
- declare function toStandardLazyResponse(response: Response): StandardLazyResponse;
59
+ interface ToStandardLazyResponseOptions extends ToStandardBodyOptions {
60
+ }
61
+ declare function toStandardLazyResponse(response: Response, options?: ToStandardLazyResponseOptions): StandardLazyResponse;
55
62
 
56
- export { type ToEventStreamOptions, type ToFetchBodyOptions, type ToFetchRequestOptions, type ToFetchResponseOptions, toEventIterator, toEventStream, toFetchBody, toFetchHeaders, toFetchRequest, toFetchResponse, toStandardBody, toStandardHeaders, toStandardLazyRequest, toStandardLazyResponse };
63
+ export { toEventIterator, toEventStream, toFetchBody, toFetchHeaders, toFetchRequest, toFetchResponse, toStandardBody, toStandardHeaders, toStandardLazyRequest, toStandardLazyResponse };
64
+ export type { ToEventIteratorOptions, ToEventStreamOptions, ToFetchBodyOptions, ToFetchRequestOptions, ToFetchResponseOptions, ToStandardBodyOptions, ToStandardLazyResponseOptions };
package/dist/index.mjs CHANGED
@@ -1,15 +1,20 @@
1
- import { stringifyJSON, parseEmptyableJSON, isTypescriptObject, isAsyncIteratorObject, once } from '@orpc/shared';
2
- import { EventDecoderStream, encodeEventMessage, getEventMeta, ErrorEvent, withEventMeta, parseContentDisposition, contentDisposition } from '@orpc/standard-server';
1
+ import { AsyncIteratorClass, startSpan, runInSpanContext, parseEmptyableJSON, isTypescriptObject, setSpanError, stringifyJSON, runWithSpan, isAsyncIteratorObject, once } from '@orpc/shared';
2
+ import { EventDecoderStream, withEventMeta, ErrorEvent, encodeEventMessage, getEventMeta, getFilenameFromContentDisposition, generateContentDisposition } from '@orpc/standard-server';
3
3
 
4
- function toEventIterator(stream) {
5
- const eventStream = stream.pipeThrough(new TextDecoderStream()).pipeThrough(new EventDecoderStream());
6
- const reader = eventStream.getReader();
7
- async function* gen() {
4
+ function toEventIterator(stream, options = {}) {
5
+ const eventStream = stream?.pipeThrough(new TextDecoderStream()).pipeThrough(new EventDecoderStream());
6
+ const reader = eventStream?.getReader();
7
+ let span;
8
+ return new AsyncIteratorClass(async () => {
9
+ span ??= startSpan("consume_event_iterator_stream");
8
10
  try {
9
11
  while (true) {
10
- const { done, value } = await reader.read();
12
+ if (reader === void 0) {
13
+ return { done: true, value: void 0 };
14
+ }
15
+ const { done, value } = await runInSpanContext(span, () => reader.read());
11
16
  if (done) {
12
- return;
17
+ return { done: true, value: void 0 };
13
18
  }
14
19
  switch (value.event) {
15
20
  case "message": {
@@ -17,14 +22,15 @@ function toEventIterator(stream) {
17
22
  if (isTypescriptObject(message)) {
18
23
  message = withEventMeta(message, value);
19
24
  }
20
- yield message;
21
- break;
25
+ span?.addEvent("message");
26
+ return { done: false, value: message };
22
27
  }
23
28
  case "error": {
24
29
  let error = new ErrorEvent({
25
30
  data: parseEmptyableJSON(value.data)
26
31
  });
27
32
  error = withEventMeta(error, value);
33
+ span?.addEvent("error");
28
34
  throw error;
29
35
  }
30
36
  case "done": {
@@ -32,22 +38,45 @@ function toEventIterator(stream) {
32
38
  if (isTypescriptObject(done2)) {
33
39
  done2 = withEventMeta(done2, value);
34
40
  }
35
- return done2;
41
+ span?.addEvent("done");
42
+ return { done: true, value: done2 };
43
+ }
44
+ default: {
45
+ span?.addEvent("maybe_keepalive");
36
46
  }
37
47
  }
38
48
  }
49
+ } catch (e) {
50
+ if (!(e instanceof ErrorEvent)) {
51
+ setSpanError(span, e, options);
52
+ }
53
+ throw e;
54
+ }
55
+ }, async (reason) => {
56
+ try {
57
+ if (reason !== "next") {
58
+ span?.addEvent("cancelled");
59
+ }
60
+ await runInSpanContext(span, () => reader?.cancel());
61
+ } catch (e) {
62
+ setSpanError(span, e, options);
63
+ throw e;
39
64
  } finally {
40
- await reader.cancel();
65
+ span?.end();
41
66
  }
42
- }
43
- return gen();
67
+ });
44
68
  }
45
69
  function toEventStream(iterator, options = {}) {
46
70
  const keepAliveEnabled = options.eventIteratorKeepAliveEnabled ?? true;
47
71
  const keepAliveInterval = options.eventIteratorKeepAliveInterval ?? 5e3;
48
72
  const keepAliveComment = options.eventIteratorKeepAliveComment ?? "";
73
+ let cancelled = false;
49
74
  let timeout;
75
+ let span;
50
76
  const stream = new ReadableStream({
77
+ start() {
78
+ span = startSpan("stream_event_iterator");
79
+ },
51
80
  async pull(controller) {
52
81
  try {
53
82
  if (keepAliveEnabled) {
@@ -55,77 +84,104 @@ function toEventStream(iterator, options = {}) {
55
84
  controller.enqueue(encodeEventMessage({
56
85
  comments: [keepAliveComment]
57
86
  }));
87
+ span?.addEvent("keepalive");
58
88
  }, keepAliveInterval);
59
89
  }
60
- const value = await iterator.next();
90
+ const value = await runInSpanContext(span, () => iterator.next());
61
91
  clearInterval(timeout);
62
- controller.enqueue(encodeEventMessage({
63
- ...getEventMeta(value.value),
64
- event: value.done ? "done" : "message",
65
- data: stringifyJSON(value.value)
66
- }));
92
+ if (cancelled) {
93
+ return;
94
+ }
95
+ const meta = getEventMeta(value.value);
96
+ if (!value.done || value.value !== void 0 || meta !== void 0) {
97
+ const event = value.done ? "done" : "message";
98
+ controller.enqueue(encodeEventMessage({
99
+ ...meta,
100
+ event,
101
+ data: stringifyJSON(value.value)
102
+ }));
103
+ span?.addEvent(event);
104
+ }
67
105
  if (value.done) {
68
106
  controller.close();
107
+ span?.end();
69
108
  }
70
109
  } catch (err) {
71
110
  clearInterval(timeout);
72
- controller.enqueue(encodeEventMessage({
73
- ...getEventMeta(err),
74
- event: "error",
75
- data: err instanceof ErrorEvent ? stringifyJSON(err.data) : void 0
76
- }));
77
- controller.close();
111
+ if (cancelled) {
112
+ return;
113
+ }
114
+ if (err instanceof ErrorEvent) {
115
+ controller.enqueue(encodeEventMessage({
116
+ ...getEventMeta(err),
117
+ event: "error",
118
+ data: stringifyJSON(err.data)
119
+ }));
120
+ span?.addEvent("error");
121
+ controller.close();
122
+ } else {
123
+ setSpanError(span, err);
124
+ controller.error(err);
125
+ }
126
+ span?.end();
78
127
  }
79
128
  },
80
- async cancel(reason) {
81
- if (reason) {
82
- await iterator.throw?.(reason);
83
- } else {
84
- await iterator.return?.();
129
+ async cancel() {
130
+ try {
131
+ cancelled = true;
132
+ clearInterval(timeout);
133
+ span?.addEvent("cancelled");
134
+ await runInSpanContext(span, () => iterator.return?.());
135
+ } catch (e) {
136
+ setSpanError(span, e);
137
+ throw e;
138
+ } finally {
139
+ span?.end();
85
140
  }
86
141
  }
87
142
  }).pipeThrough(new TextEncoderStream());
88
143
  return stream;
89
144
  }
90
145
 
91
- async function toStandardBody(re) {
92
- if (!re.body) {
93
- return void 0;
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
146
+ function toStandardBody(re, options = {}) {
147
+ return runWithSpan(
148
+ { name: "parse_standard_body", signal: options.signal },
149
+ async () => {
150
+ const contentDisposition = re.headers.get("content-disposition");
151
+ if (typeof contentDisposition === "string") {
152
+ const fileName = getFilenameFromContentDisposition(contentDisposition) ?? "blob";
153
+ const blob2 = await re.blob();
154
+ return new File([blob2], fileName, {
155
+ type: blob2.type
156
+ });
157
+ }
158
+ const contentType = re.headers.get("content-type");
159
+ if (!contentType || contentType.startsWith("application/json")) {
160
+ const text = await re.text();
161
+ return parseEmptyableJSON(text);
162
+ }
163
+ if (contentType.startsWith("multipart/form-data")) {
164
+ return await re.formData();
165
+ }
166
+ if (contentType.startsWith("application/x-www-form-urlencoded")) {
167
+ const text = await re.text();
168
+ return new URLSearchParams(text);
169
+ }
170
+ if (contentType.startsWith("text/event-stream")) {
171
+ return toEventIterator(re.body, options);
172
+ }
173
+ if (contentType.startsWith("text/plain")) {
174
+ return await re.text();
175
+ }
176
+ const blob = await re.blob();
177
+ return new File([blob], "blob", {
178
+ type: blob.type
102
179
  });
103
180
  }
104
- }
105
- const contentType = re.headers.get("content-type");
106
- if (!contentType || contentType.startsWith("application/json")) {
107
- const text = await re.text();
108
- return parseEmptyableJSON(text);
109
- }
110
- if (contentType.startsWith("multipart/form-data")) {
111
- return await re.formData();
112
- }
113
- if (contentType.startsWith("application/x-www-form-urlencoded")) {
114
- const text = await re.text();
115
- return new URLSearchParams(text);
116
- }
117
- if (contentType.startsWith("text/event-stream")) {
118
- return toEventIterator(re.body);
119
- }
120
- if (contentType.startsWith("text/plain")) {
121
- return await re.text();
122
- }
123
- const blob = await re.blob();
124
- return new File([blob], "blob", {
125
- type: blob.type
126
- });
181
+ );
127
182
  }
128
183
  function toFetchBody(body, headers, options = {}) {
184
+ const currentContentDisposition = headers.get("content-disposition");
129
185
  headers.delete("content-type");
130
186
  headers.delete("content-disposition");
131
187
  if (body === void 0) {
@@ -136,7 +192,7 @@ function toFetchBody(body, headers, options = {}) {
136
192
  headers.set("content-length", body.size.toString());
137
193
  headers.set(
138
194
  "content-disposition",
139
- contentDisposition(body instanceof File ? body.name : "blob", { type: "inline" })
195
+ currentContentDisposition ?? generateContentDisposition(body instanceof File ? body.name : "blob")
140
196
  );
141
197
  return body;
142
198
  }
@@ -148,8 +204,6 @@ function toFetchBody(body, headers, options = {}) {
148
204
  }
149
205
  if (isAsyncIteratorObject(body)) {
150
206
  headers.set("content-type", "text/event-stream");
151
- headers.set("cache-control", "no-cache");
152
- headers.set("connection", "keep-alive");
153
207
  return toEventStream(body, options);
154
208
  }
155
209
  headers.set("content-type", "application/json");
@@ -183,11 +237,10 @@ function toFetchHeaders(headers, fetchHeaders = new Headers()) {
183
237
 
184
238
  function toStandardLazyRequest(request) {
185
239
  return {
186
- raw: { request },
187
240
  url: new URL(request.url),
188
241
  signal: request.signal,
189
242
  method: request.method,
190
- body: once(() => toStandardBody(request)),
243
+ body: once(() => toStandardBody(request, { signal: request.signal })),
191
244
  get headers() {
192
245
  const headers = toStandardHeaders(request.headers);
193
246
  Object.defineProperty(this, "headers", { value: headers, writable: true });
@@ -214,10 +267,9 @@ function toFetchResponse(response, options = {}) {
214
267
  const body = toFetchBody(response.body, headers, options);
215
268
  return new Response(body, { headers, status: response.status });
216
269
  }
217
- function toStandardLazyResponse(response) {
270
+ function toStandardLazyResponse(response, options = {}) {
218
271
  return {
219
- raw: { response },
220
- body: once(() => toStandardBody(response)),
272
+ body: once(() => toStandardBody(response, options)),
221
273
  status: response.status,
222
274
  get headers() {
223
275
  const headers = toStandardHeaders(response.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.ff68fdb",
4
+ "version": "0.0.0-next.ff7ad2e",
5
5
  "license": "MIT",
6
6
  "homepage": "https://unnoq.com",
7
7
  "repository": {
@@ -23,11 +23,11 @@
23
23
  "dist"
24
24
  ],
25
25
  "dependencies": {
26
- "@orpc/shared": "0.0.0-next.ff68fdb",
27
- "@orpc/standard-server": "0.0.0-next.ff68fdb"
26
+ "@orpc/standard-server": "0.0.0-next.ff7ad2e",
27
+ "@orpc/shared": "0.0.0-next.ff7ad2e"
28
28
  },
29
29
  "devDependencies": {
30
- "@hono/node-server": "^1.13.8"
30
+ "@hono/node-server": "^1.18.2"
31
31
  },
32
32
  "scripts": {
33
33
  "build": "unbuild",