@degenerate/rules 0.0.2 → 0.0.3
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/{rules/src/evaluation → evaluation}/check-function-integrity.d.ts +1 -1
- package/dist/evaluation/check-function-integrity.d.ts.map +1 -0
- package/dist/{rules/src/evaluation → evaluation}/check-if-proposal-is-valid.d.ts +1 -1
- package/dist/evaluation/check-if-proposal-is-valid.d.ts.map +1 -0
- package/dist/{rules/src/evaluation → evaluation}/conditions/boolean-conditions.d.ts +1 -1
- package/dist/evaluation/conditions/boolean-conditions.d.ts.map +1 -0
- package/dist/{rules/src/evaluation → evaluation}/conditions/boolean-conditions.js +4 -5
- package/dist/{rules/src/evaluation → evaluation}/conditions/contains-conditions.d.ts +1 -1
- package/dist/evaluation/conditions/contains-conditions.d.ts.map +1 -0
- package/dist/{rules/src/evaluation → evaluation}/conditions/contains-conditions.js +2 -2
- package/dist/{rules/src/evaluation → evaluation}/conditions/empty-conditions.d.ts +1 -1
- package/dist/evaluation/conditions/empty-conditions.d.ts.map +1 -0
- package/dist/{rules/src/evaluation → evaluation}/conditions/empty-conditions.js +6 -6
- package/dist/{rules/src/evaluation → evaluation}/conditions/equality-conditions.d.ts +1 -1
- package/dist/evaluation/conditions/equality-conditions.d.ts.map +1 -0
- package/dist/{rules/src/evaluation → evaluation}/conditions/equality-conditions.js +3 -3
- package/dist/{rules/src/evaluation → evaluation}/conditions/null-conditions.d.ts +1 -1
- package/dist/evaluation/conditions/null-conditions.d.ts.map +1 -0
- package/dist/{rules/src/evaluation → evaluation}/conditions/null-conditions.js +3 -3
- package/dist/{rules/src/evaluation → evaluation}/conditions/range-conditions.d.ts +1 -1
- package/dist/evaluation/conditions/range-conditions.d.ts.map +1 -0
- package/dist/{rules/src/evaluation → evaluation}/conditions/range-conditions.js +5 -5
- package/dist/{rules/src/evaluation → evaluation}/conditions/special-conditions.d.ts +1 -1
- package/dist/evaluation/conditions/special-conditions.d.ts.map +1 -0
- package/dist/{rules/src/evaluation → evaluation}/conditions/special-conditions.js +3 -3
- package/dist/{rules/src/evaluation → evaluation}/conditions/starts-end-with-conditions.d.ts +1 -1
- package/dist/evaluation/conditions/starts-end-with-conditions.d.ts.map +1 -0
- package/dist/{rules/src/evaluation → evaluation}/conditions/starts-end-with-conditions.js +3 -3
- package/dist/{rules/src/evaluation → evaluation}/conditions/typeof-rule-conditions.d.ts +1 -1
- package/dist/evaluation/conditions/typeof-rule-conditions.d.ts.map +1 -0
- package/dist/{rules/src/evaluation → evaluation}/conditions/typeof-rule-conditions.js +12 -12
- package/dist/{rules/src/evaluation → evaluation}/determine-if-data-has-changed.d.ts +1 -1
- package/dist/evaluation/determine-if-data-has-changed.d.ts.map +1 -0
- package/dist/{rules/src/evaluation → evaluation}/evaluate-rule-conditions.d.ts +1 -1
- package/dist/evaluation/evaluate-rule-conditions.d.ts.map +1 -0
- package/dist/{rules/src/evaluation → evaluation}/evaluate-rule-conditions.js +20 -20
- package/dist/{rules/src/evaluation → evaluation}/evaluate-rule.d.ts +1 -1
- package/dist/evaluation/evaluate-rule.d.ts.map +1 -0
- package/dist/{rules/src/evaluation → evaluation}/evaluate-rules.d.ts +1 -1
- package/dist/evaluation/evaluate-rules.d.ts.map +1 -0
- package/dist/{rules/src/evaluation → evaluation}/get-data-changed-information.d.ts +1 -1
- package/dist/evaluation/get-data-changed-information.d.ts.map +1 -0
- package/dist/{rules/src/evaluation → evaluation}/get-root-property-results.d.ts +1 -1
- package/dist/evaluation/get-root-property-results.d.ts.map +1 -0
- package/dist/evaluation/index.d.ts.map +1 -0
- package/dist/{rules/src/evaluation → evaluation}/start-rule-evaluation.d.ts +1 -1
- package/dist/evaluation/start-rule-evaluation.d.ts.map +1 -0
- package/dist/{rules/src/evaluation → evaluation}/start-rule-evaluation.js +3 -3
- package/dist/index.d.ts.map +1 -0
- 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/errors/base-error.d.ts +0 -23
- package/dist/generic/src/errors/base-error.d.ts.map +0 -1
- package/dist/generic/src/errors/base-error.js +0 -34
- package/dist/generic/src/errors/generic/generic-errors.d.ts +0 -35
- package/dist/generic/src/errors/generic/generic-errors.d.ts.map +0 -1
- package/dist/generic/src/errors/generic/generic-errors.js +0 -47
- package/dist/generic/src/errors/index.d.ts +0 -7
- package/dist/generic/src/errors/index.d.ts.map +0 -1
- package/dist/generic/src/errors/index.js +0 -22
- package/dist/generic/src/errors/request/request-errors.d.ts +0 -89
- package/dist/generic/src/errors/request/request-errors.d.ts.map +0 -1
- package/dist/generic/src/errors/request/request-errors.js +0 -120
- package/dist/generic/src/errors/safe/safe-rules-errors.d.ts +0 -11
- package/dist/generic/src/errors/safe/safe-rules-errors.d.ts.map +0 -1
- package/dist/generic/src/errors/safe/safe-rules-errors.js +0 -17
- package/dist/generic/src/errors/scheduler/scheduler-errors.d.ts +0 -8
- package/dist/generic/src/errors/scheduler/scheduler-errors.d.ts.map +0 -1
- package/dist/generic/src/errors/scheduler/scheduler-errors.js +0 -14
- package/dist/generic/src/errors/share-data/share-data-errors.d.ts +0 -49
- package/dist/generic/src/errors/share-data/share-data-errors.d.ts.map +0 -1
- package/dist/generic/src/errors/share-data/share-data-errors.js +0 -66
- 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
- package/dist/generic/src/models/data/data-models.d.ts +0 -24
- package/dist/generic/src/models/data/data-models.d.ts.map +0 -1
- package/dist/generic/src/models/data/data-models.js +0 -3
- package/dist/generic/src/models/dynamic-execution/dynamic-execution-models.d.ts +0 -9
- package/dist/generic/src/models/dynamic-execution/dynamic-execution-models.d.ts.map +0 -1
- package/dist/generic/src/models/dynamic-execution/dynamic-execution-models.js +0 -2
- package/dist/generic/src/models/events/share-event-models.d.ts +0 -65
- package/dist/generic/src/models/events/share-event-models.d.ts.map +0 -1
- package/dist/generic/src/models/events/share-event-models.js +0 -70
- package/dist/generic/src/models/functions/share-data-function-models.d.ts +0 -86
- package/dist/generic/src/models/functions/share-data-function-models.d.ts.map +0 -1
- package/dist/generic/src/models/functions/share-data-function-models.js +0 -17
- package/dist/generic/src/models/generic/request-response-models.d.ts +0 -8
- package/dist/generic/src/models/generic/request-response-models.d.ts.map +0 -1
- package/dist/generic/src/models/generic/request-response-models.js +0 -2
- package/dist/generic/src/models/index.d.ts +0 -8
- package/dist/generic/src/models/index.d.ts.map +0 -1
- package/dist/generic/src/models/index.js +0 -24
- package/dist/generic/src/models/rules/share-rule-models.d.ts +0 -277
- package/dist/generic/src/models/rules/share-rule-models.d.ts.map +0 -1
- package/dist/generic/src/models/rules/share-rule-models.js +0 -107
- package/dist/generic/src/models/share-data/share-data.d.ts +0 -55
- package/dist/generic/src/models/share-data/share-data.d.ts.map +0 -1
- package/dist/generic/src/models/share-data/share-data.js +0 -19
- package/dist/rules/src/evaluation/check-function-integrity.d.ts.map +0 -1
- package/dist/rules/src/evaluation/check-if-proposal-is-valid.d.ts.map +0 -1
- package/dist/rules/src/evaluation/conditions/boolean-conditions.d.ts.map +0 -1
- package/dist/rules/src/evaluation/conditions/contains-conditions.d.ts.map +0 -1
- package/dist/rules/src/evaluation/conditions/empty-conditions.d.ts.map +0 -1
- package/dist/rules/src/evaluation/conditions/equality-conditions.d.ts.map +0 -1
- package/dist/rules/src/evaluation/conditions/null-conditions.d.ts.map +0 -1
- package/dist/rules/src/evaluation/conditions/range-conditions.d.ts.map +0 -1
- package/dist/rules/src/evaluation/conditions/special-conditions.d.ts.map +0 -1
- package/dist/rules/src/evaluation/conditions/starts-end-with-conditions.d.ts.map +0 -1
- package/dist/rules/src/evaluation/conditions/typeof-rule-conditions.d.ts.map +0 -1
- package/dist/rules/src/evaluation/determine-if-data-has-changed.d.ts.map +0 -1
- package/dist/rules/src/evaluation/evaluate-rule-conditions.d.ts.map +0 -1
- package/dist/rules/src/evaluation/evaluate-rule.d.ts.map +0 -1
- package/dist/rules/src/evaluation/evaluate-rules.d.ts.map +0 -1
- package/dist/rules/src/evaluation/get-data-changed-information.d.ts.map +0 -1
- package/dist/rules/src/evaluation/get-root-property-results.d.ts.map +0 -1
- package/dist/rules/src/evaluation/index.d.ts.map +0 -1
- package/dist/rules/src/evaluation/start-rule-evaluation.d.ts.map +0 -1
- package/dist/rules/src/index.d.ts.map +0 -1
- /package/dist/{rules/src/evaluation → evaluation}/check-function-integrity.js +0 -0
- /package/dist/{rules/src/evaluation → evaluation}/check-if-proposal-is-valid.js +0 -0
- /package/dist/{rules/src/evaluation → evaluation}/determine-if-data-has-changed.js +0 -0
- /package/dist/{rules/src/evaluation → evaluation}/evaluate-rule.js +0 -0
- /package/dist/{rules/src/evaluation → evaluation}/evaluate-rules.js +0 -0
- /package/dist/{rules/src/evaluation → evaluation}/get-data-changed-information.js +0 -0
- /package/dist/{rules/src/evaluation → evaluation}/get-root-property-results.js +0 -0
- /package/dist/{rules/src/evaluation → evaluation}/index.d.ts +0 -0
- /package/dist/{rules/src/evaluation → evaluation}/index.js +0 -0
- /package/dist/{rules/src/index.d.ts → index.d.ts} +0 -0
- /package/dist/{rules/src/index.js → index.js} +0 -0
|
@@ -0,0 +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,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"}
|
|
@@ -0,0 +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,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
|
*
|
|
@@ -0,0 +1 @@
|
|
|
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
|
*
|
|
@@ -0,0 +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,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
|
*
|
|
@@ -0,0 +1 @@
|
|
|
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
|
*
|
|
@@ -0,0 +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,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
|
*
|
|
@@ -0,0 +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,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
|
*
|
|
@@ -0,0 +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,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
|
*
|
|
@@ -0,0 +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,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
|
*
|
|
@@ -0,0 +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,EAAE,MAAM,qBAAqB,CAAC;AAElE;;;;;;;;GAQG;AACH,QAAA,MAAM,wBAAwB,cAAe,MAAM,GAAG,MAAM,kBAAkB,MAAM,GAAG,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,iBACvF,2BAA2B,KAAG,OAOhD,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
|
*
|
|
@@ -16,9 +16,9 @@ const src_1 = require("../../../../generic/src");
|
|
|
16
16
|
*/
|
|
17
17
|
const isValidStartEndWithValue = (dataValue, conditionValue, conditionType) => {
|
|
18
18
|
switch (conditionType) {
|
|
19
|
-
case
|
|
19
|
+
case generic_1.ConditionTypeStartsEndsWith.STARTS_WITH:
|
|
20
20
|
return dataValue.toString().startsWith(conditionValue.toString());
|
|
21
|
-
case
|
|
21
|
+
case generic_1.ConditionTypeStartsEndsWith.ENDS_WITH:
|
|
22
22
|
return dataValue.toString().endsWith(conditionValue.toString());
|
|
23
23
|
}
|
|
24
24
|
};
|
|
@@ -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
|
*
|
|
@@ -0,0 +1 @@
|
|
|
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;
|
|
@@ -0,0 +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,qBAAqB,CAAC;AAEjD;;;;;;GAMG;AACH,QAAA,MAAM,yBAAyB,YAAa,UAAU,WAAW,UAAU,KAAG,OAE7E,CAAC;AAEF,OAAO,EAAE,yBAAyB,EAAE,CAAC"}
|
|
@@ -0,0 +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,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
|
*
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"evaluate-rule.d.ts","sourceRoot":"","sources":["../../src/evaluation/evaluate-rule.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,UAAU,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,CAAC;AAG/F;;;;;;;;GAQG;AACH,QAAA,MAAM,YAAY,SACR,iBAAiB,oBACL,UAAU,qBACT,UAAU,wBAE9B,yBAmCF,CAAC;AAEF,OAAO,EAAE,YAAY,EAAE,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IShareRuleApplied, IShareData, IShareRulesEvaluationResult } from '
|
|
1
|
+
import { IShareRuleApplied, IShareData, IShareRulesEvaluationResult } from '@degenerate/generic';
|
|
2
2
|
/**
|
|
3
3
|
* This function evaluates all rules to check if at least one rule is valid.
|
|
4
4
|
* @param rootParam the root parameter that all the rules are providing a allow / deny for
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"evaluate-rules.d.ts","sourceRoot":"","sources":["../../src/evaluation/evaluate-rules.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,UAAU,EAAE,2BAA2B,EAA6B,MAAM,qBAAqB,CAAC;AAG5H;;;;;;;GAOG;AACH,QAAA,MAAM,aAAa,cACJ,MAAM,gBACH,iBAAiB,EAAE,oBACf,UAAU,qBACT,UAAU,wBAE9B,2BA2BF,CAAC;AAEF,OAAO,EAAE,aAAa,EAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-data-changed-information.d.ts","sourceRoot":"","sources":["../../src/evaluation/get-data-changed-information.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAGjD;;;;;;GAMG;AACH,QAAA,MAAM,0BAA0B,qBAAsB,UAAU,qBACzC,UAAU,KAAG,MAAM,EAsBzC,CAAC;AAEF,OAAO,EAAE,0BAA0B,EAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-root-property-results.d.ts","sourceRoot":"","sources":["../../src/evaluation/get-root-property-results.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,UAAU,EAAE,2BAA2B,EAAE,MAAM,qBAAqB,CAAC;AAGjG;;;;;;;;;GASG;AACH,QAAA,MAAM,sBAAsB,4BACC,MAAM,EAAE,gBACnB,iBAAiB,EAAE,oBACf,UAAU,qBACT,UAAU,wBAE9B,2BAA2B,EAa7B,CAAC;AAEF,OAAO,EAAE,sBAAsB,EAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/evaluation/index.ts"],"names":[],"mappings":"AAEA,cAAc,iCAAiC,CAAC;AAChD,cAAc,kCAAkC,CAAC;AACjD,cAAc,+BAA+B,CAAC;AAC9C,cAAc,kCAAkC,CAAC;AACjD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,iCAAiC,CAAC;AAChD,cAAc,yCAAyC,CAAC;AACxD,cAAc,qCAAqC,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IShareFunction, IShareRuleApplied, IShareData, IRuleEvaluationResults } from '
|
|
1
|
+
import { IShareFunction, IShareRuleApplied, IShareData, IRuleEvaluationResults } from '@degenerate/generic';
|
|
2
2
|
/**
|
|
3
3
|
* This function starts the rule evaluation for the share data.
|
|
4
4
|
*
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"start-rule-evaluation.d.ts","sourceRoot":"","sources":["../../src/evaluation/start-rule-evaluation.ts"],"names":[],"mappings":"AAEA,OAAO,EACH,cAAc,EACd,iBAAiB,EACjB,UAAU,EACV,sBAAsB,EAGzB,MAAM,qBAAqB,CAAC;AAO7B;;;;;;;;GAQG;AACH,QAAA,MAAM,mBAAmB,gBACR,MAAM,qBACA,cAAc,CAAC,GAAG,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,EAAE,GAAG,CAAC,sBAChD,cAAc,CAAC,GAAG,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,EAAE,GAAG,CAAC,EAAE,gBACzD,iBAAiB,EAAE,oBACf,UAAU,qBACT,UAAU,wBAE9B,sBA4BF,CAAC;AAEF,OAAO,EAAE,mBAAmB,EAAE,CAAC"}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
exports.startRuleEvaluation = void 0;
|
|
5
|
-
const
|
|
5
|
+
const generic_1 = require("@degenerate/generic");
|
|
6
6
|
const check_function_integrity_1 = require("./check-function-integrity");
|
|
7
7
|
const check_if_proposal_is_valid_1 = require("./check-if-proposal-is-valid");
|
|
8
8
|
const determine_if_data_has_changed_1 = require("./determine-if-data-has-changed");
|
|
@@ -26,11 +26,11 @@ const startRuleEvaluation = (shareDataId, shareDataFunction, shareDataFunctions,
|
|
|
26
26
|
};
|
|
27
27
|
// check data integrity
|
|
28
28
|
if (!(0, check_function_integrity_1.checkFunctionIntegrity)(shareDataFunction, shareDataFunctions)) {
|
|
29
|
-
throw new
|
|
29
|
+
throw new generic_1.ShareDataIntegrityError(shareDataId);
|
|
30
30
|
}
|
|
31
31
|
// check if the data has changed.
|
|
32
32
|
if (!(0, determine_if_data_has_changed_1.determineIfDataHasChanged)(shareDataCurrent, shareDataProposed)) {
|
|
33
|
-
throw new
|
|
33
|
+
throw new generic_1.ShareDataCurrentAndProposalDataMatchesError(shareDataId);
|
|
34
34
|
}
|
|
35
35
|
// get all root properties that are different
|
|
36
36
|
const differentRootProperties = (0, get_data_changed_information_1.getRootPropertyDifferences)(shareDataCurrent, shareDataProposed);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@degenerate/rules",
|
|
3
3
|
"description": "This contains the rules information needed for the ShareData Adaptive Framework Ecosystem (SAFE) network.",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.3",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
7
|
"devDependencies": {
|
|
@@ -34,5 +34,8 @@
|
|
|
34
34
|
},
|
|
35
35
|
"homepage": "https://github.com/syncrude/safe#readme",
|
|
36
36
|
"author": "Degenerate Inc.",
|
|
37
|
-
"license": "ISC"
|
|
37
|
+
"license": "ISC",
|
|
38
|
+
"dependencies": {
|
|
39
|
+
"@degenerate/generic": "^0.0.11"
|
|
40
|
+
}
|
|
38
41
|
}
|