generated from amosproj/amos202Xss0Y-projname
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFilterQuery.ts
57 lines (47 loc) · 1.22 KB
/
FilterQuery.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
import { Property } from '../entities/Property';
import QueryBase from './QueryBase';
export interface FilterCondition {
rule: string;
}
export interface OfTypeCondition extends FilterCondition {
rule: 'of-type';
type: string;
}
export function OfTypeCondition(type: string): OfTypeCondition {
return { rule: 'of-type', type };
}
export interface MatchPropertyCondition extends FilterCondition {
rule: 'match-property';
property: string;
value: Property;
}
export function MatchPropertyCondition(
property: string,
value: Property
): MatchPropertyCondition {
return { rule: 'match-property', property, value };
}
export interface MatchAllCondition extends FilterCondition {
rule: 'all';
filters: FilterCondition[];
}
export function MatchAllCondition(
...filters: FilterCondition[]
): MatchAllCondition {
return { rule: 'all', filters };
}
export interface MatchAnyCondition extends FilterCondition {
rule: 'any';
filters: FilterCondition[];
}
export function MatchAnyCondition(
...filters: FilterCondition[]
): MatchAnyCondition {
return { rule: 'any', filters };
}
export default interface FilterQuery extends QueryBase {
filters?: {
nodes?: FilterCondition;
edges?: FilterCondition;
};
}