@mastra/dynamodb 1.0.6 → 1.0.7-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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,33 @@
1
1
  # @mastra/dynamodb
2
2
 
3
+ ## 1.0.7-alpha.1
4
+
5
+ ### Patch Changes
6
+
7
+ - Respect optional `resourceId` in `getThreadById` so scoped thread lookups return `null` when the thread belongs to a different resource. ([#14237](https://github.com/mastra-ai/mastra/pull/14237))
8
+
9
+ Example:
10
+
11
+ ```typescript
12
+ const thread = await memory.getThreadById({
13
+ threadId: 'my-thread-id',
14
+ resourceId: 'my-user-id',
15
+ });
16
+ // Returns null if the thread does not belong to 'my-user-id'.
17
+ ```
18
+
19
+ - Updated dependencies [[`7c275a8`](https://github.com/mastra-ai/mastra/commit/7c275a810595e1a6c41ccc39720531ab65734700), [`890b24c`](https://github.com/mastra-ai/mastra/commit/890b24cc7d32ed6aa4dfe253e54dc6bf4099f690), [`0f48ebf`](https://github.com/mastra-ai/mastra/commit/0f48ebfc7ac7897b2092a189f45751924cf56d1c), [`f180e49`](https://github.com/mastra-ai/mastra/commit/f180e4990e71b04c9a475b523584071712f0048f), [`9260e01`](https://github.com/mastra-ai/mastra/commit/9260e015276fb1b500f7878ee452b47476bf1583), [`2f6c54e`](https://github.com/mastra-ai/mastra/commit/2f6c54e17c041cac1def54baaa6b771647836414), [`e06a159`](https://github.com/mastra-ai/mastra/commit/e06a1598ca07a6c3778aefc2a2d288363c6294ff), [`db34bc6`](https://github.com/mastra-ai/mastra/commit/db34bc6fb36cf125bda0c46be4d3fdc774b70cc4)]:
20
+ - @mastra/core@1.33.0-alpha.8
21
+
22
+ ## 1.0.7-alpha.0
23
+
24
+ ### Patch Changes
25
+
26
+ - Track `suspendedAt` and `suspendPayload` on background tasks. SQL adapters auto-migrate the new columns via `alterTable`. ([#16260](https://github.com/mastra-ai/mastra/pull/16260))
27
+
28
+ - Updated dependencies [[`9f17410`](https://github.com/mastra-ai/mastra/commit/9f1741080def23d42ee50b39887a385ae316a3c6), [`c6eb39e`](https://github.com/mastra-ai/mastra/commit/c6eb39ea6dca381c6563cb240237fbe608e02f93), [`900d086`](https://github.com/mastra-ai/mastra/commit/900d086bb737b9cf2fcf68f11b0389b801a2738c), [`4c0e286`](https://github.com/mastra-ai/mastra/commit/4c0e28637c9cfb4f416549b55e97ebfa13319dfc), [`25184ff`](https://github.com/mastra-ai/mastra/commit/25184ffaf1293ec95119426eb1a1f8d38831b96c), [`aebde9c`](https://github.com/mastra-ai/mastra/commit/aebde9cfacf56592c6b6350cae721740fe090b8a)]:
29
+ - @mastra/core@1.33.0-alpha.4
30
+
3
31
  ## 1.0.6
4
32
 
5
33
  ### Patch Changes
@@ -3,7 +3,7 @@ name: mastra-dynamodb
3
3
  description: Documentation for @mastra/dynamodb. Use when working with @mastra/dynamodb APIs, configuration, or implementation.
4
4
  metadata:
5
5
  package: "@mastra/dynamodb"
6
- version: "1.0.6"
6
+ version: "1.0.7-alpha.1"
7
7
  ---
8
8
 
9
9
  ## When to use
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.0.6",
2
+ "version": "1.0.7-alpha.1",
3
3
  "package": "@mastra/dynamodb",
4
4
  "exports": {},
5
5
  "modules": {}
@@ -56,6 +56,12 @@ export declare const backgroundTaskEntity: Entity<string, string, string, {
56
56
  type: "string";
57
57
  required: false;
58
58
  };
59
+ suspendPayload: {
60
+ set: (value?: unknown) => string | undefined;
61
+ get: (value?: string) => any;
62
+ type: "string";
63
+ required: false;
64
+ };
59
65
  retryCount: {
60
66
  type: "number";
61
67
  required: true;
@@ -72,6 +78,10 @@ export declare const backgroundTaskEntity: Entity<string, string, string, {
72
78
  type: "string";
73
79
  required: false;
74
80
  };
81
+ suspendedAtIso: {
82
+ type: "string";
83
+ required: false;
84
+ };
75
85
  completedAtIso: {
76
86
  type: "string";
77
87
  required: false;
@@ -1 +1 @@
1
- {"version":3,"file":"background-task.d.ts","sourceRoot":"","sources":["../../src/entities/background-task.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AA2BnC,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;0BAnBjB,OAAO;0BAKP,MAAM;;;;;0BALN,OAAO;0BAKP,MAAM;;;;;0BALN,OAAO;0BAKP,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UAoHpB,CAAC"}
1
+ {"version":3,"file":"background-task.d.ts","sourceRoot":"","sources":["../../src/entities/background-task.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AA2BnC,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;0BAnBjB,OAAO;0BAKP,MAAM;;;;;0BALN,OAAO;0BAKP,MAAM;;;;;0BALN,OAAO;0BAKP,MAAM;;;;;0BALN,OAAO;0BAKP,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UA6HpB,CAAC"}
@@ -875,6 +875,12 @@ export declare function getElectroDbService(client: DynamoDBDocumentClient, tabl
875
875
  type: "string";
876
876
  required: false;
877
877
  };
878
+ suspendPayload: {
879
+ set: (value?: unknown) => string | undefined;
880
+ get: (value?: string) => any;
881
+ type: "string";
882
+ required: false;
883
+ };
878
884
  retryCount: {
879
885
  type: "number";
880
886
  required: true;
@@ -891,6 +897,10 @@ export declare function getElectroDbService(client: DynamoDBDocumentClient, tabl
891
897
  type: "string";
892
898
  required: false;
893
899
  };
900
+ suspendedAtIso: {
901
+ type: "string";
902
+ required: false;
903
+ };
894
904
  completed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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiBpF"}
package/dist/index.cjs CHANGED
@@ -160,6 +160,11 @@ var backgroundTaskEntity = new electrodb.Entity({
160
160
  required: false,
161
161
  ...jsonSetGet
162
162
  },
163
+ suspendPayload: {
164
+ type: "string",
165
+ required: false,
166
+ ...jsonSetGet
167
+ },
163
168
  retryCount: {
164
169
  type: "number",
165
170
  required: true
@@ -177,6 +182,10 @@ var backgroundTaskEntity = new electrodb.Entity({
177
182
  type: "string",
178
183
  required: false
179
184
  },
185
+ suspendedAtIso: {
186
+ type: "string",
187
+ required: false
188
+ },
180
189
  completedAtIso: {
181
190
  type: "string",
182
191
  required: false
@@ -1182,11 +1191,13 @@ function toElectroRecord(task) {
1182
1191
  args: serializeJson(task.args),
1183
1192
  result: serializeJson(task.result),
1184
1193
  error: serializeJson(task.error),
1194
+ suspendPayload: serializeJson(task.suspendPayload),
1185
1195
  retryCount: task.retryCount,
1186
1196
  maxRetries: task.maxRetries,
1187
1197
  timeoutMs: task.timeoutMs,
1188
1198
  createdAt: task.createdAt.toISOString(),
1189
1199
  startedAtIso: task.startedAt?.toISOString(),
1200
+ suspendedAtIso: task.suspendedAt?.toISOString(),
1190
1201
  completedAtIso: task.completedAt?.toISOString()
1191
1202
  };
1192
1203
  }
@@ -1215,11 +1226,13 @@ function fromElectroRecord(data) {
1215
1226
  runId: String(data.runId),
1216
1227
  result: parseJson(data.result),
1217
1228
  error: parseJson(data.error),
1229
+ suspendPayload: parseJson(data.suspendPayload),
1218
1230
  retryCount: Number(data.retryCount ?? 0),
1219
1231
  maxRetries: Number(data.maxRetries ?? 0),
1220
1232
  timeoutMs: Number(data.timeoutMs ?? 3e5),
1221
1233
  createdAt: asDate(data.createdAt) ?? /* @__PURE__ */ new Date(),
1222
1234
  startedAt: asDate(data.startedAtIso),
1235
+ suspendedAt: asDate(data.suspendedAtIso),
1223
1236
  completedAt: asDate(data.completedAtIso)
1224
1237
  };
1225
1238
  }
@@ -1272,6 +1285,13 @@ var BackgroundTasksStorageDynamoDB = class extends storage.BackgroundTasksStorag
1272
1285
  setFields.error = serializeJson(update.error);
1273
1286
  }
1274
1287
  }
1288
+ if ("suspendPayload" in update) {
1289
+ if (update.suspendPayload === void 0 || update.suspendPayload === null) {
1290
+ removeFields.push("suspendPayload");
1291
+ } else {
1292
+ setFields.suspendPayload = serializeJson(update.suspendPayload);
1293
+ }
1294
+ }
1275
1295
  if ("startedAt" in update) {
1276
1296
  if (update.startedAt === void 0 || update.startedAt === null) {
1277
1297
  removeFields.push("startedAtIso");
@@ -1279,6 +1299,13 @@ var BackgroundTasksStorageDynamoDB = class extends storage.BackgroundTasksStorag
1279
1299
  setFields.startedAtIso = update.startedAt.toISOString();
1280
1300
  }
1281
1301
  }
1302
+ if ("suspendedAt" in update) {
1303
+ if (update.suspendedAt === void 0 || update.suspendedAt === null) {
1304
+ removeFields.push("suspendedAtIso");
1305
+ } else {
1306
+ setFields.suspendedAtIso = update.suspendedAt.toISOString();
1307
+ }
1308
+ }
1282
1309
  if ("completedAt" in update) {
1283
1310
  if (update.completedAt === void 0 || update.completedAt === null) {
1284
1311
  removeFields.push("completedAtIso");
@@ -1345,6 +1372,7 @@ var BackgroundTasksStorageDynamoDB = class extends storage.BackgroundTasksStorag
1345
1372
  if (filter.threadId) tasks = tasks.filter((t) => t.threadId === filter.threadId);
1346
1373
  if (filter.resourceId) tasks = tasks.filter((t) => t.resourceId === filter.resourceId);
1347
1374
  if (filter.toolName) tasks = tasks.filter((t) => t.toolName === filter.toolName);
1375
+ if (filter.toolCallId) tasks = tasks.filter((t) => t.toolCallId === filter.toolCallId);
1348
1376
  if (filter.runId) tasks = tasks.filter((t) => t.runId === filter.runId);
1349
1377
  const dateCol = filter.dateFilterBy ?? "createdAt";
1350
1378
  if (filter.fromDate) {
@@ -1533,11 +1561,14 @@ var MemoryStorageDynamoDB = class extends storage.MemoryStorage {
1533
1561
  return direction === "DESC" ? -comparison : comparison;
1534
1562
  });
1535
1563
  }
1536
- async getThreadById({ threadId }) {
1537
- this.logger.debug("Getting thread by ID", { threadId });
1564
+ async getThreadById({
1565
+ threadId,
1566
+ resourceId
1567
+ }) {
1568
+ this.logger.debug("Getting thread by ID", { threadId, resourceId });
1538
1569
  try {
1539
1570
  const result = await this.service.entities.thread.get({ entity: "thread", id: threadId }).go();
1540
- if (!result.data) {
1571
+ if (!result.data || resourceId !== void 0 && result.data.resourceId !== resourceId) {
1541
1572
  return null;
1542
1573
  }
1543
1574
  const data = result.data;