AppRules
@thotnr-aws-accl/custom-app-api / Exports / AppRules
Class: AppRules
The AppRules class provides methods to manage write validations for application instances. It allows creating, updating, retrieving, and removing validation rules that enforce specific constraints during data write operations.
Table of contents
Methods
Methods
createWriteValidation
▸ Static createWriteValidation(writeValidation): Promise<WriteValidation>
Creates a new write validation.
Parameters
writeValidation
Object
The WriteValidation object containing the details of the new validation.
Returns
Promise<WriteValidation>
A promise resolving to the ID of the newly created validation.
Example
getCurrentLabels
▸ Static getCurrentLabels(): Promise<AppRuleLabel[]>
Retrieve all labels available in the context of the "current" application instance. This typically includes labels from all read/write nodes that reference objects in this instance.
Returns
Promise<AppRuleLabel[]>
getCurrentValidations
▸ Static getCurrentValidations(labels): Promise<WriteValidation[]>
Retrieves the current validations for the specified labels.
Parameters
labels
Object
(Optional) A list of labels to filter validations by. If not provided, all validations will be retrieved.
labels.labels?
string[]
-
Returns
Promise<WriteValidation[]>
A promise resolving to an array of WriteValidation objects.
Example
Example
removeValidations
▸ Static removeValidations(validationId): Promise<number>
Removes a validation by its ID.
Parameters
validationId
Object
The unique ID of the validation to be removed.
validationId.validationId
number
-
Returns
Promise<number>
A promise resolving to the ID of the removed validation.
Example
updateWriteValidation
▸ Static updateWriteValidation(writeValidation): Promise<WriteValidation>
Updates an existing write validation.
Parameters
writeValidation
Object
The WriteValidation object containing the updated details.
Returns
Promise<WriteValidation>
A promise resolving to the updated validation.
Example
Last updated