UNPKG

6.47 kBTypeScriptView Raw
1import moment from 'moment';
2import { Field, StringFilterFunction, BooleanFilterFunction, NumberFilterFunction, FilterFunctionPrimitiveParameterType, FieldType, CollectionField } from '../odata-common';
3import { CollectionFilterFunction } from '../odata-common/filter/collection-filter-function';
4import { Entity } from './entity';
5/**
6 * Build a filter function to test whether a string is a substring of the other. Evaluates to boolean.
7 * @param substr - The substring to test for. This can either be a string, a reference to a field or another filter function.
8 * @param str - The string to test. This can either be a string, a reference to a field or another filter function.
9 *
10 * @returns The newly created filter function
11 */
12export declare function contains<EntityT extends Entity>(substr: string | Field<EntityT, boolean, boolean> | StringFilterFunction<EntityT>, str: string | Field<EntityT, boolean, boolean> | StringFilterFunction<EntityT>): BooleanFilterFunction<EntityT>;
13/**
14 * Build a filter function to test whether a string matches a pattern. Evaluates to boolean.
15 * @param str - The string to get the index from. This can either be a string, a reference to a field or another filter function.
16 * @param regex - The pattern to test against. This should be a regular expression as a string.
17 * @returns The newly created filter function
18 */
19export declare function matchesPattern<EntityT extends Entity>(str: string | Field<EntityT, boolean, boolean> | StringFilterFunction<EntityT>, regex: string): BooleanFilterFunction<EntityT>;
20/**
21 * Build a filter function to get the fractional seconds of a date. Evaluates to decimal.
22 * @param date - The date to get the fractional seconds for. This can either be a date (Moment) or a reference to a field.
23 * @returns The newly created filter function
24 */
25export declare function fractionalSeconds<EntityT extends Entity>(date: moment.Moment | Field<EntityT, boolean, boolean>): NumberFilterFunction<EntityT>;
26/**
27 * Build a filter function to get the signed number of minutes in the time zone offset. Evaluates to int.
28 * @param date - The date to get the offset minutes for. This can either be a date (Moment) or a reference to a field.
29 * @returns The newly created filter function
30 */
31export declare function totalOffsetMinutes<EntityT extends Entity>(date: moment.Moment | Field<EntityT, boolean, boolean>): NumberFilterFunction<EntityT>;
32/**
33 * Build a filter function to get the latest possible point in time. Evaluates to DateTimeOffset.
34 * @returns The newly created filter function
35 */
36export declare function maxDateTime<EntityT extends Entity>(): NumberFilterFunction<EntityT>;
37/**
38 * Build a filter function to get the earliest possible point in time. Evaluates to DateTimeOffset.
39 * @returns The newly created filter function
40 */
41export declare function minDateTime<EntityT extends Entity>(): NumberFilterFunction<EntityT>;
42/**
43 * Build a filter function to get the current point in time. Evaluates to DateTimeOffset.
44 * @returns The newly created filter function
45 */
46export declare function now<EntityT extends Entity>(): NumberFilterFunction<EntityT>;
47/**
48 * Build a filter function to test whether a set is a subset of the other, i. e. whether the second parameter can be transformed into the first by reordering and / or removing items. Evaluates to boolean.
49 * @param subset - The subset to test for. This can either be an array, a reference to a field or another filter function.
50 * @param set - The set to test. This can either be an array, a reference to a field or another filter function.
51 *
52 * @returns The newly created filter function
53 */
54export declare function hasSubset<EntityT extends Entity, ParamT extends FilterFunctionPrimitiveParameterType, ReturnT extends FieldType>(subset: ParamT[] | CollectionField<EntityT, any, boolean, boolean> | CollectionFilterFunction<EntityT, ReturnT>, set: ParamT[] | CollectionField<EntityT, any, boolean, boolean> | CollectionFilterFunction<EntityT, ReturnT>): BooleanFilterFunction<EntityT>;
55/**
56 * Build a filter function to test whether a set is a subsequence of the other, i. e. whether the second parameter can be transformed into the first by removing items. Evaluates to boolean.
57 * @param subsequence - The subsequence to test for. This can either be an array, a reference to a field or another filter function.
58 * @param sequence - The sequence to test. This can either be an array, a reference to a field or another filter function.
59 *
60 * @returns The newly created filter function
61 */
62export declare function hasSubsequence<EntityT extends Entity, ParamT extends FilterFunctionPrimitiveParameterType, ReturnT extends FieldType>(subsequence: ParamT[] | Field<EntityT, boolean, boolean> | CollectionFilterFunction<EntityT, ReturnT>, sequence: ParamT[] | Field<EntityT, boolean, boolean> | CollectionFilterFunction<EntityT, ReturnT>): BooleanFilterFunction<EntityT>;
63/**
64 * TODO: totalseconds, time
65 */
66/**
67 * OData v4 specific filter functions
68 */
69export declare const filterFunctions: {
70 contains: typeof contains;
71 matchesPattern: typeof matchesPattern;
72 fractionalSeconds: typeof fractionalSeconds;
73 totalOffsetMinutes: typeof totalOffsetMinutes;
74 maxDateTime: typeof maxDateTime;
75 minDateTime: typeof minDateTime;
76 now: typeof now;
77 hasSubset: typeof hasSubset;
78 hasSubsequence: typeof hasSubsequence;
79 endsWith: typeof import("../odata-common").endsWith;
80 startsWith: typeof import("../odata-common").startsWith;
81 length: typeof import("../odata-common").length;
82 indexOf: typeof import("../odata-common").indexOf;
83 substring: typeof import("../odata-common").substring;
84 toLower: typeof import("../odata-common").toLower;
85 toUpper: typeof import("../odata-common").toUpper;
86 trim: typeof import("../odata-common").trim;
87 concat: typeof import("../odata-common").concat;
88 round: typeof import("../odata-common").round;
89 floor: typeof import("../odata-common").floor;
90 ceiling: typeof import("../odata-common").ceiling;
91 day: typeof import("../odata-common").day;
92 hour: typeof import("../odata-common").hour;
93 minute: typeof import("../odata-common").minute;
94 month: typeof import("../odata-common").month;
95 second: typeof import("../odata-common").second;
96 year: typeof import("../odata-common").year;
97 isOf: typeof import("../odata-common").isOf;
98};
99export { filterFunctions as filterFunctionsV4 };
100//# sourceMappingURL=filter-functions.d.ts.map
\No newline at end of file