@axiom-lattice/pg-stores 1.0.90 → 1.0.91

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
@@ -1254,6 +1254,13 @@ var PostgreSQLConnectionStore = class {
1254
1254
  constructor(db) {
1255
1255
  this.db = db;
1256
1256
  }
1257
+ async listByTenant(tenantId) {
1258
+ const result = await this.db.query(
1259
+ `SELECT * FROM ${TABLE} WHERE tenant_id = $1 ORDER BY created_at`,
1260
+ [tenantId]
1261
+ );
1262
+ return result.rows.map((row) => this.mapRow(row));
1263
+ }
1257
1264
  async listByType(tenantId, type) {
1258
1265
  const result = await this.db.query(
1259
1266
  `SELECT * FROM ${TABLE} WHERE tenant_id = $1 AND type = $2 ORDER BY created_at`,
@@ -3660,7 +3667,7 @@ function mapRowToRunStep(row) {
3660
3667
  edgeTo: row.edge_to,
3661
3668
  edgePurpose: row.edge_purpose,
3662
3669
  input: safeParse(row.input, void 0),
3663
- output: safeParse(row.output, void 0),
3670
+ output: typeof row.output === "string" ? safeParse(row.output, row.output) : row.output ?? void 0,
3664
3671
  status: row.status,
3665
3672
  errorMessage: row.error_message,
3666
3673
  startedAt: row.started_at,
@@ -4555,6 +4562,17 @@ var PostgreSQLEvalStore = class {
4555
4562
  );
4556
4563
  return rows.length ? this.mapRowToRunResult(rows[0]) : null;
4557
4564
  }
4565
+ /** Delete a run result by ID */
4566
+ async deleteRunResult(tenantId, id) {
4567
+ await this.ensureInitialized();
4568
+ const result = await this.pool.query(
4569
+ `DELETE FROM lattice_eval_run_results
4570
+ WHERE id = $1
4571
+ AND run_id IN (SELECT id FROM lattice_eval_runs WHERE tenant_id = $2)`,
4572
+ [id, tenantId]
4573
+ );
4574
+ return (result.rowCount ?? 0) > 0;
4575
+ }
4558
4576
  /** Get a single run result by ID with tenant isolation */
4559
4577
  async getRunResultById(tenantId, id) {
4560
4578
  await this.ensureInitialized();