@mastra/mongodb 1.19.1-alpha.0 → 1.20.0-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-mongodb
3
3
  description: Documentation for @mastra/mongodb. Use when working with @mastra/mongodb APIs, configuration, or implementation.
4
4
  metadata:
5
5
  package: "@mastra/mongodb"
6
- version: "1.19.1-alpha.0"
6
+ version: "1.20.0-alpha.1"
7
7
  ---
8
8
 
9
9
  ## When to use
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.19.1-alpha.0",
2
+ "version": "1.20.0-alpha.1",
3
3
  "package": "@mastra/mongodb",
4
4
  "exports": {},
5
5
  "modules": {}
package/dist/index.cjs CHANGED
@@ -10,7 +10,7 @@ let _mastra_core_agent = require("@mastra/core/agent");
10
10
  let _mastra_core_evals = require("@mastra/core/evals");
11
11
  let _mastra_core_storage_domains_skills = require("@mastra/core/storage/domains/skills");
12
12
  //#region package.json
13
- var version = "1.19.1-alpha.0";
13
+ var version = "1.20.0-alpha.1";
14
14
  //#endregion
15
15
  //#region src/vector/filter.ts
16
16
  /**
@@ -2378,7 +2378,9 @@ function toDoc(task) {
2378
2378
  createdAt: task.createdAt.toISOString(),
2379
2379
  startedAt: task.startedAt?.toISOString() ?? null,
2380
2380
  suspendedAt: task.suspendedAt?.toISOString() ?? null,
2381
- completedAt: task.completedAt?.toISOString() ?? null
2381
+ completedAt: task.completedAt?.toISOString() ?? null,
2382
+ ownerId: task.ownerId ?? null,
2383
+ leaseExpiresAt: task.leaseExpiresAt?.toISOString() ?? null
2382
2384
  };
2383
2385
  }
2384
2386
  function fromDoc(doc) {
@@ -2401,7 +2403,9 @@ function fromDoc(doc) {
2401
2403
  createdAt: new Date(doc.createdAt),
2402
2404
  startedAt: doc.startedAt ? new Date(doc.startedAt) : void 0,
2403
2405
  suspendedAt: doc.suspendedAt ? new Date(doc.suspendedAt) : void 0,
2404
- completedAt: doc.completedAt ? new Date(doc.completedAt) : void 0
2406
+ completedAt: doc.completedAt ? new Date(doc.completedAt) : void 0,
2407
+ ownerId: doc.ownerId ?? void 0,
2408
+ leaseExpiresAt: doc.leaseExpiresAt ? new Date(doc.leaseExpiresAt) : void 0
2405
2409
  };
2406
2410
  }
2407
2411
  var BackgroundTasksStorageMongoDB = class BackgroundTasksStorageMongoDB extends _mastra_core_storage.BackgroundTasksStorage {
@@ -2518,11 +2522,14 @@ var BackgroundTasksStorageMongoDB = class BackgroundTasksStorageMongoDB extends
2518
2522
  if ("startedAt" in update) $set.startedAt = update.startedAt?.toISOString() ?? null;
2519
2523
  if ("suspendedAt" in update) $set.suspendedAt = update.suspendedAt?.toISOString() ?? null;
2520
2524
  if ("completedAt" in update) $set.completedAt = update.completedAt?.toISOString() ?? null;
2525
+ if ("ownerId" in update) $set.ownerId = update.ownerId ?? null;
2526
+ if ("leaseExpiresAt" in update) $set.leaseExpiresAt = update.leaseExpiresAt?.toISOString() ?? null;
2521
2527
  if (Object.keys($set).length === 0) return false;
2522
- return (await (await this.getCollection()).updateOne({
2523
- id: taskId,
2524
- ...options?.expectedStatus ? { status: options.expectedStatus } : {}
2525
- }, { $set })).matchedCount > 0;
2528
+ const filter = { id: taskId };
2529
+ if (options?.expectedStatus) filter.status = options.expectedStatus;
2530
+ if (options?.expectedOwnerId !== void 0) filter.ownerId = options.expectedOwnerId;
2531
+ if (options?.expectedLeaseExpiresAt !== void 0) filter.leaseExpiresAt = options.expectedLeaseExpiresAt?.toISOString() ?? null;
2532
+ return (await (await this.getCollection()).updateOne(filter, { $set })).matchedCount > 0;
2526
2533
  }
2527
2534
  async getTask(taskId) {
2528
2535
  const doc = await (await this.getCollection()).findOne({ id: taskId });