@mastra/upstash 0.0.0-zod-v4-compat-part-2-20250820135355 → 0.0.0-zod-v4-stuff-20250825154219

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 CHANGED
@@ -1,14 +1,118 @@
1
1
  # @mastra/upstash
2
2
 
3
- ## 0.0.0-zod-v4-compat-part-2-20250820135355
3
+ ## 0.0.0-zod-v4-stuff-20250825154219
4
4
 
5
5
  ### Patch Changes
6
6
 
7
+ - Updated dependencies [[`0778757`](https://github.com/mastra-ai/mastra/commit/07787570e4addbd501522037bd2542c3d9e26822), [`bf504a8`](https://github.com/mastra-ai/mastra/commit/bf504a833051f6f321d832cc7d631f3cb86d657b), [`e6f5046`](https://github.com/mastra-ai/mastra/commit/e6f50467aff317e67e8bd74c485c3fbe2a5a6db1), [`d51eac2`](https://github.com/mastra-ai/mastra/commit/d51eac24ba0fbb33d3e22dcc310f9c0e7167598d), [`9613558`](https://github.com/mastra-ai/mastra/commit/9613558e6475f4710e05d1be7553a32ee7bddc20)]:
8
+ - @mastra/core@0.0.0-zod-v4-stuff-20250825154219
9
+
10
+ ## 0.14.2
11
+
12
+ ### Patch Changes
13
+
14
+ - [#6700](https://github.com/mastra-ai/mastra/pull/6700) [`a5a23d9`](https://github.com/mastra-ai/mastra/commit/a5a23d981920d458dc6078919992a5338931ef02) Thanks [@gpanakkal](https://github.com/gpanakkal)! - Add `getMessagesById` method to `MastraStorage` adapters
15
+
16
+ - Updated dependencies [[`6e7e120`](https://github.com/mastra-ai/mastra/commit/6e7e1207d6e8d8b838f9024f90bd10df1181ba27), [`0f00e17`](https://github.com/mastra-ai/mastra/commit/0f00e172953ccdccadb35ed3d70f5e4d89115869), [`217cd7a`](https://github.com/mastra-ai/mastra/commit/217cd7a4ce171e9a575c41bb8c83300f4db03236), [`a5a23d9`](https://github.com/mastra-ai/mastra/commit/a5a23d981920d458dc6078919992a5338931ef02)]:
17
+ - @mastra/core@0.14.1
18
+
19
+ ## 0.14.2-alpha.0
20
+
21
+ ### Patch Changes
22
+
23
+ - [#6700](https://github.com/mastra-ai/mastra/pull/6700) [`a5a23d9`](https://github.com/mastra-ai/mastra/commit/a5a23d981920d458dc6078919992a5338931ef02) Thanks [@gpanakkal](https://github.com/gpanakkal)! - Add `getMessagesById` method to `MastraStorage` adapters
24
+
25
+ - Updated dependencies [[`6e7e120`](https://github.com/mastra-ai/mastra/commit/6e7e1207d6e8d8b838f9024f90bd10df1181ba27), [`a5a23d9`](https://github.com/mastra-ai/mastra/commit/a5a23d981920d458dc6078919992a5338931ef02)]:
26
+ - @mastra/core@0.14.1-alpha.0
27
+
28
+ ## 0.14.1
29
+
30
+ ### Patch Changes
31
+
32
+ - 03997ae: Update peerdeps
33
+ - Updated dependencies [227c7e6]
34
+ - Updated dependencies [12cae67]
35
+ - Updated dependencies [fd3a3eb]
36
+ - Updated dependencies [6faaee5]
37
+ - Updated dependencies [4232b14]
38
+ - Updated dependencies [a89de7e]
39
+ - Updated dependencies [5a37d0c]
40
+ - Updated dependencies [4bde0cb]
41
+ - Updated dependencies [cf4f357]
42
+ - Updated dependencies [ad888a2]
43
+ - Updated dependencies [481751d]
44
+ - Updated dependencies [2454423]
45
+ - Updated dependencies [194e395]
46
+ - Updated dependencies [a722c0b]
47
+ - Updated dependencies [c30bca8]
48
+ - Updated dependencies [3b5fec7]
49
+ - Updated dependencies [a8f129d]
50
+ - @mastra/core@0.14.0
51
+
52
+ ## 0.14.1-alpha.0
53
+
54
+ ### Patch Changes
55
+
56
+ - 03997ae: Update peerdeps
57
+ - @mastra/core@0.14.0-alpha.7
58
+
59
+ ## 0.14.0
60
+
61
+ ### Minor Changes
62
+
63
+ - ea0c5f2: Add store support to new score api
64
+
65
+ ### Patch Changes
66
+
67
+ - e1a2ef1: dependencies updates:
68
+ - Updated dependency [`@upstash/redis@^1.35.3` ↗︎](https://www.npmjs.com/package/@upstash/redis/v/1.35.3) (from `^1.35.1`, in `dependencies`)
69
+ - 4a406ec: fixes TypeScript declaration file imports to ensure proper ESM compatibility
70
+ - 50f80dd: Fix dynamic require of crypto in upstash store
71
+ - Updated dependencies [cb36de0]
72
+ - Updated dependencies [d0496e6]
73
+ - Updated dependencies [a82b851]
74
+ - Updated dependencies [ea0c5f2]
75
+ - Updated dependencies [41a0a0e]
76
+ - Updated dependencies [2871020]
7
77
  - Updated dependencies [94f4812]
8
78
  - Updated dependencies [e202b82]
9
79
  - Updated dependencies [e00f6a0]
80
+ - Updated dependencies [4a406ec]
81
+ - Updated dependencies [b0e43c1]
82
+ - Updated dependencies [5d377e5]
83
+ - Updated dependencies [1fb812e]
84
+ - Updated dependencies [35c5798]
85
+ - @mastra/core@0.13.0
86
+
87
+ ## 0.14.0-alpha.1
88
+
89
+ ### Patch Changes
90
+
91
+ - e1a2ef1: dependencies updates:
92
+ - Updated dependency [`@upstash/redis@^1.35.3` ↗︎](https://www.npmjs.com/package/@upstash/redis/v/1.35.3) (from `^1.35.1`, in `dependencies`)
93
+ - 4a406ec: fixes TypeScript declaration file imports to ensure proper ESM compatibility
94
+ - 50f80dd: Fix dynamic require of crypto in upstash store
95
+ - Updated dependencies [cb36de0]
96
+ - Updated dependencies [a82b851]
97
+ - Updated dependencies [41a0a0e]
98
+ - Updated dependencies [2871020]
99
+ - Updated dependencies [4a406ec]
100
+ - Updated dependencies [5d377e5]
101
+ - @mastra/core@0.13.0-alpha.2
102
+
103
+ ## 0.14.0-alpha.0
104
+
105
+ ### Minor Changes
106
+
107
+ - ea0c5f2: Add store support to new score api
108
+
109
+ ### Patch Changes
110
+
111
+ - Updated dependencies [ea0c5f2]
112
+ - Updated dependencies [b0e43c1]
113
+ - Updated dependencies [1fb812e]
10
114
  - Updated dependencies [35c5798]
11
- - @mastra/core@0.0.0-zod-v4-compat-part-2-20250820135355
115
+ - @mastra/core@0.13.0-alpha.1
12
116
 
13
117
  ## 0.13.0
14
118
 
package/dist/index.cjs CHANGED
@@ -4,6 +4,7 @@ var storage = require('@mastra/core/storage');
4
4
  var redis = require('@upstash/redis');
5
5
  var error = require('@mastra/core/error');
6
6
  var agent = require('@mastra/core/agent');
7
+ var crypto = require('crypto');
7
8
  var vector = require('@mastra/core/vector');
8
9
  var vector$1 = require('@upstash/vector');
9
10
  var filter = require('@mastra/core/vector/filter');
@@ -252,6 +253,8 @@ function processRecord(tableName, record) {
252
253
  });
253
254
  } else if (tableName === storage.TABLE_EVALS) {
254
255
  key = getKey(tableName, { id: record.run_id });
256
+ } else if (tableName === storage.TABLE_SCORERS) {
257
+ key = getKey(tableName, { runId: record.runId });
255
258
  } else {
256
259
  key = getKey(tableName, { id: record.id });
257
260
  }
@@ -621,6 +624,15 @@ var StoreMemoryUpstash = class extends storage.MemoryStorage {
621
624
  }
622
625
  return [];
623
626
  }
627
+ parseStoredMessage(storedMessage) {
628
+ const defaultMessageContent = { format: 2, parts: [{ type: "text", text: "" }] };
629
+ const { _index, ...rest } = storedMessage;
630
+ return {
631
+ ...rest,
632
+ createdAt: new Date(rest.createdAt),
633
+ content: rest.content || defaultMessageContent
634
+ };
635
+ }
624
636
  async getMessages({
625
637
  threadId,
626
638
  selectBy,
@@ -696,6 +708,40 @@ var StoreMemoryUpstash = class extends storage.MemoryStorage {
696
708
  );
697
709
  }
698
710
  }
711
+ async getMessagesById({
712
+ messageIds,
713
+ format
714
+ }) {
715
+ if (messageIds.length === 0) return [];
716
+ try {
717
+ const threadKeys = await this.client.keys("thread:*");
718
+ const result = await Promise.all(
719
+ threadKeys.map((threadKey) => {
720
+ const threadId = threadKey.split(":")[1];
721
+ if (!threadId) throw new Error(`Failed to parse thread ID from thread key "${threadKey}"`);
722
+ return this.client.mget(
723
+ messageIds.map((id) => getMessageKey(threadId, id))
724
+ );
725
+ })
726
+ );
727
+ const rawMessages = result.flat(1).filter((msg) => !!msg);
728
+ const list = new agent.MessageList().add(rawMessages.map(this.parseStoredMessage), "memory");
729
+ if (format === `v1`) return list.get.all.v1();
730
+ return list.get.all.v2();
731
+ } catch (error$1) {
732
+ throw new error.MastraError(
733
+ {
734
+ id: "STORAGE_UPSTASH_STORAGE_GET_MESSAGES_BY_ID_FAILED",
735
+ domain: error.ErrorDomain.STORAGE,
736
+ category: error.ErrorCategory.THIRD_PARTY,
737
+ details: {
738
+ messageIds: JSON.stringify(messageIds)
739
+ }
740
+ },
741
+ error$1
742
+ );
743
+ }
744
+ }
699
745
  async getMessagesPaginated(args) {
700
746
  const { threadId, selectBy, format } = args;
701
747
  const { page = 0, perPage = 40, dateRange } = selectBy?.pagination || {};
@@ -1156,7 +1202,9 @@ function transformScoreRow(row) {
1156
1202
  return {
1157
1203
  ...row,
1158
1204
  scorer: parseField(row.scorer),
1159
- extractStepResult: parseField(row.extractStepResult),
1205
+ preprocessStepResult: parseField(row.preprocessStepResult),
1206
+ generateScorePrompt: row.generateScorePrompt,
1207
+ generateReasonPrompt: row.generateReasonPrompt,
1160
1208
  analyzeStepResult: parseField(row.analyzeStepResult),
1161
1209
  metadata: parseField(row.metadata),
1162
1210
  input: parseField(row.input),
@@ -1198,6 +1246,9 @@ var ScoresUpstash = class extends storage.ScoresStorage {
1198
1246
  }
1199
1247
  async getScoresByScorerId({
1200
1248
  scorerId,
1249
+ entityId,
1250
+ entityType,
1251
+ source,
1201
1252
  pagination = { page: 0, perPage: 20 }
1202
1253
  }) {
1203
1254
  const pattern = `${storage.TABLE_SCORERS}:*`;
@@ -1211,7 +1262,14 @@ var ScoresUpstash = class extends storage.ScoresStorage {
1211
1262
  const pipeline = this.client.pipeline();
1212
1263
  keys.forEach((key) => pipeline.get(key));
1213
1264
  const results = await pipeline.exec();
1214
- const filtered = results.map((row) => row).filter((row) => !!row && typeof row === "object" && row.scorerId === scorerId);
1265
+ const filtered = results.map((row) => row).filter((row) => {
1266
+ if (!row || typeof row !== "object") return false;
1267
+ if (row.scorerId !== scorerId) return false;
1268
+ if (entityId && row.entityId !== entityId) return false;
1269
+ if (entityType && row.entityType !== entityType) return false;
1270
+ if (source && row.source !== source) return false;
1271
+ return true;
1272
+ });
1215
1273
  const total = filtered.length;
1216
1274
  const { page, perPage } = pagination;
1217
1275
  const start = page * perPage;
@@ -1764,6 +1822,12 @@ var UpstashStore = class extends storage.MastraStorage {
1764
1822
  }) {
1765
1823
  return this.stores.memory.getMessages({ threadId, selectBy, format });
1766
1824
  }
1825
+ async getMessagesById({
1826
+ messageIds,
1827
+ format
1828
+ }) {
1829
+ return this.stores.memory.getMessagesById({ messageIds, format });
1830
+ }
1767
1831
  async getMessagesPaginated(args) {
1768
1832
  return this.stores.memory.getMessagesPaginated(args);
1769
1833
  }
@@ -1835,9 +1899,12 @@ var UpstashStore = class extends storage.MastraStorage {
1835
1899
  }
1836
1900
  async getScoresByScorerId({
1837
1901
  scorerId,
1838
- pagination
1902
+ pagination,
1903
+ entityId,
1904
+ entityType,
1905
+ source
1839
1906
  }) {
1840
- return this.stores.scores.getScoresByScorerId({ scorerId, pagination });
1907
+ return this.stores.scores.getScoresByScorerId({ scorerId, pagination, entityId, entityType, source });
1841
1908
  }
1842
1909
  };
1843
1910
  var UpstashFilterTranslator = class extends filter.BaseFilterTranslator {