@beabee/beabee-common 1.10.2 → 1.10.4
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.
- package/dist/cjs/search/callouts.js +5 -0
- package/dist/cjs/search/index.js +13 -8
- package/dist/cjs/utils/date.js +1 -1
- package/dist/cjs/utils/rules.js +11 -8
- package/dist/esm/search/callouts.js +5 -0
- package/dist/esm/search/index.js +13 -8
- package/dist/esm/utils/date.js +1 -1
- package/dist/esm/utils/rules.js +11 -8
- package/dist/types/data/index.d.ts +1 -1
- package/dist/types/search/callouts.d.ts +28 -23
- package/dist/types/search/contacts.d.ts +41 -41
- package/dist/types/search/index.d.ts +78 -32
- package/dist/types/search/notices.d.ts +17 -17
- package/dist/types/search/payments.d.ts +5 -5
- package/dist/types/utils/date.d.ts +1 -1
- package/package.json +7 -7
|
@@ -31,6 +31,7 @@ exports.calloutFilters = {
|
|
|
31
31
|
exports.calloutResponseFilters = {
|
|
32
32
|
contact: {
|
|
33
33
|
type: "contact",
|
|
34
|
+
nullable: true,
|
|
34
35
|
},
|
|
35
36
|
callout: {
|
|
36
37
|
type: "text",
|
|
@@ -41,4 +42,8 @@ exports.calloutResponseFilters = {
|
|
|
41
42
|
updatedAt: {
|
|
42
43
|
type: "date",
|
|
43
44
|
},
|
|
45
|
+
answers: {
|
|
46
|
+
type: "custom",
|
|
47
|
+
nullable: true,
|
|
48
|
+
},
|
|
44
49
|
};
|
package/dist/cjs/search/index.js
CHANGED
|
@@ -38,6 +38,12 @@ const equalityOperators = {
|
|
|
38
38
|
equal: { args: 1 },
|
|
39
39
|
not_equal: { args: 1 },
|
|
40
40
|
};
|
|
41
|
+
const stringOperators = {
|
|
42
|
+
begins_with: { args: 1 },
|
|
43
|
+
ends_with: { args: 1 },
|
|
44
|
+
not_begins_with: { args: 1 },
|
|
45
|
+
not_ends_with: { args: 1 },
|
|
46
|
+
};
|
|
41
47
|
const numericOperators = {
|
|
42
48
|
...equalityOperators,
|
|
43
49
|
between: { args: 2 },
|
|
@@ -57,20 +63,19 @@ exports.nullableOperators = {
|
|
|
57
63
|
is_not_empty: { args: 0 },
|
|
58
64
|
};
|
|
59
65
|
exports.operatorsByType = {
|
|
60
|
-
text: {
|
|
61
|
-
...equalityOperators,
|
|
62
|
-
...arrayOperators,
|
|
63
|
-
begins_with: { args: 1 },
|
|
64
|
-
ends_with: { args: 1 },
|
|
65
|
-
not_begins_with: { args: 1 },
|
|
66
|
-
not_ends_with: { args: 1 },
|
|
67
|
-
},
|
|
66
|
+
text: { ...equalityOperators, ...arrayOperators, ...stringOperators },
|
|
68
67
|
date: numericOperators,
|
|
69
68
|
number: numericOperators,
|
|
70
69
|
boolean: { equal: equalityOperators.equal },
|
|
71
70
|
array: arrayOperators,
|
|
72
71
|
enum: equalityOperators,
|
|
73
72
|
contact: equalityOperators,
|
|
73
|
+
custom: {
|
|
74
|
+
...equalityOperators,
|
|
75
|
+
...arrayOperators,
|
|
76
|
+
...stringOperators,
|
|
77
|
+
...numericOperators,
|
|
78
|
+
},
|
|
74
79
|
};
|
|
75
80
|
// More general type to allow mapping while maintaining full type above
|
|
76
81
|
exports.operatorsByTypeMap = exports.operatorsByType;
|
package/dist/cjs/utils/date.js
CHANGED
|
@@ -31,7 +31,7 @@ const startOf = {
|
|
|
31
31
|
m: startOfMinute_1.default,
|
|
32
32
|
s: startOfSecond_1.default,
|
|
33
33
|
};
|
|
34
|
-
const relativeDate =
|
|
34
|
+
const relativeDate = /^\$now(?<units>\(((y|M|d|h|m|s):(-?\d+),?)+\))?$/;
|
|
35
35
|
const relativeUnit = /(y|M|d|h|m|s):(-?\d+)/g;
|
|
36
36
|
// Matches the different parts of an ISO 8601 date. Note we don't validate the
|
|
37
37
|
// pattern properly as that is handled by parseISO, we just want to know which
|
package/dist/cjs/utils/rules.js
CHANGED
|
@@ -9,27 +9,27 @@ function isRuleGroup(ruleOrGroup) {
|
|
|
9
9
|
}
|
|
10
10
|
exports.isRuleGroup = isRuleGroup;
|
|
11
11
|
function validateRule(filters, rule) {
|
|
12
|
-
const
|
|
12
|
+
const [fieldName, fieldParam] = rule.field.split(".", 2);
|
|
13
|
+
const filter = filters[fieldName];
|
|
13
14
|
if (!filter) {
|
|
14
15
|
throw new error_1.InvalidRule(rule, `Invalid field: ${rule.field}`);
|
|
15
16
|
}
|
|
17
|
+
let expectedArgs = 0;
|
|
16
18
|
if (rule.operator in search_1.nullableOperators) {
|
|
17
19
|
// Field cannot be empty (except text which can always be empty)
|
|
18
20
|
if (!filter.nullable && filter.type !== "text") {
|
|
19
21
|
throw new error_1.InvalidRule(rule, `Invalid nullable operator: field is not nullable`);
|
|
20
22
|
}
|
|
21
|
-
if (rule.value.length !== 0) {
|
|
22
|
-
throw new error_1.InvalidRule(rule, `Invalid operator argument count: ${rule.operator} needs 0, ${rule.value.length} given`);
|
|
23
|
-
}
|
|
24
23
|
}
|
|
25
24
|
else {
|
|
26
25
|
const operator = search_1.operatorsByTypeMap[filter.type][rule.operator];
|
|
27
26
|
if (!operator) {
|
|
28
27
|
throw new error_1.InvalidRule(rule, `Invalid operator for type: ${filter.type} type doesn't define ${rule.operator}`);
|
|
29
28
|
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
29
|
+
expectedArgs = operator.args;
|
|
30
|
+
}
|
|
31
|
+
if (expectedArgs !== rule.value.length) {
|
|
32
|
+
throw new error_1.InvalidRule(rule, `Invalid operator argument count: ${rule.operator} needs ${expectedArgs}, ${rule.value.length} given`);
|
|
33
33
|
}
|
|
34
34
|
const expectedType = filter.type === "boolean" || filter.type === "number"
|
|
35
35
|
? filter.type
|
|
@@ -42,8 +42,11 @@ function validateRule(filters, rule) {
|
|
|
42
42
|
throw new error_1.InvalidRule(rule, `Invalid operator argument: date type needs valid absolute or relative date, ${rule.value} given`);
|
|
43
43
|
}
|
|
44
44
|
return {
|
|
45
|
-
|
|
45
|
+
field: fieldName,
|
|
46
|
+
param: fieldParam,
|
|
46
47
|
type: filter.type,
|
|
48
|
+
operator: rule.operator,
|
|
49
|
+
value: rule.value,
|
|
47
50
|
};
|
|
48
51
|
}
|
|
49
52
|
exports.validateRule = validateRule;
|
|
@@ -28,6 +28,7 @@ export const calloutFilters = {
|
|
|
28
28
|
export const calloutResponseFilters = {
|
|
29
29
|
contact: {
|
|
30
30
|
type: "contact",
|
|
31
|
+
nullable: true,
|
|
31
32
|
},
|
|
32
33
|
callout: {
|
|
33
34
|
type: "text",
|
|
@@ -38,4 +39,8 @@ export const calloutResponseFilters = {
|
|
|
38
39
|
updatedAt: {
|
|
39
40
|
type: "date",
|
|
40
41
|
},
|
|
42
|
+
answers: {
|
|
43
|
+
type: "custom",
|
|
44
|
+
nullable: true,
|
|
45
|
+
},
|
|
41
46
|
};
|
package/dist/esm/search/index.js
CHANGED
|
@@ -21,6 +21,12 @@ const equalityOperators = {
|
|
|
21
21
|
equal: { args: 1 },
|
|
22
22
|
not_equal: { args: 1 },
|
|
23
23
|
};
|
|
24
|
+
const stringOperators = {
|
|
25
|
+
begins_with: { args: 1 },
|
|
26
|
+
ends_with: { args: 1 },
|
|
27
|
+
not_begins_with: { args: 1 },
|
|
28
|
+
not_ends_with: { args: 1 },
|
|
29
|
+
};
|
|
24
30
|
const numericOperators = {
|
|
25
31
|
...equalityOperators,
|
|
26
32
|
between: { args: 2 },
|
|
@@ -40,20 +46,19 @@ export const nullableOperators = {
|
|
|
40
46
|
is_not_empty: { args: 0 },
|
|
41
47
|
};
|
|
42
48
|
export const operatorsByType = {
|
|
43
|
-
text: {
|
|
44
|
-
...equalityOperators,
|
|
45
|
-
...arrayOperators,
|
|
46
|
-
begins_with: { args: 1 },
|
|
47
|
-
ends_with: { args: 1 },
|
|
48
|
-
not_begins_with: { args: 1 },
|
|
49
|
-
not_ends_with: { args: 1 },
|
|
50
|
-
},
|
|
49
|
+
text: { ...equalityOperators, ...arrayOperators, ...stringOperators },
|
|
51
50
|
date: numericOperators,
|
|
52
51
|
number: numericOperators,
|
|
53
52
|
boolean: { equal: equalityOperators.equal },
|
|
54
53
|
array: arrayOperators,
|
|
55
54
|
enum: equalityOperators,
|
|
56
55
|
contact: equalityOperators,
|
|
56
|
+
custom: {
|
|
57
|
+
...equalityOperators,
|
|
58
|
+
...arrayOperators,
|
|
59
|
+
...stringOperators,
|
|
60
|
+
...numericOperators,
|
|
61
|
+
},
|
|
57
62
|
};
|
|
58
63
|
// More general type to allow mapping while maintaining full type above
|
|
59
64
|
export const operatorsByTypeMap = operatorsByType;
|
package/dist/esm/utils/date.js
CHANGED
|
@@ -25,7 +25,7 @@ const startOf = {
|
|
|
25
25
|
m: startOfMinute,
|
|
26
26
|
s: startOfSecond,
|
|
27
27
|
};
|
|
28
|
-
const relativeDate =
|
|
28
|
+
const relativeDate = /^\$now(?<units>\(((y|M|d|h|m|s):(-?\d+),?)+\))?$/;
|
|
29
29
|
const relativeUnit = /(y|M|d|h|m|s):(-?\d+)/g;
|
|
30
30
|
// Matches the different parts of an ISO 8601 date. Note we don't validate the
|
|
31
31
|
// pattern properly as that is handled by parseISO, we just want to know which
|
package/dist/esm/utils/rules.js
CHANGED
|
@@ -5,27 +5,27 @@ export function isRuleGroup(ruleOrGroup) {
|
|
|
5
5
|
return "condition" in ruleOrGroup;
|
|
6
6
|
}
|
|
7
7
|
export function validateRule(filters, rule) {
|
|
8
|
-
const
|
|
8
|
+
const [fieldName, fieldParam] = rule.field.split(".", 2);
|
|
9
|
+
const filter = filters[fieldName];
|
|
9
10
|
if (!filter) {
|
|
10
11
|
throw new InvalidRule(rule, `Invalid field: ${rule.field}`);
|
|
11
12
|
}
|
|
13
|
+
let expectedArgs = 0;
|
|
12
14
|
if (rule.operator in nullableOperators) {
|
|
13
15
|
// Field cannot be empty (except text which can always be empty)
|
|
14
16
|
if (!filter.nullable && filter.type !== "text") {
|
|
15
17
|
throw new InvalidRule(rule, `Invalid nullable operator: field is not nullable`);
|
|
16
18
|
}
|
|
17
|
-
if (rule.value.length !== 0) {
|
|
18
|
-
throw new InvalidRule(rule, `Invalid operator argument count: ${rule.operator} needs 0, ${rule.value.length} given`);
|
|
19
|
-
}
|
|
20
19
|
}
|
|
21
20
|
else {
|
|
22
21
|
const operator = operatorsByTypeMap[filter.type][rule.operator];
|
|
23
22
|
if (!operator) {
|
|
24
23
|
throw new InvalidRule(rule, `Invalid operator for type: ${filter.type} type doesn't define ${rule.operator}`);
|
|
25
24
|
}
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
25
|
+
expectedArgs = operator.args;
|
|
26
|
+
}
|
|
27
|
+
if (expectedArgs !== rule.value.length) {
|
|
28
|
+
throw new InvalidRule(rule, `Invalid operator argument count: ${rule.operator} needs ${expectedArgs}, ${rule.value.length} given`);
|
|
29
29
|
}
|
|
30
30
|
const expectedType = filter.type === "boolean" || filter.type === "number"
|
|
31
31
|
? filter.type
|
|
@@ -38,8 +38,11 @@ export function validateRule(filters, rule) {
|
|
|
38
38
|
throw new InvalidRule(rule, `Invalid operator argument: date type needs valid absolute or relative date, ${rule.value} given`);
|
|
39
39
|
}
|
|
40
40
|
return {
|
|
41
|
-
|
|
41
|
+
field: fieldName,
|
|
42
|
+
param: fieldParam,
|
|
42
43
|
type: filter.type,
|
|
44
|
+
operator: rule.operator,
|
|
45
|
+
value: rule.value,
|
|
43
46
|
};
|
|
44
47
|
}
|
|
45
48
|
export function validateRuleGroup(filters, ruleGroup) {
|
|
@@ -1,38 +1,43 @@
|
|
|
1
1
|
import { ItemStatus } from "../data";
|
|
2
2
|
export declare const calloutFilters: {
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
title: {
|
|
4
|
+
type: "text";
|
|
5
5
|
};
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
status: {
|
|
7
|
+
type: "enum";
|
|
8
|
+
options: ItemStatus[];
|
|
9
9
|
};
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
answeredBy: {
|
|
11
|
+
type: "contact";
|
|
12
12
|
};
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
starts: {
|
|
14
|
+
type: "date";
|
|
15
15
|
};
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
expires: {
|
|
17
|
+
type: "date";
|
|
18
18
|
};
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
hidden: {
|
|
20
|
+
type: "boolean";
|
|
21
21
|
};
|
|
22
22
|
};
|
|
23
|
-
export
|
|
23
|
+
export type CalloutFilterName = keyof typeof calloutFilters;
|
|
24
24
|
export declare const calloutResponseFilters: {
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
contact: {
|
|
26
|
+
type: "contact";
|
|
27
|
+
nullable: true;
|
|
27
28
|
};
|
|
28
|
-
|
|
29
|
-
|
|
29
|
+
callout: {
|
|
30
|
+
type: "text";
|
|
30
31
|
};
|
|
31
|
-
|
|
32
|
-
|
|
32
|
+
createdAt: {
|
|
33
|
+
type: "date";
|
|
33
34
|
};
|
|
34
|
-
|
|
35
|
-
|
|
35
|
+
updatedAt: {
|
|
36
|
+
type: "date";
|
|
37
|
+
};
|
|
38
|
+
answers: {
|
|
39
|
+
type: "custom";
|
|
40
|
+
nullable: true;
|
|
36
41
|
};
|
|
37
42
|
};
|
|
38
|
-
export
|
|
43
|
+
export type CalloutResponseFilterName = keyof typeof calloutResponseFilters;
|
|
@@ -1,61 +1,61 @@
|
|
|
1
1
|
import { ContributionPeriod, ContributionType, NewsletterStatus } from "../data";
|
|
2
2
|
export declare const contactFilters: {
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
firstname: {
|
|
4
|
+
type: "text";
|
|
5
5
|
};
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
lastname: {
|
|
7
|
+
type: "text";
|
|
8
8
|
};
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
email: {
|
|
10
|
+
type: "text";
|
|
11
11
|
};
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
joined: {
|
|
13
|
+
type: "date";
|
|
14
14
|
};
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
lastSeen: {
|
|
16
|
+
type: "date";
|
|
17
17
|
};
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
contributionCancelled: {
|
|
19
|
+
type: "date";
|
|
20
20
|
};
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
contributionType: {
|
|
22
|
+
type: "enum";
|
|
23
|
+
options: ContributionType[];
|
|
24
24
|
};
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
contributionMonthlyAmount: {
|
|
26
|
+
type: "number";
|
|
27
27
|
};
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
28
|
+
contributionPeriod: {
|
|
29
|
+
type: "enum";
|
|
30
|
+
options: ContributionPeriod[];
|
|
31
31
|
};
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
deliveryOptIn: {
|
|
33
|
+
type: "boolean";
|
|
34
34
|
};
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
35
|
+
newsletterStatus: {
|
|
36
|
+
type: "enum";
|
|
37
|
+
options: NewsletterStatus[];
|
|
38
38
|
};
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
39
|
+
activePermission: {
|
|
40
|
+
type: "enum";
|
|
41
|
+
options: readonly ["member", "admin", "superadmin"];
|
|
42
42
|
};
|
|
43
|
-
|
|
44
|
-
|
|
43
|
+
activeMembership: {
|
|
44
|
+
type: "boolean";
|
|
45
45
|
};
|
|
46
|
-
|
|
47
|
-
|
|
46
|
+
membershipStarts: {
|
|
47
|
+
type: "date";
|
|
48
48
|
};
|
|
49
|
-
|
|
50
|
-
|
|
49
|
+
membershipExpires: {
|
|
50
|
+
type: "date";
|
|
51
51
|
};
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
52
|
+
manualPaymentSource: {
|
|
53
|
+
type: "text";
|
|
54
|
+
nullable: true;
|
|
55
55
|
};
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
56
|
+
tags: {
|
|
57
|
+
type: "array";
|
|
58
|
+
nullable: true;
|
|
59
59
|
};
|
|
60
60
|
};
|
|
61
|
-
export
|
|
61
|
+
export type ContactFilterName = keyof typeof contactFilters;
|
|
@@ -1,6 +1,6 @@
|
|
|
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
|
-
export
|
|
3
|
-
export
|
|
2
|
+
export type RuleOperator = (typeof ruleOperators)[number];
|
|
3
|
+
export type RuleValue = string | number | boolean;
|
|
4
4
|
export interface Rule {
|
|
5
5
|
field: string;
|
|
6
6
|
operator: RuleOperator;
|
|
@@ -10,22 +10,23 @@ export interface RuleGroup {
|
|
|
10
10
|
condition: "AND" | "OR";
|
|
11
11
|
rules: (RuleGroup | Rule)[];
|
|
12
12
|
}
|
|
13
|
-
export
|
|
13
|
+
export type ValidatedRuleValue<T extends FilterType> = T extends "number" ? number : T extends "boolean" ? boolean : string;
|
|
14
14
|
interface BaseValidatedRule<T extends FilterType, F extends string> {
|
|
15
15
|
type: T;
|
|
16
16
|
field: F;
|
|
17
|
-
|
|
17
|
+
param: string | undefined;
|
|
18
|
+
operator: keyof (typeof operatorsByType)[T];
|
|
18
19
|
value: ValidatedRuleValue<T>[];
|
|
19
20
|
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
export
|
|
21
|
+
type ValidatedNumberRule<Field extends string> = BaseValidatedRule<"number", Field>;
|
|
22
|
+
type ValidatedStringRule<Field extends string> = BaseValidatedRule<Exclude<FilterType, "number" | "boolean">, Field>;
|
|
23
|
+
type ValidatedBooleanRule<Field extends string> = BaseValidatedRule<"boolean", Field>;
|
|
24
|
+
export type ValidatedRule<Field extends string> = ValidatedNumberRule<Field> | ValidatedStringRule<Field> | ValidatedBooleanRule<Field>;
|
|
24
25
|
export interface ValidatedRuleGroup<Field extends string> {
|
|
25
26
|
condition: "AND" | "OR";
|
|
26
27
|
rules: (ValidatedRuleGroup<Field> | ValidatedRule<Field>)[];
|
|
27
28
|
}
|
|
28
|
-
export
|
|
29
|
+
export type FilterType = "text" | "date" | "number" | "boolean" | "array" | "enum" | "contact" | "custom";
|
|
29
30
|
interface BaseFilterArgs {
|
|
30
31
|
type: FilterType;
|
|
31
32
|
nullable?: boolean;
|
|
@@ -37,8 +38,8 @@ export interface EnumFilterArgs<T extends readonly string[] = readonly string[]>
|
|
|
37
38
|
export interface OtherFilterArgs extends BaseFilterArgs {
|
|
38
39
|
type: Exclude<FilterType, "enum">;
|
|
39
40
|
}
|
|
40
|
-
export
|
|
41
|
-
export
|
|
41
|
+
export type FilterArgs = EnumFilterArgs | OtherFilterArgs;
|
|
42
|
+
export type Filters<T extends string = string> = Record<T, FilterArgs>;
|
|
42
43
|
export interface RuleOperatorParams {
|
|
43
44
|
args: number;
|
|
44
45
|
}
|
|
@@ -50,34 +51,35 @@ export declare const nullableOperators: {
|
|
|
50
51
|
args: number;
|
|
51
52
|
};
|
|
52
53
|
};
|
|
54
|
+
type OperatorsByType = Record<FilterType, Partial<Record<RuleOperator, RuleOperatorParams>>>;
|
|
53
55
|
export declare const operatorsByType: {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
56
|
+
text: {
|
|
57
|
+
begins_with: {
|
|
58
|
+
args: number;
|
|
57
59
|
};
|
|
58
|
-
|
|
59
|
-
|
|
60
|
+
ends_with: {
|
|
61
|
+
args: number;
|
|
60
62
|
};
|
|
61
|
-
|
|
62
|
-
|
|
63
|
+
not_begins_with: {
|
|
64
|
+
args: number;
|
|
63
65
|
};
|
|
64
|
-
|
|
65
|
-
|
|
66
|
+
not_ends_with: {
|
|
67
|
+
args: number;
|
|
66
68
|
};
|
|
67
|
-
|
|
69
|
+
contains: {
|
|
68
70
|
args: number;
|
|
69
71
|
};
|
|
70
|
-
|
|
72
|
+
not_contains: {
|
|
71
73
|
args: number;
|
|
72
74
|
};
|
|
73
|
-
|
|
75
|
+
equal: {
|
|
74
76
|
args: number;
|
|
75
77
|
};
|
|
76
|
-
|
|
78
|
+
not_equal: {
|
|
77
79
|
args: number;
|
|
78
80
|
};
|
|
79
81
|
};
|
|
80
|
-
|
|
82
|
+
date: {
|
|
81
83
|
between: {
|
|
82
84
|
args: number;
|
|
83
85
|
};
|
|
@@ -103,7 +105,7 @@ export declare const operatorsByType: {
|
|
|
103
105
|
args: number;
|
|
104
106
|
};
|
|
105
107
|
};
|
|
106
|
-
|
|
108
|
+
number: {
|
|
107
109
|
between: {
|
|
108
110
|
args: number;
|
|
109
111
|
};
|
|
@@ -129,12 +131,12 @@ export declare const operatorsByType: {
|
|
|
129
131
|
args: number;
|
|
130
132
|
};
|
|
131
133
|
};
|
|
132
|
-
|
|
133
|
-
|
|
134
|
+
boolean: {
|
|
135
|
+
equal: {
|
|
134
136
|
args: number;
|
|
135
137
|
};
|
|
136
138
|
};
|
|
137
|
-
|
|
139
|
+
array: {
|
|
138
140
|
contains: {
|
|
139
141
|
args: number;
|
|
140
142
|
};
|
|
@@ -142,7 +144,15 @@ export declare const operatorsByType: {
|
|
|
142
144
|
args: number;
|
|
143
145
|
};
|
|
144
146
|
};
|
|
145
|
-
|
|
147
|
+
enum: {
|
|
148
|
+
equal: {
|
|
149
|
+
args: number;
|
|
150
|
+
};
|
|
151
|
+
not_equal: {
|
|
152
|
+
args: number;
|
|
153
|
+
};
|
|
154
|
+
};
|
|
155
|
+
contact: {
|
|
146
156
|
equal: {
|
|
147
157
|
args: number;
|
|
148
158
|
};
|
|
@@ -150,16 +160,52 @@ export declare const operatorsByType: {
|
|
|
150
160
|
args: number;
|
|
151
161
|
};
|
|
152
162
|
};
|
|
153
|
-
|
|
163
|
+
custom: {
|
|
164
|
+
between: {
|
|
165
|
+
args: number;
|
|
166
|
+
};
|
|
167
|
+
not_between: {
|
|
168
|
+
args: number;
|
|
169
|
+
};
|
|
170
|
+
less: {
|
|
171
|
+
args: number;
|
|
172
|
+
};
|
|
173
|
+
greater: {
|
|
174
|
+
args: number;
|
|
175
|
+
};
|
|
176
|
+
less_or_equal: {
|
|
177
|
+
args: number;
|
|
178
|
+
};
|
|
179
|
+
greater_or_equal: {
|
|
180
|
+
args: number;
|
|
181
|
+
};
|
|
154
182
|
equal: {
|
|
155
183
|
args: number;
|
|
156
184
|
};
|
|
157
185
|
not_equal: {
|
|
158
186
|
args: number;
|
|
159
187
|
};
|
|
188
|
+
begins_with: {
|
|
189
|
+
args: number;
|
|
190
|
+
};
|
|
191
|
+
ends_with: {
|
|
192
|
+
args: number;
|
|
193
|
+
};
|
|
194
|
+
not_begins_with: {
|
|
195
|
+
args: number;
|
|
196
|
+
};
|
|
197
|
+
not_ends_with: {
|
|
198
|
+
args: number;
|
|
199
|
+
};
|
|
200
|
+
contains: {
|
|
201
|
+
args: number;
|
|
202
|
+
};
|
|
203
|
+
not_contains: {
|
|
204
|
+
args: number;
|
|
205
|
+
};
|
|
160
206
|
};
|
|
161
207
|
};
|
|
162
|
-
export declare const operatorsByTypeMap:
|
|
208
|
+
export declare const operatorsByTypeMap: OperatorsByType;
|
|
163
209
|
export interface Paginated<T> {
|
|
164
210
|
items: T[];
|
|
165
211
|
offset: number;
|
|
@@ -1,27 +1,27 @@
|
|
|
1
1
|
import { ItemStatus } from "../data";
|
|
2
2
|
export declare const noticeFilters: {
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
createdAt: {
|
|
4
|
+
type: "date";
|
|
5
5
|
};
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
updatedAt: {
|
|
7
|
+
type: "date";
|
|
8
8
|
};
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
name: {
|
|
10
|
+
type: "text";
|
|
11
11
|
};
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
expires: {
|
|
13
|
+
type: "date";
|
|
14
|
+
nullable: true;
|
|
15
15
|
};
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
enabled: {
|
|
17
|
+
type: "boolean";
|
|
18
18
|
};
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
text: {
|
|
20
|
+
type: "text";
|
|
21
21
|
};
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
status: {
|
|
23
|
+
type: "enum";
|
|
24
|
+
options: ItemStatus[];
|
|
25
25
|
};
|
|
26
26
|
};
|
|
27
|
-
export
|
|
27
|
+
export type NoticeFilterName = keyof typeof noticeFilters;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
export declare const paymentFilters: {
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
contact: {
|
|
3
|
+
type: "contact";
|
|
4
4
|
};
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
chargeDate: {
|
|
6
|
+
type: "date";
|
|
7
7
|
};
|
|
8
8
|
};
|
|
9
|
-
export
|
|
9
|
+
export type PaymentFilterName = keyof typeof paymentFilters;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
declare const dateUnits: readonly ["s", "m", "h", "d", "M", "y"];
|
|
2
|
-
|
|
2
|
+
type DateUnit = (typeof dateUnits)[number];
|
|
3
3
|
export declare function parseDate(value: string, now?: Date): [Date, DateUnit];
|
|
4
4
|
export declare function getMinDateUnit(units: [DateUnit, ...DateUnit[]]): DateUnit;
|
|
5
5
|
export declare function getMinDateUnit(units: DateUnit[]): DateUnit | undefined;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@beabee/beabee-common",
|
|
3
|
-
"version": "1.10.
|
|
3
|
+
"version": "1.10.4",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "./dist/cjs/index.js",
|
|
6
6
|
"module": "./dist/esm/index.js",
|
|
@@ -24,12 +24,12 @@
|
|
|
24
24
|
},
|
|
25
25
|
"homepage": "https://github.com/beabee-communityrm/beabee-common#readme",
|
|
26
26
|
"devDependencies": {
|
|
27
|
-
"@tsconfig/recommended": "^1.0.
|
|
28
|
-
"jest": "^29.3.
|
|
29
|
-
"prettier": "^2.
|
|
30
|
-
"rimraf": "^
|
|
31
|
-
"ts-jest": "^29.0.
|
|
32
|
-
"typescript": "^4.
|
|
27
|
+
"@tsconfig/recommended": "^1.0.2",
|
|
28
|
+
"jest": "^29.3.1",
|
|
29
|
+
"prettier": "^2.8.3",
|
|
30
|
+
"rimraf": "^4.1.1",
|
|
31
|
+
"ts-jest": "^29.0.5",
|
|
32
|
+
"typescript": "^4.9.4"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"date-fns": "^2.29.3"
|