Group
This class defines a Group of [[Accounts]].
Accounts can be grouped by different meaning, like Expenses, Revenue, Assets, Liabilities and so on
Its useful to keep organized and for high level analysis.
Extends
ResourceProperty<bkper.Group>
Constructors
Constructor
new Group(book, payload?): Group;Parameters
| Parameter | Type |
|---|---|
book | Book |
payload? | Group |
Returns
Group
Overrides
ResourceProperty<bkper.Group>.constructorProperties
payload
payload: Group;The underlying payload data for this resource
Inherited from
ResourceProperty.payloadMethods
create()
create(): Promise<Group>;Performs create new group.
Returns
Promise<Group>
A promise that resolves to this Group
deleteProperty()
deleteProperty(key): this;Deletes a custom property.
Parameters
| Parameter | Type | Description |
|---|---|---|
key | string | The property key |
Returns
this
This resource, for chaining
Inherited from
ResourceProperty.deletePropertygetAccounts()
getAccounts(): Promise<Account[]>;Gets all Accounts of this group.
Returns
Promise<Account[]>
All Accounts of this group
getChildren()
getChildren(): Group[];Gets the children of the Group.
Returns
Group[]
An array of child Groups
getDepth()
getDepth(): number;Gets the depth of the Group in the hierarchy.
Returns
number
The depth of the Group
getDescendants()
getDescendants(): Set<Group>;Gets all descendant Groups of the current Group.
Returns
Set<Group>
A set of descendant Groups
getDescendantTreeIds()
getDescendantTreeIds(): Set<string>;Gets the IDs of all descendant Groups in a tree structure.
Returns
Set<string>
A set of descendant Group IDs
getId()
getId(): string | undefined;Gets the id of this Group.
Returns
string | undefined
The id of this Group
getName()
getName(): string | undefined;Gets the name of this Group.
Returns
string | undefined
The name of this Group
getNormalizedName()
getNormalizedName(): string;Gets the normalized name of this group without spaces and special characters.
Returns
string
The name of this group without spaces and special characters
getParent()
getParent(): Group | undefined;Gets the parent Group.
Returns
Group | undefined
The parent Group
getProperties()
getProperties(): object;Gets the custom properties stored in this resource.
Returns
object
Object with key/value pair properties
Inherited from
ResourceProperty.getPropertiesgetProperty()
getProperty(...keys): string | undefined;Gets the property value for given keys. First property found will be retrieved.
Parameters
| Parameter | Type | Description |
|---|---|---|
…keys | string[] | The property keys to search for |
Returns
string | undefined
The property value or undefined if not found
Inherited from
ResourceProperty.getPropertygetPropertyKeys()
getPropertyKeys(): string[];Gets the custom properties keys stored in this resource.
Returns
string[]
Array of property keys sorted alphabetically
Inherited from
ResourceProperty.getPropertyKeysgetRoot()
getRoot(): Group;Gets the root Group of the current Group.
Returns
Group
The root Group
getRootName()
getRootName(): string;Gets the name of the root Group.
Returns
string
The name of the root Group
getType()
getType(): AccountType;Gets the type of the accounts of this group.
Returns
The type for of the accounts of this group. Null if mixed
getVisibleProperties()
getVisibleProperties(): object;Gets the visible custom properties stored in this resource. Hidden properties (those ending with ”_”) are excluded from the result.
Returns
object
Object with key/value pair properties, excluding hidden properties
Inherited from
ResourceProperty.getVisiblePropertieshasAccounts()
hasAccounts(): boolean | undefined;Tells if this group has any account in it.
Returns
boolean | undefined
True if this group has any account in it
hasChildren()
hasChildren(): boolean;Checks if the Group has any children.
Returns
boolean
True if the Group has children, otherwise false
hasParent()
hasParent(): boolean;Checks if the Group has a parent.
Returns
boolean
True if the Group has a parent, otherwise false
isBalanceVerified()
isBalanceVerified(): Promise<boolean | undefined>;Tells if the balance of this Group has been verified/audited.
Returns
Promise<boolean | undefined>
True if the balance of this Group has been verified/audited
isCredit()
isCredit(): boolean | undefined;Tells if this is a credit (Incoming and Liabilities) group.
Returns
boolean | undefined
True if this is a credit group
isHidden()
isHidden(): boolean | undefined;Tells if the Group is hidden on main transactions menu.
Returns
boolean | undefined
True if the Group is hidden, false otherwise
isLeaf()
isLeaf(): boolean;Checks if the Group is a leaf node (i.e., has no children).
Returns
boolean
True if the Group is a leaf, otherwise false
isLocked()
isLocked(): boolean;Tells if the Group is locked by the Book owner.
Returns
boolean
True if the Group is locked
isMixed()
isMixed(): boolean | undefined;Tells if this is a mixed (Assets/Liabilities or Incoming/Outgoing) group.
Returns
boolean | undefined
True if this is a mixed group
isPermanent()
isPermanent(): boolean | undefined;Tells if the Group is permanent.
Returns
boolean | undefined
True if the Group is permanent
isRoot()
isRoot(): boolean;Checks if the Group is a root node (i.e., has no parent).
Returns
boolean
True if the Group is a root, otherwise false
json()
json(): Group;Gets an immutable copy of the JSON payload for this resource.
Returns
Group
An immutable copy of the json payload
Inherited from
ResourceProperty.jsonremove()
remove(): Promise<Group>;Performs delete group.
Returns
Promise<Group>
A promise that resolves to this Group
setHidden()
setHidden(hidden): Group;Hide/Show group on main menu.
Parameters
| Parameter | Type | Description |
|---|---|---|
hidden | boolean | Whether to hide the group |
Returns
Group
This Group, for chaining
setLocked()
setLocked(locked): Group;Sets the locked state of the Group.
Parameters
| Parameter | Type | Description |
|---|---|---|
locked | boolean | The locked state of the Group. |
Returns
Group
This Group, for chaining
setName()
setName(name): Group;Sets the name of the Group.
Parameters
| Parameter | Type | Description |
|---|---|---|
name | string | The name to set |
Returns
Group
This Group, for chaining
setParent()
setParent(group): Group;Sets the parent Group.
Parameters
| Parameter | Type | Description |
|---|---|---|
group | Group | null | undefined | The parent Group to set |
Returns
Group
This Group, for chaining
setProperties()
setProperties(properties): this;Sets the custom properties of this resource.
Parameters
| Parameter | Type | Description |
|---|---|---|
properties | { [key: string]: string; } | Object with key/value pair properties |
Returns
this
This resource, for chaining
Inherited from
ResourceProperty.setPropertiessetProperty()
setProperty(key, value): this;Sets a custom property in this resource.
Parameters
| Parameter | Type | Description |
|---|---|---|
key | string | The property key |
value | string | null | undefined | The property value, or null/undefined to clean it |
Returns
this
This resource, for chaining
Inherited from
ResourceProperty.setPropertysetVisibleProperties()
setVisibleProperties(properties): this;Sets the custom properties of this resource, filtering out hidden properties. Hidden properties are those whose keys end with an underscore ”_”.
Parameters
| Parameter | Type | Description |
|---|---|---|
properties | { [key: string]: string; } | Object with key/value pair properties |
Returns
this
This resource, for chaining
Inherited from
ResourceProperty.setVisiblePropertiessetVisibleProperty()
setVisibleProperty(key, value): this;Sets a custom property in this resource, filtering out hidden properties. Hidden properties are those whose keys end with an underscore ”_”.
Parameters
| Parameter | Type | Description |
|---|---|---|
key | string | The property key |
value | string | null | undefined | The property value, or null/undefined to clean it |
Returns
this
This resource, for chaining
Inherited from
ResourceProperty.setVisiblePropertyupdate()
update(): Promise<Group>;Performs update group, applying pending changes.
Returns
Promise<Group>
A promise that resolves to this Group