@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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@axiom-lattice/pg-stores",
3
- "version": "1.0.90",
3
+ "version": "1.0.91",
4
4
  "description": "PG stores implementation for Axiom Lattice framework",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -25,7 +25,7 @@
25
25
  "@langchain/core": "1.1.30",
26
26
  "pg": "^8.16.3",
27
27
  "uuid": "^9.0.1",
28
- "@axiom-lattice/core": "2.1.99",
28
+ "@axiom-lattice/core": "2.1.100",
29
29
  "@axiom-lattice/protocols": "2.1.51"
30
30
  },
31
31
  "devDependencies": {
@@ -220,7 +220,7 @@ describe("mapRowToRunStep", () => {
220
220
  output: "also invalid",
221
221
  });
222
222
  expect(result.input).toBeUndefined();
223
- expect(result.output).toBeUndefined();
223
+ expect(result.output).toEqual("also invalid"); // text output preserved as-is (jsonb column)
224
224
  });
225
225
 
226
226
  test("handles deeply nested objects", () => {
@@ -30,6 +30,14 @@ export class PostgreSQLConnectionStore implements ConnectionStore {
30
30
  this.db = db;
31
31
  }
32
32
 
33
+ async listByTenant(tenantId: string): Promise<ConnectionEntry[]> {
34
+ const result = await this.db.query<ConnectionRow>(
35
+ `SELECT * FROM ${TABLE} WHERE tenant_id = $1 ORDER BY created_at`,
36
+ [tenantId],
37
+ );
38
+ return result.rows.map((row) => this.mapRow(row));
39
+ }
40
+
33
41
  async listByType(tenantId: string, type: string): Promise<ConnectionEntry[]> {
34
42
  const result = await this.db.query<ConnectionRow>(
35
43
  `SELECT * FROM ${TABLE} WHERE tenant_id = $1 AND type = $2 ORDER BY created_at`,
@@ -828,6 +828,18 @@ export class PostgreSQLEvalStore implements EvalStore {
828
828
  return rows.length ? this.mapRowToRunResult(rows[0] as unknown as Record<string, unknown>) : null;
829
829
  }
830
830
 
831
+ /** Delete a run result by ID */
832
+ async deleteRunResult(tenantId: string, id: string): Promise<boolean> {
833
+ await this.ensureInitialized();
834
+ const result = await this.pool.query(
835
+ `DELETE FROM lattice_eval_run_results
836
+ WHERE id = $1
837
+ AND run_id IN (SELECT id FROM lattice_eval_runs WHERE tenant_id = $2)`,
838
+ [id, tenantId],
839
+ );
840
+ return (result.rowCount ?? 0) > 0;
841
+ }
842
+
831
843
  /** Get a single run result by ID with tenant isolation */
832
844
  private async getRunResultById(tenantId: string, id: string): Promise<EvalRunResult | null> {
833
845
  await this.ensureInitialized();
@@ -374,7 +374,9 @@ export function mapRowToRunStep(row: any): RunStep {
374
374
  edgeTo: row.edge_to,
375
375
  edgePurpose: row.edge_purpose,
376
376
  input: safeParse(row.input, undefined),
377
- output: safeParse(row.output, undefined),
377
+ output: typeof row.output === "string"
378
+ ? safeParse(row.output, row.output as any)
379
+ : row.output ?? undefined,
378
380
  status: row.status,
379
381
  errorMessage: row.error_message,
380
382
  startedAt: row.started_at,