@orpc/standard-server-fetch 0.0.0-next.0021fba

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2023 oRPC
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,77 @@
1
+ <div align="center">
2
+ <image align="center" src="https://orpc.unnoq.com/logo.webp" width=280 alt="oRPC logo" />
3
+ </div>
4
+
5
+ <h1></h1>
6
+
7
+ <div align="center">
8
+ <a href="https://codecov.io/gh/unnoq/orpc">
9
+ <img alt="codecov" src="https://codecov.io/gh/unnoq/orpc/branch/main/graph/badge.svg">
10
+ </a>
11
+ <a href="https://www.npmjs.com/package/@orpc/standard-server-fetch">
12
+ <img alt="weekly downloads" src="https://img.shields.io/npm/dw/%40orpc%2Fstandard-server-fetch?logo=npm" />
13
+ </a>
14
+ <a href="https://github.com/unnoq/orpc/blob/main/LICENSE">
15
+ <img alt="MIT License" src="https://img.shields.io/github/license/unnoq/orpc?logo=open-source-initiative" />
16
+ </a>
17
+ <a href="https://discord.gg/TXEbwRBvQn">
18
+ <img alt="Discord" src="https://img.shields.io/discord/1308966753044398161?color=7389D8&label&logo=discord&logoColor=ffffff" />
19
+ </a>
20
+ </div>
21
+
22
+ <h3 align="center">Typesafe APIs Made Simple 🪄</h3>
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
25
+
26
+ ---
27
+
28
+ ## Highlights
29
+
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), 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.
42
+
43
+ ## Documentation
44
+
45
+ You can find the full documentation [here](https://orpc.unnoq.com).
46
+
47
+ ## Packages
48
+
49
+ - [@orpc/contract](https://www.npmjs.com/package/@orpc/contract): Build your API contract.
50
+ - [@orpc/server](https://www.npmjs.com/package/@orpc/server): Build your API or implement API contract.
51
+ - [@orpc/client](https://www.npmjs.com/package/@orpc/client): Consume your API on the client with type-safety.
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/vue-colada](https://www.npmjs.com/package/@orpc/vue-colada): Integration with [Pinia Colada](https://pinia-colada.esm.dev/).
58
+ - [@orpc/hey-api](https://www.npmjs.com/package/@orpc/hey-api): [Hey API](https://heyapi.dev/) integration.
59
+ - [@orpc/zod](https://www.npmjs.com/package/@orpc/zod): More schemas that [Zod](https://zod.dev/) doesn't support yet.
60
+ - [@orpc/valibot](https://www.npmjs.com/package/@orpc/valibot): OpenAPI spec generation from [Valibot](https://valibot.dev/).
61
+ - [@orpc/arktype](https://www.npmjs.com/package/@orpc/arktype): OpenAPI spec generation from [ArkType](https://arktype.io/).
62
+
63
+ ## `@orpc/standard-server-fetch`
64
+
65
+ [Fetch API](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API) server adapter for oRPC.
66
+
67
+ ## Sponsors
68
+
69
+ <p align="center">
70
+ <a href="https://cdn.jsdelivr.net/gh/unnoq/unnoq/sponsors.svg">
71
+ <img src='https://cdn.jsdelivr.net/gh/unnoq/unnoq/sponsors.svg'/>
72
+ </a>
73
+ </p>
74
+
75
+ ## License
76
+
77
+ Distributed under the MIT License. See [LICENSE](https://github.com/unnoq/orpc/blob/main/LICENSE) for more information.
@@ -0,0 +1,64 @@
1
+ import { StandardBody, StandardHeaders, StandardLazyRequest, StandardRequest, StandardResponse, StandardLazyResponse } from '@orpc/standard-server';
2
+ import { SetSpanErrorOptions, AsyncIteratorClass } from '@orpc/shared';
3
+
4
+ interface ToEventIteratorOptions extends SetSpanErrorOptions {
5
+ }
6
+ declare function toEventIterator(stream: ReadableStream<Uint8Array> | null, options?: ToEventIteratorOptions): AsyncIteratorClass<unknown>;
7
+ interface ToEventStreamOptions {
8
+ /**
9
+ * If true, a ping comment is sent periodically to keep the connection alive.
10
+ *
11
+ * @default true
12
+ */
13
+ eventIteratorKeepAliveEnabled?: boolean;
14
+ /**
15
+ * Interval (in milliseconds) between ping comments sent after the last event.
16
+ *
17
+ * @default 5000
18
+ */
19
+ eventIteratorKeepAliveInterval?: number;
20
+ /**
21
+ * The content of the ping comment. Must not include newline characters.
22
+ *
23
+ * @default ''
24
+ */
25
+ eventIteratorKeepAliveComment?: string;
26
+ }
27
+ declare function toEventStream(iterator: AsyncIterator<unknown | void, unknown | void, void>, options?: ToEventStreamOptions): ReadableStream<Uint8Array>;
28
+
29
+ interface ToStandardBodyOptions extends ToEventIteratorOptions {
30
+ }
31
+ declare function toStandardBody(re: Request | Response, options?: ToStandardBodyOptions): Promise<StandardBody>;
32
+ interface ToFetchBodyOptions extends ToEventStreamOptions {
33
+ }
34
+ /**
35
+ * @param body
36
+ * @param headers - The headers can be changed by the function and effects on the original headers.
37
+ */
38
+ declare function toFetchBody(body: StandardBody, headers: Headers, options?: ToFetchBodyOptions): string | Blob | FormData | URLSearchParams | undefined | ReadableStream<Uint8Array>;
39
+
40
+ /**
41
+ * @param headers
42
+ * @param standardHeaders - The base headers can be changed by the function and effects on the original headers.
43
+ */
44
+ declare function toStandardHeaders(headers: Headers, standardHeaders?: StandardHeaders): StandardHeaders;
45
+ /**
46
+ * @param headers
47
+ * @param fetchHeaders - The base headers can be changed by the function and effects on the original headers.
48
+ */
49
+ declare function toFetchHeaders(headers: StandardHeaders, fetchHeaders?: Headers): Headers;
50
+
51
+ declare function toStandardLazyRequest(request: Request): StandardLazyRequest;
52
+ interface ToFetchRequestOptions extends ToFetchBodyOptions {
53
+ }
54
+ declare function toFetchRequest(request: StandardRequest, options?: ToFetchRequestOptions): Request;
55
+
56
+ interface ToFetchResponseOptions extends ToFetchBodyOptions {
57
+ }
58
+ declare function toFetchResponse(response: StandardResponse, options?: ToFetchResponseOptions): Response;
59
+ interface ToStandardLazyResponseOptions extends ToStandardBodyOptions {
60
+ }
61
+ declare function toStandardLazyResponse(response: Response, options?: ToStandardLazyResponseOptions): StandardLazyResponse;
62
+
63
+ export { toEventIterator, toEventStream, toFetchBody, toFetchHeaders, toFetchRequest, toFetchResponse, toStandardBody, toStandardHeaders, toStandardLazyRequest, toStandardLazyResponse };
64
+ export type { ToEventIteratorOptions, ToEventStreamOptions, ToFetchBodyOptions, ToFetchRequestOptions, ToFetchResponseOptions, ToStandardBodyOptions, ToStandardLazyResponseOptions };
@@ -0,0 +1,64 @@
1
+ import { StandardBody, StandardHeaders, StandardLazyRequest, StandardRequest, StandardResponse, StandardLazyResponse } from '@orpc/standard-server';
2
+ import { SetSpanErrorOptions, AsyncIteratorClass } from '@orpc/shared';
3
+
4
+ interface ToEventIteratorOptions extends SetSpanErrorOptions {
5
+ }
6
+ declare function toEventIterator(stream: ReadableStream<Uint8Array> | null, options?: ToEventIteratorOptions): AsyncIteratorClass<unknown>;
7
+ interface ToEventStreamOptions {
8
+ /**
9
+ * If true, a ping comment is sent periodically to keep the connection alive.
10
+ *
11
+ * @default true
12
+ */
13
+ eventIteratorKeepAliveEnabled?: boolean;
14
+ /**
15
+ * Interval (in milliseconds) between ping comments sent after the last event.
16
+ *
17
+ * @default 5000
18
+ */
19
+ eventIteratorKeepAliveInterval?: number;
20
+ /**
21
+ * The content of the ping comment. Must not include newline characters.
22
+ *
23
+ * @default ''
24
+ */
25
+ eventIteratorKeepAliveComment?: string;
26
+ }
27
+ declare function toEventStream(iterator: AsyncIterator<unknown | void, unknown | void, void>, options?: ToEventStreamOptions): ReadableStream<Uint8Array>;
28
+
29
+ interface ToStandardBodyOptions extends ToEventIteratorOptions {
30
+ }
31
+ declare function toStandardBody(re: Request | Response, options?: ToStandardBodyOptions): Promise<StandardBody>;
32
+ interface ToFetchBodyOptions extends ToEventStreamOptions {
33
+ }
34
+ /**
35
+ * @param body
36
+ * @param headers - The headers can be changed by the function and effects on the original headers.
37
+ */
38
+ declare function toFetchBody(body: StandardBody, headers: Headers, options?: ToFetchBodyOptions): string | Blob | FormData | URLSearchParams | undefined | ReadableStream<Uint8Array>;
39
+
40
+ /**
41
+ * @param headers
42
+ * @param standardHeaders - The base headers can be changed by the function and effects on the original headers.
43
+ */
44
+ declare function toStandardHeaders(headers: Headers, standardHeaders?: StandardHeaders): StandardHeaders;
45
+ /**
46
+ * @param headers
47
+ * @param fetchHeaders - The base headers can be changed by the function and effects on the original headers.
48
+ */
49
+ declare function toFetchHeaders(headers: StandardHeaders, fetchHeaders?: Headers): Headers;
50
+
51
+ declare function toStandardLazyRequest(request: Request): StandardLazyRequest;
52
+ interface ToFetchRequestOptions extends ToFetchBodyOptions {
53
+ }
54
+ declare function toFetchRequest(request: StandardRequest, options?: ToFetchRequestOptions): Request;
55
+
56
+ interface ToFetchResponseOptions extends ToFetchBodyOptions {
57
+ }
58
+ declare function toFetchResponse(response: StandardResponse, options?: ToFetchResponseOptions): Response;
59
+ interface ToStandardLazyResponseOptions extends ToStandardBodyOptions {
60
+ }
61
+ declare function toStandardLazyResponse(response: Response, options?: ToStandardLazyResponseOptions): StandardLazyResponse;
62
+
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 ADDED
@@ -0,0 +1,285 @@
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
+
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");
10
+ try {
11
+ while (true) {
12
+ if (reader === void 0) {
13
+ return { done: true, value: void 0 };
14
+ }
15
+ const { done, value } = await runInSpanContext(span, () => reader.read());
16
+ if (done) {
17
+ return { done: true, value: void 0 };
18
+ }
19
+ switch (value.event) {
20
+ case "message": {
21
+ let message = parseEmptyableJSON(value.data);
22
+ if (isTypescriptObject(message)) {
23
+ message = withEventMeta(message, value);
24
+ }
25
+ span?.addEvent("message");
26
+ return { done: false, value: message };
27
+ }
28
+ case "error": {
29
+ let error = new ErrorEvent({
30
+ data: parseEmptyableJSON(value.data)
31
+ });
32
+ error = withEventMeta(error, value);
33
+ span?.addEvent("error");
34
+ throw error;
35
+ }
36
+ case "done": {
37
+ let done2 = parseEmptyableJSON(value.data);
38
+ if (isTypescriptObject(done2)) {
39
+ done2 = withEventMeta(done2, value);
40
+ }
41
+ span?.addEvent("done");
42
+ return { done: true, value: done2 };
43
+ }
44
+ default: {
45
+ span?.addEvent("maybe_keepalive");
46
+ }
47
+ }
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;
64
+ } finally {
65
+ span?.end();
66
+ }
67
+ });
68
+ }
69
+ function toEventStream(iterator, options = {}) {
70
+ const keepAliveEnabled = options.eventIteratorKeepAliveEnabled ?? true;
71
+ const keepAliveInterval = options.eventIteratorKeepAliveInterval ?? 5e3;
72
+ const keepAliveComment = options.eventIteratorKeepAliveComment ?? "";
73
+ let cancelled = false;
74
+ let timeout;
75
+ let span;
76
+ const stream = new ReadableStream({
77
+ start() {
78
+ span = startSpan("stream_event_iterator");
79
+ },
80
+ async pull(controller) {
81
+ try {
82
+ if (keepAliveEnabled) {
83
+ timeout = setInterval(() => {
84
+ controller.enqueue(encodeEventMessage({
85
+ comments: [keepAliveComment]
86
+ }));
87
+ span?.addEvent("keepalive");
88
+ }, keepAliveInterval);
89
+ }
90
+ const value = await runInSpanContext(span, () => iterator.next());
91
+ clearInterval(timeout);
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
+ }
105
+ if (value.done) {
106
+ controller.close();
107
+ span?.end();
108
+ }
109
+ } catch (err) {
110
+ clearInterval(timeout);
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();
127
+ }
128
+ },
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();
140
+ }
141
+ }
142
+ }).pipeThrough(new TextEncoderStream());
143
+ return stream;
144
+ }
145
+
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
179
+ });
180
+ }
181
+ );
182
+ }
183
+ function toFetchBody(body, headers, options = {}) {
184
+ const currentContentDisposition = headers.get("content-disposition");
185
+ headers.delete("content-type");
186
+ headers.delete("content-disposition");
187
+ if (body === void 0) {
188
+ return void 0;
189
+ }
190
+ if (body instanceof Blob) {
191
+ headers.set("content-type", body.type);
192
+ headers.set("content-length", body.size.toString());
193
+ headers.set(
194
+ "content-disposition",
195
+ currentContentDisposition ?? generateContentDisposition(body instanceof File ? body.name : "blob")
196
+ );
197
+ return body;
198
+ }
199
+ if (body instanceof FormData) {
200
+ return body;
201
+ }
202
+ if (body instanceof URLSearchParams) {
203
+ return body;
204
+ }
205
+ if (isAsyncIteratorObject(body)) {
206
+ headers.set("content-type", "text/event-stream");
207
+ return toEventStream(body, options);
208
+ }
209
+ headers.set("content-type", "application/json");
210
+ return stringifyJSON(body);
211
+ }
212
+
213
+ function toStandardHeaders(headers, standardHeaders = {}) {
214
+ for (const [key, value] of headers) {
215
+ if (Array.isArray(standardHeaders[key])) {
216
+ standardHeaders[key].push(value);
217
+ } else if (standardHeaders[key] !== void 0) {
218
+ standardHeaders[key] = [standardHeaders[key], value];
219
+ } else {
220
+ standardHeaders[key] = value;
221
+ }
222
+ }
223
+ return standardHeaders;
224
+ }
225
+ function toFetchHeaders(headers, fetchHeaders = new Headers()) {
226
+ for (const [key, value] of Object.entries(headers)) {
227
+ if (Array.isArray(value)) {
228
+ for (const v of value) {
229
+ fetchHeaders.append(key, v);
230
+ }
231
+ } else if (value !== void 0) {
232
+ fetchHeaders.append(key, value);
233
+ }
234
+ }
235
+ return fetchHeaders;
236
+ }
237
+
238
+ function toStandardLazyRequest(request) {
239
+ return {
240
+ url: new URL(request.url),
241
+ signal: request.signal,
242
+ method: request.method,
243
+ body: once(() => toStandardBody(request, { signal: request.signal })),
244
+ get headers() {
245
+ const headers = toStandardHeaders(request.headers);
246
+ Object.defineProperty(this, "headers", { value: headers, writable: true });
247
+ return headers;
248
+ },
249
+ set headers(value) {
250
+ Object.defineProperty(this, "headers", { value, writable: true });
251
+ }
252
+ };
253
+ }
254
+ function toFetchRequest(request, options = {}) {
255
+ const headers = toFetchHeaders(request.headers);
256
+ const body = toFetchBody(request.body, headers, options);
257
+ return new Request(request.url, {
258
+ signal: request.signal,
259
+ method: request.method,
260
+ headers,
261
+ body
262
+ });
263
+ }
264
+
265
+ function toFetchResponse(response, options = {}) {
266
+ const headers = toFetchHeaders(response.headers);
267
+ const body = toFetchBody(response.body, headers, options);
268
+ return new Response(body, { headers, status: response.status });
269
+ }
270
+ function toStandardLazyResponse(response, options = {}) {
271
+ return {
272
+ body: once(() => toStandardBody(response, options)),
273
+ status: response.status,
274
+ get headers() {
275
+ const headers = toStandardHeaders(response.headers);
276
+ Object.defineProperty(this, "headers", { value: headers, writable: true });
277
+ return headers;
278
+ },
279
+ set headers(value) {
280
+ Object.defineProperty(this, "headers", { value, writable: true });
281
+ }
282
+ };
283
+ }
284
+
285
+ export { toEventIterator, toEventStream, toFetchBody, toFetchHeaders, toFetchRequest, toFetchResponse, toStandardBody, toStandardHeaders, toStandardLazyRequest, toStandardLazyResponse };
package/package.json ADDED
@@ -0,0 +1,37 @@
1
+ {
2
+ "name": "@orpc/standard-server-fetch",
3
+ "type": "module",
4
+ "version": "0.0.0-next.0021fba",
5
+ "license": "MIT",
6
+ "homepage": "https://unnoq.com",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git+https://github.com/unnoq/orpc.git",
10
+ "directory": "packages/standard-server-fetch"
11
+ },
12
+ "keywords": [
13
+ "orpc"
14
+ ],
15
+ "exports": {
16
+ ".": {
17
+ "types": "./dist/index.d.mts",
18
+ "import": "./dist/index.mjs",
19
+ "default": "./dist/index.mjs"
20
+ }
21
+ },
22
+ "files": [
23
+ "dist"
24
+ ],
25
+ "dependencies": {
26
+ "@orpc/shared": "0.0.0-next.0021fba",
27
+ "@orpc/standard-server": "0.0.0-next.0021fba"
28
+ },
29
+ "devDependencies": {
30
+ "@hono/node-server": "^1.18.0"
31
+ },
32
+ "scripts": {
33
+ "build": "unbuild",
34
+ "build:watch": "pnpm run build --watch",
35
+ "type:check": "tsc -b"
36
+ }
37
+ }