(path: string)
| 1207 | }; |
| 1208 | |
| 1209 | const readMigrationJournal = (path: string): MigrationJournalReadResult => { |
| 1210 | if (!fs.existsSync(path)) return { kind: "missing" }; |
| 1211 | try { |
| 1212 | const parsed = JSON.parse(fs.readFileSync(path, "utf-8")); |
| 1213 | if (!isMigrationJournal(parsed)) { |
| 1214 | return { |
| 1215 | kind: "unreadable", |
| 1216 | cause: new LocalV1V2MigrationError({ |
| 1217 | message: `Migration journal has an unrecognized shape: ${path}`, |
| 1218 | cause: parsed, |
| 1219 | }), |
| 1220 | }; |
| 1221 | } |
| 1222 | return { kind: "valid", journal: parsed }; |
| 1223 | } catch (cause) { |
| 1224 | return { kind: "unreadable", cause }; |
| 1225 | } |
| 1226 | }; |
| 1227 | |
| 1228 | const authBackupInfoForMigration = ( |
| 1229 | nonce: string, |
no test coverage detected