@fereai/sdk 0.1.0 → 0.2.0-dev.17

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.
Files changed (2) hide show
  1. package/dist/low-level.js +22 -2
  2. package/package.json +4 -2
package/dist/low-level.js CHANGED
@@ -115,7 +115,17 @@ class FereAPI {
115
115
  eventType = line.slice(6).trim();
116
116
  }
117
117
  else if (line.startsWith("data:")) {
118
- const data = JSON.parse(line.slice(5).trim());
118
+ const raw = line.slice(5).trim();
119
+ if (!raw)
120
+ continue;
121
+ let data;
122
+ try {
123
+ data = JSON.parse(raw);
124
+ }
125
+ catch {
126
+ console.debug("Unparseable SSE data:", raw);
127
+ continue;
128
+ }
119
129
  yield { event: eventType, data };
120
130
  }
121
131
  }
@@ -243,7 +253,17 @@ class FereAPI {
243
253
  eventType = line.slice(6).trim();
244
254
  }
245
255
  else if (line.startsWith("data:")) {
246
- const data = JSON.parse(line.slice(5).trim());
256
+ const raw = line.slice(5).trim();
257
+ if (!raw)
258
+ continue;
259
+ let data;
260
+ try {
261
+ data = JSON.parse(raw);
262
+ }
263
+ catch {
264
+ console.debug("Unparseable SSE data:", raw);
265
+ continue;
266
+ }
247
267
  yield { event: eventType, data };
248
268
  }
249
269
  }
package/package.json CHANGED
@@ -1,10 +1,12 @@
1
1
  {
2
2
  "name": "@fereai/sdk",
3
- "version": "0.1.0",
3
+ "version": "0.2.0-dev.17",
4
4
  "description": "TypeScript SDK for the FereAI Gateway API",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
- "files": ["dist"],
7
+ "files": [
8
+ "dist"
9
+ ],
8
10
  "scripts": {
9
11
  "build": "tsc",
10
12
  "prepublishOnly": "tsc"