import { LegacySession, MapperInterface } from '@standardnotes/domain-core' export class LegacySessionStorageMapper implements MapperInterface> { toDomain(projection: Record): LegacySession { const { jwt } = projection const legacySessionOrError = LegacySession.create(jwt as string) if (legacySessionOrError.isFailed()) { throw new Error(legacySessionOrError.getError()) } return legacySessionOrError.getValue() } toProjection(domain: LegacySession): Record { return { jwt: domain.accessToken, } } }