1 | ;
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | exports.isFilter = exports.Filter = void 0;
|
4 | /**
|
5 | * Represents a filter expression to narrow the data on a [[GetAllRequestBuilder]] request for multiple entities that match the specified criteria.
|
6 | * A filter refers to the field of an entity and restricts the request based on an operator and a value. `Entity.FIELD_NAME.operator(value)`
|
7 | *
|
8 | * Example: `Product.NAME.equals('cloud-sdk')` creates a filter for the entity `Product` that matches in case the field `NAME` equals 'cloud-sdk'.
|
9 | *
|
10 | * See also: [[Filterable]]
|
11 | * @typeparam EntityT - Type of the entity to be filtered on
|
12 | * @typeparam FieldT - Type of the field to be filtered by, see also: [[FieldType]]
|
13 | */
|
14 | // TODO 2.0 rename to BinaryFilter
|
15 | var Filter = /** @class */ (function () {
|
16 | // TODO: change the constructor to the following:
|
17 | // Constructor(public field: string | Field<EntityT>, public operator: FilterOperator, public value: FieldT) {}
|
18 | // And deprecate passing a string as the field is needed later on
|
19 | /**
|
20 | * Creates an instance of Filter.
|
21 | * @param field - Name of the field of the entity to be filtered on or a filter function
|
22 | * @param operator - Function to be used for matching
|
23 | * @param value - Value to be used by the operator
|
24 | * @param edmType - EDM type of the field to filter on, needed for custom fields
|
25 | */
|
26 | function Filter(field, operator, value, edmType) {
|
27 | this.field = field;
|
28 | this.operator = operator;
|
29 | this.value = value;
|
30 | this.edmType = edmType;
|
31 | this._fieldName = field;
|
32 | }
|
33 | return Filter;
|
34 | }());
|
35 | exports.Filter = Filter;
|
36 | function isFilter(filterable) {
|
37 | return (typeof filterable['field'] !== 'undefined' &&
|
38 | typeof filterable['operator'] !== 'undefined' &&
|
39 | typeof filterable['value'] !== 'undefined');
|
40 | }
|
41 | exports.isFilter = isFilter;
|
42 | //# sourceMappingURL=filter.js.map |
\ | No newline at end of file |