The record `raw` holds; null for none, or for one this can't read.
(raw: string | null)
| 477 | |
| 478 | /** The record `raw` holds; null for none, or for one this can't read. */ |
| 479 | function parseRecord(raw: string | null): FlowRecord | null { |
| 480 | if (!raw) return null; |
| 481 | try { |
| 482 | const { flows, written } = JSON.parse(raw) as { flows: RecordedFlow[]; written: Array<[string, Array<[string, number]>]> }; |
| 483 | if (!flows.every((flow) => flow.key.includes('\0') && (flow.names === null || Array.isArray(flow.names)))) return null; |
| 484 | return { flows, written: new Map(written.map(([name, files]) => [name, new Map(files)])) }; |
| 485 | } catch { |
| 486 | return null; |
| 487 | } |
| 488 | } |
| 489 | |
| 490 | /** A language's files as a sync found them. */ |
| 491 | interface ChangedLanguage { |