@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 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/edge.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/edge.js CHANGED
@@ -617,6 +617,19 @@ var LibSQLMemoryCore = class {
617
617
  });
618
618
  }
619
619
  }
620
+ async deleteMessages(messageIds, userId, conversationId) {
621
+ await this.initialize();
622
+ if (messageIds.length === 0) {
623
+ return;
624
+ }
625
+ const messagesTable = `${this.tablePrefix}_messages`;
626
+ const placeholders = messageIds.map(() => "?").join(",");
627
+ const sql = `DELETE FROM ${messagesTable} WHERE conversation_id = ? AND user_id = ? AND message_id IN (${placeholders})`;
628
+ await this.client.execute({
629
+ sql,
630
+ args: [conversationId, userId, ...messageIds]
631
+ });
632
+ }
620
633
  // ============================================================================
621
634
  // Conversation Operations
622
635
  // ============================================================================
@@ -729,6 +742,23 @@ var LibSQLMemoryCore = class {
729
742
  updatedAt: row.updated_at
730
743
  }));
731
744
  }
745
+ async countConversations(options) {
746
+ await this.initialize();
747
+ const conversationsTable = `${this.tablePrefix}_conversations`;
748
+ let sql = `SELECT COUNT(*) as count FROM ${conversationsTable} WHERE 1=1`;
749
+ const args = [];
750
+ if (options.userId) {
751
+ sql += " AND user_id = ?";
752
+ args.push(options.userId);
753
+ }
754
+ if (options.resourceId) {
755
+ sql += " AND resource_id = ?";
756
+ args.push(options.resourceId);
757
+ }
758
+ const result = await this.client.execute({ sql, args });
759
+ const count = Number(result.rows[0]?.count ?? 0);
760
+ return Number.isNaN(count) ? 0 : count;
761
+ }
732
762
  async updateConversation(id, updates) {
733
763
  await this.initialize();
734
764
  const conversationsTable = `${this.tablePrefix}_conversations`;