@ -24,7 +24,7 @@ 
				
			 
			
		
	
		
		
			
				
					 
					 
					import  {  PlatformServiceFactory  }  from  "./PlatformServiceFactory" ;  
					 
					 
					import  {  PlatformServiceFactory  }  from  "./PlatformServiceFactory" ;  
				
			 
			
		
	
		
		
			
				
					 
					 
					import  {  db ,  accountsDBPromise  }  from  "../db/index" ;  
					 
					 
					import  {  db ,  accountsDBPromise  }  from  "../db/index" ;  
				
			 
			
		
	
		
		
			
				
					 
					 
					import  {  Contact ,  ContactMethod  }  from  "../db/tables/contacts" ;  
					 
					 
					import  {  Contact ,  ContactMethod  }  from  "../db/tables/contacts" ;  
				
			 
			
		
	
		
		
			
				
					
					 
					 
					import  {  Settings  }  from  "../db/tables/settings" ;  
					 
					 
					import  {  Settings ,  MASTER_SETTINGS_KEY   }  from  "../db/tables/settings" ;  
				
			 
			
				
				
			
		
	
		
		
	
		
		
			
				
					 
					 
					import  {  Account  }  from  "../db/tables/accounts" ;  
					 
					 
					import  {  Account  }  from  "../db/tables/accounts" ;  
				
			 
			
		
	
		
		
			
				
					 
					 
					import  {  logger  }  from  "../utils/logger" ;  
					 
					 
					import  {  logger  }  from  "../utils/logger" ;  
				
			 
			
		
	
		
		
			
				
					 
					 
					import  {  parseJsonField  }  from  "../db/databaseUtil" ;  
					 
					 
					import  {  parseJsonField  }  from  "../db/databaseUtil" ;  
				
			 
			
		
	
	
		
		
			
				
					
						
							
								 
							 
						
						
							
								 
							 
						
						
					 
					@ -285,42 +285,47 @@ export async function getSqliteSettings(): Promise<Settings[]> { 
				
			 
			
		
	
		
		
			
				
					 
					 
					      return  [ ] ;  
					 
					 
					      return  [ ] ;  
				
			 
			
		
	
		
		
			
				
					 
					 
					    }  
					 
					 
					    }  
				
			 
			
		
	
		
		
			
				
					 
					 
					
 
					 
					 
					
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					    const  settings  =  result . values . map ( ( row )  = >  {  
					 
					 
					    const  settings  =  result . values  
				
			 
			
				
				
			
		
	
		
		
			
				
					
					 
					 
					      const  setting  =  parseJsonField ( row ,  { } )  as  Settings ;  
					 
					 
					      . map ( ( row )  = >  {  
				
			 
			
				
				
			
		
	
		
		
			
				
					
					 
					 
					      return  {  
					 
					 
					        const  setting  =  parseJsonField ( row ,  { } )  as  Settings ;  
				
			 
			
				
				
			
		
	
		
		
			
				
					
					 
					 
					        id : setting.id ,  
					 
					 
					        return  {  
				
			 
			
				
				
			
		
	
		
		
			
				
					
					 
					 
					        accountDid : setting.accountDid  ||  "" ,  
					 
					 
					          id : setting.id ,  
				
			 
			
				
				
			
		
	
		
		
			
				
					
					 
					 
					        activeDid : setting.activeDid  ||  "" ,  
					 
					 
					          accountDid : setting.accountDid  ||  null ,  
				
			 
			
				
				
			
		
	
		
		
			
				
					
					 
					 
					        apiServer : setting.apiServer  ||  "" ,  
					 
					 
					          activeDid : setting.activeDid  ||  null ,  
				
			 
			
				
				
			
		
	
		
		
			
				
					
					 
					 
					        filterFeedByNearby : setting.filterFeedByNearby  ||  false ,  
					 
					 
					          apiServer : setting.apiServer  ||  "" ,  
				
			 
			
				
				
			
		
	
		
		
			
				
					
					 
					 
					        filterFeedByVisible : setting.filterFeedByVisible  ||  false ,  
					 
					 
					          filterFeedByNearby : setting.filterFeedByNearby  ||  false ,  
				
			 
			
				
				
			
		
	
		
		
			
				
					
					 
					 
					        finishedOnboarding : setting.finishedOnboarding  ||  false ,  
					 
					 
					          filterFeedByVisible : setting.filterFeedByVisible  ||  false ,  
				
			 
			
				
				
			
		
	
		
		
			
				
					
					 
					 
					        firstName : setting.firstName  ||  "" ,  
					 
					 
					          finishedOnboarding : setting.finishedOnboarding  ||  false ,  
				
			 
			
				
				
			
		
	
		
		
			
				
					
					 
					 
					        hideRegisterPromptOnNewContact :  
					 
					 
					          firstName : setting.firstName  ||  "" ,  
				
			 
			
				
				
			
		
	
		
		
			
				
					
					 
					 
					          setting . hideRegisterPromptOnNewContact  ||  false ,  
					 
					 
					          hideRegisterPromptOnNewContact :  
				
			 
			
				
				
			
		
	
		
		
			
				
					
					 
					 
					        isRegistered : setting.isRegistered  ||  false ,  
					 
					 
					            setting . hideRegisterPromptOnNewContact  ||  false ,  
				
			 
			
				
				
			
		
	
		
		
			
				
					
					 
					 
					        lastName : setting.lastName  ||  "" ,  
					 
					 
					          isRegistered : setting.isRegistered  ||  false ,  
				
			 
			
				
				
			
		
	
		
		
			
				
					
					 
					 
					        lastAckedOfferToUserJwtId : setting.lastAckedOfferToUserJwtId  ||  "" ,  
					 
					 
					          lastName : setting.lastName  ||  "" ,  
				
			 
			
				
				
			
		
	
		
		
			
				
					
					 
					 
					        lastAckedOfferToUserProjectsJwtId :  
					 
					 
					          lastAckedOfferToUserJwtId : setting.lastAckedOfferToUserJwtId  ||  "" ,  
				
			 
			
				
				
			
		
	
		
		
			
				
					
					 
					 
					          setting . lastAckedOfferToUserProjectsJwtId  ||  "" ,  
					 
					 
					          lastAckedOfferToUserProjectsJwtId :  
				
			 
			
				
				
			
		
	
		
		
			
				
					
					 
					 
					        lastNotifiedClaimId : setting.lastNotifiedClaimId  ||  "" ,  
					 
					 
					            setting . lastAckedOfferToUserProjectsJwtId  ||  "" ,  
				
			 
			
				
				
			
		
	
		
		
			
				
					
					 
					 
					        lastViewedClaimId : setting.lastViewedClaimId  ||  "" ,  
					 
					 
					          lastNotifiedClaimId : setting.lastNotifiedClaimId  ||  "" ,  
				
			 
			
				
				
			
		
	
		
		
			
				
					
					 
					 
					        notifyingNewActivityTime : setting.notifyingNewActivityTime  ||  "" ,  
					 
					 
					          lastViewedClaimId : setting.lastViewedClaimId  ||  "" ,  
				
			 
			
				
				
			
		
	
		
		
			
				
					
					 
					 
					        notifyingReminderMessage : setting.notifyingReminderMessage  ||  "" ,  
					 
					 
					          notifyingNewActivityTime : setting.notifyingNewActivityTime  ||  "" ,  
				
			 
			
				
				
			
		
	
		
		
			
				
					
					 
					 
					        notifyingReminderTime : setting.notifyingReminderTime  ||  "" ,  
					 
					 
					          notifyingReminderMessage : setting.notifyingReminderMessage  ||  "" ,  
				
			 
			
				
				
			
		
	
		
		
			
				
					
					 
					 
					        partnerApiServer : setting.partnerApiServer  ||  "" ,  
					 
					 
					          notifyingReminderTime : setting.notifyingReminderTime  ||  "" ,  
				
			 
			
				
				
			
		
	
		
		
			
				
					
					 
					 
					        passkeyExpirationMinutes : setting.passkeyExpirationMinutes ,  
					 
					 
					          partnerApiServer : setting.partnerApiServer  ||  "" ,  
				
			 
			
				
				
			
		
	
		
		
			
				
					
					 
					 
					        profileImageUrl : setting.profileImageUrl  ||  "" ,  
					 
					 
					          passkeyExpirationMinutes : setting.passkeyExpirationMinutes ,  
				
			 
			
				
				
			
		
	
		
		
			
				
					
					 
					 
					        searchBoxes : parseJsonField ( setting . searchBoxes ,  [ ] ) ,  
					 
					 
					          profileImageUrl : setting.profileImageUrl  ||  "" ,  
				
			 
			
				
				
			
		
	
		
		
			
				
					
					 
					 
					        showContactGivesInline : setting.showContactGivesInline  ||  false ,  
					 
					 
					          searchBoxes : parseJsonField ( setting . searchBoxes ,  [ ] ) ,  
				
			 
			
				
				
			
		
	
		
		
			
				
					
					 
					 
					        showGeneralAdvanced : setting.showGeneralAdvanced  ||  false ,  
					 
					 
					          showContactGivesInline : setting.showContactGivesInline  ||  false ,  
				
			 
			
				
				
			
		
	
		
		
			
				
					
					 
					 
					        showShortcutBvc : setting.showShortcutBvc  ||  false ,  
					 
					 
					          showGeneralAdvanced : setting.showGeneralAdvanced  ||  false ,  
				
			 
			
				
				
			
		
	
		
		
			
				
					
					 
					 
					        vapid : setting.vapid  ||  "" ,  
					 
					 
					          showShortcutBvc : setting.showShortcutBvc  ||  false ,  
				
			 
			
				
				
			
		
	
		
		
			
				
					
					 
					 
					        warnIfProdServer : setting.warnIfProdServer  ||  false ,  
					 
					 
					          vapid : setting.vapid  ||  "" ,  
				
			 
			
				
				
			
		
	
		
		
			
				
					
					 
					 
					        warnIfTestServer : setting.warnIfTestServer  ||  false ,  
					 
					 
					          warnIfProdServer : setting.warnIfProdServer  ||  false ,  
				
			 
			
				
				
			
		
	
		
		
			
				
					
					 
					 
					        webPushServer : setting.webPushServer  ||  "" ,  
					 
					 
					          warnIfTestServer : setting.warnIfTestServer  ||  false ,  
				
			 
			
				
				
			
		
	
		
		
			
				
					
					 
					 
					      }  as  Settings ;  
					 
					 
					          webPushServer : setting.webPushServer  ||  "" ,  
				
			 
			
				
				
			
		
	
		
		
			
				
					
					 
					 
					    } ) ;  
					 
					 
					        }  as  Settings ;  
				
			 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					 
					 
					 
					 
					 
					      } )  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					      . filter ( ( setting )  = >  {  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					        // Only include settings that have either accountDid or activeDid set
  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					        return  setting . accountDid  ||  setting . activeDid ;  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					      } ) ;  
				
			 
			
		
	
		
		
			
				
					 
					 
					
 
					 
					 
					
 
				
			 
			
		
	
		
		
			
				
					 
					 
					    logger . info (  
					 
					 
					    logger . info (  
				
			 
			
		
	
		
		
			
				
					 
					 
					      ` [MigrationService] Retrieved  ${ settings . length }  settings from SQLite ` ,  
					 
					 
					      ` [MigrationService] Retrieved  ${ settings . length }  settings from SQLite ` ,  
				
			 
			
		
	
	
		
		
			
				
					
						
							
								 
							 
						
						
							
								 
							 
						
						
					 
					@ -837,95 +842,79 @@ function accountsEqual(account1: Account, account2: Account): boolean { 
				
			 
			
		
	
		
		
			
				
					 
					 
					 * /  
					 
					 
					 * /  
				
			 
			
		
	
		
		
			
				
					 
					 
					export  function  generateComparisonYaml ( comparison : DataComparison ) :  string  {  
					 
					 
					export  function  generateComparisonYaml ( comparison : DataComparison ) :  string  {  
				
			 
			
		
	
		
		
			
				
					 
					 
					  const  yaml  =  {  
					 
					 
					  const  yaml  =  {  
				
			 
			
		
	
		
		
			
				
					
					 
					 
					    comparison :  {  
					 
					 
					    summary :  {  
				
			 
			
				
				
			
		
	
		
		
			
				
					
					 
					 
					      summary :  {  
					 
					 
					      dexieContacts : comparison.dexieContacts.length ,  
				
			 
			
				
				
			
		
	
		
		
			
				
					
					 
					 
					        dexieContacts : comparison.dexieContacts.length ,  
					 
					 
					      sqliteContacts : comparison.sqliteContacts.filter ( c  = >  c . did ) . length ,  
				
			 
			
				
				
			
		
	
		
		
			
				
					
					 
					 
					        sqliteContacts : comparison.sqliteContacts.length ,  
					 
					 
					      dexieSettings : comparison.dexieSettings.length ,  
				
			 
			
				
				
			
		
	
		
		
			
				
					
					 
					 
					        dexieSettings : comparison.dexieSettings.length ,  
					 
					 
					      sqliteSettings : comparison.sqliteSettings.filter ( s  = >  s . accountDid  ||  s . activeDid ) . length ,  
				
			 
			
				
				
			
		
	
		
		
			
				
					
					 
					 
					        sqliteSettings : comparison.sqliteSettings.length ,  
					 
					 
					      dexieAccounts : comparison.dexieAccounts.length ,  
				
			 
			
				
				
			
		
	
		
		
			
				
					
					 
					 
					        dexieAccounts : comparison.dexieAccounts.length ,  
					 
					 
					      sqliteAccounts : comparison.sqliteAccounts.filter ( a  = >  a . did ) . length ,  
				
			 
			
				
				
			
		
	
		
		
			
				
					
					 
					 
					        sqliteAccounts : comparison.sqliteAccounts.length ,  
					 
					 
					    } ,  
				
			 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					 
					 
					 
					 
					 
					    differences :  {  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					      contacts :  {  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					        added : comparison.differences.contacts.added.length ,  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					        modified : comparison.differences.contacts.modified.length ,  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					        missing : comparison.differences.contacts.missing.filter ( c  = >  c . did ) . length ,  
				
			 
			
		
	
		
		
			
				
					 
					 
					      } ,  
					 
					 
					      } ,  
				
			 
			
		
	
		
		
			
				
					
					 
					 
					      differences :  {  
					 
					 
					      settings :  {  
				
			 
			
				
				
			
		
	
		
		
			
				
					
					 
					 
					        contacts :  {  
					 
					 
					        added : comparison.differences.settings.added.length ,  
				
			 
			
				
				
			
		
	
		
		
			
				
					
					 
					 
					          added : comparison.differences.contacts.added.length ,  
					 
					 
					        modified : comparison.differences.settings.modified.length ,  
				
			 
			
				
				
			
		
	
		
		
			
				
					
					 
					 
					          modified : comparison.differences.contacts.modified.length ,  
					 
					 
					        missing : comparison.differences.settings.missing.filter ( s  = >  s . accountDid  ||  s . activeDid ) . length ,  
				
			 
			
				
				
			
		
	
		
		
			
				
					
					 
					 
					          missing : comparison.differences.contacts.missing.length ,  
					 
					 
					      } ,  
				
			 
			
				
				
			
		
	
		
		
			
				
					
					 
					 
					        } ,  
					 
					 
					      accounts :  {  
				
			 
			
				
				
			
		
	
		
		
			
				
					
					 
					 
					        settings :  {  
					 
					 
					        added : comparison.differences.accounts.added.length ,  
				
			 
			
				
				
			
		
	
		
		
			
				
					
					 
					 
					          added : comparison.differences.settings.added.length ,  
					 
					 
					        modified : comparison.differences.accounts.modified.length ,  
				
			 
			
				
				
			
		
	
		
		
			
				
					
					 
					 
					          modified : comparison.differences.settings.modified.length ,  
					 
					 
					        missing : comparison.differences.accounts.missing.filter ( a  = >  a . did ) . length ,  
				
			 
			
				
				
			
		
	
		
		
			
				
					 
					 
					          missing : comparison.differences.settings.missing.length ,  
					 
					 
					 
				
			 
			
		
	
		
		
			
				
					 
					 
					        } ,  
					 
					 
					 
				
			 
			
		
	
		
		
			
				
					 
					 
					        accounts :  {  
					 
					 
					 
				
			 
			
		
	
		
		
			
				
					 
					 
					          added : comparison.differences.accounts.added.length ,  
					 
					 
					 
				
			 
			
		
	
		
		
			
				
					 
					 
					          modified : comparison.differences.accounts.modified.length ,  
					 
					 
					 
				
			 
			
		
	
		
		
			
				
					 
					 
					          missing : comparison.differences.accounts.missing.length ,  
					 
					 
					 
				
			 
			
		
	
		
		
			
				
					 
					 
					        } ,  
					 
					 
					 
				
			 
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					 
					 
					      } ,  
					 
					 
					      } ,  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					    } ,  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					    details :  {  
				
			 
			
		
	
		
		
			
				
					 
					 
					      contacts :  {  
					 
					 
					      contacts :  {  
				
			 
			
		
	
		
		
			
				
					 
					 
					        dexie : comparison.dexieContacts.map ( ( c )  = >  ( {  
					 
					 
					        dexie : comparison.dexieContacts.map ( ( c )  = >  ( {  
				
			 
			
		
	
		
		
			
				
					 
					 
					          did : c.did ,  
					 
					 
					          did : c.did ,  
				
			 
			
		
	
		
		
			
				
					
					 
					 
					          name : c.name ,  
					 
					 
					          name : c.name  ||  '<empty>' ,  
				
			 
			
				
				
			
		
	
		
		
			
				
					
					 
					 
					          notes : c.notes ,  
					 
					 
					          contactMethods :  ( c . contactMethods  ||  [ ] ) . length ,  
				
			 
			
				
				
			
		
	
		
		
			
				
					 
					 
					          profileImageUrl : c.profileImageUrl ,  
					 
					 
					 
				
			 
			
		
	
		
		
			
				
					 
					 
					          seesMe : c.seesMe ,  
					 
					 
					 
				
			 
			
		
	
		
		
			
				
					 
					 
					          registered : c.registered ,  
					 
					 
					 
				
			 
			
		
	
		
		
			
				
					 
					 
					          contactMethods : c.contactMethods ,  
					 
					 
					 
				
			 
			
		
	
		
		
			
				
					 
					 
					        } ) ) ,  
					 
					 
					 
				
			 
			
		
	
		
		
			
				
					 
					 
					        sqlite : comparison.sqliteContacts.map ( ( c )  = >  ( {  
					 
					 
					 
				
			 
			
		
	
		
		
			
				
					 
					 
					          did : c.did ,  
					 
					 
					 
				
			 
			
		
	
		
		
			
				
					 
					 
					          name : c.name ,  
					 
					 
					 
				
			 
			
		
	
		
		
			
				
					 
					 
					          notes : c.notes ,  
					 
					 
					 
				
			 
			
		
	
		
		
			
				
					 
					 
					          profileImageUrl : c.profileImageUrl ,  
					 
					 
					 
				
			 
			
		
	
		
		
			
				
					 
					 
					          seesMe : c.seesMe ,  
					 
					 
					 
				
			 
			
		
	
		
		
			
				
					 
					 
					          registered : c.registered ,  
					 
					 
					 
				
			 
			
		
	
		
		
			
				
					 
					 
					          contactMethods : c.contactMethods ,  
					 
					 
					 
				
			 
			
		
	
		
		
	
		
		
	
		
		
			
				
					 
					 
					        } ) ) ,  
					 
					 
					        } ) ) ,  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					        sqlite : comparison.sqliteContacts  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					          . filter ( c  = >  c . did )  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					          . map ( ( c )  = >  ( {  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					            did : c.did ,  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					            name : c.name  ||  '<empty>' ,  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					            contactMethods :  ( c . contactMethods  ||  [ ] ) . length ,  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					          } ) ) ,  
				
			 
			
		
	
		
		
			
				
					 
					 
					      } ,  
					 
					 
					      } ,  
				
			 
			
		
	
		
		
			
				
					 
					 
					      settings :  {  
					 
					 
					      settings :  {  
				
			 
			
		
	
		
		
			
				
					 
					 
					        dexie : comparison.dexieSettings.map ( ( s )  = >  ( {  
					 
					 
					        dexie : comparison.dexieSettings.map ( ( s )  = >  ( {  
				
			 
			
		
	
		
		
			
				
					 
					 
					          id : s.id ,  
					 
					 
					          id : s.id ,  
				
			 
			
		
	
		
		
			
				
					
					 
					 
					          accountDid : s.accountDid ,  
					 
					 
					          type :  s . id  ===  MASTER_SETTINGS_KEY  ?  'master'  :  'account' ,  
				
			 
			
				
				
			
		
	
		
		
			
				
					
					 
					 
					          activeDid : s.activeDid ,  
					 
					 
					          did : s.activeDid  ||  s . accountDid ,  
				
			 
			
				
				
			
		
	
		
		
			
				
					
					 
					 
					          firstName : s.firstName ,  
					 
					 
					          isRegistered : s.isRegistered  ||  false ,  
				
			 
			
				
				
			
		
	
		
		
			
				
					 
					 
					          isRegistered : s.isRegistered ,  
					 
					 
					 
				
			 
			
		
	
		
		
			
				
					 
					 
					          profileImageUrl : s.profileImageUrl ,  
					 
					 
					 
				
			 
			
		
	
		
		
			
				
					 
					 
					          showShortcutBvc : s.showShortcutBvc ,  
					 
					 
					 
				
			 
			
		
	
		
		
			
				
					 
					 
					          searchBoxes : s.searchBoxes ,  
					 
					 
					 
				
			 
			
		
	
		
		
			
				
					 
					 
					        } ) ) ,  
					 
					 
					 
				
			 
			
		
	
		
		
			
				
					 
					 
					        sqlite : comparison.sqliteSettings.map ( ( s )  = >  ( {  
					 
					 
					 
				
			 
			
		
	
		
		
			
				
					 
					 
					          id : s.id ,  
					 
					 
					 
				
			 
			
		
	
		
		
			
				
					 
					 
					          accountDid : s.accountDid ,  
					 
					 
					 
				
			 
			
		
	
		
		
			
				
					 
					 
					          activeDid : s.activeDid ,  
					 
					 
					 
				
			 
			
		
	
		
		
			
				
					 
					 
					          firstName : s.firstName ,  
					 
					 
					 
				
			 
			
		
	
		
		
			
				
					 
					 
					          isRegistered : s.isRegistered ,  
					 
					 
					 
				
			 
			
		
	
		
		
			
				
					 
					 
					          profileImageUrl : s.profileImageUrl ,  
					 
					 
					 
				
			 
			
		
	
		
		
			
				
					 
					 
					          showShortcutBvc : s.showShortcutBvc ,  
					 
					 
					 
				
			 
			
		
	
		
		
			
				
					 
					 
					          searchBoxes : s.searchBoxes ,  
					 
					 
					 
				
			 
			
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					 
					 
					        } ) ) ,  
					 
					 
					        } ) ) ,  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					        sqlite : comparison.sqliteSettings  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					          . filter ( s  = >  s . accountDid  ||  s . activeDid )  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					          . map ( ( s )  = >  ( {  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					            id : s.id ,  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					            type :  s . id  ===  MASTER_SETTINGS_KEY  ?  'master'  :  'account' ,  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					            did : s.activeDid  ||  s . accountDid ,  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					            isRegistered : s.isRegistered  ||  false ,  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					          } ) ) ,  
				
			 
			
		
	
		
		
			
				
					 
					 
					      } ,  
					 
					 
					      } ,  
				
			 
			
		
	
		
		
			
				
					 
					 
					      accounts :  {  
					 
					 
					      accounts :  {  
				
			 
			
		
	
		
		
			
				
					 
					 
					        dexie : comparison.dexieAccounts.map ( ( a )  = >  ( {  
					 
					 
					        dexie : comparison.dexieAccounts.map ( ( a )  = >  ( {  
				
			 
			
		
	
		
		
			
				
					 
					 
					          id : a.id ,  
					 
					 
					          id : a.id ,  
				
			 
			
		
	
		
		
			
				
					 
					 
					          dateCreated : a.dateCreated ,  
					 
					 
					 
				
			 
			
		
	
		
		
			
				
					 
					 
					          derivationPath : a.derivationPath ,  
					 
					 
					 
				
			 
			
		
	
		
		
			
				
					 
					 
					          did : a.did ,  
					 
					 
					          did : a.did ,  
				
			 
			
		
	
		
		
			
				
					 
					 
					          identity : a.identity ,  
					 
					 
					 
				
			 
			
		
	
		
		
			
				
					 
					 
					          mnemonic : a.mnemonic ,  
					 
					 
					 
				
			 
			
		
	
		
		
			
				
					 
					 
					          passkeyCredIdHex : a.passkeyCredIdHex ,  
					 
					 
					 
				
			 
			
		
	
		
		
			
				
					 
					 
					          publicKeyHex : a.publicKeyHex ,  
					 
					 
					 
				
			 
			
		
	
		
		
			
				
					 
					 
					        } ) ) ,  
					 
					 
					 
				
			 
			
		
	
		
		
			
				
					 
					 
					        sqlite : comparison.sqliteAccounts.map ( ( a )  = >  ( {  
					 
					 
					 
				
			 
			
		
	
		
		
			
				
					 
					 
					          id : a.id ,  
					 
					 
					 
				
			 
			
		
	
		
		
			
				
					 
					 
					          dateCreated : a.dateCreated ,  
					 
					 
					          dateCreated : a.dateCreated ,  
				
			 
			
		
	
		
		
			
				
					
					 
					 
					          derivationPath : a.derivationPath ,  
					 
					 
					          hasIdentity :  ! ! a . identity ,  
				
			 
			
				
				
			
		
	
		
		
			
				
					
					 
					 
					          did : a.did ,  
					 
					 
					          hasMnemonic :  ! ! a . mnemonic ,  
				
			 
			
				
				
			
		
	
		
		
			
				
					 
					 
					          identity : a.identity ,  
					 
					 
					 
				
			 
			
		
	
		
		
			
				
					 
					 
					          mnemonic : a.mnemonic ,  
					 
					 
					 
				
			 
			
		
	
		
		
			
				
					 
					 
					          passkeyCredIdHex : a.passkeyCredIdHex ,  
					 
					 
					 
				
			 
			
		
	
		
		
			
				
					 
					 
					          publicKeyHex : a.publicKeyHex ,  
					 
					 
					 
				
			 
			
		
	
		
		
	
		
		
	
		
		
			
				
					 
					 
					        } ) ) ,  
					 
					 
					        } ) ) ,  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					        sqlite : comparison.sqliteAccounts  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					          . filter ( a  = >  a . did )  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					          . map ( ( a )  = >  ( {  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					            id : a.id ,  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					            did : a.did ,  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					            dateCreated : a.dateCreated ,  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					            hasIdentity :  ! ! a . identity ,  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					            hasMnemonic :  ! ! a . mnemonic ,  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					          } ) ) ,  
				
			 
			
		
	
		
		
			
				
					 
					 
					      } ,  
					 
					 
					      } ,  
				
			 
			
		
	
		
		
			
				
					 
					 
					    } ,  
					 
					 
					    } ,  
				
			 
			
		
	
		
		
			
				
					 
					 
					  } ;  
					 
					 
					  } ;  
				
			 
			
		
	
	
		
		
			
				
					
						
							
								 
							 
						
						
							
								 
							 
						
						
					 
					@ -1111,29 +1100,45 @@ export async function migrateSettings( 
				
			 
			
		
	
		
		
			
				
					 
					 
					          [ dexieSetting . id ] ,  
					 
					 
					          [ dexieSetting . id ] ,  
				
			 
			
		
	
		
		
			
				
					 
					 
					        ) ;  
					 
					 
					        ) ;  
				
			 
			
		
	
		
		
			
				
					 
					 
					
 
					 
					 
					
 
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					        // Prepare the data object, handling DIDs based on whether this is the master settings
  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					        const  settingData : Record < string ,  unknown >  =  { } ;  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					        fieldsToMigrate . forEach ( ( field )  = >  {  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					          if  ( dexieSetting [ field  as  keyof  Settings ]  !==  undefined )  {  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					            settingData [ field ]  =  dexieSetting [ field  as  keyof  Settings ] ;  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					          }  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					        } ) ;  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					
 
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					        // Handle DIDs based on whether this is the master settings
  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					        if  ( dexieSetting . id  ===  MASTER_SETTINGS_KEY )  {  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					          // Master settings should only use activeDid
  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					          if  ( dexieSetting . activeDid )  {  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					            settingData . activeDid  =  dexieSetting . activeDid ;  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					          }  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					          // Ensure accountDid is null for master settings
  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					          settingData . accountDid  =  null ;  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					        }  else  {  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					          // Non-master settings should only use accountDid
  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					          if  ( dexieSetting . accountDid )  {  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					            settingData . accountDid  =  dexieSetting . accountDid ;  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					          }  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					          // Ensure activeDid is null for non-master settings
  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					          settingData . activeDid  =  null ;  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					        }  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					
 
				
			 
			
		
	
		
		
			
				
					 
					 
					        if  ( existingResult ? . values ? . length )  {  
					 
					 
					        if  ( existingResult ? . values ? . length )  {  
				
			 
			
		
	
		
		
			
				
					 
					 
					          if  ( overwriteExisting )  {  
					 
					 
					          if  ( overwriteExisting )  {  
				
			 
			
		
	
		
		
			
				
					
					 
					 
					            // Update existing setting with only the specified fields
  
					 
					 
					            // Update existing setting
  
				
			 
			
				
				
			
		
	
		
		
			
				
					
					 
					 
					            const  updateData : Record < string ,  unknown >  =  { } ;  
					 
					 
					            const  {  sql ,  params  }  =  generateUpdateStatement (  
				
			 
			
				
				
			
		
	
		
		
			
				
					
					 
					 
					            fieldsToMigrate . forEach ( ( field )  = >  {  
					 
					 
					              settingData ,  
				
			 
			
				
				
			
		
	
		
		
			
				
					
					 
					 
					              if  ( dexieSetting [ field  as  keyof  Settings ]  !==  undefined )  {  
					 
					 
					              "settings" ,  
				
			 
			
				
				
			
		
	
		
		
			
				
					
					 
					 
					                updateData [ field ]  =  dexieSetting [ field  as  keyof  Settings ] ;  
					 
					 
					              "id = ?" ,  
				
			 
			
				
				
			
		
	
		
		
			
				
					
					 
					 
					              }  
					 
					 
					              [ dexieSetting . id ] ,  
				
			 
			
				
				
			
		
	
		
		
			
				
					
					 
					 
					            } ) ;  
					 
					 
					            ) ;  
				
			 
			
				
				
			
		
	
		
		
			
				
					
					 
					 
					
 
					 
					 
					            await  platformService . dbExec ( sql ,  params ) ;  
				
			 
			
				
				
			
		
	
		
		
			
				
					
					 
					 
					            if  ( Object . keys ( updateData ) . length  >  0 )  {  
					 
					 
					            result . settingsMigrated ++ ;  
				
			 
			
				
				
			
		
	
		
		
			
				
					
					 
					 
					              const  {  sql ,  params  }  =  generateUpdateStatement (  
					 
					 
					            logger . info (  
				
			 
			
				
				
			
		
	
		
		
			
				
					
					 
					 
					                updateData  as  unknown  as  Record < string ,  unknown > ,  
					 
					 
					              ` [MigrationService] Updated settings:  ${ dexieSetting . id } ` ,  
				
			 
			
				
				
			
		
	
		
		
			
				
					
					 
					 
					                "settings" ,  
					 
					 
					            ) ;  
				
			 
			
				
				
			
		
	
		
		
			
				
					 
					 
					                "id = ?" ,  
					 
					 
					 
				
			 
			
		
	
		
		
			
				
					 
					 
					                [ dexieSetting . id ] ,  
					 
					 
					 
				
			 
			
		
	
		
		
			
				
					 
					 
					              ) ;  
					 
					 
					 
				
			 
			
		
	
		
		
			
				
					 
					 
					              await  platformService . dbExec ( sql ,  params ) ;  
					 
					 
					 
				
			 
			
		
	
		
		
			
				
					 
					 
					              result . settingsMigrated ++ ;  
					 
					 
					 
				
			 
			
		
	
		
		
			
				
					 
					 
					              logger . info (  
					 
					 
					 
				
			 
			
		
	
		
		
			
				
					 
					 
					                ` [MigrationService] Updated settings:  ${ dexieSetting . id } ` ,  
					 
					 
					 
				
			 
			
		
	
		
		
			
				
					 
					 
					              ) ;  
					 
					 
					 
				
			 
			
		
	
		
		
			
				
					 
					 
					            }  
					 
					 
					 
				
			 
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					 
					 
					          }  else  {  
					 
					 
					          }  else  {  
				
			 
			
		
	
		
		
			
				
					 
					 
					            result . warnings . push (  
					 
					 
					            result . warnings . push (  
				
			 
			
		
	
		
		
			
				
					 
					 
					              ` Settings  ${ dexieSetting . id }  already exists, skipping ` ,  
					 
					 
					              ` Settings  ${ dexieSetting . id }  already exists, skipping ` ,  
				
			 
			
		
	
	
		
		
			
				
					
						
						
						
							
								 
							 
						
					 
					@ -1141,8 +1146,9 @@ export async function migrateSettings( 
				
			 
			
		
	
		
		
			
				
					 
					 
					          }  
					 
					 
					          }  
				
			 
			
		
	
		
		
			
				
					 
					 
					        }  else  {  
					 
					 
					        }  else  {  
				
			 
			
		
	
		
		
			
				
					 
					 
					          // Insert new setting
  
					 
					 
					          // Insert new setting
  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					          settingData . id  =  dexieSetting . id ;  
				
			 
			
		
	
		
		
			
				
					 
					 
					          const  {  sql ,  params  }  =  generateInsertStatement (  
					 
					 
					          const  {  sql ,  params  }  =  generateInsertStatement (  
				
			 
			
		
	
		
		
			
				
					
					 
					 
					            dexieSetting  as  unknown  as  Record < string ,  unknown > ,  
					 
					 
					            settingData ,  
				
			 
			
				
				
			
		
	
		
		
	
		
		
			
				
					 
					 
					            "settings" ,  
					 
					 
					            "settings" ,  
				
			 
			
		
	
		
		
			
				
					 
					 
					          ) ;  
					 
					 
					          ) ;  
				
			 
			
		
	
		
		
			
				
					 
					 
					          await  platformService . dbExec ( sql ,  params ) ;  
					 
					 
					          await  platformService . dbExec ( sql ,  params ) ;