@voltagent/libsql 2.0.3 → 2.1.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/dist/edge.d.mts +1 -1
- package/dist/edge.d.ts +1 -1
- package/dist/edge.js +25 -3
- package/dist/edge.js.map +1 -1
- package/dist/edge.mjs +25 -3
- 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 +25 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +25 -3
- package/dist/index.mjs.map +1 -1
- package/dist/{vector-core-J7BkPuy8.d.mts → vector-core-CMBjkmEw.d.mts} +2 -9
- package/dist/{vector-core-J7BkPuy8.d.ts → vector-core-CMBjkmEw.d.ts} +2 -9
- package/package.json +2 -2
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-
|
|
2
|
+
import { L as LibSQLMemoryCore, a as LibSQLMemoryCoreOptions, b as LibSQLObservabilityCore, c as LibSQLObservabilityCoreOptions, d as LibSQLVectorCore, e as LibSQLVectorCoreOptions } from './vector-core-CMBjkmEw.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-
|
|
2
|
+
import { L as LibSQLMemoryCore, a as LibSQLMemoryCoreOptions, b as LibSQLObservabilityCore, c as LibSQLObservabilityCoreOptions, d as LibSQLVectorCore, e as LibSQLVectorCoreOptions } from './vector-core-CMBjkmEw.js';
|
|
3
3
|
import '@libsql/client';
|
|
4
4
|
import '@voltagent/core';
|
|
5
5
|
import 'ai';
|
package/dist/index.js
CHANGED
|
@@ -492,8 +492,12 @@ var LibSQLMemoryCore = class {
|
|
|
492
492
|
await this.initialize();
|
|
493
493
|
const messagesTable = `${this.tablePrefix}_messages`;
|
|
494
494
|
const { limit, before, after, roles } = options || {};
|
|
495
|
-
let sql = `
|
|
496
|
-
|
|
495
|
+
let sql = `
|
|
496
|
+
SELECT * FROM (
|
|
497
|
+
SELECT *
|
|
498
|
+
FROM ${messagesTable}
|
|
499
|
+
WHERE conversation_id = ? AND user_id = ?
|
|
500
|
+
`;
|
|
497
501
|
const args = [conversationId, userId];
|
|
498
502
|
if (roles && roles.length > 0) {
|
|
499
503
|
const placeholders = roles.map(() => "?").join(",");
|
|
@@ -508,11 +512,12 @@ var LibSQLMemoryCore = class {
|
|
|
508
512
|
sql += " AND created_at > ?";
|
|
509
513
|
args.push(after.toISOString());
|
|
510
514
|
}
|
|
511
|
-
sql += " ORDER BY created_at
|
|
515
|
+
sql += " ORDER BY created_at DESC";
|
|
512
516
|
if (limit && limit > 0) {
|
|
513
517
|
sql += " LIMIT ?";
|
|
514
518
|
args.push(limit);
|
|
515
519
|
}
|
|
520
|
+
sql += " ) AS subq ORDER BY created_at ASC";
|
|
516
521
|
const result = await this.client.execute({ sql, args });
|
|
517
522
|
return result.rows.map((row) => {
|
|
518
523
|
let parts;
|
|
@@ -943,6 +948,23 @@ var LibSQLMemoryCore = class {
|
|
|
943
948
|
conditions.push("created_at <= ?");
|
|
944
949
|
args.push(query.to.toISOString());
|
|
945
950
|
}
|
|
951
|
+
if (query.userId) {
|
|
952
|
+
conditions.push("user_id = ?");
|
|
953
|
+
args.push(query.userId);
|
|
954
|
+
}
|
|
955
|
+
if (query.metadata && Object.keys(query.metadata).length > 0) {
|
|
956
|
+
for (const [key, value] of Object.entries(query.metadata)) {
|
|
957
|
+
const escapedKey = key.replace(/\\/g, "\\\\").replace(/"/g, '\\"');
|
|
958
|
+
const metadataPath = `$."${escapedKey}"`;
|
|
959
|
+
if (value === null) {
|
|
960
|
+
conditions.push("json_type(metadata, ?) = 'null'");
|
|
961
|
+
args.push(metadataPath);
|
|
962
|
+
continue;
|
|
963
|
+
}
|
|
964
|
+
conditions.push("json_extract(metadata, ?) = json(?)");
|
|
965
|
+
args.push(metadataPath, (0, import_internal.safeStringify)(value));
|
|
966
|
+
}
|
|
967
|
+
}
|
|
946
968
|
let sql = `SELECT * FROM ${workflowStatesTable}`;
|
|
947
969
|
if (conditions.length > 0) {
|
|
948
970
|
sql += ` WHERE ${conditions.join(" AND ")}`;
|