@degenerate/rules 0.0.4 → 0.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +15 -0
- package/README.md +1 -0
- package/dist/evaluation/check-function-integrity.d.ts.map +1 -0
- package/dist/evaluation/check-if-proposal-is-valid.d.ts.map +1 -0
- package/dist/evaluation/conditions/boolean-conditions.d.ts.map +1 -0
- package/dist/evaluation/conditions/contains-conditions.d.ts.map +1 -0
- package/dist/evaluation/conditions/empty-conditions.d.ts.map +1 -0
- package/dist/evaluation/conditions/equality-conditions.d.ts.map +1 -0
- package/dist/evaluation/conditions/null-conditions.d.ts.map +1 -0
- package/dist/evaluation/conditions/range-conditions.d.ts.map +1 -0
- package/dist/evaluation/conditions/special-conditions.d.ts.map +1 -0
- 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/evaluation/conditions/starts-end-with-conditions.js +100 -0
- package/dist/evaluation/conditions/typeof-rule-conditions.d.ts.map +1 -0
- package/dist/{rules/src/evaluation → evaluation}/conditions/typeof-rule-conditions.js +3 -3
- package/dist/evaluation/determine-if-data-has-changed.d.ts.map +1 -0
- package/dist/evaluation/evaluate-rule-conditions.d.ts.map +1 -0
- package/dist/evaluation/evaluate-rule.d.ts.map +1 -0
- package/dist/evaluation/evaluate-rules.d.ts.map +1 -0
- package/dist/evaluation/get-data-changed-information.d.ts.map +1 -0
- package/dist/evaluation/get-root-property-results.d.ts.map +1 -0
- package/dist/evaluation/index.d.ts.map +1 -0
- package/dist/evaluation/start-rule-evaluation.d.ts.map +1 -0
- package/dist/index.d.ts.map +1 -0
- package/package.json +4 -3
- 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 -30
- 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 -40
- 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/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/starts-end-with-conditions.js +0 -44
- 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.d.ts +0 -0
- /package/dist/{rules/src/evaluation → evaluation}/check-function-integrity.js +0 -0
- /package/dist/{rules/src/evaluation → evaluation}/check-if-proposal-is-valid.d.ts +0 -0
- /package/dist/{rules/src/evaluation → evaluation}/check-if-proposal-is-valid.js +0 -0
- /package/dist/{rules/src/evaluation → evaluation}/conditions/boolean-conditions.d.ts +0 -0
- /package/dist/{rules/src/evaluation → evaluation}/conditions/boolean-conditions.js +0 -0
- /package/dist/{rules/src/evaluation → evaluation}/conditions/contains-conditions.d.ts +0 -0
- /package/dist/{rules/src/evaluation → evaluation}/conditions/contains-conditions.js +0 -0
- /package/dist/{rules/src/evaluation → evaluation}/conditions/empty-conditions.d.ts +0 -0
- /package/dist/{rules/src/evaluation → evaluation}/conditions/empty-conditions.js +0 -0
- /package/dist/{rules/src/evaluation → evaluation}/conditions/equality-conditions.d.ts +0 -0
- /package/dist/{rules/src/evaluation → evaluation}/conditions/equality-conditions.js +0 -0
- /package/dist/{rules/src/evaluation → evaluation}/conditions/null-conditions.d.ts +0 -0
- /package/dist/{rules/src/evaluation → evaluation}/conditions/null-conditions.js +0 -0
- /package/dist/{rules/src/evaluation → evaluation}/conditions/range-conditions.d.ts +0 -0
- /package/dist/{rules/src/evaluation → evaluation}/conditions/range-conditions.js +0 -0
- /package/dist/{rules/src/evaluation → evaluation}/conditions/special-conditions.d.ts +0 -0
- /package/dist/{rules/src/evaluation → evaluation}/conditions/special-conditions.js +0 -0
- /package/dist/{rules/src/evaluation → evaluation}/conditions/typeof-rule-conditions.d.ts +0 -0
- /package/dist/{rules/src/evaluation → evaluation}/determine-if-data-has-changed.d.ts +0 -0
- /package/dist/{rules/src/evaluation → evaluation}/determine-if-data-has-changed.js +0 -0
- /package/dist/{rules/src/evaluation → evaluation}/evaluate-rule-conditions.d.ts +0 -0
- /package/dist/{rules/src/evaluation → evaluation}/evaluate-rule-conditions.js +0 -0
- /package/dist/{rules/src/evaluation → evaluation}/evaluate-rule.d.ts +0 -0
- /package/dist/{rules/src/evaluation → evaluation}/evaluate-rule.js +0 -0
- /package/dist/{rules/src/evaluation → evaluation}/evaluate-rules.d.ts +0 -0
- /package/dist/{rules/src/evaluation → evaluation}/evaluate-rules.js +0 -0
- /package/dist/{rules/src/evaluation → evaluation}/get-data-changed-information.d.ts +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.d.ts +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/evaluation → evaluation}/start-rule-evaluation.d.ts +0 -0
- /package/dist/{rules/src/evaluation → evaluation}/start-rule-evaluation.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
package/LICENSE.md
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
ISC License
|
|
2
|
+
|
|
3
|
+
Copyright (c) [2024] [Degenerateiinc.ca]
|
|
4
|
+
|
|
5
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
6
|
+
purpose with or without fee is hereby granted, provided that the above
|
|
7
|
+
copyright notice and this permission notice appear in all copies.
|
|
8
|
+
|
|
9
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
10
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
11
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
12
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
13
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
14
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
15
|
+
PERFORMANCE OF THIS SOFTWARE.
|
package/README.md
CHANGED
|
@@ -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"}
|
|
@@ -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"}
|
|
@@ -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"}
|
|
@@ -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"}
|
|
@@ -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"}
|
|
@@ -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"}
|
|
@@ -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"}
|
|
@@ -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"}
|
|
@@ -11,6 +11,6 @@ import { ConditionTypeStartsEndsWith } from '@degenerate/generic';
|
|
|
11
11
|
*
|
|
12
12
|
* @returns
|
|
13
13
|
*/
|
|
14
|
-
declare const isValidStartEndWithValue: (dataValue: string | number, conditionValue: string | number, conditionType: ConditionTypeStartsEndsWith) => boolean;
|
|
14
|
+
declare const isValidStartEndWithValue: (dataValue: string | number | (string | number)[], conditionValue: string | number | (string | number)[], conditionType: ConditionTypeStartsEndsWith) => boolean;
|
|
15
15
|
export { isValidStartEndWithValue };
|
|
16
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,EAEH,2BAA2B,EAI9B,MAAM,qBAAqB,CAAC;AAE7B;;;;;;;;GAQG;AACH,QAAA,MAAM,wBAAwB,cAAe,MAAM,GAAG,MAAM,GAAG,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,kBAAkB,MAAM,GAAG,MAAM,GAAG,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,iBACtH,2BAA2B,KAAG,OAchD,CAAC;AAEF,OAAO,EAAE,wBAAwB,EAAE,CAAC"}
|
|
@@ -0,0 +1,100 @@
|
|
|
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 generic_1 = require("@degenerate/generic");
|
|
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
|
+
// Make sure the data type is correct
|
|
19
|
+
if (!(typeof dataValue === 'string' || typeof dataValue === 'number' || (0, generic_1.validateArray)(dataValue, 1))) {
|
|
20
|
+
throw new generic_1.SafeRuleEvaluationConditionDataValueError(dataValue, conditionValue, conditionType);
|
|
21
|
+
}
|
|
22
|
+
if (!(typeof conditionValue === 'string' || typeof conditionValue === 'number' || (0, generic_1.validateArray)(conditionValue, 1))) {
|
|
23
|
+
throw new generic_1.SafeRuleEvaluationConditionValueError(dataValue, conditionValue, conditionType);
|
|
24
|
+
}
|
|
25
|
+
if ((typeof dataValue === 'string' || typeof dataValue === 'number') && (typeof conditionValue === 'string' || typeof conditionValue === 'number')) {
|
|
26
|
+
return isValidStartEndWithStringNumberValue(dataValue, conditionValue, conditionType);
|
|
27
|
+
}
|
|
28
|
+
else {
|
|
29
|
+
return isValidStartEndWithArrayValue(dataValue, conditionValue, conditionType);
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
exports.isValidStartEndWithValue = isValidStartEndWithValue;
|
|
33
|
+
//#region internal functions
|
|
34
|
+
const isValidStartEndWithArrayValue = (dataValue, conditionValue, conditionType) => {
|
|
35
|
+
if ((0, generic_1.validateArray)(dataValue, 1) && (0, generic_1.validateArray)(conditionValue, 1)) {
|
|
36
|
+
// check the datatype is valid
|
|
37
|
+
let dataValueSameType = (0, generic_1.checkIfAllItemsInAnArrayAreSameType)(dataValue, 'string');
|
|
38
|
+
if (!dataValueSameType)
|
|
39
|
+
dataValueSameType = (0, generic_1.checkIfAllItemsInAnArrayAreSameType)(dataValue, 'number');
|
|
40
|
+
if (!dataValueSameType)
|
|
41
|
+
throw new generic_1.SafeRuleEvaluationConditionDataValueError(dataValue, conditionValue, conditionType);
|
|
42
|
+
let conditionValueSameType = (0, generic_1.checkIfAllItemsInAnArrayAreSameType)(conditionValue, 'string');
|
|
43
|
+
if (!conditionValueSameType)
|
|
44
|
+
conditionValueSameType = (0, generic_1.checkIfAllItemsInAnArrayAreSameType)(conditionValue, 'number');
|
|
45
|
+
if (!conditionValueSameType)
|
|
46
|
+
throw new generic_1.SafeRuleEvaluationConditionValueError(dataValue, conditionValue, conditionType);
|
|
47
|
+
const valueToCheck = (conditionType === generic_1.ConditionTypeStartsEndsWith.STARTS_WITH) ?
|
|
48
|
+
dataValue[0] : dataValue[dataValue.length - 1];
|
|
49
|
+
let isValid = false;
|
|
50
|
+
for (const conditionValueElement of conditionValue) {
|
|
51
|
+
if (valueToCheck.toString() === conditionValueElement.toString()) {
|
|
52
|
+
isValid = true;
|
|
53
|
+
break;
|
|
54
|
+
}
|
|
55
|
+
;
|
|
56
|
+
}
|
|
57
|
+
return isValid;
|
|
58
|
+
}
|
|
59
|
+
else if ((0, generic_1.validateArray)(dataValue, 1) && (typeof conditionValue === 'string' || typeof conditionValue === 'number')) {
|
|
60
|
+
// check the datatype is valid
|
|
61
|
+
let dataValueSameType = (0, generic_1.checkIfAllItemsInAnArrayAreSameType)(dataValue, 'string');
|
|
62
|
+
if (!dataValueSameType)
|
|
63
|
+
dataValueSameType = (0, generic_1.checkIfAllItemsInAnArrayAreSameType)(dataValue, 'number');
|
|
64
|
+
if (!dataValueSameType)
|
|
65
|
+
throw new generic_1.SafeRuleEvaluationConditionDataValueError(dataValue, conditionValue, conditionType);
|
|
66
|
+
const valueToCheck = (conditionType === generic_1.ConditionTypeStartsEndsWith.STARTS_WITH) ?
|
|
67
|
+
dataValue[0] : dataValue[dataValue.length - 1];
|
|
68
|
+
return valueToCheck.toString() === conditionValue.toString();
|
|
69
|
+
}
|
|
70
|
+
else if ((0, generic_1.validateArray)(conditionValue, 1) && (typeof dataValue === 'string' || typeof dataValue === 'number')) {
|
|
71
|
+
// make sure the condition datatype is valid
|
|
72
|
+
let conditionValueSameType = (0, generic_1.checkIfAllItemsInAnArrayAreSameType)(conditionValue, 'string');
|
|
73
|
+
if (!conditionValueSameType)
|
|
74
|
+
conditionValueSameType = (0, generic_1.checkIfAllItemsInAnArrayAreSameType)(conditionValue, 'number');
|
|
75
|
+
if (!conditionValueSameType)
|
|
76
|
+
throw new generic_1.SafeRuleEvaluationConditionValueError(dataValue, conditionValue, conditionType);
|
|
77
|
+
for (const conditionValueElement of conditionValue) {
|
|
78
|
+
if (isValidStartEndWithStringNumberValue(dataValue, conditionValueElement, conditionType)) {
|
|
79
|
+
return true;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
return false;
|
|
84
|
+
};
|
|
85
|
+
/**
|
|
86
|
+
* This takes a value and checks if the value starts or ends with value for a string or number
|
|
87
|
+
* @param dataValue the value to check
|
|
88
|
+
* @param conditionValue the value to check against
|
|
89
|
+
* @param conditionType the type of equality condition to check for
|
|
90
|
+
* @returns
|
|
91
|
+
*/
|
|
92
|
+
const isValidStartEndWithStringNumberValue = (dataValue, conditionValue, conditionType) => {
|
|
93
|
+
switch (conditionType) {
|
|
94
|
+
case generic_1.ConditionTypeStartsEndsWith.STARTS_WITH:
|
|
95
|
+
return dataValue.toString().startsWith(conditionValue.toString());
|
|
96
|
+
case generic_1.ConditionTypeStartsEndsWith.ENDS_WITH:
|
|
97
|
+
return dataValue.toString().endsWith(conditionValue.toString());
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
//#endregion internal functions
|
|
@@ -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"}
|
|
@@ -30,14 +30,14 @@ const checkType = (dataValue, typeofValue) => {
|
|
|
30
30
|
switch (typeofValue) {
|
|
31
31
|
case generic_1.ConditionTypeOf.STRING:
|
|
32
32
|
return typeof dataValue === 'string';
|
|
33
|
-
case generic_1.ConditionTypeOf.NUMBER:
|
|
34
|
-
return typeof dataValue === 'number';
|
|
35
33
|
case generic_1.ConditionTypeOf.INTEGER:
|
|
36
34
|
return Number.isInteger(dataValue);
|
|
35
|
+
case generic_1.ConditionTypeOf.NUMBER:
|
|
36
|
+
return typeof dataValue === 'number';
|
|
37
37
|
case generic_1.ConditionTypeOf.BOOLEAN:
|
|
38
38
|
return typeof dataValue === 'boolean';
|
|
39
39
|
case generic_1.ConditionTypeOf.OBJECT:
|
|
40
|
-
return typeof dataValue === 'object';
|
|
40
|
+
return typeof dataValue === 'object' && dataValue !== null;
|
|
41
41
|
case generic_1.ConditionTypeOf.ARRAY:
|
|
42
42
|
return Array.isArray(dataValue);
|
|
43
43
|
case generic_1.ConditionTypeOf.NULL:
|
|
@@ -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"}
|
|
@@ -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"}
|
|
@@ -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;AAIpD,cAAc,4BAA4B,CAAC;AAC3C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,iCAAiC,CAAC;AAChD,cAAc,iBAAiB,CAAC;AAChC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,kBAAkB,CAAC;AACjC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,yBAAyB,CAAC"}
|
|
@@ -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"}
|
|
@@ -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.8",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
7
|
"devDependencies": {
|
|
@@ -36,6 +36,7 @@
|
|
|
36
36
|
"author": "Degenerate Inc.",
|
|
37
37
|
"license": "ISC",
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@degenerate/generic": "^0.0.
|
|
40
|
-
}
|
|
39
|
+
"@degenerate/generic": "^0.0.14"
|
|
40
|
+
},
|
|
41
|
+
"gitHead": "5059d45109891b0ef2bca1fe368767ef7171edef"
|
|
41
42
|
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This is the base error class that all other errors should extend from.
|
|
3
|
-
*/
|
|
4
|
-
export declare class BaseError extends Error {
|
|
5
|
-
errorCode?: number;
|
|
6
|
-
/**
|
|
7
|
-
* This is the base error type for the application.
|
|
8
|
-
*
|
|
9
|
-
* @param message the message to include.
|
|
10
|
-
* @param errorCode the error code if we want to include one.
|
|
11
|
-
*/
|
|
12
|
-
constructor(message: string, errorCode?: number);
|
|
13
|
-
/**
|
|
14
|
-
* This function returns the error as a JSON object.
|
|
15
|
-
*/
|
|
16
|
-
toJSON(): {
|
|
17
|
-
message: string;
|
|
18
|
-
errorType: string;
|
|
19
|
-
errorCode: number | undefined;
|
|
20
|
-
stack: string | undefined;
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
|
-
//# sourceMappingURL=base-error.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"base-error.d.ts","sourceRoot":"","sources":["../../../../../generic/src/errors/base-error.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,qBAAa,SAAU,SAAQ,KAAK;IACzB,SAAS,CAAC,EAAE,MAAM,CAAC;IAE1B;;;;;OAKG;gBACS,OAAO,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM;IAU/C;;OAEG;IACI,MAAM;;;;;;CAQhB"}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.BaseError = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* This is the base error class that all other errors should extend from.
|
|
6
|
-
*/
|
|
7
|
-
class BaseError extends Error {
|
|
8
|
-
/**
|
|
9
|
-
* This is the base error type for the application.
|
|
10
|
-
*
|
|
11
|
-
* @param message the message to include.
|
|
12
|
-
* @param errorCode the error code if we want to include one.
|
|
13
|
-
*/
|
|
14
|
-
constructor(message, errorCode) {
|
|
15
|
-
super(message); // Pass the message to the Error constructor
|
|
16
|
-
this.name = this.constructor.name; // Set the name of the error
|
|
17
|
-
this.errorCode = errorCode; // Set the error code
|
|
18
|
-
// This line is needed to restore the correct prototype chain.
|
|
19
|
-
// (see note below)
|
|
20
|
-
Object.setPrototypeOf(this, new.target.prototype);
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* This function returns the error as a JSON object.
|
|
24
|
-
*/
|
|
25
|
-
toJSON() {
|
|
26
|
-
return {
|
|
27
|
-
message: this.message,
|
|
28
|
-
errorType: this.name,
|
|
29
|
-
errorCode: this.errorCode,
|
|
30
|
-
stack: this.stack,
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
exports.BaseError = BaseError;
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { BaseError } from '../base-error';
|
|
2
|
-
/**
|
|
3
|
-
* This file contains all the errors that are more generic in nature.
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* This is used for when function data was not received.
|
|
7
|
-
*/
|
|
8
|
-
export declare class FunctionDataNotReceivedError extends BaseError {
|
|
9
|
-
/**
|
|
10
|
-
* This is used for when function data was not received.
|
|
11
|
-
*/
|
|
12
|
-
constructor();
|
|
13
|
-
}
|
|
14
|
-
/**
|
|
15
|
-
* This is used for when an item can not have a searchable index created for it.
|
|
16
|
-
*/
|
|
17
|
-
export declare class UnableToCreateSearchableIndexError extends BaseError {
|
|
18
|
-
/**
|
|
19
|
-
* This is used for when an item can not have a searchable index created for it.
|
|
20
|
-
*
|
|
21
|
-
* @param item
|
|
22
|
-
*/
|
|
23
|
-
constructor(item: any);
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* This is used for when a function is not implemented.
|
|
27
|
-
*/
|
|
28
|
-
export declare class NotImplementedError extends BaseError {
|
|
29
|
-
/**
|
|
30
|
-
* This is used for when a function is not implemented.
|
|
31
|
-
*
|
|
32
|
-
*/
|
|
33
|
-
constructor();
|
|
34
|
-
}
|
|
35
|
-
//# sourceMappingURL=generic-errors.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"generic-errors.d.ts","sourceRoot":"","sources":["../../../../../../generic/src/errors/generic/generic-errors.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAE1C;;GAEG;AAEH;;GAEG;AACH,qBAAa,4BAA6B,SAAQ,SAAS;IACvD;;OAEG;;CAIN;AAED;;GAEG;AACH,qBAAa,kCAAmC,SAAQ,SAAS;IAC7D;;;;OAIG;gBACS,IAAI,EAAE,GAAG;CAGxB;AAED;;GAEG;AACH,qBAAa,mBAAoB,SAAQ,SAAS;IAC9C;;;OAGG;;CAIN"}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.NotImplementedError = exports.UnableToCreateSearchableIndexError = exports.FunctionDataNotReceivedError = void 0;
|
|
4
|
-
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
5
|
-
const base_error_1 = require("../base-error");
|
|
6
|
-
/**
|
|
7
|
-
* This file contains all the errors that are more generic in nature.
|
|
8
|
-
*/
|
|
9
|
-
/**
|
|
10
|
-
* This is used for when function data was not received.
|
|
11
|
-
*/
|
|
12
|
-
class FunctionDataNotReceivedError extends base_error_1.BaseError {
|
|
13
|
-
/**
|
|
14
|
-
* This is used for when function data was not received.
|
|
15
|
-
*/
|
|
16
|
-
constructor() {
|
|
17
|
-
super('Data required for the functions to run was not received.');
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
exports.FunctionDataNotReceivedError = FunctionDataNotReceivedError;
|
|
21
|
-
/**
|
|
22
|
-
* This is used for when an item can not have a searchable index created for it.
|
|
23
|
-
*/
|
|
24
|
-
class UnableToCreateSearchableIndexError extends base_error_1.BaseError {
|
|
25
|
-
/**
|
|
26
|
-
* This is used for when an item can not have a searchable index created for it.
|
|
27
|
-
*
|
|
28
|
-
* @param item
|
|
29
|
-
*/
|
|
30
|
-
constructor(item) {
|
|
31
|
-
super(`The item ${item} can not have a searchable index created for it.`);
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
exports.UnableToCreateSearchableIndexError = UnableToCreateSearchableIndexError;
|
|
35
|
-
/**
|
|
36
|
-
* This is used for when a function is not implemented.
|
|
37
|
-
*/
|
|
38
|
-
class NotImplementedError extends base_error_1.BaseError {
|
|
39
|
-
/**
|
|
40
|
-
* This is used for when a function is not implemented.
|
|
41
|
-
*
|
|
42
|
-
*/
|
|
43
|
-
constructor() {
|
|
44
|
-
super('This function / feature is not implemented.');
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
exports.NotImplementedError = NotImplementedError;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
export * from './base-error';
|
|
2
|
-
export * from './generic/generic-errors';
|
|
3
|
-
export * from './request/request-errors';
|
|
4
|
-
export * from './safe/safe-rules-errors';
|
|
5
|
-
export * from './scheduler/scheduler-errors';
|
|
6
|
-
export * from './share-data/share-data-errors';
|
|
7
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../generic/src/errors/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,0BAA0B,CAAC;AACzC,cAAc,0BAA0B,CAAC;AACzC,cAAc,0BAA0B,CAAC;AACzC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,gCAAgC,CAAC"}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./base-error"), exports);
|
|
18
|
-
__exportStar(require("./generic/generic-errors"), exports);
|
|
19
|
-
__exportStar(require("./request/request-errors"), exports);
|
|
20
|
-
__exportStar(require("./safe/safe-rules-errors"), exports);
|
|
21
|
-
__exportStar(require("./scheduler/scheduler-errors"), exports);
|
|
22
|
-
__exportStar(require("./share-data/share-data-errors"), exports);
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
import { BaseError } from '../base-error';
|
|
2
|
-
/**
|
|
3
|
-
* This is thrown when the request object is not valid.
|
|
4
|
-
*/
|
|
5
|
-
export declare class RequestObjectValidationFailedError extends BaseError {
|
|
6
|
-
/**
|
|
7
|
-
* This is thrown when the request object is not valid.
|
|
8
|
-
* @param objectToValidate the object that is not valid
|
|
9
|
-
* @param validationType the type of validation that failed
|
|
10
|
-
*/
|
|
11
|
-
constructor(objectToValidate: any, validationObject: string, validationType: string);
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* This is throw when the request object has too many properties.
|
|
15
|
-
*/
|
|
16
|
-
export declare class RequestObjectTooManyPropertiesError extends BaseError {
|
|
17
|
-
/**
|
|
18
|
-
* This is throw when the request object has too many properties.
|
|
19
|
-
* @param objectToValidate the object that is not valid
|
|
20
|
-
* @param validationOject the object property text that is being validated
|
|
21
|
-
* @param totalProperties the total properties on the object
|
|
22
|
-
* @param maxProperties the max properties allowed on the object
|
|
23
|
-
*/
|
|
24
|
-
constructor(objectToValidate: any, validationOject: string, totalProperties: number, maxProperties: number);
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* This is thrown when the request object has too few properties.
|
|
28
|
-
*/
|
|
29
|
-
export declare class RequestObjectTooFewPropertiesError extends BaseError {
|
|
30
|
-
/**
|
|
31
|
-
* This is thrown when the request object has too few properties.
|
|
32
|
-
* @param objectToValidate the object that is not valid
|
|
33
|
-
* @param validationOject the object property text that is being validated
|
|
34
|
-
* @param totalProperties the total properties on the object
|
|
35
|
-
* @param minProperties the min properties allowed on the object
|
|
36
|
-
*/
|
|
37
|
-
constructor(objectToValidate: any, validationOject: string, totalProperties: number, minProperties: number);
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* This is thrown when the request object should only have a certain number of properties.
|
|
41
|
-
*/
|
|
42
|
-
export declare class RequestObjectShouldOnlyHaveXPropertiesError extends BaseError {
|
|
43
|
-
/**
|
|
44
|
-
* This is thrown when the request object should only have a certain number of properties.
|
|
45
|
-
* @param objectToValidate the object that is not valid
|
|
46
|
-
* @param validationOject the object property text that is being validated
|
|
47
|
-
* @param totalProperties the total properties on the object
|
|
48
|
-
* @param expectedProperties the expected properties on the object
|
|
49
|
-
*/
|
|
50
|
-
constructor(objectToValidate: any, validationOject: string, totalProperties: number, expectedProperties: number);
|
|
51
|
-
}
|
|
52
|
-
/**
|
|
53
|
-
* This is throw when the request object has a property that does not match the param property.
|
|
54
|
-
*/
|
|
55
|
-
export declare class RequestObjectPropertyNotMatchingParamProperty extends BaseError {
|
|
56
|
-
/**
|
|
57
|
-
* This is thrown when the request object doesnot match the param property.
|
|
58
|
-
* @param requestPropertyName the property in the request object
|
|
59
|
-
* @param requestPropertyValue the value of the property in the request object
|
|
60
|
-
* @param paramPropertyName the property in the param object
|
|
61
|
-
* @param paramPropertyValue the value of the property in the param object
|
|
62
|
-
*/
|
|
63
|
-
constructor(requestPropertyName: string, requestPropertyValue: any, paramPropertyName: string, paramPropertyValue: any);
|
|
64
|
-
}
|
|
65
|
-
/**
|
|
66
|
-
* This is thrown when the query object is not valid.
|
|
67
|
-
*/
|
|
68
|
-
export declare class RequestQueryNotValidError extends BaseError {
|
|
69
|
-
/**
|
|
70
|
-
* This is thrown when the query object is not valid.
|
|
71
|
-
* @param queryObjectName the name of the query object
|
|
72
|
-
* @param queryValue the value of the query object
|
|
73
|
-
* @param expectedType the expected type of the query object
|
|
74
|
-
*/
|
|
75
|
-
constructor(queryObjectName: string, queryValue: any, expectedType: string);
|
|
76
|
-
}
|
|
77
|
-
/**
|
|
78
|
-
* This is thrown when the param object is not valid.
|
|
79
|
-
*/
|
|
80
|
-
export declare class RequestParamNotValidError extends BaseError {
|
|
81
|
-
/**
|
|
82
|
-
* This is thrown when the param object is not valid.
|
|
83
|
-
* @param paramName the name of the param object
|
|
84
|
-
* @param paramValue the value of the param object
|
|
85
|
-
* @param expectedType the expected type of the param object
|
|
86
|
-
*/
|
|
87
|
-
constructor(paramName: string, paramValue: any, expectedType: string, allParams: any);
|
|
88
|
-
}
|
|
89
|
-
//# sourceMappingURL=request-errors.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"request-errors.d.ts","sourceRoot":"","sources":["../../../../../../generic/src/errors/request/request-errors.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAI1C;;GAEG;AACH,qBAAa,kCAAmC,SAAQ,SAAS;IAC7D;;;;OAIG;gBACS,gBAAgB,EAAE,GAAG,EAAE,gBAAgB,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM;CAGtF;AAED;;GAEG;AACH,qBAAa,mCAAoC,SAAQ,SAAS;IAC9D;;;;;;OAMG;gBACS,gBAAgB,EAAE,GAAG,EAAE,eAAe,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM;CAG7G;AAED;;GAEG;AACH,qBAAa,kCAAmC,SAAQ,SAAS;IAC7D;;;;;;OAMG;gBACS,gBAAgB,EAAE,GAAG,EAAE,eAAe,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM;CAG7G;AAED;;GAEG;AACH,qBAAa,2CAA4C,SAAQ,SAAS;IACtE;;;;;;OAMG;gBACS,gBAAgB,EAAE,GAAG,EAAE,eAAe,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,EAAE,kBAAkB,EAAE,MAAM;CAGlH;AAED;;GAEG;AACH,qBAAa,6CAA8C,SAAQ,SAAS;IACxE;;;;;;OAMG;gBACS,mBAAmB,EAAE,MAAM,EAAE,oBAAoB,EAAE,GAAG,EAAE,iBAAiB,EAAE,MAAM,EAAE,kBAAkB,EAAE,GAAG;CAGzH;AAMD;;GAEG;AACH,qBAAa,yBAA0B,SAAQ,SAAS;IACpD;;;;;OAKG;gBACS,eAAe,EAAE,MAAM,EAAE,UAAU,EAAE,GAAG,EAAE,YAAY,EAAE,MAAM;CAG7E;AAMD;;GAEG;AACH,qBAAa,yBAA0B,SAAQ,SAAS;IACpD;;;;;OAKG;gBACS,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,GAAG,EAAE,YAAY,EAAE,MAAM,EAAE,SAAS,EAAE,GAAG;CAGvF"}
|