@mastra/convex 1.4.0 → 1.5.0-alpha.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/CHANGELOG.md +25 -0
- package/dist/{chunk-2KILIA33.cjs → chunk-PKCUPSKO.cjs} +2 -2
- package/dist/{chunk-2KILIA33.cjs.map → chunk-PKCUPSKO.cjs.map} +1 -1
- package/dist/{chunk-MC2EQATP.js → chunk-SQMTQ7ZD.js} +2 -2
- package/dist/{chunk-MC2EQATP.js.map → chunk-SQMTQ7ZD.js.map} +1 -1
- package/dist/docs/SKILL.md +1 -1
- package/dist/docs/assets/SOURCE_MAP.json +6 -6
- package/dist/index.cjs +12 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +8 -4
- package/dist/index.js.map +1 -1
- package/dist/server/index.cjs +6 -6
- package/dist/server/index.js +1 -1
- package/dist/storage/domains/memory/index.d.ts.map +1 -1
- package/dist/storage/types.d.ts.map +1 -1
- package/package.json +7 -6
package/dist/docs/SKILL.md
CHANGED
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "1.
|
|
2
|
+
"version": "1.5.0-alpha.0",
|
|
3
3
|
"package": "@mastra/convex",
|
|
4
4
|
"exports": {
|
|
5
5
|
"mastraCache": {
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
|
-
"implementation": "dist/chunk-
|
|
7
|
+
"implementation": "dist/chunk-SQMTQ7ZD.js"
|
|
8
8
|
},
|
|
9
9
|
"mastraNativeVectorAction": {
|
|
10
10
|
"types": "dist/index.d.ts",
|
|
11
|
-
"implementation": "dist/chunk-
|
|
11
|
+
"implementation": "dist/chunk-SQMTQ7ZD.js"
|
|
12
12
|
},
|
|
13
13
|
"mastraNativeVectorMutation": {
|
|
14
14
|
"types": "dist/index.d.ts",
|
|
15
|
-
"implementation": "dist/chunk-
|
|
15
|
+
"implementation": "dist/chunk-SQMTQ7ZD.js"
|
|
16
16
|
},
|
|
17
17
|
"mastraNativeVectorQuery": {
|
|
18
18
|
"types": "dist/index.d.ts",
|
|
19
|
-
"implementation": "dist/chunk-
|
|
19
|
+
"implementation": "dist/chunk-SQMTQ7ZD.js"
|
|
20
20
|
},
|
|
21
21
|
"mastraStorage": {
|
|
22
22
|
"types": "dist/index.d.ts",
|
|
23
|
-
"implementation": "dist/chunk-
|
|
23
|
+
"implementation": "dist/chunk-SQMTQ7ZD.js"
|
|
24
24
|
},
|
|
25
25
|
"TABLE_BACKGROUND_TASKS": {
|
|
26
26
|
"types": "dist/index.d.ts",
|
package/dist/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkPKCUPSKO_cjs = require('./chunk-PKCUPSKO.cjs');
|
|
4
4
|
var chunkZCCKLZQH_cjs = require('./chunk-ZCCKLZQH.cjs');
|
|
5
5
|
var cache = require('@mastra/core/cache');
|
|
6
6
|
var storage = require('@mastra/core/storage');
|
|
@@ -1163,6 +1163,7 @@ var MemoryConvex = class extends storage.MemoryStorage {
|
|
|
1163
1163
|
}
|
|
1164
1164
|
async listMessages(args) {
|
|
1165
1165
|
const { threadId, resourceId, include, filter, perPage: perPageInput, page = 0, orderBy } = args;
|
|
1166
|
+
const metadataFilter = storage.validateStorageMetadataFilter(filter?.metadata);
|
|
1166
1167
|
const threadIds = Array.isArray(threadId) ? threadId : [threadId];
|
|
1167
1168
|
if (threadIds.length === 0 || threadIds.some((id) => !id.trim())) {
|
|
1168
1169
|
throw new error.MastraError(
|
|
@@ -1201,6 +1202,7 @@ var MemoryConvex = class extends storage.MemoryStorage {
|
|
|
1201
1202
|
rows = rows.filter((row) => row.resourceId === resourceId);
|
|
1202
1203
|
}
|
|
1203
1204
|
rows = storage.filterByDateRange(rows, (row) => new Date(row.createdAt), filter?.dateRange);
|
|
1205
|
+
rows = rows.filter((row) => storage.storageMessageMatchesMetadataFilter(row.content, metadataFilter));
|
|
1204
1206
|
rows.sort((a, b) => {
|
|
1205
1207
|
const aValue = field === "createdAt" || field === "updatedAt" ? new Date(a[field]).getTime() : a[field];
|
|
1206
1208
|
const bValue = field === "createdAt" || field === "updatedAt" ? new Date(b[field]).getTime() : b[field];
|
|
@@ -1215,7 +1217,7 @@ var MemoryConvex = class extends storage.MemoryStorage {
|
|
|
1215
1217
|
const messageIds = new Set(messages.map((msg) => msg.id));
|
|
1216
1218
|
if (include && include.length > 0) {
|
|
1217
1219
|
const preloadedThreads = /* @__PURE__ */ new Map();
|
|
1218
|
-
if (!resourceId && !filter?.dateRange) {
|
|
1220
|
+
if (!resourceId && !filter?.dateRange && !metadataFilter) {
|
|
1219
1221
|
for (const tid of threadIds) {
|
|
1220
1222
|
preloadedThreads.set(
|
|
1221
1223
|
tid,
|
|
@@ -1232,7 +1234,7 @@ var MemoryConvex = class extends storage.MemoryStorage {
|
|
|
1232
1234
|
}
|
|
1233
1235
|
}
|
|
1234
1236
|
messages = this._sortMessages(messages, field, direction);
|
|
1235
|
-
const hasMore = include && include.length > 0 ? new Set(messages.filter((m) => m.threadId === threadId).map((m) => m.id)).size < totalThreadMessages : perPageInput === false ? false : offset + perPage < totalThreadMessages;
|
|
1237
|
+
const hasMore = metadataFilter ? perPageInput !== false && offset + perPage < totalThreadMessages : include && include.length > 0 ? new Set(messages.filter((m) => m.threadId === threadId).map((m) => m.id)).size < totalThreadMessages : perPageInput === false ? false : offset + perPage < totalThreadMessages;
|
|
1236
1238
|
return {
|
|
1237
1239
|
messages,
|
|
1238
1240
|
total: totalThreadMessages,
|
|
@@ -1243,6 +1245,7 @@ var MemoryConvex = class extends storage.MemoryStorage {
|
|
|
1243
1245
|
}
|
|
1244
1246
|
async listMessagesByResourceId(args) {
|
|
1245
1247
|
const { resourceId, filter, perPage: perPageInput, page = 0, orderBy } = args;
|
|
1248
|
+
const metadataFilter = storage.validateStorageMetadataFilter(filter?.metadata);
|
|
1246
1249
|
const { field, direction } = this.parseOrderBy(orderBy, "ASC");
|
|
1247
1250
|
const perPage = storage.normalizePerPage(perPageInput, 40);
|
|
1248
1251
|
if (page < 0) {
|
|
@@ -1271,6 +1274,7 @@ var MemoryConvex = class extends storage.MemoryStorage {
|
|
|
1271
1274
|
const { offset, perPage: perPageForResponse } = storage.calculatePagination(page, perPageInput, perPage);
|
|
1272
1275
|
let rows = await this.#db.queryTable(storage.TABLE_MESSAGES, [{ field: "resourceId", value: resourceId }]);
|
|
1273
1276
|
rows = storage.filterByDateRange(rows, (row) => new Date(row.createdAt), filter?.dateRange);
|
|
1277
|
+
rows = rows.filter((row) => storage.storageMessageMatchesMetadataFilter(row.content, metadataFilter));
|
|
1274
1278
|
rows = this._sortStoredMessages(rows, field, direction);
|
|
1275
1279
|
const total = rows.length;
|
|
1276
1280
|
const paginatedRows = rows.slice(offset, offset + perPage);
|
|
@@ -2986,23 +2990,23 @@ var ConvexNativeVector = class extends vector.MastraVector {
|
|
|
2986
2990
|
|
|
2987
2991
|
Object.defineProperty(exports, "mastraCache", {
|
|
2988
2992
|
enumerable: true,
|
|
2989
|
-
get: function () { return
|
|
2993
|
+
get: function () { return chunkPKCUPSKO_cjs.mastraCache; }
|
|
2990
2994
|
});
|
|
2991
2995
|
Object.defineProperty(exports, "mastraNativeVectorAction", {
|
|
2992
2996
|
enumerable: true,
|
|
2993
|
-
get: function () { return
|
|
2997
|
+
get: function () { return chunkPKCUPSKO_cjs.mastraNativeVectorAction; }
|
|
2994
2998
|
});
|
|
2995
2999
|
Object.defineProperty(exports, "mastraNativeVectorMutation", {
|
|
2996
3000
|
enumerable: true,
|
|
2997
|
-
get: function () { return
|
|
3001
|
+
get: function () { return chunkPKCUPSKO_cjs.mastraNativeVectorMutation; }
|
|
2998
3002
|
});
|
|
2999
3003
|
Object.defineProperty(exports, "mastraNativeVectorQuery", {
|
|
3000
3004
|
enumerable: true,
|
|
3001
|
-
get: function () { return
|
|
3005
|
+
get: function () { return chunkPKCUPSKO_cjs.mastraNativeVectorQuery; }
|
|
3002
3006
|
});
|
|
3003
3007
|
Object.defineProperty(exports, "mastraStorage", {
|
|
3004
3008
|
enumerable: true,
|
|
3005
|
-
get: function () { return
|
|
3009
|
+
get: function () { return chunkPKCUPSKO_cjs.mastraStorage; }
|
|
3006
3010
|
});
|
|
3007
3011
|
Object.defineProperty(exports, "TABLE_BACKGROUND_TASKS", {
|
|
3008
3012
|
enumerable: true,
|