MCPcopy
hub / github.com/BuilderIO/agent-native / parseRow

Function parseRow

packages/core/src/progress/store.ts:70–92  ·  view source on GitHub ↗
(row: Record<string, unknown>)

Source from the content-addressed store, hash-verified

68}
69
70function parseRow(row: Record<string, unknown>): AgentRun {
71 const percent = row.percent;
72 return {
73 id: String(row.id),
74 owner: String(row.owner),
75 title: String(row.title),
76 step: row.step == null ? undefined : String(row.step),
77 percent: percent == null ? null : Number(percent),
78 status: String(row.status) as ProgressStatus,
79 metadata: row.metadata
80 ? safeJsonParse<Record<string, unknown> | undefined>(
81 row.metadata,
82 undefined,
83 )
84 : undefined,
85 startedAt: new Date(Number(row.started_at)).toISOString(),
86 updatedAt: new Date(Number(row.updated_at)).toISOString(),
87 completedAt:
88 row.completed_at == null
89 ? null
90 : new Date(Number(row.completed_at)).toISOString(),
91 };
92}
93
94export async function insertRun(input: StartRunInput): Promise<AgentRun> {
95 await ensureTable();

Callers 2

getRunFunction · 0.70
listRunsFunction · 0.70

Calls 1

safeJsonParseFunction · 0.50

Tested by

no test coverage detected