import moment from 'moment' ; import BigNumber from 'bignumber.js' ; import { DeSerializers } from '../de-serializers' ; import { EntityBase } from '../entity-base' ; import { Field } from '../selectable' ; import { StringFilterFunction } from './string-filter-function' ; import { BooleanFilterFunction } from './boolean-filter-function' ; import { filterFunction } from './filter-function' ; import { NumberFilterFunction } from './number-filter-function' ; internal param str param suffix returns export function endsWith < EntityT extends EntityBase > ( str , suffix ) { return filterFunction ( 'endswith' , 'boolean' , str , suffix ) ; } internal param str param prefix returns export function startsWith < EntityT extends EntityBase > ( str , prefix ) { return filterFunction ( 'startswith' , 'boolean' , str , prefix ) ; } internal param str returns export function length < EntityT extends EntityBase > ( str ) { return filterFunction ( 'length' , 'int' , str ) ; } internal param str param substr returns export function indexOf < EntityT extends EntityBase > ( str , substr ) { return filterFunction ( 'indexof' , 'int' , str , substr ) ; } internal param str param pos param len returns export function substring < EntityT extends EntityBase > ( str , pos , len ? ) { return typeof len === 'undefined' ? filterFunction ( 'substring' , 'string' , str , pos ) : filterFunction ( 'substring' , 'string' , str , pos , len ) ; } internal param str returns export function toLower < EntityT extends EntityBase > ( str ) { return filterFunction ( 'tolower' , 'string' , str ) ; } internal param str returns export function toUpper < EntityT extends EntityBase > ( str ) { return filterFunction ( 'toupper' , 'string' , str ) ; } internal param str returns export function trim < EntityT extends EntityBase > ( str ) { return filterFunction ( 'trim' , 'string' , str ) ; } internal param str1 param str2 returns export function concat < EntityT extends EntityBase > ( str1 , str2 ) { return filterFunction ( 'concat' , 'string' , str1 , str2 ) ; } param num param returnType returns internal export function round < EntityT extends EntityBase > ( num , returnType = 'double' ) { return filterFunction ( 'round' , returnType , num ) ; } param num param returnType returns internal export function floor < EntityT extends EntityBase > ( num , returnType = 'double' ) { return filterFunction ( 'floor' , returnType , num ) ; } param num param returnType returns internal export function ceiling < EntityT extends EntityBase > ( num , returnType = 'double' ) { return filterFunction ( 'ceiling' , returnType , num ) ; } param date returns internal export function day < EntityT extends EntityBase > ( date ) { return filterFunction ( 'day' , 'int' , date ) ; } param date returns internal export function hour < EntityT extends EntityBase > ( date ) { return filterFunction ( 'hour' , 'int' , date ) ; } param date returns internal export function minute < EntityT extends EntityBase > ( date ) { return filterFunction ( 'minute' , 'int' , date ) ; } param date returns internal export function month < EntityT extends EntityBase > ( date ) { return filterFunction ( 'month' , 'int' , date ) ; } param date returns internal export function second < EntityT extends EntityBase > ( date ) { return filterFunction ( 'second' , 'int' , date ) ; } param date returns internal export function year < EntityT extends EntityBase > ( date ) { return filterFunction ( 'year' , 'int' , date ) ; } param type returns internal export function isOf < EntityT extends EntityBase > ( type ) ; param expression param type returns internal export function isOf < EntityT extends EntityBase > ( expression , type ) ; param expressionOrType param type returns internal export function isOf < EntityT extends EntityBase > ( expressionOrType , type ? ) { return type ? filterFunction ( 'isof' , 'boolean' , expressionOrType , type ) : filterFunction ( 'isof' , 'boolean' , expressionOrType ) ; } internal param deSerializers returns export function filterFunctions < BinaryT = string , BooleanT = boolean , ByteT = number , DecimalT = BigNumber , DoubleT = number , FloatT = number , Int16T = number , Int32T = number , Int64T = BigNumber , GuidT = string , SByteT = number , SingleT = number , StringT = string , AnyT = any > ( deSerializers ) { return { endsWith , startsWith , length , indexOf , substring , toLower , toUpper , trim , concat , round , floor , ceiling , day , hour , minute , month , second , year , isOf } ; } internal export interface FilterFunctionsType { endsWith : typeof endsWith ; startsWith : typeof startsWith ; length : typeof length ; indexOf : typeof indexOf ; substring : typeof substring ; toLower : typeof toLower ; toUpper : typeof toUpper ; trim : typeof trim ; concat : typeof concat ; round : typeof round ; floor : typeof floor ; ceiling : typeof ceiling ; day : typeof day ; hour : typeof hour ; minute : typeof minute ; month : typeof month ; second : typeof second ; year : typeof year ; isOf : typeof isOf ; } internal export type FilterFunctionTypes = typeof endsWith | typeof startsWith | typeof length | typeof indexOf | typeof substring | typeof toLower | typeof toUpper | typeof trim | typeof concat | typeof round | typeof floor | typeof ceiling | typeof day | typeof hour | typeof minute | typeof month | typeof second | typeof year | typeof isOf ; internal export type FilterFunctionNames = 'endsWith' | 'startsWith' | 'length' | 'indexOf' | 'substring' | 'toLower' | 'toUpper' | 'trim' | 'concat' | 'round' | 'floor' | 'ceiling' | 'day' | 'hour' | 'minute' | 'month' | 'second' | 'year' | 'isOf' ;