@beabee/beabee-common 1.19.7 → 1.19.8
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/data/callouts.js +2 -0
- package/dist/cjs/data/index.js +67 -0
- package/dist/cjs/error/InvalidRule.js +11 -0
- package/dist/cjs/error/index.js +8 -0
- package/dist/cjs/index.js +23 -0
- package/dist/cjs/search/api-keys.js +11 -0
- package/dist/cjs/search/callouts.js +101 -0
- package/dist/cjs/search/contacts.js +78 -0
- package/dist/cjs/search/index.js +81 -0
- package/dist/cjs/search/notices.js +37 -0
- package/dist/cjs/search/payments.js +27 -0
- package/dist/cjs/utils/callouts.js +118 -0
- package/dist/cjs/utils/date.js +77 -0
- package/dist/cjs/utils/payments.js +31 -0
- package/dist/cjs/utils/rules.js +69 -0
- package/dist/esm/data/callouts.js +1 -0
- package/dist/esm/data/index.js +50 -57
- package/dist/esm/error/InvalidRule.js +7 -10
- package/dist/esm/error/index.js +2 -1
- package/dist/esm/index.js +7 -4
- package/dist/esm/search/api-keys.js +7 -10
- package/dist/esm/search/callouts.js +94 -100
- package/dist/esm/search/contacts.js +74 -83
- package/dist/esm/search/index.js +64 -6
- package/dist/esm/search/notices.js +33 -36
- package/dist/esm/search/payments.js +23 -26
- package/dist/esm/utils/callouts.js +93 -91
- package/dist/esm/utils/date.js +56 -56
- package/dist/esm/utils/payments.js +23 -25
- package/dist/esm/utils/rules.js +58 -75
- package/dist/types/data/callouts.d.ts +74 -0
- package/dist/types/data/index.d.ts +4 -0
- package/dist/types/error/InvalidRule.d.ts +2 -2
- package/dist/types/error/index.d.ts +2 -1
- package/dist/types/index.d.ts +7 -5
- package/dist/types/search/api-keys.d.ts +1 -0
- package/dist/types/search/callouts.d.ts +5 -1
- package/dist/types/search/contacts.d.ts +1 -2
- package/dist/types/search/index.d.ts +194 -6
- package/dist/types/search/notices.d.ts +2 -1
- package/dist/types/search/payments.d.ts +2 -1
- package/dist/types/utils/callouts.d.ts +3 -1
- package/dist/types/utils/date.d.ts +3 -3
- package/dist/types/utils/payments.d.ts +7 -1
- package/dist/types/utils/rules.d.ts +1 -1
- package/package.json +12 -31
- package/README.md +0 -41
- package/dist/cjs/data/index.cjs +0 -87
- package/dist/cjs/error/InvalidRule.cjs +0 -35
- package/dist/cjs/error/index.cjs +0 -22
- package/dist/cjs/index.cjs +0 -28
- package/dist/cjs/search/api-keys.cjs +0 -35
- package/dist/cjs/search/callouts.cjs +0 -131
- package/dist/cjs/search/contacts.cjs +0 -105
- package/dist/cjs/search/index.cjs +0 -32
- package/dist/cjs/search/notices.cjs +0 -61
- package/dist/cjs/search/operators.cjs +0 -89
- package/dist/cjs/search/payments.cjs +0 -51
- package/dist/cjs/types/api-key-filter-name.cjs +0 -16
- package/dist/cjs/types/array-filter-args.cjs +0 -16
- package/dist/cjs/types/base-callout-component-schema.cjs +0 -16
- package/dist/cjs/types/base-filter-args.cjs +0 -16
- package/dist/cjs/types/base-validated-rule.cjs +0 -16
- package/dist/cjs/types/callout-component-schema.cjs +0 -16
- package/dist/cjs/types/callout-filter-name.cjs +0 -16
- package/dist/cjs/types/callout-form-schema.cjs +0 -16
- package/dist/cjs/types/callout-navigation-schema.cjs +0 -16
- package/dist/cjs/types/callout-response-answer-address.cjs +0 -16
- package/dist/cjs/types/callout-response-answer-file-upload.cjs +0 -16
- package/dist/cjs/types/callout-response-answer.cjs +0 -16
- package/dist/cjs/types/callout-response-answers.cjs +0 -16
- package/dist/cjs/types/callout-response-comment-filter-name.cjs +0 -16
- package/dist/cjs/types/callout-response-filter-name.cjs +0 -16
- package/dist/cjs/types/callout-slide-schema.cjs +0 -16
- package/dist/cjs/types/callout-tag-filter-name.cjs +0 -16
- package/dist/cjs/types/content-callout-component-schema.cjs +0 -16
- package/dist/cjs/types/date-unit.cjs +0 -16
- package/dist/cjs/types/duration.cjs +0 -16
- package/dist/cjs/types/enum-filter-args.cjs +0 -16
- package/dist/cjs/types/feeable.cjs +0 -16
- package/dist/cjs/types/filter-args.cjs +0 -16
- package/dist/cjs/types/filter-type.cjs +0 -16
- package/dist/cjs/types/filters.cjs +0 -16
- package/dist/cjs/types/index.cjs +0 -120
- package/dist/cjs/types/input-callout-component-schema.cjs +0 -16
- package/dist/cjs/types/input-file-callout-component-schema.cjs +0 -16
- package/dist/cjs/types/nestable-callout-component-schema.cjs +0 -16
- package/dist/cjs/types/notice-filter-name.cjs +0 -16
- package/dist/cjs/types/operators-by-type.cjs +0 -16
- package/dist/cjs/types/other-filter-args.cjs +0 -16
- package/dist/cjs/types/paginated-query.cjs +0 -16
- package/dist/cjs/types/paginated.cjs +0 -16
- package/dist/cjs/types/payment-filter-name.cjs +0 -16
- package/dist/cjs/types/radio-callout-component-schema.cjs +0 -16
- package/dist/cjs/types/role-type.cjs +0 -16
- package/dist/cjs/types/rule-group.cjs +0 -16
- package/dist/cjs/types/rule-operator.cjs +0 -16
- package/dist/cjs/types/rule-opperator-params.cjs +0 -16
- package/dist/cjs/types/rule-value.cjs +0 -16
- package/dist/cjs/types/rule.cjs +0 -16
- package/dist/cjs/types/select-callout-component-schema.cjs +0 -16
- package/dist/cjs/types/stripe-fee-country.cjs +0 -16
- package/dist/cjs/types/unit-matches.cjs +0 -16
- package/dist/cjs/types/validated-boolean-rule.cjs +0 -16
- package/dist/cjs/types/validated-number-rule.cjs +0 -16
- package/dist/cjs/types/validated-rule-group.cjs +0 -16
- package/dist/cjs/types/validated-rule-value.cjs +0 -16
- package/dist/cjs/types/validated-rule.cjs +0 -16
- package/dist/cjs/types/validated-string-rule.cjs +0 -16
- package/dist/cjs/utils/callouts.cjs +0 -137
- package/dist/cjs/utils/date.cjs +0 -87
- package/dist/cjs/utils/index.cjs +0 -28
- package/dist/cjs/utils/payments.cjs +0 -53
- package/dist/cjs/utils/rules.cjs +0 -109
- package/dist/esm/search/operators.js +0 -62
- package/dist/esm/types/api-key-filter-name.js +0 -0
- package/dist/esm/types/array-filter-args.js +0 -0
- package/dist/esm/types/base-callout-component-schema.js +0 -0
- package/dist/esm/types/base-filter-args.js +0 -0
- package/dist/esm/types/base-validated-rule.js +0 -0
- package/dist/esm/types/callout-component-schema.js +0 -0
- package/dist/esm/types/callout-filter-name.js +0 -0
- package/dist/esm/types/callout-form-schema.js +0 -0
- package/dist/esm/types/callout-navigation-schema.js +0 -0
- package/dist/esm/types/callout-response-answer-address.js +0 -0
- package/dist/esm/types/callout-response-answer-file-upload.js +0 -0
- package/dist/esm/types/callout-response-answer.js +0 -0
- package/dist/esm/types/callout-response-answers.js +0 -0
- package/dist/esm/types/callout-response-comment-filter-name.js +0 -0
- package/dist/esm/types/callout-response-filter-name.js +0 -0
- package/dist/esm/types/callout-slide-schema.js +0 -0
- package/dist/esm/types/callout-tag-filter-name.js +0 -0
- package/dist/esm/types/content-callout-component-schema.js +0 -0
- package/dist/esm/types/date-unit.js +0 -0
- package/dist/esm/types/duration.js +0 -0
- package/dist/esm/types/enum-filter-args.js +0 -0
- package/dist/esm/types/feeable.js +0 -0
- package/dist/esm/types/filter-args.js +0 -0
- package/dist/esm/types/filter-type.js +0 -0
- package/dist/esm/types/filters.js +0 -0
- package/dist/esm/types/index.js +0 -50
- package/dist/esm/types/input-callout-component-schema.js +0 -0
- package/dist/esm/types/input-file-callout-component-schema.js +0 -0
- package/dist/esm/types/nestable-callout-component-schema.js +0 -0
- package/dist/esm/types/notice-filter-name.js +0 -0
- package/dist/esm/types/operators-by-type.js +0 -0
- package/dist/esm/types/other-filter-args.js +0 -0
- package/dist/esm/types/paginated-query.js +0 -0
- package/dist/esm/types/paginated.js +0 -0
- package/dist/esm/types/payment-filter-name.js +0 -0
- package/dist/esm/types/radio-callout-component-schema.js +0 -0
- package/dist/esm/types/role-type.js +0 -0
- package/dist/esm/types/rule-group.js +0 -0
- package/dist/esm/types/rule-operator.js +0 -0
- package/dist/esm/types/rule-opperator-params.js +0 -0
- package/dist/esm/types/rule-value.js +0 -0
- package/dist/esm/types/rule.js +0 -0
- package/dist/esm/types/select-callout-component-schema.js +0 -0
- package/dist/esm/types/stripe-fee-country.js +0 -0
- package/dist/esm/types/unit-matches.js +0 -0
- package/dist/esm/types/validated-boolean-rule.js +0 -0
- package/dist/esm/types/validated-number-rule.js +0 -0
- package/dist/esm/types/validated-rule-group.js +0 -0
- package/dist/esm/types/validated-rule-value.js +0 -0
- package/dist/esm/types/validated-rule.js +0 -0
- package/dist/esm/types/validated-string-rule.js +0 -0
- package/dist/esm/utils/index.js +0 -4
- package/dist/types/search/operators.d.ts +0 -128
- package/dist/types/types/api-key-filter-name.d.ts +0 -2
- package/dist/types/types/array-filter-args.d.ts +0 -5
- package/dist/types/types/base-callout-component-schema.d.ts +0 -9
- package/dist/types/types/base-filter-args.d.ts +0 -5
- package/dist/types/types/base-validated-rule.d.ts +0 -9
- package/dist/types/types/callout-component-schema.d.ts +0 -2
- package/dist/types/types/callout-filter-name.d.ts +0 -2
- package/dist/types/types/callout-form-schema.d.ts +0 -4
- package/dist/types/types/callout-navigation-schema.d.ts +0 -6
- package/dist/types/types/callout-response-answer-address.d.ts +0 -9
- package/dist/types/types/callout-response-answer-file-upload.d.ts +0 -3
- package/dist/types/types/callout-response-answer.d.ts +0 -2
- package/dist/types/types/callout-response-answers.d.ts +0 -5
- package/dist/types/types/callout-response-comment-filter-name.d.ts +0 -2
- package/dist/types/types/callout-response-filter-name.d.ts +0 -2
- package/dist/types/types/callout-slide-schema.d.ts +0 -7
- package/dist/types/types/callout-tag-filter-name.d.ts +0 -2
- package/dist/types/types/content-callout-component-schema.d.ts +0 -5
- package/dist/types/types/date-unit.d.ts +0 -2
- package/dist/types/types/duration.d.ts +0 -1
- package/dist/types/types/enum-filter-args.d.ts +0 -5
- package/dist/types/types/feeable.d.ts +0 -6
- package/dist/types/types/filter-args.d.ts +0 -2
- package/dist/types/types/filter-type.d.ts +0 -1
- package/dist/types/types/filters.d.ts +0 -2
- package/dist/types/types/index.d.ts +0 -50
- package/dist/types/types/input-callout-component-schema.d.ts +0 -6
- package/dist/types/types/input-file-callout-component-schema.d.ts +0 -5
- package/dist/types/types/nestable-callout-component-schema.d.ts +0 -6
- package/dist/types/types/notice-filter-name.d.ts +0 -2
- package/dist/types/types/operators-by-type.d.ts +0 -2
- package/dist/types/types/other-filter-args.d.ts +0 -4
- package/dist/types/types/paginated-query.d.ts +0 -8
- package/dist/types/types/paginated.d.ts +0 -6
- package/dist/types/types/payment-filter-name.d.ts +0 -2
- package/dist/types/types/radio-callout-component-schema.d.ts +0 -10
- package/dist/types/types/role-type.d.ts +0 -2
- package/dist/types/types/rule-group.d.ts +0 -5
- package/dist/types/types/rule-operator.d.ts +0 -2
- package/dist/types/types/rule-opperator-params.d.ts +0 -3
- package/dist/types/types/rule-value.d.ts +0 -1
- package/dist/types/types/rule.d.ts +0 -6
- package/dist/types/types/select-callout-component-schema.d.ts +0 -11
- package/dist/types/types/stripe-fee-country.d.ts +0 -1
- package/dist/types/types/unit-matches.d.ts +0 -2
- package/dist/types/types/validated-boolean-rule.d.ts +0 -2
- package/dist/types/types/validated-number-rule.d.ts +0 -2
- package/dist/types/types/validated-rule-group.d.ts +0 -5
- package/dist/types/types/validated-rule-value.d.ts +0 -2
- package/dist/types/types/validated-rule.d.ts +0 -2
- package/dist/types/types/validated-string-rule.d.ts +0 -2
- package/dist/types/utils/index.d.ts +0 -4
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.validateRuleGroup = exports.validateRule = exports.isRuleGroup = void 0;
|
|
4
|
+
const error_1 = require("../error");
|
|
5
|
+
const search_1 = require("../search");
|
|
6
|
+
const date_1 = require("./date");
|
|
7
|
+
function isRuleGroup(ruleOrGroup) {
|
|
8
|
+
return "condition" in ruleOrGroup;
|
|
9
|
+
}
|
|
10
|
+
exports.isRuleGroup = isRuleGroup;
|
|
11
|
+
function validateRule(filters, rule) {
|
|
12
|
+
const filter = filters[rule.field];
|
|
13
|
+
if (!filter) {
|
|
14
|
+
throw new error_1.InvalidRule(rule, `Invalid field: ${rule.field}`);
|
|
15
|
+
}
|
|
16
|
+
let expectedArgs = 0;
|
|
17
|
+
if (rule.operator in search_1.nullableOperators) {
|
|
18
|
+
// Field cannot be empty (except text which can always be empty)
|
|
19
|
+
if (!filter.nullable && filter.type !== "text") {
|
|
20
|
+
throw new error_1.InvalidRule(rule, `Invalid nullable operator: field is not nullable`);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
const operator = search_1.operatorsByTypeMap[filter.type][rule.operator];
|
|
25
|
+
if (!operator) {
|
|
26
|
+
throw new error_1.InvalidRule(rule, `Invalid operator for type: ${filter.type} type doesn't define ${rule.operator}`);
|
|
27
|
+
}
|
|
28
|
+
expectedArgs = operator.args;
|
|
29
|
+
}
|
|
30
|
+
if (expectedArgs !== rule.value.length) {
|
|
31
|
+
throw new error_1.InvalidRule(rule, `Invalid operator argument count: ${rule.operator} needs ${expectedArgs}, ${rule.value.length} given`);
|
|
32
|
+
}
|
|
33
|
+
const expectedType = filter.type === "boolean" || filter.type === "number"
|
|
34
|
+
? filter.type
|
|
35
|
+
: "string";
|
|
36
|
+
if (rule.value.some((v) => typeof v !== expectedType)) {
|
|
37
|
+
throw new error_1.InvalidRule(rule, `Invalid operator argument type: ${rule.operator} needs ${expectedType}, ${rule.value.map((v) => typeof v)} given`);
|
|
38
|
+
}
|
|
39
|
+
if (filter.type === "date" &&
|
|
40
|
+
rule.value.some((v) => !(0, date_1.isValidDate)(v))) {
|
|
41
|
+
throw new error_1.InvalidRule(rule, `Invalid operator argument: date type needs valid absolute or relative date, ${rule.value} given`);
|
|
42
|
+
}
|
|
43
|
+
if ((filter.type === "enum" || filter.type === "array") &&
|
|
44
|
+
rule.value.some((v) => filter.options?.indexOf(v) === -1)) {
|
|
45
|
+
throw new error_1.InvalidRule(rule, `Invalid operator argument: ${filter.type} type expected ${filter.options}, ${rule.value} given`);
|
|
46
|
+
}
|
|
47
|
+
return {
|
|
48
|
+
field: rule.field,
|
|
49
|
+
type: filter.type,
|
|
50
|
+
nullable: !!filter.nullable,
|
|
51
|
+
operator: rule.operator,
|
|
52
|
+
value: rule.value,
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
exports.validateRule = validateRule;
|
|
56
|
+
function validateRuleGroup(filters, ruleGroup) {
|
|
57
|
+
const validatedRuleGroup = {
|
|
58
|
+
condition: ruleGroup.condition,
|
|
59
|
+
rules: [],
|
|
60
|
+
};
|
|
61
|
+
for (const rule of ruleGroup.rules) {
|
|
62
|
+
const valid = isRuleGroup(rule)
|
|
63
|
+
? validateRuleGroup(filters, rule)
|
|
64
|
+
: validateRule(filters, rule);
|
|
65
|
+
validatedRuleGroup.rules.push(valid);
|
|
66
|
+
}
|
|
67
|
+
return validatedRuleGroup;
|
|
68
|
+
}
|
|
69
|
+
exports.validateRuleGroup = validateRuleGroup;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/esm/data/index.js
CHANGED
|
@@ -1,57 +1,50 @@
|
|
|
1
|
-
var ContributionPeriod
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
})(ContributionPeriod || {});
|
|
6
|
-
var ContributionType
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
})(ContributionType || {});
|
|
13
|
-
var ItemStatus
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
})(ItemStatus || {});
|
|
20
|
-
var MembershipStatus
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
})(MembershipStatus || {});
|
|
27
|
-
var NewsletterStatus
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
})(NewsletterStatus || {});
|
|
35
|
-
var PaymentMethod
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
})(PaymentMethod || {});
|
|
42
|
-
var PaymentStatus
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
})(PaymentStatus || {});
|
|
49
|
-
export
|
|
50
|
-
|
|
51
|
-
ContributionType,
|
|
52
|
-
ItemStatus,
|
|
53
|
-
MembershipStatus,
|
|
54
|
-
NewsletterStatus,
|
|
55
|
-
PaymentMethod,
|
|
56
|
-
PaymentStatus
|
|
57
|
-
};
|
|
1
|
+
export var ContributionPeriod;
|
|
2
|
+
(function (ContributionPeriod) {
|
|
3
|
+
ContributionPeriod["Monthly"] = "monthly";
|
|
4
|
+
ContributionPeriod["Annually"] = "annually";
|
|
5
|
+
})(ContributionPeriod || (ContributionPeriod = {}));
|
|
6
|
+
export var ContributionType;
|
|
7
|
+
(function (ContributionType) {
|
|
8
|
+
ContributionType["Automatic"] = "Automatic";
|
|
9
|
+
ContributionType["Manual"] = "Manual";
|
|
10
|
+
ContributionType["Gift"] = "Gift";
|
|
11
|
+
ContributionType["None"] = "None";
|
|
12
|
+
})(ContributionType || (ContributionType = {}));
|
|
13
|
+
export var ItemStatus;
|
|
14
|
+
(function (ItemStatus) {
|
|
15
|
+
ItemStatus["Draft"] = "draft";
|
|
16
|
+
ItemStatus["Scheduled"] = "scheduled";
|
|
17
|
+
ItemStatus["Open"] = "open";
|
|
18
|
+
ItemStatus["Ended"] = "ended";
|
|
19
|
+
})(ItemStatus || (ItemStatus = {}));
|
|
20
|
+
export var MembershipStatus;
|
|
21
|
+
(function (MembershipStatus) {
|
|
22
|
+
MembershipStatus["Active"] = "active";
|
|
23
|
+
MembershipStatus["Expiring"] = "expiring";
|
|
24
|
+
MembershipStatus["Expired"] = "expired";
|
|
25
|
+
MembershipStatus["None"] = "none";
|
|
26
|
+
})(MembershipStatus || (MembershipStatus = {}));
|
|
27
|
+
export var NewsletterStatus;
|
|
28
|
+
(function (NewsletterStatus) {
|
|
29
|
+
NewsletterStatus["Subscribed"] = "subscribed";
|
|
30
|
+
NewsletterStatus["Unsubscribed"] = "unsubscribed";
|
|
31
|
+
NewsletterStatus["Cleaned"] = "cleaned";
|
|
32
|
+
NewsletterStatus["Pending"] = "pending";
|
|
33
|
+
NewsletterStatus["None"] = "none";
|
|
34
|
+
})(NewsletterStatus || (NewsletterStatus = {}));
|
|
35
|
+
export var PaymentMethod;
|
|
36
|
+
(function (PaymentMethod) {
|
|
37
|
+
PaymentMethod["StripeCard"] = "s_card";
|
|
38
|
+
PaymentMethod["StripeSEPA"] = "s_sepa";
|
|
39
|
+
PaymentMethod["StripeBACS"] = "s_bacs";
|
|
40
|
+
PaymentMethod["GoCardlessDirectDebit"] = "gc_direct-debit";
|
|
41
|
+
})(PaymentMethod || (PaymentMethod = {}));
|
|
42
|
+
export var PaymentStatus;
|
|
43
|
+
(function (PaymentStatus) {
|
|
44
|
+
PaymentStatus["Pending"] = "pending";
|
|
45
|
+
PaymentStatus["Successful"] = "successful";
|
|
46
|
+
PaymentStatus["Failed"] = "failed";
|
|
47
|
+
PaymentStatus["Cancelled"] = "cancelled";
|
|
48
|
+
})(PaymentStatus || (PaymentStatus = {}));
|
|
49
|
+
export const RoleTypes = ["member", "admin", "superadmin"];
|
|
50
|
+
export * from "./callouts";
|
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
class InvalidRule extends Error {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
export default class InvalidRule extends Error {
|
|
2
|
+
constructor(rule, message) {
|
|
3
|
+
super();
|
|
4
|
+
this.rule = rule;
|
|
5
|
+
this.message = message;
|
|
6
|
+
Object.setPrototypeOf(this, InvalidRule.prototype);
|
|
7
|
+
}
|
|
8
8
|
}
|
|
9
|
-
export {
|
|
10
|
-
InvalidRule
|
|
11
|
-
};
|
package/dist/esm/error/index.js
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import InvalidRule from "./InvalidRule";
|
|
2
|
+
export { InvalidRule };
|
package/dist/esm/index.js
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
export * from "./
|
|
2
|
-
export * from "./
|
|
3
|
-
export * from "./
|
|
4
|
-
export * from "./utils/
|
|
1
|
+
export * from "./search";
|
|
2
|
+
export * from "./data";
|
|
3
|
+
export * from "./error";
|
|
4
|
+
export * from "./utils/callouts";
|
|
5
|
+
export * from "./utils/date";
|
|
6
|
+
export * from "./utils/payments";
|
|
7
|
+
export * from "./utils/rules";
|
|
@@ -1,104 +1,98 @@
|
|
|
1
|
-
import { ItemStatus } from "../data
|
|
2
|
-
const calloutFilters = {
|
|
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
|
-
|
|
1
|
+
import { ItemStatus } from "../data";
|
|
2
|
+
export const calloutFilters = {
|
|
3
|
+
slug: {
|
|
4
|
+
type: "text",
|
|
5
|
+
},
|
|
6
|
+
title: {
|
|
7
|
+
type: "text",
|
|
8
|
+
},
|
|
9
|
+
status: {
|
|
10
|
+
type: "enum",
|
|
11
|
+
options: [
|
|
12
|
+
ItemStatus.Draft,
|
|
13
|
+
ItemStatus.Scheduled,
|
|
14
|
+
ItemStatus.Open,
|
|
15
|
+
ItemStatus.Ended,
|
|
16
|
+
],
|
|
17
|
+
},
|
|
18
|
+
answeredBy: {
|
|
19
|
+
type: "contact",
|
|
20
|
+
},
|
|
21
|
+
starts: {
|
|
22
|
+
type: "date",
|
|
23
|
+
nullable: true,
|
|
24
|
+
},
|
|
25
|
+
expires: {
|
|
26
|
+
type: "date",
|
|
27
|
+
nullable: true,
|
|
28
|
+
},
|
|
29
|
+
hidden: {
|
|
30
|
+
type: "boolean",
|
|
31
|
+
},
|
|
32
32
|
};
|
|
33
|
-
const calloutResponseFilters = {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
33
|
+
export const calloutResponseFilters = {
|
|
34
|
+
id: {
|
|
35
|
+
type: "text",
|
|
36
|
+
},
|
|
37
|
+
contact: {
|
|
38
|
+
type: "contact",
|
|
39
|
+
nullable: true,
|
|
40
|
+
},
|
|
41
|
+
callout: {
|
|
42
|
+
type: "text",
|
|
43
|
+
},
|
|
44
|
+
createdAt: {
|
|
45
|
+
type: "date",
|
|
46
|
+
},
|
|
47
|
+
updatedAt: {
|
|
48
|
+
type: "date",
|
|
49
|
+
},
|
|
50
|
+
bucket: {
|
|
51
|
+
type: "text",
|
|
52
|
+
nullable: true,
|
|
53
|
+
},
|
|
54
|
+
tags: {
|
|
55
|
+
type: "array",
|
|
56
|
+
},
|
|
57
|
+
assignee: {
|
|
58
|
+
type: "contact",
|
|
59
|
+
nullable: true,
|
|
60
|
+
},
|
|
61
|
+
answers: {
|
|
62
|
+
type: "blob",
|
|
63
|
+
},
|
|
64
64
|
};
|
|
65
|
-
const calloutResponseCommentFilters = {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
65
|
+
export const calloutResponseCommentFilters = {
|
|
66
|
+
id: {
|
|
67
|
+
type: "text",
|
|
68
|
+
},
|
|
69
|
+
responseId: {
|
|
70
|
+
type: "text",
|
|
71
|
+
},
|
|
72
|
+
contact: {
|
|
73
|
+
type: "contact",
|
|
74
|
+
},
|
|
75
|
+
createdAt: {
|
|
76
|
+
type: "date",
|
|
77
|
+
},
|
|
78
|
+
updatedAt: {
|
|
79
|
+
type: "date",
|
|
80
|
+
},
|
|
81
|
+
text: {
|
|
82
|
+
type: "text",
|
|
83
|
+
},
|
|
84
84
|
};
|
|
85
|
-
const calloutTagFilters = {
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
};
|
|
99
|
-
export {
|
|
100
|
-
calloutFilters,
|
|
101
|
-
calloutResponseCommentFilters,
|
|
102
|
-
calloutResponseFilters,
|
|
103
|
-
calloutTagFilters
|
|
85
|
+
export const calloutTagFilters = {
|
|
86
|
+
id: {
|
|
87
|
+
type: "text",
|
|
88
|
+
},
|
|
89
|
+
name: {
|
|
90
|
+
type: "text",
|
|
91
|
+
},
|
|
92
|
+
description: {
|
|
93
|
+
type: "text",
|
|
94
|
+
},
|
|
95
|
+
calloutSlug: {
|
|
96
|
+
type: "text",
|
|
97
|
+
},
|
|
104
98
|
};
|
|
@@ -1,84 +1,75 @@
|
|
|
1
|
-
import {
|
|
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
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
},
|
|
76
|
-
tags: {
|
|
77
|
-
type: "array",
|
|
78
|
-
nullable: true
|
|
79
|
-
}
|
|
80
|
-
};
|
|
81
|
-
export {
|
|
82
|
-
RoleTypes,
|
|
83
|
-
contactFilters
|
|
1
|
+
import { ContributionPeriod, ContributionType, NewsletterStatus, RoleTypes, } from "../data";
|
|
2
|
+
export const contactFilters = {
|
|
3
|
+
id: {
|
|
4
|
+
type: "contact",
|
|
5
|
+
},
|
|
6
|
+
firstname: {
|
|
7
|
+
type: "text",
|
|
8
|
+
},
|
|
9
|
+
lastname: {
|
|
10
|
+
type: "text",
|
|
11
|
+
},
|
|
12
|
+
email: {
|
|
13
|
+
type: "text",
|
|
14
|
+
},
|
|
15
|
+
joined: {
|
|
16
|
+
type: "date",
|
|
17
|
+
},
|
|
18
|
+
lastSeen: {
|
|
19
|
+
type: "date",
|
|
20
|
+
},
|
|
21
|
+
contributionCancelled: {
|
|
22
|
+
type: "date",
|
|
23
|
+
nullable: true,
|
|
24
|
+
},
|
|
25
|
+
contributionType: {
|
|
26
|
+
type: "enum",
|
|
27
|
+
options: [
|
|
28
|
+
ContributionType.Automatic,
|
|
29
|
+
ContributionType.Gift,
|
|
30
|
+
ContributionType.Manual,
|
|
31
|
+
ContributionType.None,
|
|
32
|
+
],
|
|
33
|
+
},
|
|
34
|
+
contributionMonthlyAmount: {
|
|
35
|
+
type: "number",
|
|
36
|
+
},
|
|
37
|
+
contributionPeriod: {
|
|
38
|
+
type: "enum",
|
|
39
|
+
options: [ContributionPeriod.Monthly, ContributionPeriod.Annually],
|
|
40
|
+
},
|
|
41
|
+
deliveryOptIn: {
|
|
42
|
+
type: "boolean",
|
|
43
|
+
},
|
|
44
|
+
newsletterStatus: {
|
|
45
|
+
type: "enum",
|
|
46
|
+
options: [
|
|
47
|
+
NewsletterStatus.Subscribed,
|
|
48
|
+
NewsletterStatus.Unsubscribed,
|
|
49
|
+
NewsletterStatus.Cleaned,
|
|
50
|
+
NewsletterStatus.Pending,
|
|
51
|
+
NewsletterStatus.None,
|
|
52
|
+
],
|
|
53
|
+
},
|
|
54
|
+
activePermission: {
|
|
55
|
+
type: "enum",
|
|
56
|
+
options: RoleTypes,
|
|
57
|
+
},
|
|
58
|
+
activeMembership: {
|
|
59
|
+
type: "boolean",
|
|
60
|
+
},
|
|
61
|
+
membershipStarts: {
|
|
62
|
+
type: "date",
|
|
63
|
+
},
|
|
64
|
+
membershipExpires: {
|
|
65
|
+
type: "date",
|
|
66
|
+
},
|
|
67
|
+
manualPaymentSource: {
|
|
68
|
+
type: "text",
|
|
69
|
+
nullable: true,
|
|
70
|
+
},
|
|
71
|
+
tags: {
|
|
72
|
+
type: "array",
|
|
73
|
+
nullable: true,
|
|
74
|
+
},
|
|
84
75
|
};
|
package/dist/esm/search/index.js
CHANGED
|
@@ -1,6 +1,64 @@
|
|
|
1
|
-
|
|
2
|
-
export
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
// *** Definitions for rules ***
|
|
2
|
+
export const ruleOperators = [
|
|
3
|
+
"equal",
|
|
4
|
+
"not_equal",
|
|
5
|
+
"less",
|
|
6
|
+
"less_or_equal",
|
|
7
|
+
"greater",
|
|
8
|
+
"greater_or_equal",
|
|
9
|
+
"between",
|
|
10
|
+
"not_between",
|
|
11
|
+
"begins_with",
|
|
12
|
+
"not_begins_with",
|
|
13
|
+
"contains",
|
|
14
|
+
"not_contains",
|
|
15
|
+
"ends_with",
|
|
16
|
+
"not_ends_with",
|
|
17
|
+
"is_empty",
|
|
18
|
+
"is_not_empty",
|
|
19
|
+
];
|
|
20
|
+
const equalityOperators = {
|
|
21
|
+
equal: { args: 1 },
|
|
22
|
+
not_equal: { args: 1 },
|
|
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
|
+
};
|
|
30
|
+
const numericOperators = {
|
|
31
|
+
...equalityOperators,
|
|
32
|
+
between: { args: 2 },
|
|
33
|
+
not_between: { args: 2 },
|
|
34
|
+
less: { args: 1 },
|
|
35
|
+
greater: { args: 1 },
|
|
36
|
+
less_or_equal: { args: 1 },
|
|
37
|
+
greater_or_equal: { args: 1 },
|
|
38
|
+
};
|
|
39
|
+
const arrayOperators = {
|
|
40
|
+
contains: { args: 1 },
|
|
41
|
+
not_contains: { args: 1 },
|
|
42
|
+
};
|
|
43
|
+
// Special operator can be applied across all fields if they are nullable
|
|
44
|
+
export const nullableOperators = {
|
|
45
|
+
is_empty: { args: 0 },
|
|
46
|
+
is_not_empty: { args: 0 },
|
|
47
|
+
};
|
|
48
|
+
export const operatorsByType = {
|
|
49
|
+
text: { ...equalityOperators, ...arrayOperators, ...stringOperators },
|
|
50
|
+
blob: arrayOperators,
|
|
51
|
+
date: numericOperators,
|
|
52
|
+
number: numericOperators,
|
|
53
|
+
boolean: { equal: equalityOperators.equal },
|
|
54
|
+
array: arrayOperators,
|
|
55
|
+
enum: equalityOperators,
|
|
56
|
+
contact: equalityOperators,
|
|
57
|
+
};
|
|
58
|
+
// More general type to allow mapping while maintaining full type above
|
|
59
|
+
export const operatorsByTypeMap = operatorsByType;
|
|
60
|
+
export * from "./api-keys";
|
|
61
|
+
export * from "./callouts";
|
|
62
|
+
export * from "./contacts";
|
|
63
|
+
export * from "./notices";
|
|
64
|
+
export * from "./payments";
|