@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.
- package/dist/index.cjs +118 -21
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +119 -22
- package/dist/index.js.map +1 -1
- package/dist/storage/domains/memory/index.d.ts +16 -4
- package/dist/storage/domains/memory/index.d.ts.map +1 -1
- package/dist/storage/domains/operations/index.d.ts.map +1 -1
- package/dist/storage/domains/score/index.d.ts +3 -2
- package/dist/storage/domains/score/index.d.ts.map +1 -1
- package/dist/storage/domains/traces/index.d.ts +1 -1
- package/dist/storage/domains/workflows/index.d.ts +19 -1
- package/dist/storage/domains/workflows/index.d.ts.map +1 -1
- package/dist/storage/index.d.ts +36 -7
- package/dist/storage/index.d.ts.map +1 -1
- package/package.json +9 -8
- package/src/storage/domains/memory/index.ts +113 -20
- package/src/storage/domains/operations/index.ts +2 -0
- package/src/storage/domains/score/index.ts +7 -3
- package/src/storage/domains/workflows/index.ts +38 -1
- package/src/storage/index.ts +67 -12
package/src/storage/index.ts
CHANGED
|
@@ -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(
|
|
258
|
-
return this.stores.memory.getThreadsByResourceId(
|
|
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(
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
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
|
|
476
|
-
|
|
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
|
|
536
|
+
return this.stores.scores.getScoresByScorerId({ scorerId, source, entityId, entityType, pagination });
|
|
482
537
|
}
|
|
483
538
|
}
|