@mastra/pg 1.27.2-alpha.0 → 1.27.2-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
@@ -23007,7 +23007,7 @@ var WorkflowsPG = class WorkflowsPG extends WorkflowsStorage {
23007
23007
  }, error);
23008
23008
  }
23009
23009
  }
23010
- async listWorkflowRuns({ workflowName, fromDate, toDate, perPage, page, resourceId, threadId, status } = {}) {
23010
+ async listWorkflowRuns({ workflowName, fromDate, toDate, perPage, page, resourceId, threadId, status, summary } = {}) {
23011
23011
  try {
23012
23012
  const conditions = [];
23013
23013
  const values = [];
@@ -23055,8 +23055,13 @@ var WorkflowsPG = class WorkflowsPG extends WorkflowsStorage {
23055
23055
  }
23056
23056
  const normalizedPerPage = usePagination ? normalizePerPage(perPage, Number.MAX_SAFE_INTEGER) : 0;
23057
23057
  const offset = usePagination ? page * normalizedPerPage : void 0;
23058
+ let selectList = "*";
23059
+ if (summary) {
23060
+ const snapshotJson = await this.#db.getColumnType(TABLE_WORKFLOW_SNAPSHOT, "snapshot") === "jsonb" ? "snapshot" : `regexp_replace(snapshot::text, '\\\\u(0000|[Dd][89A-Fa-f][0-9A-Fa-f]{2})', '', 'g')::jsonb`;
23061
+ selectList = `workflow_name, run_id, "resourceId", "createdAt", "createdAtZ", "updatedAt", "updatedAtZ", jsonb_build_object('status', ${snapshotJson} -> 'status', 'timestamp', ${snapshotJson} -> 'timestamp') AS snapshot`;
23062
+ }
23058
23063
  const query = `
23059
- SELECT * FROM ${getTableName({
23064
+ SELECT ${selectList} FROM ${getTableName({
23060
23065
  indexName: TABLE_WORKFLOW_SNAPSHOT,
23061
23066
  schemaName: getSchemaName(this.#schema)
23062
23067
  })}