@voltagent/libsql 2.1.0 → 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.mjs CHANGED
@@ -910,6 +910,23 @@ var LibSQLMemoryCore = class {
910
910
  conditions.push("created_at <= ?");
911
911
  args.push(query.to.toISOString());
912
912
  }
913
+ if (query.userId) {
914
+ conditions.push("user_id = ?");
915
+ args.push(query.userId);
916
+ }
917
+ if (query.metadata && Object.keys(query.metadata).length > 0) {
918
+ for (const [key, value] of Object.entries(query.metadata)) {
919
+ const escapedKey = key.replace(/\\/g, "\\\\").replace(/"/g, '\\"');
920
+ const metadataPath = `$."${escapedKey}"`;
921
+ if (value === null) {
922
+ conditions.push("json_type(metadata, ?) = 'null'");
923
+ args.push(metadataPath);
924
+ continue;
925
+ }
926
+ conditions.push("json_extract(metadata, ?) = json(?)");
927
+ args.push(metadataPath, safeStringify(value));
928
+ }
929
+ }
913
930
  let sql = `SELECT * FROM ${workflowStatesTable}`;
914
931
  if (conditions.length > 0) {
915
932
  sql += ` WHERE ${conditions.join(" AND ")}`;