@pikku/fetch 0.12.3 → 0.12.4

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/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ ## 0.12.4
2
+
3
+ ### Patch Changes
4
+
5
+ - ade6f0b: `subscribeToSSE`: call `onError` when the stream closes cleanly without the caller having called `close()`. Previously a server-side connection drop (or any clean EOF before the terminal event) exited the read loop silently, leaving the caller's `runPhase` stuck at `'running'` indefinitely with no way to recover.
6
+
1
7
  ## 0.12.3
2
8
 
3
9
  ### Patch Changes
@@ -224,6 +224,9 @@ class CorePikkuFetch {
224
224
  handler(parsed);
225
225
  }
226
226
  }
227
+ // Clean EOF before caller called close() = unexpected stream termination.
228
+ if (!closed)
229
+ throw new Error('SSE stream closed unexpectedly');
227
230
  }
228
231
  catch (err) {
229
232
  if (!closed)
@@ -202,6 +202,9 @@ export class CorePikkuFetch {
202
202
  handler(parsed);
203
203
  }
204
204
  }
205
+ // Clean EOF before caller called close() = unexpected stream termination.
206
+ if (!closed)
207
+ throw new Error('SSE stream closed unexpectedly');
205
208
  }
206
209
  catch (err) {
207
210
  if (!closed)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pikku/fetch",
3
- "version": "0.12.3",
3
+ "version": "0.12.4",
4
4
  "author": "yasser.fadl@gmail.com",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -254,6 +254,8 @@ export class CorePikkuFetch {
254
254
  handler(parsed)
255
255
  }
256
256
  }
257
+ // Clean EOF before caller called close() = unexpected stream termination.
258
+ if (!closed) throw new Error('SSE stream closed unexpectedly')
257
259
  } catch (err) {
258
260
  if (!closed) onError?.(err)
259
261
  }