(value: unknown)
| 219 | } |
| 220 | |
| 221 | function parseCheckHostsTaskValue(value: unknown): CheckHostsTaskValue | null { |
| 222 | if (!value || typeof value !== 'object') return null |
| 223 | const task = value as Partial<CheckHostsTaskValue> |
| 224 | if ( |
| 225 | typeof task.startedAt !== 'string' || |
| 226 | !(typeof task.finishedAt === 'string' || task.finishedAt === null) || |
| 227 | typeof task.total !== 'number' || |
| 228 | typeof task.checked !== 'number' |
| 229 | ) { |
| 230 | return null |
| 231 | } |
| 232 | |
| 233 | return { |
| 234 | startedAt: task.startedAt, |
| 235 | finishedAt: task.finishedAt, |
| 236 | total: task.total, |
| 237 | checked: task.checked, |
| 238 | errorMessage: typeof task.errorMessage === 'string' ? task.errorMessage : null, |
| 239 | } |
| 240 | } |
| 241 | |
| 242 | async function getPublicCheckHostsTask() { |
| 243 | const row = await db.query.siteConfigs.findFirst({ |
no outgoing calls
no test coverage detected