@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/index.d.mts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { Logger } from '@voltagent/logger';
2
- import { L as LibSQLMemoryCore, a as LibSQLMemoryCoreOptions, b as LibSQLObservabilityCore, c as LibSQLObservabilityCoreOptions, d as LibSQLVectorCore, e as LibSQLVectorCoreOptions } from './vector-core-CKn8FNVK.mjs';
2
+ import { L as LibSQLMemoryCore, a as LibSQLMemoryCoreOptions, b as LibSQLObservabilityCore, c as LibSQLObservabilityCoreOptions, d as LibSQLVectorCore, e as LibSQLVectorCoreOptions } from './vector-core-J7BkPuy8.mjs';
3
3
  import '@libsql/client';
4
4
  import '@voltagent/core';
5
5
  import 'ai';
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { Logger } from '@voltagent/logger';
2
- import { L as LibSQLMemoryCore, a as LibSQLMemoryCoreOptions, b as LibSQLObservabilityCore, c as LibSQLObservabilityCoreOptions, d as LibSQLVectorCore, e as LibSQLVectorCoreOptions } from './vector-core-CKn8FNVK.js';
2
+ import { L as LibSQLMemoryCore, a as LibSQLMemoryCoreOptions, b as LibSQLObservabilityCore, c as LibSQLObservabilityCoreOptions, d as LibSQLVectorCore, e as LibSQLVectorCoreOptions } from './vector-core-J7BkPuy8.js';
3
3
  import '@libsql/client';
4
4
  import '@voltagent/core';
5
5
  import 'ai';
package/dist/index.js CHANGED
@@ -626,6 +626,19 @@ var LibSQLMemoryCore = class {
626
626
  });
627
627
  }
628
628
  }
629
+ async deleteMessages(messageIds, userId, conversationId) {
630
+ await this.initialize();
631
+ if (messageIds.length === 0) {
632
+ return;
633
+ }
634
+ const messagesTable = `${this.tablePrefix}_messages`;
635
+ const placeholders = messageIds.map(() => "?").join(",");
636
+ const sql = `DELETE FROM ${messagesTable} WHERE conversation_id = ? AND user_id = ? AND message_id IN (${placeholders})`;
637
+ await this.client.execute({
638
+ sql,
639
+ args: [conversationId, userId, ...messageIds]
640
+ });
641
+ }
629
642
  // ============================================================================
630
643
  // Conversation Operations
631
644
  // ============================================================================
@@ -738,6 +751,23 @@ var LibSQLMemoryCore = class {
738
751
  updatedAt: row.updated_at
739
752
  }));
740
753
  }
754
+ async countConversations(options) {
755
+ await this.initialize();
756
+ const conversationsTable = `${this.tablePrefix}_conversations`;
757
+ let sql = `SELECT COUNT(*) as count FROM ${conversationsTable} WHERE 1=1`;
758
+ const args = [];
759
+ if (options.userId) {
760
+ sql += " AND user_id = ?";
761
+ args.push(options.userId);
762
+ }
763
+ if (options.resourceId) {
764
+ sql += " AND resource_id = ?";
765
+ args.push(options.resourceId);
766
+ }
767
+ const result = await this.client.execute({ sql, args });
768
+ const count = Number(result.rows[0]?.count ?? 0);
769
+ return Number.isNaN(count) ? 0 : count;
770
+ }
741
771
  async updateConversation(id, updates) {
742
772
  await this.initialize();
743
773
  const conversationsTable = `${this.tablePrefix}_conversations`;