@mastra/dynamodb 0.13.3 → 0.14.0-alpha.1

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.
Files changed (46) hide show
  1. package/dist/entities/eval.d.ts +102 -0
  2. package/dist/entities/eval.d.ts.map +1 -0
  3. package/dist/entities/index.d.ts +746 -0
  4. package/dist/entities/index.d.ts.map +1 -0
  5. package/dist/entities/message.d.ts +100 -0
  6. package/dist/entities/message.d.ts.map +1 -0
  7. package/dist/entities/resource.d.ts +54 -0
  8. package/dist/entities/resource.d.ts.map +1 -0
  9. package/dist/entities/score.d.ts +229 -0
  10. package/dist/entities/score.d.ts.map +1 -0
  11. package/dist/entities/thread.d.ts +69 -0
  12. package/dist/entities/thread.d.ts.map +1 -0
  13. package/dist/entities/trace.d.ts +127 -0
  14. package/dist/entities/trace.d.ts.map +1 -0
  15. package/dist/entities/utils.d.ts +21 -0
  16. package/dist/entities/utils.d.ts.map +1 -0
  17. package/dist/entities/workflow-snapshot.d.ts +74 -0
  18. package/dist/entities/workflow-snapshot.d.ts.map +1 -0
  19. package/dist/index.cjs +71 -16
  20. package/dist/index.cjs.map +1 -0
  21. package/dist/index.d.ts +2 -2
  22. package/dist/index.d.ts.map +1 -0
  23. package/dist/index.js +71 -16
  24. package/dist/index.js.map +1 -0
  25. package/dist/storage/domains/legacy-evals/index.d.ts +19 -0
  26. package/dist/storage/domains/legacy-evals/index.d.ts.map +1 -0
  27. package/dist/storage/domains/memory/index.d.ts +81 -0
  28. package/dist/storage/domains/memory/index.d.ts.map +1 -0
  29. package/dist/storage/domains/operations/index.d.ts +69 -0
  30. package/dist/storage/domains/operations/index.d.ts.map +1 -0
  31. package/dist/storage/domains/score/index.d.ts +42 -0
  32. package/dist/storage/domains/score/index.d.ts.map +1 -0
  33. package/dist/storage/domains/traces/index.d.ts +28 -0
  34. package/dist/storage/domains/traces/index.d.ts.map +1 -0
  35. package/dist/storage/domains/workflows/index.d.ts +32 -0
  36. package/dist/storage/domains/workflows/index.d.ts.map +1 -0
  37. package/dist/storage/index.d.ts +220 -0
  38. package/dist/storage/index.d.ts.map +1 -0
  39. package/package.json +9 -8
  40. package/src/entities/score.ts +32 -0
  41. package/src/storage/domains/memory/index.ts +56 -19
  42. package/src/storage/domains/score/index.ts +6 -3
  43. package/src/storage/index.ts +10 -7
  44. package/dist/_tsup-dts-rollup.d.cts +0 -1977
  45. package/dist/_tsup-dts-rollup.d.ts +0 -1977
  46. package/dist/index.d.cts +0 -2
