@mastra/client-js 1.45.0 → 1.45.1-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.
@@ -3,7 +3,7 @@ name: mastra-client-js
3
3
  description: Documentation for @mastra/client-js. Use when working with @mastra/client-js APIs, configuration, or implementation.
4
4
  metadata:
5
5
  package: "@mastra/client-js"
6
- version: "1.45.0"
6
+ version: "1.45.1-alpha.1"
7
7
  ---
8
8
 
9
9
  ## When to use
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.45.0",
2
+ "version": "1.45.1-alpha.1",
3
3
  "package": "@mastra/client-js",
4
4
  "exports": {},
5
5
  "modules": {}
@@ -191,7 +191,7 @@ await client.purgeDatasetItem('dataset-id', 'item-id', {
191
191
 
192
192
  The optional third argument scopes the purge to a tenant organization and project. The server returns `404` when the dataset doesn't belong to that scope.
193
193
 
194
- Returns `Promise<{ success: boolean }>`. The operation is idempotent and can't be undone. Don't run it concurrently with dataset item updates or deletions because a write that started before purge can commit a stale revision afterward. MongoDB storage requires a replica set or sharded deployment with transaction support. See [`dataset.purgeItem()`](https://mastra.ai/reference/datasets/purgeItem) for the complete purge behavior.
194
+ Returns `Promise<{ success: boolean }>`. The operation is idempotent and can't be undone. Purge serializes or conflicts with concurrent dataset item writers without guaranteeing which operation completes first. If a mutating item update loses the race, storage re-reads the purge marker and rejects it with `DATASET_ITEM_PURGED`. Deletes remain idempotent, and any deletion tombstone created during the race stays redacted. MongoDB storage requires a replica set or sharded deployment with transaction support. See [`dataset.purgeItem()`](https://mastra.ai/reference/datasets/purgeItem) for the complete purge behavior.
195
195
 
196
196
  ## Related
197
197
 
package/dist/index.cjs CHANGED
@@ -5938,6 +5938,7 @@ var AgentControllerSession = class extends BaseResource {
5938
5938
  while (!cancelled) {
5939
5939
  const { done, value } = await reader.read();
5940
5940
  if (done) return cancelled ? { kind: "cancelled" } : { kind: "done" };
5941
+ if (cancelled) return { kind: "cancelled" };
5941
5942
  buffer += decoder.decode(value, { stream: true });
5942
5943
  let separator;
5943
5944
  while ((separator = findFrameSeparator(buffer)) !== null) {
@@ -5953,6 +5954,7 @@ var AgentControllerSession = class extends BaseResource {
5953
5954
  } catch {
5954
5955
  continue;
5955
5956
  }
5957
+ if (cancelled) return { kind: "cancelled" };
5956
5958
  try {
5957
5959
  options.onEvent(event);
5958
5960
  } catch (cause) {
@@ -6005,6 +6007,7 @@ var AgentControllerSession = class extends BaseResource {
6005
6007
  let attempts = 0;
6006
6008
  let reconnectedResponse;
6007
6009
  while (!reconnectedResponse) {
6010
+ if (cancelled) return;
6008
6011
  if (attempts >= reconnectOptions.maxRetries) {
6009
6012
  reportTerminalError(result);
6010
6013
  return;
@@ -6029,6 +6032,10 @@ var AgentControllerSession = class extends BaseResource {
6029
6032
  try {
6030
6033
  options.onReconnect?.();
6031
6034
  } catch {}
6035
+ if (cancelled) {
6036
+ response.body?.cancel().catch(() => {});
6037
+ return;
6038
+ }
6032
6039
  }
6033
6040
  };
6034
6041
  run(firstResponse);