@mastra/dynamodb 0.0.0-share-agent-metadata-with-cloud-20250718123411 → 0.0.0-span-scorring-test-20251124132129

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 (51) hide show
  1. package/CHANGELOG.md +1484 -0
  2. package/README.md +0 -4
  3. package/dist/entities/eval.d.ts +102 -0
  4. package/dist/entities/eval.d.ts.map +1 -0
  5. package/dist/entities/index.d.ts +761 -0
  6. package/dist/entities/index.d.ts.map +1 -0
  7. package/dist/entities/message.d.ts +100 -0
  8. package/dist/entities/message.d.ts.map +1 -0
  9. package/dist/entities/resource.d.ts +54 -0
  10. package/dist/entities/resource.d.ts.map +1 -0
  11. package/dist/entities/score.d.ts +244 -0
  12. package/dist/entities/score.d.ts.map +1 -0
  13. package/dist/entities/thread.d.ts +69 -0
  14. package/dist/entities/thread.d.ts.map +1 -0
  15. package/dist/entities/trace.d.ts +127 -0
  16. package/dist/entities/trace.d.ts.map +1 -0
  17. package/dist/entities/utils.d.ts +21 -0
  18. package/dist/entities/utils.d.ts.map +1 -0
  19. package/dist/entities/workflow-snapshot.d.ts +74 -0
  20. package/dist/entities/workflow-snapshot.d.ts.map +1 -0
  21. package/dist/index.cjs +1754 -566
  22. package/dist/index.cjs.map +1 -0
  23. package/dist/index.d.ts +2 -2
  24. package/dist/index.d.ts.map +1 -0
  25. package/dist/index.js +1755 -567
  26. package/dist/index.js.map +1 -0
  27. package/dist/storage/domains/memory/index.d.ts +61 -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 +51 -0
  32. package/dist/storage/domains/score/index.d.ts.map +1 -0
  33. package/dist/storage/domains/workflows/index.d.ts +44 -0
  34. package/dist/storage/domains/workflows/index.d.ts.map +1 -0
  35. package/dist/storage/index.d.ts +204 -0
  36. package/dist/storage/index.d.ts.map +1 -0
  37. package/package.json +31 -18
  38. package/dist/_tsup-dts-rollup.d.cts +0 -1160
  39. package/dist/_tsup-dts-rollup.d.ts +0 -1160
  40. package/dist/index.d.cts +0 -2
  41. package/src/entities/eval.ts +0 -102
  42. package/src/entities/index.ts +0 -23
  43. package/src/entities/message.ts +0 -143
  44. package/src/entities/thread.ts +0 -66
  45. package/src/entities/trace.ts +0 -129
  46. package/src/entities/utils.ts +0 -51
  47. package/src/entities/workflow-snapshot.ts +0 -56
  48. package/src/index.ts +0 -1
  49. package/src/storage/docker-compose.yml +0 -16
  50. package/src/storage/index.test.ts +0 -1483
  51. package/src/storage/index.ts +0 -1383
