@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.
@@ -3,7 +3,7 @@ name: mastra-pg
3
3
  description: Documentation for @mastra/pg. Use when working with @mastra/pg APIs, configuration, or implementation.
4
4
  metadata:
5
5
  package: "@mastra/pg"
6
- version: "1.27.2-alpha.0"
6
+ version: "1.27.2-alpha.1"
7
7
  ---
8
8
 
9
9
  ## When to use
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.27.2-alpha.0",
2
+ "version": "1.27.2-alpha.1",
3
3
  "package": "@mastra/pg",
4
4
  "exports": {},
5
5
  "modules": {}
package/dist/index.cjs CHANGED
@@ -23031,7 +23031,7 @@ var WorkflowsPG = class WorkflowsPG extends _mastra_core_storage.WorkflowsStorag
23031
23031
  }, error);
23032
23032
  }
23033
23033
  }
23034
- async listWorkflowRuns({ workflowName, fromDate, toDate, perPage, page, resourceId, threadId, status } = {}) {
23034
+ async listWorkflowRuns({ workflowName, fromDate, toDate, perPage, page, resourceId, threadId, status, summary } = {}) {
23035
23035
  try {
23036
23036
  const conditions = [];
23037
23037
  const values = [];
@@ -23079,8 +23079,13 @@ var WorkflowsPG = class WorkflowsPG extends _mastra_core_storage.WorkflowsStorag
23079
23079
  }
23080
23080
  const normalizedPerPage = usePagination ? (0, _mastra_core_storage.normalizePerPage)(perPage, Number.MAX_SAFE_INTEGER) : 0;
23081
23081
  const offset = usePagination ? page * normalizedPerPage : void 0;
23082
+ let selectList = "*";
23083
+ if (summary) {
23084
+ const snapshotJson = await this.#db.getColumnType(_mastra_core_storage.TABLE_WORKFLOW_SNAPSHOT, "snapshot") === "jsonb" ? "snapshot" : `regexp_replace(snapshot::text, '\\\\u(0000|[Dd][89A-Fa-f][0-9A-Fa-f]{2})', '', 'g')::jsonb`;
23085
+ selectList = `workflow_name, run_id, "resourceId", "createdAt", "createdAtZ", "updatedAt", "updatedAtZ", jsonb_build_object('status', ${snapshotJson} -> 'status', 'timestamp', ${snapshotJson} -> 'timestamp') AS snapshot`;
23086
+ }
23082
23087
  const query = `
23083
- SELECT * FROM ${getTableName({
23088
+ SELECT ${selectList} FROM ${getTableName({
23084
23089
  indexName: _mastra_core_storage.TABLE_WORKFLOW_SNAPSHOT,
23085
23090
  schemaName: getSchemaName(this.#schema)
23086
23091
  })}