Improvements to persisted state migration (#2098)
* Fix session email/emailConfirmed types, update usage for safer access * Handle fallback better, better errors * Better handling, add test * Add test for default data * Remove fallback, not needed, update logs
This commit is contained in:
parent
a915a57b10
commit
3c8036587e
9 changed files with 48 additions and 30 deletions
|
@ -2,17 +2,14 @@ import {z} from 'zod'
|
|||
import {deviceLocales} from '#/platform/detection'
|
||||
|
||||
// only data needed for rendering account page
|
||||
// TODO agent.resumeSession requires the following fields
|
||||
const accountSchema = z.object({
|
||||
service: z.string(),
|
||||
did: z.string(),
|
||||
handle: z.string(),
|
||||
email: z.string(),
|
||||
emailConfirmed: z.boolean(),
|
||||
email: z.string().optional(),
|
||||
emailConfirmed: z.boolean().optional(),
|
||||
refreshJwt: z.string().optional(), // optional because it can expire
|
||||
accessJwt: z.string().optional(), // optional because it can expire
|
||||
// displayName: z.string().optional(),
|
||||
// aviUrl: z.string().optional(),
|
||||
})
|
||||
export type PersistedAccount = z.infer<typeof accountSchema>
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue