|
|
@ -182,28 +182,27 @@ export async function getSqliteContacts(): Promise<Contact[]> { |
|
|
|
const platformService = PlatformServiceFactory.getInstance(); |
|
|
|
const result = await platformService.dbQuery("SELECT * FROM contacts"); |
|
|
|
|
|
|
|
if (!result?.values?.length) { |
|
|
|
return []; |
|
|
|
let contacts: Contact[] = []; |
|
|
|
if (result?.values?.length) { |
|
|
|
contacts = result.values.map((row) => { |
|
|
|
const contact = parseJsonField(row, {}) as Contact; |
|
|
|
return { |
|
|
|
did: contact.did || "", |
|
|
|
name: contact.name || "", |
|
|
|
contactMethods: parseJsonField( |
|
|
|
contact.contactMethods, |
|
|
|
[], |
|
|
|
) as ContactMethod[], |
|
|
|
nextPubKeyHashB64: contact.nextPubKeyHashB64 || "", |
|
|
|
notes: contact.notes || "", |
|
|
|
profileImageUrl: contact.profileImageUrl || "", |
|
|
|
publicKeyBase64: contact.publicKeyBase64 || "", |
|
|
|
seesMe: contact.seesMe || false, |
|
|
|
registered: contact.registered || false, |
|
|
|
} as Contact; |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
const contacts = result.values.map((row) => { |
|
|
|
const contact = parseJsonField(row, {}) as Contact; |
|
|
|
return { |
|
|
|
did: contact.did || "", |
|
|
|
name: contact.name || "", |
|
|
|
contactMethods: parseJsonField( |
|
|
|
contact.contactMethods, |
|
|
|
[], |
|
|
|
) as ContactMethod[], |
|
|
|
nextPubKeyHashB64: contact.nextPubKeyHashB64 || "", |
|
|
|
notes: contact.notes || "", |
|
|
|
profileImageUrl: contact.profileImageUrl || "", |
|
|
|
publicKeyBase64: contact.publicKeyBase64 || "", |
|
|
|
seesMe: contact.seesMe || false, |
|
|
|
registered: contact.registered || false, |
|
|
|
} as Contact; |
|
|
|
}); |
|
|
|
|
|
|
|
logger.info( |
|
|
|
`[MigrationService] Retrieved ${contacts.length} contacts from SQLite`, |
|
|
|
); |
|
|
@ -280,42 +279,41 @@ export async function getSqliteSettings(): Promise<Settings[]> { |
|
|
|
const platformService = PlatformServiceFactory.getInstance(); |
|
|
|
const result = await platformService.dbQuery("SELECT * FROM settings"); |
|
|
|
|
|
|
|
if (!result?.values?.length) { |
|
|
|
return []; |
|
|
|
let settings: Settings[] = []; |
|
|
|
if (result?.values?.length) { |
|
|
|
settings = result.values.map((row) => { |
|
|
|
const setting = parseJsonField(row, {}) as Settings; |
|
|
|
return { |
|
|
|
id: setting.id, |
|
|
|
accountDid: setting.accountDid || "", |
|
|
|
activeDid: setting.activeDid || "", |
|
|
|
apiServer: setting.apiServer || "", |
|
|
|
filterFeedByNearby: setting.filterFeedByNearby || false, |
|
|
|
filterFeedByVisible: setting.filterFeedByVisible || false, |
|
|
|
finishedOnboarding: setting.finishedOnboarding || false, |
|
|
|
firstName: setting.firstName || "", |
|
|
|
hideRegisterPromptOnNewContact: setting.hideRegisterPromptOnNewContact || false, |
|
|
|
isRegistered: setting.isRegistered || false, |
|
|
|
lastName: setting.lastName || "", |
|
|
|
lastAckedOfferToUserJwtId: setting.lastAckedOfferToUserJwtId || "", |
|
|
|
lastAckedOfferToUserProjectsJwtId: setting.lastAckedOfferToUserProjectsJwtId || "", |
|
|
|
lastNotifiedClaimId: setting.lastNotifiedClaimId || "", |
|
|
|
lastViewedClaimId: setting.lastViewedClaimId || "", |
|
|
|
notifyingNewActivityTime: setting.notifyingNewActivityTime || "", |
|
|
|
notifyingReminderMessage: setting.notifyingReminderMessage || "", |
|
|
|
notifyingReminderTime: setting.notifyingReminderTime || "", |
|
|
|
partnerApiServer: setting.partnerApiServer || "", |
|
|
|
passkeyExpirationMinutes: setting.passkeyExpirationMinutes, |
|
|
|
profileImageUrl: setting.profileImageUrl || "", |
|
|
|
searchBoxes: parseJsonField(setting.searchBoxes, []), |
|
|
|
showContactGivesInline: setting.showContactGivesInline || false, |
|
|
|
showGeneralAdvanced: setting.showGeneralAdvanced || false, |
|
|
|
showShortcutBvc: setting.showShortcutBvc || false, |
|
|
|
vapid: setting.vapid || "", |
|
|
|
} as Settings; |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
const settings = result.values.map((row) => { |
|
|
|
const setting = parseJsonField(row, {}) as Settings; |
|
|
|
return { |
|
|
|
id: setting.id, |
|
|
|
accountDid: setting.accountDid || "", |
|
|
|
activeDid: setting.activeDid || "", |
|
|
|
apiServer: setting.apiServer || "", |
|
|
|
filterFeedByNearby: setting.filterFeedByNearby || false, |
|
|
|
filterFeedByVisible: setting.filterFeedByVisible || false, |
|
|
|
finishedOnboarding: setting.finishedOnboarding || false, |
|
|
|
firstName: setting.firstName || "", |
|
|
|
hideRegisterPromptOnNewContact: setting.hideRegisterPromptOnNewContact || false, |
|
|
|
isRegistered: setting.isRegistered || false, |
|
|
|
lastName: setting.lastName || "", |
|
|
|
lastAckedOfferToUserJwtId: setting.lastAckedOfferToUserJwtId || "", |
|
|
|
lastAckedOfferToUserProjectsJwtId: setting.lastAckedOfferToUserProjectsJwtId || "", |
|
|
|
lastNotifiedClaimId: setting.lastNotifiedClaimId || "", |
|
|
|
lastViewedClaimId: setting.lastViewedClaimId || "", |
|
|
|
notifyingNewActivityTime: setting.notifyingNewActivityTime || "", |
|
|
|
notifyingReminderMessage: setting.notifyingReminderMessage || "", |
|
|
|
notifyingReminderTime: setting.notifyingReminderTime || "", |
|
|
|
partnerApiServer: setting.partnerApiServer || "", |
|
|
|
passkeyExpirationMinutes: setting.passkeyExpirationMinutes, |
|
|
|
profileImageUrl: setting.profileImageUrl || "", |
|
|
|
searchBoxes: parseJsonField(setting.searchBoxes, []), |
|
|
|
showContactGivesInline: setting.showContactGivesInline || false, |
|
|
|
showGeneralAdvanced: setting.showGeneralAdvanced || false, |
|
|
|
showShortcutBvc: setting.showShortcutBvc || false, |
|
|
|
vapid: setting.vapid || "", |
|
|
|
} as Settings; |
|
|
|
}); |
|
|
|
|
|
|
|
logger.info( |
|
|
|
`[MigrationService] Retrieved ${settings.length} settings from SQLite`, |
|
|
|
); |
|
|
@ -355,24 +353,23 @@ export async function getSqliteAccounts(): Promise<Account[]> { |
|
|
|
const platformService = PlatformServiceFactory.getInstance(); |
|
|
|
const result = await platformService.dbQuery("SELECT * FROM accounts"); |
|
|
|
|
|
|
|
if (!result?.values?.length) { |
|
|
|
return []; |
|
|
|
let accounts: Account[] = []; |
|
|
|
if (result?.values?.length) { |
|
|
|
accounts = result.values.map((row) => { |
|
|
|
const account = parseJsonField(row, {}) as Account; |
|
|
|
return { |
|
|
|
id: account.id, |
|
|
|
dateCreated: account.dateCreated || "", |
|
|
|
derivationPath: account.derivationPath || "", |
|
|
|
did: account.did || "", |
|
|
|
identity: account.identity || "", |
|
|
|
mnemonic: account.mnemonic || "", |
|
|
|
passkeyCredIdHex: account.passkeyCredIdHex || "", |
|
|
|
publicKeyHex: account.publicKeyHex || "", |
|
|
|
} as Account; |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
const accounts = result.values.map((row) => { |
|
|
|
const account = parseJsonField(row, {}) as Account; |
|
|
|
return { |
|
|
|
id: account.id, |
|
|
|
dateCreated: account.dateCreated || "", |
|
|
|
derivationPath: account.derivationPath || "", |
|
|
|
did: account.did || "", |
|
|
|
identity: account.identity || "", |
|
|
|
mnemonic: account.mnemonic || "", |
|
|
|
passkeyCredIdHex: account.passkeyCredIdHex || "", |
|
|
|
publicKeyHex: account.publicKeyHex || "", |
|
|
|
} as Account; |
|
|
|
}); |
|
|
|
|
|
|
|
logger.info( |
|
|
|
`[MigrationService] Retrieved ${accounts.length} accounts from SQLite`, |
|
|
|
); |
|
|
|