@@ -0,0 +1,81 @@
1
+ import type { MastraMessageContentV2 } from '@mastra/core/agent';
2
+ import type { StorageThreadType, MastraMessageV1, MastraMessageV2 } from '@mastra/core/memory';
3
+ import { MemoryStorage } from '@mastra/core/storage';
4
+ import type { PaginationInfo, StorageGetMessagesArg, StorageResourceType, ThreadSortOptions } from '@mastra/core/storage';
5
+ import type { Service } from 'electrodb';
6
+ export declare class MemoryStorageDynamoDB extends MemoryStorage {
7
+ private service;
8
+ constructor({ service }: {
9
+ service: Service<Record<string, any>>;
10
+ });
11
+ private parseMessageData;
12
+ private transformAndSortThreads;
13
+ getThreadById({ threadId }: {
14
+ threadId: string;
15
+ }): Promise<StorageThreadType | null>;
16
+ /**
17
+ * @deprecated use getThreadsByResourceIdPaginated instead for paginated results.
18
+ */
19
+ getThreadsByResourceId(args: {
20
+ resourceId: string;
21
+ } & ThreadSortOptions): Promise<StorageThreadType[]>;
22
+ saveThread({ thread }: {
23
+ thread: StorageThreadType;
24
+ }): Promise<StorageThreadType>;
25
+ updateThread({ id, title, metadata, }: {
26
+ id: string;
27
+ title: string;
28
+ metadata: Record<string, unknown>;
29
+ }): Promise<StorageThreadType>;
30
+ deleteThread({ threadId }: {
31
+ threadId: string;
32
+ }): Promise<void>;
33
+ getMessages(args: StorageGetMessagesArg & {
34
+ format?: 'v1';
35
+ }): Promise<MastraMessageV1[]>;
36
+ getMessages(args: StorageGetMessagesArg & {
37
+ format: 'v2';
38
+ }): Promise<MastraMessageV2[]>;
39
+ saveMessages(args: {
40
+ messages: MastraMessageV1[];
41
+ format?: undefined | 'v1';
42
+ }): Promise<MastraMessageV1[]>;
43
+ saveMessages(args: {
44
+ messages: MastraMessageV2[];
45
+ format: 'v2';
46
+ }): Promise<MastraMessageV2[]>;
47
+ getThreadsByResourceIdPaginated(args: {
48
+ resourceId: string;
49
+ page?: number;
50
+ perPage?: number;
51
+ } & ThreadSortOptions): Promise<PaginationInfo & {
52
+ threads: StorageThreadType[];
53
+ }>;
54
+ getMessagesPaginated(args: StorageGetMessagesArg & {
55
+ format?: 'v1' | 'v2';
56
+ }): Promise<PaginationInfo & {
57
+ messages: MastraMessageV1[] | MastraMessageV2[];
58
+ }>;
59
+ private _getIncludedMessages;
60
+ updateMessages(args: {
61
+ messages: Partial<Omit<MastraMessageV2, 'createdAt'>> & {
62
+ id: string;
63
+ content?: {
64
+ metadata?: MastraMessageContentV2['metadata'];
65
+ content?: MastraMessageContentV2['content'];
66
+ };
67
+ }[];
68
+ }): Promise<MastraMessageV2[]>;
69
+ getResourceById({ resourceId }: {
70
+ resourceId: string;
71
+ }): Promise<StorageResourceType | null>;
72
+ saveResource({ resource }: {
73
+ resource: StorageResourceType;
74
+ }): Promise<StorageResourceType>;
75
+ updateResource({ resourceId, workingMemory, metadata, }: {
76
+ resourceId: string;
77
+ workingMemory?: string;
78
+ metadata?: Record<string, unknown>;
79
+ }): Promise<StorageResourceType>;
80
+ }
81
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +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,EACV,c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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"}
@@ -0,0 +1,69 @@
1
+ import type { DynamoDBDocumentClient } from '@aws-sdk/lib-dynamodb';
2
+ import { StoreOperations } from '@mastra/core/storage';
3
+ import type { StorageColumn, TABLE_NAMES } from '@mastra/core/storage';
4
+ import type { Service } from 'electrodb';
5
+ export declare class StoreOperationsDynamoDB extends StoreOperations {
6
+ client: DynamoDBDocumentClient;
7
+ tableName: string;
8
+ service: Service<Record<string, any>>;
9
+ constructor({ service, tableName, client, }: {
10
+ service: Service<Record<string, any>>;
11
+ tableName: string;
12
+ client: DynamoDBDocumentClient;
13
+ });
14
+ hasColumn(): Promise<boolean>;
15
+ dropTable(): Promise<void>;
16
+ private getEntityNameForTable;
17
+ /**
18
+ * Pre-processes a record to ensure Date objects are converted to ISO strings
19
+ * This is necessary because ElectroDB validation happens before setters are applied
20
+ */
21
+ private preprocessRecord;
22
+ /**
23
+ * Validates that the required DynamoDB table exists and is accessible.
24
+ * This does not check the table structure - it assumes the table
25
+ * was created with the correct structure via CDK/CloudFormation.
26
+ */
27
+ private validateTableExists;
28
+ /**
29
+ * This method is modified for DynamoDB with ElectroDB single-table design.
30
+ * It assumes the table is created and managed externally via CDK/CloudFormation.
31
+ *
32
+ * This implementation only validates that the required table exists and is accessible.
33
+ * No table creation is attempted - we simply check if we can access the table.
34
+ */
35
+ createTable({ tableName }: {
36
+ tableName: TABLE_NAMES;
37
+ schema: Record<string, any>;
38
+ }): Promise<void>;
39
+ insert({ tableName, record }: {
40
+ tableName: TABLE_NAMES;
41
+ record: Record<string, any>;
42
+ }): Promise<void>;
43
+ alterTable(_args: {
44
+ tableName: TABLE_NAMES;
45
+ schema: Record<string, StorageColumn>;
46
+ ifNotExists: string[];
47
+ }): Promise<void>;
48
+ /**
49
+ * Clear all items from a logical "table" (entity type)
50
+ */
51
+ clearTable({ tableName }: {
52
+ tableName: TABLE_NAMES;
53
+ }): Promise<void>;
54
+ /**
55
+ * Insert multiple records as a batch
56
+ */
57
+ batchInsert({ tableName, records }: {
58
+ tableName: TABLE_NAMES;
59
+ records: Record<string, any>[];
60
+ }): Promise<void>;
61
+ /**
62
+ * Load a record by its keys
63
+ */
64
+ load<R>({ tableName, keys }: {
65
+ tableName: TABLE_NAMES;
66
+ keys: Record<string, string>;
67
+ }): Promise<R | null>;
68
+ }
69
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/storage/domains/operations/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAEpE,OAAO,EACL,eAAe,EAQhB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACvE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEzC,qBAAa,uBAAwB,SAAQ,eAAe;IAC1D,MAAM,EAAE,sBAAsB,CAAC;IAC/B,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,CAAC;gBAC1B,EACV,OAAO,EACP,SAAS,EACT,MAAM,GACP,EAAE;QACD,OAA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AAI,CAAC,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,EAAE;QAAE,SAAS,EAAE,WAAW,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;KAAE,GAAG,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC;CA+ChH"}
@@ -0,0 +1,42 @@
1
+ import type { ScoreRowData } from '@mastra/core/scores';
2
+ import { ScoresStorage } from '@mastra/core/storage';
3
+ import type { PaginationInfo, StoragePagination } from '@mastra/core/storage';
4
+ import type { Service } from 'electrodb';
5
+ export declare class ScoresStorageDynamoDB extends ScoresStorage {
6
+ private service;
7
+ constructor({ service }: {
8
+ service: Service<Record<string, any>>;
9
+ });
10
+ private parseScoreData;
11
+ getScoreById({ id }: {
12
+ id: string;
13
+ }): Promise<ScoreRowData | null>;
14
+ saveScore(score: Omit<ScoreRowData, 'id' | 'createdAt' | 'updatedAt'>): Promise<{
15
+ score: ScoreRowData;
16
+ }>;
17
+ getScoresByScorerId({ scorerId, pagination, entityId, entityType, }: {
18
+ scorerId: string;
19
+ pagination: StoragePagination;
20
+ entityId?: string;
21
+ entityType?: string;
22
+ }): Promise<{
23
+ pagination: PaginationInfo;
24
+ scores: ScoreRowData[];
25
+ }>;
26
+ getScoresByRunId({ runId, pagination, }: {
27
+ runId: string;
28
+ pagination: StoragePagination;
29
+ }): Promise<{
30
+ pagination: PaginationInfo;
31
+ scores: ScoreRowData[];
32
+ }>;
33
+ getScoresByEntityId({ entityId, entityType, pagination, }: {
34
+ entityId: string;
35
+ entityType: string;
36
+ pagination: StoragePagination;
37
+ }): Promise<{
38
+ pagination: PaginationInfo;
39
+ scores: ScoreRowData[];
40
+ }>;
41
+ }
42
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +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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AAC,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"}
@@ -0,0 +1,28 @@
1
+ import { TracesStorage } from '@mastra/core/storage';
2
+ import type { PaginationInfo, StorageGetTracesPaginatedArg } from '@mastra/core/storage';
3
+ import type { Trace } from '@mastra/core/telemetry';
4
+ import type { Service } from 'electrodb';
5
+ import type { StoreOperationsDynamoDB } from '../operations/index.js';
6
+ export declare class TracesStorageDynamoDB extends TracesStorage {
7
+ private service;
8
+ private operations;
9
+ constructor({ service, operations }: {
10
+ service: Service<Record<string, any>>;
11
+ operations: StoreOperationsDynamoDB;
12
+ });
13
+ getTraces(args: {
14
+ name?: string;
15
+ scope?: string;
16
+ page: number;
17
+ perPage: number;
18
+ attributes?: Record<string, string>;
19
+ filters?: Record<string, any>;
20
+ }): Promise<any[]>;
21
+ batchTraceInsert({ records }: {
22
+ records: Record<string, any>[];
23
+ }): Promise<void>;
24
+ getTracesPaginated(args: StorageGetTracesPaginatedArg): Promise<PaginationInfo & {
25
+ traces: Trace[];
26
+ }>;
27
+ }
28
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/storage/domains/traces/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAgB,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACnE,OAAO,KAAK,EAAE,cAAc,EAAE,4BAA4B,EAAE,MAAM,sBAAsB,CAAC;AACzF,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AAE7D,qBAAa,qBAAsB,SAAQ,aAAa;IACtD,OAAO,CAAC,OAAO,CAA+B;IAC9C,OAAO,CAAC,UAAU,CAA0B;gBAChC,EAAE,OAAO,EAAE,UAAU,EAAE,EAAE;QAAE,OAAO,EAAE,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,CAAC;QAAC,UAAU,EAAE,uBAAuB,CAAA;KAAE;IAQ7G,SAAS,CAAC,IAAI,EAAE;QACpB,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,IAAI,EAAE,MAAM,CAAC;QACb,OAAO,EAAE,MAAM,CAAC;QAChB,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QACpC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;KAC/B,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;IAiDZ,gBAAgB,CAAC,EAAE,OAAO,EAAE,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IA2BhF,kBAAkB,CAAC,IAAI,EAAE,4BAA4B,GAAG,OAAO,CAAC,cAAc,GAAG;QAAE,MAAM,EAAE,KAAK,EAAE,CAAA;KAAE,CAAC;CAwL5G"}
@@ -0,0 +1,32 @@
1
+ import { WorkflowsStorage } from '@mastra/core/storage';
2
+ import type { WorkflowRun, WorkflowRuns } from '@mastra/core/storage';
3
+ import type { WorkflowRunState } from '@mastra/core/workflows';
4
+ import type { Service } from 'electrodb';
5
+ export declare class WorkflowStorageDynamoDB extends WorkflowsStorage {
6
+ private service;
7
+ constructor({ service }: {
8
+ service: Service<Record<string, any>>;
9
+ });
10
+ persistWorkflowSnapshot({ workflowName, runId, snapshot, }: {
11
+ workflowName: string;
12
+ runId: string;
13
+ snapshot: WorkflowRunState;
14
+ }): Promise<void>;
15
+ loadWorkflowSnapshot({ workflowName, runId, }: {
16
+ workflowName: string;
17
+ runId: string;
18
+ }): Promise<WorkflowRunState | null>;
19
+ getWorkflowRuns(args?: {
20
+ workflowName?: string;
21
+ fromDate?: Date;
22
+ toDate?: Date;
23
+ limit?: number;
24
+ offset?: number;
25
+ resourceId?: string;
26
+ }): Promise<WorkflowRuns>;
27
+ getWorkflowRunById(args: {
28
+ runId: string;
29
+ workflowName?: string;
30
+ }): Promise<WorkflowRun | null>;
31
+ }
32
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/storage/domains/workflows/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACtE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAwBzC,qBAAa,uBAAwB,SAAQ,gBAAgB;IAC3D,OAAO,CAAC,OAAO,CAA+B;gBAClC,EAAE,OAAO,EAAE,EAAE;QAAE,OAAO,EAAE,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,CAAA;KAAE;IAO5D,uBAAuB,CAAC,EAC5B,YAAY,EACZ,KAAK,EACL,QAAQ,GACT,EAAE;QACD,YAAY,EAAE,MAAM,CAAC;QACrB,KAAK,EAAE,MAAM,CAAC;QACd,QAAQ,EAAE,gBAAgB,CAAC;KAC5B,GAAG,OAAO,CAAC,IAAI,CAAC;IA+BX,oBAAoB,CAAC,EACzB,YAAY,EACZ,KAAK,GACN,EAAE;QACD,YAAY,EAAE,MAAM,CAAC;QACrB,KAAK,EAAE,MAAM,CAAC;KACf,GAAG,OAAO,CAAC,gBAAgB,GAAG,IAAI,CAAC;IAiC9B,eAAe,CAAC,IAAI,CAAC,EAAE;QAC3B,YAAY,CAAC,EAAE,MAAM,CAAC;QACtB,QAAQ,CAAC,EAAE,IAAI,CAAC;QAChB,MAAM,CAAC,EAAE,IAAI,CAAC;QACd,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,UAAU,CAAC,EAAE,MAAM,CAAC;KACrB,GAAG,OAAO,CAAC,YAAY,CAAC;IA2FnB,kBAAkB,CAAC,IAAI,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,YAAY,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,WAAW,GAAG,IAAI,CAAC;CAmFtG"}
@@ -0,0 +1,220 @@
1
+ import type { MastraMessageContentV2 } from '@mastra/core/agent';
2
+ import type { StorageThreadType, MastraMessageV2, MastraMessageV1 } from '@mastra/core/memory';
3
+ import type { ScoreRowData } from '@mastra/core/scores';
4
+ import { MastraStorage } 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
+ import type { Trace } from '@mastra/core/telemetry';
7
+ import type { WorkflowRunState } from '@mastra/core/workflows';
8
+ export interface DynamoDBStoreConfig {
9
+ region?: string;
10
+ tableName: string;
11
+ endpoint?: string;
12
+ credentials?: {
13
+ accessKeyId: string;
14
+ secretAccessKey: string;
15
+ };
16
+ }
17
+ export declare class DynamoDBStore extends MastraStorage {
18
+ private tableName;
19
+ private client;
20
+ private service;
21
+ protected hasInitialized: Promise<boolean> | null;
22
+ stores: StorageDomains;
23
+ constructor({ name, config }: {
24
+ name: string;
25
+ config: DynamoDBStoreConfig;
26
+ });
27
+ get supports(): {
28
+ selectByIncludeResourceScope: boolean;
29
+ resourceWorkingMemory: boolean;
30
+ hasColumn: boolean;
31
+ createTable: boolean;
32
+ deleteMessages: boolean;
33
+ };
34
+ /**
35
+ * Validates that the required DynamoDB table exists and is accessible.
36
+ * This does not check the table structure - it assumes the table
37
+ * was created with the correct structure via CDK/CloudFormation.
38
+ */
39
+ private validateTableExists;
40
+ /**
41
+ * Initialize storage, validating the externally managed table is accessible.
42
+ * For the single-table design, we only validate once that we can access
43
+ * the table that was created via CDK/CloudFormation.
44
+ */
45
+ init(): Promise<void>;
46
+ /**
47
+ * Performs the actual table validation and stores the promise.
48
+ * Handles resetting the stored promise on failure to allow retries.
49
+ */
50
+ private _performInitializationAndStore;
51
+ createTable({ tableName, schema }: {
52
+ tableName: TABLE_NAMES;
53
+ schema: Record<string, any>;
54
+ }): Promise<void>;
55
+ alterTable(_args: {
56
+ tableName: TABLE_NAMES;
57
+ schema: Record<string, StorageColumn>;
58
+ ifNotExists: string[];
59
+ }): Promise<void>;
60
+ clearTable({ tableName }: {
61
+ tableName: TABLE_NAMES;
62
+ }): Promise<void>;
63
+ dropTable({ tableName }: {
64
+ tableName: TABLE_NAMES;
65
+ }): Promise<void>;
66
+ insert({ tableName, record }: {
67
+ tableName: TABLE_NAMES;
68
+ record: Record<string, any>;
69
+ }): Promise<void>;
70
+ batchInsert({ tableName, records }: {
71
+ tableName: TABLE_NAMES;
72
+ records: Record<string, any>[];
73
+ }): Promise<void>;
74
+ load<R>({ tableName, keys }: {
75
+ tableName: TABLE_NAMES;
76
+ keys: Record<string, string>;
77
+ }): Promise<R | null>;
78
+ getThreadById({ threadId }: {
79
+ threadId: string;
80
+ }): Promise<StorageThreadType | null>;
81
+ getThreadsByResourceId(args: {
82
+ resourceId: string;
83
+ } & ThreadSortOptions): Promise<StorageThreadType[]>;
84
+ saveThread({ thread }: {
85
+ thread: StorageThreadType;
86
+ }): Promise<StorageThreadType>;
87
+ updateThread({ id, title, metadata, }: {
88
+ id: string;
89
+ title: string;
90
+ metadata: Record<string, unknown>;
91
+ }): Promise<StorageThreadType>;
92
+ deleteThread({ threadId }: {
93
+ threadId: string;
94
+ }): Promise<void>;
95
+ getMessages(args: StorageGetMessagesArg & {
96
+ format?: 'v1';
97
+ }): Promise<MastraMessageV1[]>;
98
+ getMessages(args: StorageGetMessagesArg & {
99
+ format: 'v2';
100
+ }): Promise<MastraMessageV2[]>;
101
+ saveMessages(args: {
102
+ messages: MastraMessageV1[];
103
+ format?: undefined | 'v1';
104
+ }): Promise<MastraMessageV1[]>;
105
+ saveMessages(args: {
106
+ messages: MastraMessageV2[];
107
+ format: 'v2';
108
+ }): Promise<MastraMessageV2[]>;
109
+ getThreadsByResourceIdPaginated(args: {
110
+ resourceId: string;
111
+ page: number;
112
+ perPage: number;
113
+ } & ThreadSortOptions): Promise<PaginationInfo & {
114
+ threads: StorageThreadType[];
115
+ }>;
116
+ getMessagesPaginated(args: StorageGetMessagesArg & {
117
+ format?: 'v1' | 'v2';
118
+ }): Promise<PaginationInfo & {
119
+ messages: MastraMessageV1[] | MastraMessageV2[];
120
+ }>;
121
+ updateMessages(_args: {
122
+ messages: Partial<Omit<MastraMessageV2, 'createdAt'>> & {
123
+ id: string;
124
+ content?: {
125
+ metadata?: MastraMessageContentV2['metadata'];
126
+ content?: MastraMessageContentV2['content'];
127
+ };
128
+ }[];
129
+ }): Promise<MastraMessageV2[]>;
130
+ getTraces(args: {
131
+ name?: string;
132
+ scope?: string;
133
+ page: number;
134
+ perPage: number;
135
+ attributes?: Record<string, string>;
136
+ filters?: Record<string, any>;
137
+ }): Promise<any[]>;
138
+ batchTraceInsert({ records }: {
139
+ records: Record<string, any>[];
140
+ }): Promise<void>;
141
+ getTracesPaginated(_args: StorageGetTracesArg): Promise<PaginationInfo & {
142
+ traces: Trace[];
143
+ }>;
144
+ persistWorkflowSnapshot({ workflowName, runId, snapshot, }: {
145
+ workflowName: string;
146
+ runId: string;
147
+ snapshot: WorkflowRunState;
148
+ }): Promise<void>;
149
+ loadWorkflowSnapshot({ workflowName, runId, }: {
150
+ workflowName: string;
151
+ runId: string;
152
+ }): Promise<WorkflowRunState | null>;
153
+ getWorkflowRuns(args?: {
154
+ workflowName?: string;
155
+ fromDate?: Date;
156
+ toDate?: Date;
157
+ limit?: number;
158
+ offset?: number;
159
+ resourceId?: string;
160
+ }): Promise<WorkflowRuns>;
161
+ getWorkflowRunById(args: {
162
+ runId: string;
163
+ workflowName?: string;
164
+ }): Promise<WorkflowRun | null>;
165
+ getResourceById({ resourceId }: {
166
+ resourceId: string;
167
+ }): Promise<StorageResourceType | null>;
168
+ saveResource({ resource }: {
169
+ resource: StorageResourceType;
170
+ }): Promise<StorageResourceType>;
171
+ updateResource({ resourceId, workingMemory, metadata, }: {
172
+ resourceId: string;
173
+ workingMemory?: string;
174
+ metadata?: Record<string, any>;
175
+ }): Promise<StorageResourceType>;
176
+ getEvalsByAgentName(agentName: string, type?: 'test' | 'live'): Promise<EvalRow[]>;
177
+ getEvals(options: {
178
+ agentName?: string;
179
+ type?: 'test' | 'live';
180
+ } & PaginationArgs): Promise<PaginationInfo & {
181
+ evals: EvalRow[];
182
+ }>;
183
+ /**
184
+ * Closes the DynamoDB client connection and cleans up resources.
185
+ * Should be called when the store is no longer needed, e.g., at the end of tests or application shutdown.
186
+ */
187
+ close(): Promise<void>;
188
+ /**
189
+ * SCORERS - Not implemented
190
+ */
191
+ getScoreById({ id: _id }: {
192
+ id: string;
193
+ }): Promise<ScoreRowData | null>;
194
+ saveScore(_score: ScoreRowData): Promise<{
195
+ score: ScoreRowData;
196
+ }>;
197
+ getScoresByRunId({ runId: _runId, pagination: _pagination, }: {
198
+ runId: string;
199
+ pagination: StoragePagination;
200
+ }): Promise<{
201
+ pagination: PaginationInfo;
202
+ scores: ScoreRowData[];
203
+ }>;
204
+ getScoresByEntityId({ entityId: _entityId, entityType: _entityType, pagination: _pagination, }: {
205
+ pagination: StoragePagination;
206
+ entityId: string;
207
+ entityType: string;
208
+ }): Promise<{
209
+ pagination: PaginationInfo;
210
+ scores: ScoreRowData[];
211
+ }>;
212
+ getScoresByScorerId({ scorerId: _scorerId, pagination: _pagination, }: {
213
+ scorerId: string;
214
+ pagination: StoragePagination;
215
+ }): Promise<{
216
+ pagination: PaginationInfo;
217
+ scores: ScoreRowData[];
218
+ }>;
219
+ }
220
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +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,EACnB,iBAAiB,EAClB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAU/D,MAAM,WAAW,mBAAmB;IAClC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE;QACZ,WAAW,EAAE,MAAM,CAAC;QACpB,eAAe,EAAE,MAAM,CAAC;KACzB,CAAC;CACH;AAOD,qBAAa,aAAc,SAAQ,aAAa;IAC9C,OAAO,CAAC,SAAS,CAAS;IAC1B,OAAO,CAAC,MAAM,CAAyB;IACvC,OAAO,CAAC,OAAO,CAAgB;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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,EAAE,SAAS,EACnB,UAAU,EAAE,WAAW,GACxB,EAAE;QACD,QAAQ,EAAE,MAAM,CAAC;QACjB,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.13.3",
3
+ "version": "0.14.0-alpha.1",
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
  },
