@mastra/server 0.11.0-alpha.2 → 0.11.0-alpha.3
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/{chunk-AHXXKSOO.js → chunk-R3I7AJVL.js} +7 -1
- package/dist/{chunk-SE2BQ536.cjs → chunk-TTPJHP42.cjs} +7 -1
- package/dist/server/handlers/memory.cjs +14 -14
- package/dist/server/handlers/memory.js +1 -1
- package/dist/server/handlers.cjs +2 -2
- package/dist/server/handlers.js +1 -1
- package/package.json +2 -2
|
@@ -135,9 +135,15 @@ async function saveMessagesHandler({
|
|
|
135
135
|
if (!Array.isArray(body.messages)) {
|
|
136
136
|
throw new HTTPException(400, { message: "Messages should be an array" });
|
|
137
137
|
}
|
|
138
|
+
const invalidMessages = body.messages.filter((message) => !message.threadId || !message.resourceId);
|
|
139
|
+
if (invalidMessages.length > 0) {
|
|
140
|
+
throw new HTTPException(400, {
|
|
141
|
+
message: `All messages must have threadId and resourceId fields. Found ${invalidMessages.length} invalid message(s).`
|
|
142
|
+
});
|
|
143
|
+
}
|
|
138
144
|
const processedMessages = body.messages.map((message) => ({
|
|
139
145
|
...message,
|
|
140
|
-
id: memory.generateId(),
|
|
146
|
+
id: message.id || memory.generateId(),
|
|
141
147
|
createdAt: message.createdAt ? new Date(message.createdAt) : /* @__PURE__ */ new Date()
|
|
142
148
|
}));
|
|
143
149
|
const result = await memory.saveMessages({ messages: processedMessages, memoryConfig: {} });
|
|
@@ -137,9 +137,15 @@ async function saveMessagesHandler({
|
|
|
137
137
|
if (!Array.isArray(body.messages)) {
|
|
138
138
|
throw new chunk2KZFMI6P_cjs.HTTPException(400, { message: "Messages should be an array" });
|
|
139
139
|
}
|
|
140
|
+
const invalidMessages = body.messages.filter((message) => !message.threadId || !message.resourceId);
|
|
141
|
+
if (invalidMessages.length > 0) {
|
|
142
|
+
throw new chunk2KZFMI6P_cjs.HTTPException(400, {
|
|
143
|
+
message: `All messages must have threadId and resourceId fields. Found ${invalidMessages.length} invalid message(s).`
|
|
144
|
+
});
|
|
145
|
+
}
|
|
140
146
|
const processedMessages = body.messages.map((message) => ({
|
|
141
147
|
...message,
|
|
142
|
-
id: memory.generateId(),
|
|
148
|
+
id: message.id || memory.generateId(),
|
|
143
149
|
createdAt: message.createdAt ? new Date(message.createdAt) : /* @__PURE__ */ new Date()
|
|
144
150
|
}));
|
|
145
151
|
const result = await memory.saveMessages({ messages: processedMessages, memoryConfig: {} });
|
|
@@ -1,58 +1,58 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkTTPJHP42_cjs = require('../../chunk-TTPJHP42.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
Object.defineProperty(exports, "createThreadHandler", {
|
|
8
8
|
enumerable: true,
|
|
9
|
-
get: function () { return
|
|
9
|
+
get: function () { return chunkTTPJHP42_cjs.createThreadHandler; }
|
|
10
10
|
});
|
|
11
11
|
Object.defineProperty(exports, "deleteThreadHandler", {
|
|
12
12
|
enumerable: true,
|
|
13
|
-
get: function () { return
|
|
13
|
+
get: function () { return chunkTTPJHP42_cjs.deleteThreadHandler; }
|
|
14
14
|
});
|
|
15
15
|
Object.defineProperty(exports, "getMemoryConfigHandler", {
|
|
16
16
|
enumerable: true,
|
|
17
|
-
get: function () { return
|
|
17
|
+
get: function () { return chunkTTPJHP42_cjs.getMemoryConfigHandler; }
|
|
18
18
|
});
|
|
19
19
|
Object.defineProperty(exports, "getMemoryStatusHandler", {
|
|
20
20
|
enumerable: true,
|
|
21
|
-
get: function () { return
|
|
21
|
+
get: function () { return chunkTTPJHP42_cjs.getMemoryStatusHandler; }
|
|
22
22
|
});
|
|
23
23
|
Object.defineProperty(exports, "getMessagesHandler", {
|
|
24
24
|
enumerable: true,
|
|
25
|
-
get: function () { return
|
|
25
|
+
get: function () { return chunkTTPJHP42_cjs.getMessagesHandler; }
|
|
26
26
|
});
|
|
27
27
|
Object.defineProperty(exports, "getMessagesPaginatedHandler", {
|
|
28
28
|
enumerable: true,
|
|
29
|
-
get: function () { return
|
|
29
|
+
get: function () { return chunkTTPJHP42_cjs.getMessagesPaginatedHandler; }
|
|
30
30
|
});
|
|
31
31
|
Object.defineProperty(exports, "getThreadByIdHandler", {
|
|
32
32
|
enumerable: true,
|
|
33
|
-
get: function () { return
|
|
33
|
+
get: function () { return chunkTTPJHP42_cjs.getThreadByIdHandler; }
|
|
34
34
|
});
|
|
35
35
|
Object.defineProperty(exports, "getThreadsHandler", {
|
|
36
36
|
enumerable: true,
|
|
37
|
-
get: function () { return
|
|
37
|
+
get: function () { return chunkTTPJHP42_cjs.getThreadsHandler; }
|
|
38
38
|
});
|
|
39
39
|
Object.defineProperty(exports, "getWorkingMemoryHandler", {
|
|
40
40
|
enumerable: true,
|
|
41
|
-
get: function () { return
|
|
41
|
+
get: function () { return chunkTTPJHP42_cjs.getWorkingMemoryHandler; }
|
|
42
42
|
});
|
|
43
43
|
Object.defineProperty(exports, "saveMessagesHandler", {
|
|
44
44
|
enumerable: true,
|
|
45
|
-
get: function () { return
|
|
45
|
+
get: function () { return chunkTTPJHP42_cjs.saveMessagesHandler; }
|
|
46
46
|
});
|
|
47
47
|
Object.defineProperty(exports, "searchMemoryHandler", {
|
|
48
48
|
enumerable: true,
|
|
49
|
-
get: function () { return
|
|
49
|
+
get: function () { return chunkTTPJHP42_cjs.searchMemoryHandler; }
|
|
50
50
|
});
|
|
51
51
|
Object.defineProperty(exports, "updateThreadHandler", {
|
|
52
52
|
enumerable: true,
|
|
53
|
-
get: function () { return
|
|
53
|
+
get: function () { return chunkTTPJHP42_cjs.updateThreadHandler; }
|
|
54
54
|
});
|
|
55
55
|
Object.defineProperty(exports, "updateWorkingMemoryHandler", {
|
|
56
56
|
enumerable: true,
|
|
57
|
-
get: function () { return
|
|
57
|
+
get: function () { return chunkTTPJHP42_cjs.updateWorkingMemoryHandler; }
|
|
58
58
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { createThreadHandler, deleteThreadHandler, getMemoryConfigHandler, getMemoryStatusHandler, getMessagesHandler, getMessagesPaginatedHandler, getThreadByIdHandler, getThreadsHandler, getWorkingMemoryHandler, saveMessagesHandler, searchMemoryHandler, updateThreadHandler, updateWorkingMemoryHandler } from '../../chunk-
|
|
1
|
+
export { createThreadHandler, deleteThreadHandler, getMemoryConfigHandler, getMemoryStatusHandler, getMessagesHandler, getMessagesPaginatedHandler, getThreadByIdHandler, getThreadsHandler, getWorkingMemoryHandler, saveMessagesHandler, searchMemoryHandler, updateThreadHandler, updateWorkingMemoryHandler } from '../../chunk-R3I7AJVL.js';
|
package/dist/server/handlers.cjs
CHANGED
|
@@ -11,7 +11,7 @@ var chunkSDPGVWQJ_cjs = require('../chunk-SDPGVWQJ.cjs');
|
|
|
11
11
|
var chunkENPKI53P_cjs = require('../chunk-ENPKI53P.cjs');
|
|
12
12
|
var chunkJMLYCXMK_cjs = require('../chunk-JMLYCXMK.cjs');
|
|
13
13
|
var chunkQGX47B5D_cjs = require('../chunk-QGX47B5D.cjs');
|
|
14
|
-
var
|
|
14
|
+
var chunkTTPJHP42_cjs = require('../chunk-TTPJHP42.cjs');
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
|
|
@@ -61,5 +61,5 @@ Object.defineProperty(exports, "logs", {
|
|
|
61
61
|
});
|
|
62
62
|
Object.defineProperty(exports, "memory", {
|
|
63
63
|
enumerable: true,
|
|
64
|
-
get: function () { return
|
|
64
|
+
get: function () { return chunkTTPJHP42_cjs.memory_exports; }
|
|
65
65
|
});
|
package/dist/server/handlers.js
CHANGED
|
@@ -9,4 +9,4 @@ export { a2a_exports as a2a } from '../chunk-GHC4YV6R.js';
|
|
|
9
9
|
export { agents_exports as agents } from '../chunk-VRJ2TE5J.js';
|
|
10
10
|
export { legacyWorkflows_exports as legacyWorkflows } from '../chunk-5PQQ42EZ.js';
|
|
11
11
|
export { logs_exports as logs } from '../chunk-4D66QEKC.js';
|
|
12
|
-
export { memory_exports as memory } from '../chunk-
|
|
12
|
+
export { memory_exports as memory } from '../chunk-R3I7AJVL.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mastra/server",
|
|
3
|
-
"version": "0.11.0-alpha.
|
|
3
|
+
"version": "0.11.0-alpha.3",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
"zod-to-json-schema": "^3.24.5",
|
|
62
62
|
"@internal/lint": "0.0.20",
|
|
63
63
|
"@internal/storage-test-utils": "0.0.16",
|
|
64
|
-
"@mastra/core": "0.11.0-alpha.
|
|
64
|
+
"@mastra/core": "0.11.0-alpha.3"
|
|
65
65
|
},
|
|
66
66
|
"scripts": {
|
|
67
67
|
"build": "tsup src/index.ts src/server/handlers.ts src/server/handlers/*.ts !src/server/handlers/*.test.ts --format esm,cjs --clean --experimental-dts --treeshake=smallest --splitting",
|