@mastra/mongodb 1.19.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.
- package/dist/docs/SKILL.md +1 -1
- package/dist/docs/assets/SOURCE_MAP.json +1 -1
- package/dist/index.cjs +24 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +24 -8
- 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/dist/storage/domains/skills/index.d.ts.map +1 -1
- package/package.json +3 -3
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-alpha.1";
|
|
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 });
|
|
@@ -11014,7 +11021,7 @@ var MongoDBSkillsStorage = class MongoDBSkillsStorage extends SkillsStorage {
|
|
|
11014
11021
|
}
|
|
11015
11022
|
async list(args) {
|
|
11016
11023
|
try {
|
|
11017
|
-
const { page = 0, perPage: perPageInput, orderBy, authorId, visibility, metadata } = args || {};
|
|
11024
|
+
const { page = 0, perPage: perPageInput, orderBy, authorId, visibility, metadata, status, entityIds } = args || {};
|
|
11018
11025
|
const { field, direction } = this.parseOrderBy(orderBy);
|
|
11019
11026
|
if (page < 0) throw new MastraError({
|
|
11020
11027
|
id: createStorageErrorId("MONGODB", "LIST_SKILLS", "INVALID_PAGE"),
|
|
@@ -11024,8 +11031,17 @@ var MongoDBSkillsStorage = class MongoDBSkillsStorage extends SkillsStorage {
|
|
|
11024
11031
|
}, /* @__PURE__ */ new Error("page must be >= 0"));
|
|
11025
11032
|
const perPage = normalizePerPage(perPageInput, 100);
|
|
11026
11033
|
const { offset, perPage: perPageForResponse } = calculatePagination(page, perPageInput, perPage);
|
|
11034
|
+
if (entityIds && entityIds.length === 0) return {
|
|
11035
|
+
skills: [],
|
|
11036
|
+
total: 0,
|
|
11037
|
+
page,
|
|
11038
|
+
perPage: perPageForResponse,
|
|
11039
|
+
hasMore: false
|
|
11040
|
+
};
|
|
11027
11041
|
const collection = await this.getCollection(TABLE_SKILLS);
|
|
11028
11042
|
const filter = {};
|
|
11043
|
+
if (entityIds && entityIds.length > 0) filter.id = { $in: entityIds };
|
|
11044
|
+
if (status) filter.status = status;
|
|
11029
11045
|
if (authorId) filter.authorId = authorId;
|
|
11030
11046
|
if (visibility) filter.visibility = visibility;
|
|
11031
11047
|
if (metadata) for (const [key, value] of Object.entries(metadata)) filter[`metadata.${key}`] = value;
|