Bona Iqiniso Application Board

V3BiAlertValidationArray

Specification for V3BiAlertValidationArray

Attributes

AttributeTypeDescription
alertsV3BiAlertValidationBase[]Array of alert validation base items

Methods

MethodDescription
constructorInitializes a new instance of V3BiAlertValidationArray with the provided alerts array.
getAlertByFieldReturns an array of V3BiAlertValidationBase items that match the specified field.
getAlertByReferenceReturns a single V3BiAlertValidationBase item that matches the specified reference and field.
addAlertByReferenceAdds a new V3BiAlertValidationBase item to the alerts array if it does not already exist with the same reference and field.

Constructor

Signature:

constructor(alerts: V3BiAlertValidationBase[])

Parameters:

  • alerts (V3BiAlertValidationBase[]): Array of alert validation base items.

Description:
The constructor initializes the V3BiAlertValidationArray instance with the provided alerts array.

Method: getAlertByField

Signature:

getAlertByField(field: string | undefined): V3BiAlertValidationBase[]

Parameters:

  • field (string | undefined): The field to filter alerts by.

Description:
Returns an array of V3BiAlertValidationBase items that match the specified field.

Method: getAlertByReference

Signature:

getAlertByReference(reference: string, field: string | undefined): V3BiAlertValidationBase | undefined

Parameters:

  • reference (string): The reference of the alert to find.
  • field (string | undefined): The field of the alert to find.

Description:
Returns a single V3BiAlertValidationBase item that matches the specified reference and field, or undefined if no match is found.

Method: addAlertByReference

Signature:

addAlertByReference(reference: string, field?: string): void

Parameters:

  • reference (string): The reference of the alert to add.
  • field (string | undefined): The field of the alert to add.

Description:
Adds a new V3BiAlertValidationBase item to the alerts array if it does not already exist with the same reference and field. Throws an error if a duplicate alert is found.

Example Usage

const alerts = [
  new V3BiAlertValidationBase('alert1', 'field1'),
  new V3BiAlertValidationBase('alert2', 'field2')
];
const alertArray = new V3BiAlertValidationArray(alerts);
alertArray.addAlertByReference('alert3', 'field3');