@@ -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,OAAO,EAAE,OAAO,CAAC,MAAM,CAAC,MAAM,EA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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,51 @@
1
+ import type { ScoreRowData, ScoringSource } from '@mastra/core/evals';
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
+ listScoresByScorerId({ scorerId, pagination, entityId, entityType, source, }: {
18
+ scorerId: string;
19
+ pagination: StoragePagination;
20
+ entityId?: string;
21
+ entityType?: string;
22
+ source?: ScoringSource;
23
+ }): Promise<{
24
+ pagination: PaginationInfo;
25
+ scores: ScoreRowData[];
26
+ }>;
27
+ listScoresByRunId({ runId, pagination, }: {
28
+ runId: string;
29
+ pagination: StoragePagination;
30
+ }): Promise<{
31
+ pagination: PaginationInfo;
32
+ scores: ScoreRowData[];
33
+ }>;
34
+ listScoresByEntityId({ entityId, entityType, pagination, }: {
35
+ entityId: string;
36
+ entityType: string;
37
+ pagination: StoragePagination;
38
+ }): Promise<{
39
+ pagination: PaginationInfo;
40
+ scores: ScoreRowData[];
41
+ }>;
42
+ listScoresBySpan({ traceId, spanId, pagination, }: {
43
+ traceId: string;
44
+ spanId: string;
45
+ pagination: StoragePagination;
46
+ }): Promise<{
47
+ pagination: PaginationInfo;
48
+ scores: ScoreRowData[];
49
+ }>;
50
+ }
51
+ //# sourceMappingURL=index.d.ts.map
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,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,oBAAoB,CAAC,EACzB,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;IAgD7D,gBAAgB,CAAC,EACrB,OAAO,EACP,MAAM,EACN,UAAU,GACX,EAAE;QACD,OAAO,EAAE,MAAM,CAAC;QAChB,MAAM,EAAE,MAAM,CAAC;QACf,UAAU,EAAE,iBAAiB,CAAC;KAC/B,GAAG,OAAO,CAAC;QAAE,UAAU,EAAE,cAAc,CAAC;QAAC,MAAM,EAAE,YAAY,EAAE,CAAA;KAAE,CAAC;CA4CpE"}
@@ -0,0 +1,44 @@
1
+ import { WorkflowsStorage } from '@mastra/core/storage';
2
+ import type { WorkflowRun, WorkflowRuns, StorageListWorkflowRunsInput } from '@mastra/core/storage';
3
+ import type { StepResult, 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
+ updateWorkflowResults({}: {
11
+ workflowName: string;
12
+ runId: string;
13
+ stepId: string;
14
+ result: StepResult<any, any, any, any>;
15
+ requestContext: Record<string, any>;
16
+ }): Promise<Record<string, StepResult<any, any, any, any>>>;
17
+ updateWorkflowState({}: {
18
+ workflowName: string;
19
+ runId: string;
20
+ opts: {
21
+ status: string;
22
+ result?: StepResult<any, any, any, any>;
23
+ error?: string;
24
+ suspendedPaths?: Record<string, number[]>;
25
+ waitingPaths?: Record<string, number[]>;
26
+ };
27
+ }): Promise<WorkflowRunState | undefined>;
28
+ persistWorkflowSnapshot({ workflowName, runId, resourceId, snapshot, }: {
29
+ workflowName: string;
30
+ runId: string;
31
+ resourceId?: string;
32
+ snapshot: WorkflowRunState;
33
+ }): Promise<void>;
34
+ loadWorkflowSnapshot({ workflowName, runId, }: {
35
+ workflowName: string;
36
+ runId: string;
37
+ }): Promise<WorkflowRunState | null>;
38
+ listWorkflowRuns(args?: StorageListWorkflowRunsInput): Promise<WorkflowRuns>;
39
+ getWorkflowRunById(args: {
40
+ runId: string;
41
+ workflowName?: string;
42
+ }): Promise<WorkflowRun | null>;
43
+ }
44
+ //# 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,EAAoB,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAC1E,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,4BAA4B,EAAE,MAAM,sBAAsB,CAAC;AACpG,OAAO,KAAK,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC3E,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;IAMlE,qBAAqB,CACnB,EAMC,EAAE;QACD,YAAY,EAAE,MAAM,CAAC;QACrB,KAAK,EAAE,MAAM,CAAC;QACd,MAAM,EAAE,MAAM,CAAC;QACf,MAAM,EAAE,UAAU,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,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,YAAY,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,WAAW,GAAG,IAAI,CAAC;CA8EtG"}
@@ -0,0 +1,204 @@
1
+ import type { MastraMessageContentV2 } from '@mastra/core/agent';
2
+ import type { ScoreRowData, ScoringSource } from '@mastra/core/evals';
3
+ import type { StorageThreadType, MastraDBMessage } from '@mastra/core/memory';
4
+ import { MastraStorage } from '@mastra/core/storage';
5
+ import type { WorkflowRun, WorkflowRuns, TABLE_NAMES, PaginationInfo, StorageColumn, StoragePagination, StorageDomains, StorageResourceType, StorageListWorkflowRunsInput } from '@mastra/core/storage';
6
+ import type { StepResult, WorkflowRunState } from '@mastra/core/workflows';
7
+ export interface DynamoDBStoreConfig {
8
+ id: string;
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
+ listScoresBySpan: boolean;
34
+ };
35
+ /**
36
+ * Validates that the required DynamoDB table exists and is accessible.
37
+ * This does not check the table structure - it assumes the table
38
+ * was created with the correct structure via CDK/CloudFormation.
39
+ */
40
+ private validateTableExists;
41
+ /**
42
+ * Initialize storage, validating the externally managed table is accessible.
43
+ * For the single-table design, we only validate once that we can access
44
+ * the table that was created via CDK/CloudFormation.
45
+ */
46
+ init(): Promise<void>;
47
+ /**
48
+ * Performs the actual table validation and stores the promise.
49
+ * Handles resetting the stored promise on failure to allow retries.
50
+ */
51
+ private _performInitializationAndStore;
52
+ createTable({ tableName, schema }: {
53
+ tableName: TABLE_NAMES;
54
+ schema: Record<string, any>;
55
+ }): Promise<void>;
56
+ alterTable(_args: {
57
+ tableName: TABLE_NAMES;
58
+ schema: Record<string, StorageColumn>;
59
+ ifNotExists: string[];
60
+ }): Promise<void>;
61
+ clearTable({ tableName }: {
62
+ tableName: TABLE_NAMES;
63
+ }): Promise<void>;
64
+ dropTable({ tableName }: {
65
+ tableName: TABLE_NAMES;
66
+ }): Promise<void>;
67
+ insert({ tableName, record }: {
68
+ tableName: TABLE_NAMES;
69
+ record: Record<string, any>;
70
+ }): Promise<void>;
71
+ batchInsert({ tableName, records }: {
72
+ tableName: TABLE_NAMES;
73
+ records: Record<string, any>[];
74
+ }): Promise<void>;
75
+ load<R>({ tableName, keys }: {
76
+ tableName: TABLE_NAMES;
77
+ keys: Record<string, string>;
78
+ }): Promise<R | null>;
79
+ getThreadById({ threadId }: {
80
+ threadId: string;
81
+ }): Promise<StorageThreadType | null>;
82
+ saveThread({ thread }: {
83
+ thread: StorageThreadType;
84
+ }): Promise<StorageThreadType>;
85
+ updateThread({ id, title, metadata, }: {
86
+ id: string;
87
+ title: string;
88
+ metadata: Record<string, unknown>;
89
+ }): Promise<StorageThreadType>;
90
+ deleteThread({ threadId }: {
91
+ threadId: string;
92
+ }): Promise<void>;
93
+ listMessagesById(args: {
94
+ messageIds: string[];
95
+ }): Promise<{
96
+ messages: MastraDBMessage[];
97
+ }>;
98
+ saveMessages(args: {
99
+ messages: MastraDBMessage[];
100
+ }): Promise<{
101
+ messages: MastraDBMessage[];
102
+ }>;
103
+ updateMessages(_args: {
104
+ messages: (Partial<Omit<MastraDBMessage, 'createdAt'>> & {
105
+ id: string;
106
+ content?: {
107
+ metadata?: MastraMessageContentV2['metadata'];
108
+ content?: MastraMessageContentV2['content'];
109
+ };
110
+ })[];
111
+ }): Promise<MastraDBMessage[]>;
112
+ updateWorkflowResults({ workflowName, runId, stepId, result, requestContext, }: {
113
+ workflowName: string;
114
+ runId: string;
115
+ stepId: string;
116
+ result: StepResult<any, any, any, any>;
117
+ requestContext: Record<string, any>;
118
+ }): Promise<Record<string, StepResult<any, any, any, any>>>;
119
+ updateWorkflowState({ workflowName, runId, opts, }: {
120
+ workflowName: string;
121
+ runId: string;
122
+ opts: {
123
+ status: string;
124
+ result?: StepResult<any, any, any, any>;
125
+ error?: string;
126
+ suspendedPaths?: Record<string, number[]>;
127
+ waitingPaths?: Record<string, number[]>;
128
+ };
129
+ }): Promise<WorkflowRunState | undefined>;
130
+ persistWorkflowSnapshot({ workflowName, runId, resourceId, snapshot, }: {
131
+ workflowName: string;
132
+ runId: string;
133
+ resourceId?: string;
134
+ snapshot: WorkflowRunState;
135
+ }): Promise<void>;
136
+ loadWorkflowSnapshot({ workflowName, runId, }: {
137
+ workflowName: string;
138
+ runId: string;
139
+ }): Promise<WorkflowRunState | null>;
140
+ listWorkflowRuns(args?: StorageListWorkflowRunsInput): Promise<WorkflowRuns>;
141
+ getWorkflowRunById(args: {
142
+ runId: string;
143
+ workflowName?: string;
144
+ }): Promise<WorkflowRun | null>;
145
+ getResourceById({ resourceId }: {
146
+ resourceId: string;
147
+ }): Promise<StorageResourceType | null>;
148
+ saveResource({ resource }: {
149
+ resource: StorageResourceType;
150
+ }): Promise<StorageResourceType>;
151
+ updateResource({ resourceId, workingMemory, metadata, }: {
152
+ resourceId: string;
153
+ workingMemory?: string;
154
+ metadata?: Record<string, any>;
155
+ }): Promise<StorageResourceType>;
156
+ /**
157
+ * Closes the DynamoDB client connection and cleans up resources.
158
+ * Should be called when the store is no longer needed, e.g., at the end of tests or application shutdown.
159
+ */
160
+ close(): Promise<void>;
161
+ /**
162
+ * SCORERS - Not implemented
163
+ */
164
+ getScoreById({ id: _id }: {
165
+ id: string;
166
+ }): Promise<ScoreRowData | null>;
167
+ saveScore(_score: ScoreRowData): Promise<{
168
+ score: ScoreRowData;
169
+ }>;
170
+ listScoresByRunId({ runId: _runId, pagination: _pagination, }: {
171
+ runId: string;
172
+ pagination: StoragePagination;
173
+ }): Promise<{
174
+ pagination: PaginationInfo;
175
+ scores: ScoreRowData[];
176
+ }>;
177
+ listScoresByEntityId({ entityId: _entityId, entityType: _entityType, pagination: _pagination, }: {
178
+ pagination: StoragePagination;
179
+ entityId: string;
180
+ entityType: string;
181
+ }): Promise<{
182
+ pagination: PaginationInfo;
183
+ scores: ScoreRowData[];
184
+ }>;
185
+ listScoresByScorerId({ scorerId, source, entityId, entityType, pagination, }: {
186
+ scorerId: string;
187
+ entityId?: string;
188
+ entityType?: string;
189
+ source?: ScoringSource;
190
+ pagination: StoragePagination;
191
+ }): Promise<{
192
+ pagination: PaginationInfo;
193
+ scores: ScoreRowData[];
194
+ }>;
195
+ listScoresBySpan({ traceId, spanId, pagination, }: {
196
+ traceId: string;
197
+ spanId: string;
198
+ pagination: StoragePagination;
199
+ }): Promise<{
200
+ pagination: PaginationInfo;
201
+ scores: ScoreRowData[];
202
+ }>;
203
+ }
204
+ //# 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,YAAY,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACtE,OAAO,KAAK,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAE9E,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,KAAK,EACV,WAAW,EACX,YAAY,EACZ,WAAW,EACX,cAAc,EACd,aAAa,EACb,iBAAiB,EACjB,cAAc,EACd,mBAAmB,EACnB,4BAA4B,EAC7B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAQ3E,MAAM,WAAW,mBAAmB;IAClC,EAAE,EAAE,MAAM,CAA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M,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;IAI7D,gBAAgB,CAAC,EACrB,OAAO,EACP,MAAM,EACN,UAAU,GACX,EAAE;QACD,OAAO,EAAE,MAAM,CAAC;QAChB,MAAM,EAAE,MAAM,CAAC;QACf,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-share-agent-metadata-with-cloud-20250718123411",
3
+ "version": "0.0.0-span-scorring-test-20251124132129",
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
  },
