(row: NamespacedRow)
| 44 | } |
| 45 | |
| 46 | function getRowVirtualMetadata(row: NamespacedRow): RowVirtualMetadata { |
| 47 | let found = false |
| 48 | let allSynced = true |
| 49 | let hasLocal = false |
| 50 | |
| 51 | for (const [alias, value] of Object.entries(row as Record<string, unknown>)) { |
| 52 | if (alias === `$selected`) continue |
| 53 | if (value === null || typeof value !== `object`) continue |
| 54 | const asRecord = value as Record<string, unknown> |
| 55 | const hasSyncedProp = `$synced` in asRecord |
| 56 | const hasOriginProp = `$origin` in asRecord |
| 57 | if (!hasSyncedProp && !hasOriginProp) { |
| 58 | continue |
| 59 | } |
| 60 | found = true |
| 61 | if (asRecord.$synced === false) { |
| 62 | allSynced = false |
| 63 | } |
| 64 | if (asRecord.$origin === `local`) { |
| 65 | hasLocal = true |
| 66 | } |
| 67 | } |
| 68 | |
| 69 | return { |
| 70 | synced: found ? allSynced : true, |
| 71 | hasLocal, |
| 72 | } |
| 73 | } |
| 74 | |
| 75 | const { sum, count, avg, min, max } = groupByOperators |
| 76 |
no test coverage detected