@degenerate/rules 0.0.1
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/README.md +3 -0
- package/dist/generic/src/_settings/cryptography-settings.d.ts +27 -0
- package/dist/generic/src/_settings/cryptography-settings.d.ts.map +1 -0
- package/dist/generic/src/_settings/cryptography-settings.js +27 -0
- package/dist/generic/src/crypto/calculate-combined-hash.d.ts +13 -0
- package/dist/generic/src/crypto/calculate-combined-hash.d.ts.map +1 -0
- package/dist/generic/src/crypto/calculate-combined-hash.js +44 -0
- package/dist/generic/src/crypto/calculate-hash.d.ts +7 -0
- package/dist/generic/src/crypto/calculate-hash.d.ts.map +1 -0
- package/dist/generic/src/crypto/calculate-hash.js +37 -0
- package/dist/generic/src/crypto/index.d.ts +13 -0
- package/dist/generic/src/crypto/index.d.ts.map +1 -0
- package/dist/generic/src/crypto/index.js +34 -0
- package/dist/generic/src/crypto/private-public-keys/create-key-pair-from-mnemonic.d.ts +12 -0
- package/dist/generic/src/crypto/private-public-keys/create-key-pair-from-mnemonic.d.ts.map +1 -0
- package/dist/generic/src/crypto/private-public-keys/create-key-pair-from-mnemonic.js +44 -0
- package/dist/generic/src/crypto/private-public-keys/create-key-pair-from-private-key.d.ts +11 -0
- package/dist/generic/src/crypto/private-public-keys/create-key-pair-from-private-key.d.ts.map +1 -0
- package/dist/generic/src/crypto/private-public-keys/create-key-pair-from-private-key.js +40 -0
- package/dist/generic/src/crypto/private-public-keys/generation/create-256-private-key-from-mnemonic.d.ts +11 -0
- package/dist/generic/src/crypto/private-public-keys/generation/create-256-private-key-from-mnemonic.d.ts.map +1 -0
- package/dist/generic/src/crypto/private-public-keys/generation/create-256-private-key-from-mnemonic.js +45 -0
- package/dist/generic/src/crypto/private-public-keys/generation/create-entropy-for-elliptical-curve.d.ts +10 -0
- package/dist/generic/src/crypto/private-public-keys/generation/create-entropy-for-elliptical-curve.d.ts.map +1 -0
- package/dist/generic/src/crypto/private-public-keys/generation/create-entropy-for-elliptical-curve.js +40 -0
- package/dist/generic/src/crypto/private-public-keys/generation/create-random-256-private-key.d.ts +8 -0
- package/dist/generic/src/crypto/private-public-keys/generation/create-random-256-private-key.d.ts.map +1 -0
- package/dist/generic/src/crypto/private-public-keys/generation/create-random-256-private-key.js +41 -0
- package/dist/generic/src/crypto/private-public-keys/generation/generate-key-pair.d.ts +11 -0
- package/dist/generic/src/crypto/private-public-keys/generation/generate-key-pair.d.ts.map +1 -0
- package/dist/generic/src/crypto/private-public-keys/generation/generate-key-pair.js +39 -0
- package/dist/generic/src/crypto/private-public-keys/generation/get-private-public-key-from-keypair.d.ts +15 -0
- package/dist/generic/src/crypto/private-public-keys/generation/get-private-public-key-from-keypair.d.ts.map +1 -0
- package/dist/generic/src/crypto/private-public-keys/generation/get-private-public-key-from-keypair.js +21 -0
- package/dist/generic/src/crypto/signature/create-crypto-signature.d.ts +9 -0
- package/dist/generic/src/crypto/signature/create-crypto-signature.d.ts.map +1 -0
- package/dist/generic/src/crypto/signature/create-crypto-signature.js +13 -0
- package/dist/generic/src/crypto/signature/verify-crypto-signature-by-data.d.ts +13 -0
- package/dist/generic/src/crypto/signature/verify-crypto-signature-by-data.d.ts.map +1 -0
- package/dist/generic/src/crypto/signature/verify-crypto-signature-by-data.js +45 -0
- package/dist/generic/src/crypto/signature/verify-crypto-signature-by-hash.d.ts +13 -0
- package/dist/generic/src/crypto/signature/verify-crypto-signature-by-hash.d.ts.map +1 -0
- package/dist/generic/src/crypto/signature/verify-crypto-signature-by-hash.js +42 -0
- package/dist/generic/src/errors/base-error.d.ts +23 -0
- package/dist/generic/src/errors/base-error.d.ts.map +1 -0
- package/dist/generic/src/errors/base-error.js +34 -0
- package/dist/generic/src/errors/generic/generic-errors.d.ts +35 -0
- package/dist/generic/src/errors/generic/generic-errors.d.ts.map +1 -0
- package/dist/generic/src/errors/generic/generic-errors.js +47 -0
- package/dist/generic/src/errors/index.d.ts +7 -0
- package/dist/generic/src/errors/index.d.ts.map +1 -0
- package/dist/generic/src/errors/index.js +22 -0
- package/dist/generic/src/errors/request/request-errors.d.ts +89 -0
- package/dist/generic/src/errors/request/request-errors.d.ts.map +1 -0
- package/dist/generic/src/errors/request/request-errors.js +120 -0
- package/dist/generic/src/errors/safe/safe-rules-errors.d.ts +11 -0
- package/dist/generic/src/errors/safe/safe-rules-errors.d.ts.map +1 -0
- package/dist/generic/src/errors/safe/safe-rules-errors.js +17 -0
- package/dist/generic/src/errors/scheduler/scheduler-errors.d.ts +8 -0
- package/dist/generic/src/errors/scheduler/scheduler-errors.d.ts.map +1 -0
- package/dist/generic/src/errors/scheduler/scheduler-errors.js +14 -0
- package/dist/generic/src/errors/share-data/share-data-errors.d.ts +49 -0
- package/dist/generic/src/errors/share-data/share-data-errors.d.ts.map +1 -0
- package/dist/generic/src/errors/share-data/share-data-errors.js +66 -0
- package/dist/generic/src/helpers/array/array-helpers.d.ts +8 -0
- package/dist/generic/src/helpers/array/array-helpers.d.ts.map +1 -0
- package/dist/generic/src/helpers/array/array-helpers.js +14 -0
- package/dist/generic/src/helpers/data/data-helpers.d.ts +46 -0
- package/dist/generic/src/helpers/data/data-helpers.d.ts.map +1 -0
- package/dist/generic/src/helpers/data/data-helpers.js +106 -0
- package/dist/generic/src/helpers/file/file-helpers.d.ts +12 -0
- package/dist/generic/src/helpers/file/file-helpers.d.ts.map +1 -0
- package/dist/generic/src/helpers/file/file-helpers.js +39 -0
- package/dist/generic/src/helpers/id-helpers.d.ts +8 -0
- package/dist/generic/src/helpers/id-helpers.d.ts.map +1 -0
- package/dist/generic/src/helpers/id-helpers.js +19 -0
- package/dist/generic/src/helpers/index.d.ts +11 -0
- package/dist/generic/src/helpers/index.d.ts.map +1 -0
- package/dist/generic/src/helpers/index.js +31 -0
- package/dist/generic/src/helpers/lodash/lodash-helpers.d.ts +14 -0
- package/dist/generic/src/helpers/lodash/lodash-helpers.d.ts.map +1 -0
- package/dist/generic/src/helpers/lodash/lodash-helpers.js +28 -0
- package/dist/generic/src/helpers/object-helpers.d.ts +23 -0
- package/dist/generic/src/helpers/object-helpers.d.ts.map +1 -0
- package/dist/generic/src/helpers/object-helpers.js +54 -0
- package/dist/generic/src/helpers/object-validation-helpers.d.ts +59 -0
- package/dist/generic/src/helpers/object-validation-helpers.d.ts.map +1 -0
- package/dist/generic/src/helpers/object-validation-helpers.js +233 -0
- package/dist/generic/src/helpers/request/params-object-helpers.d.ts +38 -0
- package/dist/generic/src/helpers/request/params-object-helpers.d.ts.map +1 -0
- package/dist/generic/src/helpers/request/params-object-helpers.js +54 -0
- package/dist/generic/src/helpers/request/query-object-helpers.d.ts +12 -0
- package/dist/generic/src/helpers/request/query-object-helpers.d.ts.map +1 -0
- package/dist/generic/src/helpers/request/query-object-helpers.js +25 -0
- package/dist/generic/src/helpers/request/request-object-helpers.d.ts +19 -0
- package/dist/generic/src/helpers/request/request-object-helpers.d.ts.map +1 -0
- package/dist/generic/src/helpers/request/request-object-helpers.js +28 -0
- package/dist/generic/src/index.d.ts +6 -0
- package/dist/generic/src/index.d.ts.map +1 -0
- package/dist/generic/src/index.js +23 -0
- package/dist/generic/src/models/data/data-models.d.ts +24 -0
- package/dist/generic/src/models/data/data-models.d.ts.map +1 -0
- package/dist/generic/src/models/data/data-models.js +3 -0
- package/dist/generic/src/models/dynamic-execution/dynamic-execution-models.d.ts +9 -0
- package/dist/generic/src/models/dynamic-execution/dynamic-execution-models.d.ts.map +1 -0
- package/dist/generic/src/models/dynamic-execution/dynamic-execution-models.js +2 -0
- package/dist/generic/src/models/events/share-event-models.d.ts +65 -0
- package/dist/generic/src/models/events/share-event-models.d.ts.map +1 -0
- package/dist/generic/src/models/events/share-event-models.js +70 -0
- package/dist/generic/src/models/functions/share-data-function-models.d.ts +86 -0
- package/dist/generic/src/models/functions/share-data-function-models.d.ts.map +1 -0
- package/dist/generic/src/models/functions/share-data-function-models.js +17 -0
- package/dist/generic/src/models/generic/request-response-models.d.ts +8 -0
- package/dist/generic/src/models/generic/request-response-models.d.ts.map +1 -0
- package/dist/generic/src/models/generic/request-response-models.js +2 -0
- package/dist/generic/src/models/index.d.ts +8 -0
- package/dist/generic/src/models/index.d.ts.map +1 -0
- package/dist/generic/src/models/index.js +24 -0
- package/dist/generic/src/models/rules/share-rule-models.d.ts +277 -0
- package/dist/generic/src/models/rules/share-rule-models.d.ts.map +1 -0
- package/dist/generic/src/models/rules/share-rule-models.js +107 -0
- package/dist/generic/src/models/share-data/share-data.d.ts +55 -0
- package/dist/generic/src/models/share-data/share-data.d.ts.map +1 -0
- package/dist/generic/src/models/share-data/share-data.js +19 -0
- package/dist/rules/jest.config.d.ts +8 -0
- package/dist/rules/jest.config.d.ts.map +1 -0
- package/dist/rules/jest.config.js +44 -0
- package/dist/rules/src/evaluation/check-function-integrity.d.ts +7 -0
- package/dist/rules/src/evaluation/check-function-integrity.d.ts.map +1 -0
- package/dist/rules/src/evaluation/check-function-integrity.js +14 -0
- package/dist/rules/src/evaluation/check-if-proposal-is-valid.d.ts +11 -0
- package/dist/rules/src/evaluation/check-if-proposal-is-valid.d.ts.map +1 -0
- package/dist/rules/src/evaluation/check-if-proposal-is-valid.js +15 -0
- package/dist/rules/src/evaluation/conditions/boolean-conditions.d.ts +15 -0
- package/dist/rules/src/evaluation/conditions/boolean-conditions.d.ts.map +1 -0
- package/dist/rules/src/evaluation/conditions/boolean-conditions.js +29 -0
- package/dist/rules/src/evaluation/conditions/contains-conditions.d.ts +16 -0
- package/dist/rules/src/evaluation/conditions/contains-conditions.d.ts.map +1 -0
- package/dist/rules/src/evaluation/conditions/contains-conditions.js +27 -0
- package/dist/rules/src/evaluation/conditions/empty-conditions.d.ts +15 -0
- package/dist/rules/src/evaluation/conditions/empty-conditions.d.ts.map +1 -0
- package/dist/rules/src/evaluation/conditions/empty-conditions.js +50 -0
- package/dist/rules/src/evaluation/conditions/equality-conditions.d.ts +15 -0
- package/dist/rules/src/evaluation/conditions/equality-conditions.d.ts.map +1 -0
- package/dist/rules/src/evaluation/conditions/equality-conditions.js +24 -0
- package/dist/rules/src/evaluation/conditions/null-conditions.d.ts +15 -0
- package/dist/rules/src/evaluation/conditions/null-conditions.d.ts.map +1 -0
- package/dist/rules/src/evaluation/conditions/null-conditions.js +24 -0
- package/dist/rules/src/evaluation/conditions/range-conditions.d.ts +15 -0
- package/dist/rules/src/evaluation/conditions/range-conditions.d.ts.map +1 -0
- package/dist/rules/src/evaluation/conditions/range-conditions.js +28 -0
- package/dist/rules/src/evaluation/conditions/special-conditions.d.ts +15 -0
- package/dist/rules/src/evaluation/conditions/special-conditions.d.ts.map +1 -0
- package/dist/rules/src/evaluation/conditions/special-conditions.js +47 -0
- package/dist/rules/src/evaluation/conditions/starts-end-with-conditions.d.ts +16 -0
- package/dist/rules/src/evaluation/conditions/starts-end-with-conditions.d.ts.map +1 -0
- package/dist/rules/src/evaluation/conditions/starts-end-with-conditions.js +25 -0
- package/dist/rules/src/evaluation/conditions/typeof-rule-conditions.d.ts +16 -0
- package/dist/rules/src/evaluation/conditions/typeof-rule-conditions.d.ts.map +1 -0
- package/dist/rules/src/evaluation/conditions/typeof-rule-conditions.js +56 -0
- package/dist/rules/src/evaluation/determine-if-data-has-changed.d.ts +11 -0
- package/dist/rules/src/evaluation/determine-if-data-has-changed.d.ts.map +1 -0
- package/dist/rules/src/evaluation/determine-if-data-has-changed.js +14 -0
- package/dist/rules/src/evaluation/evaluate-rule-conditions.d.ts +10 -0
- package/dist/rules/src/evaluation/evaluate-rule-conditions.d.ts.map +1 -0
- package/dist/rules/src/evaluation/evaluate-rule-conditions.js +66 -0
- package/dist/rules/src/evaluation/evaluate-rule.d.ts +13 -0
- package/dist/rules/src/evaluation/evaluate-rule.d.ts.map +1 -0
- package/dist/rules/src/evaluation/evaluate-rule.js +50 -0
- package/dist/rules/src/evaluation/evaluate-rules.d.ts +12 -0
- package/dist/rules/src/evaluation/evaluate-rules.d.ts.map +1 -0
- package/dist/rules/src/evaluation/evaluate-rules.js +50 -0
- package/dist/rules/src/evaluation/get-data-changed-information.d.ts +11 -0
- package/dist/rules/src/evaluation/get-data-changed-information.d.ts.map +1 -0
- package/dist/rules/src/evaluation/get-data-changed-information.js +31 -0
- package/dist/rules/src/evaluation/get-root-property-results.d.ts +14 -0
- package/dist/rules/src/evaluation/get-root-property-results.d.ts.map +1 -0
- package/dist/rules/src/evaluation/get-root-property-results.js +27 -0
- package/dist/rules/src/evaluation/index.d.ts +10 -0
- package/dist/rules/src/evaluation/index.d.ts.map +1 -0
- package/dist/rules/src/evaluation/index.js +27 -0
- package/dist/rules/src/evaluation/start-rule-evaluation.d.ts +13 -0
- package/dist/rules/src/evaluation/start-rule-evaluation.d.ts.map +1 -0
- package/dist/rules/src/evaluation/start-rule-evaluation.js +42 -0
- package/dist/rules/src/index.d.ts +2 -0
- package/dist/rules/src/index.d.ts.map +1 -0
- package/dist/rules/src/index.js +17 -0
- package/package.json +38 -0
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Changes to this file should be maed throughout all packages to keep consistency.
|
|
3
|
+
// Descritions of the properties are in the root jest.config.ts file.
|
|
4
|
+
/**
|
|
5
|
+
* For a detailed explanation regarding each configuration property, visit:
|
|
6
|
+
* https://jestjs.io/docs/configuration
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
const config = {
|
|
10
|
+
collectCoverageFrom: [
|
|
11
|
+
"src/**/*.ts"
|
|
12
|
+
],
|
|
13
|
+
coverageDirectory: "coverage",
|
|
14
|
+
coverageProvider: "v8",
|
|
15
|
+
moduleFileExtensions: [
|
|
16
|
+
"js",
|
|
17
|
+
"mjs",
|
|
18
|
+
"cjs",
|
|
19
|
+
"jsx",
|
|
20
|
+
"ts",
|
|
21
|
+
"tsx",
|
|
22
|
+
"json",
|
|
23
|
+
"node"
|
|
24
|
+
],
|
|
25
|
+
modulePathIgnorePatterns: [
|
|
26
|
+
"dist",
|
|
27
|
+
],
|
|
28
|
+
preset: "ts-jest",
|
|
29
|
+
roots: [
|
|
30
|
+
"<rootDir>/src/"
|
|
31
|
+
],
|
|
32
|
+
testEnvironment: "jsdom",
|
|
33
|
+
testMatch: [
|
|
34
|
+
"**/__tests__/**/*.[jt]s?(x)",
|
|
35
|
+
"**/?(*.)+(spec|test).[tj]s?(x)"
|
|
36
|
+
],
|
|
37
|
+
transform: {
|
|
38
|
+
'^.+\\.tsx?$': ['ts-jest', {
|
|
39
|
+
tsConfig: 'tsconfig.json',
|
|
40
|
+
}],
|
|
41
|
+
},
|
|
42
|
+
verbose: true,
|
|
43
|
+
};
|
|
44
|
+
exports.default = config;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { IShareFunction } from '../../../generic/src';
|
|
2
|
+
/**
|
|
3
|
+
* This function ensures function integrity by comparing the function that was run to a list of functions that are allowed to be run.
|
|
4
|
+
*/
|
|
5
|
+
declare const checkFunctionIntegrity: (shareDataFunction: IShareFunction<any, (...args: any[]) => any, any>, shareDataFunctions: IShareFunction<any, (...args: any[]) => any, any>[]) => boolean;
|
|
6
|
+
export { checkFunctionIntegrity };
|
|
7
|
+
//# sourceMappingURL=check-function-integrity.d.ts.map
|
|
@@ -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,sBAAsB,CAAC;AAEtD;;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,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.checkFunctionIntegrity = void 0;
|
|
5
|
+
/**
|
|
6
|
+
* This function ensures function integrity by comparing the function that was run to a list of functions that are allowed to be run.
|
|
7
|
+
*/
|
|
8
|
+
const checkFunctionIntegrity = (shareDataFunction, shareDataFunctions) => {
|
|
9
|
+
if (shareDataFunctions.includes(shareDataFunction)) {
|
|
10
|
+
return true;
|
|
11
|
+
}
|
|
12
|
+
return false;
|
|
13
|
+
};
|
|
14
|
+
exports.checkFunctionIntegrity = checkFunctionIntegrity;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { IShareRulesEvaluationResult } from '../../../generic/src';
|
|
2
|
+
/**
|
|
3
|
+
* This function checks if the proposal is valid.
|
|
4
|
+
*
|
|
5
|
+
* @param totalRulesToBeValid the total rules that need to be valid
|
|
6
|
+
* @param rulesResults the rules results
|
|
7
|
+
* @returns
|
|
8
|
+
*/
|
|
9
|
+
declare const checkIfProposalIsValid: (totalRulesToBeValid: number, rulesResults: IShareRulesEvaluationResult[]) => boolean;
|
|
10
|
+
export { checkIfProposalIsValid };
|
|
11
|
+
//# sourceMappingURL=check-if-proposal-is-valid.d.ts.map
|
|
@@ -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,sBAAsB,CAAC;AAEnE;;;;;;GAMG;AACH,QAAA,MAAM,sBAAsB,wBACH,MAAM,gBACb,2BAA2B,EAAE,KAC5C,OAGF,CAAC;AAEF,OAAO,EAAE,sBAAsB,EAAE,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.checkIfProposalIsValid = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* This function checks if the proposal is valid.
|
|
6
|
+
*
|
|
7
|
+
* @param totalRulesToBeValid the total rules that need to be valid
|
|
8
|
+
* @param rulesResults the rules results
|
|
9
|
+
* @returns
|
|
10
|
+
*/
|
|
11
|
+
const checkIfProposalIsValid = (totalRulesToBeValid, rulesResults) => {
|
|
12
|
+
const totalRulesValid = rulesResults.filter((x) => x.passedRuleCheck).length;
|
|
13
|
+
return totalRulesValid === totalRulesToBeValid;
|
|
14
|
+
};
|
|
15
|
+
exports.checkIfProposalIsValid = checkIfProposalIsValid;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file contains the functions for checking that the boolean conditions are met.
|
|
3
|
+
*/
|
|
4
|
+
import { ConditionTypeBoolean } from '../../../../generic/src/models/rules/share-rule-models';
|
|
5
|
+
/**
|
|
6
|
+
* This takes a value and checks if it meets the boolean condition.
|
|
7
|
+
*
|
|
8
|
+
* @param dataValue the value to check
|
|
9
|
+
* @param conditionType whether this is a boolean or not boolean condition
|
|
10
|
+
*
|
|
11
|
+
* @returns
|
|
12
|
+
*/
|
|
13
|
+
declare const isValidBooleanValue: (dataValue: unknown, conditionType: ConditionTypeBoolean) => boolean;
|
|
14
|
+
export { isValidBooleanValue };
|
|
15
|
+
//# sourceMappingURL=boolean-conditions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"boolean-conditions.d.ts","sourceRoot":"","sources":["../../../../../src/evaluation/conditions/boolean-conditions.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAE,oBAAoB,EAAE,MAAM,wDAAwD,CAAC;AAG9F;;;;;;;GAOG;AACH,QAAA,MAAM,mBAAmB,cAAe,OAAO,iBAAiB,oBAAoB,KAAG,OAWtF,CAAC;AAEF,OAAO,EAAE,mBAAmB,EAAE,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* This file contains the functions for checking that the boolean conditions are met.
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.isValidBooleanValue = void 0;
|
|
7
|
+
const src_1 = require("../../../../generic/src");
|
|
8
|
+
const share_rule_models_1 = require("../../../../generic/src/models/rules/share-rule-models");
|
|
9
|
+
/**
|
|
10
|
+
* This takes a value and checks if it meets the boolean condition.
|
|
11
|
+
*
|
|
12
|
+
* @param dataValue the value to check
|
|
13
|
+
* @param conditionType whether this is a boolean or not boolean condition
|
|
14
|
+
*
|
|
15
|
+
* @returns
|
|
16
|
+
*/
|
|
17
|
+
const isValidBooleanValue = (dataValue, conditionType) => {
|
|
18
|
+
const isBoolean = (0, src_1.validateBoolean)(dataValue);
|
|
19
|
+
if (!isBoolean) {
|
|
20
|
+
return false;
|
|
21
|
+
}
|
|
22
|
+
switch (conditionType) {
|
|
23
|
+
case share_rule_models_1.ConditionTypeBoolean.IS_TRUE:
|
|
24
|
+
return dataValue === true;
|
|
25
|
+
case share_rule_models_1.ConditionTypeBoolean.IS_FALSE:
|
|
26
|
+
return dataValue === false;
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
exports.isValidBooleanValue = isValidBooleanValue;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file contains the functions for checking that contains conditions are met.
|
|
3
|
+
*/
|
|
4
|
+
import { ConditionTypeContains } from '../../../../generic/src';
|
|
5
|
+
/**
|
|
6
|
+
* This takes a value and checks if it is contained or not contained in the proper range of values.
|
|
7
|
+
*
|
|
8
|
+
* @param dataValue the value to check
|
|
9
|
+
* @param conditionValue the value to check against
|
|
10
|
+
* @param conditionType whether this is a contains or not contains condition
|
|
11
|
+
*
|
|
12
|
+
* @returns
|
|
13
|
+
*/
|
|
14
|
+
declare const isValidContainsValue: (dataValue: string | number, conditionValue: string | (number | string)[], conditionType: ConditionTypeContains) => boolean;
|
|
15
|
+
export { isValidContainsValue };
|
|
16
|
+
//# sourceMappingURL=contains-conditions.d.ts.map
|
|
@@ -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,yBAAyB,CAAC;AAEhE;;;;;;;;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"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* This file contains the functions for checking that contains conditions are met.
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.isValidContainsValue = void 0;
|
|
7
|
+
const src_1 = require("../../../../generic/src");
|
|
8
|
+
/**
|
|
9
|
+
* This takes a value and checks if it is contained or not contained in the proper range of values.
|
|
10
|
+
*
|
|
11
|
+
* @param dataValue the value to check
|
|
12
|
+
* @param conditionValue the value to check against
|
|
13
|
+
* @param conditionType whether this is a contains or not contains condition
|
|
14
|
+
*
|
|
15
|
+
* @returns
|
|
16
|
+
*/
|
|
17
|
+
const isValidContainsValue = (dataValue, conditionValue, conditionType) => {
|
|
18
|
+
let isMatchedCondition = false;
|
|
19
|
+
if (typeof conditionValue === 'string') {
|
|
20
|
+
isMatchedCondition = conditionValue.includes(dataValue.toString());
|
|
21
|
+
}
|
|
22
|
+
else {
|
|
23
|
+
isMatchedCondition = conditionValue.includes(dataValue);
|
|
24
|
+
}
|
|
25
|
+
return (conditionType === src_1.ConditionTypeContains.CONTAINS) ? isMatchedCondition : !isMatchedCondition;
|
|
26
|
+
};
|
|
27
|
+
exports.isValidContainsValue = isValidContainsValue;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file contains the functions for checking that the values are empty
|
|
3
|
+
*/
|
|
4
|
+
import { ConditionTypeEmpty } from '../../../../generic/src';
|
|
5
|
+
/**
|
|
6
|
+
* This takes a value and checks if it meets the empty condition
|
|
7
|
+
*
|
|
8
|
+
* @param dataValue the value to check
|
|
9
|
+
* @param conditionType whether this is a boolean or not boolean condition
|
|
10
|
+
*
|
|
11
|
+
* @returns
|
|
12
|
+
*/
|
|
13
|
+
declare const isValidEmptyValue: (dataValue: unknown, conditionType: ConditionTypeEmpty) => boolean;
|
|
14
|
+
export { isValidEmptyValue };
|
|
15
|
+
//# sourceMappingURL=empty-conditions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"empty-conditions.d.ts","sourceRoot":"","sources":["../../../../../src/evaluation/conditions/empty-conditions.ts"],"names":[],"mappings":"AACA;;GAEG;AAEH,OAAO,EAAE,kBAAkB,EAAiB,MAAM,yBAAyB,CAAC;AAE5E;;;;;;;GAOG;AACH,QAAA,MAAM,iBAAiB,cAAe,OAAO,iBAAiB,kBAAkB,KAAG,OAiBlF,CAAC;AAEF,OAAO,EAAE,iBAAiB,EAAE,CAAC"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* This file contains the functions for checking that the values are empty
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.isValidEmptyValue = void 0;
|
|
7
|
+
const src_1 = require("../../../../generic/src");
|
|
8
|
+
/**
|
|
9
|
+
* This takes a value and checks if it meets the empty condition
|
|
10
|
+
*
|
|
11
|
+
* @param dataValue the value to check
|
|
12
|
+
* @param conditionType whether this is a boolean or not boolean condition
|
|
13
|
+
*
|
|
14
|
+
* @returns
|
|
15
|
+
*/
|
|
16
|
+
const isValidEmptyValue = (dataValue, conditionType) => {
|
|
17
|
+
const isArray = (0, src_1.validateArray)(dataValue);
|
|
18
|
+
if (isArray) {
|
|
19
|
+
switch (conditionType) {
|
|
20
|
+
case src_1.ConditionTypeEmpty.IS_EMPTY:
|
|
21
|
+
return dataValue.length === 0;
|
|
22
|
+
case src_1.ConditionTypeEmpty.IS_NOT_EMPTY:
|
|
23
|
+
return dataValue.length > 0;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
switch (conditionType) {
|
|
28
|
+
case src_1.ConditionTypeEmpty.IS_EMPTY:
|
|
29
|
+
return isEmpty(dataValue);
|
|
30
|
+
case src_1.ConditionTypeEmpty.IS_NOT_EMPTY:
|
|
31
|
+
return !isEmpty(dataValue);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
exports.isValidEmptyValue = isValidEmptyValue;
|
|
36
|
+
/**
|
|
37
|
+
* Whether the item is empty.
|
|
38
|
+
*
|
|
39
|
+
* @param dataValue the value to check
|
|
40
|
+
* @returns
|
|
41
|
+
*/
|
|
42
|
+
const isEmpty = (dataValue) => {
|
|
43
|
+
if (dataValue === null || dataValue === undefined) {
|
|
44
|
+
return true;
|
|
45
|
+
}
|
|
46
|
+
if (typeof dataValue === 'string') {
|
|
47
|
+
return dataValue === '';
|
|
48
|
+
}
|
|
49
|
+
return false;
|
|
50
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file contains the functions for checking that equality conditions are met.
|
|
3
|
+
*/
|
|
4
|
+
import { ConditionTypeEquality } from '../../../../generic/src';
|
|
5
|
+
/**
|
|
6
|
+
* This takes a value and checks if two values are strictly equal or not equal.
|
|
7
|
+
*
|
|
8
|
+
* @param dataValue the value to check
|
|
9
|
+
* @param conditionValue the value to check against
|
|
10
|
+
* @param conditionType the type of equality condition to check for
|
|
11
|
+
* @returns
|
|
12
|
+
*/
|
|
13
|
+
declare const isValidEqualityValue: (dataValue: unknown, conditionValue: unknown, conditionType: ConditionTypeEquality) => boolean;
|
|
14
|
+
export { isValidEqualityValue };
|
|
15
|
+
//# sourceMappingURL=equality-conditions.d.ts.map
|
|
@@ -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,yBAAyB,CAAC;AAEhE;;;;;;;GAOG;AACH,QAAA,MAAM,oBAAoB,cAAe,OAAO,kBAAkB,OAAO,iBAAiB,qBAAqB,KAAG,OAOjH,CAAC;AAEF,OAAO,EAAE,oBAAoB,EAAE,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* This file contains the functions for checking that equality conditions are met.
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.isValidEqualityValue = void 0;
|
|
7
|
+
const src_1 = require("../../../../generic/src");
|
|
8
|
+
/**
|
|
9
|
+
* This takes a value and checks if two values are strictly equal or not equal.
|
|
10
|
+
*
|
|
11
|
+
* @param dataValue the value to check
|
|
12
|
+
* @param conditionValue the value to check against
|
|
13
|
+
* @param conditionType the type of equality condition to check for
|
|
14
|
+
* @returns
|
|
15
|
+
*/
|
|
16
|
+
const isValidEqualityValue = (dataValue, conditionValue, conditionType) => {
|
|
17
|
+
switch (conditionType) {
|
|
18
|
+
case src_1.ConditionTypeEquality.EQUAL:
|
|
19
|
+
return dataValue === conditionValue;
|
|
20
|
+
case src_1.ConditionTypeEquality.NOT_EQUAL:
|
|
21
|
+
return dataValue !== conditionValue;
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
exports.isValidEqualityValue = isValidEqualityValue;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file contains the functions for checking that the null conditions are met.
|
|
3
|
+
*/
|
|
4
|
+
import { ConditionTypeNull } from '../../../../generic/src';
|
|
5
|
+
/**
|
|
6
|
+
* This takes a value and checks if it meets the null condition.
|
|
7
|
+
*
|
|
8
|
+
* @param dataValue the value to check
|
|
9
|
+
* @param conditionType whether this is a contains or not contains condition
|
|
10
|
+
*
|
|
11
|
+
* @returns
|
|
12
|
+
*/
|
|
13
|
+
declare const isValidNullValue: (dataValue: any, conditionType: ConditionTypeNull) => boolean;
|
|
14
|
+
export { isValidNullValue };
|
|
15
|
+
//# sourceMappingURL=null-conditions.d.ts.map
|
|
@@ -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,yBAAyB,CAAC;AAE5D;;;;;;;GAOG;AACH,QAAA,MAAM,gBAAgB,cAAe,GAAG,iBAAiB,iBAAiB,KAAG,OAO5E,CAAC;AAEF,OAAO,EAAE,gBAAgB,EAAE,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* This file contains the functions for checking that the null conditions are met.
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.isValidNullValue = void 0;
|
|
7
|
+
const src_1 = require("../../../../generic/src");
|
|
8
|
+
/**
|
|
9
|
+
* This takes a value and checks if it meets the null condition.
|
|
10
|
+
*
|
|
11
|
+
* @param dataValue the value to check
|
|
12
|
+
* @param conditionType whether this is a contains or not contains condition
|
|
13
|
+
*
|
|
14
|
+
* @returns
|
|
15
|
+
*/
|
|
16
|
+
const isValidNullValue = (dataValue, conditionType) => {
|
|
17
|
+
switch (conditionType) {
|
|
18
|
+
case src_1.ConditionTypeNull.IS_NULL:
|
|
19
|
+
return dataValue === null;
|
|
20
|
+
case src_1.ConditionTypeNull.IS_NOT_NULL:
|
|
21
|
+
return dataValue !== null;
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
exports.isValidNullValue = isValidNullValue;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file contains the functions for checking that range conditions are met.
|
|
3
|
+
*/
|
|
4
|
+
import { ConditionTypeRange } from '../../../../generic/src';
|
|
5
|
+
/**
|
|
6
|
+
* This takes a value and checks if it is in the proper range of values.
|
|
7
|
+
*
|
|
8
|
+
* @param dataValue the value to check
|
|
9
|
+
* @param conditionValue the value to check against
|
|
10
|
+
* @param conditionType the type of equality condition to check for
|
|
11
|
+
* @returns
|
|
12
|
+
*/
|
|
13
|
+
declare const isValidRangeValue: (dataValue: string | number, conditionValue: string | number, conditionType: ConditionTypeRange) => boolean;
|
|
14
|
+
export { isValidRangeValue };
|
|
15
|
+
//# sourceMappingURL=range-conditions.d.ts.map
|
|
@@ -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,yBAAyB,CAAC;AAE7D;;;;;;;GAOG;AACH,QAAA,MAAM,iBAAiB,cAAe,MAAM,GAAG,MAAM,kBAAkB,MAAM,GAAG,MAAM,iBAAiB,kBAAkB,KAAG,OAW3H,CAAC;AAEF,OAAO,EAAE,iBAAiB,EAAE,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* This file contains the functions for checking that range conditions are met.
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.isValidRangeValue = void 0;
|
|
7
|
+
const src_1 = require("../../../../generic/src");
|
|
8
|
+
/**
|
|
9
|
+
* This takes a value and checks if it is in the proper range of values.
|
|
10
|
+
*
|
|
11
|
+
* @param dataValue the value to check
|
|
12
|
+
* @param conditionValue the value to check against
|
|
13
|
+
* @param conditionType the type of equality condition to check for
|
|
14
|
+
* @returns
|
|
15
|
+
*/
|
|
16
|
+
const isValidRangeValue = (dataValue, conditionValue, conditionType) => {
|
|
17
|
+
switch (conditionType) {
|
|
18
|
+
case src_1.ConditionTypeRange.GREATER_THAN:
|
|
19
|
+
return dataValue > conditionValue;
|
|
20
|
+
case src_1.ConditionTypeRange.LESS_THAN:
|
|
21
|
+
return dataValue < conditionValue;
|
|
22
|
+
case src_1.ConditionTypeRange.GREATER_THAN_OR_EQUAL:
|
|
23
|
+
return dataValue >= conditionValue;
|
|
24
|
+
case src_1.ConditionTypeRange.LESS_THAN_OR_EQUAL:
|
|
25
|
+
return dataValue <= conditionValue;
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
exports.isValidRangeValue = isValidRangeValue;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file contains the functions for checking that special conditions are met.
|
|
3
|
+
*/
|
|
4
|
+
import { ConditionTypeSpecial } from '../../../../generic/src';
|
|
5
|
+
/**
|
|
6
|
+
* This takes a value and checks if the special condition is met.
|
|
7
|
+
*
|
|
8
|
+
* @param dataValue the value to check
|
|
9
|
+
* @param conditionValue the value to check against
|
|
10
|
+
* @param conditionType the type of equality condition to check for
|
|
11
|
+
* @returns
|
|
12
|
+
*/
|
|
13
|
+
declare const isValidSpecialValue: (dataValue: unknown, conditionValue: unknown, conditionType: ConditionTypeSpecial) => boolean;
|
|
14
|
+
export { isValidSpecialValue };
|
|
15
|
+
//# sourceMappingURL=special-conditions.d.ts.map
|
|
@@ -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,yBAAyB,CAAC;AAE/G;;;;;;;GAOG;AACH,QAAA,MAAM,mBAAmB,cAAe,OAAO,kBAAkB,OAAO,iBAAiB,oBAAoB,KAAG,OAK/G,CAAC;AAEF,OAAO,EAAE,mBAAmB,EAAE,CAAC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* This file contains the functions for checking that special conditions are met.
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.isValidSpecialValue = void 0;
|
|
7
|
+
const src_1 = require("../../../../generic/src");
|
|
8
|
+
/**
|
|
9
|
+
* This takes a value and checks if the special condition is met.
|
|
10
|
+
*
|
|
11
|
+
* @param dataValue the value to check
|
|
12
|
+
* @param conditionValue the value to check against
|
|
13
|
+
* @param conditionType the type of equality condition to check for
|
|
14
|
+
* @returns
|
|
15
|
+
*/
|
|
16
|
+
const isValidSpecialValue = (dataValue, conditionValue, conditionType) => {
|
|
17
|
+
switch (conditionType) {
|
|
18
|
+
case src_1.ConditionTypeSpecial.PATTERN:
|
|
19
|
+
return evaluatePattern(dataValue, conditionValue);
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
exports.isValidSpecialValue = isValidSpecialValue;
|
|
23
|
+
//#region Special Conditions Functions
|
|
24
|
+
/**
|
|
25
|
+
* This takes a value and checks if the regex pattern is met.
|
|
26
|
+
* @param dataValue the value to check
|
|
27
|
+
* @param conditionValue the value to check against
|
|
28
|
+
* @returns
|
|
29
|
+
*/
|
|
30
|
+
const evaluatePattern = (dataValue, conditionValue) => {
|
|
31
|
+
if (!dataValue || typeof dataValue !== 'string') {
|
|
32
|
+
return false;
|
|
33
|
+
}
|
|
34
|
+
if (!conditionValue || typeof conditionValue !== 'string') {
|
|
35
|
+
return false;
|
|
36
|
+
}
|
|
37
|
+
try {
|
|
38
|
+
const regex = new RegExp(conditionValue);
|
|
39
|
+
const result = regex.test(dataValue);
|
|
40
|
+
return result;
|
|
41
|
+
}
|
|
42
|
+
catch (err) {
|
|
43
|
+
throw new src_1.SafeRuleEvaluationSpecialConditionPatternError(dataValue, conditionValue);
|
|
44
|
+
}
|
|
45
|
+
// return regex.test(dataValue as string);
|
|
46
|
+
};
|
|
47
|
+
//#endregion Special Conditions Functions
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file contains the functions for checking that starts or ends with are met
|
|
3
|
+
*/
|
|
4
|
+
import { ConditionTypeStartsEndsWith } from '../../../../generic/src';
|
|
5
|
+
/**
|
|
6
|
+
* This takes a value and checks if the value starts or ends with value
|
|
7
|
+
*
|
|
8
|
+
* @param dataValue the value to check
|
|
9
|
+
* @param conditionValue the value to check against
|
|
10
|
+
* @param conditionType whether this is a starts with or ends with condition
|
|
11
|
+
*
|
|
12
|
+
* @returns
|
|
13
|
+
*/
|
|
14
|
+
declare const isValidStartEndWithValue: (dataValue: string | number, conditionValue: string | (number | string)[], conditionType: ConditionTypeStartsEndsWith) => boolean;
|
|
15
|
+
export { isValidStartEndWithValue };
|
|
16
|
+
//# sourceMappingURL=starts-end-with-conditions.d.ts.map
|
|
@@ -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,yBAAyB,CAAC;AAEtE;;;;;;;;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"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* This file contains the functions for checking that starts or ends with are met
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.isValidStartEndWithValue = void 0;
|
|
7
|
+
const src_1 = require("../../../../generic/src");
|
|
8
|
+
/**
|
|
9
|
+
* This takes a value and checks if the value starts or ends with value
|
|
10
|
+
*
|
|
11
|
+
* @param dataValue the value to check
|
|
12
|
+
* @param conditionValue the value to check against
|
|
13
|
+
* @param conditionType whether this is a starts with or ends with condition
|
|
14
|
+
*
|
|
15
|
+
* @returns
|
|
16
|
+
*/
|
|
17
|
+
const isValidStartEndWithValue = (dataValue, conditionValue, conditionType) => {
|
|
18
|
+
switch (conditionType) {
|
|
19
|
+
case src_1.ConditionTypeStartsEndsWith.STARTS_WITH:
|
|
20
|
+
return dataValue.toString().startsWith(conditionValue.toString());
|
|
21
|
+
case src_1.ConditionTypeStartsEndsWith.ENDS_WITH:
|
|
22
|
+
return dataValue.toString().endsWith(conditionValue.toString());
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
exports.isValidStartEndWithValue = isValidStartEndWithValue;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file contains the functions for checking that the data is the proper type of data.
|
|
3
|
+
*/
|
|
4
|
+
import { ConditionTypeOf, ConditionTypeTypeOf } from '../../../../generic/src';
|
|
5
|
+
/**
|
|
6
|
+
* This takes a value and checks if it is the proper type of value.
|
|
7
|
+
*
|
|
8
|
+
* @param dataValue the value to check
|
|
9
|
+
* @param typeofValue the type of value to check for
|
|
10
|
+
* @param conditionType if the value should be equal to the type of value (is true or is not true)
|
|
11
|
+
*
|
|
12
|
+
* @returns
|
|
13
|
+
*/
|
|
14
|
+
declare const isValidTypeOfValue: (dataValue: unknown, typeofValue: ConditionTypeOf, conditionType: ConditionTypeTypeOf) => boolean;
|
|
15
|
+
export { isValidTypeOfValue };
|
|
16
|
+
//# sourceMappingURL=typeof-rule-conditions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"typeof-rule-conditions.d.ts","sourceRoot":"","sources":["../../../../../src/evaluation/conditions/typeof-rule-conditions.ts"],"names":[],"mappings":"AAEA;;GAEG;AAEH,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAE/E;;;;;;;;GAQG;AACH,QAAA,MAAM,kBAAkB,cAAe,OAAO,eAAe,eAAe,iBAAiB,mBAAmB,KAAG,OAGlH,CAAC;AAsCF,OAAO,EAAE,kBAAkB,EAAE,CAAC"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* This file contains the functions for checking that the data is the proper type of data.
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.isValidTypeOfValue = void 0;
|
|
7
|
+
const src_1 = require("../../../../generic/src");
|
|
8
|
+
/**
|
|
9
|
+
* This takes a value and checks if it is the proper type of value.
|
|
10
|
+
*
|
|
11
|
+
* @param dataValue the value to check
|
|
12
|
+
* @param typeofValue the type of value to check for
|
|
13
|
+
* @param conditionType if the value should be equal to the type of value (is true or is not true)
|
|
14
|
+
*
|
|
15
|
+
* @returns
|
|
16
|
+
*/
|
|
17
|
+
const isValidTypeOfValue = (dataValue, typeofValue, conditionType) => {
|
|
18
|
+
const initialResult = checkType(dataValue, typeofValue);
|
|
19
|
+
return (conditionType === src_1.ConditionTypeTypeOf.IS_TYPEOF) ? initialResult : !initialResult;
|
|
20
|
+
};
|
|
21
|
+
exports.isValidTypeOfValue = isValidTypeOfValue;
|
|
22
|
+
/**
|
|
23
|
+
* This checks the type of the value and sees if it matches the type of value.
|
|
24
|
+
*
|
|
25
|
+
* @param dataValue the value to check
|
|
26
|
+
* @param typeofValue the type of value to check for
|
|
27
|
+
* @returns
|
|
28
|
+
*/
|
|
29
|
+
const checkType = (dataValue, typeofValue) => {
|
|
30
|
+
switch (typeofValue) {
|
|
31
|
+
case src_1.ConditionTypeOf.STRING:
|
|
32
|
+
return typeof dataValue === 'string';
|
|
33
|
+
case src_1.ConditionTypeOf.NUMBER:
|
|
34
|
+
return typeof dataValue === 'number';
|
|
35
|
+
case src_1.ConditionTypeOf.INTEGER:
|
|
36
|
+
return Number.isInteger(dataValue);
|
|
37
|
+
case src_1.ConditionTypeOf.BOOLEAN:
|
|
38
|
+
return typeof dataValue === 'boolean';
|
|
39
|
+
case src_1.ConditionTypeOf.OBJECT:
|
|
40
|
+
return typeof dataValue === 'object';
|
|
41
|
+
case src_1.ConditionTypeOf.ARRAY:
|
|
42
|
+
return Array.isArray(dataValue);
|
|
43
|
+
case src_1.ConditionTypeOf.NULL:
|
|
44
|
+
return dataValue === null;
|
|
45
|
+
case src_1.ConditionTypeOf.UNDEFINED:
|
|
46
|
+
return typeof dataValue === 'undefined';
|
|
47
|
+
case src_1.ConditionTypeOf.FUNCTION:
|
|
48
|
+
return typeof dataValue === 'function';
|
|
49
|
+
// case ConditionTypeOf.SYMBOL:
|
|
50
|
+
// return typeof dataValue === 'symbol';
|
|
51
|
+
case src_1.ConditionTypeOf.BIGINT:
|
|
52
|
+
return typeof dataValue === 'bigint';
|
|
53
|
+
default:
|
|
54
|
+
return false;
|
|
55
|
+
}
|
|
56
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { IShareData } from '../../../generic/src';
|
|
2
|
+
/**
|
|
3
|
+
* This function determines if the data has changed.
|
|
4
|
+
*
|
|
5
|
+
* @param oldData the old data to compare
|
|
6
|
+
* @param newData the new data to compare
|
|
7
|
+
* @returns
|
|
8
|
+
*/
|
|
9
|
+
declare const determineIfDataHasChanged: (oldData: IShareData, newData: IShareData) => boolean;
|
|
10
|
+
export { determineIfDataHasChanged };
|
|
11
|
+
//# sourceMappingURL=determine-if-data-has-changed.d.ts.map
|
|
@@ -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,sBAAsB,CAAC;AAElD;;;;;;GAMG;AACH,QAAA,MAAM,yBAAyB,YAAa,UAAU,WAAW,UAAU,KAAG,OAE7E,CAAC;AAEF,OAAO,EAAE,yBAAyB,EAAE,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.determineIfDataHasChanged = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* This function determines if the data has changed.
|
|
6
|
+
*
|
|
7
|
+
* @param oldData the old data to compare
|
|
8
|
+
* @param newData the new data to compare
|
|
9
|
+
* @returns
|
|
10
|
+
*/
|
|
11
|
+
const determineIfDataHasChanged = (oldData, newData) => {
|
|
12
|
+
return JSON.stringify(oldData) !== JSON.stringify(newData);
|
|
13
|
+
};
|
|
14
|
+
exports.determineIfDataHasChanged = determineIfDataHasChanged;
|