1 | import { Filter, Where } from '@loopback/filter';
|
2 | import { AnyObject, DataObject } from '../common-types';
|
3 | import { Entity } from '../model';
|
4 | /**
|
5 | * A utility function which takes a filter and enforces constraint(s)
|
6 | * on it
|
7 | * @param originalFilter - the filter to apply the constrain(s) to
|
8 | * @param constraint - the constraint which is to be applied on the filter
|
9 | * @returns Filter the modified filter with the constraint, otherwise
|
10 | * the original filter
|
11 | */
|
12 | export declare function constrainFilter<T extends object>(originalFilter: Filter<T> | undefined, constraint: AnyObject): Filter<T>;
|
13 | /**
|
14 | * A utility function which takes a where filter and enforces constraint(s)
|
15 | * on it
|
16 | * @param originalWhere - the where filter to apply the constrain(s) to
|
17 | * @param constraint - the constraint which is to be applied on the filter
|
18 | * @returns Filter the modified filter with the constraint, otherwise
|
19 | * the original filter
|
20 | */
|
21 | export declare function constrainWhere<T extends object>(originalWhere: Where<T> | undefined, constraint: Where<T>): Where<T>;
|
22 | /**
|
23 | * A utility function which takes a where filter and enforces constraint(s)
|
24 | * on it with OR clause
|
25 | * @param originalWhere - the where filter to apply the constrain(s) to
|
26 | * @param constraint - the constraint which is to be applied on the filter with
|
27 | * or clause
|
28 | * @returns Filter the modified filter with the constraint, otherwise
|
29 | * the original filter
|
30 | */
|
31 | export declare function constrainWhereOr<T extends object>(originalWhere: Where<T> | undefined, constraint: Where<T>[]): Where<T>;
|
32 | /**
|
33 | * A utility function which takes a model instance data and enforces constraint(s)
|
34 | * on it
|
35 | * @param originalData - the model data to apply the constrain(s) to
|
36 | * @param constraint - the constraint which is to be applied on the data object
|
37 | * @returns the modified data with the constraint, otherwise
|
38 | * the original instance data
|
39 | */
|
40 | export declare function constrainDataObject<T extends Entity>(originalData: DataObject<T>, constraint: DataObject<T>): DataObject<T>;
|
41 | /**
|
42 | * A utility function which takes an array of model instance data and
|
43 | * enforces constraint(s) on it
|
44 | * @param originalData - the array of model data to apply the constrain(s) to
|
45 | * @param constraint - the constraint which is to be applied on the data objects
|
46 | * @returns an array of the modified data with the constraint, otherwise
|
47 | * the original instance data array
|
48 | */
|
49 | export declare function constrainDataObjects<T extends Entity>(originalData: DataObject<T>[], constraint: DataObject<T>): DataObject<T>[];
|