# Class default

Revision represents a snapshot of note's title and content at some point in the past. It's used for seamless note versioning.

#### Hierarchy (View Summary)

- default<default>
  - default

- Defined in becca/entities/brevision.ts:26

#####
Index

### Constructors

constructor

### Properties

blobId?
content?
contentLength?
dateCreated?
dateLastEdited?
dateModified?
isProtected?
isSynced?
mime
noteId
revisionId?
title
type
utcDateCreated
utcDateLastEdited?
utcDateModified?

### Accessors

becca
isDeleted
entityName
hashedProperties
primaryKeyName

### Methods

_getContent
_setContent
beforeSaving
eraseRevision
generateHash
getAttachmentById
getAttachmentByTitle
getAttachments
getAttachmentsByRole
getContent
getJsonContent
getJsonContentSafely
getNote
getPojo
getPojoToSave
getUtcDateChanged
hasStringContent
init
isContentAvailable
markAsDeleted
markAsDeletedSimple
putEntityChange
save
setContent
updateFromRow

##
Constructors

### constructor

- new default(row: RevisionRow, titleDecrypted?: boolean): default

- #### Parameters

  - row: RevisionRow
  - titleDecrypted: boolean = false

  #### Returns default

  Overrides default.constructor

  - Defined in becca/entities/brevision.ts:42

##
Properties

### `Optional` blobId

blobId?: string

Inherited from default.blobId

- Defined in becca/entities/abstract_becca_entity.ts:35

### `Optional` content

content?: string | Buffer<ArrayBufferLike>

- Defined in becca/entities/brevision.ts:40

### `Optional` contentLength

contentLength?: number

- Defined in becca/entities/brevision.ts:39

### `Optional` dateCreated

dateCreated?: string

Inherited from default.dateCreated

- Defined in becca/entities/abstract_becca_entity.ts:28

### `Optional` dateLastEdited

dateLastEdited?: string

- Defined in becca/entities/brevision.ts:37

### `Optional` dateModified

dateModified?: string

Inherited from default.dateModified

- Defined in becca/entities/abstract_becca_entity.ts:29

### `Optional` isProtected

isProtected?: boolean

Inherited from default.isProtected

- Defined in becca/entities/abstract_becca_entity.ts:33

### `Optional` isSynced

isSynced?: boolean

Inherited from default.isSynced

- Defined in becca/entities/abstract_becca_entity.ts:34

### mime

mime: string

- Defined in becca/entities/brevision.ts:35

### noteId

noteId: string

- Defined in becca/entities/brevision.ts:33

### `Optional` revisionId

revisionId?: string

- Defined in becca/entities/brevision.ts:32

### title

title: string

- Defined in becca/entities/brevision.ts:36

### type

type: string

- Defined in becca/entities/brevision.ts:34

### utcDateCreated

utcDateCreated: string

Inherited from default.utcDateCreated

- Defined in becca/entities/abstract_becca_entity.ts:31

### `Optional` utcDateLastEdited

utcDateLastEdited?: string

- Defined in becca/entities/brevision.ts:38

### `Optional` utcDateModified

utcDateModified?: string

Inherited from default.utcDateModified

- Defined in becca/entities/abstract_becca_entity.ts:27

##
Accessors

### `Protected` becca

- get becca(): Becca

- #### Returns Becca

  Inherited from AbstractBeccaEntity.becca

  - Defined in becca/entities/abstract_becca_entity.ts:48

### isDeleted

- get isDeleted(): boolean

- #### Returns boolean

  Inherited from AbstractBeccaEntity.isDeleted

  - Defined in becca/entities/abstract_becca_entity.ts:96

### `Static` entityName

- get entityName(): string

- #### Returns string

  - Defined in becca/entities/brevision.ts:27

### `Static` hashedProperties

- get hashedProperties(): string[]

- #### Returns string[]

  - Defined in becca/entities/brevision.ts:29

### `Static` primaryKeyName

- get primaryKeyName(): string

- #### Returns string

  - Defined in becca/entities/brevision.ts:28

##
Methods

### `Protected`_getContent

- _getContent(): string | Buffer<ArrayBufferLike>

- #### Returns string | Buffer<ArrayBufferLike>

  Inherited from default._getContent

  - Defined in becca/entities/abstract_becca_entity.ts:264

### `Protected`_setContent

- _setContent(content: string | Buffer<ArrayBufferLike>, opts?: ContentOpts): void

- #### Parameters

  - content: string | Buffer<ArrayBufferLike>
  - opts: ContentOpts = {}

  #### Returns void

  Inherited from default._setContent

  - Defined in becca/entities/abstract_becca_entity.ts:141

### beforeSaving

- beforeSaving(): void

- #### Returns void

  Overrides default.beforeSaving

  - Defined in becca/entities/brevision.ts:169

### eraseRevision

- eraseRevision(): void

- Revisions are not soft-deletable, they are immediately hard-deleted (erased).

  #### Returns void

  - Defined in becca/entities/brevision.ts:163

### generateHash

- generateHash(isDeleted?: boolean): string

- #### Parameters

  - `Optional` isDeleted: boolean

  #### Returns string

  Inherited from default.generateHash

  - Defined in becca/entities/abstract_becca_entity.ts:64

### getAttachmentById

- getAttachmentById(attachmentId: String, opts?: GetByIdOpts): null | default

- #### Parameters

  - attachmentId: String
  - opts: GetByIdOpts = {}

  #### Returns null | default

  - Defined in becca/entities/brevision.ts:130

### getAttachmentByTitle

- getAttachmentByTitle(title: string): default

