const ret = yield* Sql.schema.single({
Request: CreateThreadInput,
Result: InsertResult,
execute: (input) => db`
INSERT INTO threads (sources, history, created_at, updated_at)
VALUES (${input.sources}, ${input.history}, ${input.created_at}, ${input.updated_at})`,
})({
sources: data.sources ?? [],
history: data.history ?? [],
created_at: new Date(),
updated_at: new Date(),
});
const threadID = ThreadID(ret.lastInsertRowid);
const ret = yield* Sql.schema.single({
Request: CreateThreadInput,
Result: InsertResult,
execute: (input) => db`
INSERT INTO threads (sources, history, created_at, updated_at)
VALUES (${input.sources}, ${input.history}, ${input.created_at}, ${input.updated_at})`,
})({
sources: data.sources ?? [],
history: data.history ?? [],
created_at: new Date(),
updated_at: new Date(),
});
const threadID = ThreadID(ret.lastInsertRowid);