@boldvideo/bold-js 1.19.0 → 1.19.1

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,5 +1,15 @@
1
1
  # @boldvideo/bold-js
2
2
 
3
+ ## 1.19.1
4
+
5
+ ### Patch Changes
6
+
7
+ - d49c344: Fix SSE parser dropping events from multi-line event blocks
8
+
9
+ The `parseSSE` function checked if the entire event block started with `data:`, which failed when the server included an `event:` field before the `data:` field. This caused all streaming events except `message_start` to be silently dropped, hanging the stream indefinitely.
10
+
11
+ The parser now correctly splits each event block into individual lines and extracts the `data:` line from within the block.
12
+
3
13
  ## 1.19.0
4
14
 
5
15
  ### Minor Changes
package/dist/index.cjs CHANGED
@@ -634,11 +634,14 @@ async function* parseSSE(response) {
634
634
  }
635
635
  const lines = buffer.split(/\r?\n\r?\n/);
636
636
  buffer = done ? "" : lines.pop() || "";
637
- for (const line of lines) {
638
- const trimmed = line.trim();
639
- if (!trimmed || !trimmed.startsWith("data:"))
637
+ for (const block of lines) {
638
+ if (!block.trim())
640
639
  continue;
641
- const json = trimmed.slice(5).trim();
640
+ const blockLines = block.split(/\r?\n/);
641
+ const dataLine = blockLines.find((l) => l.trim().startsWith("data:"));
642
+ if (!dataLine)
643
+ continue;
644
+ const json = dataLine.trim().slice(5).trim();
642
645
  if (!json)
643
646
  continue;
644
647
  try {
package/dist/index.js CHANGED
@@ -594,11 +594,14 @@ async function* parseSSE(response) {
594
594
  }
595
595
  const lines = buffer.split(/\r?\n\r?\n/);
596
596
  buffer = done ? "" : lines.pop() || "";
597
- for (const line of lines) {
598
- const trimmed = line.trim();
599
- if (!trimmed || !trimmed.startsWith("data:"))
597
+ for (const block of lines) {
598
+ if (!block.trim())
600
599
  continue;
601
- const json = trimmed.slice(5).trim();
600
+ const blockLines = block.split(/\r?\n/);
601
+ const dataLine = blockLines.find((l) => l.trim().startsWith("data:"));
602
+ if (!dataLine)
603
+ continue;
604
+ const json = dataLine.trim().slice(5).trim();
602
605
  if (!json)
603
606
  continue;
604
607
  try {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@boldvideo/bold-js",
3
3
  "license": "MIT",
4
- "version": "1.19.0",
4
+ "version": "1.19.1",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",
7
7
  "types": "dist/index.d.ts",