- #### Parameters

  - title: string

  #### Returns default

  - Defined in becca/entities/brevision.ts:155

### getAttachments

- getAttachments(): default[]

- #### Returns default[]

  - Defined in becca/entities/brevision.ts:121

### getAttachmentsByRole

- getAttachmentsByRole(role: string): default[]

- #### Parameters

  - role: string

  #### Returns default[]

  - Defined in becca/entities/brevision.ts:144

### getContent

- getContent(): string | Buffer<ArrayBufferLike>

- #### Returns string | Buffer<ArrayBufferLike>

  - Defined in becca/entities/brevision.ts:91

### getJsonContent

- getJsonContent(): null | {}

- #### Returns null | {}

  #### Throws

  Error in case of invalid JSON

  - Defined in becca/entities/brevision.ts:97

### getJsonContentSafely

- getJsonContentSafely(): null | {}

- #### Returns null | {}

  valid object or null if the content cannot be parsed as JSON

  - Defined in becca/entities/brevision.ts:108

### getNote

- getNote(): default

- #### Returns default

  - Defined in becca/entities/brevision.ts:68

### getPojo

- getPojo(): {
  blobId: undefined
  | string;
  content: undefined | string | Buffer<ArrayBufferLike>;
  contentLength: undefined | number;
  dateCreated: undefined | string;
  dateLastEdited: undefined | string;
  isProtected: undefined | boolean;
  mime: string;
  noteId: string;
  revisionId: undefined | string;
  title: undefined | string;
  type: string;
  utcDateCreated: string;
  utcDateLastEdited: undefined | string;
  utcDateModified: undefined | string;
  }

- #### Returns {
  blobId: undefined | string;
  content: undefined | string | Buffer<ArrayBufferLike>;
  contentLength: undefined | number;
  dateCreated: undefined | string;
  dateLastEdited: undefined | string;
  isProtected: undefined | boolean;
  mime: string;
  noteId: string;
  revisionId: undefined | string;
  title: undefined | string;
  type: string;
  utcDateCreated: string;
  utcDateLastEdited: undefined | string;
  utcDateModified: undefined | string;
  }

  Overrides default.getPojo

  - Defined in becca/entities/brevision.ts:175

### getPojoToSave

- getPojoToSave(): {
  blobId: undefined
  | string;
  content: undefined | string | Buffer<ArrayBufferLike>;
  contentLength: undefined | number;
  dateCreated: undefined | string;
  dateLastEdited: undefined | string;
  isProtected: undefined | boolean;
  mime: string;
  noteId: string;
  revisionId: undefined | string;
  title: undefined | string;
  type: string;
  utcDateCreated: string;
  utcDateLastEdited: undefined | string;
  utcDateModified: undefined | string;
  }

- #### Returns {
  blobId: undefined | string;
  content: undefined | string | Buffer<ArrayBufferLike>;
  contentLength: undefined | number;
  dateCreated: undefined | string;
  dateLastEdited: undefined | string;
  isProtected: undefined | boolean;
  mime: string;
  noteId: string;
  revisionId: undefined | string;
  title: undefined | string;
  type: string;
  utcDateCreated: string;
  utcDateLastEdited: undefined | string;
  utcDateModified: undefined | string;
  }

  Overrides default.getPojoToSave

  - Defined in becca/entities/brevision.ts:194

### getUtcDateChanged

- getUtcDateChanged(): string

- #### Returns string

  Inherited from default.getUtcDateChanged

  - Defined in becca/entities/abstract_becca_entity.ts:44

### hasStringContent

- hasStringContent(): boolean

- #### Returns boolean

  true if the note has string content (not binary)

  Overrides default.hasStringContent

  - Defined in becca/entities/brevision.ts:73

### init

- init(): void

- #### Returns void

  Inherited from default.init

  - Defined in becca/entities/abstract_becca_entity.ts:90

### isContentAvailable

- isContentAvailable(): boolean

- #### Returns boolean

  - Defined in becca/entities/brevision.ts:77

### markAsDeleted

- markAsDeleted(deleteId?: null | string): void

- Mark the entity as (soft) deleted. It will be completely erased later.

  This is a low-level method, for notes and branches use `note.deleteNote()` and 'branch.deleteBranch()` instead.

  #### Parameters

  - deleteId: null | string = null

  #### Returns void

  Inherited from default.markAsDeleted

  - Defined in becca/entities/abstract_becca_entity.ts:280

### markAsDeletedSimple

- markAsDeletedSimple(): void

- #### Returns void

  Inherited from default.markAsDeletedSimple

  - Defined in becca/entities/abstract_becca_entity.ts:305

### `Protected` putEntityChange

- putEntityChange(isDeleted: boolean): void

- #### Parameters

  - isDeleted: boolean

  #### Returns void

  Inherited from default.putEntityChange

  - Defined in becca/entities/abstract_becca_entity.ts:52

### save

- save(opts?: {}): this

- Saves entity - executes SQL, but doesn't commit the transaction on its own

  #### Parameters

  - `Optional` opts: {}

  #### Returns this

  Inherited from default.save

  - Defined in becca/entities/abstract_becca_entity.ts:104

### setContent

- setContent(content: string | Buffer<ArrayBufferLike>, opts?: ContentOpts): void

- #### Parameters

  - content: string | Buffer<ArrayBufferLike>
  - opts: ContentOpts = {}

  #### Returns void

  - Defined in becca/entities/brevision.ts:117

### updateFromRow

- updateFromRow(row: RevisionRow): void

- #### Parameters

  - row: RevisionRow

  #### Returns void

  Overrides default.updateFromRow

  - Defined in becca/entities/brevision.ts:52