StatusfulMixin
Hierarchy
- StatusfulMixin
 
Implements
- Statusful
 - Statusful
 
Index
Properties
Methods
Properties
status
• status: Status
Implementation of Statusful.status
Methods
getSelectableStatuses
▸ getSelectableStatuses(): Record‹string, Status›
Implementation of Statusful
Returns all selectable status.
Returns: Record‹string, Status›
Collection of available status.
getStatus
▸ getStatus(): Status
Implementation of Statusful
Returns current status of instance.
Returns: Status
Current status of instance as string.
hasStatus
▸ hasStatus(): boolean
Implementation of Statusful
Evaluates if target has status set on instance(is not nil).
Returns: boolean
Returns true if instance has status set(not nil), else false.
isInOneOfStatuses
▸ isInOneOfStatuses(status: Status | Status[]): boolean
Implementation of Statusful
Evaluates if target is in one of expected status.
Parameters:
| Name | Type | Description | 
|---|---|---|
status | Status | Status[] | Expected status in which one of instance should be. | 
Returns: boolean
Returns true if instance is in one of status, else false.
isInStatus
▸ isInStatus(status: Status | Status[]): boolean
Implementation of Statusful
Evaluates if target is in expected status.
Parameters:
| Name | Type | Description | 
|---|---|---|
status | Status | Status[] | Expected status in which instance should be. | 
Returns: boolean
Returns true if instance is in status, else false.
setStatus
▸ setStatus(status: Status): void
Implementation of Statusful
Sets instance status.
throws {ValidationError}
Thrown if the provided status does not match one of the selectable status.
throws {UndefinedStatusesError}
Thrown if the instance does not have any status assigned.
Parameters:
| Name | Type | Description | 
|---|---|---|
status | Status | Status to which instance should be set. | 
Returns: void
validateStatus
▸ validateStatus(statusOrStatuses: Status | Status[], error?: Error): boolean
Implementation of Statusful
Validates if instance is in allowed status(s).
throws {InvalidStatusError}
Thrown if target is not in correct(one of allowed) status.
Parameters:
| Name | Type | Description | 
|---|---|---|
statusOrStatuses | Status | Status[] | Expected status list in one of which instance should be. | 
error? | Error | Optional error instance for case where status does not match expected one. | 
Returns: boolean
Returns true if instance is in correct status, else throws.