@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/dist/index.js CHANGED
@@ -158,6 +158,11 @@ var backgroundTaskEntity = new Entity({
158
158
  required: false,
159
159
  ...jsonSetGet
160
160
  },
161
+ suspendPayload: {
162
+ type: "string",
163
+ required: false,
164
+ ...jsonSetGet
165
+ },
161
166
  retryCount: {
162
167
  type: "number",
163
168
  required: true
@@ -175,6 +180,10 @@ var backgroundTaskEntity = new Entity({
175
180
  type: "string",
176
181
  required: false
177
182
  },
183
+ suspendedAtIso: {
184
+ type: "string",
185
+ required: false
186
+ },
178
187
  completedAtIso: {
179
188
  type: "string",
180
189
  required: false
@@ -1180,11 +1189,13 @@ function toElectroRecord(task) {
1180
1189
  args: serializeJson(task.args),
1181
1190
  result: serializeJson(task.result),
1182
1191
  error: serializeJson(task.error),
1192
+ suspendPayload: serializeJson(task.suspendPayload),
1183
1193
  retryCount: task.retryCount,
1184
1194
  maxRetries: task.maxRetries,
1185
1195
  timeoutMs: task.timeoutMs,
1186
1196
  createdAt: task.createdAt.toISOString(),
1187
1197
  startedAtIso: task.startedAt?.toISOString(),
1198
+ suspendedAtIso: task.suspendedAt?.toISOString(),
1188
1199
  completedAtIso: task.completedAt?.toISOString()
1189
1200
  };
1190
1201
  }
@@ -1213,11 +1224,13 @@ function fromElectroRecord(data) {
1213
1224
  runId: String(data.runId),
1214
1225
  result: parseJson(data.result),
1215
1226
  error: parseJson(data.error),
1227
+ suspendPayload: parseJson(data.suspendPayload),
1216
1228
  retryCount: Number(data.retryCount ?? 0),
1217
1229
  maxRetries: Number(data.maxRetries ?? 0),
1218
1230
  timeoutMs: Number(data.timeoutMs ?? 3e5),
1219
1231
  createdAt: asDate(data.createdAt) ?? /* @__PURE__ */ new Date(),
1220
1232
  startedAt: asDate(data.startedAtIso),
1233
+ suspendedAt: asDate(data.suspendedAtIso),
1221
1234
  completedAt: asDate(data.completedAtIso)
1222
1235
  };
1223
1236
  }
@@ -1270,6 +1283,13 @@ var BackgroundTasksStorageDynamoDB = class extends BackgroundTasksStorage {
1270
1283
  setFields.error = serializeJson(update.error);
1271
1284
  }
1272
1285
  }
1286
+ if ("suspendPayload" in update) {
1287
+ if (update.suspendPayload === void 0 || update.suspendPayload === null) {
1288
+ removeFields.push("suspendPayload");
1289
+ } else {
1290
+ setFields.suspendPayload = serializeJson(update.suspendPayload);
1291
+ }
1292
+ }
1273
1293
  if ("startedAt" in update) {
1274
1294
  if (update.startedAt === void 0 || update.startedAt === null) {
1275
1295
  removeFields.push("startedAtIso");
@@ -1277,6 +1297,13 @@ var BackgroundTasksStorageDynamoDB = class extends BackgroundTasksStorage {
1277
1297
  setFields.startedAtIso = update.startedAt.toISOString();
1278
1298
  }
1279
1299
  }
1300
+ if ("suspendedAt" in update) {
1301
+ if (update.suspendedAt === void 0 || update.suspendedAt === null) {
1302
+ removeFields.push("suspendedAtIso");
1303
+ } else {
1304
+ setFields.suspendedAtIso = update.suspendedAt.toISOString();
1305
+ }
1306
+ }
1280
1307
  if ("completedAt" in update) {
1281
1308
  if (update.completedAt === void 0 || update.completedAt === null) {
1282
1309
  removeFields.push("completedAtIso");
@@ -1343,6 +1370,7 @@ var BackgroundTasksStorageDynamoDB = class extends BackgroundTasksStorage {
1343
1370
  if (filter.threadId) tasks = tasks.filter((t) => t.threadId === filter.threadId);
1344
1371
  if (filter.resourceId) tasks = tasks.filter((t) => t.resourceId === filter.resourceId);
1345
1372
  if (filter.toolName) tasks = tasks.filter((t) => t.toolName === filter.toolName);
1373
+ if (filter.toolCallId) tasks = tasks.filter((t) => t.toolCallId === filter.toolCallId);
1346
1374
  if (filter.runId) tasks = tasks.filter((t) => t.runId === filter.runId);
1347
1375
  const dateCol = filter.dateFilterBy ?? "createdAt";
1348
1376
  if (filter.fromDate) {
@@ -1531,11 +1559,14 @@ var MemoryStorageDynamoDB = class extends MemoryStorage {
1531
1559
  return direction === "DESC" ? -comparison : comparison;
1532
1560
  });
1533
1561
  }
1534
- async getThreadById({ threadId }) {
1535
- this.logger.debug("Getting thread by ID", { threadId });
1562
+ async getThreadById({
1563
+ threadId,
1564
+ resourceId
1565
+ }) {
1566
+ this.logger.debug("Getting thread by ID", { threadId, resourceId });
1536
1567
  try {
1537
1568
  const result = await this.service.entities.thread.get({ entity: "thread", id: threadId }).go();
1538
- if (!result.data) {
1569
+ if (!result.data || resourceId !== void 0 && result.data.resourceId !== resourceId) {
1539
1570
  return null;
1540
1571
  }
1541
1572
  const data = result.data;