| 19 | const encodePrompt = Schema.encodeSync(Prompt) |
| 20 | |
| 21 | const fromRow = (row: typeof SessionInputTable.$inferSelect): Admitted => |
| 22 | Admitted.make({ |
| 23 | admittedSeq: row.admitted_seq, |
| 24 | id: SessionMessage.ID.make(row.id), |
| 25 | sessionID: SessionSchema.ID.make(row.session_id), |
| 26 | prompt: decodePrompt(row.prompt), |
| 27 | delivery: row.delivery, |
| 28 | timeCreated: DateTime.makeUnsafe(row.time_created), |
| 29 | ...(row.promoted_seq === null ? {} : { promotedSeq: row.promoted_seq }), |
| 30 | }) |
| 31 | |
| 32 | export const find = Effect.fn("SessionInput.find")(function* (db: DatabaseService, id: SessionMessage.ID) { |
| 33 | const row = yield* db.select().from(SessionInputTable).where(eq(SessionInputTable.id, id)).get().pipe(Effect.orDie) |