import type Entry from '../interfaces/Entry.mjs'; import type { EntryId, EntryMeta, EntryMetaForUrl, EntryMetaForUrlWithToken, EntryMetaWithToken, NewEntry, Token } from '../interfaces/Entry.mjs'; import type FavaLibMediator from '../FavaLibMediator.mjs'; /** * Manages the public operations related to the vault, including adding, deleting, and updating entries. */ declare class VaultOperationsManager { private readonly mediator; private get platformProviders(); /** * Constructs a new instance of VaultManager. * @param mediator - The mediator for accessing other components. */ constructor(mediator: FavaLibMediator); private get vaultDataManager(); private get commandManager(); /** * @returns The number of entries in the vault. */ get size(): number; /** * Retrieve metadata for a specific entry. * @param entryId - The ID of the entry. * @returns The entry's metadata. * @throws {EntryNotFoundError} If no entry exists with the given ID. */ getEntryMeta(entryId: EntryId): EntryMeta; /** * Search for entry ids matching the provided query. * @param query - The search query string. * @returns An array of matching entry IDs. */ searchEntries(query: string): EntryId[]; /** * Search for entries matching the provided query. * @param query - The search query string. * @param includeTokens - When true, includes current tokens with the metas. * @returns An array of matching entry metas, optionally with tokens. */ searchEntriesMetas(query: string, includeTokens: true): Promise; /** * @inheritdoc */ searchEntriesMetas(query: string, includeTokens?: false): EntryMeta[]; /** * Retrieve a list of all entry IDs in the library. * @returns An array of all entry IDs. */ listEntries(): EntryId[]; /** * Retrieve a list of all entry metas in the library. * @param includeTokens - When true, includes current tokens with the metas. * @returns An array of all entry metas, optionally with tokens. */ listEntriesMetas(includeTokens: true): Promise; /** * @inheritdoc */ listEntriesMetas(includeTokens?: false): EntryMeta[]; /** * Collect the entries whose matchers cover a url, most specific first. * @param url - The url to match against. * @returns The matching entries, each with the matcher that made it match. */ private matchEntriesForUrl; /** * Find the ids of the entries that belong to a url, most specific first. * * Entries with no matchers are never returned, and an unparseable url, or * one whose scheme is not http(s), yields an empty list rather than an * error. * * Regex matchers run synchronously and can block the calling thread. * @param url - The url to match against. * @returns The matching entry ids. */ findEntriesForUrl(url: string): EntryId[]; /** * Find the entries that belong to a url, most specific first. * @param url - The url to match against. * @param includeTokens - When true, includes current tokens with the metas. * @returns The matching entry metas, optionally with tokens. */ findEntryMetasForUrl(url: string, includeTokens: true): Promise; /** * @inheritdoc */ findEntryMetasForUrl(url: string, includeTokens?: false): EntryMetaForUrl[]; /** * Generate a time-based one-time password (TOTP) for a specific entry. * @param id - The unique identifier of the entry. * @param timestamp - Optional timestamp to use for token generation (default is current time). * @returns A promise resolving to an object containing the token and between which timestamps it is valid * @throws {EntryNotFoundError} If no entry exists with the given ID. * @throws {TokenGenerationError} If token generation fails due to invalid entry data or technical issues. */ generateTokenForEntry(id: EntryId, timestamp?: number): Promise; /** * Add a new entry to the library. * @param entry - The entry data to add (without an ID, as it will be generated). * @returns A promise that resolves to the newly generated EntryId. * @throws {InvalidCommandError} If the provided entry data is invalid or incomplete. */ addEntry(entry: NewEntry): Promise; /** * Delete an existing entry from the library. * @param entryId - The unique identifier of the entry to delete. * @throws {EntryNotFoundError} If no entry exists with the given ID. */ deleteEntry(entryId: EntryId): Promise; /** * Update an existing entry in the library. * @param entryId - The unique identifier of the entry to update. * @param updates - An object containing the fields to update and their new values. * @returns A promise that resolves to the updated entry's metadata. * @throws {EntryNotFoundError} If no entry exists with the given ID. * @throws {InvalidCommandError} If the update data is invalid or would result in an invalid entry. */ updateEntry(entryId: EntryId, updates: Partial>): Promise; } export default VaultOperationsManager;