[web] Move createAsyncMigrate to lib
Summary:
https://linear.app/comm/issue/ENG-3997/support-async-migrations-on-native
We want to support async migrations on native, as we do on the web. This diffs moves the createAsyncMigrate function to lib, and extracts web-specific code.
Test Plan:
(tested on firefox)
- Remove firefox from DB_SUPPORTED_BROWSERS, change stateVersion on web from 2 to 1, clear all data for localhost in firefox
- Open the web app, check if indexedDB is empty, create a dummy draft
- Add firefox to supported browsers, bump stateVersion to 2
- Open the app, check if the draft is still there, check if indexedDB has data
- Refresh the app check if the draft is still there
Reviewers: kamil, tomek, ashoat
Reviewed By: kamil
Subscribers: ashoat
Differential Revision: https://phab.comm.dev/D8352