import moment from 'moment' ; import { Field , StringFilterFunction , BooleanFilterFunction , NumberFilterFunction , FilterFunctionPrimitiveParameterType , FieldType , CollectionField , CollectionFilterFunction , filterFunctions as filterFunctionsCommon , FilterFunctionNames as FilterFunctionNamesCommon , FilterFunctionsType as FilterFunctionsCommonType , Time } from '@sap-cloud-sdk/odata-common/internal' ; import BigNumber from 'bignumber.js' ; import { Entity } from './entity' ; import { filterFunction } from './filter-function' ; import { defaultDeSerializers , DeSerializers , mergeDefaultDeSerializersWith } from './de-serializers' ; param substr param str returns export function contains < EntityT extends Entity > ( substr , str ) { return filterFunction ( 'contains' , 'boolean' , substr , str ) ; } param str param regex returns export function matchesPattern < EntityT extends Entity > ( str , regex ) { return filterFunction ( 'matchesPattern' , 'boolean' , str , regex ) ; } param date returns export function fractionalSeconds < EntityT extends Entity > ( date ) { return filterFunction ( 'fractionalseconds' , 'decimal' , date ) ; } param date returns export function totalOffsetMinutes < EntityT extends Entity > ( date ) { return filterFunction ( 'totaloffsetminutes' , 'decimal' , date ) ; } returns export function maxDateTime < EntityT extends Entity > ( ) { return filterFunction ( 'maxdatetime' , 'decimal' ) ; } returns export function minDateTime < EntityT extends Entity > ( ) { return filterFunction ( 'mindatetime' , 'decimal' ) ; } returns export function now < EntityT extends Entity > ( ) { return filterFunction ( 'now' , 'decimal' ) ; } param subset param set returns export function hasSubset < EntityT extends Entity , ParamT extends FilterFunctionPrimitiveParameterType , ReturnT extends FieldType > ( subset , set ) { return filterFunction ( 'hassubset' , 'boolean' , subset , set ) ; } param subsequence param sequence returns export function hasSubsequence < EntityT extends Entity , ParamT extends FilterFunctionPrimitiveParameterType , ReturnT extends FieldType > ( subsequence , sequence ) { return filterFunction ( 'hassubsequence' , 'boolean' , subsequence , sequence ) ; } /**
 * TODO: totalseconds, time
 */ 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 , DateTimeT = moment . Moment , DateTimeOffsetT = moment . Moment , TimeT = Time > ( deSerializers = defaultDeSerializers as any ) { return { ... filterFunctionsCommon ( mergeDefaultDeSerializersWith ( deSerializers ) ) , contains , matchesPattern , fractionalSeconds , totalOffsetMinutes , maxDateTime , minDateTime , now , hasSubset , hasSubsequence } ; } internal export type FilterFunctionTypes = FilterFunctionsCommonType & { contains : typeof contains ; matchesPattern : typeof matchesPattern ; fractionalSeconds : typeof fractionalSeconds ; totalOffsetMinutes : typeof totalOffsetMinutes ; maxDateTime : typeof maxDateTime ; minDateTime : typeof minDateTime ; now : typeof now ; hasSubset : typeof hasSubset ; hasSubsequence : typeof hasSubsequence ; } ; internal export type FilterFunctionNames = FilterFunctionNamesCommon | 'contains' | 'matchesPattern' | 'fractionalSeconds' | 'totalOffsetMinutes' | 'maxDateTime' | 'minDateTime' | 'now' | 'hasSubset' | 'hasSubsequence' ;