@orpc/standard-server-fetch 0.0.0-next.c79fd64 → 0.0.0-next.c81407e

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
@@ -17,6 +17,9 @@
17
17
  <a href="https://discord.gg/TXEbwRBvQn">
18
18
  <img alt="Discord" src="https://img.shields.io/discord/1308966753044398161?color=7389D8&label&logo=discord&logoColor=ffffff" />
19
19
  </a>
20
+ <a href="https://deepwiki.com/unnoq/orpc">
21
+ <img src="https://deepwiki.com/badge.svg" alt="Ask DeepWiki">
22
+ </a>
20
23
  </div>
21
24
 
22
25
  <h3 align="center">Typesafe APIs Made Simple 🪄</h3>
package/dist/index.mjs CHANGED
@@ -1,10 +1,11 @@
1
- import { AsyncIteratorClass, startSpan, runInSpanContext, parseEmptyableJSON, isTypescriptObject, setSpanError, stringifyJSON, runWithSpan, isAsyncIteratorObject, once } from '@orpc/shared';
1
+ import { AsyncIteratorClass, startSpan, runInSpanContext, AbortError, parseEmptyableJSON, isTypescriptObject, setSpanError, stringifyJSON, runWithSpan, 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, options = {}) {
5
5
  const eventStream = stream?.pipeThrough(new TextDecoderStream()).pipeThrough(new EventDecoderStream());
6
6
  const reader = eventStream?.getReader();
7
7
  let span;
8
+ let isCancelled = false;
8
9
  return new AsyncIteratorClass(async () => {
9
10
  span ??= startSpan("consume_event_iterator_stream");
10
11
  try {
@@ -14,6 +15,9 @@ function toEventIterator(stream, options = {}) {
14
15
  }
15
16
  const { done, value } = await runInSpanContext(span, () => reader.read());
16
17
  if (done) {
18
+ if (isCancelled) {
19
+ throw new AbortError("Stream was cancelled");
20
+ }
17
21
  return { done: true, value: void 0 };
18
22
  }
19
23
  switch (value.event) {
@@ -55,6 +59,7 @@ function toEventIterator(stream, options = {}) {
55
59
  }, async (reason) => {
56
60
  try {
57
61
  if (reason !== "next") {
62
+ isCancelled = true;
58
63
  span?.addEvent("cancelled");
59
64
  }
60
65
  await runInSpanContext(span, () => reader?.cancel());
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.c79fd64",
4
+ "version": "0.0.0-next.c81407e",
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.c79fd64",
27
- "@orpc/standard-server": "0.0.0-next.c79fd64"
26
+ "@orpc/shared": "0.0.0-next.c81407e",
27
+ "@orpc/standard-server": "0.0.0-next.c81407e"
28
28
  },
29
29
  "devDependencies": {
30
- "@hono/node-server": "^1.19.1"
30
+ "@hono/node-server": "^1.19.5"
31
31
  },
32
32
  "scripts": {
33
33
  "build": "unbuild",