@degenerate/rules 0.0.2 → 0.0.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/generic/src/errors/safe/safe-rules-errors.d.ts +19 -0
- package/dist/generic/src/errors/safe/safe-rules-errors.d.ts.map +1 -1
- package/dist/generic/src/errors/safe/safe-rules-errors.js +25 -2
- package/dist/rules/src/evaluation/check-function-integrity.d.ts +1 -1
- package/dist/rules/src/evaluation/check-function-integrity.d.ts.map +1 -1
- package/dist/rules/src/evaluation/check-if-proposal-is-valid.d.ts +1 -1
- package/dist/rules/src/evaluation/check-if-proposal-is-valid.d.ts.map +1 -1
- package/dist/rules/src/evaluation/conditions/boolean-conditions.d.ts +1 -1
- package/dist/rules/src/evaluation/conditions/boolean-conditions.d.ts.map +1 -1
- package/dist/rules/src/evaluation/conditions/boolean-conditions.js +4 -5
- package/dist/rules/src/evaluation/conditions/contains-conditions.d.ts +1 -1
- package/dist/rules/src/evaluation/conditions/contains-conditions.d.ts.map +1 -1
- package/dist/rules/src/evaluation/conditions/contains-conditions.js +2 -2
- package/dist/rules/src/evaluation/conditions/empty-conditions.d.ts +1 -1
- package/dist/rules/src/evaluation/conditions/empty-conditions.d.ts.map +1 -1
- package/dist/rules/src/evaluation/conditions/empty-conditions.js +6 -6
- package/dist/rules/src/evaluation/conditions/equality-conditions.d.ts +1 -1
- package/dist/rules/src/evaluation/conditions/equality-conditions.d.ts.map +1 -1
- package/dist/rules/src/evaluation/conditions/equality-conditions.js +3 -3
- package/dist/rules/src/evaluation/conditions/null-conditions.d.ts +1 -1
- package/dist/rules/src/evaluation/conditions/null-conditions.d.ts.map +1 -1
- package/dist/rules/src/evaluation/conditions/null-conditions.js +3 -3
- package/dist/rules/src/evaluation/conditions/range-conditions.d.ts +1 -1
- package/dist/rules/src/evaluation/conditions/range-conditions.d.ts.map +1 -1
- package/dist/rules/src/evaluation/conditions/range-conditions.js +5 -5
- package/dist/rules/src/evaluation/conditions/special-conditions.d.ts +1 -1
- package/dist/rules/src/evaluation/conditions/special-conditions.d.ts.map +1 -1
- package/dist/rules/src/evaluation/conditions/special-conditions.js +3 -3
- package/dist/rules/src/evaluation/conditions/starts-end-with-conditions.d.ts +2 -2
- package/dist/rules/src/evaluation/conditions/starts-end-with-conditions.d.ts.map +1 -1
- package/dist/rules/src/evaluation/conditions/starts-end-with-conditions.js +22 -3
- package/dist/rules/src/evaluation/conditions/typeof-rule-conditions.d.ts +1 -1
- package/dist/rules/src/evaluation/conditions/typeof-rule-conditions.d.ts.map +1 -1
- package/dist/rules/src/evaluation/conditions/typeof-rule-conditions.js +12 -12
- package/dist/rules/src/evaluation/determine-if-data-has-changed.d.ts +1 -1
- package/dist/rules/src/evaluation/determine-if-data-has-changed.d.ts.map +1 -1
- package/dist/rules/src/evaluation/evaluate-rule-conditions.d.ts +1 -1
- package/dist/rules/src/evaluation/evaluate-rule-conditions.d.ts.map +1 -1
- package/dist/rules/src/evaluation/evaluate-rule-conditions.js +20 -20
- package/dist/rules/src/evaluation/evaluate-rule.d.ts +1 -1
- package/dist/rules/src/evaluation/evaluate-rule.d.ts.map +1 -1
- package/dist/rules/src/evaluation/evaluate-rules.d.ts +1 -1
- package/dist/rules/src/evaluation/evaluate-rules.d.ts.map +1 -1
- package/dist/rules/src/evaluation/get-data-changed-information.d.ts +1 -1
- package/dist/rules/src/evaluation/get-data-changed-information.d.ts.map +1 -1
- package/dist/rules/src/evaluation/get-root-property-results.d.ts +1 -1
- package/dist/rules/src/evaluation/get-root-property-results.d.ts.map +1 -1
- package/dist/rules/src/evaluation/index.d.ts +9 -0
- package/dist/rules/src/evaluation/index.d.ts.map +1 -1
- package/dist/rules/src/evaluation/index.js +9 -0
- package/dist/rules/src/evaluation/start-rule-evaluation.d.ts +1 -1
- package/dist/rules/src/evaluation/start-rule-evaluation.d.ts.map +1 -1
- package/dist/rules/src/evaluation/start-rule-evaluation.js +3 -3
- package/package.json +5 -2
- package/dist/generic/src/_settings/cryptography-settings.d.ts +0 -27
- package/dist/generic/src/_settings/cryptography-settings.d.ts.map +0 -1
- package/dist/generic/src/_settings/cryptography-settings.js +0 -27
- package/dist/generic/src/crypto/calculate-combined-hash.d.ts +0 -13
- package/dist/generic/src/crypto/calculate-combined-hash.d.ts.map +0 -1
- package/dist/generic/src/crypto/calculate-combined-hash.js +0 -44
- package/dist/generic/src/crypto/calculate-hash.d.ts +0 -7
- package/dist/generic/src/crypto/calculate-hash.d.ts.map +0 -1
- package/dist/generic/src/crypto/calculate-hash.js +0 -37
- package/dist/generic/src/crypto/index.d.ts +0 -13
- package/dist/generic/src/crypto/index.d.ts.map +0 -1
- package/dist/generic/src/crypto/index.js +0 -34
- package/dist/generic/src/crypto/private-public-keys/create-key-pair-from-mnemonic.d.ts +0 -12
- package/dist/generic/src/crypto/private-public-keys/create-key-pair-from-mnemonic.d.ts.map +0 -1
- package/dist/generic/src/crypto/private-public-keys/create-key-pair-from-mnemonic.js +0 -44
- package/dist/generic/src/crypto/private-public-keys/create-key-pair-from-private-key.d.ts +0 -11
- package/dist/generic/src/crypto/private-public-keys/create-key-pair-from-private-key.d.ts.map +0 -1
- package/dist/generic/src/crypto/private-public-keys/create-key-pair-from-private-key.js +0 -40
- package/dist/generic/src/crypto/private-public-keys/generation/create-256-private-key-from-mnemonic.d.ts +0 -11
- package/dist/generic/src/crypto/private-public-keys/generation/create-256-private-key-from-mnemonic.d.ts.map +0 -1
- package/dist/generic/src/crypto/private-public-keys/generation/create-256-private-key-from-mnemonic.js +0 -45
- package/dist/generic/src/crypto/private-public-keys/generation/create-entropy-for-elliptical-curve.d.ts +0 -10
- package/dist/generic/src/crypto/private-public-keys/generation/create-entropy-for-elliptical-curve.d.ts.map +0 -1
- package/dist/generic/src/crypto/private-public-keys/generation/create-entropy-for-elliptical-curve.js +0 -40
- package/dist/generic/src/crypto/private-public-keys/generation/create-random-256-private-key.d.ts +0 -8
- package/dist/generic/src/crypto/private-public-keys/generation/create-random-256-private-key.d.ts.map +0 -1
- package/dist/generic/src/crypto/private-public-keys/generation/create-random-256-private-key.js +0 -41
- package/dist/generic/src/crypto/private-public-keys/generation/generate-key-pair.d.ts +0 -11
- package/dist/generic/src/crypto/private-public-keys/generation/generate-key-pair.d.ts.map +0 -1
- package/dist/generic/src/crypto/private-public-keys/generation/generate-key-pair.js +0 -39
- package/dist/generic/src/crypto/private-public-keys/generation/get-private-public-key-from-keypair.d.ts +0 -15
- package/dist/generic/src/crypto/private-public-keys/generation/get-private-public-key-from-keypair.d.ts.map +0 -1
- package/dist/generic/src/crypto/private-public-keys/generation/get-private-public-key-from-keypair.js +0 -21
- package/dist/generic/src/crypto/signature/create-crypto-signature.d.ts +0 -9
- package/dist/generic/src/crypto/signature/create-crypto-signature.d.ts.map +0 -1
- package/dist/generic/src/crypto/signature/create-crypto-signature.js +0 -13
- package/dist/generic/src/crypto/signature/verify-crypto-signature-by-data.d.ts +0 -13
- package/dist/generic/src/crypto/signature/verify-crypto-signature-by-data.d.ts.map +0 -1
- package/dist/generic/src/crypto/signature/verify-crypto-signature-by-data.js +0 -45
- package/dist/generic/src/crypto/signature/verify-crypto-signature-by-hash.d.ts +0 -13
- package/dist/generic/src/crypto/signature/verify-crypto-signature-by-hash.d.ts.map +0 -1
- package/dist/generic/src/crypto/signature/verify-crypto-signature-by-hash.js +0 -42
- package/dist/generic/src/helpers/array/array-helpers.d.ts +0 -8
- package/dist/generic/src/helpers/array/array-helpers.d.ts.map +0 -1
- package/dist/generic/src/helpers/array/array-helpers.js +0 -14
- package/dist/generic/src/helpers/data/data-helpers.d.ts +0 -46
- package/dist/generic/src/helpers/data/data-helpers.d.ts.map +0 -1
- package/dist/generic/src/helpers/data/data-helpers.js +0 -106
- package/dist/generic/src/helpers/file/file-helpers.d.ts +0 -12
- package/dist/generic/src/helpers/file/file-helpers.d.ts.map +0 -1
- package/dist/generic/src/helpers/file/file-helpers.js +0 -39
- package/dist/generic/src/helpers/id-helpers.d.ts +0 -8
- package/dist/generic/src/helpers/id-helpers.d.ts.map +0 -1
- package/dist/generic/src/helpers/id-helpers.js +0 -19
- package/dist/generic/src/helpers/index.d.ts +0 -11
- package/dist/generic/src/helpers/index.d.ts.map +0 -1
- package/dist/generic/src/helpers/index.js +0 -31
- package/dist/generic/src/helpers/lodash/lodash-helpers.d.ts +0 -14
- package/dist/generic/src/helpers/lodash/lodash-helpers.d.ts.map +0 -1
- package/dist/generic/src/helpers/lodash/lodash-helpers.js +0 -28
- package/dist/generic/src/helpers/object-helpers.d.ts +0 -23
- package/dist/generic/src/helpers/object-helpers.d.ts.map +0 -1
- package/dist/generic/src/helpers/object-helpers.js +0 -54
- package/dist/generic/src/helpers/object-validation-helpers.d.ts +0 -59
- package/dist/generic/src/helpers/object-validation-helpers.d.ts.map +0 -1
- package/dist/generic/src/helpers/object-validation-helpers.js +0 -233
- package/dist/generic/src/helpers/request/params-object-helpers.d.ts +0 -38
- package/dist/generic/src/helpers/request/params-object-helpers.d.ts.map +0 -1
- package/dist/generic/src/helpers/request/params-object-helpers.js +0 -54
- package/dist/generic/src/helpers/request/query-object-helpers.d.ts +0 -12
- package/dist/generic/src/helpers/request/query-object-helpers.d.ts.map +0 -1
- package/dist/generic/src/helpers/request/query-object-helpers.js +0 -25
- package/dist/generic/src/helpers/request/request-object-helpers.d.ts +0 -19
- package/dist/generic/src/helpers/request/request-object-helpers.d.ts.map +0 -1
- package/dist/generic/src/helpers/request/request-object-helpers.js +0 -28
- package/dist/generic/src/index.d.ts +0 -6
- package/dist/generic/src/index.d.ts.map +0 -1
- package/dist/generic/src/index.js +0 -23
|
@@ -1,4 +1,23 @@
|
|
|
1
|
+
import { ConditionType } from '../../models';
|
|
1
2
|
import { BaseError } from '../base-error';
|
|
3
|
+
/**
|
|
4
|
+
* This error is thrown when a evaluation condition data value is not valid
|
|
5
|
+
*/
|
|
6
|
+
export declare class SafeRuleEvaluationConditionDataValueError extends BaseError {
|
|
7
|
+
/**
|
|
8
|
+
* This error is thrown when a evaluation condition data value is not valid
|
|
9
|
+
*/
|
|
10
|
+
constructor(dataValue: unknown, conditionValue: unknown, conditionType: ConditionType);
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* This error is thrown when a evaluation condition value is not valid
|
|
14
|
+
*/
|
|
15
|
+
export declare class SafeRuleEvaluationConditionValueError extends BaseError {
|
|
16
|
+
/**
|
|
17
|
+
* This error is thrown when a evaluation condition value is not valid
|
|
18
|
+
*/
|
|
19
|
+
constructor(dataValue: unknown, conditionValue: unknown, conditionType: ConditionType);
|
|
20
|
+
}
|
|
2
21
|
/**
|
|
3
22
|
* This error is thrown when a speical condition pattern is not valid
|
|
4
23
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"safe-rules-errors.d.ts","sourceRoot":"","sources":["../../../../../../generic/src/errors/safe/safe-rules-errors.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAE1C;;GAEG;AACH,qBAAa,8CAA+C,SAAQ,SAAS;IACzE;;OAEG;gBACS,SAAS,EAAE,OAAO,EAAE,cAAc,EAAE,OAAO;CAG1D"}
|
|
1
|
+
{"version":3,"file":"safe-rules-errors.d.ts","sourceRoot":"","sources":["../../../../../../generic/src/errors/safe/safe-rules-errors.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAE1C;;GAEG;AACH,qBAAa,yCAA0C,SAAQ,SAAS;IACpE;;OAEG;gBACS,SAAS,EAAE,OAAO,EAAE,cAAc,EAAE,OAAO,EAAE,aAAa,EAAE,aAAa;CAGxF;AAED;;GAEG;AACH,qBAAa,qCAAsC,SAAQ,SAAS;IAChE;;OAEG;gBACS,SAAS,EAAE,OAAO,EAAE,cAAc,EAAE,OAAO,EAAE,aAAa,EAAE,aAAa;CAGxF;AAED;;GAEG;AACH,qBAAa,8CAA+C,SAAQ,SAAS;IACzE;;OAEG;gBACS,SAAS,EAAE,OAAO,EAAE,cAAc,EAAE,OAAO;CAG1D"}
|
|
@@ -1,8 +1,31 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SafeRuleEvaluationSpecialConditionPatternError = void 0;
|
|
4
|
-
// This file contains the errors for the share data rules.
|
|
3
|
+
exports.SafeRuleEvaluationSpecialConditionPatternError = exports.SafeRuleEvaluationConditionValueError = exports.SafeRuleEvaluationConditionDataValueError = void 0;
|
|
5
4
|
const base_error_1 = require("../base-error");
|
|
5
|
+
/**
|
|
6
|
+
* This error is thrown when a evaluation condition data value is not valid
|
|
7
|
+
*/
|
|
8
|
+
class SafeRuleEvaluationConditionDataValueError extends base_error_1.BaseError {
|
|
9
|
+
/**
|
|
10
|
+
* This error is thrown when a evaluation condition data value is not valid
|
|
11
|
+
*/
|
|
12
|
+
constructor(dataValue, conditionValue, conditionType) {
|
|
13
|
+
super(`Share Rule condition evaluation for type ${conditionType} failed to execute. dataValue: ${dataValue} is incorrect for conditionValue: ${conditionValue}`);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
exports.SafeRuleEvaluationConditionDataValueError = SafeRuleEvaluationConditionDataValueError;
|
|
17
|
+
/**
|
|
18
|
+
* This error is thrown when a evaluation condition value is not valid
|
|
19
|
+
*/
|
|
20
|
+
class SafeRuleEvaluationConditionValueError extends base_error_1.BaseError {
|
|
21
|
+
/**
|
|
22
|
+
* This error is thrown when a evaluation condition value is not valid
|
|
23
|
+
*/
|
|
24
|
+
constructor(dataValue, conditionValue, conditionType) {
|
|
25
|
+
super(`Share Rule condition evaluation for type ${conditionType} failed to execute. conditionValue: ${conditionValue} is incorrect for dataValue: ${dataValue}`);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
exports.SafeRuleEvaluationConditionValueError = SafeRuleEvaluationConditionValueError;
|
|
6
29
|
/**
|
|
7
30
|
* This error is thrown when a speical condition pattern is not valid
|
|
8
31
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"check-function-integrity.d.ts","sourceRoot":"","sources":["../../../../src/evaluation/check-function-integrity.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"check-function-integrity.d.ts","sourceRoot":"","sources":["../../../../src/evaluation/check-function-integrity.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAErD;;GAEG;AACH,QAAA,MAAM,sBAAsB,sBAAuB,cAAc,CAAC,GAAG,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,EAAE,GAAG,CAAC,sBAC5E,cAAc,CAAC,GAAG,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,EAAE,GAAG,CAAC,EAAE,KAAG,OAK7E,CAAC;AAEF,OAAO,EAAE,sBAAsB,EAAE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"check-if-proposal-is-valid.d.ts","sourceRoot":"","sources":["../../../../src/evaluation/check-if-proposal-is-valid.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,2BAA2B,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"check-if-proposal-is-valid.d.ts","sourceRoot":"","sources":["../../../../src/evaluation/check-if-proposal-is-valid.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,2BAA2B,EAAE,MAAM,qBAAqB,CAAC;AAElE;;;;;;GAMG;AACH,QAAA,MAAM,sBAAsB,wBACH,MAAM,gBACb,2BAA2B,EAAE,KAC5C,OAGF,CAAC;AAEF,OAAO,EAAE,sBAAsB,EAAE,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* This file contains the functions for checking that the boolean conditions are met.
|
|
3
3
|
*/
|
|
4
|
-
import { ConditionTypeBoolean } from '
|
|
4
|
+
import { ConditionTypeBoolean } from '@degenerate/generic';
|
|
5
5
|
/**
|
|
6
6
|
* This takes a value and checks if it meets the boolean condition.
|
|
7
7
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"boolean-conditions.d.ts","sourceRoot":"","sources":["../../../../../src/evaluation/conditions/boolean-conditions.ts"],"names":[],"mappings":"AAAA;;GAEG;
|
|
1
|
+
{"version":3,"file":"boolean-conditions.d.ts","sourceRoot":"","sources":["../../../../../src/evaluation/conditions/boolean-conditions.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAmB,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAE5E;;;;;;;GAOG;AACH,QAAA,MAAM,mBAAmB,cAAe,OAAO,iBAAiB,oBAAoB,KAAG,OAWtF,CAAC;AAEF,OAAO,EAAE,mBAAmB,EAAE,CAAC"}
|
|
@@ -4,8 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.isValidBooleanValue = void 0;
|
|
7
|
-
const
|
|
8
|
-
const share_rule_models_1 = require("../../../../generic/src/models/rules/share-rule-models");
|
|
7
|
+
const generic_1 = require("@degenerate/generic");
|
|
9
8
|
/**
|
|
10
9
|
* This takes a value and checks if it meets the boolean condition.
|
|
11
10
|
*
|
|
@@ -15,14 +14,14 @@ const share_rule_models_1 = require("../../../../generic/src/models/rules/share-
|
|
|
15
14
|
* @returns
|
|
16
15
|
*/
|
|
17
16
|
const isValidBooleanValue = (dataValue, conditionType) => {
|
|
18
|
-
const isBoolean = (0,
|
|
17
|
+
const isBoolean = (0, generic_1.validateBoolean)(dataValue);
|
|
19
18
|
if (!isBoolean) {
|
|
20
19
|
return false;
|
|
21
20
|
}
|
|
22
21
|
switch (conditionType) {
|
|
23
|
-
case
|
|
22
|
+
case generic_1.ConditionTypeBoolean.IS_TRUE:
|
|
24
23
|
return dataValue === true;
|
|
25
|
-
case
|
|
24
|
+
case generic_1.ConditionTypeBoolean.IS_FALSE:
|
|
26
25
|
return dataValue === false;
|
|
27
26
|
}
|
|
28
27
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* This file contains the functions for checking that contains conditions are met.
|
|
3
3
|
*/
|
|
4
|
-
import { ConditionTypeContains } from '
|
|
4
|
+
import { ConditionTypeContains } from '@degenerate/generic';
|
|
5
5
|
/**
|
|
6
6
|
* This takes a value and checks if it is contained or not contained in the proper range of values.
|
|
7
7
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contains-conditions.d.ts","sourceRoot":"","sources":["../../../../../src/evaluation/conditions/contains-conditions.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,qBAAqB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"contains-conditions.d.ts","sourceRoot":"","sources":["../../../../../src/evaluation/conditions/contains-conditions.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAE5D;;;;;;;;GAQG;AACH,QAAA,MAAM,oBAAoB,cAAe,MAAM,GAAG,MAAM,kBAAkB,MAAM,GAAG,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,iBACnF,qBAAqB,KAAG,OAQ1C,CAAC;AAEF,OAAO,EAAE,oBAAoB,EAAE,CAAC"}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.isValidContainsValue = void 0;
|
|
7
|
-
const
|
|
7
|
+
const generic_1 = require("@degenerate/generic");
|
|
8
8
|
/**
|
|
9
9
|
* This takes a value and checks if it is contained or not contained in the proper range of values.
|
|
10
10
|
*
|
|
@@ -22,6 +22,6 @@ const isValidContainsValue = (dataValue, conditionValue, conditionType) => {
|
|
|
22
22
|
else {
|
|
23
23
|
isMatchedCondition = conditionValue.includes(dataValue);
|
|
24
24
|
}
|
|
25
|
-
return (conditionType ===
|
|
25
|
+
return (conditionType === generic_1.ConditionTypeContains.CONTAINS) ? isMatchedCondition : !isMatchedCondition;
|
|
26
26
|
};
|
|
27
27
|
exports.isValidContainsValue = isValidContainsValue;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* This file contains the functions for checking that the values are empty
|
|
3
3
|
*/
|
|
4
|
-
import { ConditionTypeEmpty } from '
|
|
4
|
+
import { ConditionTypeEmpty } from '@degenerate/generic';
|
|
5
5
|
/**
|
|
6
6
|
* This takes a value and checks if it meets the empty condition
|
|
7
7
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"empty-conditions.d.ts","sourceRoot":"","sources":["../../../../../src/evaluation/conditions/empty-conditions.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"empty-conditions.d.ts","sourceRoot":"","sources":["../../../../../src/evaluation/conditions/empty-conditions.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,kBAAkB,EAAiB,MAAM,qBAAqB,CAAC;AAExE;;;;;;;GAOG;AACH,QAAA,MAAM,iBAAiB,cAAe,OAAO,iBAAiB,kBAAkB,KAAG,OAiBlF,CAAC;AAEF,OAAO,EAAE,iBAAiB,EAAE,CAAC"}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.isValidEmptyValue = void 0;
|
|
7
|
-
const
|
|
7
|
+
const generic_1 = require("@degenerate/generic");
|
|
8
8
|
/**
|
|
9
9
|
* This takes a value and checks if it meets the empty condition
|
|
10
10
|
*
|
|
@@ -14,20 +14,20 @@ const src_1 = require("../../../../generic/src");
|
|
|
14
14
|
* @returns
|
|
15
15
|
*/
|
|
16
16
|
const isValidEmptyValue = (dataValue, conditionType) => {
|
|
17
|
-
const isArray = (0,
|
|
17
|
+
const isArray = (0, generic_1.validateArray)(dataValue);
|
|
18
18
|
if (isArray) {
|
|
19
19
|
switch (conditionType) {
|
|
20
|
-
case
|
|
20
|
+
case generic_1.ConditionTypeEmpty.IS_EMPTY:
|
|
21
21
|
return dataValue.length === 0;
|
|
22
|
-
case
|
|
22
|
+
case generic_1.ConditionTypeEmpty.IS_NOT_EMPTY:
|
|
23
23
|
return dataValue.length > 0;
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
26
|
else {
|
|
27
27
|
switch (conditionType) {
|
|
28
|
-
case
|
|
28
|
+
case generic_1.ConditionTypeEmpty.IS_EMPTY:
|
|
29
29
|
return isEmpty(dataValue);
|
|
30
|
-
case
|
|
30
|
+
case generic_1.ConditionTypeEmpty.IS_NOT_EMPTY:
|
|
31
31
|
return !isEmpty(dataValue);
|
|
32
32
|
}
|
|
33
33
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* This file contains the functions for checking that equality conditions are met.
|
|
3
3
|
*/
|
|
4
|
-
import { ConditionTypeEquality } from '
|
|
4
|
+
import { ConditionTypeEquality } from '@degenerate/generic';
|
|
5
5
|
/**
|
|
6
6
|
* This takes a value and checks if two values are strictly equal or not equal.
|
|
7
7
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"equality-conditions.d.ts","sourceRoot":"","sources":["../../../../../src/evaluation/conditions/equality-conditions.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,qBAAqB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"equality-conditions.d.ts","sourceRoot":"","sources":["../../../../../src/evaluation/conditions/equality-conditions.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAE5D;;;;;;;GAOG;AACH,QAAA,MAAM,oBAAoB,cAAe,OAAO,kBAAkB,OAAO,iBAAiB,qBAAqB,KAAG,OAOjH,CAAC;AAEF,OAAO,EAAE,oBAAoB,EAAE,CAAC"}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.isValidEqualityValue = void 0;
|
|
7
|
-
const
|
|
7
|
+
const generic_1 = require("@degenerate/generic");
|
|
8
8
|
/**
|
|
9
9
|
* This takes a value and checks if two values are strictly equal or not equal.
|
|
10
10
|
*
|
|
@@ -15,9 +15,9 @@ const src_1 = require("../../../../generic/src");
|
|
|
15
15
|
*/
|
|
16
16
|
const isValidEqualityValue = (dataValue, conditionValue, conditionType) => {
|
|
17
17
|
switch (conditionType) {
|
|
18
|
-
case
|
|
18
|
+
case generic_1.ConditionTypeEquality.EQUAL:
|
|
19
19
|
return dataValue === conditionValue;
|
|
20
|
-
case
|
|
20
|
+
case generic_1.ConditionTypeEquality.NOT_EQUAL:
|
|
21
21
|
return dataValue !== conditionValue;
|
|
22
22
|
}
|
|
23
23
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* This file contains the functions for checking that the null conditions are met.
|
|
3
3
|
*/
|
|
4
|
-
import { ConditionTypeNull } from '
|
|
4
|
+
import { ConditionTypeNull } from '@degenerate/generic';
|
|
5
5
|
/**
|
|
6
6
|
* This takes a value and checks if it meets the null condition.
|
|
7
7
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"null-conditions.d.ts","sourceRoot":"","sources":["../../../../../src/evaluation/conditions/null-conditions.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"null-conditions.d.ts","sourceRoot":"","sources":["../../../../../src/evaluation/conditions/null-conditions.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAExD;;;;;;;GAOG;AACH,QAAA,MAAM,gBAAgB,cAAe,GAAG,iBAAiB,iBAAiB,KAAG,OAO5E,CAAC;AAEF,OAAO,EAAE,gBAAgB,EAAE,CAAC"}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.isValidNullValue = void 0;
|
|
7
|
-
const
|
|
7
|
+
const generic_1 = require("@degenerate/generic");
|
|
8
8
|
/**
|
|
9
9
|
* This takes a value and checks if it meets the null condition.
|
|
10
10
|
*
|
|
@@ -15,9 +15,9 @@ const src_1 = require("../../../../generic/src");
|
|
|
15
15
|
*/
|
|
16
16
|
const isValidNullValue = (dataValue, conditionType) => {
|
|
17
17
|
switch (conditionType) {
|
|
18
|
-
case
|
|
18
|
+
case generic_1.ConditionTypeNull.IS_NULL:
|
|
19
19
|
return dataValue === null;
|
|
20
|
-
case
|
|
20
|
+
case generic_1.ConditionTypeNull.IS_NOT_NULL:
|
|
21
21
|
return dataValue !== null;
|
|
22
22
|
}
|
|
23
23
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* This file contains the functions for checking that range conditions are met.
|
|
3
3
|
*/
|
|
4
|
-
import { ConditionTypeRange } from '
|
|
4
|
+
import { ConditionTypeRange } from '@degenerate/generic';
|
|
5
5
|
/**
|
|
6
6
|
* This takes a value and checks if it is in the proper range of values.
|
|
7
7
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"range-conditions.d.ts","sourceRoot":"","sources":["../../../../../src/evaluation/conditions/range-conditions.ts"],"names":[],"mappings":"AACA;;GAEG;AAEH,OAAO,EAAE,kBAAkB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"range-conditions.d.ts","sourceRoot":"","sources":["../../../../../src/evaluation/conditions/range-conditions.ts"],"names":[],"mappings":"AACA;;GAEG;AAEH,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAEzD;;;;;;;GAOG;AACH,QAAA,MAAM,iBAAiB,cAAe,MAAM,GAAG,MAAM,kBAAkB,MAAM,GAAG,MAAM,iBAAiB,kBAAkB,KAAG,OAW3H,CAAC;AAEF,OAAO,EAAE,iBAAiB,EAAE,CAAC"}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.isValidRangeValue = void 0;
|
|
7
|
-
const
|
|
7
|
+
const generic_1 = require("@degenerate/generic");
|
|
8
8
|
/**
|
|
9
9
|
* This takes a value and checks if it is in the proper range of values.
|
|
10
10
|
*
|
|
@@ -15,13 +15,13 @@ const src_1 = require("../../../../generic/src");
|
|
|
15
15
|
*/
|
|
16
16
|
const isValidRangeValue = (dataValue, conditionValue, conditionType) => {
|
|
17
17
|
switch (conditionType) {
|
|
18
|
-
case
|
|
18
|
+
case generic_1.ConditionTypeRange.GREATER_THAN:
|
|
19
19
|
return dataValue > conditionValue;
|
|
20
|
-
case
|
|
20
|
+
case generic_1.ConditionTypeRange.LESS_THAN:
|
|
21
21
|
return dataValue < conditionValue;
|
|
22
|
-
case
|
|
22
|
+
case generic_1.ConditionTypeRange.GREATER_THAN_OR_EQUAL:
|
|
23
23
|
return dataValue >= conditionValue;
|
|
24
|
-
case
|
|
24
|
+
case generic_1.ConditionTypeRange.LESS_THAN_OR_EQUAL:
|
|
25
25
|
return dataValue <= conditionValue;
|
|
26
26
|
}
|
|
27
27
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* This file contains the functions for checking that special conditions are met.
|
|
3
3
|
*/
|
|
4
|
-
import { ConditionTypeSpecial } from '
|
|
4
|
+
import { ConditionTypeSpecial } from '@degenerate/generic';
|
|
5
5
|
/**
|
|
6
6
|
* This takes a value and checks if the special condition is met.
|
|
7
7
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"special-conditions.d.ts","sourceRoot":"","sources":["../../../../../src/evaluation/conditions/special-conditions.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,oBAAoB,EAAkD,MAAM,
|
|
1
|
+
{"version":3,"file":"special-conditions.d.ts","sourceRoot":"","sources":["../../../../../src/evaluation/conditions/special-conditions.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,oBAAoB,EAAkD,MAAM,qBAAqB,CAAC;AAE3G;;;;;;;GAOG;AACH,QAAA,MAAM,mBAAmB,cAAe,OAAO,kBAAkB,OAAO,iBAAiB,oBAAoB,KAAG,OAK/G,CAAC;AAEF,OAAO,EAAE,mBAAmB,EAAE,CAAC"}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.isValidSpecialValue = void 0;
|
|
7
|
-
const
|
|
7
|
+
const generic_1 = require("@degenerate/generic");
|
|
8
8
|
/**
|
|
9
9
|
* This takes a value and checks if the special condition is met.
|
|
10
10
|
*
|
|
@@ -15,7 +15,7 @@ const src_1 = require("../../../../generic/src");
|
|
|
15
15
|
*/
|
|
16
16
|
const isValidSpecialValue = (dataValue, conditionValue, conditionType) => {
|
|
17
17
|
switch (conditionType) {
|
|
18
|
-
case
|
|
18
|
+
case generic_1.ConditionTypeSpecial.PATTERN:
|
|
19
19
|
return evaluatePattern(dataValue, conditionValue);
|
|
20
20
|
}
|
|
21
21
|
};
|
|
@@ -40,7 +40,7 @@ const evaluatePattern = (dataValue, conditionValue) => {
|
|
|
40
40
|
return result;
|
|
41
41
|
}
|
|
42
42
|
catch (err) {
|
|
43
|
-
throw new
|
|
43
|
+
throw new generic_1.SafeRuleEvaluationSpecialConditionPatternError(dataValue, conditionValue);
|
|
44
44
|
}
|
|
45
45
|
// return regex.test(dataValue as string);
|
|
46
46
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* This file contains the functions for checking that starts or ends with are met
|
|
3
3
|
*/
|
|
4
|
-
import { ConditionTypeStartsEndsWith } from '
|
|
4
|
+
import { ConditionTypeStartsEndsWith } from '@degenerate/generic';
|
|
5
5
|
/**
|
|
6
6
|
* This takes a value and checks if the value starts or ends with value
|
|
7
7
|
*
|
|
@@ -11,6 +11,6 @@ import { ConditionTypeStartsEndsWith } from '../../../../generic/src';
|
|
|
11
11
|
*
|
|
12
12
|
* @returns
|
|
13
13
|
*/
|
|
14
|
-
declare const isValidStartEndWithValue: (dataValue: string | number, conditionValue: string |
|
|
14
|
+
declare const isValidStartEndWithValue: (dataValue: string | number, conditionValue: string | number, conditionType: ConditionTypeStartsEndsWith) => boolean;
|
|
15
15
|
export { isValidStartEndWithValue };
|
|
16
16
|
//# sourceMappingURL=starts-end-with-conditions.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"starts-end-with-conditions.d.ts","sourceRoot":"","sources":["../../../../../src/evaluation/conditions/starts-end-with-conditions.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,2BAA2B,
|
|
1
|
+
{"version":3,"file":"starts-end-with-conditions.d.ts","sourceRoot":"","sources":["../../../../../src/evaluation/conditions/starts-end-with-conditions.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,2BAA2B,EAAiB,MAAM,qBAAqB,CAAC;AAGjF;;;;;;;;GAQG;AACH,QAAA,MAAM,wBAAwB,cAAe,MAAM,GAAG,MAAM,kBAAkB,MAAM,GAAG,MAAM,iBAC1E,2BAA2B,KAAG,OAWhD,CAAC;AAEF,OAAO,EAAE,wBAAwB,EAAE,CAAC"}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.isValidStartEndWithValue = void 0;
|
|
7
|
-
const
|
|
7
|
+
const generic_1 = require("@degenerate/generic");
|
|
8
8
|
/**
|
|
9
9
|
* This takes a value and checks if the value starts or ends with value
|
|
10
10
|
*
|
|
@@ -15,11 +15,30 @@ const src_1 = require("../../../../generic/src");
|
|
|
15
15
|
* @returns
|
|
16
16
|
*/
|
|
17
17
|
const isValidStartEndWithValue = (dataValue, conditionValue, conditionType) => {
|
|
18
|
+
// Make sure the data type is correct
|
|
19
|
+
// if (!dataValue) SafeRuleEvaluationConditionDataValueError()
|
|
20
|
+
// Array.isArray(incomingObject)
|
|
21
|
+
// const isArray = validateArray
|
|
18
22
|
switch (conditionType) {
|
|
19
|
-
case
|
|
23
|
+
case generic_1.ConditionTypeStartsEndsWith.STARTS_WITH:
|
|
20
24
|
return dataValue.toString().startsWith(conditionValue.toString());
|
|
21
|
-
case
|
|
25
|
+
case generic_1.ConditionTypeStartsEndsWith.ENDS_WITH:
|
|
22
26
|
return dataValue.toString().endsWith(conditionValue.toString());
|
|
23
27
|
}
|
|
24
28
|
};
|
|
25
29
|
exports.isValidStartEndWithValue = isValidStartEndWithValue;
|
|
30
|
+
/**
|
|
31
|
+
* This takes a value and checks if the value starts or ends with value for a string or number
|
|
32
|
+
* @param dataValue the value to check
|
|
33
|
+
* @param conditionValue the value to check against
|
|
34
|
+
* @param conditionType the type of equality condition to check for
|
|
35
|
+
* @returns
|
|
36
|
+
*/
|
|
37
|
+
const isValidStartEndWithStringNumberValue = (dataValue, conditionValue, conditionType) => {
|
|
38
|
+
switch (conditionType) {
|
|
39
|
+
case generic_1.ConditionTypeStartsEndsWith.STARTS_WITH:
|
|
40
|
+
return dataValue.toString().startsWith(conditionValue.toString());
|
|
41
|
+
case generic_1.ConditionTypeStartsEndsWith.ENDS_WITH:
|
|
42
|
+
return dataValue.toString().endsWith(conditionValue.toString());
|
|
43
|
+
}
|
|
44
|
+
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* This file contains the functions for checking that the data is the proper type of data.
|
|
3
3
|
*/
|
|
4
|
-
import { ConditionTypeOf, ConditionTypeTypeOf } from '
|
|
4
|
+
import { ConditionTypeOf, ConditionTypeTypeOf } from '@degenerate/generic';
|
|
5
5
|
/**
|
|
6
6
|
* This takes a value and checks if it is the proper type of value.
|
|
7
7
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typeof-rule-conditions.d.ts","sourceRoot":"","sources":["../../../../../src/evaluation/conditions/typeof-rule-conditions.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"typeof-rule-conditions.d.ts","sourceRoot":"","sources":["../../../../../src/evaluation/conditions/typeof-rule-conditions.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAE3E;;;;;;;;GAQG;AACH,QAAA,MAAM,kBAAkB,cAAe,OAAO,eAAe,eAAe,iBAAiB,mBAAmB,KAAG,OAGlH,CAAC;AAsCF,OAAO,EAAE,kBAAkB,EAAE,CAAC"}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.isValidTypeOfValue = void 0;
|
|
7
|
-
const
|
|
7
|
+
const generic_1 = require("@degenerate/generic");
|
|
8
8
|
/**
|
|
9
9
|
* This takes a value and checks if it is the proper type of value.
|
|
10
10
|
*
|
|
@@ -16,7 +16,7 @@ const src_1 = require("../../../../generic/src");
|
|
|
16
16
|
*/
|
|
17
17
|
const isValidTypeOfValue = (dataValue, typeofValue, conditionType) => {
|
|
18
18
|
const initialResult = checkType(dataValue, typeofValue);
|
|
19
|
-
return (conditionType ===
|
|
19
|
+
return (conditionType === generic_1.ConditionTypeTypeOf.IS_TYPEOF) ? initialResult : !initialResult;
|
|
20
20
|
};
|
|
21
21
|
exports.isValidTypeOfValue = isValidTypeOfValue;
|
|
22
22
|
/**
|
|
@@ -28,27 +28,27 @@ exports.isValidTypeOfValue = isValidTypeOfValue;
|
|
|
28
28
|
*/
|
|
29
29
|
const checkType = (dataValue, typeofValue) => {
|
|
30
30
|
switch (typeofValue) {
|
|
31
|
-
case
|
|
31
|
+
case generic_1.ConditionTypeOf.STRING:
|
|
32
32
|
return typeof dataValue === 'string';
|
|
33
|
-
case
|
|
33
|
+
case generic_1.ConditionTypeOf.NUMBER:
|
|
34
34
|
return typeof dataValue === 'number';
|
|
35
|
-
case
|
|
35
|
+
case generic_1.ConditionTypeOf.INTEGER:
|
|
36
36
|
return Number.isInteger(dataValue);
|
|
37
|
-
case
|
|
37
|
+
case generic_1.ConditionTypeOf.BOOLEAN:
|
|
38
38
|
return typeof dataValue === 'boolean';
|
|
39
|
-
case
|
|
39
|
+
case generic_1.ConditionTypeOf.OBJECT:
|
|
40
40
|
return typeof dataValue === 'object';
|
|
41
|
-
case
|
|
41
|
+
case generic_1.ConditionTypeOf.ARRAY:
|
|
42
42
|
return Array.isArray(dataValue);
|
|
43
|
-
case
|
|
43
|
+
case generic_1.ConditionTypeOf.NULL:
|
|
44
44
|
return dataValue === null;
|
|
45
|
-
case
|
|
45
|
+
case generic_1.ConditionTypeOf.UNDEFINED:
|
|
46
46
|
return typeof dataValue === 'undefined';
|
|
47
|
-
case
|
|
47
|
+
case generic_1.ConditionTypeOf.FUNCTION:
|
|
48
48
|
return typeof dataValue === 'function';
|
|
49
49
|
// case ConditionTypeOf.SYMBOL:
|
|
50
50
|
// return typeof dataValue === 'symbol';
|
|
51
|
-
case
|
|
51
|
+
case generic_1.ConditionTypeOf.BIGINT:
|
|
52
52
|
return typeof dataValue === 'bigint';
|
|
53
53
|
default:
|
|
54
54
|
return false;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"determine-if-data-has-changed.d.ts","sourceRoot":"","sources":["../../../../src/evaluation/determine-if-data-has-changed.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"determine-if-data-has-changed.d.ts","sourceRoot":"","sources":["../../../../src/evaluation/determine-if-data-has-changed.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEjD;;;;;;GAMG;AACH,QAAA,MAAM,yBAAyB,YAAa,UAAU,WAAW,UAAU,KAAG,OAE7E,CAAC;AAEF,OAAO,EAAE,yBAAyB,EAAE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"evaluate-rule-conditions.d.ts","sourceRoot":"","sources":["../../../../src/evaluation/evaluate-rule-conditions.ts"],"names":[],"mappings":"AAAA,OAAO,EAUH,UAAU,EACV,aAAa,EAChB,MAAM,
|
|
1
|
+
{"version":3,"file":"evaluate-rule-conditions.d.ts","sourceRoot":"","sources":["../../../../src/evaluation/evaluate-rule-conditions.ts"],"names":[],"mappings":"AAAA,OAAO,EAUH,UAAU,EACV,aAAa,EAChB,MAAM,qBAAqB,CAAC;AAW7B;;;;;GAKG;AACH,QAAA,MAAM,sBAAsB,iBAAkB,aAAa,aAAa,UAAU,KAAG,OAkCpF,CAAC;AAGF,OAAO,EAAE,sBAAsB,EAAE,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.evaluateRuleConditions = void 0;
|
|
4
|
-
const
|
|
4
|
+
const generic_1 = require("@degenerate/generic");
|
|
5
5
|
const boolean_conditions_1 = require("./conditions/boolean-conditions");
|
|
6
6
|
const contains_conditions_1 = require("./conditions/contains-conditions");
|
|
7
7
|
const empty_conditions_1 = require("./conditions/empty-conditions");
|
|
@@ -21,33 +21,33 @@ const evaluateRuleConditions = (targetObject, condition) => {
|
|
|
21
21
|
const splitProperties = condition.targettedProperty.split('.');
|
|
22
22
|
const targetValue = getNestedProperty(targetObject, splitProperties);
|
|
23
23
|
switch (condition.conditionType) {
|
|
24
|
-
case
|
|
25
|
-
case
|
|
24
|
+
case generic_1.ConditionTypeTypeOf.IS_TYPEOF:
|
|
25
|
+
case generic_1.ConditionTypeTypeOf.IS_NOT_TYPEOF:
|
|
26
26
|
return (0, typeof_rule_conditions_1.isValidTypeOfValue)(targetValue, condition.conditionValue, condition.conditionType);
|
|
27
|
-
case
|
|
28
|
-
case
|
|
27
|
+
case generic_1.ConditionTypeEquality.EQUAL:
|
|
28
|
+
case generic_1.ConditionTypeEquality.NOT_EQUAL:
|
|
29
29
|
return (0, equality_conditions_1.isValidEqualityValue)(targetValue, condition.conditionValue, condition.conditionType);
|
|
30
|
-
case
|
|
31
|
-
case
|
|
32
|
-
case
|
|
33
|
-
case
|
|
30
|
+
case generic_1.ConditionTypeRange.GREATER_THAN:
|
|
31
|
+
case generic_1.ConditionTypeRange.LESS_THAN:
|
|
32
|
+
case generic_1.ConditionTypeRange.GREATER_THAN_OR_EQUAL:
|
|
33
|
+
case generic_1.ConditionTypeRange.LESS_THAN_OR_EQUAL:
|
|
34
34
|
return (0, range_conditions_1.isValidRangeValue)(targetValue, condition.conditionValue, condition.conditionType);
|
|
35
|
-
case
|
|
36
|
-
case
|
|
35
|
+
case generic_1.ConditionTypeContains.CONTAINS:
|
|
36
|
+
case generic_1.ConditionTypeContains.NOT_CONTAINS:
|
|
37
37
|
return (0, contains_conditions_1.isValidContainsValue)(targetValue, condition.conditionValue, condition.conditionType);
|
|
38
|
-
case
|
|
39
|
-
case
|
|
38
|
+
case generic_1.ConditionTypeStartsEndsWith.STARTS_WITH:
|
|
39
|
+
case generic_1.ConditionTypeStartsEndsWith.ENDS_WITH:
|
|
40
40
|
return (0, starts_end_with_conditions_1.isValidStartEndWithValue)(targetValue, condition.conditionValue, condition.conditionType);
|
|
41
|
-
case
|
|
42
|
-
case
|
|
41
|
+
case generic_1.ConditionTypeNull.IS_NULL:
|
|
42
|
+
case generic_1.ConditionTypeNull.IS_NOT_NULL:
|
|
43
43
|
return (0, null_conditions_1.isValidNullValue)(targetValue, condition.conditionType);
|
|
44
|
-
case
|
|
45
|
-
case
|
|
44
|
+
case generic_1.ConditionTypeBoolean.IS_TRUE:
|
|
45
|
+
case generic_1.ConditionTypeBoolean.IS_FALSE:
|
|
46
46
|
return (0, boolean_conditions_1.isValidBooleanValue)(targetValue, condition.conditionType);
|
|
47
|
-
case
|
|
48
|
-
case
|
|
47
|
+
case generic_1.ConditionTypeEmpty.IS_EMPTY:
|
|
48
|
+
case generic_1.ConditionTypeEmpty.IS_NOT_EMPTY:
|
|
49
49
|
return (0, empty_conditions_1.isValidEmptyValue)(targetValue, condition.conditionType);
|
|
50
|
-
case
|
|
50
|
+
case generic_1.ConditionTypeSpecial.PATTERN:
|
|
51
51
|
return (0, special_conditions_1.isValidSpecialValue)(targetObject, condition.conditionValue, condition.conditionType);
|
|
52
52
|
}
|
|
53
53
|
// return false;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IShareRuleApplied, IShareData, IShareRuleEvalutionResult } from '
|
|
1
|
+
import { IShareRuleApplied, IShareData, IShareRuleEvalutionResult } from '@degenerate/generic';
|
|
2
2
|
/**
|
|
3
3
|
* This function evaluates a rule and returns the Id of the rule and whether it is valid.
|
|
4
4
|
*
|