@voltagent/libsql 2.0.1 → 2.0.3
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/dist/edge.d.mts +1 -1
- package/dist/edge.d.ts +1 -1
- package/dist/edge.js +30 -0
- package/dist/edge.js.map +1 -1
- package/dist/edge.mjs +30 -0
- package/dist/edge.mjs.map +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +30 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +30 -0
- package/dist/index.mjs.map +1 -1
- package/dist/{vector-core-CKn8FNVK.d.mts → vector-core-J7BkPuy8.d.mts} +2 -0
- package/dist/{vector-core-CKn8FNVK.d.ts → vector-core-J7BkPuy8.d.ts} +2 -0
- package/package.json +4 -4
package/dist/index.mjs
CHANGED
|
@@ -590,6 +590,19 @@ var LibSQLMemoryCore = class {
|
|
|
590
590
|
});
|
|
591
591
|
}
|
|
592
592
|
}
|
|
593
|
+
async deleteMessages(messageIds, userId, conversationId) {
|
|
594
|
+
await this.initialize();
|
|
595
|
+
if (messageIds.length === 0) {
|
|
596
|
+
return;
|
|
597
|
+
}
|
|
598
|
+
const messagesTable = `${this.tablePrefix}_messages`;
|
|
599
|
+
const placeholders = messageIds.map(() => "?").join(",");
|
|
600
|
+
const sql = `DELETE FROM ${messagesTable} WHERE conversation_id = ? AND user_id = ? AND message_id IN (${placeholders})`;
|
|
601
|
+
await this.client.execute({
|
|
602
|
+
sql,
|
|
603
|
+
args: [conversationId, userId, ...messageIds]
|
|
604
|
+
});
|
|
605
|
+
}
|
|
593
606
|
// ============================================================================
|
|
594
607
|
// Conversation Operations
|
|
595
608
|
// ============================================================================
|
|
@@ -702,6 +715,23 @@ var LibSQLMemoryCore = class {
|
|
|
702
715
|
updatedAt: row.updated_at
|
|
703
716
|
}));
|
|
704
717
|
}
|
|
718
|
+
async countConversations(options) {
|
|
719
|
+
await this.initialize();
|
|
720
|
+
const conversationsTable = `${this.tablePrefix}_conversations`;
|
|
721
|
+
let sql = `SELECT COUNT(*) as count FROM ${conversationsTable} WHERE 1=1`;
|
|
722
|
+
const args = [];
|
|
723
|
+
if (options.userId) {
|
|
724
|
+
sql += " AND user_id = ?";
|
|
725
|
+
args.push(options.userId);
|
|
726
|
+
}
|
|
727
|
+
if (options.resourceId) {
|
|
728
|
+
sql += " AND resource_id = ?";
|
|
729
|
+
args.push(options.resourceId);
|
|
730
|
+
}
|
|
731
|
+
const result = await this.client.execute({ sql, args });
|
|
732
|
+
const count = Number(result.rows[0]?.count ?? 0);
|
|
733
|
+
return Number.isNaN(count) ? 0 : count;
|
|
734
|
+
}
|
|
705
735
|
async updateConversation(id, updates) {
|
|
706
736
|
await this.initialize();
|
|
707
737
|
const conversationsTable = `${this.tablePrefix}_conversations`;
|