(row: DataDrainRow)
| 15 | * surface as errors instead of leaking through the response. |
| 16 | */ |
| 17 | export function serializeDrain(row: DataDrainRow): DataDrain { |
| 18 | const destinationConfig = getDestination(row.destinationType).configSchema.parse( |
| 19 | row.destinationConfig |
| 20 | ) |
| 21 | return dataDrainSchema.parse({ |
| 22 | id: row.id, |
| 23 | organizationId: row.organizationId, |
| 24 | name: row.name, |
| 25 | source: row.source, |
| 26 | scheduleCadence: row.scheduleCadence, |
| 27 | enabled: row.enabled, |
| 28 | cursor: row.cursor, |
| 29 | lastRunAt: row.lastRunAt ? row.lastRunAt.toISOString() : null, |
| 30 | lastSuccessAt: row.lastSuccessAt ? row.lastSuccessAt.toISOString() : null, |
| 31 | createdBy: row.createdBy, |
| 32 | createdAt: row.createdAt.toISOString(), |
| 33 | updatedAt: row.updatedAt.toISOString(), |
| 34 | destinationType: row.destinationType, |
| 35 | destinationConfig, |
| 36 | }) |
| 37 | } |
| 38 | |
| 39 | export function serializeDrainRun(row: DataDrainRunRow): DataDrainRun { |
| 40 | return { |
no test coverage detected