@mastra/dynamodb 0.0.0-zod-v4-compat-part-2-20250822105954 → 0.0.0-zod-v4-stuff-20250825154219

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.
@@ -1,7 +1,7 @@
1
1
  import type { MastraMessageContentV2 } from '@mastra/core/agent';
2
2
  import type { StorageThreadType, MastraMessageV1, MastraMessageV2 } from '@mastra/core/memory';
3
3
  import { MemoryStorage } from '@mastra/core/storage';
4
- import type { PaginationInfo, StorageGetMessagesArg, StorageResourceType } from '@mastra/core/storage';
4
+ import type { PaginationInfo, StorageGetMessagesArg, StorageResourceType, ThreadSortOptions } from '@mastra/core/storage';
5
5
  import type { Service } from 'electrodb';
6
6
  export declare class MemoryStorageDynamoDB extends MemoryStorage {
7
7
  private service;
@@ -9,12 +9,16 @@ export declare class MemoryStorageDynamoDB extends MemoryStorage {
9
9
  service: Service<Record<string, any>>;
10
10
  });
11
11
  private parseMessageData;
12
+ private transformAndSortThreads;
12
13
  getThreadById({ threadId }: {
13
14
  threadId: string;
14
15
  }): Promise<StorageThreadType | null>;
15
- getThreadsByResourceId({ resourceId }: {
16
+ /**
17
+ * @deprecated use getThreadsByResourceIdPaginated instead for paginated results.
18
+ */
19
+ getThreadsByResourceId(args: {
16
20
  resourceId: string;
17
- }): Promise<StorageThreadType[]>;
21
+ } & ThreadSortOptions): Promise<StorageThreadType[]>;
18
22
  saveThread({ thread }: {
19
23
  thread: StorageThreadType;
20
24
  }): Promise<StorageThreadType>;
