@mastra/mongodb 1.26.0 → 1.27.0

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
@@ -10,7 +10,7 @@ import { MessageList } from "@mastra/core/agent";
10
10
  import { saveScorePayloadSchema } from "@mastra/core/evals";
11
11
  import { skillSnapshotFieldValuesEqual } from "@mastra/core/storage/domains/skills";
12
12
  // package.json
13
- var version = "1.26.0";
13
+ var version = "1.27.0";
14
14
  // src/vector/filter.ts
15
15
  /**
16
16
  * Translator for MongoDB filter queries.
@@ -8258,14 +8258,16 @@ var MemoryStorageMongoDB = class MemoryStorageMongoDB extends MemoryStorage {
8258
8258
  collection: TABLE_THREADS,
8259
8259
  keys: {
8260
8260
  resourceId: 1,
8261
- createdAt: -1
8261
+ createdAt: -1,
8262
+ id: -1
8262
8263
  }
8263
8264
  },
8264
8265
  {
8265
8266
  collection: TABLE_THREADS,
8266
8267
  keys: {
8267
8268
  resourceId: 1,
8268
- updatedAt: -1
8269
+ updatedAt: -1,
8270
+ id: -1
8269
8271
  }
8270
8272
  },
8271
8273
  {
@@ -8933,7 +8935,10 @@ var MemoryStorageMongoDB = class MemoryStorageMongoDB extends MemoryStorage {
8933
8935
  hasMore: offset < total
8934
8936
  };
8935
8937
  const sortOrder = direction === "ASC" ? 1 : -1;
8936
- let cursor = collection.find(query).sort({ [field]: sortOrder }).skip(offset);
8938
+ let cursor = collection.find(query).sort({
8939
+ [field]: sortOrder,
8940
+ id: sortOrder
8941
+ }).skip(offset);
8937
8942
  if (perPageInput !== false) cursor = cursor.limit(perPage);
8938
8943
  return {
8939
8944
  threads: (await cursor.toArray()).map((thread) => ({
@@ -11628,7 +11633,9 @@ function scheduleToDoc(schedule) {
11628
11633
  updated_at: schedule.updatedAt,
11629
11634
  metadata: schedule.metadata ?? null,
11630
11635
  owner_type: schedule.ownerType ?? null,
11631
- owner_id: schedule.ownerId ?? null
11636
+ owner_id: schedule.ownerId ?? null,
11637
+ run_at: schedule.runAt ?? null,
11638
+ end_at: schedule.endAt ?? null
11632
11639
  };
11633
11640
  }
11634
11641
  function docToSchedule(doc) {
@@ -11649,6 +11656,8 @@ function docToSchedule(doc) {
11649
11656
  if (doc.metadata != null) schedule.metadata = doc.metadata;
11650
11657
  if (doc.owner_type != null) schedule.ownerType = String(doc.owner_type);
11651
11658
  if (doc.owner_id != null) schedule.ownerId = String(doc.owner_id);
11659
+ if (doc.run_at != null) schedule.runAt = Number(doc.run_at);
11660
+ if (doc.end_at != null) schedule.endAt = Number(doc.end_at);
11652
11661
  return schedule;
11653
11662
  }
11654
11663
  function triggerToDoc(trigger) {
@@ -11827,6 +11836,8 @@ var SchedulesMongoDB = class SchedulesMongoDB extends SchedulesStorage {
11827
11836
  if ("metadata" in patch) $set.metadata = patch.metadata ?? null;
11828
11837
  if ("ownerType" in patch) $set.owner_type = patch.ownerType ?? null;
11829
11838
  if ("ownerId" in patch) $set.owner_id = patch.ownerId ?? null;
11839
+ if ("runAt" in patch) $set.run_at = patch.runAt ?? null;
11840
+ if ("endAt" in patch) $set.end_at = patch.endAt ?? null;
11830
11841
  $set.updated_at = Date.now();
11831
11842
  const result = await (await this.getSchedulesCollection()).findOneAndUpdate({ id }, { $set }, { returnDocument: "after" });
11832
11843
  if (!result) throw new Error(`Schedule ${id} not found`);