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