@mastra/mongodb 1.19.1-alpha.0 → 1.20.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/docs/SKILL.md +1 -1
- package/dist/docs/assets/SOURCE_MAP.json +1 -1
- package/dist/docs/references/reference-storage-retention.md +1 -1
- package/dist/index.cjs +14 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +14 -7
- package/dist/index.js.map +1 -1
- package/dist/storage/domains/background-tasks/index.d.ts +2 -4
- package/dist/storage/domains/background-tasks/index.d.ts.map +1 -1
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -9,7 +9,7 @@ import { MessageList } from "@mastra/core/agent";
|
|
|
9
9
|
import { saveScorePayloadSchema } from "@mastra/core/evals";
|
|
10
10
|
import { skillSnapshotFieldValuesEqual } from "@mastra/core/storage/domains/skills";
|
|
11
11
|
//#region package.json
|
|
12
|
-
var version = "1.
|
|
12
|
+
var version = "1.20.0";
|
|
13
13
|
//#endregion
|
|
14
14
|
//#region src/vector/filter.ts
|
|
15
15
|
/**
|
|
@@ -2377,7 +2377,9 @@ function toDoc(task) {
|
|
|
2377
2377
|
createdAt: task.createdAt.toISOString(),
|
|
2378
2378
|
startedAt: task.startedAt?.toISOString() ?? null,
|
|
2379
2379
|
suspendedAt: task.suspendedAt?.toISOString() ?? null,
|
|
2380
|
-
completedAt: task.completedAt?.toISOString() ?? null
|
|
2380
|
+
completedAt: task.completedAt?.toISOString() ?? null,
|
|
2381
|
+
ownerId: task.ownerId ?? null,
|
|
2382
|
+
leaseExpiresAt: task.leaseExpiresAt?.toISOString() ?? null
|
|
2381
2383
|
};
|
|
2382
2384
|
}
|
|
2383
2385
|
function fromDoc(doc) {
|
|
@@ -2400,7 +2402,9 @@ function fromDoc(doc) {
|
|
|
2400
2402
|
createdAt: new Date(doc.createdAt),
|
|
2401
2403
|
startedAt: doc.startedAt ? new Date(doc.startedAt) : void 0,
|
|
2402
2404
|
suspendedAt: doc.suspendedAt ? new Date(doc.suspendedAt) : void 0,
|
|
2403
|
-
completedAt: doc.completedAt ? new Date(doc.completedAt) : void 0
|
|
2405
|
+
completedAt: doc.completedAt ? new Date(doc.completedAt) : void 0,
|
|
2406
|
+
ownerId: doc.ownerId ?? void 0,
|
|
2407
|
+
leaseExpiresAt: doc.leaseExpiresAt ? new Date(doc.leaseExpiresAt) : void 0
|
|
2404
2408
|
};
|
|
2405
2409
|
}
|
|
2406
2410
|
var BackgroundTasksStorageMongoDB = class BackgroundTasksStorageMongoDB extends BackgroundTasksStorage {
|
|
@@ -2517,11 +2521,14 @@ var BackgroundTasksStorageMongoDB = class BackgroundTasksStorageMongoDB extends
|
|
|
2517
2521
|
if ("startedAt" in update) $set.startedAt = update.startedAt?.toISOString() ?? null;
|
|
2518
2522
|
if ("suspendedAt" in update) $set.suspendedAt = update.suspendedAt?.toISOString() ?? null;
|
|
2519
2523
|
if ("completedAt" in update) $set.completedAt = update.completedAt?.toISOString() ?? null;
|
|
2524
|
+
if ("ownerId" in update) $set.ownerId = update.ownerId ?? null;
|
|
2525
|
+
if ("leaseExpiresAt" in update) $set.leaseExpiresAt = update.leaseExpiresAt?.toISOString() ?? null;
|
|
2520
2526
|
if (Object.keys($set).length === 0) return false;
|
|
2521
|
-
|
|
2522
|
-
|
|
2523
|
-
|
|
2524
|
-
|
|
2527
|
+
const filter = { id: taskId };
|
|
2528
|
+
if (options?.expectedStatus) filter.status = options.expectedStatus;
|
|
2529
|
+
if (options?.expectedOwnerId !== void 0) filter.ownerId = options.expectedOwnerId;
|
|
2530
|
+
if (options?.expectedLeaseExpiresAt !== void 0) filter.leaseExpiresAt = options.expectedLeaseExpiresAt?.toISOString() ?? null;
|
|
2531
|
+
return (await (await this.getCollection()).updateOne(filter, { $set })).matchedCount > 0;
|
|
2525
2532
|
}
|
|
2526
2533
|
async getTask(taskId) {
|
|
2527
2534
|
const doc = await (await this.getCollection()).findOne({ id: taskId });
|