Back to Trilium

Class default

docs/Script API/classes/Backend_Script_API._internal_.default.html

0.102.29.9 KB
Original Source

Class default

Becca is a backend cache of all notes, branches, and attributes. There's a similar frontend cache Froca, and share cache Shaca.

Index

Constructors

constructor

Properties

allNoteSetCacheattributeIndexattributesbrancheschildParentToBranchetapiTokensloadednotesoptions

Methods

addNotedecryptProtectedNotesdirtyNoteSetCachefindAttributesfindAttributesWithPrefixgetAllNoteSetgetAttachmentgetAttachmentOrThrowgetAttachmentsgetAttributegetAttributeOrThrowgetBlobgetBranchgetBranchFromChildAndParentgetBranchOrThrowgetEntitygetEtapiTokengetEtapiTokensgetNotegetNoteOrThrowgetNotesgetOptiongetRecentNotesFromQuerygetRevisiongetRevisionOrThrowgetRevisionsFromQuerygetRootreset

Constructors

constructor

new default(): default

Returns default

Properties

allNoteSetCache

allNoteSetCache: null | NoteSet

attributeIndex

attributeIndex: Record<string, BAttribute[]>

Points from attribute type-name to list of attributes

attributes

attributes: Record<string, BAttribute>

branches

branches: Record<string, BBranch>

childParentToBranch

childParentToBranch: Record<string, BBranch>

etapiTokens

etapiTokens: Record<string, BEtapiToken>

loaded

loaded: boolean

notes

notes: Record<string, BNote>

options

options: Record<string, BOption>

Methods

addNote

addNote(noteId: string, note: BNote): void

Parameters

  • noteId: string
  • note: BNote

Returns void

decryptProtectedNotes

decryptProtectedNotes(): void

Returns void

dirtyNoteSetCache

dirtyNoteSetCache(): void

Should be called when the set of all non-skeleton notes changes (added/removed)

Returns void

findAttributes

findAttributes(type: string, name: string): BAttribute[]

Parameters

  • type: string
  • name: string

Returns BAttribute[]

findAttributesWithPrefix

findAttributesWithPrefix(type: string, name: string): BAttribute[]

Parameters

  • type: string
  • name: string

Returns BAttribute[]

getAllNoteSet

getAllNoteSet(): NoteSet

Returns NoteSet

getAttachment

getAttachment(attachmentId: string, opts?: AttachmentOpts): null | BAttachment

Parameters

  • attachmentId: string
  • opts: AttachmentOpts = {}

Returns null | BAttachment

getAttachmentOrThrow

getAttachmentOrThrow(attachmentId: string, opts?: AttachmentOpts): BAttachment

Parameters

  • attachmentId: string
  • opts: AttachmentOpts = {}

Returns BAttachment

getAttachments

getAttachments(attachmentIds: string[]): BAttachment[]

Parameters

  • attachmentIds: string[]

Returns BAttachment[]

getAttribute

getAttribute(attributeId: string): null | BAttribute

Parameters

  • attributeId: string

Returns null | BAttribute

getAttributeOrThrow

getAttributeOrThrow(attributeId: string): BAttribute

Parameters

  • attributeId: string

Returns BAttribute

getBlob

getBlob(entity: { blobId?: string }): null | BBlob

Parameters

  • entity: { blobId?: string }

Returns null | BBlob

getBranch

getBranch(branchId: string): null | BBranch

Parameters

  • branchId: string

Returns null | BBranch

getBranchFromChildAndParent

getBranchFromChildAndParent(
childNoteId: string,
parentNoteId: string,
): null | BBranch

Parameters

  • childNoteId: string
  • parentNoteId: string

Returns null | BBranch

getBranchOrThrow

getBranchOrThrow(branchId: string): BBranch

Parameters

  • branchId: string

Returns BBranch

getEntity

getEntity<T extends AbstractBeccaEntity<T>>(
entityName: string,
entityId: string,
): null | AbstractBeccaEntity<T>

Type Parameters

Parameters

  • entityName: string
  • entityId: string

Returns null | AbstractBeccaEntity<T>

getEtapiToken

getEtapiToken(etapiTokenId: string): null | BEtapiToken

Parameters

  • etapiTokenId: string

Returns null | BEtapiToken

getEtapiTokens

getEtapiTokens(): BEtapiToken[]

Returns BEtapiToken[]

getNote

getNote(noteId: string): null | BNote

Parameters

  • noteId: string

Returns null | BNote

getNoteOrThrow

getNoteOrThrow(noteId: string): BNote

Parameters

  • noteId: string

Returns BNote

getNotes

getNotes(noteIds: string[], ignoreMissing?: boolean): BNote[]

Parameters

  • noteIds: string[]
  • ignoreMissing: boolean = false

Returns BNote[]

getOption

getOption(name: string): null | BOption

Parameters

  • name: string

Returns null | BOption

getRecentNotesFromQuery

getRecentNotesFromQuery(query: string, params?: string[]): BRecentNote[]

Parameters

  • query: string
  • params: string[] = []

Returns BRecentNote[]

getRevision

getRevision(revisionId: string): null | BRevision

Parameters

  • revisionId: string

Returns null | BRevision

getRevisionOrThrow

getRevisionOrThrow(revisionId: string): BRevision

Parameters

  • revisionId: string

Returns BRevision

getRevisionsFromQuery

getRevisionsFromQuery(query: string, params?: string[]): BRevision[]

Parameters

  • query: string
  • params: string[] = []

Returns BRevision[]

getRoot

getRoot(): null | BNote

Returns null | BNote

reset

reset(): void

Returns void

Settings

Member Visibility

  • Protected
  • Inherited
  • External

ThemeOSLightDark

On This Page

Constructors constructor Properties allNoteSetCacheattributeIndexattributesbrancheschildParentToBranchetapiTokensloadednotesoptions Methods addNotedecryptProtectedNotesdirtyNoteSetCachefindAttributesfindAttributesWithPrefixgetAllNoteSetgetAttachmentgetAttachmentOrThrowgetAttachmentsgetAttributegetAttributeOrThrowgetBlobgetBranchgetBranchFromChildAndParentgetBranchOrThrowgetEntitygetEtapiTokengetEtapiTokensgetNotegetNoteOrThrowgetNotesgetOptiongetRecentNotesFromQuerygetRevisiongetRevisionOrThrowgetRevisionsFromQuerygetRootreset