[lib][keyserver] Extract rawThreadInfo validators into their own file
Summary:
After adding an import of socket-types.js to call-keyserver-endpoint-provider.js in a later diff, I encountered an import cycle that was triggered by yarn test in lib.
I found a way to resolve it by extracting the rawThreadInfo validators into their own file. Now it's possible to import the rawThreadInfo validators without triggering an import of threadEntityValidator from entity-text.js. I didn't follow the mystery further than that... entity-text.js imports a lot of utils, so I guessed that this change would solve the issue.
NOTE: I also renamed MemberInfoValidator to memberInfoValidator here, for consistency with the rest of the codebase.
NOTE: I ended up having another import cycle that I had to resolve, and after resolving that one, this diff was no longer necessary to resolve the first import cycle. That said, I still thought it was a good idea to put this diff up, in case the same code is involved in another import cycle later.
Depends on D10952
Test Plan:
- Test successful session invalidation in single keyserver world
- I prevented the Socket from rendering by adding a return null line before the other returns in KeyserverConnectionHandler. This avoided the Socket triggering session recovery.
- I started the iOS simulator and logged in using a test user.
- I opened the Redux Dev Tools
- I deleted the test user's cookie from the MariaDB database: DELETE FROM cookies WHERE user = 6390578 AND platform = 'ios'
- I sent a message as the test user
- I confirmed that session recovery was triggered in the Redux dev tools (and through some console logs)
- I repeated the process above several times to make sure it consistently worked multiple times in a single run
- I confirmed that the message was delivered "transparently" (without any visible issues, or evidence of session invalidation)
- Test failed session invalidation in single keyserver world
- I ran through the above test, but I hacked legacy-recover-keyserver-session.js to use the wrong password so the session recovery would fail
- I confirmed that I was logged out, and that an alert appeared explaining that my session was invalidated
- Test logging out during session recovery
- I triggered an infinite loop of session recoveries by running through the above test, but swallowing the SET_NEW_SESSION
- I logged out of the app
- I confirmed that the session recovery loop stopped, and that I was logged out successfully
Reviewers: atul
Reviewed By: atul
Subscribers: tomek
Differential Revision: https://phab.comm.dev/D10953