@@ -20,33 +20,46 @@
20
20
  },
21
21
  "files": [
22
22
  "dist",
23
- "src"
23
+ "CHANGELOG.md"
24
24
  ],
25
25
  "dependencies": {
26
- "@aws-sdk/client-dynamodb": "^3.840.0",
27
- "@aws-sdk/lib-dynamodb": "^3.840.0",
28
- "electrodb": "^3.4.3"
26
+ "@aws-sdk/client-dynamodb": "^3.902.0",
27
+ "@aws-sdk/lib-dynamodb": "^3.902.0",
28
+ "electrodb": "^3.5.0"
29
29
  },
30
30
  "peerDependencies": {
31
- "@mastra/core": "0.0.0-share-agent-metadata-with-cloud-20250718123411"
31
+ "@mastra/core": "0.0.0-span-scorring-test-20251124132129"
32
32
  },
33
33
  "devDependencies": {
34
34
  "@microsoft/api-extractor": "^7.52.8",
35
- "@types/node": "^20.19.0",
36
- "@vitest/coverage-v8": "3.2.3",
37
- "@vitest/ui": "3.2.3",
38
- "axios": "^1.10.0",
39
- "eslint": "^9.30.1",
35
+ "@types/node": "22.13.17",
36
+ "@vitest/coverage-v8": "4.0.12",
37
+ "@vitest/ui": "4.0.12",
38
+ "axios": "^1.12.2",
39
+ "eslint": "^9.37.0",
40
40
  "tsup": "^8.5.0",
41
41
  "typescript": "^5.8.3",
42
- "vitest": "^3.2.4",
43
- "@internal/storage-test-utils": "0.0.16",
44
- "@internal/lint": "0.0.0-share-agent-metadata-with-cloud-20250718123411",
45
- "@mastra/core": "0.0.0-share-agent-metadata-with-cloud-20250718123411"
42
+ "vitest": "4.0.12",
43
+ "@internal/storage-test-utils": "0.0.49",
44
+ "@internal/lint": "0.0.0-span-scorring-test-20251124132129",
45
+ "@internal/types-builder": "0.0.0-span-scorring-test-20251124132129",
46
+ "@mastra/core": "0.0.0-span-scorring-test-20251124132129"
47
+ },
48
+ "homepage": "https://mastra.ai",
49
+ "repository": {
50
+ "type": "git",
51
+ "url": "git+https://github.com/mastra-ai/mastra.git",
52
+ "directory": "stores/dynamodb"
53
+ },
54
+ "bugs": {
55
+ "url": "https://github.com/mastra-ai/mastra/issues"
56
+ },
57
+ "engines": {
58
+ "node": ">=22.13.0"
46
59
  },
47
60
  "scripts": {
48
- "build": "tsup src/index.ts --format esm,cjs --experimental-dts --clean --treeshake=smallest --splitting",
49
- "dev": "tsup --watch",
61
+ "build": "tsup --silent --config tsup.config.ts",
62
+ "dev": "tsup --watch && tsc -p tsconfig.build.json",
50
63
  "clean": "rm -rf dist",
51
64
  "lint": "eslint .",
52
65
  "pretest": "docker compose up -d",