The operation ID.
Partial updates to apply.
The updated operation, or null if not found.
export function updateFailedOperation(
id: string,
updates: Partial<FailedOperation>,
): FailedOperation | null {
try {
const queue = getFailedOperations();
const operation = queue.operations.find((op) => op.id === id);
if (!operation) {
console.warn(`[Storage] Failed operation not found: ${id}`);
return null;
}
// Apply updates
Object.assign(operation, updates);
queue.lastUpdated = Date.now();
// Save updated queue
storage.setItem(STORAGE_KEYS.FAILED_OPERATIONS, JSON.stringify(queue));
console.debug(`[Storage] Updated failed operation: ${id}`);
return operation;
} catch (error) {
console.error("[Storage] Failed to update operation:", error);
throw error;
}
}
Updates a failed operation in the queue.