@ -178,15 +178,15 @@ class BNote extends AbstractBeccaEntity<BNote> {
}
/ * *
* Returns < i > strong < / i > ( as opposed to < i > weak < / i > ) parent branches . See isWeak for details .
* /
* Returns < i > strong < / i > ( as opposed to < i > weak < / i > ) parent branches . See isWeak for details .
* /
getStrongParentBranches() {
return this . getParentBranches ( ) . filter ( branch = > ! branch . isWeak ) ;
}
/ * *
* @deprecated use getParentBranches ( ) instead
* /
* @deprecated use getParentBranches ( ) instead
* /
getBranches() {
return this . parentBranches ;
}
@ -209,20 +209,20 @@ class BNote extends AbstractBeccaEntity<BNote> {
}
/ * *
* Note content has quite special handling - it ' s not a separate entity , but a lazily loaded
* part of Note entity with its own sync . Reasons behind this hybrid design has been :
*
* - content can be quite large , and it 's not necessary to load it / fill memory for any note access even if we don' t need a content , especially for bulk operations like search
* - changes in the note metadata or title should not trigger note content sync ( so we keep separate utcDateModified and entity changes records )
* - but to the user note content and title changes are one and the same - single dateModified ( so all changes must go through Note and content is not a separate entity )
* /
* Note content has quite special handling - it ' s not a separate entity , but a lazily loaded
* part of Note entity with its own sync . Reasons behind this hybrid design has been :
*
* - content can be quite large , and it 's not necessary to load it / fill memory for any note access even if we don' t need a content , especially for bulk operations like search
* - changes in the note metadata or title should not trigger note content sync ( so we keep separate utcDateModified and entity changes records )
* - but to the user note content and title changes are one and the same - single dateModified ( so all changes must go through Note and content is not a separate entity )
* /
getContent() {
return this . _getContent ( ) ;
}
/ * *
* @throws Error in case of invalid JSON
* /
* @throws Error in case of invalid JSON
* /
getJsonContent ( ) : any | null {
const content = this . getContent ( ) ;
@ -327,13 +327,13 @@ class BNote extends AbstractBeccaEntity<BNote> {
}
/ * *
* Beware that the method must not create a copy of the array , but actually returns its internal array
* ( for performance reasons )
*
* @param type - ( optional ) attribute type to filter
* @param name - ( optional ) attribute name to filter
* @returns all note ' s attributes , including inherited ones
* /
* Beware that the method must not create a copy of the array , but actually returns its internal array
* ( for performance reasons )
*
* @param type - ( optional ) attribute type to filter
* @param name - ( optional ) attribute name to filter
* @returns all note ' s attributes , including inherited ones
* /
getAttributes ( type ? : string , name? : string ) : BAttribute [ ] {
this . __validateTypeName ( type , name ) ;
this . __ensureAttributeCacheIsAvailable ( ) ;
@ -468,18 +468,18 @@ class BNote extends AbstractBeccaEntity<BNote> {
}
/ * *
* @param name - label name
* @param value - label value
* @returns true if label exists ( including inherited )
* /
* @param name - label name
* @param value - label value
* @returns true if label exists ( including inherited )
* /
hasLabel ( name : string , value? : string ) : boolean {
return this . hasAttribute ( LABEL , name , value ) ;
}
/ * *
* @param name - label name
* @returns true if label exists ( including inherited ) and does not have "false" value .
* /
* @param name - label name
* @returns true if label exists ( including inherited ) and does not have "false" value .
* /
isLabelTruthy ( name : string ) : boolean {
const label = this . getLabel ( name ) ;
@ -491,112 +491,112 @@ class BNote extends AbstractBeccaEntity<BNote> {
}
/ * *
* @param name - label name
* @param value - label value
* @returns true if label exists ( excluding inherited )
* /
* @param name - label name
* @param value - label value
* @returns true if label exists ( excluding inherited )
* /
hasOwnedLabel ( name : string , value? : string ) : boolean {
return this . hasOwnedAttribute ( LABEL , name , value ) ;
}
/ * *
* @param name - relation name
* @param value - relation value
* @returns true if relation exists ( including inherited )
* /
* @param name - relation name
* @param value - relation value
* @returns true if relation exists ( including inherited )
* /
hasRelation ( name : string , value? : string ) : boolean {
return this . hasAttribute ( RELATION , name , value ) ;
}
/ * *
* @param name - relation name
* @param value - relation value
* @returns true if relation exists ( excluding inherited )
* /
* @param name - relation name
* @param value - relation value
* @returns true if relation exists ( excluding inherited )
* /
hasOwnedRelation ( name : string , value? : string ) : boolean {
return this . hasOwnedAttribute ( RELATION , name , value ) ;
}
/ * *
* @param name - label name
* @returns label if it exists , null otherwise
* /
* @param name - label name
* @returns label if it exists , null otherwise
* /
getLabel ( name : string ) : BAttribute | null {
return this . getAttribute ( LABEL , name ) ;
}
/ * *
* @param name - label name
* @returns label if it exists , null otherwise
* /
* @param name - label name
* @returns label if it exists , null otherwise
* /
getOwnedLabel ( name : string ) : BAttribute | null {
return this . getOwnedAttribute ( LABEL , name ) ;
}
/ * *
* @param name - relation name
* @returns relation if it exists , null otherwise
* /
* @param name - relation name
* @returns relation if it exists , null otherwise
* /
getRelation ( name : string ) : BAttribute | null {
return this . getAttribute ( RELATION , name ) ;
}
/ * *
* @param name - relation name
* @returns relation if it exists , null otherwise
* /
* @param name - relation name
* @returns relation if it exists , null otherwise
* /
getOwnedRelation ( name : string ) : BAttribute | null {
return this . getOwnedAttribute ( RELATION , name ) ;
}
/ * *
* @param name - label name
* @returns label value if label exists , null otherwise
* /
* @param name - label name
* @returns label value if label exists , null otherwise
* /
getLabelValue ( name : string ) : string | null {
return this . getAttributeValue ( LABEL , name ) ;
}
/ * *
* @param name - label name
* @returns label value if label exists , null otherwise
* /
* @param name - label name
* @returns label value if label exists , null otherwise
* /
getOwnedLabelValue ( name : string ) : string | null {
return this . getOwnedAttributeValue ( LABEL , name ) ;
}
/ * *
* @param name - relation name
* @returns relation value if relation exists , null otherwise
* /
* @param name - relation name
* @returns relation value if relation exists , null otherwise
* /
getRelationValue ( name : string ) : string | null {
return this . getAttributeValue ( RELATION , name ) ;
}
/ * *
* @param name - relation name
* @returns relation value if relation exists , null otherwise
* /
* @param name - relation name
* @returns relation value if relation exists , null otherwise
* /
getOwnedRelationValue ( name : string ) : string | null {
return this . getOwnedAttributeValue ( RELATION , name ) ;
}
/ * *
* @param attribute type ( label , relation , etc . )
* @param name - attribute name
* @param value - attribute value
* @returns true if note has an attribute with given type and name ( excluding inherited )
* /
* @param attribute type ( label , relation , etc . )
* @param name - attribute name
* @param value - attribute value
* @returns true if note has an attribute with given type and name ( excluding inherited )
* /
hasOwnedAttribute ( type : string , name : string , value? : string ) : boolean {
return ! ! this . getOwnedAttribute ( type , name , value ) ;
}
/ * *
* @param type - attribute type ( label , relation , etc . )
* @param name - attribute name
* @returns attribute of the given type and name . If there are more such attributes , first is returned .
* Returns null if there ' s no such attribute belonging to this note .
* /
* @param type - attribute type ( label , relation , etc . )
* @param name - attribute name
* @returns attribute of the given type and name . If there are more such attributes , first is returned .
* Returns null if there ' s no such attribute belonging to this note .
* /
getAttribute ( type : string , name : string ) : BAttribute | null {
const attributes = this . getAttributes ( ) ;
@ -604,10 +604,10 @@ class BNote extends AbstractBeccaEntity<BNote> {
}
/ * *
* @param type - attribute type ( label , relation , etc . )
* @param name - attribute name
* @returns attribute value of given type and name or null if no such attribute exists .
* /
* @param type - attribute type ( label , relation , etc . )
* @param name - attribute name
* @returns attribute value of given type and name or null if no such attribute exists .
* /
getAttributeValue ( type : string , name : string ) : string | null {
const attr = this . getAttribute ( type , name ) ;
@ -615,10 +615,10 @@ class BNote extends AbstractBeccaEntity<BNote> {
}
/ * *
* @param type - attribute type ( label , relation , etc . )
* @param name - attribute name
* @returns attribute value of given type and name or null if no such attribute exists .
* /
* @param type - attribute type ( label , relation , etc . )
* @param name - attribute name
* @returns attribute value of given type and name or null if no such attribute exists .
* /
getOwnedAttributeValue ( type : string , name : string ) : string | null {
const attr = this . getOwnedAttribute ( type , name ) ;
@ -626,62 +626,62 @@ class BNote extends AbstractBeccaEntity<BNote> {
}
/ * *
* @param name - label name to filter
* @returns all note ' s labels ( attributes with type label ) , including inherited ones
* /
* @param name - label name to filter
* @returns all note ' s labels ( attributes with type label ) , including inherited ones
* /
getLabels ( name? : string ) : BAttribute [ ] {
return this . getAttributes ( LABEL , name ) ;
}
/ * *
* @param name - label name to filter
* @returns all note ' s label values , including inherited ones
* /
* @param name - label name to filter
* @returns all note ' s label values , including inherited ones
* /
getLabelValues ( name : string ) : string [ ] {
return this . getLabels ( name ) . map ( l = > l . value ) ;
}
/ * *
* @param name - label name to filter
* @returns all note ' s labels ( attributes with type label ) , excluding inherited ones
* /
* @param name - label name to filter
* @returns all note ' s labels ( attributes with type label ) , excluding inherited ones
* /
getOwnedLabels ( name : string ) : BAttribute [ ] {
return this . getOwnedAttributes ( LABEL , name ) ;
}
/ * *
* @param name - label name to filter
* @returns all note ' s label values , excluding inherited ones
* /
* @param name - label name to filter
* @returns all note ' s label values , excluding inherited ones
* /
getOwnedLabelValues ( name : string ) : string [ ] {
return this . getOwnedAttributes ( LABEL , name ) . map ( l = > l . value ) ;
}
/ * *
* @param name - relation name to filter
* @returns all note ' s relations ( attributes with type relation ) , including inherited ones
* /
* @param name - relation name to filter
* @returns all note ' s relations ( attributes with type relation ) , including inherited ones
* /
getRelations ( name? : string ) : BAttribute [ ] {
return this . getAttributes ( RELATION , name ) ;
}
/ * *
* @param name - relation name to filter
* @returns all note ' s relations ( attributes with type relation ) , excluding inherited ones
* /
* @param name - relation name to filter
* @returns all note ' s relations ( attributes with type relation ) , excluding inherited ones
* /
getOwnedRelations ( name? : string | null ) : BAttribute [ ] {
return this . getOwnedAttributes ( RELATION , name ) ;
}
/ * *
* Beware that the method must not create a copy of the array , but actually returns its internal array
* ( for performance reasons )
*
* @param type - ( optional ) attribute type to filter
* @param name - ( optional ) attribute name to filter
* @param value - ( optional ) attribute value to filter
* @returns note ' s "owned" attributes - excluding inherited ones
* /
* Beware that the method must not create a copy of the array , but actually returns its internal array
* ( for performance reasons )
*
* @param type - ( optional ) attribute type to filter
* @param name - ( optional ) attribute name to filter
* @param value - ( optional ) attribute value to filter
* @returns note ' s "owned" attributes - excluding inherited ones
* /
getOwnedAttributes ( type : string | null = null , name : string | null = null , value : string | null = null ) {
this . __validateTypeName ( type , name ) ;
@ -703,10 +703,10 @@ class BNote extends AbstractBeccaEntity<BNote> {
}
/ * *
* @returns attribute belonging to this specific note ( excludes inherited attributes )
*
* This method can be significantly faster than the getAttribute ( )
* /
* @returns attribute belonging to this specific note ( excludes inherited attributes )
*
* This method can be significantly faster than the getAttribute ( )
* /
getOwnedAttribute ( type : string , name : string , value : string | null = null ) {
const attrs = this . getOwnedAttributes ( type , name , value ) ;
@ -776,12 +776,12 @@ class BNote extends AbstractBeccaEntity<BNote> {
}
/ * *
* This is used for :
* - fast searching
* - note similarity evaluation
*
* @returns - returns flattened textual representation of note , prefixes and attributes
* /
* This is used for :
* - fast searching
* - note similarity evaluation
*
* @returns - returns flattened textual representation of note , prefixes and attributes
* /
getFlatText() {
if ( ! this . __flatTextCache ) {
this . __flatTextCache = ` ${ this . noteId } ${ this . type } ${ this . mime } ` ;
@ -1077,7 +1077,7 @@ class BNote extends AbstractBeccaEntity<BNote> {
}
/ * * @ r e t u r n s r e t u r n s o n l y n o t e s w h i c h a r e t e m p l a t e d , d o e s n o t i n c l u d e t h e i r s u b t r e e s
* in effect returns notes which are influenced by note ' s non - inheritable attributes * /
* in effect returns notes which are influenced by note ' s non - inheritable attributes * /
getInheritingNotes ( ) : BNote [ ] {
const arr : BNote [ ] = [ this ] ;
@ -1120,10 +1120,10 @@ class BNote extends AbstractBeccaEntity<BNote> {
const query = opts . includeContentLength
? ` SELECT attachments.*, LENGTH(blobs.content) AS contentLength
FROM attachments
JOIN blobs USING ( blobId )
WHERE ownerId = ? AND isDeleted = 0
ORDER BY position `
FROM attachments
JOIN blobs USING ( blobId )
WHERE ownerId = ? AND isDeleted = 0
ORDER BY position `
: ` SELECT * FROM attachments WHERE ownerId = ? AND isDeleted = 0 ORDER BY position ` ;
return sql . getRows < AttachmentRow > ( query , [ this . noteId ] )
@ -1135,9 +1135,9 @@ class BNote extends AbstractBeccaEntity<BNote> {
const query = opts . includeContentLength
? ` SELECT attachments.*, LENGTH(blobs.content) AS contentLength
FROM attachments
JOIN blobs USING ( blobId )
WHERE ownerId = ? AND attachmentId = ? AND isDeleted = 0 `
FROM attachments
JOIN blobs USING ( blobId )
WHERE ownerId = ? AND attachmentId = ? AND isDeleted = 0 `
: ` SELECT * FROM attachments WHERE ownerId = ? AND attachmentId = ? AND isDeleted = 0 ` ;
return sql . getRows < AttachmentRow > ( query , [ this . noteId , attachmentId ] )
@ -1147,10 +1147,10 @@ class BNote extends AbstractBeccaEntity<BNote> {
getAttachmentsByRole ( role : string ) : BAttachment [ ] {
return sql . getRows < AttachmentRow > ( `
SELECT attachments . *
FROM attachments
WHERE ownerId = ?
AND role = ?
AND isDeleted = 0
FROM attachments
WHERE ownerId = ?
AND role = ?
AND isDeleted = 0
ORDER BY position ` , [this.noteId, role])
. map ( row = > new BAttachment ( row ) ) ;
}
@ -1161,10 +1161,10 @@ class BNote extends AbstractBeccaEntity<BNote> {
}
/ * *
* Gives all possible note paths leading to this note . Paths containing search note are ignored ( could form cycles )
*
* @returns array of notePaths ( each represented by array of noteIds constituting the particular note path )
* /
* Gives all possible note paths leading to this note . Paths containing search note are ignored ( could form cycles )
*
* @returns array of notePaths ( each represented by array of noteIds constituting the particular note path )
* /
getAllNotePaths ( ) : string [ ] [ ] {
if ( this . noteId === 'root' ) {
return [ [ 'root' ] ] ;
@ -1209,19 +1209,19 @@ class BNote extends AbstractBeccaEntity<BNote> {
}
/ * *
* Returns a note path considered to be the "best"
*
* @return array of noteIds constituting the particular note path
* /
* Returns a note path considered to be the "best"
*
* @return array of noteIds constituting the particular note path
* /
getBestNotePath ( hoistedNoteId : string = 'root' ) : string [ ] {
return this . getSortedNotePathRecords ( hoistedNoteId ) [ 0 ] ? . notePath ;
}
/ * *
* Returns a note path considered to be the "best"
*
* @return serialized note path ( e . g . 'root/a1h315/js725h' )
* /
* Returns a note path considered to be the "best"
*
* @return serialized note path ( e . g . 'root/a1h315/js725h' )
* /
getBestNotePathString ( hoistedNoteId : string = 'root' ) : string {
const notePath = this . getBestNotePath ( hoistedNoteId ) ;
@ -1229,8 +1229,8 @@ class BNote extends AbstractBeccaEntity<BNote> {
}
/ * *
* @return boolean - true if there ' s no non - hidden path , note is not cloned to the visible tree
* /
* @return boolean - true if there ' s no non - hidden path , note is not cloned to the visible tree
* /
isHiddenCompletely() {
if ( this . noteId === 'root' ) {
return false ;
@ -1250,8 +1250,8 @@ class BNote extends AbstractBeccaEntity<BNote> {
}
/ * *
* @returns true if ancestorNoteId occurs in at least one of the note ' s paths
* /
* @returns true if ancestorNoteId occurs in at least one of the note ' s paths
* /
isDescendantOfNote ( ancestorNoteId : string ) : boolean {
const notePaths = this . getAllNotePaths ( ) ;
@ -1259,12 +1259,12 @@ class BNote extends AbstractBeccaEntity<BNote> {
}
/ * *
* Update 's given attribute' s value or creates it if it doesn ' t exist
*
* @param type - attribute type ( label , relation , etc . )
* @param name - attribute name
* @param value - attribute value ( optional )
* /
* Update 's given attribute' s value or creates it if it doesn ' t exist
*
* @param type - attribute type ( label , relation , etc . )
* @param name - attribute name
* @param value - attribute value ( optional )
* /
setAttribute ( type : AttributeType , name : string , value? : string ) {
const attributes = this . getOwnedAttributes ( ) ;
const attr = attributes . find ( attr = > attr . type === type && attr . name === name ) ;
@ -1288,12 +1288,12 @@ class BNote extends AbstractBeccaEntity<BNote> {
}
/ * *
* Removes given attribute name - value pair if it exists .
*
* @param type - attribute type ( label , relation , etc . )
* @param name - attribute name
* @param value - attribute value ( optional )
* /
* Removes given attribute name - value pair if it exists .
*
* @param type - attribute type ( label , relation , etc . )
* @param name - attribute name
* @param value - attribute value ( optional )
* /
removeAttribute ( type : string , name : string , value? : string ) {
const attributes = this . getOwnedAttributes ( ) ;
@ -1305,13 +1305,13 @@ class BNote extends AbstractBeccaEntity<BNote> {
}
/ * *
* Adds a new attribute to this note . The attribute is saved and returned .
* See addLabel , addRelation for more specific methods .
*
* @param type - attribute type ( label / relation )
* @param name - name of the attribute , not including the leading ~ / #
* @param value - value of the attribute - text for labels , target note ID for relations ; optional .
* /
* Adds a new attribute to this note . The attribute is saved and returned .
* See addLabel , addRelation for more specific methods .
*
* @param type - attribute type ( label / relation )
* @param name - name of the attribute , not including the leading ~ / #
* @param value - value of the attribute - text for labels , target note ID for relations ; optional .
* /
addAttribute ( type : AttributeType , name : string , value : string = "" , isInheritable : boolean = false , position : number | null = null ) : BAttribute {
return new BAttribute ( {
noteId : this.noteId ,
@ -1324,33 +1324,33 @@ class BNote extends AbstractBeccaEntity<BNote> {
}
/ * *
* Adds a new label to this note . The label attribute is saved and returned .
*
* @param name - name of the label , not including the leading #
* @param value - text value of the label ; optional
* /
* Adds a new label to this note . The label attribute is saved and returned .
*
* @param name - name of the label , not including the leading #
* @param value - text value of the label ; optional
* /
addLabel ( name : string , value : string = "" , isInheritable : boolean = false ) : BAttribute {
return this . addAttribute ( LABEL , name , value , isInheritable ) ;
}
/ * *
* Adds a new relation to this note . The relation attribute is saved and
* returned .
*
* @param name - name of the relation , not including the leading ~
* /
* Adds a new relation to this note . The relation attribute is saved and
* returned .
*
* @param name - name of the relation , not including the leading ~
* /
addRelation ( name : string , targetNoteId : string , isInheritable : boolean = false ) : BAttribute {
return this . addAttribute ( RELATION , name , targetNoteId , isInheritable ) ;
}
/ * *
* Based on enabled , the attribute is either set or removed .
*
* @param type - attribute type ( 'relation' , 'label' etc . )
* @param enabled - toggle On or Off
* @param name - attribute name
* @param value - attribute value ( optional )
* /
* Based on enabled , the attribute is either set or removed .
*
* @param type - attribute type ( 'relation' , 'label' etc . )
* @param enabled - toggle On or Off
* @param name - attribute name
* @param value - attribute value ( optional )
* /
toggleAttribute ( type : AttributeType , enabled : boolean , name : string , value? : string ) {
if ( enabled ) {
this . setAttribute ( type , name , value ) ;
@ -1361,63 +1361,63 @@ class BNote extends AbstractBeccaEntity<BNote> {
}
/ * *
* Based on enabled , label is either set or removed .
*
* @param enabled - toggle On or Off
* @param name - label name
* @param value - label value ( optional )
* /
* Based on enabled , label is either set or removed .
*
* @param enabled - toggle On or Off
* @param name - label name
* @param value - label value ( optional )
* /
toggleLabel ( enabled : boolean , name : string , value? : string ) {
return this . toggleAttribute ( LABEL , enabled , name , value ) ;
}
/ * *
* Based on enabled , relation is either set or removed .
*
* @param enabled - toggle On or Off
* @param name - relation name
* @param value - relation value ( noteId )
* /
* Based on enabled , relation is either set or removed .
*
* @param enabled - toggle On or Off
* @param name - relation name
* @param value - relation value ( noteId )
* /
toggleRelation ( enabled : boolean , name : string , value? : string ) {
return this . toggleAttribute ( RELATION , enabled , name , value ) ;
}
/ * *
* Update 's given label' s value or creates it if it doesn ' t exist
*
* @param name - label name
* @param value label value
* /
* Update 's given label' s value or creates it if it doesn ' t exist
*
* @param name - label name
* @param value label value
* /
setLabel ( name : string , value? : string ) {
return this . setAttribute ( LABEL , name , value ) ;
}
/ * *
* Update 's given relation' s value or creates it if it doesn ' t exist
*
* @param name - relation name
* @param value - relation value ( noteId )
* /
* Update 's given relation' s value or creates it if it doesn ' t exist
*
* @param name - relation name
* @param value - relation value ( noteId )
* /
setRelation ( name : string , value? : string ) {
return this . setAttribute ( RELATION , name , value ) ;
}
/ * *
* Remove label name - value pair , if it exists .
*
* @param name - label name
* @param value - label value
* /
* Remove label name - value pair , if it exists .
*
* @param name - label name
* @param value - label value
* /
removeLabel ( name : string , value? : string ) {
return this . removeAttribute ( LABEL , name , value ) ;
}
/ * *
* Remove the relation name - value pair , if it exists .
*
* @param name - relation name
* @param value - relation value ( noteId )
* /
* Remove the relation name - value pair , if it exists .
*
* @param name - relation name
* @param value - relation value ( noteId )
* /
removeRelation ( name : string , value? : string ) {
return this . removeAttribute ( RELATION , name , value ) ;
}
@ -1468,20 +1468,20 @@ class BNote extends AbstractBeccaEntity<BNote> {
}
/ * *
* Some notes are eligible for conversion into an attachment of its parent , note must have these properties :
* - it has exactly one target relation
* - it has a relation from its parent note
* - it has no children
* - it has no clones
* - the parent is of type text
* - both notes are either unprotected or user is in protected session
*
* Currently , works only for image notes .
*
* In the future , this functionality might get more generic and some of the requirements relaxed .
*
* @returns null if note is not eligible for conversion
* /
* Some notes are eligible for conversion into an attachment of its parent , note must have these properties :
* - it has exactly one target relation
* - it has a relation from its parent note
* - it has no children
* - it has no clones
* - the parent is of type text
* - both notes are either unprotected or user is in protected session
*
* Currently , works only for image notes .
*
* In the future , this functionality might get more generic and some of the requirements relaxed .
*
* @returns null if note is not eligible for conversion
* /
convertToParentAttachment ( opts : ConvertOpts = { autoConversion : false } ) : BAttachment | null {
if ( ! this . isEligibleForConversionToAttachment ( opts ) ) {
return null ;
@ -1518,10 +1518,10 @@ class BNote extends AbstractBeccaEntity<BNote> {
}
/ * *
* ( Soft ) delete a note and all its descendants .
*
* @param deleteId - optional delete identified
* /
* ( Soft ) delete a note and all its descendants .
*
* @param deleteId - optional delete identified
* /
deleteNote ( deleteId : string | null = null , taskContext : TaskContext | null = null ) {
if ( this . isDeleted ) {
return ;
@ -1640,9 +1640,9 @@ class BNote extends AbstractBeccaEntity<BNote> {
}
/ * *
* @param matchBy - choose by which property we detect if to update an existing attachment .
* @param matchBy - choose by which property we detect if to update an existing attachment .
* Supported values are either 'attachmentId' ( default ) or 'title'
* /
* /
saveAttachment ( { attachmentId , role , mime , title , content , position } : AttachmentRow , matchBy = 'attachmentId' ) {
if ( ! [ 'attachmentId' , 'title' ] . includes ( matchBy ) ) {
throw new Error ( ` Unsupported value ' ${ matchBy } ' for matchBy param, has to be either 'attachmentId' or 'title'. ` ) ;