@@ -32,6 +36,14 @@ export declare class MemoryStorageDynamoDB extends MemoryStorage {
32
36
  getMessages(args: StorageGetMessagesArg & {
33
37
  format: 'v2';
34
38
  }): Promise<MastraMessageV2[]>;
39
+ getMessagesById({ messageIds, format, }: {
40
+ messageIds: string[];
41
+ format: 'v1';
42
+ }): Promise<MastraMessageV1[]>;
43
+ getMessagesById({ messageIds, format, }: {
44
+ messageIds: string[];
45
+ format?: 'v2';
46
+ }): Promise<MastraMessageV2[]>;
35
47
  saveMessages(args: {
36
48
  messages: MastraMessageV1[];
37
49
  format?: undefined | 'v1';
@@ -44,7 +56,7 @@ export declare class MemoryStorageDynamoDB extends MemoryStorage {
44
56
  resourceId: string;
45
57
  page?: number;
46
58
  perPage?: number;
47
- }): Promise<PaginationInfo & {
59
+ } & ThreadSortOptions): Promise<PaginationInfo & {
48
60
  threads: StorageThreadType[];
49
61
  }>;
50
62
  getMessagesPaginated(args: StorageGetMessagesArg & {
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/storage/domains/memory/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAEjE,OAAO,KAAK,EAAE,iBAAiB,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAC/F,OAAO,EAAE,aAAa,EAAuB,MAAM,sBAAsB,CAAC;AAC1E,OAAO,KAAK,EAAE,cAAc,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AACvG,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEzC,qBAAa,qBAAsB,SAAQ,aAAa;IACtD,OAAO,CAAC,OAAO,CAA+B;gBAClC,EAAE,OAAO,EAAE,EAAE;QAAE,OAAO,EAAE,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,CAAA;KAAE;IAMlE,OAAO,CAAC,gBAAgB;IAalB,aAAa,CAAC,EAAE,QAAQ,EAAE,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,iBAAiB,GAAG,IAAI,CAAC;IAgCpF,sBAAsB,CAAC,EAAE,UAAU,EAAE,EAAE;QAAE,UAAU,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,iBAAiB,EAAE,CAAC;IA+B5F,UAAU,CAAC,EAAE,MAAM,EAAE,EAA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GlE,oBAAoB;IA8E5B,cAAc,CAAC,IAAI,EAAE;QACzB,QAAQ,EAAE,OAAO,CAAC,IAAI,CAAC,eAAe,EAAE,WAAW,CAAC,CAAC,GACnD;YACE,EAAE,EAAE,MAAM,CAAC;YACX,OAAO,CAAC,EAAE;gBAAE,QAAQ,CAAC,EAAE,sBAAsB,CAAC,UAAU,CAAC,CAAC;gBAAC,OAAO,CAAC,EAAE,sBAAsB,CAAC,SAAS,CAAC,CAAA;aAAE,CAAC;SAC1G,EAAE,CAAC;KACP,GAAG,OAAO,CAAC,eAAe,EAAE,CAAC;IAoGxB,eAAe,CAAC,EAAE,UAAU,EAAE,EAAE;QAAE,UAAU,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,mBAAmB,GAAG,IAAI,CAAC;IAiC5F,YAAY,CAAC,EAAE,QAAQ,EAAE,EAAE;QAAE,QAAQ,EAAE,mBAAmB,CAAA;KAAE,GAAG,OAAO,CAAC,mBAAmB,CAAC;IAqC3F,cAAc,CAAC,EACnB,UAAU,EACV,aAAa,EACb,QAAQ,GACT,EAAE;QACD,UAAU,EAAE,MAAM,CAAC;QACnB,aAAa,CAAC,EAAE,MAAM,CAAC;QACvB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;KACpC,GAAG,OAAO,CAAC,mBAAmB,CAAC;CA2DjC"}
@@ -1,4 +1,4 @@
1
- import type { ScoreRowData } from '@mastra/core/scores';
1
+ import type { ScoreRowData, ScoringSource } from '@mastra/core/scores';
2
2
  import { ScoresStorage } from '@mastra/core/storage';
3
3
  import type { PaginationInfo, StoragePagination } from '@mastra/core/storage';
4
4
  import type { Service } from 'electrodb';
@@ -14,11 +14,12 @@ export declare class ScoresStorageDynamoDB extends ScoresStorage {
14
14
  saveScore(score: Omit<ScoreRowData, 'id' | 'createdAt' | 'updatedAt'>): Promise<{
15
15
  score: ScoreRowData;
16
16
  }>;
17
- getScoresByScorerId({ scorerId, pagination, entityId, entityType, }: {
17
+ getScoresByScorerId({ scorerId, pagination, entityId, entityType, source, }: {
18
18
  scorerId: string;
19
19
  pagination: StoragePagination;
20
20
  entityId?: string;
21
21
  entityType?: string;
22
+ source?: ScoringSource;
22
23
  }): Promise<{
23
24
  pagination: PaginationInfo;
24
25
  scores: ScoreRowData[];
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/storage/domains/score/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,KAAK,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAC9E,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEzC,qBAAa,qBAAsB,SAAQ,aAAa;IACtD,OAAO,CAAC,OAAO,CAA+B;gBAClC,EAAE,OAAO,EAAE,EAAE;QAAE,OAAO,EAAE,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,CAAA;KAAE;IAMlE,OAAO,CAAC,cAAc;IAUhB,YAAY,CAAC,EAAE,EAAE,EAAE,EAAE;QAAE,EAAE,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC;IAuBlE,SAAS,CAAC,KAAK,EAAE,IAAI,CAAC,YAAY,EAAE,IAAI,GAAG,WAAW,GAAG,WAAW,CAAC,GAAG,OAAO,CAAC;QAAE,KAAK,EAAE,YAAY,CAAA;KAAE,CAAC;IA8DxG,mBAAmB,CAAC,EACxB,QAAQ,EACR,UAAU,EACV,QAAQ,EACR,UAAU,GACX,EAAE;QACD,QAAQ,EAAE,MAAM,CAAC;QACjB,UAAU,EAAE,iBAAiB,CAAC;QAC9B,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,UAAU,CAAC,EAAE,MAAM,CAAC;KACrB,GAA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I,CAAC;IAuBlE,SAAS,CAAC,KAAK,EAAE,IAAI,CAAC,YAAY,EAAE,IAAI,GAAG,WAAW,GAAG,WAAW,CAAC,GAAG,OAAO,CAAC;QAAE,KAAK,EAAE,YAAY,CAAA;KAAE,CAAC;IAiExG,mBAAmB,CAAC,EACxB,QAAQ,EACR,UAAU,EACV,QAAQ,EACR,UAAU,EACV,MAAM,GACP,EAAE;QACD,QAAQ,EAAE,MAAM,CAAC;QACjB,UAAU,EAAE,iBAAiB,CAAC;QAC9B,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,MAAM,CAAC,EAAE,aAAa,CAAC;KACxB,GAAG,OAAO,CAAC;QAAE,UAAU,EAAE,cAAc,CAAC;QAAC,MAAM,EAAE,YAAY,EAAE,CAAA;KAAE,CAAC;IA6D7D,gBAAgB,CAAC,EACrB,KAAK,EACL,UAAU,GACX,EAAE;QACD,KAAK,EAAE,MAAM,CAAC;QACd,UAAU,EAAE,iBAAiB,CAAC;KAC/B,GAAG,OAAO,CAAC;QAAE,UAAU,EAAE,cAAc,CAAC;QAAC,MAAM,EAAE,YAAY,EAAE,CAAA;KAAE,CAAC;IA6C7D,mBAAmB,CAAC,EACxB,QAAQ,EACR,UAAU,EACV,UAAU,GACX,EAAE;QACD,QAAQ,EAAE,MAAM,CAAC;QACjB,UAAU,EAAE,MAAM,CAAC;QACnB,UAAU,EAAE,iBAAiB,CAAC;KAC/B,GAAG,OAAO,CAAC;QAAE,UAAU,EAAE,cAAc,CAAC;QAAC,MAAM,EAAE,YAAY,EAAE,CAAA;KAAE,CAAC;CA+CpE"}
@@ -2,7 +2,7 @@ import { TracesStorage } from '@mastra/core/storage';
2
2
  import type { PaginationInfo, StorageGetTracesPaginatedArg } from '@mastra/core/storage';
3
3
  import type { Trace } from '@mastra/core/telemetry';
4
4
  import type { Service } from 'electrodb';
5
- import type { StoreOperationsDynamoDB } from '../operations';
5
+ import type { StoreOperationsDynamoDB } from '../operations/index.js';
6
6
  export declare class TracesStorageDynamoDB extends TracesStorage {
7
7
  private service;
8
8
  private operations;
@@ -1,8 +1,8 @@
1
1
  import type { MastraMessageContentV2 } from '@mastra/core/agent';
2
2
  import type { StorageThreadType, MastraMessageV2, MastraMessageV1 } from '@mastra/core/memory';
3
- import type { ScoreRowData } from '@mastra/core/scores';
3
+ import type { ScoreRowData, ScoringSource } from '@mastra/core/scores';
4
4
  import { MastraStorage } from '@mastra/core/storage';
5
- import type { EvalRow, StorageGetMessagesArg, WorkflowRun, WorkflowRuns, TABLE_NAMES, StorageGetTracesArg, PaginationInfo, StorageColumn, StoragePagination, StorageDomains, PaginationArgs, StorageResourceType } from '@mastra/core/storage';
5
+ import type { EvalRow, StorageGetMessagesArg, WorkflowRun, WorkflowRuns, TABLE_NAMES, StorageGetTracesArg, PaginationInfo, StorageColumn, StoragePagination, StorageDomains, PaginationArgs, StorageResourceType, ThreadSortOptions } from '@mastra/core/storage';
6
6
  import type { Trace } from '@mastra/core/telemetry';
7
7
  import type { WorkflowRunState } from '@mastra/core/workflows';
8
8
  export interface DynamoDBStoreConfig {
@@ -78,9 +78,9 @@ export declare class DynamoDBStore extends MastraStorage {
78
78
  getThreadById({ threadId }: {
79
79
  threadId: string;
80
80
  }): Promise<StorageThreadType | null>;
81
- getThreadsByResourceId({ resourceId }: {
81
+ getThreadsByResourceId(args: {
82
82
  resourceId: string;
83
- }): Promise<StorageThreadType[]>;
83
+ } & ThreadSortOptions): Promise<StorageThreadType[]>;
84
84
  saveThread({ thread }: {
85
85
  thread: StorageThreadType;
86
86
  }): Promise<StorageThreadType>;
@@ -98,6 +98,14 @@ export declare class DynamoDBStore extends MastraStorage {
98
98
  getMessages(args: StorageGetMessagesArg & {
99
99
  format: 'v2';
100
100
  }): Promise<MastraMessageV2[]>;
101
+ getMessagesById({ messageIds, format }: {
102
+ messageIds: string[];
103
+ format: 'v1';
104
+ }): Promise<MastraMessageV1[]>;
105
+ getMessagesById({ messageIds, format }: {
106
+ messageIds: string[];
107
+ format?: 'v2';
108
+ }): Promise<MastraMessageV2[]>;
101
109
  saveMessages(args: {
102
110
  messages: MastraMessageV1[];
103
111
  format?: undefined | 'v1';
@@ -110,7 +118,7 @@ export declare class DynamoDBStore extends MastraStorage {
110
118
  resourceId: string;
111
119
  page: number;
112
120
  perPage: number;
113
- }): Promise<PaginationInfo & {
121
+ } & ThreadSortOptions): Promise<PaginationInfo & {
114
122
  threads: StorageThreadType[];
115
123
  }>;
116
124
  getMessagesPaginated(args: StorageGetMessagesArg & {
@@ -209,8 +217,11 @@ export declare class DynamoDBStore extends MastraStorage {
209
217
  pagination: PaginationInfo;
210
218
  scores: ScoreRowData[];
211
219
  }>;
212
- getScoresByScorerId({ scorerId: _scorerId, pagination: _pagination, }: {
220
+ getScoresByScorerId({ scorerId, source, entityId, entityType, pagination, }: {
213
221
  scorerId: string;
222
+ entityId?: string;
223
+ entityType?: string;
224
+ source?: ScoringSource;
214
225
  pagination: StoragePagination;
215
226
  }): Promise<{
216
227
  pagination: PaginationInfo;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/storage/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAEjE,OAAO,KAAK,EAAE,iBAAiB,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAE/F,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,KAAK,EACV,OAAO,EACP,qBAAqB,EACrB,WAAW,EACX,YAAY,EACZ,WAAW,EACX,mBAAmB,EACnB,cAAc,EACd,aAAa,EACb,iBAAiB,EACjB,cAAc,EACd,cAAc,EACd,mBAAmB,EACpB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,wBAAwB,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D,KAAK,EAAE,MAAM,CAAC;QACd,UAAU,EAAE,iBAAiB,CAAC;KAC/B,GAAG,OAAO,CAAC;QAAE,UAAU,EAAE,cAAc,CAAC;QAAC,MAAM,EAAE,YAAY,EAAE,CAAA;KAAE,CAAC;IAI7D,mBAAmB,CAAC,EACxB,QAAQ,EAAE,SAAS,EACnB,UAAU,EAAE,WAAW,EACvB,UAAU,EAAE,WAAW,GACxB,EAAE;QACD,UAAU,EAAE,iBAAiB,CAAC;QAC9B,QAAQ,EAAE,MAAM,CAAC;QACjB,UAAU,EAAE,MAAM,CAAC;KACpB,GAAG,OAAO,CAAC;QAAE,UAAU,EAAE,cAAc,CAAC;QAAC,MAAM,EAAE,YAAY,EAAE,CAAA;KAAE,CAAC;IAQ7D,mBAAmB,CAAC,EACxB,QAAQ,EACR,MAAM,EACN,QAAQ,EACR,UAAU,EACV,UAAU,GACX,EAAE;QACD,QAAQ,EAAE,MAAM,CAAC;QACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,MAAM,CAAC,EAAE,aAAa,CAAC;QACvB,UAAU,EAAE,iBAAiB,CAAC;KAC/B,GAAG,OAAO,CAAC;QAAE,UAAU,EAAE,cAAc,CAAC;QAAC,MAAM,EAAE,YAAY,EAAE,CAAA;KAAE,CAAC;CAGpE"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mastra/dynamodb",
3
- "version": "0.0.0-zod-v4-compat-part-2-20250822105954",
3
+ "version": "0.0.0-zod-v4-stuff-20250825154219",
4
4
  "description": "DynamoDB storage adapter for Mastra",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -12,7 +12,7 @@
12
12
  "default": "./dist/index.js"
13
13
  },
14
14
  "require": {
15
- "types": "./dist/index.d.cts",
15
+ "types": "./dist/index.d.ts",
16
16
  "default": "./dist/index.cjs"
17
17
  }
18
18
  },
@@ -23,12 +23,12 @@
23
23
  "src"
24
24
  ],
25
25
  "dependencies": {
26
- "@aws-sdk/client-dynamodb": "^3.848.0",
27
- "@aws-sdk/lib-dynamodb": "^3.840.0",
26
+ "@aws-sdk/client-dynamodb": "^3.859.0",
27
+ "@aws-sdk/lib-dynamodb": "^3.859.0",
28
28
  "electrodb": "^3.4.3"
29
29
  },
30
30
  "peerDependencies": {
31
- "@mastra/core": "0.0.0-zod-v4-compat-part-2-20250822105954"
31
+ "@mastra/core": "0.0.0-zod-v4-stuff-20250825154219"
32
32
  },
33
33
  "devDependencies": {
34
34
  "@microsoft/api-extractor": "^7.52.8",
@@ -40,9 +40,10 @@
40
40
  "tsup": "^8.5.0",
41
41
  "typescript": "^5.8.3",
42
42
  "vitest": "^3.2.4",
43
- "@internal/lint": "0.0.0-zod-v4-compat-part-2-20250822105954",
44
- "@internal/storage-test-utils": "0.0.22",
45
- "@mastra/core": "0.0.0-zod-v4-compat-part-2-20250822105954"
43
+ "@internal/storage-test-utils": "0.0.27",
44
+ "@mastra/core": "0.0.0-zod-v4-stuff-20250825154219",
45
+ "@internal/types-builder": "0.0.0-zod-v4-stuff-20250825154219",
46
+ "@internal/lint": "0.0.0-zod-v4-stuff-20250825154219"
46
47
  },
47
48
  "scripts": {
48
49
  "build": "tsup --silent --config tsup.config.ts",
@@ -73,6 +73,28 @@ export const scoreEntity = new Entity({
73
73
  return value;
74
74
  },
75
75
  },
76
+ preprocessStepResult: {
77
+ type: 'string',
78
+ required: false,
79
+ set: (value?: Record<string, unknown> | string) => {
80
+ if (value && typeof value !== 'string') {
81
+ return JSON.stringify(value);
82
+ }
83
+ return value;
84
+ },
85
+ get: (value?: string) => {
86
+ if (value && typeof value === 'string') {
87
+ try {
88
+ if (value.startsWith('{') || value.startsWith('[')) {
89
+ return JSON.parse(value);
90
+ }
91
+ } catch {
92
+ return value;
93
+ }
94
+ }
95
+ return value;
96
+ },
97
+ },
76
98
  analyzeStepResult: {
77
99
  type: 'string',
78
100
  required: false,
@@ -111,10 +133,20 @@ export const scoreEntity = new Entity({
111
133
  type: 'string',
112
134
  required: false,
113
135
  },
136
+
137
+ // Deprecated in favor of generateReasonPrompt
114
138
  reasonPrompt: {
115
139
  type: 'string',
116
140
  required: false,
117
141
  },
142
+ generateScorePrompt: {
143
+ type: 'string',
144
+ required: false,
145
+ },
146
+ generateReasonPrompt: {
147
+ type: 'string',
148
+ required: false,
149
+ },
118
150
  input: {
119
151
  type: 'string',
120
152
  required: true,
@@ -3,7 +3,12 @@ import type { MastraMessageContentV2 } from '@mastra/core/agent';
3
3
  import { ErrorCategory, ErrorDomain, MastraError } from '@mastra/core/error';
4
4
  import type { StorageThreadType, MastraMessageV1, MastraMessageV2 } from '@mastra/core/memory';
5
5
  import { MemoryStorage, resolveMessageLimit } from '@mastra/core/storage';
6
- import type { PaginationInfo, StorageGetMessagesArg, StorageResourceType } from '@mastra/core/storage';
6
+ import type {
7
+ PaginationInfo,
8
+ StorageGetMessagesArg,
9
+ StorageResourceType,
10
+ ThreadSortOptions,
11
+ } from '@mastra/core/storage';
7
12
  import type { Service } from 'electrodb';
8
13
 
9
14
  export class MemoryStorageDynamoDB extends MemoryStorage {
@@ -27,6 +32,24 @@ export class MemoryStorageDynamoDB extends MemoryStorage {
27
32
  };
28
33
  }
29
34
 
35
+ // Helper function to transform and sort threads
36
+ private transformAndSortThreads(rawThreads: any[], orderBy: string, sortDirection: string): StorageThreadType[] {
37
+ return rawThreads
38
+ .map((data: any) => ({
39
+ ...data,
40
+ // Convert date strings back to Date objects for consistency
41
+ createdAt: typeof data.createdAt === 'string' ? new Date(data.createdAt) : data.createdAt,
42
+ updatedAt: typeof data.updatedAt === 'string' ? new Date(data.updatedAt) : data.updatedAt,
43
+ }))
44
+ .sort((a: StorageThreadType, b: StorageThreadType) => {
45
+ const fieldA = orderBy === 'createdAt' ? a.createdAt : a.updatedAt;
46
+ const fieldB = orderBy === 'createdAt' ? b.createdAt : b.updatedAt;
47
+
48
+ const comparison = fieldA.getTime() - fieldB.getTime();
49
+ return sortDirection === 'DESC' ? -comparison : comparison;
50
+ }) as StorageThreadType[];
51
+ }
52
+
30
53
  async getThreadById({ threadId }: { threadId: string }): Promise<StorageThreadType | null> {
31
54
  this.logger.debug('Getting thread by ID', { threadId });
32
55
  try {
@@ -59,8 +82,16 @@ export class MemoryStorageDynamoDB extends MemoryStorage {
59
82
  }
60
83
  }
61
84
 
62
- async getThreadsByResourceId({ resourceId }: { resourceId: string }): Promise<StorageThreadType[]> {
63
- this.logger.debug('Getting threads by resource ID', { resourceId });
85
+ /**
86
+ * @deprecated use getThreadsByResourceIdPaginated instead for paginated results.
87
+ */
88
+ public async getThreadsByResourceId(args: { resourceId: string } & ThreadSortOptions): Promise<StorageThreadType[]> {
89
+ const resourceId = args.resourceId;
90
+ const orderBy = this.castThreadOrderBy(args.orderBy);
91
+ const sortDirection = this.castThreadSortDirection(args.sortDirection);
92
+
93
+ this.logger.debug('Getting threads by resource ID', { resourceId, orderBy, sortDirection });
94
+
64
95
  try {
65
96
  const result = await this.service.entities.thread.query.byResource({ entity: 'thread', resourceId }).go();
66
97
 
@@ -68,15 +99,8 @@ export class MemoryStorageDynamoDB extends MemoryStorage {
68
99
  return [];
69
100
  }
70
101
 
71
- // ElectroDB handles the transformation with attribute getters
72
- return result.data.map((data: any) => ({
73
- ...data,
74
- // Convert date strings back to Date objects for consistency
75
- createdAt: typeof data.createdAt === 'string' ? new Date(data.createdAt) : data.createdAt,
76
- updatedAt: typeof data.updatedAt === 'string' ? new Date(data.updatedAt) : data.updatedAt,
77
- // metadata: data.metadata ? JSON.parse(data.metadata) : undefined, // REMOVED by AI
78
- // metadata is already transformed by the entity's getter
79
- })) as StorageThreadType[];
102
+ // Use shared helper method for transformation and sorting
103
+ return this.transformAndSortThreads(result.data, orderBy, sortDirection);
80
104
  } catch (error) {
81
105
  throw new MastraError(
82
106
  {
@@ -101,7 +125,7 @@ export class MemoryStorageDynamoDB extends MemoryStorage {
101
125
  resourceId: thread.resourceId,
102
126
  title: thread.title || `Thread ${thread.id}`,
103
127
  createdAt: thread.createdAt?.toISOString() || now.toISOString(),
104
- updatedAt: now.toISOString(),
128
+ updatedAt: thread.updatedAt?.toISOString() || now.toISOString(),
105
129
  metadata: thread.metadata ? JSON.stringify(thread.metadata) : undefined,
106
130
  };
107
131
 
@@ -326,6 +350,62 @@ export class MemoryStorageDynamoDB extends MemoryStorage {
326
350
  }
327
351
  }
328
352
 
353
+ public async getMessagesById({
354
+ messageIds,
355
+ format,
356
+ }: {
357
+ messageIds: string[];
358
+ format: 'v1';
359
+ }): Promise<MastraMessageV1[]>;
360
+ public async getMessagesById({
361
+ messageIds,
362
+ format,
363
+ }: {
364
+ messageIds: string[];
365
+ format?: 'v2';
366
+ }): Promise<MastraMessageV2[]>;
367
+ public async getMessagesById({
368
+ messageIds,
369
+ format,
370
+ }: {
371
+ messageIds: string[];
372
+ format?: 'v1' | 'v2';
373
+ }): Promise<MastraMessageV1[] | MastraMessageV2[]> {
374
+ this.logger.debug('Getting messages by ID', { messageIds });
375
+ if (messageIds.length === 0) return [];
376
+
377
+ try {
378
+ const results = await Promise.all(
379
+ messageIds.map(id => this.service.entities.message.query.primary({ entity: 'message', id }).go()),
380
+ );
381
+
382
+ const data = results.map(result => result.data).flat(1);
383
+
384
+ let parsedMessages = data
385
+ .map((data: any) => this.parseMessageData(data))
386
+ .filter((msg: any): msg is MastraMessageV2 => 'content' in msg);
387
+
388
+ // Deduplicate messages by ID (like libsql)
389
+ const uniqueMessages = parsedMessages.filter(
390
+ (message, index, self) => index === self.findIndex(m => m.id === message.id),
391
+ );
392
+
393
+ const list = new MessageList().add(uniqueMessages, 'memory');
394
+ if (format === `v1`) return list.get.all.v1();
395
+ return list.get.all.v2();
396
+ } catch (error) {
397
+ throw new MastraError(
398
+ {
399
+ id: 'STORAGE_DYNAMODB_STORE_GET_MESSAGES_BY_ID_FAILED',
400
+ domain: ErrorDomain.STORAGE,
401
+ category: ErrorCategory.THIRD_PARTY,
402
+ details: { messageIds: JSON.stringify(messageIds) },
403
+ },
404
+ error,
405
+ );
406
+ }
407
+ }
408
+
329
409
  async saveMessages(args: { messages: MastraMessageV1[]; format?: undefined | 'v1' }): Promise<MastraMessageV1[]>;
330
410
  async saveMessages(args: { messages: MastraMessageV2[]; format: 'v2' }): Promise<MastraMessageV2[]>;
331
411
  async saveMessages(
@@ -417,13 +497,24 @@ export class MemoryStorageDynamoDB extends MemoryStorage {
417
497
  }
418
498
  }
419
499
 
420
- async getThreadsByResourceIdPaginated(args: {
421
- resourceId: string;
422
- page?: number;
423
- perPage?: number;
424
- }): Promise<PaginationInfo & { threads: StorageThreadType[] }> {
500
+ async getThreadsByResourceIdPaginated(
501
+ args: {
502
+ resourceId: string;
503
+ page?: number;
504
+ perPage?: number;
505
+ } & ThreadSortOptions,
506
+ ): Promise<PaginationInfo & { threads: StorageThreadType[] }> {
425
507
  const { resourceId, page = 0, perPage = 100 } = args;
426
- this.logger.debug('Getting threads by resource ID with pagination', { resourceId, page, perPage });
508
+ const orderBy = this.castThreadOrderBy(args.orderBy);
509
+ const sortDirection = this.castThreadSortDirection(args.sortDirection);
510
+
511
+ this.logger.debug('Getting threads by resource ID with pagination', {
512
+ resourceId,
513
+ page,
514
+ perPage,
515
+ orderBy,
516
+ sortDirection,
517
+ });
427
518
 
428
519
  try {
429
520
  // Query threads by resource ID using the GSI
@@ -431,7 +522,9 @@ export class MemoryStorageDynamoDB extends MemoryStorage {
431
522
 
432
523
  // Get all threads for this resource ID (DynamoDB doesn't support OFFSET/LIMIT)
433
524
  const results = await query.go();
434
- const allThreads = results.data;
525
+
526
+ // Use shared helper method for transformation and sorting
527
+ const allThreads = this.transformAndSortThreads(results.data, orderBy, sortDirection);
435
528
 
436
529
  // Apply pagination in memory
437
530
  const startIndex = page * perPage;
@@ -1,5 +1,5 @@
1
1
  import { ErrorCategory, ErrorDomain, MastraError } from '@mastra/core/error';
2
- import type { ScoreRowData } from '@mastra/core/scores';
2
+ import type { ScoreRowData, ScoringSource } from '@mastra/core/scores';
3
3
  import { ScoresStorage } from '@mastra/core/storage';
4
4
  import type { PaginationInfo, StoragePagination } from '@mastra/core/storage';
5
5
  import type { Service } from 'electrodb';
@@ -58,13 +58,16 @@ export class ScoresStorageDynamoDB extends ScoresStorage {
58
58
  traceId: score.traceId || '',
59
59
  runId: score.runId,
60
60
  scorer: typeof score.scorer === 'string' ? score.scorer : JSON.stringify(score.scorer),
61
- extractStepResult:
62
- typeof score.extractStepResult === 'string' ? score.extractStepResult : JSON.stringify(score.extractStepResult),
61
+ preprocessStepResult:
62
+ typeof score.preprocessStepResult === 'string'
63
+ ? score.preprocessStepResult
64
+ : JSON.stringify(score.preprocessStepResult),
63
65
  analyzeStepResult:
64
66
  typeof score.analyzeStepResult === 'string' ? score.analyzeStepResult : JSON.stringify(score.analyzeStepResult),
65
67
  score: score.score,
66
68
  reason: score.reason,
67
- extractPrompt: score.extractPrompt,
69
+ preprocessPrompt: score.preprocessPrompt,
70
+ generateScorePrompt: score.generateScorePrompt,
68
71
  analyzePrompt: score.analyzePrompt,
69
72
  reasonPrompt: score.reasonPrompt,
70
73
  input: typeof score.input === 'string' ? score.input : JSON.stringify(score.input),
@@ -112,14 +115,14 @@ export class ScoresStorageDynamoDB extends ScoresStorage {
112
115
  pagination,
113
116
  entityId,
114
117
  entityType,
118
+ source,
115
119
  }: {
116
120
  scorerId: string;
117
121
  pagination: StoragePagination;
118
122
  entityId?: string;
119
123
  entityType?: string;
124
+ source?: ScoringSource;
120
125
  }): Promise<{ pagination: PaginationInfo; scores: ScoreRowData[] }> {
121
- this.logger.debug('Getting scores by scorer ID', { scorerId, pagination, entityId, entityType });
122
-
123
126
  try {
124
127
  // Query scores by scorer ID using the GSI
125
128
  const query = this.service.entities.score.query.byScorer({ entity: 'score', scorerId });
@@ -135,6 +138,9 @@ export class ScoresStorageDynamoDB extends ScoresStorage {
135
138
  if (entityType) {
136
139
  allScores = allScores.filter((score: ScoreRowData) => score.entityType === entityType);
137
140
  }
141
+ if (source) {
142
+ allScores = allScores.filter((score: ScoreRowData) => score.source === source);
143
+ }
138
144
 
139
145
  // Sort by createdAt DESC (newest first)
140
146
  allScores.sort((a: ScoreRowData, b: ScoreRowData) => b.createdAt.getTime() - a.createdAt.getTime());
@@ -167,6 +173,7 @@ export class ScoresStorageDynamoDB extends ScoresStorage {
167
173
  scorerId: scorerId || '',
168
174
  entityId: entityId || '',
169
175
  entityType: entityType || '',
176
+ source: source || '',
170
177
  page: pagination.page,
171
178
  perPage: pagination.perPage,
172
179
  },
@@ -4,7 +4,7 @@ import type { MastraMessageContentV2 } from '@mastra/core/agent';
4
4
  import { ErrorCategory, ErrorDomain, MastraError } from '@mastra/core/error';
5
5
  import type { StorageThreadType, MastraMessageV2, MastraMessageV1 } from '@mastra/core/memory';
6
6
 
7
- import type { ScoreRowData } from '@mastra/core/scores';
7
+ import type { ScoreRowData, ScoringSource } from '@mastra/core/scores';
8
8
  import { MastraStorage } from '@mastra/core/storage';
9
9
  import type {
10
10
  EvalRow,
@@ -19,6 +19,7 @@ import type {
19
19
  StorageDomains,
20
20
  PaginationArgs,
21
21
  StorageResourceType,
22
+ ThreadSortOptions,
22
23
  } from '@mastra/core/storage';
23
24
  import type { Trace } from '@mastra/core/telemetry';
24
25
  import type { WorkflowRunState } from '@mastra/core/workflows';
@@ -254,8 +255,8 @@ export class DynamoDBStore extends MastraStorage {
254
255
  return this.stores.memory.getThreadById({ threadId });
255
256
  }
256
257
 
257
- async getThreadsByResourceId({ resourceId }: { resourceId: string }): Promise<StorageThreadType[]> {
258
- return this.stores.memory.getThreadsByResourceId({ resourceId });
258
+ async getThreadsByResourceId(args: { resourceId: string } & ThreadSortOptions): Promise<StorageThreadType[]> {
259
+ return this.stores.memory.getThreadsByResourceId(args);
259
260
  }
260
261
 
261
262
  async saveThread({ thread }: { thread: StorageThreadType }): Promise<StorageThreadType> {
@@ -290,6 +291,18 @@ export class DynamoDBStore extends MastraStorage {
290
291
  return this.stores.memory.getMessages({ threadId, resourceId, selectBy, format });
291
292
  }
292
293
 
294
+ async getMessagesById({ messageIds, format }: { messageIds: string[]; format: 'v1' }): Promise<MastraMessageV1[]>;
295
+ async getMessagesById({ messageIds, format }: { messageIds: string[]; format?: 'v2' }): Promise<MastraMessageV2[]>;
296
+ async getMessagesById({
297
+ messageIds,
298
+ format,
299
+ }: {
300
+ messageIds: string[];
301
+ format?: 'v1' | 'v2';
302
+ }): Promise<MastraMessageV1[] | MastraMessageV2[]> {
303
+ return this.stores.memory.getMessagesById({ messageIds, format });
304
+ }
305
+
293
306
  async saveMessages(args: { messages: MastraMessageV1[]; format?: undefined | 'v1' }): Promise<MastraMessageV1[]>;
294
307
  async saveMessages(args: { messages: MastraMessageV2[]; format: 'v2' }): Promise<MastraMessageV2[]>;
295
308
  async saveMessages(
@@ -298,11 +311,13 @@ export class DynamoDBStore extends MastraStorage {
298
311
  return this.stores.memory.saveMessages(args);
299
312
  }
300
313
 
301
- async getThreadsByResourceIdPaginated(args: {
302
- resourceId: string;
303
- page: number;
304
- perPage: number;
305
- }): Promise<PaginationInfo & { threads: StorageThreadType[] }> {
314
+ async getThreadsByResourceIdPaginated(
315
+ args: {
316
+ resourceId: string;
317
+ page: number;
318
+ perPage: number;
319
+ } & ThreadSortOptions,
320
+ ): Promise<PaginationInfo & { threads: StorageThreadType[] }> {
306
321
  return this.stores.memory.getThreadsByResourceIdPaginated(args);
307
322
  }
308
323
 
@@ -472,12 +487,18 @@ export class DynamoDBStore extends MastraStorage {
472
487
  }
473
488
 
474
489
  async getScoresByScorerId({
475
- scorerId: _scorerId,
476
- pagination: _pagination,
490
+ scorerId,
491
+ source,
492
+ entityId,
493
+ entityType,
494
+ pagination,
477
495
  }: {
478
496
  scorerId: string;
497
+ entityId?: string;
498
+ entityType?: string;
499
+ source?: ScoringSource;
479
500
  pagination: StoragePagination;
480
501
  }): Promise<{ pagination: PaginationInfo; scores: ScoreRowData[] }> {
481
- return this.stores.scores.getScoresByScorerId({ scorerId: _scorerId, pagination: _pagination });
502
+ return this.stores.scores.getScoresByScorerId({ scorerId, source, entityId, entityType, pagination });
482
503
  }
483
504
  }