@mastra/cloudflare-d1 0.12.11 → 0.13.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.
- package/CHANGELOG.md +26 -0
- package/dist/index.cjs +14 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +14 -9
- package/dist/index.js.map +1 -1
- package/dist/storage/domains/memory/index.d.ts +1 -1
- package/dist/storage/domains/memory/index.d.ts.map +1 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,31 @@
|
|
|
1
1
|
# @mastra/cloudflare-d1
|
|
2
2
|
|
|
3
|
+
## 0.13.0-alpha.1
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 376913a: Update peerdeps of @mastra/core
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies [8fbf79e]
|
|
12
|
+
- @mastra/core@0.16.0-alpha.1
|
|
13
|
+
|
|
14
|
+
## 0.12.12-alpha.0
|
|
15
|
+
|
|
16
|
+
### Patch Changes
|
|
17
|
+
|
|
18
|
+
- 6f5eb7a: Throw if an empty or whitespace-only threadId is passed when getting messages
|
|
19
|
+
- Updated dependencies [fd83526]
|
|
20
|
+
- Updated dependencies [d0b90ab]
|
|
21
|
+
- Updated dependencies [6f5eb7a]
|
|
22
|
+
- Updated dependencies [a01cf14]
|
|
23
|
+
- Updated dependencies [a9e50ee]
|
|
24
|
+
- Updated dependencies [5397eb4]
|
|
25
|
+
- Updated dependencies [c9f4e4a]
|
|
26
|
+
- Updated dependencies [0acbc80]
|
|
27
|
+
- @mastra/core@0.16.0-alpha.0
|
|
28
|
+
|
|
3
29
|
## 0.12.11
|
|
4
30
|
|
|
5
31
|
### Patch Changes
|
package/dist/index.cjs
CHANGED
|
@@ -808,6 +808,7 @@ var MemoryStorageD1 = class extends storage.MemoryStorage {
|
|
|
808
808
|
}
|
|
809
809
|
}
|
|
810
810
|
async _getIncludedMessages(threadId, selectBy) {
|
|
811
|
+
if (!threadId.trim()) throw new Error("threadId must be a non-empty string");
|
|
811
812
|
const include = selectBy?.include;
|
|
812
813
|
if (!include) return null;
|
|
813
814
|
const unionQueries = [];
|
|
@@ -866,17 +867,19 @@ var MemoryStorageD1 = class extends storage.MemoryStorage {
|
|
|
866
867
|
}
|
|
867
868
|
async getMessages({
|
|
868
869
|
threadId,
|
|
870
|
+
resourceId,
|
|
869
871
|
selectBy,
|
|
870
872
|
format
|
|
871
873
|
}) {
|
|
872
|
-
const fullTableName = this.operations.getTableName(storage.TABLE_MESSAGES);
|
|
873
|
-
const limit = storage.resolveMessageLimit({
|
|
874
|
-
last: selectBy?.last,
|
|
875
|
-
defaultLimit: 40
|
|
876
|
-
});
|
|
877
|
-
const include = selectBy?.include || [];
|
|
878
|
-
const messages = [];
|
|
879
874
|
try {
|
|
875
|
+
if (!threadId.trim()) throw new Error("threadId must be a non-empty string");
|
|
876
|
+
const fullTableName = this.operations.getTableName(storage.TABLE_MESSAGES);
|
|
877
|
+
const limit = storage.resolveMessageLimit({
|
|
878
|
+
last: selectBy?.last,
|
|
879
|
+
defaultLimit: 40
|
|
880
|
+
});
|
|
881
|
+
const include = selectBy?.include || [];
|
|
882
|
+
const messages = [];
|
|
880
883
|
if (include.length) {
|
|
881
884
|
const includeResult = await this._getIncludedMessages(threadId, selectBy);
|
|
882
885
|
if (Array.isArray(includeResult)) messages.push(...includeResult);
|
|
@@ -916,7 +919,7 @@ var MemoryStorageD1 = class extends storage.MemoryStorage {
|
|
|
916
919
|
domain: error.ErrorDomain.STORAGE,
|
|
917
920
|
category: error.ErrorCategory.THIRD_PARTY,
|
|
918
921
|
text: `Failed to retrieve messages for thread ${threadId}: ${error$1 instanceof Error ? error$1.message : String(error$1)}`,
|
|
919
|
-
details: { threadId }
|
|
922
|
+
details: { threadId, resourceId: resourceId ?? "" }
|
|
920
923
|
},
|
|
921
924
|
error$1
|
|
922
925
|
);
|
|
@@ -968,6 +971,7 @@ var MemoryStorageD1 = class extends storage.MemoryStorage {
|
|
|
968
971
|
}
|
|
969
972
|
async getMessagesPaginated({
|
|
970
973
|
threadId,
|
|
974
|
+
resourceId,
|
|
971
975
|
selectBy,
|
|
972
976
|
format
|
|
973
977
|
}) {
|
|
@@ -977,6 +981,7 @@ var MemoryStorageD1 = class extends storage.MemoryStorage {
|
|
|
977
981
|
const fullTableName = this.operations.getTableName(storage.TABLE_MESSAGES);
|
|
978
982
|
const messages = [];
|
|
979
983
|
try {
|
|
984
|
+
if (!threadId.trim()) throw new Error("threadId must be a non-empty string");
|
|
980
985
|
if (selectBy?.include?.length) {
|
|
981
986
|
const includeResult = await this._getIncludedMessages(threadId, selectBy);
|
|
982
987
|
if (Array.isArray(includeResult)) messages.push(...includeResult);
|
|
@@ -1065,7 +1070,7 @@ var MemoryStorageD1 = class extends storage.MemoryStorage {
|
|
|
1065
1070
|
domain: error.ErrorDomain.STORAGE,
|
|
1066
1071
|
category: error.ErrorCategory.THIRD_PARTY,
|
|
1067
1072
|
text: `Failed to retrieve messages for thread ${threadId}: ${error$1 instanceof Error ? error$1.message : String(error$1)}`,
|
|
1068
|
-
details: { threadId }
|
|
1073
|
+
details: { threadId, resourceId: resourceId ?? "" }
|
|
1069
1074
|
},
|
|
1070
1075
|
error$1
|
|
1071
1076
|
);
|