import { SNItemsKey } from '@standardnotes/encryption'; import { PayloadManager } from '../Payloads/PayloadManager'; import { UuidString } from '../../Types/UuidString'; import * as Models from '@standardnotes/models'; import * as Services from '@standardnotes/services'; import { ItemRelationshipDirection } from '@standardnotes/services'; /** * The item manager is backed by the payload manager. It listens for change events from the * global payload manager, and converts any payloads to items, then propagates those items to * listeners on the item manager. When the item manager makes a change to an item, it will modify * items using a mutator, then emit those payloads to the payload manager. The payload manager * will then notify its observers (which is us), we'll convert the payloads to items, * and then we'll propagate them to our listeners. */ export declare class ItemManager extends Services.AbstractService implements Services.ItemManagerInterface { private payloadManager; protected internalEventBus: Services.InternalEventBusInterface; private unsubChangeObserver; private observers; private collection; private systemSmartViews; private itemCounter; private streamDisposers; private navigationDisplayController; private tagDisplayController; private itemsKeyDisplayController; private componentDisplayController; private themeDisplayController; private fileDisplayController; private smartViewDisplayController; constructor(payloadManager: PayloadManager, internalEventBus: Services.InternalEventBusInterface); private rebuildSystemSmartViews; getCollection(): Models.ItemCollection; private createCollection; private get allDisplayControllers(); get invalidItems(): Models.EncryptedItemInterface[]; get invalidNonVaultedItems(): Models.EncryptedItemInterface[]; createItemFromPayload(payload: Models.DecryptedPayloadInterface): T; createPayloadFromObject(object: Models.DecryptedTransferPayload): Models.DecryptedPayloadInterface; setPrimaryItemDisplayOptions(options: Models.NotesAndFilesDisplayControllerOptions): void; setTagsAndViewsDisplayOptions(options: Models.TagsAndViewsDisplayOptions): void; setVaultDisplayOptions(options: Models.VaultDisplayOptions): void; getInteractableItems(): Models.DecryptedItemInterface[]; getDisplayableNotes(): Models.SNNote[]; getDisplayableFiles(): Models.FileItem[]; getDisplayableNotesAndFiles(): (Models.SNNote | Models.FileItem)[]; getDisplayableTags(): Models.SNTag[]; getDisplayableItemsKeys(): SNItemsKey[]; getDisplayableComponents(): Models.ComponentInterface[]; deinit(): void; resetState(): void; findItem(uuid: UuidString): T | undefined; findAnyItem(uuid: UuidString): Models.ItemInterface | undefined; findAnyItems(uuids: UuidString[]): Models.ItemInterface[]; private findSystemSmartView; findSureItem(uuid: UuidString): T; findItems(uuids: UuidString[]): T[]; findItemsIncludingBlanks(uuids: UuidString[]): (T | undefined)[]; get items(): Models.DecryptedItemInterface[]; /** Unlock .items, this function includes error decrypting items */ allTrackedItems(): Models.ItemInterface[]; hasTagsNeedingFoldersMigration(): boolean; addNoteCountChangeObserver(observer: Models.TagItemCountChangeObserver): () => void; allCountableNotesCount(): number; allCountableFilesCount(): number; countableNotesForTag(tag: Models.SNTag | Models.SmartView): number; getNoteCount(): number; addObserver(contentType: string | string[], callback: Services.ItemManagerChangeObserverCallback): () => void; /** * Returns the items that reference the given item, or an empty array if no results. */ itemsReferencingItem(itemToLookupUuidFor: { uuid: UuidString; }, contentType?: string): I[]; /** * Returns all items that an item directly references */ referencesForItem(itemToLookupUuidFor: Models.DecryptedItemInterface, contentType?: string): I[]; private setPayloads; private notifyObserversByUiAdjustingDelta; private notifyObservers; /** * Returns an array of items that need to be synced. */ getDirtyItems(): (Models.DecryptedItemInterface | Models.DeletedItemInterface)[]; createTemplateItem = Models.DecryptedItemInterface>(contentType: string, content?: C, override?: Partial>): I; /** * @param item item to be checked * @returns Whether the item is a template (unmanaged) */ isTemplateItem(item: Models.DecryptedItemInterface): boolean; getItems(contentType: string | string[]): T[]; getAnyItems(contentType: string | string[]): Models.ItemInterface[]; itemsMatchingPredicate(contentType: string, predicate: Models.PredicateInterface): T[]; itemsMatchingPredicates(contentType: string, predicates: Models.PredicateInterface[]): T[]; subItemsMatchingPredicates(items: T[], predicates: Models.PredicateInterface[]): T[]; getRootTags(): Models.SNTag[]; findTagByTitle(title: string): Models.SNTag | undefined; findTagByTitleAndParent(title: string, parentItemToLookupUuidFor?: Models.SNTag): Models.SNTag | undefined; /** * Finds tags with title or component starting with a search query and (optionally) not associated with a note * @param searchQuery - The query string to match * @param note - The note whose tags should be omitted from results * @returns Array containing tags matching search query and not associated with note */ searchTags(searchQuery: string, note?: Models.SNNote): Models.SNTag[]; getTagParent(itemToLookupUuidFor: Models.SNTag): Models.SNTag | undefined; getDisplayableTagParent(itemToLookupUuidFor: Models.SNTag): Models.SNTag | undefined; getTagPrefixTitle(tag: Models.SNTag): string | undefined; getTagLongTitle(tag: Models.SNTag): string; getTagParentChain(itemToLookupUuidFor: Models.SNTag): Models.SNTag[]; getTagChildren(itemToLookupUuidFor: Models.SNTag): Models.SNTag[]; getDeepTagChildren(itemToLookupUuidFor: Models.SNTag): Models.SNTag[]; isTagAncestor(tagToLookUpUuidFor: Models.SNTag, childToLookUpUuidFor: Models.SNTag): boolean; isValidTagParent(parentTagToLookUpUuidFor: Models.SNTag, childToLookUpUuidFor: Models.SNTag): boolean; /** * Get tags for a note sorted in natural order * @param item - The item whose tags will be returned * @returns Array containing tags associated with an item */ getSortedTagsForItem(item: Models.DecryptedItemInterface): Models.SNTag[]; getUnsortedTagsForItem(item: Models.DecryptedItemInterface): Models.SNTag[]; isSmartViewTitle(title: string): boolean; notesMatchingSmartView(view: Models.SmartView): Models.SNNote[]; get allNotesSmartView(): Models.SmartView; get archivedSmartView(): Models.SmartView; get trashSmartView(): Models.SmartView; get untaggedNotesSmartView(): Models.SmartView; get trashedItems(): Models.SNNote[]; /** * Returns all smart views, sorted by title. */ getSmartViews(): Models.SmartView[]; /** * The number of notes currently managed */ get noteCount(): number; /** * Immediately removes all items from mapping state and notifies observers * Used primarily when signing into an account and wanting to discard any current * local data. */ removeAllItemsFromMemory(): Promise; /** * Important: Caller must coordinate with storage service separately to delete item from persistent database. */ removeItemFromMemory(item: Models.AnyItemInterface): void; /** * Important: Caller must coordinate with storage service separately to delete item from persistent database. */ removeItemsFromMemory(items: Models.AnyItemInterface[]): void; relationshipDirectionBetweenItems(itemA: Models.DecryptedItemInterface, itemB: Models.DecryptedItemInterface): ItemRelationshipDirection; conflictsOf(uuid: string): Models.AnyItemInterface[]; numberOfNotesWithConflicts(): number; getItemLinkedFiles(item: Models.DecryptedItemInterface): Models.FileItem[]; getItemLinkedNotes(item: Models.DecryptedItemInterface): Models.SNNote[]; /** * Begin streaming items to display in the UI. The stream callback will be called * immediately with the present items that match the constraint, and over time whenever * items matching the constraint are added, changed, or deleted. */ streamItems(contentType: string | string[], stream: Models.ItemStream): () => void; }