@mastra/dynamodb 1.0.0-beta.7 → 1.0.0-beta.9

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/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, createStorageErrorId, WorkflowsStorage, normalizePerPage, MemoryStorage, calculatePagination, ScoresStorage, SCORERS_SCHEMA, TABLE_THREADS, TABLE_MESSAGES, TABLE_RESOURCES, TABLE_SCORERS, TABLE_WORKFLOW_SNAPSHOT } from '@mastra/core/storage';
4
+ import { MemoryStorage, createStorageErrorId, normalizePerPage, calculatePagination, filterByDateRange, ScoresStorage, SCORERS_SCHEMA, WorkflowsStorage, MastraStorage, TABLE_SCORERS, TABLE_WORKFLOW_SNAPSHOT, TABLE_RESOURCES, 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/evals';
@@ -1277,21 +1277,11 @@ var MemoryStorageDynamoDB = class extends MemoryStorage {
1277
1277
  if (resourceId) {
1278
1278
  allThreadMessages = allThreadMessages.filter((msg) => msg.resourceId === resourceId);
1279
1279
  }
1280
- if (filter?.dateRange) {
1281
- const dateRange = filter.dateRange;
1282
- allThreadMessages = allThreadMessages.filter((msg) => {
1283
- const createdAt = new Date(msg.createdAt).getTime();
1284
- if (dateRange.start) {
1285
- const startTime = dateRange.start instanceof Date ? dateRange.start.getTime() : new Date(dateRange.start).getTime();
1286
- if (createdAt < startTime) return false;
1287
- }
1288
- if (dateRange.end) {
1289
- const endTime = dateRange.end instanceof Date ? dateRange.end.getTime() : new Date(dateRange.end).getTime();
1290
- if (createdAt > endTime) return false;
1291
- }
1292
- return true;
1293
- });
1294
- }
1280
+ allThreadMessages = filterByDateRange(
1281
+ allThreadMessages,
1282
+ (msg) => new Date(msg.createdAt),
1283
+ filter?.dateRange
1284
+ );
1295
1285
  allThreadMessages.sort((a, b) => {
1296
1286
  const aValue = field === "createdAt" ? new Date(a.createdAt).getTime() : a[field];
1297
1287
  const bValue = field === "createdAt" ? new Date(b.createdAt).getTime() : b[field];
@@ -2401,19 +2391,6 @@ var DynamoDBStore = class extends MastraStorage {
2401
2391
  );
2402
2392
  }
2403
2393
  }
2404
- get supports() {
2405
- return {
2406
- selectByIncludeResourceScope: true,
2407
- resourceWorkingMemory: true,
2408
- hasColumn: false,
2409
- createTable: false,
2410
- deleteMessages: true,
2411
- observability: false,
2412
- indexManagement: false,
2413
- listScoresBySpan: true,
2414
- agents: false
2415
- };
2416
- }
2417
2394
  /**
2418
2395
  * Validates that the required DynamoDB table exists and is accessible.
2419
2396
  * This does not check the table structure - it assumes the table
@@ -2504,6 +2481,6 @@ var DynamoDBStore = class extends MastraStorage {
2504
2481
  }
2505
2482
  };
2506
2483
 
2507
- export { DynamoDBStore };
2484
+ export { DynamoDBStore, MemoryStorageDynamoDB, ScoresStorageDynamoDB, WorkflowStorageDynamoDB };
2508
2485
  //# sourceMappingURL=index.js.map
2509
2486
  //# sourceMappingURL=index.js.map