(row: Record<string, unknown>)
| 193 | } |
| 194 | |
| 195 | function rowToAnnotation(row: Record<string, unknown>): Annotation { |
| 196 | const extra = row.extra ? JSON.parse(row.extra as string) : undefined; |
| 197 | const kind = (row.kind as Annotation["kind"]) || "feedback"; |
| 198 | return { |
| 199 | id: row.id as string, |
| 200 | sessionId: row.session_id as string, |
| 201 | x: row.x as number, |
| 202 | y: row.y as number, |
| 203 | comment: row.comment as string, |
| 204 | element: row.element as string, |
| 205 | elementPath: row.element_path as string, |
| 206 | timestamp: row.timestamp as number, |
| 207 | selectedText: row.selected_text as string | undefined, |
| 208 | boundingBox: row.bounding_box ? JSON.parse(row.bounding_box as string) : undefined, |
| 209 | nearbyText: row.nearby_text as string | undefined, |
| 210 | cssClasses: row.css_classes as string | undefined, |
| 211 | nearbyElements: row.nearby_elements as string | undefined, |
| 212 | computedStyles: row.computed_styles as string | undefined, |
| 213 | fullPath: row.full_path as string | undefined, |
| 214 | accessibility: row.accessibility as string | undefined, |
| 215 | isMultiSelect: Boolean(row.is_multi_select), |
| 216 | isFixed: Boolean(row.is_fixed), |
| 217 | reactComponents: row.react_components as string | undefined, |
| 218 | kind, |
| 219 | ...(kind === "placement" && extra?.placement ? { placement: extra.placement } : {}), |
| 220 | ...(kind === "rearrange" && extra?.rearrange ? { rearrange: extra.rearrange } : {}), |
| 221 | url: row.url as string | undefined, |
| 222 | intent: row.intent as Annotation["intent"], |
| 223 | severity: row.severity as Annotation["severity"], |
| 224 | status: row.status as AnnotationStatus | undefined, |
| 225 | thread: row.thread ? JSON.parse(row.thread as string) : undefined, |
| 226 | createdAt: row.created_at as string | undefined, |
| 227 | updatedAt: row.updated_at as string | undefined, |
| 228 | resolvedAt: row.resolved_at as string | undefined, |
| 229 | resolvedBy: row.resolved_by as Annotation["resolvedBy"], |
| 230 | authorId: row.author_id as string | undefined, |
| 231 | }; |
| 232 | } |
| 233 | |
| 234 | // ----------------------------------------------------------------------------- |
| 235 | // SQLite Store Implementation |
no outgoing calls
no test coverage detected
searching dependent graphs…