Skip to content

platform/data/profile-db

Defined in: app/src/platform/data/profile-db.ts:120

The profile database profile.db: history with full-text search, bookmarks and the list of downloads. It runs in the data service process, never in the browser process, because SQLite calls block. Schema changes run as numbered migrations; before one runs on an existing database, a copy is written next to it with VACUUM INTO. A database from a newer version is opened read-only, so an older version never changes data it does not understand.

new ProfileDatabase(path, clock?): ProfileDatabase

Defined in: app/src/platform/data/profile-db.ts:130

string

Path of profile.db, or :memory: in tests.

() => number

Current time in milliseconds since 1970.

ProfileDatabase

readonly readOnly: boolean

Defined in: app/src/platform/data/profile-db.ts:124

Whether the database belongs to a newer version and must not be written.

addBookmark(parent, title, url?): number

Defined in: app/src/platform/data/profile-db.ts:298

Adds a bookmark or a folder at the end of a folder.

number

The folder.

string

Its title.

string

The address of a bookmark; omitted for a folder.

number

The new id.

addDownload(url, path, total): number

Defined in: app/src/platform/data/profile-db.ts:429

Adds a download to the list, which keeps the most recent ones.

string

The address it comes from.

string

The file it is saved to.

number

Its size in bytes, or 0 while unknown.

number

Its id.

addVisit(url, title?): void

Defined in: app/src/platform/data/profile-db.ts:163

Records a visit of a page.

string

The page’s address.

string = ''

Its title, if known yet.

void

bookmarkList(): BookmarkRow[]

Defined in: app/src/platform/data/profile-db.ts:312

Every bookmark and folder in display order: the two root folders first, then the contents of each folder in their order. Roots have no parent, folders no address.

BookmarkRow[]

bookmarks(): BookmarkNode[]

Defined in: app/src/platform/data/profile-db.ts:256

The bookmarks: the bookmarks bar and the other bookmarks, with their folders.

BookmarkNode[]

bookmarkUrls(): string[]

Defined in: app/src/platform/data/profile-db.ts:325

The distinct addresses of all bookmarks.

string[]

clearHistory(): void

Defined in: app/src/platform/data/profile-db.ts:227

Removes the whole history.

void

close(): void

Defined in: app/src/platform/data/profile-db.ts:504

Closes the database.

void

deleteHistory(ids): void

Defined in: app/src/platform/data/profile-db.ts:220

Removes pages from the history.

readonly number[]

The pages.

void

downloads(limit?): DownloadEntry[]

Defined in: app/src/platform/data/profile-db.ts:467

The most recent downloads, newest first. Downloads that were still running when the browser stopped are interrupted.

number = 100

Most downloads to return.

DownloadEntry[]

history(query, limit?, before?): HistoryEntry[]

Defined in: app/src/platform/data/profile-db.ts:190

Pages of the history, newest first, optionally matching search terms.

string

Words that the title or address must contain; empty for all pages.

number = 100

The most pages to return.

number = Number.MAX_SAFE_INTEGER

Only pages visited before this time.

HistoryEntry[]

importBookmarks(folderTitle, tree, source): number

Defined in: app/src/platform/data/profile-db.ts:389

Imports another browser’s bookmarks into a new folder of the other bookmarks. The folder of an earlier import from the same source is replaced, so importing again adds nothing.

string

Title of the new folder, such as “Imported from Chrome”.

readonly ImportedBookmark[]

The bookmarks and folders.

string

Identifies where the bookmarks come from, such as a browser profile.

number

How many bookmarks were imported.

importHistory(visits): number

Defined in: app/src/platform/data/profile-db.ts:238

Adds pages of another browser’s history; pages that exist keep the newer visit and the higher count of visits, so importing the same history again changes nothing.

readonly ImportedVisit[]

The pages.

number

How many pages were new.

interruptDownloads(): void

Defined in: app/src/platform/data/profile-db.ts:486

Marks the downloads that were still running when the browser stopped as interrupted.

