feat(export): Replace CSV export with standardized JSON format

- Add contactsToExportJson utility function for standardized data export
- Replace CSV export with JSON format in DataExportSection
- Update file extension and MIME type to application/json
- Remove Dexie-specific export logic in favor of unified SQLite/Dexie approach
- Update success notifications to reflect JSON format
- Add TypeScript interfaces for export data structure

This change improves data portability and standardization by:
- Using a consistent JSON format for data export/import
- Supporting both SQLite and Dexie databases
- Including all contact fields in export
- Properly handling contactMethods as stringified JSON
- Maintaining backward compatibility with existing import tools

Security: No sensitive data exposure, maintains existing access controls
This commit is contained in:
Matthew Raymer
2025-06-07 05:02:33 +00:00
parent cfb186a04e
commit b9223d7fe2
9 changed files with 230 additions and 126 deletions

View File

@@ -31,8 +31,6 @@ export class MigrationService {
sqlQuery: (sql: string) => Promise<T>,
extractMigrationNames: (result: T) => Set<string>,
): Promise<void> {
// eslint-disable-next-line no-console
console.log("Will run migrations");
// Create migrations table if it doesn't exist
const result0 = await sqlExec(`
@@ -42,29 +40,21 @@ export class MigrationService {
executed_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
`);
// eslint-disable-next-line no-console
console.log("Created migrations table", JSON.stringify(result0));
// Get list of executed migrations
const result1: T = await sqlQuery("SELECT name FROM migrations;");
const executedMigrations = extractMigrationNames(result1);
// eslint-disable-next-line no-console
console.log(
"Executed migration select",
JSON.stringify(executedMigrations),
);
// Run pending migrations in order
for (const migration of this.migrations) {
if (!executedMigrations.has(migration.name)) {
const result2 = await sqlExec(migration.sql);
// eslint-disable-next-line no-console
console.log("Executed migration", JSON.stringify(result2));
const result3 = await sqlExec(
await sqlExec(migration.sql);
await sqlExec(
`INSERT INTO migrations (name) VALUES ('${migration.name}')`,
);
// eslint-disable-next-line no-console
console.log("Updated migrations table", JSON.stringify(result3));
}
}
}