@@ -28,7 +28,7 @@
28
28
  "electrodb": "^3.4.3"
29
29
  },
30
30
  "peerDependencies": {
31
- "@mastra/core": ">=0.10.7-0 <0.13.0-0"
31
+ "@mastra/core": ">=0.13.0-0 <0.14.0-0"
32
32
  },
33
33
  "devDependencies": {
34
34
  "@microsoft/api-extractor": "^7.52.8",
@@ -40,13 +40,14 @@
40
40
  "tsup": "^8.5.0",
41
41
  "typescript": "^5.8.3",
42
42
  "vitest": "^3.2.4",
43
- "@internal/lint": "0.0.24",
44
- "@internal/storage-test-utils": "0.0.20",
45
- "@mastra/core": "0.12.0"
43
+ "@internal/lint": "0.0.26",
44
+ "@internal/storage-test-utils": "0.0.22",
45
+ "@internal/types-builder": "0.0.1",
46
+ "@mastra/core": "0.13.0-alpha.2"
46
47
  },
47
48
  "scripts": {
48
- "build": "tsup src/index.ts --format esm,cjs --experimental-dts --clean --treeshake=smallest --splitting",
49
- "dev": "tsup --watch",
49
+ "build": "tsup --silent --config tsup.config.ts",
50
+ "dev": "tsup --watch && tsc -p tsconfig.build.json",
50
51
  "clean": "rm -rf dist",
51
52
  "lint": "eslint .",
52
53
  "pretest": "docker compose up -d",
@@ -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,