@mastra/libsql 0.13.3 → 0.13.4-alpha.0
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/.turbo/turbo-build.log +1 -1
- package/CHANGELOG.md +12 -0
- package/dist/index.cjs +42 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +42 -0
- package/dist/index.js.map +1 -1
- package/dist/storage/domains/memory/index.d.ts +8 -0
- package/dist/storage/domains/memory/index.d.ts.map +1 -1
- package/dist/storage/index.d.ts +8 -0
- package/dist/storage/index.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/storage/domains/memory/index.ts +56 -0
- package/src/storage/index.ts +12 -0
package/.turbo/turbo-build.log
CHANGED
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @mastra/libsql
|
|
2
2
|
|
|
3
|
+
## 0.13.4-alpha.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#6920](https://github.com/mastra-ai/mastra/pull/6920) [`64ad21f`](https://github.com/mastra-ai/mastra/commit/64ad21ff4f58ce8b344d163d800d9e4f84d82f6f) Thanks [@dane-ai-mastra](https://github.com/apps/dane-ai-mastra)! - dependencies updates:
|
|
8
|
+
- Updated dependency [`@libsql/client@^0.15.12` ↗︎](https://www.npmjs.com/package/@libsql/client/v/0.15.12) (from `^0.15.10`, in `dependencies`)
|
|
9
|
+
|
|
10
|
+
- [#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
|
|
11
|
+
|
|
12
|
+
- Updated dependencies [[`6e7e120`](https://github.com/mastra-ai/mastra/commit/6e7e1207d6e8d8b838f9024f90bd10df1181ba27), [`a5a23d9`](https://github.com/mastra-ai/mastra/commit/a5a23d981920d458dc6078919992a5338931ef02)]:
|
|
13
|
+
- @mastra/core@0.14.1-alpha.0
|
|
14
|
+
|
|
3
15
|
## 0.13.3
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
package/dist/index.cjs
CHANGED
|
@@ -1157,6 +1157,42 @@ var MemoryLibSQL = class extends storage.MemoryStorage {
|
|
|
1157
1157
|
);
|
|
1158
1158
|
}
|
|
1159
1159
|
}
|
|
1160
|
+
async getMessagesById({
|
|
1161
|
+
messageIds,
|
|
1162
|
+
format
|
|
1163
|
+
}) {
|
|
1164
|
+
if (messageIds.length === 0) return [];
|
|
1165
|
+
try {
|
|
1166
|
+
const sql = `
|
|
1167
|
+
SELECT
|
|
1168
|
+
id,
|
|
1169
|
+
content,
|
|
1170
|
+
role,
|
|
1171
|
+
type,
|
|
1172
|
+
"createdAt",
|
|
1173
|
+
thread_id,
|
|
1174
|
+
"resourceId"
|
|
1175
|
+
FROM "${storage.TABLE_MESSAGES}"
|
|
1176
|
+
WHERE id IN (${messageIds.map(() => "?").join(", ")})
|
|
1177
|
+
ORDER BY "createdAt" DESC
|
|
1178
|
+
`;
|
|
1179
|
+
const result = await this.client.execute({ sql, args: messageIds });
|
|
1180
|
+
if (!result.rows) return [];
|
|
1181
|
+
const list = new agent.MessageList().add(result.rows.map(this.parseRow), "memory");
|
|
1182
|
+
if (format === `v1`) return list.get.all.v1();
|
|
1183
|
+
return list.get.all.v2();
|
|
1184
|
+
} catch (error$1) {
|
|
1185
|
+
throw new error.MastraError(
|
|
1186
|
+
{
|
|
1187
|
+
id: "LIBSQL_STORE_GET_MESSAGES_BY_ID_FAILED",
|
|
1188
|
+
domain: error.ErrorDomain.STORAGE,
|
|
1189
|
+
category: error.ErrorCategory.THIRD_PARTY,
|
|
1190
|
+
details: { messageIds: JSON.stringify(messageIds) }
|
|
1191
|
+
},
|
|
1192
|
+
error$1
|
|
1193
|
+
);
|
|
1194
|
+
}
|
|
1195
|
+
}
|
|
1160
1196
|
async getMessagesPaginated(args) {
|
|
1161
1197
|
const { threadId, format, selectBy } = args;
|
|
1162
1198
|
const { page = 0, perPage: perPageInput, dateRange } = selectBy?.pagination || {};
|
|
@@ -2605,6 +2641,12 @@ var LibSQLStore = class extends storage.MastraStorage {
|
|
|
2605
2641
|
}) {
|
|
2606
2642
|
return this.stores.memory.getMessages({ threadId, selectBy, format });
|
|
2607
2643
|
}
|
|
2644
|
+
async getMessagesById({
|
|
2645
|
+
messageIds,
|
|
2646
|
+
format
|
|
2647
|
+
}) {
|
|
2648
|
+
return this.stores.memory.getMessagesById({ messageIds, format });
|
|
2649
|
+
}
|
|
2608
2650
|
async getMessagesPaginated(args) {
|
|
2609
2651
|
return this.stores.memory.getMessagesPaginated(args);
|
|
2610
2652
|
}
|