@beabee/beabee-common 1.19.7 → 1.19.9
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
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __copyProps = (to, from, except, desc) => {
|
|
7
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
-
for (let key of __getOwnPropNames(from))
|
|
9
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
-
}
|
|
12
|
-
return to;
|
|
13
|
-
};
|
|
14
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
-
var rule_operator_exports = {};
|
|
16
|
-
module.exports = __toCommonJS(rule_operator_exports);
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __copyProps = (to, from, except, desc) => {
|
|
7
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
-
for (let key of __getOwnPropNames(from))
|
|
9
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
-
}
|
|
12
|
-
return to;
|
|
13
|
-
};
|
|
14
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
-
var rule_opperator_params_exports = {};
|
|
16
|
-
module.exports = __toCommonJS(rule_opperator_params_exports);
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __copyProps = (to, from, except, desc) => {
|
|
7
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
-
for (let key of __getOwnPropNames(from))
|
|
9
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
-
}
|
|
12
|
-
return to;
|
|
13
|
-
};
|
|
14
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
-
var rule_value_exports = {};
|
|
16
|
-
module.exports = __toCommonJS(rule_value_exports);
|
package/dist/cjs/types/rule.cjs
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __copyProps = (to, from, except, desc) => {
|
|
7
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
-
for (let key of __getOwnPropNames(from))
|
|
9
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
-
}
|
|
12
|
-
return to;
|
|
13
|
-
};
|
|
14
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
-
var rule_exports = {};
|
|
16
|
-
module.exports = __toCommonJS(rule_exports);
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __copyProps = (to, from, except, desc) => {
|
|
7
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
-
for (let key of __getOwnPropNames(from))
|
|
9
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
-
}
|
|
12
|
-
return to;
|
|
13
|
-
};
|
|
14
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
-
var select_callout_component_schema_exports = {};
|
|
16
|
-
module.exports = __toCommonJS(select_callout_component_schema_exports);
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __copyProps = (to, from, except, desc) => {
|
|
7
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
-
for (let key of __getOwnPropNames(from))
|
|
9
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
-
}
|
|
12
|
-
return to;
|
|
13
|
-
};
|
|
14
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
-
var stripe_fee_country_exports = {};
|
|
16
|
-
module.exports = __toCommonJS(stripe_fee_country_exports);
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __copyProps = (to, from, except, desc) => {
|
|
7
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
-
for (let key of __getOwnPropNames(from))
|
|
9
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
-
}
|
|
12
|
-
return to;
|
|
13
|
-
};
|
|
14
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
-
var unit_matches_exports = {};
|
|
16
|
-
module.exports = __toCommonJS(unit_matches_exports);
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __copyProps = (to, from, except, desc) => {
|
|
7
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
-
for (let key of __getOwnPropNames(from))
|
|
9
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
-
}
|
|
12
|
-
return to;
|
|
13
|
-
};
|
|
14
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
-
var validated_boolean_rule_exports = {};
|
|
16
|
-
module.exports = __toCommonJS(validated_boolean_rule_exports);
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __copyProps = (to, from, except, desc) => {
|
|
7
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
-
for (let key of __getOwnPropNames(from))
|
|
9
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
-
}
|
|
12
|
-
return to;
|
|
13
|
-
};
|
|
14
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
-
var validated_number_rule_exports = {};
|
|
16
|
-
module.exports = __toCommonJS(validated_number_rule_exports);
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __copyProps = (to, from, except, desc) => {
|
|
7
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
-
for (let key of __getOwnPropNames(from))
|
|
9
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
-
}
|
|
12
|
-
return to;
|
|
13
|
-
};
|
|
14
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
-
var validated_rule_group_exports = {};
|
|
16
|
-
module.exports = __toCommonJS(validated_rule_group_exports);
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __copyProps = (to, from, except, desc) => {
|
|
7
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
-
for (let key of __getOwnPropNames(from))
|
|
9
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
-
}
|
|
12
|
-
return to;
|
|
13
|
-
};
|
|
14
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
-
var validated_rule_value_exports = {};
|
|
16
|
-
module.exports = __toCommonJS(validated_rule_value_exports);
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __copyProps = (to, from, except, desc) => {
|
|
7
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
-
for (let key of __getOwnPropNames(from))
|
|
9
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
-
}
|
|
12
|
-
return to;
|
|
13
|
-
};
|
|
14
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
-
var validated_rule_exports = {};
|
|
16
|
-
module.exports = __toCommonJS(validated_rule_exports);
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __copyProps = (to, from, except, desc) => {
|
|
7
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
-
for (let key of __getOwnPropNames(from))
|
|
9
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
-
}
|
|
12
|
-
return to;
|
|
13
|
-
};
|
|
14
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
-
var validated_string_rule_exports = {};
|
|
16
|
-
module.exports = __toCommonJS(validated_string_rule_exports);
|
|
@@ -1,137 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var callouts_exports = {};
|
|
20
|
-
__export(callouts_exports, {
|
|
21
|
-
filterComponents: () => filterComponents,
|
|
22
|
-
flattenComponents: () => flattenComponents,
|
|
23
|
-
getCalloutComponents: () => getCalloutComponents,
|
|
24
|
-
getCalloutFilters: () => getCalloutFilters,
|
|
25
|
-
isAddressAnswer: () => isAddressAnswer,
|
|
26
|
-
isFileUploadAnswer: () => isFileUploadAnswer,
|
|
27
|
-
stringifyAnswer: () => stringifyAnswer
|
|
28
|
-
});
|
|
29
|
-
module.exports = __toCommonJS(callouts_exports);
|
|
30
|
-
function isNestableComponent(component) {
|
|
31
|
-
return "components" in component && component.type !== "address";
|
|
32
|
-
}
|
|
33
|
-
function convertValuesToOptions(values) {
|
|
34
|
-
return values.map(({ value }) => value);
|
|
35
|
-
}
|
|
36
|
-
function convertComponentToFilter(component) {
|
|
37
|
-
const baseItem = {
|
|
38
|
-
label: component.label || component.fullKey,
|
|
39
|
-
nullable: true
|
|
40
|
-
};
|
|
41
|
-
switch (component.type) {
|
|
42
|
-
case "checkbox":
|
|
43
|
-
return { ...baseItem, type: "boolean", nullable: false };
|
|
44
|
-
case "number":
|
|
45
|
-
return { ...baseItem, type: "number" };
|
|
46
|
-
case "select":
|
|
47
|
-
return {
|
|
48
|
-
...baseItem,
|
|
49
|
-
type: "enum",
|
|
50
|
-
options: convertValuesToOptions(component.data.values)
|
|
51
|
-
};
|
|
52
|
-
case "selectboxes":
|
|
53
|
-
case "radio":
|
|
54
|
-
return {
|
|
55
|
-
...baseItem,
|
|
56
|
-
type: component.type === "radio" ? "enum" : "array",
|
|
57
|
-
options: convertValuesToOptions(component.values)
|
|
58
|
-
};
|
|
59
|
-
case "textarea":
|
|
60
|
-
return { ...baseItem, type: "blob" };
|
|
61
|
-
default:
|
|
62
|
-
return { ...baseItem, type: "text" };
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
function getNiceAnswer(component, value) {
|
|
66
|
-
var _a, _b;
|
|
67
|
-
switch (component.type) {
|
|
68
|
-
case "radio":
|
|
69
|
-
case "selectboxes":
|
|
70
|
-
return ((_a = component.values.find((v) => v.value === value)) == null ? void 0 : _a.label) || value;
|
|
71
|
-
case "select":
|
|
72
|
-
return ((_b = component.data.values.find((v) => v.value === value)) == null ? void 0 : _b.label) || value;
|
|
73
|
-
default:
|
|
74
|
-
return value;
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
function flattenComponents(components) {
|
|
78
|
-
return components.flatMap(
|
|
79
|
-
(component) => isNestableComponent(component) ? [component, ...flattenComponents(component.components)] : [component]
|
|
80
|
-
);
|
|
81
|
-
}
|
|
82
|
-
function filterComponents(components, filterFn) {
|
|
83
|
-
return components.filter(filterFn).map((component) => {
|
|
84
|
-
return {
|
|
85
|
-
...component,
|
|
86
|
-
...isNestableComponent(component) && {
|
|
87
|
-
components: filterComponents(component.components, filterFn)
|
|
88
|
-
}
|
|
89
|
-
};
|
|
90
|
-
});
|
|
91
|
-
}
|
|
92
|
-
function getCalloutComponents(formSchema) {
|
|
93
|
-
return formSchema.slides.flatMap(
|
|
94
|
-
(slide) => flattenComponents(slide.components).map((component) => ({
|
|
95
|
-
...component,
|
|
96
|
-
slideId: slide.id,
|
|
97
|
-
fullKey: `${slide.id}.${component.key}`
|
|
98
|
-
}))
|
|
99
|
-
);
|
|
100
|
-
}
|
|
101
|
-
function getCalloutFilters(formSchema) {
|
|
102
|
-
const items = getCalloutComponents(formSchema).filter((c) => c.input).map((c) => [`answers.${c.fullKey}`, convertComponentToFilter(c)]);
|
|
103
|
-
return Object.fromEntries(items);
|
|
104
|
-
}
|
|
105
|
-
function isAddressAnswer(answer) {
|
|
106
|
-
return !!answer && typeof answer === "object" && "geometry" in answer;
|
|
107
|
-
}
|
|
108
|
-
function isFileUploadAnswer(answer) {
|
|
109
|
-
return !!answer && typeof answer === "object" && "url" in answer;
|
|
110
|
-
}
|
|
111
|
-
function stringifyAnswer(component, answer) {
|
|
112
|
-
if (Array.isArray(answer)) {
|
|
113
|
-
return answer.map((a) => stringifyAnswer(component, a)).join(", ");
|
|
114
|
-
} else if (!answer) {
|
|
115
|
-
return "";
|
|
116
|
-
} else if (isAddressAnswer(answer)) {
|
|
117
|
-
return answer.geometry.location.lat + ", " + answer.geometry.location.lng;
|
|
118
|
-
} else if (isFileUploadAnswer(answer)) {
|
|
119
|
-
return answer.url;
|
|
120
|
-
} else if (typeof answer === "object") {
|
|
121
|
-
return Object.entries(answer).filter(([, selected]) => selected).map(([value]) => getNiceAnswer(component, value)).join(", ");
|
|
122
|
-
} else if (typeof answer === "string") {
|
|
123
|
-
return getNiceAnswer(component, answer);
|
|
124
|
-
} else {
|
|
125
|
-
return answer.toString();
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
129
|
-
0 && (module.exports = {
|
|
130
|
-
filterComponents,
|
|
131
|
-
flattenComponents,
|
|
132
|
-
getCalloutComponents,
|
|
133
|
-
getCalloutFilters,
|
|
134
|
-
isAddressAnswer,
|
|
135
|
-
isFileUploadAnswer,
|
|
136
|
-
stringifyAnswer
|
|
137
|
-
});
|
package/dist/cjs/utils/date.cjs
DELETED
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var date_exports = {};
|
|
20
|
-
__export(date_exports, {
|
|
21
|
-
dateUnitMap: () => dateUnitMap,
|
|
22
|
-
dateUnits: () => dateUnits,
|
|
23
|
-
getMinDateUnit: () => getMinDateUnit,
|
|
24
|
-
isValidDate: () => isValidDate,
|
|
25
|
-
parseDate: () => parseDate
|
|
26
|
-
});
|
|
27
|
-
module.exports = __toCommonJS(date_exports);
|
|
28
|
-
var import_date_fns = require("date-fns");
|
|
29
|
-
const dateUnits = ["s", "m", "h", "d", "M", "y"];
|
|
30
|
-
const dateUnitMap = {
|
|
31
|
-
y: "years",
|
|
32
|
-
M: "months",
|
|
33
|
-
d: "days",
|
|
34
|
-
h: "hours",
|
|
35
|
-
m: "minutes",
|
|
36
|
-
s: "seconds"
|
|
37
|
-
};
|
|
38
|
-
const startOf = {
|
|
39
|
-
y: import_date_fns.startOfYear,
|
|
40
|
-
M: import_date_fns.startOfMonth,
|
|
41
|
-
d: import_date_fns.startOfDay,
|
|
42
|
-
h: import_date_fns.startOfHour,
|
|
43
|
-
m: import_date_fns.startOfMinute,
|
|
44
|
-
s: import_date_fns.startOfSecond
|
|
45
|
-
};
|
|
46
|
-
const relativeDate = /^\$now(?<units>\(((y|M|d|h|m|s):(-?\d+),?)+\))?$/;
|
|
47
|
-
const relativeUnit = /(y|M|d|h|m|s):(-?\d+)/g;
|
|
48
|
-
const absoluteDate = /^(?<y>\d{4,})(-(?<M>\d\d)(-(?<d>\d\d)([T ](?<h>\d\d)(:(?<m>\d\d)(:(?<s>\d\d))?)?)?)?)?/;
|
|
49
|
-
function parseDate(value, now) {
|
|
50
|
-
var _a, _b;
|
|
51
|
-
let date;
|
|
52
|
-
let units;
|
|
53
|
-
const relativeMatch = relativeDate.exec(value);
|
|
54
|
-
if (relativeMatch) {
|
|
55
|
-
date = now || /* @__PURE__ */ new Date();
|
|
56
|
-
const unitsGroup = (_a = relativeMatch.groups) == null ? void 0 : _a.units;
|
|
57
|
-
if (unitsGroup) {
|
|
58
|
-
const unitMatches = unitsGroup.matchAll(relativeUnit);
|
|
59
|
-
units = [];
|
|
60
|
-
for (const [_, unit, delta] of unitMatches) {
|
|
61
|
-
date = (0, import_date_fns.add)(date, { [dateUnitMap[unit]]: Number(delta) });
|
|
62
|
-
units.push(unit);
|
|
63
|
-
}
|
|
64
|
-
} else {
|
|
65
|
-
units = ["d"];
|
|
66
|
-
}
|
|
67
|
-
} else {
|
|
68
|
-
date = (0, import_date_fns.parseISO)(value);
|
|
69
|
-
units = Object.entries(((_b = absoluteDate.exec(value)) == null ? void 0 : _b.groups) || {}).filter(([_, n]) => !!n).map(([unit]) => unit);
|
|
70
|
-
}
|
|
71
|
-
const minUnit = getMinDateUnit(units) || "s";
|
|
72
|
-
return [startOf[minUnit](date), minUnit];
|
|
73
|
-
}
|
|
74
|
-
function getMinDateUnit(units) {
|
|
75
|
-
return dateUnits.find((unit) => units.includes(unit));
|
|
76
|
-
}
|
|
77
|
-
function isValidDate(s) {
|
|
78
|
-
return relativeDate.test(s) || (0, import_date_fns.isValid)((0, import_date_fns.parseISO)(s));
|
|
79
|
-
}
|
|
80
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
81
|
-
0 && (module.exports = {
|
|
82
|
-
dateUnitMap,
|
|
83
|
-
dateUnits,
|
|
84
|
-
getMinDateUnit,
|
|
85
|
-
isValidDate,
|
|
86
|
-
parseDate
|
|
87
|
-
});
|
package/dist/cjs/utils/index.cjs
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __copyProps = (to, from, except, desc) => {
|
|
7
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
-
for (let key of __getOwnPropNames(from))
|
|
9
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
-
}
|
|
12
|
-
return to;
|
|
13
|
-
};
|
|
14
|
-
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
15
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
16
|
-
var utils_exports = {};
|
|
17
|
-
module.exports = __toCommonJS(utils_exports);
|
|
18
|
-
__reExport(utils_exports, require("./callouts.cjs"), module.exports);
|
|
19
|
-
__reExport(utils_exports, require("./date.cjs"), module.exports);
|
|
20
|
-
__reExport(utils_exports, require("./payments.cjs"), module.exports);
|
|
21
|
-
__reExport(utils_exports, require("./rules.cjs"), module.exports);
|
|
22
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
23
|
-
0 && (module.exports = {
|
|
24
|
-
...require("./callouts.cjs"),
|
|
25
|
-
...require("./date.cjs"),
|
|
26
|
-
...require("./payments.cjs"),
|
|
27
|
-
...require("./rules.cjs")
|
|
28
|
-
});
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var payments_exports = {};
|
|
20
|
-
__export(payments_exports, {
|
|
21
|
-
calcPaymentFee: () => calcPaymentFee
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(payments_exports);
|
|
24
|
-
var import_data = require("../data/index.cjs");
|
|
25
|
-
const stripeFees = {
|
|
26
|
-
gb: {
|
|
27
|
-
[import_data.PaymentMethod.StripeCard]: (amount) => 0.2 + 0.015 * amount,
|
|
28
|
-
[import_data.PaymentMethod.StripeSEPA]: () => 0.3,
|
|
29
|
-
[import_data.PaymentMethod.StripeBACS]: (amount) => Math.min(2, Math.max(0.2, 0.01 * amount))
|
|
30
|
-
},
|
|
31
|
-
eu: {
|
|
32
|
-
[import_data.PaymentMethod.StripeCard]: (amount) => 0.25 + 0.015 * amount,
|
|
33
|
-
[import_data.PaymentMethod.StripeSEPA]: () => 0.35,
|
|
34
|
-
[import_data.PaymentMethod.StripeBACS]: () => 0
|
|
35
|
-
// Not available
|
|
36
|
-
},
|
|
37
|
-
ca: {
|
|
38
|
-
[import_data.PaymentMethod.StripeCard]: (amount) => 0.3 + 0.029 * amount,
|
|
39
|
-
[import_data.PaymentMethod.StripeSEPA]: () => 0,
|
|
40
|
-
// Not available
|
|
41
|
-
[import_data.PaymentMethod.StripeBACS]: () => 0
|
|
42
|
-
// Not available
|
|
43
|
-
}
|
|
44
|
-
};
|
|
45
|
-
const gcFee = (amount) => 0.2 + amount * 0.01;
|
|
46
|
-
function calcPaymentFee(feeable, country) {
|
|
47
|
-
const feeFn = feeable.paymentMethod === import_data.PaymentMethod.GoCardlessDirectDebit ? gcFee : stripeFees[country][feeable.paymentMethod];
|
|
48
|
-
return feeable.period === import_data.ContributionPeriod.Annually ? 0 : feeFn(feeable.amount);
|
|
49
|
-
}
|
|
50
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
51
|
-
0 && (module.exports = {
|
|
52
|
-
calcPaymentFee
|
|
53
|
-
});
|
package/dist/cjs/utils/rules.cjs
DELETED
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var rules_exports = {};
|
|
20
|
-
__export(rules_exports, {
|
|
21
|
-
isRuleGroup: () => isRuleGroup,
|
|
22
|
-
validateRule: () => validateRule,
|
|
23
|
-
validateRuleGroup: () => validateRuleGroup
|
|
24
|
-
});
|
|
25
|
-
module.exports = __toCommonJS(rules_exports);
|
|
26
|
-
var import_error = require("../error/index.cjs");
|
|
27
|
-
var import_search = require("../search/index.cjs");
|
|
28
|
-
var import_date = require("./date.cjs");
|
|
29
|
-
function isRuleGroup(ruleOrGroup) {
|
|
30
|
-
return "condition" in ruleOrGroup;
|
|
31
|
-
}
|
|
32
|
-
function validateRule(filters, rule) {
|
|
33
|
-
const filter = filters[rule.field];
|
|
34
|
-
if (!filter) {
|
|
35
|
-
throw new import_error.InvalidRule(rule, `Invalid field: ${rule.field}`);
|
|
36
|
-
}
|
|
37
|
-
let expectedArgs = 0;
|
|
38
|
-
if (rule.operator in import_search.nullableOperators) {
|
|
39
|
-
if (!filter.nullable && filter.type !== "text") {
|
|
40
|
-
throw new import_error.InvalidRule(
|
|
41
|
-
rule,
|
|
42
|
-
`Invalid nullable operator: field is not nullable`
|
|
43
|
-
);
|
|
44
|
-
}
|
|
45
|
-
} else {
|
|
46
|
-
const operator = import_search.operatorsByTypeMap[filter.type][rule.operator];
|
|
47
|
-
if (!operator) {
|
|
48
|
-
throw new import_error.InvalidRule(
|
|
49
|
-
rule,
|
|
50
|
-
`Invalid operator for type: ${filter.type} type doesn't define ${rule.operator}`
|
|
51
|
-
);
|
|
52
|
-
}
|
|
53
|
-
expectedArgs = operator.args;
|
|
54
|
-
}
|
|
55
|
-
if (expectedArgs !== rule.value.length) {
|
|
56
|
-
throw new import_error.InvalidRule(
|
|
57
|
-
rule,
|
|
58
|
-
`Invalid operator argument count: ${rule.operator} needs ${expectedArgs}, ${rule.value.length} given`
|
|
59
|
-
);
|
|
60
|
-
}
|
|
61
|
-
const expectedType = filter.type === "boolean" || filter.type === "number" ? filter.type : "string";
|
|
62
|
-
if (rule.value.some((v) => typeof v !== expectedType)) {
|
|
63
|
-
throw new import_error.InvalidRule(
|
|
64
|
-
rule,
|
|
65
|
-
`Invalid operator argument type: ${rule.operator} needs ${expectedType}, ${rule.value.map(
|
|
66
|
-
(v) => typeof v
|
|
67
|
-
)} given`
|
|
68
|
-
);
|
|
69
|
-
}
|
|
70
|
-
if (filter.type === "date" && rule.value.some((v) => !(0, import_date.isValidDate)(v))) {
|
|
71
|
-
throw new import_error.InvalidRule(
|
|
72
|
-
rule,
|
|
73
|
-
`Invalid operator argument: date type needs valid absolute or relative date, ${rule.value} given`
|
|
74
|
-
);
|
|
75
|
-
}
|
|
76
|
-
if ((filter.type === "enum" || filter.type === "array") && rule.value.some((v) => {
|
|
77
|
-
var _a;
|
|
78
|
-
return ((_a = filter.options) == null ? void 0 : _a.indexOf(v)) === -1;
|
|
79
|
-
})) {
|
|
80
|
-
throw new import_error.InvalidRule(
|
|
81
|
-
rule,
|
|
82
|
-
`Invalid operator argument: ${filter.type} type expected ${filter.options}, ${rule.value} given`
|
|
83
|
-
);
|
|
84
|
-
}
|
|
85
|
-
return {
|
|
86
|
-
field: rule.field,
|
|
87
|
-
type: filter.type,
|
|
88
|
-
nullable: !!filter.nullable,
|
|
89
|
-
operator: rule.operator,
|
|
90
|
-
value: rule.value
|
|
91
|
-
};
|
|
92
|
-
}
|
|
93
|
-
function validateRuleGroup(filters, ruleGroup) {
|
|
94
|
-
const validatedRuleGroup = {
|
|
95
|
-
condition: ruleGroup.condition,
|
|
96
|
-
rules: []
|
|
97
|
-
};
|
|
98
|
-
for (const rule of ruleGroup.rules) {
|
|
99
|
-
const valid = isRuleGroup(rule) ? validateRuleGroup(filters, rule) : validateRule(filters, rule);
|
|
100
|
-
validatedRuleGroup.rules.push(valid);
|
|
101
|
-
}
|
|
102
|
-
return validatedRuleGroup;
|
|
103
|
-
}
|
|
104
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
105
|
-
0 && (module.exports = {
|
|
106
|
-
isRuleGroup,
|
|
107
|
-
validateRule,
|
|
108
|
-
validateRuleGroup
|
|
109
|
-
});
|