@mastra/libsql 1.10.1-alpha.1 → 1.10.1-alpha.2

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.js CHANGED
@@ -1171,29 +1171,33 @@ var LibSQLVector = class extends MastraVector {
1171
1171
  }
1172
1172
  };
1173
1173
  var safeStringify = (value) => {
1174
- const seen = /* @__PURE__ */ new WeakSet();
1174
+ const ancestors = /* @__PURE__ */ new Set();
1175
1175
  const sanitize = (val) => {
1176
1176
  if (val === null || val === void 0) return val;
1177
1177
  if (typeof val === "function") return void 0;
1178
1178
  if (typeof val === "symbol") return void 0;
1179
1179
  if (typeof val === "bigint") return val.toString();
1180
1180
  if (typeof val !== "object") return val;
1181
- if (seen.has(val)) return void 0;
1182
- seen.add(val);
1181
+ if (ancestors.has(val)) return void 0;
1183
1182
  if (typeof val.toJSON === "function") {
1184
1183
  return sanitize(val.toJSON());
1185
1184
  }
1186
- if (Array.isArray(val)) {
1187
- return val.map((item) => sanitize(item));
1188
- }
1189
- const result = {};
1190
- for (const key of Object.keys(val)) {
1191
- const sanitized = sanitize(val[key]);
1192
- if (sanitized !== void 0) {
1193
- result[key] = sanitized;
1185
+ ancestors.add(val);
1186
+ try {
1187
+ if (Array.isArray(val)) {
1188
+ return val.map((item) => sanitize(item));
1194
1189
  }
1190
+ const result = {};
1191
+ for (const key of Object.keys(val)) {
1192
+ const sanitized = sanitize(val[key]);
1193
+ if (sanitized !== void 0) {
1194
+ result[key] = sanitized;
1195
+ }
1196
+ }
1197
+ return result;
1198
+ } finally {
1199
+ ancestors.delete(val);
1195
1200
  }
1196
- return result;
1197
1201
  };
1198
1202
  return JSON.stringify(sanitize(value)) ?? "null";
1199
1203
  };
@@ -6634,11 +6638,18 @@ var MemoryLibSQL = class extends MemoryStorage {
6634
6638
  });
6635
6639
  return updatedResource;
6636
6640
  }
6637
- async getThreadById({ threadId }) {
6641
+ async getThreadById({
6642
+ threadId,
6643
+ resourceId
6644
+ }) {
6638
6645
  try {
6646
+ const keys = { id: threadId };
6647
+ if (resourceId !== void 0) {
6648
+ keys.resourceId = resourceId;
6649
+ }
6639
6650
  const result = await this.#db.select({
6640
6651
  tableName: TABLE_THREADS,
6641
- keys: { id: threadId }
6652
+ keys
6642
6653
  });
6643
6654
  if (!result) {
6644
6655
  return null;