@mastra/pg 1.10.1-alpha.0 → 1.10.1-alpha.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.js CHANGED
@@ -7855,12 +7855,21 @@ var MemoryPG = class _MemoryPG extends MemoryStorage {
7855
7855
  resourceId: row.resourceId
7856
7856
  };
7857
7857
  }
7858
- async getThreadById({ threadId }) {
7858
+ async getThreadById({
7859
+ threadId,
7860
+ resourceId
7861
+ }) {
7859
7862
  try {
7860
7863
  const tableName = getTableName4({ indexName: TABLE_THREADS, schemaName: getSchemaName4(this.#schema) });
7864
+ let query = `SELECT * FROM ${tableName} WHERE id = $1`;
7865
+ let params = [threadId];
7866
+ if (resourceId !== void 0) {
7867
+ query += ` AND "resourceId" = $2`;
7868
+ params.push(resourceId);
7869
+ }
7861
7870
  const thread = await this.#db.client.oneOrNone(
7862
- `SELECT * FROM ${tableName} WHERE id = $1`,
7863
- [threadId]
7871
+ query,
7872
+ params
7864
7873
  );
7865
7874
  if (!thread) {
7866
7875
  return null;