@axiom-lattice/pg-stores 1.0.70 → 1.0.71

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.70",
3
+ "version": "1.0.71",
4
4
  "description": "PG stores implementation for Axiom Lattice framework",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -22,8 +22,8 @@
22
22
  "dependencies": {
23
23
  "pg": "^8.16.3",
24
24
  "uuid": "^9.0.1",
25
- "@axiom-lattice/core": "2.1.79",
26
- "@axiom-lattice/protocols": "2.1.41"
25
+ "@axiom-lattice/core": "2.1.80",
26
+ "@axiom-lattice/protocols": "2.1.42"
27
27
  },
28
28
  "devDependencies": {
29
29
  "@types/node": "^20.11.24",
@@ -188,6 +188,19 @@ export class PostgreSQLWorkflowTrackingStore implements WorkflowTrackingStore {
188
188
  };
189
189
  }
190
190
 
191
+ async upsertRunStep(request: CreateRunStepRequest): Promise<RunStep> {
192
+ await this.ensureInitialized();
193
+ // Look up by (run_id, step_type, step_name) — the idempotency key
194
+ const result = await this.pool.query(
195
+ `SELECT * FROM lattice_workflow_steps WHERE run_id = $1 AND step_type = $2 AND step_name = $3`,
196
+ [request.runId, request.stepType, request.stepName]
197
+ );
198
+ if (result.rows.length > 0) {
199
+ return this.mapRowToRunStep(result.rows[0]);
200
+ }
201
+ return this.createRunStep(request);
202
+ }
203
+
191
204
  async updateRunStep(runId: string, stepId: string, updates: UpdateRunStepRequest): Promise<RunStep | null> {
192
205
  await this.ensureInitialized();
193
206
  const now = new Date();