feat(ext/shared): message types for LastPass import

Adds parse_lastpass_csv (preview) and import_lastpass_commit
(write) to the popup-only message set, plus typed response
helpers. SW handlers + UI follow in Tasks 12-14.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
adlee-was-taken
2026-04-29 23:30:18 -04:00
parent 1f764a4639
commit fbd029e4cb

View File

@@ -55,7 +55,9 @@ export type PopupMessage =
bytes: ArrayBuffer;
passphrase: string;
newRemote: { hostType: 'gitea' | 'github'; hostUrl: string; repoPath: string; apiToken: string };
};
}
| { type: 'parse_lastpass_csv'; bytes: ArrayBuffer }
| { type: 'import_lastpass_commit'; items: Item[] };
// --- Messages a content script may send ---
@@ -161,6 +163,7 @@ export const POPUP_ONLY_TYPES: ReadonlySet<PopupMessage['type']> = new Set([
'get_field_history',
'get_session_config', 'update_session_config',
'export_backup', 'restore_backup',
'parse_lastpass_csv', 'import_lastpass_commit',
] as PopupMessage['type'][]);
export interface ExportBackupResponse extends Extract<Response, { ok: true }> {
@@ -173,6 +176,19 @@ export interface RestoreBackupResponse extends Extract<Response, { ok: true }> {
};
}
export interface ParseLastPassCsvResponse extends Extract<Response, { ok: true }> {
data: {
items: Item[];
warnings: Array<{ row: number; title?: string; message: string }>;
};
}
export interface ImportLastPassCommitResponse extends Extract<Response, { ok: true }> {
data: {
summary: { itemCount: number };
};
}
export const CONTENT_CALLABLE_TYPES: ReadonlySet<ContentMessage['type']> = new Set([
'get_autofill_candidates', 'get_credentials', 'check_credential', 'blacklist_site',
'capture_save_login',