Method
type Method = (this: Entry, ...args: any[]) => unknown;
A Function mounted as a JavaScript method on the Model class. Receives the entry instance as this.
Warning
Do not use Arrow Functions so that this correctly refers to the entry instance.
Methods
type Methods = { [key: string]: Method };
Specifies the JavaScript methods of the class Model. It is an Object where each key is the name of the method and the value is the method implementation.
special methods
These methods, when defined, are called by Sedentary at specific lifecycle events:
construct() — called after the entry is created (not for loaded entries). See Entries initialization.
preLoad() / postLoad() — before/after loading from the database
preSave() / postSave(savedRecords) — before/after saving
preRemove() / postRemove(deletedRecords) — before/after removing
preCommit(actions) / postCommit(actions) — before/after a transaction commits
All are optional and have empty default implementations in the base entry class.