@mastra/dynamodb 0.15.10 → 0.15.11-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 +11 -0
- package/dist/entities/index.d.ts +4 -0
- package/dist/entities/index.d.ts.map +1 -1
- package/dist/entities/score.d.ts +4 -0
- package/dist/entities/score.d.ts.map +1 -1
- package/dist/index.cjs +16 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +17 -3
- package/dist/index.js.map +1 -1
- package/dist/storage/domains/memory/index.d.ts.map +1 -1
- package/dist/storage/domains/score/index.d.ts.map +1 -1
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { DynamoDBClient, DescribeTableCommand } from '@aws-sdk/client-dynamodb';
|
|
2
2
|
import { DynamoDBDocumentClient } from '@aws-sdk/lib-dynamodb';
|
|
3
3
|
import { MastraError, ErrorCategory, ErrorDomain } from '@mastra/core/error';
|
|
4
|
-
import { MastraStorage, StoreOperations, TracesStorage, TABLE_TRACES, WorkflowsStorage, MemoryStorage, resolveMessageLimit, ScoresStorage, LegacyEvalsStorage, TABLE_AI_SPANS, TABLE_RESOURCES, TABLE_SCORERS, TABLE_EVALS, TABLE_WORKFLOW_SNAPSHOT, TABLE_MESSAGES, TABLE_THREADS } from '@mastra/core/storage';
|
|
4
|
+
import { MastraStorage, StoreOperations, TracesStorage, TABLE_TRACES, WorkflowsStorage, MemoryStorage, resolveMessageLimit, ScoresStorage, SCORERS_SCHEMA, LegacyEvalsStorage, TABLE_AI_SPANS, TABLE_RESOURCES, TABLE_SCORERS, TABLE_EVALS, TABLE_WORKFLOW_SNAPSHOT, TABLE_MESSAGES, TABLE_THREADS } from '@mastra/core/storage';
|
|
5
5
|
import { Entity, Service } from 'electrodb';
|
|
6
6
|
import { MessageList } from '@mastra/core/agent';
|
|
7
7
|
import { saveScorePayloadSchema } from '@mastra/core/scores';
|
|
@@ -423,6 +423,10 @@ var scoreEntity = new Entity({
|
|
|
423
423
|
return value;
|
|
424
424
|
}
|
|
425
425
|
},
|
|
426
|
+
preprocessPrompt: {
|
|
427
|
+
type: "string",
|
|
428
|
+
required: false
|
|
429
|
+
},
|
|
426
430
|
preprocessStepResult: {
|
|
427
431
|
type: "string",
|
|
428
432
|
required: false,
|
|
@@ -1566,7 +1570,8 @@ var MemoryStorageDynamoDB = class extends MemoryStorage {
|
|
|
1566
1570
|
const paginatedMessages = messages.slice(start, end);
|
|
1567
1571
|
const hasMore = end < total;
|
|
1568
1572
|
const list = new MessageList({ threadId, resourceId }).add(paginatedMessages, "memory");
|
|
1569
|
-
|
|
1573
|
+
let finalMessages = format === "v2" ? list.get.all.v2() : list.get.all.v1();
|
|
1574
|
+
finalMessages = finalMessages.sort((a, b) => new Date(a.createdAt).getTime() - new Date(b.createdAt).getTime());
|
|
1570
1575
|
return {
|
|
1571
1576
|
messages: finalMessages,
|
|
1572
1577
|
total,
|
|
@@ -2157,8 +2162,17 @@ var ScoresStorageDynamoDB = class extends ScoresStorage {
|
|
|
2157
2162
|
}
|
|
2158
2163
|
// Helper function to parse score data (handle JSON fields)
|
|
2159
2164
|
parseScoreData(data) {
|
|
2165
|
+
const result = {};
|
|
2166
|
+
for (const key of Object.keys(SCORERS_SCHEMA)) {
|
|
2167
|
+
if (["traceId", "resourceId", "threadId", "spanId"].includes(key)) {
|
|
2168
|
+
result[key] = data[key] === "" ? null : data[key];
|
|
2169
|
+
continue;
|
|
2170
|
+
}
|
|
2171
|
+
result[key] = data[key];
|
|
2172
|
+
}
|
|
2173
|
+
result.entity = data.entityData ? data.entityData : null;
|
|
2160
2174
|
return {
|
|
2161
|
-
...
|
|
2175
|
+
...result,
|
|
2162
2176
|
// Convert date strings back to Date objects for consistency
|
|
2163
2177
|
createdAt: data.createdAt ? new Date(data.createdAt) : /* @__PURE__ */ new Date(),
|
|
2164
2178
|
updatedAt: data.updatedAt ? new Date(data.updatedAt) : /* @__PURE__ */ new Date()
|