@orpc/standard-server-fetch 0.0.0-next.fa8d145 → 0.0.0-next.fc23c8d

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
@@ -30,7 +30,7 @@
30
30
  - **🔗 End-to-End Type Safety**: Ensure type-safe inputs, outputs, and errors from client to server.
31
31
  - **📘 First-Class OpenAPI**: Built-in support that fully adheres to the OpenAPI standard.
32
32
  - **📝 Contract-First Development**: Optionally define your API contract before implementation.
33
- - **⚙️ Framework Integrations**: Seamlessly integrate with TanStack Query (React, Vue, Solid, Svelte), Pinia Colada, and more.
33
+ - **⚙️ Framework Integrations**: Seamlessly integrate with TanStack Query (React, Vue, Solid, Svelte, Angular), Pinia Colada, and more.
34
34
  - **🚀 Server Actions**: Fully compatible with React Server Actions on Next.js, TanStack Start, and other platforms.
35
35
  - **🔠 Standard Schema Support**: Works out of the box with Zod, Valibot, ArkType, and other schema validators.
36
36
  - **🗃️ Native Types**: Supports native types like Date, File, Blob, BigInt, URL, and more.
@@ -49,14 +49,12 @@ You can find the full documentation [here](https://orpc.unnoq.com).
49
49
  - [@orpc/contract](https://www.npmjs.com/package/@orpc/contract): Build your API contract.
50
50
  - [@orpc/server](https://www.npmjs.com/package/@orpc/server): Build your API or implement API contract.
51
51
  - [@orpc/client](https://www.npmjs.com/package/@orpc/client): Consume your API on the client with type-safety.
52
- - [@orpc/nest](https://www.npmjs.com/package/@orpc/nest): Deeply integrate oRPC with NestJS.
52
+ - [@orpc/openapi](https://www.npmjs.com/package/@orpc/openapi): Generate OpenAPI specs and handle OpenAPI requests.
53
+ - [@orpc/nest](https://www.npmjs.com/package/@orpc/nest): Deeply integrate oRPC with [NestJS](https://nestjs.com/).
53
54
  - [@orpc/react](https://www.npmjs.com/package/@orpc/react): Utilities for integrating oRPC with React and React Server Actions.
54
- - [@orpc/react-query](https://www.npmjs.com/package/@orpc/react-query): Integration with [React Query](https://tanstack.com/query/latest/docs/framework/react/overview).
55
- - [@orpc/vue-query](https://www.npmjs.com/package/@orpc/vue-query): Integration with [Vue Query](https://tanstack.com/query/latest/docs/framework/vue/overview).
56
- - [@orpc/solid-query](https://www.npmjs.com/package/@orpc/solid-query): Integration with [Solid Query](https://tanstack.com/query/latest/docs/framework/solid/overview).
57
- - [@orpc/svelte-query](https://www.npmjs.com/package/@orpc/svelte-query): Integration with [Svelte Query](https://tanstack.com/query/latest/docs/framework/svelte/overview).
55
+ - [@orpc/tanstack-query](https://www.npmjs.com/package/@orpc/tanstack-query): [TanStack Query](https://tanstack.com/query/latest) integration.
58
56
  - [@orpc/vue-colada](https://www.npmjs.com/package/@orpc/vue-colada): Integration with [Pinia Colada](https://pinia-colada.esm.dev/).
59
- - [@orpc/openapi](https://www.npmjs.com/package/@orpc/openapi): Generate OpenAPI specs and handle OpenAPI requests.
57
+ - [@orpc/hey-api](https://www.npmjs.com/package/@orpc/hey-api): [Hey API](https://heyapi.dev/) integration.
60
58
  - [@orpc/zod](https://www.npmjs.com/package/@orpc/zod): More schemas that [Zod](https://zod.dev/) doesn't support yet.
61
59
  - [@orpc/valibot](https://www.npmjs.com/package/@orpc/valibot): OpenAPI spec generation from [Valibot](https://valibot.dev/).
62
60
  - [@orpc/arktype](https://www.npmjs.com/package/@orpc/arktype): OpenAPI spec generation from [ArkType](https://arktype.io/).
package/dist/index.d.mts CHANGED
@@ -1,6 +1,7 @@
1
1
  import { StandardBody, StandardHeaders, StandardLazyRequest, StandardRequest, StandardResponse, StandardLazyResponse } from '@orpc/standard-server';
2
+ import { AsyncIteratorClass } from '@orpc/shared';
2
3
 
3
- declare function toEventIterator(stream: ReadableStream<Uint8Array>): AsyncIteratorObject<unknown | void, unknown | void, void> & AsyncGenerator<unknown | void, unknown | void, void>;
4
+ declare function toEventIterator(stream: ReadableStream<Uint8Array> | null): AsyncIteratorClass<unknown>;
4
5
  interface ToEventStreamOptions {
5
6
  /**
6
7
  * If true, a ping comment is sent periodically to keep the connection alive.
package/dist/index.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import { StandardBody, StandardHeaders, StandardLazyRequest, StandardRequest, StandardResponse, StandardLazyResponse } from '@orpc/standard-server';
2
+ import { AsyncIteratorClass } from '@orpc/shared';
2
3
 
3
- declare function toEventIterator(stream: ReadableStream<Uint8Array>): AsyncIteratorObject<unknown | void, unknown | void, void> & AsyncGenerator<unknown | void, unknown | void, void>;
4
+ declare function toEventIterator(stream: ReadableStream<Uint8Array> | null): AsyncIteratorClass<unknown>;
4
5
  interface ToEventStreamOptions {
5
6
  /**
6
7
  * If true, a ping comment is sent periodically to keep the connection alive.
package/dist/index.mjs CHANGED
@@ -1,11 +1,14 @@
1
- import { createAsyncIteratorObject, parseEmptyableJSON, isTypescriptObject, stringifyJSON, isAsyncIteratorObject, once } from '@orpc/shared';
1
+ import { AsyncIteratorClass, parseEmptyableJSON, isTypescriptObject, stringifyJSON, isAsyncIteratorObject, once } from '@orpc/shared';
2
2
  import { EventDecoderStream, withEventMeta, ErrorEvent, encodeEventMessage, getEventMeta, getFilenameFromContentDisposition, generateContentDisposition } from '@orpc/standard-server';
3
3
 
4
4
  function toEventIterator(stream) {
5
- const eventStream = stream.pipeThrough(new TextDecoderStream()).pipeThrough(new EventDecoderStream());
6
- const reader = eventStream.getReader();
7
- return createAsyncIteratorObject(async () => {
5
+ const eventStream = stream?.pipeThrough(new TextDecoderStream()).pipeThrough(new EventDecoderStream());
6
+ const reader = eventStream?.getReader();
7
+ return new AsyncIteratorClass(async () => {
8
8
  while (true) {
9
+ if (reader === void 0) {
10
+ return { done: true, value: void 0 };
11
+ }
9
12
  const { done, value } = await reader.read();
10
13
  if (done) {
11
14
  return { done: true, value: void 0 };
@@ -35,7 +38,7 @@ function toEventIterator(stream) {
35
38
  }
36
39
  }
37
40
  }, async () => {
38
- await reader.cancel();
41
+ await reader?.cancel();
39
42
  });
40
43
  }
41
44
  function toEventStream(iterator, options = {}) {
@@ -93,9 +96,6 @@ function toEventStream(iterator, options = {}) {
93
96
  }
94
97
 
95
98
  async function toStandardBody(re) {
96
- if (re.body === null) {
97
- return void 0;
98
- }
99
99
  const contentDisposition = re.headers.get("content-disposition");
100
100
  if (typeof contentDisposition === "string") {
101
101
  const fileName = getFilenameFromContentDisposition(contentDisposition) ?? "blob";
@@ -151,8 +151,6 @@ function toFetchBody(body, headers, options = {}) {
151
151
  }
152
152
  if (isAsyncIteratorObject(body)) {
153
153
  headers.set("content-type", "text/event-stream");
154
- headers.set("cache-control", "no-cache");
155
- headers.set("connection", "keep-alive");
156
154
  return toEventStream(body, options);
157
155
  }
158
156
  headers.set("content-type", "application/json");
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.fa8d145",
4
+ "version": "0.0.0-next.fc23c8d",
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.fa8d145",
27
- "@orpc/standard-server": "0.0.0-next.fa8d145"
26
+ "@orpc/shared": "0.0.0-next.fc23c8d",
27
+ "@orpc/standard-server": "0.0.0-next.fc23c8d"
28
28
  },
29
29
  "devDependencies": {
30
- "@hono/node-server": "^1.14.1"
30
+ "@hono/node-server": "^1.14.4"
31
31
  },
32
32
  "scripts": {
33
33
  "build": "unbuild",