void

removeBookmark(id): void

Defined in: app/src/platform/data/profile-db.ts:366

Removes a bookmark or a folder with everything in it. The root folders stay.

number

The bookmark or folder.

void

removeBookmarkUrl(url): void

Defined in: app/src/platform/data/profile-db.ts:376

Removes every bookmark of an address, for the star in the address bar.

string

The address.

void

removeDownloads(ids): void

Defined in: app/src/platform/data/profile-db.ts:495

Removes downloads from the list; their files stay.

readonly number[]

The downloads.

void

setTitle(url, title): void

Defined in: app/src/platform/data/profile-db.ts:179

Updates the title of a page in the history.

string

The page’s address.

string

Its new title.

void

updateBookmark(id, title, url?, parent?): void

Defined in: app/src/platform/data/profile-db.ts:341

Renames a bookmark or a folder, changes the address of a bookmark, and moves either to the end of another folder. The root folders stay as they are, and a folder never moves into itself or one of its own folders.

number

The bookmark or folder.

string

Its new title.

string

The new address of a bookmark; ignored for a folder.

number

The folder to move it to; omitted to keep it where it is.

void

updateDownload(id, received, total, state): void

Defined in: app/src/platform/data/profile-db.ts:455

Records how far a download got and where it stands.

number

The download.

number

The bytes received.

number

Its size in bytes, or 0 while unknown.

DownloadState

Where it stands.

void

Defined in: app/src/platform/data/profile-db.ts:16

A bookmark or a folder of bookmarks.

readonly optional children?: readonly BookmarkNode[]

Defined in: app/src/platform/data/profile-db.ts:21

readonly id: number

Defined in: app/src/platform/data/profile-db.ts:17

readonly title: string

Defined in: app/src/platform/data/profile-db.ts:18

readonly optional url?: string

Defined in: app/src/platform/data/profile-db.ts:20

The address of a bookmark; undefined for a folder.


Defined in: app/src/platform/data/profile-db.ts:25

A bookmark or folder as the bookmarks page lists it.

readonly id: number

Defined in: app/src/platform/data/profile-db.ts:26

readonly parentId: number | null

Defined in: app/src/platform/data/profile-db.ts:28

The folder it is in; null for the two root folders.

readonly title: string

Defined in: app/src/platform/data/profile-db.ts:29

readonly url: string | null

Defined in: app/src/platform/data/profile-db.ts:31

The address of a bookmark; null for a folder.


Defined in: app/src/platform/data/profile-db.ts:6

A page in the history, with its most recent visit.

readonly id: number

Defined in: app/src/platform/data/profile-db.ts:7

readonly lastVisit: number

Defined in: app/src/platform/data/profile-db.ts:12

Milliseconds since 1970 of the most recent visit.

readonly title: string

Defined in: app/src/platform/data/profile-db.ts:9

readonly url: string

Defined in: app/src/platform/data/profile-db.ts:8

readonly visitCount: number

Defined in: app/src/platform/data/profile-db.ts:10


Defined in: app/src/platform/data/profile-db.ts:35

A bookmark or folder to import, as another browser stores it.

readonly optional children?: readonly ImportedBookmark[]

Defined in: app/src/platform/data/profile-db.ts:38

readonly title: string

Defined in: app/src/platform/data/profile-db.ts:36

readonly optional url?: string

Defined in: app/src/platform/data/profile-db.ts:37


Defined in: app/src/platform/data/profile-db.ts:42

A page of another browser’s history to import.

readonly lastVisit: number

Defined in: app/src/platform/data/profile-db.ts:46

readonly title: string

Defined in: app/src/platform/data/profile-db.ts:44

readonly url: string

Defined in: app/src/platform/data/profile-db.ts:43

readonly visitCount: number

Defined in: app/src/platform/data/profile-db.ts:45

const profileSchemaVersion: number = migrations.length

Defined in: app/src/platform/data/profile-db.ts:110

The schema version that this build writes.

Re-exports bookmarkRoots