@tenetkit/pg 0.31.0 → 0.33.0

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.
@@ -17,7 +17,7 @@ import { handoffSessionEntry, isHandoffCommit, sameHandoffCheckpoint, sameHandof
17
17
  import { lockRunHierarchy } from "./locks.js";
18
18
  export const postgresOperations = (input) => {
19
19
  const { sql, hub, run, runNoTxn, requireRun, requireClaim, nextId } = input;
20
- const fenced = (claim, effect) => run(sql `SELECT run_id FROM baton_runs WHERE run_id = ${claim.runId} FOR UPDATE`.pipe(Effect.andThen(requireClaim(claim)), Effect.andThen(effect)));
20
+ const fenced = (claim, effect) => run(sql `SELECT run_id FROM tenetkit_runs WHERE run_id = ${claim.runId} FOR UPDATE`.pipe(Effect.andThen(requireClaim(claim)), Effect.andThen(effect)));
21
21
  return {
22
22
  recordOperation: (op) => fenced(op, Effect.gen(function* () {
23
23
  const loaded = yield* requireRun(op.runId);
@@ -25,13 +25,13 @@ export const postgresOperations = (input) => {
25
25
  return yield* RunTerminal.make({ runId: loaded.runId, status: loaded.status });
26
26
  }
27
27
  const existing = yield* sql `
28
- SELECT * FROM baton_run_operations
28
+ SELECT * FROM tenetkit_run_operations
29
29
  WHERE run_id = ${op.runId} AND operation_key = ${op.operationKey}
30
30
  `;
31
31
  const prior = existing[0];
32
32
  if (prior !== undefined) {
33
33
  const consumed = yield* sql `
34
- SELECT entry_id FROM baton_run_steering
34
+ SELECT entry_id FROM tenetkit_run_steering
35
35
  WHERE run_id = ${op.runId} AND consumed_operation_id = ${prior.operation_id}
36
36
  ORDER BY sequence
37
37
  `;
@@ -44,7 +44,7 @@ export const postgresOperations = (input) => {
44
44
  }
45
45
  const steeringEntryIds = op.steeringEntryIds ?? [];
46
46
  const pending = yield* sql `
47
- SELECT entry_id FROM baton_run_steering
47
+ SELECT entry_id FROM tenetkit_run_steering
48
48
  WHERE run_id = ${op.runId} AND consumed_operation_id IS NULL AND discarded_reason IS NULL
49
49
  ORDER BY sequence
50
50
  `;
@@ -59,7 +59,7 @@ export const postgresOperations = (input) => {
59
59
  catch: (error) => RuntimeUnavailable.make({ message: String(error) }),
60
60
  });
61
61
  yield* sql `
62
- INSERT INTO baton_run_operations (
62
+ INSERT INTO tenetkit_run_operations (
63
63
  run_id, operation_id, operation_key, kind, status, input_digest, input_json,
64
64
  result_json, error_json, replay_policy, attempt, owner_worker_id, lease_expires_at, started_at, finished_at
65
65
  ) VALUES (
@@ -70,7 +70,7 @@ export const postgresOperations = (input) => {
70
70
  `;
71
71
  if (op.checkpoint !== undefined || op.continuation !== undefined) {
72
72
  yield* sql `
73
- UPDATE baton_runs SET
73
+ UPDATE tenetkit_runs SET
74
74
  driver_checkpoint_json = COALESCE(${op.checkpoint === undefined ? null : encodeJson(ExecutionCheckpoint, op.checkpoint)}, driver_checkpoint_json),
75
75
  executable_ref_json = ${encodeExecutableRef(executableRef)},
76
76
  continuation_json = CASE WHEN ${op.continuation === undefined ? 0 : 1} = 1
@@ -81,7 +81,7 @@ export const postgresOperations = (input) => {
81
81
  }
82
82
  for (const entryId of steeringEntryIds) {
83
83
  yield* sql `
84
- UPDATE baton_run_steering SET consumed_operation_id = ${operationId}
84
+ UPDATE tenetkit_run_steering SET consumed_operation_id = ${operationId}
85
85
  WHERE run_id = ${op.runId} AND entry_id = ${entryId}
86
86
  AND consumed_operation_id IS NULL AND discarded_reason IS NULL
87
87
  `;
@@ -97,19 +97,19 @@ export const postgresOperations = (input) => {
97
97
  yield* appendEvent(hub, yield* requireRun(op.runId), event);
98
98
  }
99
99
  const rows = yield* sql `
100
- SELECT * FROM baton_run_operations WHERE run_id = ${op.runId} AND operation_id = ${operationId}
100
+ SELECT * FROM tenetkit_run_operations WHERE run_id = ${op.runId} AND operation_id = ${operationId}
101
101
  `;
102
102
  return toOperationRecord(rows[0]);
103
103
  })),
104
104
  startOperation: (op) => fenced(op, Effect.gen(function* () {
105
105
  yield* requireRun(op.runId);
106
106
  yield* sql `
107
- UPDATE baton_run_operations
107
+ UPDATE tenetkit_run_operations
108
108
  SET status = 'running', started_at = NOW()
109
109
  WHERE run_id = ${op.runId} AND operation_id = ${op.operationId} AND status = 'requested'
110
110
  `;
111
111
  const rows = yield* sql `
112
- SELECT * FROM baton_run_operations WHERE run_id = ${op.runId} AND operation_id = ${op.operationId}
112
+ SELECT * FROM tenetkit_run_operations WHERE run_id = ${op.runId} AND operation_id = ${op.operationId}
113
113
  `;
114
114
  const row = rows[0];
115
115
  if (row === undefined)
@@ -119,7 +119,7 @@ export const postgresOperations = (input) => {
119
119
  completeOperation: (op) => fenced(op, Effect.gen(function* () {
120
120
  const loaded = yield* requireRun(op.runId);
121
121
  const existing = yield* sql `
122
- SELECT * FROM baton_run_operations
122
+ SELECT * FROM tenetkit_run_operations
123
123
  WHERE run_id = ${op.runId} AND operation_id = ${op.operationId}
124
124
  FOR UPDATE
125
125
  `;
@@ -147,7 +147,7 @@ export const postgresOperations = (input) => {
147
147
  }
148
148
  for (const entryId of new Set(op.steeringEntryIds ?? [])) {
149
149
  const rows = yield* sql `
150
- SELECT consumed_operation_id FROM baton_run_steering
150
+ SELECT consumed_operation_id FROM tenetkit_run_steering
151
151
  WHERE run_id = ${op.runId} AND entry_id = ${entryId}
152
152
  `;
153
153
  if (rows[0]?.consumed_operation_id !== op.operationId) {
@@ -172,7 +172,7 @@ export const postgresOperations = (input) => {
172
172
  }
173
173
  if (op.outcome._tag === "Succeeded") {
174
174
  yield* sql `
175
- UPDATE baton_run_operations
175
+ UPDATE tenetkit_run_operations
176
176
  SET status = 'succeeded', result_json = ${encodeJsonValue(op.outcome.value)}, finished_at = NOW()
177
177
  WHERE run_id = ${op.runId} AND operation_id = ${op.operationId}
178
178
  AND status IN ('requested', 'running')
@@ -180,7 +180,7 @@ export const postgresOperations = (input) => {
180
180
  }
181
181
  else if (op.outcome._tag === "Failed") {
182
182
  yield* sql `
183
- UPDATE baton_run_operations
183
+ UPDATE tenetkit_run_operations
184
184
  SET status = 'failed', error_json = ${encodeJsonValue(op.outcome.error)}, finished_at = NOW()
185
185
  WHERE run_id = ${op.runId} AND operation_id = ${op.operationId}
186
186
  AND status IN ('requested', 'running')
@@ -188,13 +188,13 @@ export const postgresOperations = (input) => {
188
188
  }
189
189
  else {
190
190
  yield* sql `
191
- UPDATE baton_run_operations SET status = 'unknown', finished_at = NOW()
191
+ UPDATE tenetkit_run_operations SET status = 'unknown', finished_at = NOW()
192
192
  WHERE run_id = ${op.runId} AND operation_id = ${op.operationId}
193
193
  AND status IN ('requested', 'running')
194
194
  `;
195
195
  }
196
196
  yield* sql `
197
- UPDATE baton_runs SET
197
+ UPDATE tenetkit_runs SET
198
198
  driver_checkpoint_json = COALESCE(${op.checkpoint === undefined ? null : encodeJson(ExecutionCheckpoint, op.checkpoint)}, driver_checkpoint_json),
199
199
  executable_ref_json = ${encodeExecutableRef(executableRef)},
200
200
  continuation_json = CASE WHEN ${op.continuation === undefined ? 0 : 1} = 1
@@ -207,7 +207,7 @@ export const postgresOperations = (input) => {
207
207
  yield* appendEvent(hub, yield* requireRun(op.runId), { _tag: "OperationUnknown", operationId: op.operationId }, loaded.cancellationRequested ? "cancelling" : "needs-resolution");
208
208
  }
209
209
  const rows = yield* sql `
210
- SELECT * FROM baton_run_operations WHERE run_id = ${op.runId} AND operation_id = ${op.operationId}
210
+ SELECT * FROM tenetkit_run_operations WHERE run_id = ${op.runId} AND operation_id = ${op.operationId}
211
211
  `;
212
212
  return toOperationRecord(rows[0]);
213
213
  })),
@@ -215,7 +215,7 @@ export const postgresOperations = (input) => {
215
215
  expireRunningOperation: (op) => fenced(op, Effect.gen(function* () {
216
216
  const loaded = yield* requireRun(op.runId);
217
217
  const rows = yield* sql `
218
- SELECT * FROM baton_run_operations WHERE run_id = ${op.runId} AND operation_id = ${op.operationId}
218
+ SELECT * FROM tenetkit_run_operations WHERE run_id = ${op.runId} AND operation_id = ${op.operationId}
219
219
  `;
220
220
  const row = rows[0];
221
221
  if (row === undefined)
@@ -225,29 +225,29 @@ export const postgresOperations = (input) => {
225
225
  }
226
226
  if (canBlindRetry(row.replay_policy)) {
227
227
  yield* sql `
228
- UPDATE baton_run_operations
228
+ UPDATE tenetkit_run_operations
229
229
  SET status = 'requested', started_at = NULL, finished_at = NULL, owner_worker_id = NULL, lease_expires_at = NULL
230
230
  WHERE run_id = ${op.runId} AND operation_id = ${op.operationId} AND status = 'running'
231
231
  `;
232
232
  const next = yield* sql `
233
- SELECT * FROM baton_run_operations WHERE run_id = ${op.runId} AND operation_id = ${op.operationId}
233
+ SELECT * FROM tenetkit_run_operations WHERE run_id = ${op.runId} AND operation_id = ${op.operationId}
234
234
  `;
235
235
  return { record: toOperationRecord(next[0]), outcome: "retried" };
236
236
  }
237
237
  yield* sql `
238
- UPDATE baton_run_operations SET status = 'unknown', finished_at = NOW()
238
+ UPDATE tenetkit_run_operations SET status = 'unknown', finished_at = NOW()
239
239
  WHERE run_id = ${op.runId} AND operation_id = ${op.operationId} AND status = 'running'
240
240
  `;
241
241
  yield* appendEvent(hub, loaded, { _tag: "OperationUnknown", operationId: op.operationId }, loaded.cancellationRequested ? "cancelling" : "needs-resolution");
242
242
  const next = yield* sql `
243
- SELECT * FROM baton_run_operations WHERE run_id = ${op.runId} AND operation_id = ${op.operationId}
243
+ SELECT * FROM tenetkit_run_operations WHERE run_id = ${op.runId} AND operation_id = ${op.operationId}
244
244
  `;
245
245
  return { record: toOperationRecord(next[0]), outcome: "unknown" };
246
246
  })),
247
247
  getOperation: (op) => runNoTxn(Effect.gen(function* () {
248
248
  yield* requireRun(op.runId);
249
249
  const rows = yield* sql `
250
- SELECT * FROM baton_run_operations WHERE run_id = ${op.runId} AND operation_id = ${op.operationId}
250
+ SELECT * FROM tenetkit_run_operations WHERE run_id = ${op.runId} AND operation_id = ${op.operationId}
251
251
  `;
252
252
  const row = rows[0];
253
253
  if (row === undefined)
@@ -257,7 +257,7 @@ export const postgresOperations = (input) => {
257
257
  getOperationByKey: (op) => runNoTxn(Effect.gen(function* () {
258
258
  yield* requireRun(op.runId);
259
259
  const rows = yield* sql `
260
- SELECT * FROM baton_run_operations WHERE run_id = ${op.runId} AND operation_key = ${op.operationKey}
260
+ SELECT * FROM tenetkit_run_operations WHERE run_id = ${op.runId} AND operation_key = ${op.operationKey}
261
261
  `;
262
262
  return rows[0] === undefined ? undefined : toOperationRecord(rows[0]);
263
263
  })),
@@ -271,7 +271,7 @@ export const postgresOperations = (input) => {
271
271
  return;
272
272
  }
273
273
  const rows = yield* sql `
274
- SELECT * FROM baton_run_operations
274
+ SELECT * FROM tenetkit_run_operations
275
275
  WHERE run_id = ${op.runId} AND operation_id = ${op.operationId}
276
276
  FOR UPDATE
277
277
  `;
@@ -296,7 +296,7 @@ export const postgresOperations = (input) => {
296
296
  return yield* conflict();
297
297
  if (op.resolution._tag === "Succeeded") {
298
298
  yield* sql `
299
- UPDATE baton_run_operations SET status = 'succeeded', result_json = ${encodeJsonValue(op.resolution.value)},
299
+ UPDATE tenetkit_run_operations SET status = 'succeeded', result_json = ${encodeJsonValue(op.resolution.value)},
300
300
  resolution_idempotency_key = ${op.idempotencyKey}, resolution_json = ${resolutionJson},
301
301
  owner_worker_id = NULL, lease_expires_at = NULL, finished_at = NOW()
302
302
  WHERE run_id = ${op.runId} AND operation_id = ${op.operationId} AND status = 'unknown'
@@ -304,7 +304,7 @@ export const postgresOperations = (input) => {
304
304
  }
305
305
  else if (op.resolution._tag === "Failed") {
306
306
  yield* sql `
307
- UPDATE baton_run_operations SET status = 'failed', error_json = ${encodeJsonValue(op.resolution.error)},
307
+ UPDATE tenetkit_run_operations SET status = 'failed', error_json = ${encodeJsonValue(op.resolution.error)},
308
308
  resolution_idempotency_key = ${op.idempotencyKey}, resolution_json = ${resolutionJson},
309
309
  owner_worker_id = NULL, lease_expires_at = NULL, finished_at = NOW()
310
310
  WHERE run_id = ${op.runId} AND operation_id = ${op.operationId} AND status = 'unknown'
@@ -312,14 +312,14 @@ export const postgresOperations = (input) => {
312
312
  }
313
313
  else {
314
314
  yield* sql `
315
- UPDATE baton_run_operations SET status = 'requested', result_json = NULL, error_json = NULL,
315
+ UPDATE tenetkit_run_operations SET status = 'requested', result_json = NULL, error_json = NULL,
316
316
  resolution_idempotency_key = ${op.idempotencyKey}, resolution_json = ${resolutionJson},
317
317
  owner_worker_id = NULL, lease_expires_at = NULL, started_at = NULL, finished_at = NULL
318
318
  WHERE run_id = ${op.runId} AND operation_id = ${op.operationId} AND status = 'unknown'
319
319
  `;
320
320
  }
321
321
  yield* sql `
322
- UPDATE baton_runs SET status = CASE WHEN cancellation_requested THEN 'cancelling' ELSE 'queued' END, owner_worker_id = NULL, lease_expires_at = NULL, updated_at = NOW()
322
+ UPDATE tenetkit_runs SET status = CASE WHEN cancellation_requested THEN 'cancelling' ELSE 'queued' END, owner_worker_id = NULL, lease_expires_at = NULL, updated_at = NOW()
323
323
  WHERE run_id = ${op.runId} AND status = 'needs-resolution'
324
324
  `;
325
325
  yield* settleAdmittedCancellation(hub, op.runId);
@@ -8,7 +8,7 @@ import { completeRun, requireRun } from "./pg-helpers.js";
8
8
  import { suspend } from "./store-suspend.js";
9
9
  import { admitProgramChild } from "tenetkit/runtime/driver/sql/store-admit";
10
10
  export const programStoreMethods = (input) => {
11
- const fenced = (claim, effect) => input.run(input.sql `SELECT run_id FROM baton_runs WHERE run_id = ${claim.runId} FOR UPDATE`.pipe(Effect.andThen(requireExecutionClaim(claim)), Effect.andThen(effect)));
11
+ const fenced = (claim, effect) => input.run(input.sql `SELECT run_id FROM tenetkit_runs WHERE run_id = ${claim.runId} FOR UPDATE`.pipe(Effect.andThen(requireExecutionClaim(claim)), Effect.andThen(effect)));
12
12
  return {
13
13
  admitProgramChild: (operation) => fenced(operation, admitProgramChild(input.hub, operation)),
14
14
  admitProgramChildAndSuspend: (operation) => fenced(operation, admitProgramChild(input.hub, operation).pipe(Effect.tap(() => suspend(input.hub, operation)))),
@@ -29,7 +29,7 @@ export const suspend = Function.dual(2, (hub, input) => Effect.gen(function* ()
29
29
  catch: (error) => RuntimeUnavailable.make({ message: String(error) }),
30
30
  });
31
31
  yield* sql `
32
- UPDATE baton_runs SET
32
+ UPDATE tenetkit_runs SET
33
33
  driver_checkpoint_json = COALESCE(${input.checkpoint === undefined ? null : encodeJson(ExecutionCheckpoint, input.checkpoint)}, driver_checkpoint_json),
34
34
  executable_ref_json = ${encodeExecutableRef(executableRef)},
35
35
  suspension_json = ${encodeJson(ExecutionSuspension, input.suspension)},
@@ -40,7 +40,7 @@ export const suspend = Function.dual(2, (hub, input) => Effect.gen(function* ()
40
40
  WHERE run_id = ${input.runId}
41
41
  `;
42
42
  yield* sql `
43
- INSERT INTO baton_run_waits (
43
+ INSERT INTO tenetkit_run_waits (
44
44
  run_id, wait_id, reason, status, response_json, due_at, owner_worker_id, lease_expires_at, opened_at, closed_at
45
45
  ) VALUES (
46
46
  ${loaded.runId}, ${input.wait.waitId}, ${encodeReason(input.wait.reason)}, 'open', NULL, NULL, NULL, NULL, NOW(), NULL
@@ -67,7 +67,7 @@ export const suspend = Function.dual(2, (hub, input) => Effect.gen(function* ()
67
67
  const groupId = groupIdFromSuspension(input.suspension);
68
68
  if (groupId !== undefined) {
69
69
  const rows = yield* sql `
70
- SELECT parent_run_id, status FROM baton_fan_outs WHERE fan_out_id = ${groupId}
70
+ SELECT parent_run_id, status FROM tenetkit_fan_outs WHERE fan_out_id = ${groupId}
71
71
  `;
72
72
  const group = rows[0];
73
73
  if (group?.parent_run_id === loaded.runId && group.status !== "running") {
@@ -77,11 +77,11 @@ export const suspend = Function.dual(2, (hub, input) => Effect.gen(function* ()
77
77
  payload: resultFromInspection(yield* inspectFanOut(groupId).pipe(Effect.mapError(() => RuntimeUnavailable.make({ message: `child group ${groupId} disappeared` })))),
78
78
  };
79
79
  yield* sql `
80
- UPDATE baton_run_waits SET status = 'signaled', response_json = ${encodeJson(WaitResolution, resolution)}, closed_at = NOW()
80
+ UPDATE tenetkit_run_waits SET status = 'signaled', response_json = ${encodeJson(WaitResolution, resolution)}, closed_at = NOW()
81
81
  WHERE run_id = ${loaded.runId} AND wait_id = ${input.wait.waitId} AND status = 'open'
82
82
  `;
83
83
  yield* appendEvent(hub, yield* requireRun(loaded.runId), { _tag: "RunResumed", waitId: input.wait.waitId, resolution }, "running");
84
84
  }
85
85
  }
86
- yield* sql `UPDATE baton_runs SET owner_worker_id = NULL, lease_expires_at = NULL WHERE run_id = ${loaded.runId}`;
86
+ yield* sql `UPDATE tenetkit_runs SET owner_worker_id = NULL, lease_expires_at = NULL WHERE run_id = ${loaded.runId}`;
87
87
  }));
@@ -90,7 +90,7 @@ export const makePostgresServices = (options) => Effect.gen(function* () {
90
90
  });
91
91
  const registrations = yield* narrow(executable, yield* loadRegistrations(parent.runId)).pipe(Effect.mapError((error) => RuntimeUnavailable.make({ message: String(error) })));
92
92
  const existing = yield* sql `
93
- SELECT * FROM baton_runs
93
+ SELECT * FROM tenetkit_runs
94
94
  WHERE address = ${input.message.to}
95
95
  AND session_id = ${input.message.sessionId}
96
96
  AND idempotency_key = ${input.message.idempotencyKey}
@@ -132,7 +132,7 @@ export const makePostgresServices = (options) => Effect.gen(function* () {
132
132
  });
133
133
  yield* associateRegistrations(runId, registrations);
134
134
  yield* sql `
135
- INSERT INTO baton_run_links (parent_run_id, child_run_id, invocation_id, readiness, terminal_event_id, created_at, settled_at)
135
+ INSERT INTO tenetkit_run_links (parent_run_id, child_run_id, invocation_id, readiness, terminal_event_id, created_at, settled_at)
136
136
  VALUES (${parent.runId}, ${runId}, ${input.invocationId}, ${childReadiness}, NULL, NOW(), NULL)
137
137
  `;
138
138
  yield* appendEvent(transactionHub, parent, {
@@ -152,7 +152,7 @@ export const makePostgresServices = (options) => Effect.gen(function* () {
152
152
  return { runId, messageId: input.message.id, acceptedSequence: 0, duplicate: false };
153
153
  }
154
154
  const started = (yield* loadRun(runId));
155
- yield* sql `UPDATE baton_runs SET attempt_fence = 1, attempt = 1, status = 'running' WHERE run_id = ${runId}`;
155
+ yield* sql `UPDATE tenetkit_runs SET attempt_fence = 1, attempt = 1, status = 'running' WHERE run_id = ${runId}`;
156
156
  yield* appendEvent(transactionHub, { ...started, attempt: 1 }, { _tag: "RunAttemptStarted", attempt: 1 }, "running");
157
157
  return { runId, messageId: input.message.id, acceptedSequence: 0, duplicate: false };
158
158
  })),
@@ -189,7 +189,7 @@ export const makePostgresServices = (options) => Effect.gen(function* () {
189
189
  const responded = [...loaded.respondedWaitIds, input.waitId];
190
190
  const resolution = input.resolution;
191
191
  const closed = yield* sql `
192
- UPDATE baton_run_waits SET status = 'responded', response_json = ${encodeJson(WaitResolution, resolution)}, closed_at = NOW()
192
+ UPDATE tenetkit_run_waits SET status = 'responded', response_json = ${encodeJson(WaitResolution, resolution)}, closed_at = NOW()
193
193
  WHERE run_id = ${loaded.runId} AND wait_id = ${input.waitId} AND status = 'open'
194
194
  RETURNING wait_id
195
195
  `;
@@ -200,12 +200,12 @@ export const makePostgresServices = (options) => Effect.gen(function* () {
200
200
  return yield* ResponseConflict.make({ runId: loaded.runId, waitId: input.waitId });
201
201
  }
202
202
  yield* sql `
203
- UPDATE baton_runs
203
+ UPDATE tenetkit_runs
204
204
  SET responded_wait_ids_json = ${encodeJson(StringArray, responded)}, updated_at = NOW()
205
205
  WHERE run_id = ${loaded.runId}
206
206
  `;
207
207
  yield* sql `
208
- UPDATE baton_program_operations SET status = 'reserved'
208
+ UPDATE tenetkit_program_operations SET status = 'reserved'
209
209
  WHERE run_id = ${loaded.runId} AND wait_id = ${input.waitId} AND status = 'waiting'
210
210
  `;
211
211
  const current = (yield* loadRun(loaded.runId));
@@ -220,7 +220,7 @@ export const makePostgresServices = (options) => Effect.gen(function* () {
220
220
  const responded = [...loaded.respondedWaitIds, response.waitId];
221
221
  const resolution = input.decision;
222
222
  const closed = yield* sql `
223
- UPDATE baton_run_waits SET status = 'responded', response_json = ${encodeJson(WaitResolution, resolution)}, closed_at = NOW()
223
+ UPDATE tenetkit_run_waits SET status = 'responded', response_json = ${encodeJson(WaitResolution, resolution)}, closed_at = NOW()
224
224
  WHERE run_id = ${loaded.runId} AND wait_id = ${response.waitId} AND status = 'open'
225
225
  RETURNING wait_id
226
226
  `;
@@ -228,12 +228,12 @@ export const makePostgresServices = (options) => Effect.gen(function* () {
228
228
  return yield* ApprovalStale.make({ runId: loaded.runId, approvalId: input.approvalId });
229
229
  }
230
230
  yield* sql `
231
- UPDATE baton_runs
231
+ UPDATE tenetkit_runs
232
232
  SET responded_wait_ids_json = ${encodeJson(StringArray, responded)}, updated_at = NOW()
233
233
  WHERE run_id = ${loaded.runId}
234
234
  `;
235
235
  yield* sql `
236
- UPDATE baton_program_operations SET status = 'reserved'
236
+ UPDATE tenetkit_program_operations SET status = 'reserved'
237
237
  WHERE run_id = ${loaded.runId} AND wait_id = ${response.waitId} AND status = 'waiting'
238
238
  `;
239
239
  const current = (yield* loadRun(loaded.runId));
@@ -255,7 +255,7 @@ export const makePostgresServices = (options) => Effect.gen(function* () {
255
255
  ...(input.payload === undefined ? {} : { payload: input.payload }),
256
256
  };
257
257
  yield* sql `
258
- UPDATE baton_run_waits SET status = 'signaled', response_json = ${encodeJson(WaitResolution, resolution)}, closed_at = NOW()
258
+ UPDATE tenetkit_run_waits SET status = 'signaled', response_json = ${encodeJson(WaitResolution, resolution)}, closed_at = NOW()
259
259
  WHERE run_id = ${loaded.runId} AND wait_id = ${loaded.activeWaitId} AND status = 'open'
260
260
  `;
261
261
  yield* appendEvent(transactionHub, loaded, { _tag: "RunResumed", waitId: loaded.activeWaitId, resolution }, "running");
@@ -298,11 +298,11 @@ export const makePostgresServices = (options) => Effect.gen(function* () {
298
298
  return;
299
299
  }
300
300
  const runningFanOut = yield* sql `
301
- SELECT fan_out_id FROM baton_fan_outs WHERE parent_run_id = ${loaded.runId} AND status = 'running' LIMIT 1
301
+ SELECT fan_out_id FROM tenetkit_fan_outs WHERE parent_run_id = ${loaded.runId} AND status = 'running' LIMIT 1
302
302
  `;
303
303
  if (runningFanOut.length > 0) {
304
304
  yield* sql `
305
- UPDATE baton_runs SET status = 'waiting', owner_worker_id = NULL, lease_expires_at = NULL,
305
+ UPDATE tenetkit_runs SET status = 'waiting', owner_worker_id = NULL, lease_expires_at = NULL,
306
306
  suspension_json = NULL,
307
307
  pending_outcome_json = ${encodeJson(PendingRunOutcome, { _tag: "Failed", error: input.error })}
308
308
  WHERE run_id = ${loaded.runId}
@@ -336,7 +336,7 @@ export const makePostgresServices = (options) => Effect.gen(function* () {
336
336
  const responded = [...loaded.respondedWaitIds, input.waitId];
337
337
  const resolution = input.resolution;
338
338
  const closed = yield* sql `
339
- UPDATE baton_run_waits SET status = 'responded', response_json = ${encodeJson(WaitResolution, resolution)}, closed_at = NOW()
339
+ UPDATE tenetkit_run_waits SET status = 'responded', response_json = ${encodeJson(WaitResolution, resolution)}, closed_at = NOW()
340
340
  WHERE run_id = ${loaded.runId} AND wait_id = ${input.waitId} AND status = 'open'
341
341
  RETURNING wait_id
342
342
  `;
@@ -347,12 +347,12 @@ export const makePostgresServices = (options) => Effect.gen(function* () {
347
347
  return yield* ResponseConflict.make({ runId: loaded.runId, waitId: input.waitId });
348
348
  }
349
349
  yield* sql `
350
- UPDATE baton_runs
350
+ UPDATE tenetkit_runs
351
351
  SET responded_wait_ids_json = ${encodeJson(StringArray, responded)}, updated_at = NOW()
352
352
  WHERE run_id = ${loaded.runId}
353
353
  `;
354
354
  yield* sql `
355
- UPDATE baton_program_operations SET status = 'reserved'
355
+ UPDATE tenetkit_program_operations SET status = 'reserved'
356
356
  WHERE run_id = ${loaded.runId} AND wait_id = ${input.waitId} AND status = 'waiting'
357
357
  `;
358
358
  const current = (yield* loadRun(loaded.runId));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/package.json",
3
- "version": "0.31.0",
3
+ "version": "0.33.0",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -37,7 +37,7 @@
37
37
  },
38
38
  "dependencies": {
39
39
  "@effect/sql-pg": "4.0.0-rc.109",
40
- "tenetkit": "0.31.0"
40
+ "tenetkit": "0.33.0"
41
41
  },
42
42
  "devDependencies": {
43
43
  "@effect/vitest": "4.0.0-rc.109",