@mastra/client-js 0.10.14 → 0.10.15-alpha.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.
@@ -1,5 +1,5 @@
1
1
 
2
- > @mastra/client-js@0.10.14-alpha.1 build /home/runner/work/mastra/mastra/client-sdks/client-js
2
+ > @mastra/client-js@0.10.15-alpha.1 build /home/runner/work/mastra/mastra/client-sdks/client-js
3
3
  > tsup src/index.ts --format esm,cjs --dts --clean --treeshake=smallest --splitting
4
4
 
5
5
  CLI Building entry: src/index.ts
@@ -9,11 +9,11 @@
9
9
  CLI Cleaning output folder
10
10
  ESM Build start
11
11
  CJS Build start
12
- CJS dist/index.cjs 71.41 KB
13
- CJS ⚡️ Build success in 1829ms
14
- ESM dist/index.js 71.12 KB
15
- ESM ⚡️ Build success in 1832ms
12
+ CJS dist/index.cjs 71.60 KB
13
+ CJS ⚡️ Build success in 2098ms
14
+ ESM dist/index.js 71.31 KB
15
+ ESM ⚡️ Build success in 2105ms
16
16
  DTS Build start
17
- DTS ⚡️ Build success in 16039ms
17
+ DTS ⚡️ Build success in 17372ms
18
18
  DTS dist/index.d.ts 41.95 KB
19
19
  DTS dist/index.d.cts 41.95 KB
package/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # @mastra/client-js
2
2
 
3
+ ## 0.10.15-alpha.1
4
+
5
+ ### Patch Changes
6
+
7
+ - @mastra/core@0.11.0-alpha.1
8
+
9
+ ## 0.10.15-alpha.0
10
+
11
+ ### Patch Changes
12
+
13
+ - 7827943: Handle streaming large data
14
+ - Updated dependencies [7827943]
15
+ - Updated dependencies [bf1e7e7]
16
+ - Updated dependencies [cbddd18]
17
+ - @mastra/core@0.11.0-alpha.0
18
+
3
19
  ## 0.10.14
4
20
 
5
21
  ### Patch Changes
package/dist/index.cjs CHANGED
@@ -1480,6 +1480,7 @@ var Workflow = class extends BaseResource {
1480
1480
  if (!response.body) {
1481
1481
  throw new Error("Response body is null");
1482
1482
  }
1483
+ let failedChunk = void 0;
1483
1484
  const transformStream = new TransformStream({
1484
1485
  start() {
1485
1486
  },
@@ -1489,10 +1490,13 @@ var Workflow = class extends BaseResource {
1489
1490
  const chunks = decoded.split(RECORD_SEPARATOR2);
1490
1491
  for (const chunk2 of chunks) {
1491
1492
  if (chunk2) {
1493
+ const newChunk = failedChunk ? failedChunk + chunk2 : chunk2;
1492
1494
  try {
1493
- const parsedChunk = JSON.parse(chunk2);
1495
+ const parsedChunk = JSON.parse(newChunk);
1494
1496
  controller.enqueue(parsedChunk);
1495
- } catch {
1497
+ failedChunk = void 0;
1498
+ } catch (error) {
1499
+ failedChunk = newChunk;
1496
1500
  }
1497
1501
  }
1498
1502
  }
package/dist/index.js CHANGED
@@ -1474,6 +1474,7 @@ var Workflow = class extends BaseResource {
1474
1474
  if (!response.body) {
1475
1475
  throw new Error("Response body is null");
1476
1476
  }
1477
+ let failedChunk = void 0;
1477
1478
  const transformStream = new TransformStream({
1478
1479
  start() {
1479
1480
  },
@@ -1483,10 +1484,13 @@ var Workflow = class extends BaseResource {
1483
1484
  const chunks = decoded.split(RECORD_SEPARATOR2);
1484
1485
  for (const chunk2 of chunks) {
1485
1486
  if (chunk2) {
1487
+ const newChunk = failedChunk ? failedChunk + chunk2 : chunk2;
1486
1488
  try {
1487
- const parsedChunk = JSON.parse(chunk2);
1489
+ const parsedChunk = JSON.parse(newChunk);
1488
1490
  controller.enqueue(parsedChunk);
1489
- } catch {
1491
+ failedChunk = void 0;
1492
+ } catch (error) {
1493
+ failedChunk = newChunk;
1490
1494
  }
1491
1495
  }
1492
1496
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mastra/client-js",
3
- "version": "0.10.14",
3
+ "version": "0.10.15-alpha.1",
4
4
  "description": "The official TypeScript library for the Mastra Client API",
5
5
  "author": "",
6
6
  "type": "module",
@@ -34,7 +34,7 @@
34
34
  "rxjs": "7.8.1",
35
35
  "zod": "^3.25.67",
36
36
  "zod-to-json-schema": "^3.24.5",
37
- "@mastra/core": "0.10.15"
37
+ "@mastra/core": "0.11.0-alpha.1"
38
38
  },
39
39
  "peerDependencies": {
40
40
  "zod": "^3.0.0"
@@ -289,6 +289,9 @@ export class Workflow extends BaseResource {
289
289
  throw new Error('Response body is null');
290
290
  }
291
291
 
292
+ //using undefined instead of empty string to avoid parsing errors
293
+ let failedChunk: string | undefined = undefined;
294
+
292
295
  // Create a transform stream that processes the response body
293
296
  const transformStream = new TransformStream<ArrayBuffer, { type: string; payload: any }>({
294
297
  start() {},
@@ -303,11 +306,13 @@ export class Workflow extends BaseResource {
303
306
  // Process each chunk
304
307
  for (const chunk of chunks) {
305
308
  if (chunk) {
309
+ const newChunk: string = failedChunk ? failedChunk + chunk : chunk;
306
310
  try {
307
- const parsedChunk = JSON.parse(chunk);
311
+ const parsedChunk = JSON.parse(newChunk);
308
312
  controller.enqueue(parsedChunk);
309
- } catch {
310
- // Silently ignore parsing errors
313
+ failedChunk = undefined;
314
+ } catch (error) {
315
+ failedChunk = newChunk;
311
316
  }
312
317
  }
313
318
  }