@mastra/dynamodb 0.0.0-update-scorers-api-20250801170445 → 0.0.0-vector-query-tool-provider-options-20250828222356

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.
@@ -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,9 +19,10 @@ 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
- import type { WorkflowRunState } from '@mastra/core/workflows';
25
+ import type { StepResult, WorkflowRunState } from '@mastra/core/workflows';
25
26
  import type { Service } from 'electrodb';
26
27
  import { getElectroDbService } from '../entities';
27
28
  import { LegacyEvalsDynamoDB } from './domains/legacy-evals';
@@ -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
 
@@ -343,6 +358,40 @@ export class DynamoDBStore extends MastraStorage {
343
358
  }
344
359
 
345
360
  // Workflow operations
361
+ async updateWorkflowResults({
362
+ workflowName,
363
+ runId,
364
+ stepId,
365
+ result,
366
+ runtimeContext,
367
+ }: {
368
+ workflowName: string;
369
+ runId: string;
370
+ stepId: string;
371
+ result: StepResult<any, any, any, any>;
372
+ runtimeContext: Record<string, any>;
373
+ }): Promise<Record<string, StepResult<any, any, any, any>>> {
374
+ return this.stores.workflows.updateWorkflowResults({ workflowName, runId, stepId, result, runtimeContext });
375
+ }
376
+
377
+ async updateWorkflowState({
378
+ workflowName,
379
+ runId,
380
+ opts,
381
+ }: {
382
+ workflowName: string;
383
+ runId: string;
384
+ opts: {
385
+ status: string;
386
+ result?: StepResult<any, any, any, any>;
387
+ error?: string;
388
+ suspendedPaths?: Record<string, number[]>;
389
+ waitingPaths?: Record<string, number[]>;
390
+ };
391
+ }): Promise<WorkflowRunState | undefined> {
392
+ return this.stores.workflows.updateWorkflowState({ workflowName, runId, opts });
393
+ }
394
+
346
395
  async persistWorkflowSnapshot({
347
396
  workflowName,
348
397
  runId,
@@ -472,12 +521,18 @@ export class DynamoDBStore extends MastraStorage {
472
521
  }
473
522
 
474
523
  async getScoresByScorerId({
475
- scorerId: _scorerId,
476
- pagination: _pagination,
524
+ scorerId,
525
+ source,
526
+ entityId,
527
+ entityType,
528
+ pagination,
477
529
  }: {
478
530
  scorerId: string;
531
+ entityId?: string;
532
+ entityType?: string;
533
+ source?: ScoringSource;
479
534
  pagination: StoragePagination;
480
535
  }): Promise<{ pagination: PaginationInfo; scores: ScoreRowData[] }> {
481
- return this.stores.scores.getScoresByScorerId({ scorerId: _scorerId, pagination: _pagination });
536
+ return this.stores.scores.getScoresByScorerId({ scorerId, source, entityId, entityType, pagination });
482
537
  }
483
538
  }