@sap-cloud-sdk/odata-common
Version:
SAP Cloud SDK for JavaScript common functions of OData client generator and OpenAPI clint generator.
38 lines • 1.55 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.FilterList = void 0;
exports.isFilterList = isFilterList;
// eslint-disable-next-line import/no-internal-modules
const one_to_many_link_1 = require("../selectable/one-to-many-link");
/**
* Data structure to combine {@link Filterable}s conjunctively and / or disjunctively. A FilterList matches when all filterables within the `andFilters` match and when at least one filterable within the `orFilters` matches. Should not be used directly.
* @typeParam EntityT -
*/
class FilterList {
/**
* Creates an instance of FilterList.
* @param andFilters - Filters to be combined by logical conjunction (`and`).
* @param orFilters - Filters to be combined by logical disjunction (`or`).
*/
constructor(andFilters = [], orFilters = []) {
this.andFilters = andFilters;
this.orFilters = orFilters;
}
}
exports.FilterList = FilterList;
/**
* Type guard for the FilterList.
* @param filterable - Variable to be checked.
* @returns boolean
* @internal
*/
function isFilterList(filterable) {
return (typeof filterable['field'] === 'undefined' &&
typeof filterable['operator'] === 'undefined' &&
typeof filterable['value'] === 'undefined' &&
typeof filterable['functionName'] === 'undefined' &&
typeof filterable['link'] === 'undefined' &&
!('lambdaOperator' in filterable) &&
!(filterable instanceof one_to_many_link_1.OneToManyLink));
}
//# sourceMappingURL=filter-list.js.map