@unito/integration-sdk
Version:
Integration SDK
16 lines (15 loc) • 823 B
TypeScript
import { FieldSchema } from '@unito/integration-api';
import { Filter } from './index.js';
/**
* Use this helper function to retrieve the applicable filters from the context object. While using filters
* directly from context might work, it doesn't offer any guarantees about the shape of the filters nor the
* validity of the fields against which the filters are applied. On the other hand, this function ensures that
* all filters are valid and that the fields against which the filters are applied are present in the schema.
*
* @param context The object containing the raw filters
* @param fields The schema of the item against which the filters are applied
* @returns The validated filters
*/
export declare function getApplicableFilters(context: {
filters: Filter[];
}, fields: FieldSchema[]): Filter[];