@beabee/beabee-common 1.6.0 → 1.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
export declare const ruleOperators: readonly ["equal", "not_equal", "less", "less_or_equal", "greater", "greater_or_equal", "between", "not_between", "begins_with", "not_begins_with", "contains", "not_contains", "ends_with", "not_ends_with", "is_empty", "is_not_empty"];
|
|
2
2
|
export declare type RuleOperator = typeof ruleOperators[number];
|
|
3
3
|
export declare type RuleValue = string | number | boolean;
|
|
4
|
-
export interface Rule<
|
|
5
|
-
field:
|
|
4
|
+
export interface Rule<Field extends string> {
|
|
5
|
+
field: Field;
|
|
6
6
|
operator: RuleOperator;
|
|
7
7
|
value: RuleValue[];
|
|
8
8
|
}
|
|
9
|
-
export interface RuleGroup<
|
|
9
|
+
export interface RuleGroup<Field extends string> {
|
|
10
10
|
condition: "AND" | "OR";
|
|
11
|
-
rules: (RuleGroup<
|
|
11
|
+
rules: (RuleGroup<Field> | Rule<Field>)[];
|
|
12
12
|
}
|
|
13
13
|
export declare type FilterType = "text" | "date" | "number" | "boolean" | "array" | "enum" | "contact";
|
|
14
14
|
export declare type FilterValue = RuleValue;
|
|
@@ -49,14 +49,14 @@ export interface Paginated<T> {
|
|
|
49
49
|
count: number;
|
|
50
50
|
total: number;
|
|
51
51
|
}
|
|
52
|
-
export interface PaginatedQuery<
|
|
52
|
+
export interface PaginatedQuery<Field extends string> {
|
|
53
53
|
limit?: number;
|
|
54
54
|
offset?: number;
|
|
55
55
|
sort?: string;
|
|
56
56
|
order?: "ASC" | "DESC";
|
|
57
|
-
rules?: RuleGroup<
|
|
57
|
+
rules?: RuleGroup<Field>;
|
|
58
58
|
}
|
|
59
|
-
export declare function isRuleGroup<
|
|
59
|
+
export declare function isRuleGroup<Field extends string>(ruleOrGroup: Rule<Field> | RuleGroup<Field>): ruleOrGroup is RuleGroup<Field>;
|
|
60
60
|
export declare function validateRule<Field extends string>(filters: Filters<Field>, rule: Rule<string>): rule is Rule<Field>;
|
|
61
61
|
export declare function validateRuleGroup<Field extends string>(filters: Filters<Field>, ruleGroup: RuleGroup<string>): ruleGroup is RuleGroup<Field>;
|
|
62
62
|
export declare function convertRuleGroupToFilters(ruleGroup?: RuleGroup<string>): Filter[] | null;
|