MCPcopy Index your code
hub / github.com/simstudioai/sim / serializeDrain

Function serializeDrain

apps/sim/lib/data-drains/serializers.ts:17–37  ·  view source on GitHub ↗
(row: DataDrainRow)

Source from the content-addressed store, hash-verified

15 * surface as errors instead of leaking through the response.
16 */
17export 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
39export function serializeDrainRun(row: DataDrainRunRow): DataDrainRun {
40 return {

Callers 2

route.tsFile · 0.90
route.tsFile · 0.90

Calls 2

getDestinationFunction · 0.90
parseMethod · 0.80

Tested by

no test coverage detected