@mastra/dynamodb 1.0.0-beta.2 → 1.0.0-beta.4
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/CHANGELOG.md +47 -0
- package/dist/index.cjs +60 -52
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +61 -53
- package/dist/index.js.map +1 -1
- 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 +2 -2
- package/dist/storage/domains/score/index.d.ts.map +1 -1
- package/dist/storage/domains/workflows/index.d.ts.map +1 -1
- package/dist/storage/index.d.ts +22 -2
- package/dist/storage/index.d.ts.map +1 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,52 @@
|
|
|
1
1
|
# @mastra/dynamodb
|
|
2
2
|
|
|
3
|
+
## 1.0.0-beta.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Fix saveScore not persisting ID correctly, breaking getScoreById retrieval ([#10915](https://github.com/mastra-ai/mastra/pull/10915))
|
|
8
|
+
|
|
9
|
+
**What Changed**
|
|
10
|
+
- saveScore now correctly returns scores that can be retrieved with getScoreById
|
|
11
|
+
- Validation errors now include contextual information (scorer, entity, trace details) for easier debugging
|
|
12
|
+
|
|
13
|
+
**Impact**
|
|
14
|
+
Previously, calling getScoreById after saveScore would return null because the generated ID wasn't persisted to the database. This is now fixed across all store implementations, ensuring consistent behavior and data integrity.
|
|
15
|
+
|
|
16
|
+
- Updated dependencies [[`0d41fe2`](https://github.com/mastra-ai/mastra/commit/0d41fe245355dfc66d61a0d9c85d9400aac351ff), [`6b3ba91`](https://github.com/mastra-ai/mastra/commit/6b3ba91494cc10394df96782f349a4f7b1e152cc), [`7907fd1`](https://github.com/mastra-ai/mastra/commit/7907fd1c5059813b7b870b81ca71041dc807331b)]:
|
|
17
|
+
- @mastra/core@1.0.0-beta.8
|
|
18
|
+
|
|
19
|
+
## 1.0.0-beta.3
|
|
20
|
+
|
|
21
|
+
### Minor Changes
|
|
22
|
+
|
|
23
|
+
- Add `disableInit` option to all storage adapters ([#10851](https://github.com/mastra-ai/mastra/pull/10851))
|
|
24
|
+
|
|
25
|
+
Adds a new `disableInit` config option to all storage providers that allows users to disable automatic table creation/migrations at runtime. This is useful for CI/CD pipelines where you want to run migrations during deployment with elevated credentials, then run the application with `disableInit: true` so it doesn't attempt schema changes at runtime.
|
|
26
|
+
|
|
27
|
+
```typescript
|
|
28
|
+
// CI/CD script - run migrations
|
|
29
|
+
const storage = new PostgresStore({
|
|
30
|
+
connectionString: DATABASE_URL,
|
|
31
|
+
id: 'pg-storage',
|
|
32
|
+
});
|
|
33
|
+
await storage.init();
|
|
34
|
+
|
|
35
|
+
// Runtime - skip auto-init
|
|
36
|
+
const storage = new PostgresStore({
|
|
37
|
+
connectionString: DATABASE_URL,
|
|
38
|
+
id: 'pg-storage',
|
|
39
|
+
disableInit: true,
|
|
40
|
+
});
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### Patch Changes
|
|
44
|
+
|
|
45
|
+
- Standardize error IDs across all storage and vector stores using centralized helper functions (`createStorageErrorId` and `createVectorErrorId`). This ensures consistent error ID patterns (`MASTRA_STORAGE_{STORE}_{OPERATION}_{STATUS}` and `MASTRA_VECTOR_{STORE}_{OPERATION}_{STATUS}`) across the codebase for better error tracking and debugging. ([#10913](https://github.com/mastra-ai/mastra/pull/10913))
|
|
46
|
+
|
|
47
|
+
- Updated dependencies [[`3076c67`](https://github.com/mastra-ai/mastra/commit/3076c6778b18988ae7d5c4c5c466366974b2d63f), [`85d7ee1`](https://github.com/mastra-ai/mastra/commit/85d7ee18ff4e14d625a8a30ec6656bb49804989b), [`c6c1092`](https://github.com/mastra-ai/mastra/commit/c6c1092f8fbf76109303f69e000e96fd1960c4ce), [`81dc110`](https://github.com/mastra-ai/mastra/commit/81dc11008d147cf5bdc8996ead1aa61dbdebb6fc), [`7aedb74`](https://github.com/mastra-ai/mastra/commit/7aedb74883adf66af38e270e4068fd42e7a37036), [`8f02d80`](https://github.com/mastra-ai/mastra/commit/8f02d800777397e4b45d7f1ad041988a8b0c6630), [`d7aad50`](https://github.com/mastra-ai/mastra/commit/d7aad501ce61646b76b4b511e558ac4eea9884d0), [`ce0a73a`](https://github.com/mastra-ai/mastra/commit/ce0a73abeaa75b10ca38f9e40a255a645d50ebfb), [`a02e542`](https://github.com/mastra-ai/mastra/commit/a02e542d23179bad250b044b17ff023caa61739f), [`a372c64`](https://github.com/mastra-ai/mastra/commit/a372c640ad1fd12e8f0613cebdc682fc156b4d95), [`8846867`](https://github.com/mastra-ai/mastra/commit/8846867ffa9a3746767618e314bebac08eb77d87), [`42a42cf`](https://github.com/mastra-ai/mastra/commit/42a42cf3132b9786feecbb8c13c583dce5b0e198), [`ae08bf0`](https://github.com/mastra-ai/mastra/commit/ae08bf0ebc6a4e4da992b711c4a389c32ba84cf4), [`21735a7`](https://github.com/mastra-ai/mastra/commit/21735a7ef306963554a69a89b44f06c3bcd85141), [`1d877b8`](https://github.com/mastra-ai/mastra/commit/1d877b8d7b536a251c1a7a18db7ddcf4f68d6f8b)]:
|
|
48
|
+
- @mastra/core@1.0.0-beta.7
|
|
49
|
+
|
|
3
50
|
## 1.0.0-beta.2
|
|
4
51
|
|
|
5
52
|
### Patch Changes
|
package/dist/index.cjs
CHANGED
|
@@ -989,7 +989,7 @@ var MemoryStorageDynamoDB = class extends storage.MemoryStorage {
|
|
|
989
989
|
} catch (error$1) {
|
|
990
990
|
throw new error.MastraError(
|
|
991
991
|
{
|
|
992
|
-
id: "
|
|
992
|
+
id: storage.createStorageErrorId("DYNAMODB", "GET_THREAD_BY_ID", "FAILED"),
|
|
993
993
|
domain: error.ErrorDomain.STORAGE,
|
|
994
994
|
category: error.ErrorCategory.THIRD_PARTY,
|
|
995
995
|
details: { threadId }
|
|
@@ -1023,7 +1023,7 @@ var MemoryStorageDynamoDB = class extends storage.MemoryStorage {
|
|
|
1023
1023
|
} catch (error$1) {
|
|
1024
1024
|
throw new error.MastraError(
|
|
1025
1025
|
{
|
|
1026
|
-
id: "
|
|
1026
|
+
id: storage.createStorageErrorId("DYNAMODB", "SAVE_THREAD", "FAILED"),
|
|
1027
1027
|
domain: error.ErrorDomain.STORAGE,
|
|
1028
1028
|
category: error.ErrorCategory.THIRD_PARTY,
|
|
1029
1029
|
details: { threadId: thread.id }
|
|
@@ -1065,7 +1065,7 @@ var MemoryStorageDynamoDB = class extends storage.MemoryStorage {
|
|
|
1065
1065
|
} catch (error$1) {
|
|
1066
1066
|
throw new error.MastraError(
|
|
1067
1067
|
{
|
|
1068
|
-
id: "
|
|
1068
|
+
id: storage.createStorageErrorId("DYNAMODB", "UPDATE_THREAD", "FAILED"),
|
|
1069
1069
|
domain: error.ErrorDomain.STORAGE,
|
|
1070
1070
|
category: error.ErrorCategory.THIRD_PARTY,
|
|
1071
1071
|
details: { threadId: id }
|
|
@@ -1097,7 +1097,7 @@ var MemoryStorageDynamoDB = class extends storage.MemoryStorage {
|
|
|
1097
1097
|
} catch (error$1) {
|
|
1098
1098
|
throw new error.MastraError(
|
|
1099
1099
|
{
|
|
1100
|
-
id: "
|
|
1100
|
+
id: storage.createStorageErrorId("DYNAMODB", "DELETE_THREAD", "FAILED"),
|
|
1101
1101
|
domain: error.ErrorDomain.STORAGE,
|
|
1102
1102
|
category: error.ErrorCategory.THIRD_PARTY,
|
|
1103
1103
|
details: { threadId }
|
|
@@ -1123,7 +1123,7 @@ var MemoryStorageDynamoDB = class extends storage.MemoryStorage {
|
|
|
1123
1123
|
} catch (error$1) {
|
|
1124
1124
|
throw new error.MastraError(
|
|
1125
1125
|
{
|
|
1126
|
-
id: "
|
|
1126
|
+
id: storage.createStorageErrorId("DYNAMODB", "LIST_MESSAGES_BY_ID", "FAILED"),
|
|
1127
1127
|
domain: error.ErrorDomain.STORAGE,
|
|
1128
1128
|
category: error.ErrorCategory.THIRD_PARTY,
|
|
1129
1129
|
details: { messageIds: JSON.stringify(messageIds) }
|
|
@@ -1138,7 +1138,7 @@ var MemoryStorageDynamoDB = class extends storage.MemoryStorage {
|
|
|
1138
1138
|
if (threadIds.length === 0 || threadIds.some((id) => !id.trim())) {
|
|
1139
1139
|
throw new error.MastraError(
|
|
1140
1140
|
{
|
|
1141
|
-
id: "
|
|
1141
|
+
id: storage.createStorageErrorId("DYNAMODB", "LIST_MESSAGES", "INVALID_THREAD_ID"),
|
|
1142
1142
|
domain: error.ErrorDomain.STORAGE,
|
|
1143
1143
|
category: error.ErrorCategory.THIRD_PARTY,
|
|
1144
1144
|
details: { threadId: Array.isArray(threadId) ? threadId.join(",") : threadId }
|
|
@@ -1152,7 +1152,7 @@ var MemoryStorageDynamoDB = class extends storage.MemoryStorage {
|
|
|
1152
1152
|
if (page < 0) {
|
|
1153
1153
|
throw new error.MastraError(
|
|
1154
1154
|
{
|
|
1155
|
-
id: "
|
|
1155
|
+
id: storage.createStorageErrorId("DYNAMODB", "LIST_MESSAGES", "INVALID_PAGE"),
|
|
1156
1156
|
domain: error.ErrorDomain.STORAGE,
|
|
1157
1157
|
category: error.ErrorCategory.USER,
|
|
1158
1158
|
details: { page }
|
|
@@ -1250,7 +1250,7 @@ var MemoryStorageDynamoDB = class extends storage.MemoryStorage {
|
|
|
1250
1250
|
} catch (error$1) {
|
|
1251
1251
|
const mastraError = new error.MastraError(
|
|
1252
1252
|
{
|
|
1253
|
-
id: "
|
|
1253
|
+
id: storage.createStorageErrorId("DYNAMODB", "LIST_MESSAGES", "FAILED"),
|
|
1254
1254
|
domain: error.ErrorDomain.STORAGE,
|
|
1255
1255
|
category: error.ErrorCategory.THIRD_PARTY,
|
|
1256
1256
|
details: {
|
|
@@ -1333,7 +1333,7 @@ var MemoryStorageDynamoDB = class extends storage.MemoryStorage {
|
|
|
1333
1333
|
} catch (error$1) {
|
|
1334
1334
|
throw new error.MastraError(
|
|
1335
1335
|
{
|
|
1336
|
-
id: "
|
|
1336
|
+
id: storage.createStorageErrorId("DYNAMODB", "SAVE_MESSAGES", "FAILED"),
|
|
1337
1337
|
domain: error.ErrorDomain.STORAGE,
|
|
1338
1338
|
category: error.ErrorCategory.THIRD_PARTY,
|
|
1339
1339
|
details: { count: messages.length }
|
|
@@ -1348,7 +1348,7 @@ var MemoryStorageDynamoDB = class extends storage.MemoryStorage {
|
|
|
1348
1348
|
if (page < 0) {
|
|
1349
1349
|
throw new error.MastraError(
|
|
1350
1350
|
{
|
|
1351
|
-
id: "
|
|
1351
|
+
id: storage.createStorageErrorId("DYNAMODB", "LIST_THREADS_BY_RESOURCE_ID", "INVALID_PAGE"),
|
|
1352
1352
|
domain: error.ErrorDomain.STORAGE,
|
|
1353
1353
|
category: error.ErrorCategory.USER,
|
|
1354
1354
|
details: { page }
|
|
@@ -1383,7 +1383,7 @@ var MemoryStorageDynamoDB = class extends storage.MemoryStorage {
|
|
|
1383
1383
|
} catch (error$1) {
|
|
1384
1384
|
throw new error.MastraError(
|
|
1385
1385
|
{
|
|
1386
|
-
id: "
|
|
1386
|
+
id: storage.createStorageErrorId("DYNAMODB", "LIST_THREADS_BY_RESOURCE_ID", "FAILED"),
|
|
1387
1387
|
domain: error.ErrorDomain.STORAGE,
|
|
1388
1388
|
category: error.ErrorCategory.THIRD_PARTY,
|
|
1389
1389
|
details: { resourceId, page, perPage }
|
|
@@ -1517,7 +1517,7 @@ var MemoryStorageDynamoDB = class extends storage.MemoryStorage {
|
|
|
1517
1517
|
} catch (error$1) {
|
|
1518
1518
|
throw new error.MastraError(
|
|
1519
1519
|
{
|
|
1520
|
-
id: "
|
|
1520
|
+
id: storage.createStorageErrorId("DYNAMODB", "UPDATE_MESSAGES", "FAILED"),
|
|
1521
1521
|
domain: error.ErrorDomain.STORAGE,
|
|
1522
1522
|
category: error.ErrorCategory.THIRD_PARTY,
|
|
1523
1523
|
details: { count: messages.length }
|
|
@@ -1546,7 +1546,7 @@ var MemoryStorageDynamoDB = class extends storage.MemoryStorage {
|
|
|
1546
1546
|
} catch (error$1) {
|
|
1547
1547
|
throw new error.MastraError(
|
|
1548
1548
|
{
|
|
1549
|
-
id: "
|
|
1549
|
+
id: storage.createStorageErrorId("DYNAMODB", "GET_RESOURCE_BY_ID", "FAILED"),
|
|
1550
1550
|
domain: error.ErrorDomain.STORAGE,
|
|
1551
1551
|
category: error.ErrorCategory.THIRD_PARTY,
|
|
1552
1552
|
details: { resourceId }
|
|
@@ -1578,7 +1578,7 @@ var MemoryStorageDynamoDB = class extends storage.MemoryStorage {
|
|
|
1578
1578
|
} catch (error$1) {
|
|
1579
1579
|
throw new error.MastraError(
|
|
1580
1580
|
{
|
|
1581
|
-
id: "
|
|
1581
|
+
id: storage.createStorageErrorId("DYNAMODB", "SAVE_RESOURCE", "FAILED"),
|
|
1582
1582
|
domain: error.ErrorDomain.STORAGE,
|
|
1583
1583
|
category: error.ErrorCategory.THIRD_PARTY,
|
|
1584
1584
|
details: { resourceId: resource.id }
|
|
@@ -1627,7 +1627,7 @@ var MemoryStorageDynamoDB = class extends storage.MemoryStorage {
|
|
|
1627
1627
|
} catch (error$1) {
|
|
1628
1628
|
throw new error.MastraError(
|
|
1629
1629
|
{
|
|
1630
|
-
id: "
|
|
1630
|
+
id: storage.createStorageErrorId("DYNAMODB", "UPDATE_RESOURCE", "FAILED"),
|
|
1631
1631
|
domain: error.ErrorDomain.STORAGE,
|
|
1632
1632
|
category: error.ErrorCategory.THIRD_PARTY,
|
|
1633
1633
|
details: { resourceId }
|
|
@@ -1727,7 +1727,7 @@ var StoreOperationsDynamoDB = class extends storage.StoreOperations {
|
|
|
1727
1727
|
}
|
|
1728
1728
|
throw new error.MastraError(
|
|
1729
1729
|
{
|
|
1730
|
-
id: "
|
|
1730
|
+
id: storage.createStorageErrorId("DYNAMODB", "VALIDATE_TABLE_EXISTS", "FAILED"),
|
|
1731
1731
|
domain: error.ErrorDomain.STORAGE,
|
|
1732
1732
|
category: error.ErrorCategory.THIRD_PARTY,
|
|
1733
1733
|
details: { tableName: this.tableName }
|
|
@@ -1760,7 +1760,7 @@ var StoreOperationsDynamoDB = class extends storage.StoreOperations {
|
|
|
1760
1760
|
this.logger.error("Error validating table access", { tableName: this.tableName, error: error$1 });
|
|
1761
1761
|
throw new error.MastraError(
|
|
1762
1762
|
{
|
|
1763
|
-
id: "
|
|
1763
|
+
id: storage.createStorageErrorId("DYNAMODB", "VALIDATE_TABLE_ACCESS", "FAILED"),
|
|
1764
1764
|
domain: error.ErrorDomain.STORAGE,
|
|
1765
1765
|
category: error.ErrorCategory.THIRD_PARTY,
|
|
1766
1766
|
details: { tableName: this.tableName }
|
|
@@ -1774,7 +1774,7 @@ var StoreOperationsDynamoDB = class extends storage.StoreOperations {
|
|
|
1774
1774
|
const entityName = this.getEntityNameForTable(tableName);
|
|
1775
1775
|
if (!entityName || !this.service.entities[entityName]) {
|
|
1776
1776
|
throw new error.MastraError({
|
|
1777
|
-
id: "
|
|
1777
|
+
id: storage.createStorageErrorId("DYNAMODB", "INSERT", "INVALID_ARGS"),
|
|
1778
1778
|
domain: error.ErrorDomain.STORAGE,
|
|
1779
1779
|
category: error.ErrorCategory.USER,
|
|
1780
1780
|
text: "No entity defined for tableName",
|
|
@@ -1787,7 +1787,7 @@ var StoreOperationsDynamoDB = class extends storage.StoreOperations {
|
|
|
1787
1787
|
} catch (error$1) {
|
|
1788
1788
|
throw new error.MastraError(
|
|
1789
1789
|
{
|
|
1790
|
-
id: "
|
|
1790
|
+
id: storage.createStorageErrorId("DYNAMODB", "INSERT", "FAILED"),
|
|
1791
1791
|
domain: error.ErrorDomain.STORAGE,
|
|
1792
1792
|
category: error.ErrorCategory.THIRD_PARTY,
|
|
1793
1793
|
details: { tableName }
|
|
@@ -1806,7 +1806,7 @@ var StoreOperationsDynamoDB = class extends storage.StoreOperations {
|
|
|
1806
1806
|
const entityName = this.getEntityNameForTable(tableName);
|
|
1807
1807
|
if (!entityName || !this.service.entities[entityName]) {
|
|
1808
1808
|
throw new error.MastraError({
|
|
1809
|
-
id: "
|
|
1809
|
+
id: storage.createStorageErrorId("DYNAMODB", "CLEAR_TABLE", "INVALID_ARGS"),
|
|
1810
1810
|
domain: error.ErrorDomain.STORAGE,
|
|
1811
1811
|
category: error.ErrorCategory.USER,
|
|
1812
1812
|
text: "No entity defined for tableName",
|
|
@@ -1869,7 +1869,7 @@ var StoreOperationsDynamoDB = class extends storage.StoreOperations {
|
|
|
1869
1869
|
} catch (error$1) {
|
|
1870
1870
|
throw new error.MastraError(
|
|
1871
1871
|
{
|
|
1872
|
-
id: "
|
|
1872
|
+
id: storage.createStorageErrorId("DYNAMODB", "CLEAR_TABLE", "FAILED"),
|
|
1873
1873
|
domain: error.ErrorDomain.STORAGE,
|
|
1874
1874
|
category: error.ErrorCategory.THIRD_PARTY,
|
|
1875
1875
|
details: { tableName }
|
|
@@ -1886,7 +1886,7 @@ var StoreOperationsDynamoDB = class extends storage.StoreOperations {
|
|
|
1886
1886
|
const entityName = this.getEntityNameForTable(tableName);
|
|
1887
1887
|
if (!entityName || !this.service.entities[entityName]) {
|
|
1888
1888
|
throw new error.MastraError({
|
|
1889
|
-
id: "
|
|
1889
|
+
id: storage.createStorageErrorId("DYNAMODB", "BATCH_INSERT", "INVALID_ARGS"),
|
|
1890
1890
|
domain: error.ErrorDomain.STORAGE,
|
|
1891
1891
|
category: error.ErrorCategory.USER,
|
|
1892
1892
|
text: "No entity defined for tableName",
|
|
@@ -1914,7 +1914,7 @@ var StoreOperationsDynamoDB = class extends storage.StoreOperations {
|
|
|
1914
1914
|
} catch (error$1) {
|
|
1915
1915
|
throw new error.MastraError(
|
|
1916
1916
|
{
|
|
1917
|
-
id: "
|
|
1917
|
+
id: storage.createStorageErrorId("DYNAMODB", "BATCH_INSERT", "FAILED"),
|
|
1918
1918
|
domain: error.ErrorDomain.STORAGE,
|
|
1919
1919
|
category: error.ErrorCategory.THIRD_PARTY,
|
|
1920
1920
|
details: { tableName }
|
|
@@ -1931,7 +1931,7 @@ var StoreOperationsDynamoDB = class extends storage.StoreOperations {
|
|
|
1931
1931
|
const entityName = this.getEntityNameForTable(tableName);
|
|
1932
1932
|
if (!entityName || !this.service.entities[entityName]) {
|
|
1933
1933
|
throw new error.MastraError({
|
|
1934
|
-
id: "
|
|
1934
|
+
id: storage.createStorageErrorId("DYNAMODB", "LOAD", "INVALID_ARGS"),
|
|
1935
1935
|
domain: error.ErrorDomain.STORAGE,
|
|
1936
1936
|
category: error.ErrorCategory.USER,
|
|
1937
1937
|
text: "No entity defined for tableName",
|
|
@@ -1949,7 +1949,7 @@ var StoreOperationsDynamoDB = class extends storage.StoreOperations {
|
|
|
1949
1949
|
} catch (error$1) {
|
|
1950
1950
|
throw new error.MastraError(
|
|
1951
1951
|
{
|
|
1952
|
-
id: "
|
|
1952
|
+
id: storage.createStorageErrorId("DYNAMODB", "LOAD", "FAILED"),
|
|
1953
1953
|
domain: error.ErrorDomain.STORAGE,
|
|
1954
1954
|
category: error.ErrorCategory.THIRD_PARTY,
|
|
1955
1955
|
details: { tableName }
|
|
@@ -2000,7 +2000,7 @@ var ScoresStorageDynamoDB = class extends storage.ScoresStorage {
|
|
|
2000
2000
|
} catch (error$1) {
|
|
2001
2001
|
throw new error.MastraError(
|
|
2002
2002
|
{
|
|
2003
|
-
id: "
|
|
2003
|
+
id: storage.createStorageErrorId("DYNAMODB", "GET_SCORE_BY_ID", "FAILED"),
|
|
2004
2004
|
domain: error.ErrorDomain.STORAGE,
|
|
2005
2005
|
category: error.ErrorCategory.THIRD_PARTY,
|
|
2006
2006
|
details: { id }
|
|
@@ -2016,15 +2016,22 @@ var ScoresStorageDynamoDB = class extends storage.ScoresStorage {
|
|
|
2016
2016
|
} catch (error$1) {
|
|
2017
2017
|
throw new error.MastraError(
|
|
2018
2018
|
{
|
|
2019
|
-
id: "
|
|
2019
|
+
id: storage.createStorageErrorId("DYNAMODB", "SAVE_SCORE", "VALIDATION_FAILED"),
|
|
2020
2020
|
domain: error.ErrorDomain.STORAGE,
|
|
2021
|
-
category: error.ErrorCategory.
|
|
2021
|
+
category: error.ErrorCategory.USER,
|
|
2022
|
+
details: {
|
|
2023
|
+
scorer: score.scorer?.id ?? "unknown",
|
|
2024
|
+
entityId: score.entityId ?? "unknown",
|
|
2025
|
+
entityType: score.entityType ?? "unknown",
|
|
2026
|
+
traceId: score.traceId ?? "",
|
|
2027
|
+
spanId: score.spanId ?? ""
|
|
2028
|
+
}
|
|
2022
2029
|
},
|
|
2023
2030
|
error$1
|
|
2024
2031
|
);
|
|
2025
2032
|
}
|
|
2026
2033
|
const now = /* @__PURE__ */ new Date();
|
|
2027
|
-
const scoreId =
|
|
2034
|
+
const scoreId = crypto.randomUUID();
|
|
2028
2035
|
const scorer = typeof validatedScore.scorer === "string" ? validatedScore.scorer : JSON.stringify(validatedScore.scorer);
|
|
2029
2036
|
const preprocessStepResult = typeof validatedScore.preprocessStepResult === "string" ? validatedScore.preprocessStepResult : JSON.stringify(validatedScore.preprocessStepResult);
|
|
2030
2037
|
const analyzeStepResult = typeof validatedScore.analyzeStepResult === "string" ? validatedScore.analyzeStepResult : JSON.stringify(validatedScore.analyzeStepResult);
|
|
@@ -2054,17 +2061,18 @@ var ScoresStorageDynamoDB = class extends storage.ScoresStorage {
|
|
|
2054
2061
|
);
|
|
2055
2062
|
try {
|
|
2056
2063
|
await this.service.entities.score.upsert(scoreData).go();
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
2064
|
+
return {
|
|
2065
|
+
score: {
|
|
2066
|
+
...validatedScore,
|
|
2067
|
+
id: scoreId,
|
|
2068
|
+
createdAt: now,
|
|
2069
|
+
updatedAt: now
|
|
2070
|
+
}
|
|
2062
2071
|
};
|
|
2063
|
-
return { score: savedScore };
|
|
2064
2072
|
} catch (error$1) {
|
|
2065
2073
|
throw new error.MastraError(
|
|
2066
2074
|
{
|
|
2067
|
-
id: "
|
|
2075
|
+
id: storage.createStorageErrorId("DYNAMODB", "SAVE_SCORE", "FAILED"),
|
|
2068
2076
|
domain: error.ErrorDomain.STORAGE,
|
|
2069
2077
|
category: error.ErrorCategory.THIRD_PARTY,
|
|
2070
2078
|
details: { scorerId: score.scorerId, runId: score.runId }
|
|
@@ -2112,7 +2120,7 @@ var ScoresStorageDynamoDB = class extends storage.ScoresStorage {
|
|
|
2112
2120
|
} catch (error$1) {
|
|
2113
2121
|
throw new error.MastraError(
|
|
2114
2122
|
{
|
|
2115
|
-
id: "
|
|
2123
|
+
id: storage.createStorageErrorId("DYNAMODB", "LIST_SCORES_BY_SCORER_ID", "FAILED"),
|
|
2116
2124
|
domain: error.ErrorDomain.STORAGE,
|
|
2117
2125
|
category: error.ErrorCategory.THIRD_PARTY,
|
|
2118
2126
|
details: {
|
|
@@ -2156,7 +2164,7 @@ var ScoresStorageDynamoDB = class extends storage.ScoresStorage {
|
|
|
2156
2164
|
} catch (error$1) {
|
|
2157
2165
|
throw new error.MastraError(
|
|
2158
2166
|
{
|
|
2159
|
-
id: "
|
|
2167
|
+
id: storage.createStorageErrorId("DYNAMODB", "LIST_SCORES_BY_RUN_ID", "FAILED"),
|
|
2160
2168
|
domain: error.ErrorDomain.STORAGE,
|
|
2161
2169
|
category: error.ErrorCategory.THIRD_PARTY,
|
|
2162
2170
|
details: { runId, page: pagination.page, perPage: pagination.perPage }
|
|
@@ -2195,7 +2203,7 @@ var ScoresStorageDynamoDB = class extends storage.ScoresStorage {
|
|
|
2195
2203
|
} catch (error$1) {
|
|
2196
2204
|
throw new error.MastraError(
|
|
2197
2205
|
{
|
|
2198
|
-
id: "
|
|
2206
|
+
id: storage.createStorageErrorId("DYNAMODB", "LIST_SCORES_BY_ENTITY_ID", "FAILED"),
|
|
2199
2207
|
domain: error.ErrorDomain.STORAGE,
|
|
2200
2208
|
category: error.ErrorCategory.THIRD_PARTY,
|
|
2201
2209
|
details: { entityId, entityType, page: pagination.page, perPage: pagination.perPage }
|
|
@@ -2233,7 +2241,7 @@ var ScoresStorageDynamoDB = class extends storage.ScoresStorage {
|
|
|
2233
2241
|
} catch (error$1) {
|
|
2234
2242
|
throw new error.MastraError(
|
|
2235
2243
|
{
|
|
2236
|
-
id: "
|
|
2244
|
+
id: storage.createStorageErrorId("DYNAMODB", "LIST_SCORES_BY_SPAN", "FAILED"),
|
|
2237
2245
|
domain: error.ErrorDomain.STORAGE,
|
|
2238
2246
|
category: error.ErrorCategory.THIRD_PARTY,
|
|
2239
2247
|
details: { traceId, spanId, page: pagination.page, perPage: pagination.perPage }
|
|
@@ -2299,7 +2307,7 @@ var WorkflowStorageDynamoDB = class extends storage.WorkflowsStorage {
|
|
|
2299
2307
|
} catch (error$1) {
|
|
2300
2308
|
throw new error.MastraError(
|
|
2301
2309
|
{
|
|
2302
|
-
id: "
|
|
2310
|
+
id: storage.createStorageErrorId("DYNAMODB", "PERSIST_WORKFLOW_SNAPSHOT", "FAILED"),
|
|
2303
2311
|
domain: error.ErrorDomain.STORAGE,
|
|
2304
2312
|
category: error.ErrorCategory.THIRD_PARTY,
|
|
2305
2313
|
details: { workflowName, runId }
|
|
@@ -2327,7 +2335,7 @@ var WorkflowStorageDynamoDB = class extends storage.WorkflowsStorage {
|
|
|
2327
2335
|
} catch (error$1) {
|
|
2328
2336
|
throw new error.MastraError(
|
|
2329
2337
|
{
|
|
2330
|
-
id: "
|
|
2338
|
+
id: storage.createStorageErrorId("DYNAMODB", "LOAD_WORKFLOW_SNAPSHOT", "FAILED"),
|
|
2331
2339
|
domain: error.ErrorDomain.STORAGE,
|
|
2332
2340
|
category: error.ErrorCategory.THIRD_PARTY,
|
|
2333
2341
|
details: { workflowName, runId }
|
|
@@ -2344,7 +2352,7 @@ var WorkflowStorageDynamoDB = class extends storage.WorkflowsStorage {
|
|
|
2344
2352
|
if (page < 0) {
|
|
2345
2353
|
throw new error.MastraError(
|
|
2346
2354
|
{
|
|
2347
|
-
id: "
|
|
2355
|
+
id: storage.createStorageErrorId("DYNAMODB", "LIST_WORKFLOW_RUNS", "INVALID_PAGE"),
|
|
2348
2356
|
domain: error.ErrorDomain.STORAGE,
|
|
2349
2357
|
category: error.ErrorCategory.USER,
|
|
2350
2358
|
details: { page }
|
|
@@ -2414,7 +2422,7 @@ var WorkflowStorageDynamoDB = class extends storage.WorkflowsStorage {
|
|
|
2414
2422
|
} catch (error$1) {
|
|
2415
2423
|
throw new error.MastraError(
|
|
2416
2424
|
{
|
|
2417
|
-
id: "
|
|
2425
|
+
id: storage.createStorageErrorId("DYNAMODB", "LIST_WORKFLOW_RUNS", "FAILED"),
|
|
2418
2426
|
domain: error.ErrorDomain.STORAGE,
|
|
2419
2427
|
category: error.ErrorCategory.THIRD_PARTY,
|
|
2420
2428
|
details: { workflowName: args?.workflowName || "", resourceId: args?.resourceId || "" }
|
|
@@ -2468,7 +2476,7 @@ var WorkflowStorageDynamoDB = class extends storage.WorkflowsStorage {
|
|
|
2468
2476
|
} catch (error$1) {
|
|
2469
2477
|
throw new error.MastraError(
|
|
2470
2478
|
{
|
|
2471
|
-
id: "
|
|
2479
|
+
id: storage.createStorageErrorId("DYNAMODB", "GET_WORKFLOW_RUN_BY_ID", "FAILED"),
|
|
2472
2480
|
domain: error.ErrorDomain.STORAGE,
|
|
2473
2481
|
category: error.ErrorCategory.THIRD_PARTY,
|
|
2474
2482
|
details: { runId, workflowName: args?.workflowName || "" }
|
|
@@ -2487,7 +2495,7 @@ var DynamoDBStore = class extends storage.MastraStorage {
|
|
|
2487
2495
|
hasInitialized = null;
|
|
2488
2496
|
stores;
|
|
2489
2497
|
constructor({ name, config }) {
|
|
2490
|
-
super({ id: config.id, name });
|
|
2498
|
+
super({ id: config.id, name, disableInit: config.disableInit });
|
|
2491
2499
|
try {
|
|
2492
2500
|
if (!config.tableName || typeof config.tableName !== "string" || config.tableName.trim() === "") {
|
|
2493
2501
|
throw new Error("DynamoDBStore: config.tableName must be provided and cannot be empty.");
|
|
@@ -2522,7 +2530,7 @@ var DynamoDBStore = class extends storage.MastraStorage {
|
|
|
2522
2530
|
} catch (error$1) {
|
|
2523
2531
|
throw new error.MastraError(
|
|
2524
2532
|
{
|
|
2525
|
-
id: "
|
|
2533
|
+
id: storage.createStorageErrorId("DYNAMODB", "CONSTRUCTOR", "FAILED"),
|
|
2526
2534
|
domain: error.ErrorDomain.STORAGE,
|
|
2527
2535
|
category: error.ErrorCategory.USER
|
|
2528
2536
|
},
|
|
@@ -2558,7 +2566,7 @@ var DynamoDBStore = class extends storage.MastraStorage {
|
|
|
2558
2566
|
}
|
|
2559
2567
|
throw new error.MastraError(
|
|
2560
2568
|
{
|
|
2561
|
-
id: "
|
|
2569
|
+
id: storage.createStorageErrorId("DYNAMODB", "VALIDATE_TABLE_EXISTS", "FAILED"),
|
|
2562
2570
|
domain: error.ErrorDomain.STORAGE,
|
|
2563
2571
|
category: error.ErrorCategory.THIRD_PARTY,
|
|
2564
2572
|
details: { tableName: this.tableName }
|
|
@@ -2581,7 +2589,7 @@ var DynamoDBStore = class extends storage.MastraStorage {
|
|
|
2581
2589
|
} catch (error$1) {
|
|
2582
2590
|
throw new error.MastraError(
|
|
2583
2591
|
{
|
|
2584
|
-
id: "
|
|
2592
|
+
id: storage.createStorageErrorId("DYNAMODB", "INIT", "FAILED"),
|
|
2585
2593
|
domain: error.ErrorDomain.STORAGE,
|
|
2586
2594
|
category: error.ErrorCategory.THIRD_PARTY,
|
|
2587
2595
|
details: { tableName: this.tableName }
|
|
@@ -2716,7 +2724,7 @@ var DynamoDBStore = class extends storage.MastraStorage {
|
|
|
2716
2724
|
} catch (error$1) {
|
|
2717
2725
|
throw new error.MastraError(
|
|
2718
2726
|
{
|
|
2719
|
-
id: "
|
|
2727
|
+
id: storage.createStorageErrorId("DYNAMODB", "CLOSE", "FAILED"),
|
|
2720
2728
|
domain: error.ErrorDomain.STORAGE,
|
|
2721
2729
|
category: error.ErrorCategory.THIRD_PARTY
|
|
2722
2730
|
},
|
|
@@ -2730,8 +2738,8 @@ var DynamoDBStore = class extends storage.MastraStorage {
|
|
|
2730
2738
|
async getScoreById({ id: _id }) {
|
|
2731
2739
|
return this.stores.scores.getScoreById({ id: _id });
|
|
2732
2740
|
}
|
|
2733
|
-
async saveScore(
|
|
2734
|
-
return this.stores.scores.saveScore(
|
|
2741
|
+
async saveScore(score) {
|
|
2742
|
+
return this.stores.scores.saveScore(score);
|
|
2735
2743
|
}
|
|
2736
2744
|
async listScoresByRunId({
|
|
2737
2745
|
runId: _runId,
|