@degenerate/rules 0.1.9 → 0.1.10
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 +82 -2
- package/dist/__testdata__/conditions/current-conditions.test-data.d.ts +64 -0
- package/dist/__testdata__/conditions/current-conditions.test-data.d.ts.map +1 -1
- package/dist/__testdata__/conditions/current-conditions.test-data.js +115 -338
- package/dist/__testdata__/rules/rules.test-data.d.ts.map +1 -1
- package/dist/__testdata__/rules/rules.test-data.js +1 -0
- package/dist/create/conditions/create-share-rule-conditions.d.ts +12 -0
- package/dist/create/conditions/create-share-rule-conditions.d.ts.map +1 -0
- package/dist/create/conditions/create-share-rule-conditions.js +21 -0
- package/dist/create/conditions/create-typeof-conditions.d.ts +2 -2
- package/dist/create/conditions/create-typeof-conditions.d.ts.map +1 -1
- package/dist/create/conditions/create-typeof-conditions.js +3 -3
- package/dist/create/index.d.ts +1 -0
- package/dist/create/index.d.ts.map +1 -1
- package/dist/create/index.js +1 -0
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -1,4 +1,84 @@
|
|
|
1
|
-
|
|
1
|
+
[Back to @degenerate documentation](../../README.md)
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
# @degenerate/rules Package
|
|
4
4
|
|
|
5
|
+
The `@degenerate/rules` package is a core component of the SAFE system, responsible for defining and enforcing various rules and policies within the system. This package provides a set of utilities and functions to manage and validate rules, ensuring that the system operates within the defined constraints and policies.
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
# Contents
|
|
9
|
+
|
|
10
|
+
1. [Features](#features)
|
|
11
|
+
2. [Installation](#installation)
|
|
12
|
+
3. [Usage](#usage)
|
|
13
|
+
4. [Test Data](#test-data)
|
|
14
|
+
5. [Contributing](#contributing)
|
|
15
|
+
6. [License](#license)
|
|
16
|
+
7. [Support](#support)
|
|
17
|
+
|
|
18
|
+
## Features
|
|
19
|
+
|
|
20
|
+
- **Rule Creation**: Allows the creation and management of rules that govern the behavior of the system.
|
|
21
|
+
|
|
22
|
+
Rule creation contains the functions and services to create rules that will be accepted into the SAFE Network. The `@degenerate/rules` package provides a set of utilities and functions to create and manage rules, ensuring that the system operates within the defined constraints and policies.
|
|
23
|
+
|
|
24
|
+
[Rule Creation Directory](./src/create/)
|
|
25
|
+
|
|
26
|
+
- **Rule Evaluation**: Provides utilities to take the existing data, proposed data changes and rule sets and evalute whether the proposed changes are valid.
|
|
27
|
+
|
|
28
|
+
Rule evaluation contains the functions and services to evaluate the proposed data to ensure that the share data objects are consistent and maintain integrity in the SAFE Network. The `@degenerate/rules` package provides a set of utilities and functions to evaluate rules, ensuring that the system operates within the defined constraints and policies.
|
|
29
|
+
|
|
30
|
+
[Rule Evaluation Directory](./src/evaluation/)
|
|
31
|
+
|
|
32
|
+
- **Rule Validation**: Provides utilities to validate rules, shapes and data coming into the SAFE network.
|
|
33
|
+
|
|
34
|
+
Rule Validation ensures that all data and operations within the system adhere to the established rules and policies and will be valid in the SAFE network. The `@degenerate/rules` package provides a set of utilities and functions to manage and validate rules, ensuring that the system operates within the defined constraints and policies.
|
|
35
|
+
|
|
36
|
+
[Rule Evaluation Directory](./src/evaluation/)
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
[Back To Top](#contents)
|
|
40
|
+
|
|
41
|
+
## Installation
|
|
42
|
+
|
|
43
|
+
To install the `@degenerate/rules` package, use the following command:
|
|
44
|
+
|
|
45
|
+
```sh
|
|
46
|
+
npm install @degenerate/rules
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
[Back To Top](#contents)
|
|
50
|
+
|
|
51
|
+
## Usage
|
|
52
|
+
|
|
53
|
+
## Test Data
|
|
54
|
+
|
|
55
|
+
Test data is provided in the `__testdata__` directory. This data is used to test the rule creation, evaluation and validation functions.
|
|
56
|
+
|
|
57
|
+
[Test Data Directory](./__testdata__/)
|
|
58
|
+
|
|
59
|
+
[Back To Top](#contents)
|
|
60
|
+
|
|
61
|
+
## Contributing
|
|
62
|
+
Contributions to the @degenerate/rules package are welcome. Please follow the guidelines outlined in the CONTRIBUTING.md file.
|
|
63
|
+
|
|
64
|
+
[Back To Top](#contents)
|
|
65
|
+
|
|
66
|
+
## License
|
|
67
|
+
This package is licensed under the ISC License. See the [LICENSE](./LICENSE.md) file for more information.
|
|
68
|
+
|
|
69
|
+
[Back To Top](#contents)
|
|
70
|
+
|
|
71
|
+
## Support
|
|
72
|
+
For support and questions, please open an issue on the GitHub repository.
|
|
73
|
+
|
|
74
|
+
[Back To Top](#contents)
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
| Rule Component | Function | Directory |
|
|
81
|
+
| ----- | ----- | ----- |
|
|
82
|
+
| **Creation** | Allows the creation and management of rules that govern the behaviour of the system. | [Create](./src/create/) |
|
|
83
|
+
| **Evaluation** | Provides utilities to take the existing data, proposed data changes and rule sets and evaluate whether the proposed changes are valid. | ./src/evaluation/ |
|
|
84
|
+
| **Validation** | Provides utilities to validate rules, shapes and data coming into the SAFE network. | ./src/validation/ |
|
|
@@ -1 +1,65 @@
|
|
|
1
|
+
import { IConditionBoolean, IConditionContains, IConditionEmpty, IConditionEquality, IConditionNull, IConditionRange, IConditionShareRule, IConditionSpecial, IConditionStartsEndsWith, IShareRule } from '@degenerate/generic';
|
|
2
|
+
export declare const exampleConditionTypeOfIsNumber: import("@degenerate/generic").IConditionTypeOf;
|
|
3
|
+
export declare const exampleConditionTypeOfIsNotNumber: import("@degenerate/generic").IConditionTypeOf;
|
|
4
|
+
export declare const exampleConditionTypeOfIsString: import("@degenerate/generic").IConditionTypeOf;
|
|
5
|
+
export declare const exampleConditionTypeOfIsNotString: import("@degenerate/generic").IConditionTypeOf;
|
|
6
|
+
export declare const exampleConditionTypeOfIsBoolean: import("@degenerate/generic").IConditionTypeOf;
|
|
7
|
+
export declare const exampleConditionTypeOfIsNotBoolean: import("@degenerate/generic").IConditionTypeOf;
|
|
8
|
+
export declare const exampleConditionTypeOfIsObject: import("@degenerate/generic").IConditionTypeOf;
|
|
9
|
+
export declare const exampleConditionTypeOfIsNotObject: import("@degenerate/generic").IConditionTypeOf;
|
|
10
|
+
export declare const exampleConditionTypeOfIsInteger: import("@degenerate/generic").IConditionTypeOf;
|
|
11
|
+
export declare const exampleConditionTypeOfIsNotInteger: import("@degenerate/generic").IConditionTypeOf;
|
|
12
|
+
export declare const exampleConditionTypeOfIsArray: import("@degenerate/generic").IConditionTypeOf;
|
|
13
|
+
export declare const exampleConditionTypeOfIsNotArray: import("@degenerate/generic").IConditionTypeOf;
|
|
14
|
+
export declare const exampleConditionTypeOfIsNull: import("@degenerate/generic").IConditionTypeOf;
|
|
15
|
+
export declare const exampleConditionTypeOfIsNotNull: import("@degenerate/generic").IConditionTypeOf;
|
|
16
|
+
export declare const exampleConditionTypeOfIsUndefined: import("@degenerate/generic").IConditionTypeOf;
|
|
17
|
+
export declare const exampleConditionTypeOfIsNotUndefined: import("@degenerate/generic").IConditionTypeOf;
|
|
18
|
+
export declare const exampleConditionTypeOfIsFunction: import("@degenerate/generic").IConditionTypeOf;
|
|
19
|
+
export declare const exampleConditionTypeOfIsNotFunction: import("@degenerate/generic").IConditionTypeOf;
|
|
20
|
+
export declare const exampleConditionTypeOfIsBigInt: import("@degenerate/generic").IConditionTypeOf;
|
|
21
|
+
export declare const exampleConditionTypeOfIsNotBigInt: import("@degenerate/generic").IConditionTypeOf;
|
|
22
|
+
export declare const exampleConditionEqualityIs100: IConditionEquality;
|
|
23
|
+
export declare const exampleConditionEqualityIsNotNewYork: IConditionEquality;
|
|
24
|
+
export declare const exampleConditionEqualityIs200: IConditionEquality;
|
|
25
|
+
export declare const exampleConditionEqualityIsNotAdmin: IConditionEquality;
|
|
26
|
+
export declare const exampleConditionRangeIsGreaterThan100: IConditionRange;
|
|
27
|
+
export declare const exampleConditionRangeIsNotGreaterThan100: IConditionRange;
|
|
28
|
+
export declare const exampleConditionRangeIsLessThan200: IConditionRange;
|
|
29
|
+
export declare const exampleConditionRangeIsNotLessThan200: IConditionRange;
|
|
30
|
+
export declare const exampleConditionRangeIsGreaterThanOrEqual100: IConditionRange;
|
|
31
|
+
export declare const exampleConditionRangeIsNotGreaterThanOrEqual100: IConditionRange;
|
|
32
|
+
export declare const exampleConditionRangeIsLessThanOrEqual200: IConditionRange;
|
|
33
|
+
export declare const exampleConditionRangeIsNotLessThanOrEqual200: IConditionRange;
|
|
34
|
+
export declare const exampleConditionRangeIsGreaterThanH: IConditionRange;
|
|
35
|
+
export declare const exampleConditionRangeIsNotGreaterThanH: IConditionRange;
|
|
36
|
+
export declare const exampleConditionRangeIsLessThanY: IConditionRange;
|
|
37
|
+
export declare const exampleConditionRangeIsNotLessThanY: IConditionRange;
|
|
38
|
+
export declare const exampleConditionRangeIsGreaterThanOrEqualH: IConditionRange;
|
|
39
|
+
export declare const exampleConditionRangeIsNotGreaterThanOrEqualH: IConditionRange;
|
|
40
|
+
export declare const exampleConditionRangeIsLessThanOrEqualY: IConditionRange;
|
|
41
|
+
export declare const exampleConditionRangeIsNotLessThanOrEqualY: IConditionRange;
|
|
42
|
+
export declare const exampleConditionContainsIsGar: IConditionContains;
|
|
43
|
+
export declare const exampleConditionContainsIsNotGarison: IConditionContains;
|
|
44
|
+
export declare const exampleConditionContainsIsGarCarHap: IConditionContains;
|
|
45
|
+
export declare const exampleConditionContainsIsNotGarCarHap: IConditionContains;
|
|
46
|
+
export declare const exampleConditionContainsIs1135: IConditionContains;
|
|
47
|
+
export declare const exampleConditionContainsIsNot1135: IConditionContains;
|
|
48
|
+
export declare const exampleConditionStartsWithIsCal: IConditionStartsEndsWith;
|
|
49
|
+
export declare const exampleConditionStartsWithIsNotCal: IConditionStartsEndsWith;
|
|
50
|
+
export declare const exampleConditionEndsWithIsGary: IConditionStartsEndsWith;
|
|
51
|
+
export declare const exampleConditionEndsWithIsNotGary: IConditionStartsEndsWith;
|
|
52
|
+
export declare const exampleConditionIsNull: IConditionNull;
|
|
53
|
+
export declare const exampleConditionIsNotNull: IConditionNull;
|
|
54
|
+
export declare const exampleConditionBooleanIsTrue: IConditionBoolean;
|
|
55
|
+
export declare const exampleConditionBooleanIsNotTrue: IConditionBoolean;
|
|
56
|
+
export declare const exampleConditionBooleanIsFalse: IConditionBoolean;
|
|
57
|
+
export declare const exampleConditionBooleanIsNotFalse: IConditionBoolean;
|
|
58
|
+
export declare const exampleConditionIsEmpty: IConditionEmpty;
|
|
59
|
+
export declare const exampleConditionIsNotEmpty: IConditionEmpty;
|
|
60
|
+
export declare const exampleConditionSpecialIsPattern: IConditionSpecial;
|
|
61
|
+
export declare const exampleConditionSpecialIsNotPattern: IConditionSpecial;
|
|
62
|
+
export declare const nestedShareRule: IShareRule;
|
|
63
|
+
export declare const exampleConditionIsShareRule: IConditionShareRule;
|
|
64
|
+
export declare const exampleConditionIsNotShareRule: IConditionShareRule;
|
|
1
65
|
//# sourceMappingURL=current-conditions.test-data.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"current-conditions.test-data.d.ts","sourceRoot":"","sources":["../../../src/__testdata__/conditions/current-conditions.test-data.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"current-conditions.test-data.d.ts","sourceRoot":"","sources":["../../../src/__testdata__/conditions/current-conditions.test-data.ts"],"names":[],"mappings":"AAAA,OAAO,EAQH,iBAAiB,EACjB,kBAAkB,EAClB,eAAe,EACf,kBAAkB,EAClB,cAAc,EACd,eAAe,EACf,mBAAmB,EACnB,iBAAiB,EACjB,wBAAwB,EACxB,UAAU,EACb,MAAM,qBAAqB,CAAC;AAc7B,eAAO,MAAM,8BAA8B,gDAAkG,CAAC;AAC9I,eAAO,MAAM,iCAAiC,gDAAsG,CAAC;AACrJ,eAAO,MAAM,8BAA8B,gDAAyF,CAAC;AACrI,eAAO,MAAM,iCAAiC,gDAA6F,CAAC;AAC5I,eAAO,MAAM,+BAA+B,gDAA8F,CAAC;AAC3I,eAAO,MAAM,kCAAkC,gDAAkG,CAAC;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
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
// IS_NOT_TYPEOF = 'is not typeof'
|
|
118
|
-
// }
|
|
119
|
-
// /**
|
|
120
|
-
// * This contains the choices for the equality conditions.
|
|
121
|
-
// */
|
|
122
|
-
// export enum ConditionTypeEquality {
|
|
123
|
-
// EQUAL = 'equal',
|
|
124
|
-
// NOT_EQUAL = 'not equal'
|
|
125
|
-
// }
|
|
126
|
-
// /**
|
|
127
|
-
// * This contains the choices for the range conditions.
|
|
128
|
-
// */
|
|
129
|
-
// export enum ConditionTypeRange {
|
|
130
|
-
// GREATER_THAN = 'greater than',
|
|
131
|
-
// LESS_THAN = 'less than',
|
|
132
|
-
// GREATER_THAN_OR_EQUAL = 'greater than or equal',
|
|
133
|
-
// LESS_THAN_OR_EQUAL = 'less than or equal'
|
|
134
|
-
// }
|
|
135
|
-
// /**
|
|
136
|
-
// * This contains the choices for the contains conditions.
|
|
137
|
-
// */
|
|
138
|
-
// export enum ConditionTypeContains {
|
|
139
|
-
// CONTAINS = 'contains',
|
|
140
|
-
// NOT_CONTAINS = 'not contains',
|
|
141
|
-
// }
|
|
142
|
-
// /**
|
|
143
|
-
// * This contains the choices for the starts with and ends with conditions.
|
|
144
|
-
// */
|
|
145
|
-
// export enum ConditionTypeStartsEndsWith {
|
|
146
|
-
// STARTS_WITH = 'starts with',
|
|
147
|
-
// ENDS_WITH = 'ends with',
|
|
148
|
-
// }
|
|
149
|
-
// /**
|
|
150
|
-
// * This contains the choices for the null conditions.
|
|
151
|
-
// */
|
|
152
|
-
// export enum ConditionTypeNull {
|
|
153
|
-
// IS_NULL = 'is null',
|
|
154
|
-
// IS_NOT_NULL = 'is not null',
|
|
155
|
-
// }
|
|
156
|
-
// /**
|
|
157
|
-
// * This contains the choices for the boolean conditions.
|
|
158
|
-
// */
|
|
159
|
-
// export enum ConditionTypeBoolean {
|
|
160
|
-
// IS_TRUE = 'is true',
|
|
161
|
-
// IS_FALSE = 'is false',
|
|
162
|
-
// }
|
|
163
|
-
// /**
|
|
164
|
-
// * This contains the choices for the empty conditions.
|
|
165
|
-
// */
|
|
166
|
-
// export enum ConditionTypeEmpty {
|
|
167
|
-
// IS_EMPTY = 'is empty',
|
|
168
|
-
// IS_NOT_EMPTY = 'is not empty',
|
|
169
|
-
// }
|
|
170
|
-
// /**
|
|
171
|
-
// * This contains the choices for the special conditions.
|
|
172
|
-
// */
|
|
173
|
-
// export enum ConditionTypeSpecial {
|
|
174
|
-
// PATTERN = 'pattern',
|
|
175
|
-
// }
|
|
176
|
-
// /**
|
|
177
|
-
// * This contains the choices for the combined rule conditions that are a type of object
|
|
178
|
-
// */
|
|
179
|
-
// export enum ConditionTypeCombinedRules {
|
|
180
|
-
// OBJECT = 'object',
|
|
181
|
-
// }
|
|
182
|
-
// /**
|
|
183
|
-
// * This is the interface for the conditional information in the checks.
|
|
184
|
-
// */
|
|
185
|
-
// export type ICondition =
|
|
186
|
-
// IConditionTypeOf |
|
|
187
|
-
// IConditionEquality |
|
|
188
|
-
// IConditionRange |
|
|
189
|
-
// IConditionContains |
|
|
190
|
-
// IConditionStartsEndsWith |
|
|
191
|
-
// IConditionNull |
|
|
192
|
-
// IConditionBoolean |
|
|
193
|
-
// IConditionEmpty |
|
|
194
|
-
// IConditionSpecial;
|
|
195
|
-
// /**
|
|
196
|
-
// * These are the different choices for the types of data in a condition.
|
|
197
|
-
// */
|
|
198
|
-
// export enum ConditionTypeOf {
|
|
199
|
-
// STRING = 'string',
|
|
200
|
-
// NUMBER = 'number',
|
|
201
|
-
// INTEGER = 'integer',
|
|
202
|
-
// BOOLEAN = 'boolean',
|
|
203
|
-
// OBJECT = 'object',
|
|
204
|
-
// ARRAY = 'array',
|
|
205
|
-
// NULL = 'null',
|
|
206
|
-
// UNDEFINED = 'undefined',
|
|
207
|
-
// FUNCTION = 'function',
|
|
208
|
-
// // SYMBOL = 'symbol',
|
|
209
|
-
// BIGINT = 'bigint'
|
|
210
|
-
// }
|
|
211
|
-
// /**
|
|
212
|
-
// * This is the interface for the type of condition.
|
|
213
|
-
// *
|
|
214
|
-
// const exampleConditionTypeOf: IConditionTypeOf = {
|
|
215
|
-
// targettedProperty: 'address.city.total',
|
|
216
|
-
// conditionType: ConditionTypeTypeOf.IS_TYPEOF,
|
|
217
|
-
// conditionValue: ConditionTypeOf.NUMBER
|
|
218
|
-
// };
|
|
219
|
-
// */
|
|
220
|
-
// export interface IConditionTypeOf {
|
|
221
|
-
// targettedProperty: string; // the property that is being checked ('address.city.value')
|
|
222
|
-
// conditionType: ConditionTypeTypeOf; // the type of condition to evaluate
|
|
223
|
-
// conditionValue: ConditionTypeOf; // the value to evaluate the condition against
|
|
224
|
-
// }
|
|
225
|
-
// /**
|
|
226
|
-
// * This is the interface for the equality condition.
|
|
227
|
-
// *
|
|
228
|
-
// const exampleConditionEquality: IConditionEquality = {
|
|
229
|
-
// targettedProperty: 'address.city.total',
|
|
230
|
-
// conditionType: ConditionTypeEquality.EQUAL,
|
|
231
|
-
// conditionValue: 100
|
|
232
|
-
// };
|
|
233
|
-
// */
|
|
234
|
-
// export interface IConditionEquality {
|
|
235
|
-
// targettedProperty: string; // the property that is being checked ('address.city.value')
|
|
236
|
-
// conditionType: ConditionTypeEquality; // the type of condition to evaluate
|
|
237
|
-
// conditionValue: number | string; // the value to evaluate the condition against
|
|
238
|
-
// }
|
|
239
|
-
// /**
|
|
240
|
-
// * This is the interface for the range condition.
|
|
241
|
-
// *
|
|
242
|
-
// const exampleConditionRange: IConditionRange = {
|
|
243
|
-
// targettedProperty: 'address.city.total',
|
|
244
|
-
// conditionType: ConditionTypeRange.GREATER_THAN,
|
|
245
|
-
// conditionValue: 100
|
|
246
|
-
// };
|
|
247
|
-
// */
|
|
248
|
-
// export interface IConditionRange {
|
|
249
|
-
// targettedProperty: string; // the property that is being checked ('address.city.value')
|
|
250
|
-
// conditionType: ConditionTypeRange; // the type of condition to evaluate
|
|
251
|
-
// conditionValue: string | number; // the value to evaluate the condition against
|
|
252
|
-
// }
|
|
253
|
-
// /**
|
|
254
|
-
// * This is the interface for the contains condition.
|
|
255
|
-
// *
|
|
256
|
-
// const exampleConditionContains: IConditionContains = {
|
|
257
|
-
// targettedProperty: 'address.city.name',
|
|
258
|
-
// conditionType: ConditionTypeContains.CONTAINS,
|
|
259
|
-
// conditionValue: ['gar'| 'garison' | 'garage']
|
|
260
|
-
// * };
|
|
261
|
-
// */
|
|
262
|
-
// export interface IConditionContains {
|
|
263
|
-
// targettedProperty: string; // the property that is being checked ('address.city.value')
|
|
264
|
-
// conditionType: ConditionTypeContains; // the type of condition to evaluate
|
|
265
|
-
// conditionValue: string | string[] | number[]; // the value to evaluate the condition against
|
|
266
|
-
// }
|
|
267
|
-
// /**
|
|
268
|
-
// * This is the interface for the starts with and ends with condition.
|
|
269
|
-
// *
|
|
270
|
-
// const exampleConditionStartsEndsWith: IConditionStartsEndsWith = {
|
|
271
|
-
// targettedProperty: 'address.city.name',
|
|
272
|
-
// conditionType: ConditionTypeStartsEndsWith.STARTS_WITH,
|
|
273
|
-
// conditionValue: 'cal'
|
|
274
|
-
// };
|
|
275
|
-
// */
|
|
276
|
-
// export interface IConditionStartsEndsWith {
|
|
277
|
-
// targettedProperty: string; // the property that is being checked ('address.city.value')
|
|
278
|
-
// conditionType: ConditionTypeStartsEndsWith; // the type of condition to evaluate
|
|
279
|
-
// conditionValue: string; // the value to evaluate the condition against
|
|
280
|
-
// }
|
|
281
|
-
// /**
|
|
282
|
-
// * This is the interface for the null condition.
|
|
283
|
-
// *
|
|
284
|
-
// const exampleConditionNull: IConditionNull = {
|
|
285
|
-
// targettedProperty: 'address.city.name',
|
|
286
|
-
// conditionType: ConditionTypeNull.IS_NULL
|
|
287
|
-
// };
|
|
288
|
-
// */
|
|
289
|
-
// export interface IConditionNull {
|
|
290
|
-
// targettedProperty: string; // the property that is being checked ('address.city.value')
|
|
291
|
-
// conditionType: ConditionTypeNull; // the type of condition to evaluate
|
|
292
|
-
// }
|
|
293
|
-
// /**
|
|
294
|
-
// * This is the interface for the boolean condition.
|
|
295
|
-
// *
|
|
296
|
-
// const exampleConditionBoolean: IConditionBoolean = {
|
|
297
|
-
// targettedProperty: 'address.city.name',
|
|
298
|
-
// conditionType: ConditionTypeBoolean.IS_TRUE
|
|
299
|
-
// };
|
|
300
|
-
// */
|
|
301
|
-
// export interface IConditionBoolean {
|
|
302
|
-
// targettedProperty: string; // the property that is being checked ('address.city.value')
|
|
303
|
-
// conditionType: ConditionTypeBoolean; // the type of condition to evaluate
|
|
304
|
-
// }
|
|
305
|
-
// /**
|
|
306
|
-
// * This is the interface for the empty condition.
|
|
307
|
-
// *
|
|
308
|
-
// const exampleConditionEmpty: IConditionEmpty = {
|
|
309
|
-
// targettedProperty: 'address.city.name',
|
|
310
|
-
// conditionType: ConditionTypeEmpty.IS_EMPTY
|
|
311
|
-
// };
|
|
312
|
-
// */
|
|
313
|
-
// export interface IConditionEmpty {
|
|
314
|
-
// targettedProperty: string; // the property that is being checked ('address.city.value')
|
|
315
|
-
// conditionType: ConditionTypeEmpty; // the type of condition to evaluate
|
|
316
|
-
// }
|
|
317
|
-
// /**
|
|
318
|
-
// * This is the interface for the special condition.
|
|
319
|
-
// *
|
|
320
|
-
// const exampleConditionSpecial: IConditionSpecial = {
|
|
321
|
-
// targettedProperty: 'address.city.name',
|
|
322
|
-
// conditionType: ConditionTypeSpecial.PATTERN,
|
|
323
|
-
// conditionValue: '^[a-zA-Z0-9]*$'
|
|
324
|
-
// };
|
|
325
|
-
// */
|
|
326
|
-
// export interface IConditionSpecial {
|
|
327
|
-
// targettedProperty: string; // the property that is being checked ('address.city.value')
|
|
328
|
-
// conditionType: ConditionTypeSpecial; // the type of condition to evaluate
|
|
329
|
-
// conditionValue: string; // the value to evaluate the condition against
|
|
330
|
-
// }
|
|
331
|
-
// /**
|
|
332
|
-
// * This is the interface for the combined rule condition.
|
|
333
|
-
// */
|
|
334
|
-
// export interface IConditionCombinedRules {
|
|
335
|
-
// targettedProperty: string; // the property that is being checked ('address.city.value')
|
|
336
|
-
// conditionType: ConditionTypeCombinedRules; // the type of condition to evaluate
|
|
337
|
-
// conditionValue: IShareRuleGroup; // the value to evaluate the condition against
|
|
338
|
-
// }
|
|
339
|
-
// //#endregion Conditions
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.exampleConditionEndsWithIsNotGary = exports.exampleConditionEndsWithIsGary = exports.exampleConditionStartsWithIsNotCal = exports.exampleConditionStartsWithIsCal = exports.exampleConditionContainsIsNot1135 = exports.exampleConditionContainsIs1135 = exports.exampleConditionContainsIsNotGarCarHap = exports.exampleConditionContainsIsGarCarHap = exports.exampleConditionContainsIsNotGarison = exports.exampleConditionContainsIsGar = exports.exampleConditionRangeIsNotLessThanOrEqualY = exports.exampleConditionRangeIsLessThanOrEqualY = exports.exampleConditionRangeIsNotGreaterThanOrEqualH = exports.exampleConditionRangeIsGreaterThanOrEqualH = exports.exampleConditionRangeIsNotLessThanY = exports.exampleConditionRangeIsLessThanY = exports.exampleConditionRangeIsNotGreaterThanH = exports.exampleConditionRangeIsGreaterThanH = exports.exampleConditionRangeIsNotLessThanOrEqual200 = exports.exampleConditionRangeIsLessThanOrEqual200 = exports.exampleConditionRangeIsNotGreaterThanOrEqual100 = exports.exampleConditionRangeIsGreaterThanOrEqual100 = exports.exampleConditionRangeIsNotLessThan200 = exports.exampleConditionRangeIsLessThan200 = exports.exampleConditionRangeIsNotGreaterThan100 = exports.exampleConditionRangeIsGreaterThan100 = exports.exampleConditionEqualityIsNotAdmin = exports.exampleConditionEqualityIs200 = exports.exampleConditionEqualityIsNotNewYork = exports.exampleConditionEqualityIs100 = exports.exampleConditionTypeOfIsNotBigInt = exports.exampleConditionTypeOfIsBigInt = exports.exampleConditionTypeOfIsNotFunction = exports.exampleConditionTypeOfIsFunction = exports.exampleConditionTypeOfIsNotUndefined = exports.exampleConditionTypeOfIsUndefined = exports.exampleConditionTypeOfIsNotNull = exports.exampleConditionTypeOfIsNull = exports.exampleConditionTypeOfIsNotArray = exports.exampleConditionTypeOfIsArray = exports.exampleConditionTypeOfIsNotInteger = exports.exampleConditionTypeOfIsInteger = exports.exampleConditionTypeOfIsNotObject = exports.exampleConditionTypeOfIsObject = exports.exampleConditionTypeOfIsNotBoolean = exports.exampleConditionTypeOfIsBoolean = exports.exampleConditionTypeOfIsNotString = exports.exampleConditionTypeOfIsString = exports.exampleConditionTypeOfIsNotNumber = exports.exampleConditionTypeOfIsNumber = void 0;
|
|
4
|
+
exports.exampleConditionIsNotShareRule = exports.exampleConditionIsShareRule = exports.nestedShareRule = exports.exampleConditionSpecialIsNotPattern = exports.exampleConditionSpecialIsPattern = exports.exampleConditionIsNotEmpty = exports.exampleConditionIsEmpty = exports.exampleConditionBooleanIsNotFalse = exports.exampleConditionBooleanIsFalse = exports.exampleConditionBooleanIsNotTrue = exports.exampleConditionBooleanIsTrue = exports.exampleConditionIsNotNull = exports.exampleConditionIsNull = void 0;
|
|
5
|
+
const generic_1 = require("@degenerate/generic");
|
|
6
|
+
const create_typeof_conditions_1 = require("../../create/conditions/create-typeof-conditions");
|
|
7
|
+
const create_equality_conditions_1 = require("../../create/conditions/create-equality-conditions");
|
|
8
|
+
const create_range_conditions_1 = require("../../create/conditions/create-range-conditions");
|
|
9
|
+
const create_contains_conditions_1 = require("../../create/conditions/create-contains-conditions");
|
|
10
|
+
const create_starts_end_with_conditions_1 = require("../../create/conditions/create-starts-end-with-conditions");
|
|
11
|
+
const create_null_conditions_1 = require("../../create/conditions/create-null-conditions");
|
|
12
|
+
const create_boolean_conditions_1 = require("../../create/conditions/create-boolean-conditions");
|
|
13
|
+
const create_empty_conditions_1 = require("../../create/conditions/create-empty-conditions");
|
|
14
|
+
const create_special_conditions_1 = require("../../create/conditions/create-special-conditions");
|
|
15
|
+
const create_share_rule_conditions_1 = require("../../create/conditions/create-share-rule-conditions");
|
|
16
|
+
//#region condition TYPEOF
|
|
17
|
+
exports.exampleConditionTypeOfIsNumber = (0, create_typeof_conditions_1.createTypeOfConditions)('address.city.total', generic_1.ConditionTypeOf.NUMBER, generic_1.ConditionTypeQualifier.IS);
|
|
18
|
+
exports.exampleConditionTypeOfIsNotNumber = (0, create_typeof_conditions_1.createTypeOfConditions)('address.city.total', generic_1.ConditionTypeOf.NUMBER, generic_1.ConditionTypeQualifier.IS_NOT);
|
|
19
|
+
exports.exampleConditionTypeOfIsString = (0, create_typeof_conditions_1.createTypeOfConditions)('user.name', generic_1.ConditionTypeOf.STRING, generic_1.ConditionTypeQualifier.IS);
|
|
20
|
+
exports.exampleConditionTypeOfIsNotString = (0, create_typeof_conditions_1.createTypeOfConditions)('user.name', generic_1.ConditionTypeOf.STRING, generic_1.ConditionTypeQualifier.IS_NOT);
|
|
21
|
+
exports.exampleConditionTypeOfIsBoolean = (0, create_typeof_conditions_1.createTypeOfConditions)('user.isActive', generic_1.ConditionTypeOf.BOOLEAN, generic_1.ConditionTypeQualifier.IS);
|
|
22
|
+
exports.exampleConditionTypeOfIsNotBoolean = (0, create_typeof_conditions_1.createTypeOfConditions)('user.isActive', generic_1.ConditionTypeOf.BOOLEAN, generic_1.ConditionTypeQualifier.IS_NOT);
|
|
23
|
+
exports.exampleConditionTypeOfIsObject = (0, create_typeof_conditions_1.createTypeOfConditions)('user.profile', generic_1.ConditionTypeOf.OBJECT, generic_1.ConditionTypeQualifier.IS);
|
|
24
|
+
exports.exampleConditionTypeOfIsNotObject = (0, create_typeof_conditions_1.createTypeOfConditions)('user.profile', generic_1.ConditionTypeOf.OBJECT, generic_1.ConditionTypeQualifier.IS_NOT);
|
|
25
|
+
exports.exampleConditionTypeOfIsInteger = (0, create_typeof_conditions_1.createTypeOfConditions)('address.city.total', generic_1.ConditionTypeOf.INTEGER, generic_1.ConditionTypeQualifier.IS);
|
|
26
|
+
exports.exampleConditionTypeOfIsNotInteger = (0, create_typeof_conditions_1.createTypeOfConditions)('address.city.total', generic_1.ConditionTypeOf.INTEGER, generic_1.ConditionTypeQualifier.IS_NOT);
|
|
27
|
+
exports.exampleConditionTypeOfIsArray = (0, create_typeof_conditions_1.createTypeOfConditions)('address.city.total', generic_1.ConditionTypeOf.ARRAY, generic_1.ConditionTypeQualifier.IS);
|
|
28
|
+
exports.exampleConditionTypeOfIsNotArray = (0, create_typeof_conditions_1.createTypeOfConditions)('address.city.total', generic_1.ConditionTypeOf.ARRAY, generic_1.ConditionTypeQualifier.IS_NOT);
|
|
29
|
+
exports.exampleConditionTypeOfIsNull = (0, create_typeof_conditions_1.createTypeOfConditions)('address.city.total', generic_1.ConditionTypeOf.NULL, generic_1.ConditionTypeQualifier.IS);
|
|
30
|
+
exports.exampleConditionTypeOfIsNotNull = (0, create_typeof_conditions_1.createTypeOfConditions)('address.city.total', generic_1.ConditionTypeOf.NULL, generic_1.ConditionTypeQualifier.IS_NOT);
|
|
31
|
+
exports.exampleConditionTypeOfIsUndefined = (0, create_typeof_conditions_1.createTypeOfConditions)('address.city.total', generic_1.ConditionTypeOf.UNDEFINED, generic_1.ConditionTypeQualifier.IS);
|
|
32
|
+
exports.exampleConditionTypeOfIsNotUndefined = (0, create_typeof_conditions_1.createTypeOfConditions)('address.city.total', generic_1.ConditionTypeOf.UNDEFINED, generic_1.ConditionTypeQualifier.IS_NOT);
|
|
33
|
+
exports.exampleConditionTypeOfIsFunction = (0, create_typeof_conditions_1.createTypeOfConditions)('address.function', generic_1.ConditionTypeOf.FUNCTION, generic_1.ConditionTypeQualifier.IS);
|
|
34
|
+
exports.exampleConditionTypeOfIsNotFunction = (0, create_typeof_conditions_1.createTypeOfConditions)('address.function', generic_1.ConditionTypeOf.FUNCTION, generic_1.ConditionTypeQualifier.IS_NOT);
|
|
35
|
+
exports.exampleConditionTypeOfIsBigInt = (0, create_typeof_conditions_1.createTypeOfConditions)('address.city.total', generic_1.ConditionTypeOf.BIGINT, generic_1.ConditionTypeQualifier.IS);
|
|
36
|
+
exports.exampleConditionTypeOfIsNotBigInt = (0, create_typeof_conditions_1.createTypeOfConditions)('address.city.total', generic_1.ConditionTypeOf.BIGINT, generic_1.ConditionTypeQualifier.IS_NOT);
|
|
37
|
+
//#endregion condition TYPEOF
|
|
38
|
+
//#region condition EQUALITY
|
|
39
|
+
exports.exampleConditionEqualityIs100 = (0, create_equality_conditions_1.createEqualityConditions)('address.city.total', 100, generic_1.ConditionTypeQualifier.IS);
|
|
40
|
+
exports.exampleConditionEqualityIsNotNewYork = (0, create_equality_conditions_1.createEqualityConditions)('address.city.name', 'New York', generic_1.ConditionTypeQualifier.IS_NOT);
|
|
41
|
+
exports.exampleConditionEqualityIs200 = (0, create_equality_conditions_1.createEqualityConditions)('user.age', 200, generic_1.ConditionTypeQualifier.IS);
|
|
42
|
+
exports.exampleConditionEqualityIsNotAdmin = (0, create_equality_conditions_1.createEqualityConditions)('user.role', 'admin', generic_1.ConditionTypeQualifier.IS_NOT);
|
|
43
|
+
//#endregion condition EQUALITY
|
|
44
|
+
//#region condition RANGE
|
|
45
|
+
exports.exampleConditionRangeIsGreaterThan100 = (0, create_range_conditions_1.createRangeConditions)('address.city.total', generic_1.ConditionTypeRange.GREATER_THAN, 100, generic_1.ConditionTypeQualifier.IS);
|
|
46
|
+
exports.exampleConditionRangeIsNotGreaterThan100 = (0, create_range_conditions_1.createRangeConditions)('address.city.total', generic_1.ConditionTypeRange.GREATER_THAN, 100, generic_1.ConditionTypeQualifier.IS_NOT);
|
|
47
|
+
exports.exampleConditionRangeIsLessThan200 = (0, create_range_conditions_1.createRangeConditions)('address.city.total', generic_1.ConditionTypeRange.LESS_THAN, 200, generic_1.ConditionTypeQualifier.IS);
|
|
48
|
+
exports.exampleConditionRangeIsNotLessThan200 = (0, create_range_conditions_1.createRangeConditions)('address.city.total', generic_1.ConditionTypeRange.LESS_THAN, 200, generic_1.ConditionTypeQualifier.IS_NOT);
|
|
49
|
+
exports.exampleConditionRangeIsGreaterThanOrEqual100 = (0, create_range_conditions_1.createRangeConditions)('address.city.total', generic_1.ConditionTypeRange.GREATER_THAN_OR_EQUAL, 100, generic_1.ConditionTypeQualifier.IS);
|
|
50
|
+
exports.exampleConditionRangeIsNotGreaterThanOrEqual100 = (0, create_range_conditions_1.createRangeConditions)('address.city.total', generic_1.ConditionTypeRange.GREATER_THAN_OR_EQUAL, 100, generic_1.ConditionTypeQualifier.IS_NOT);
|
|
51
|
+
exports.exampleConditionRangeIsLessThanOrEqual200 = (0, create_range_conditions_1.createRangeConditions)('address.city.total', generic_1.ConditionTypeRange.LESS_THAN_OR_EQUAL, 200, generic_1.ConditionTypeQualifier.IS);
|
|
52
|
+
exports.exampleConditionRangeIsNotLessThanOrEqual200 = (0, create_range_conditions_1.createRangeConditions)('address.city.total', generic_1.ConditionTypeRange.LESS_THAN_OR_EQUAL, 200, generic_1.ConditionTypeQualifier.IS_NOT);
|
|
53
|
+
exports.exampleConditionRangeIsGreaterThanH = (0, create_range_conditions_1.createRangeConditions)('address.city.total', generic_1.ConditionTypeRange.GREATER_THAN, 'h', generic_1.ConditionTypeQualifier.IS);
|
|
54
|
+
exports.exampleConditionRangeIsNotGreaterThanH = (0, create_range_conditions_1.createRangeConditions)('address.city.total', generic_1.ConditionTypeRange.GREATER_THAN, 'h', generic_1.ConditionTypeQualifier.IS_NOT);
|
|
55
|
+
exports.exampleConditionRangeIsLessThanY = (0, create_range_conditions_1.createRangeConditions)('address.city.total', generic_1.ConditionTypeRange.LESS_THAN, 'y', generic_1.ConditionTypeQualifier.IS);
|
|
56
|
+
exports.exampleConditionRangeIsNotLessThanY = (0, create_range_conditions_1.createRangeConditions)('address.city.total', generic_1.ConditionTypeRange.LESS_THAN, 'y', generic_1.ConditionTypeQualifier.IS_NOT);
|
|
57
|
+
exports.exampleConditionRangeIsGreaterThanOrEqualH = (0, create_range_conditions_1.createRangeConditions)('address.city.total', generic_1.ConditionTypeRange.GREATER_THAN_OR_EQUAL, 'h', generic_1.ConditionTypeQualifier.IS);
|
|
58
|
+
exports.exampleConditionRangeIsNotGreaterThanOrEqualH = (0, create_range_conditions_1.createRangeConditions)('address.city.total', generic_1.ConditionTypeRange.GREATER_THAN_OR_EQUAL, 'h', generic_1.ConditionTypeQualifier.IS_NOT);
|
|
59
|
+
exports.exampleConditionRangeIsLessThanOrEqualY = (0, create_range_conditions_1.createRangeConditions)('address.city.total', generic_1.ConditionTypeRange.LESS_THAN_OR_EQUAL, 'y', generic_1.ConditionTypeQualifier.IS);
|
|
60
|
+
exports.exampleConditionRangeIsNotLessThanOrEqualY = (0, create_range_conditions_1.createRangeConditions)('address.city.total', generic_1.ConditionTypeRange.LESS_THAN_OR_EQUAL, 'y', generic_1.ConditionTypeQualifier.IS_NOT);
|
|
61
|
+
//#endregion condition RANGE
|
|
62
|
+
//#region condition CONTAINS
|
|
63
|
+
exports.exampleConditionContainsIsGar = (0, create_contains_conditions_1.createContainsConditions)('address.city.name', 'gar', generic_1.ConditionTypeQualifier.IS);
|
|
64
|
+
exports.exampleConditionContainsIsNotGarison = (0, create_contains_conditions_1.createContainsConditions)('address.city.name', 'gar', generic_1.ConditionTypeQualifier.IS_NOT);
|
|
65
|
+
exports.exampleConditionContainsIsGarCarHap = (0, create_contains_conditions_1.createContainsConditions)('address.city.name', ['gar', 'car', 'hap'], generic_1.ConditionTypeQualifier.IS);
|
|
66
|
+
exports.exampleConditionContainsIsNotGarCarHap = (0, create_contains_conditions_1.createContainsConditions)('address.city.name', ['gar', 'car', 'hap'], generic_1.ConditionTypeQualifier.IS_NOT);
|
|
67
|
+
exports.exampleConditionContainsIs1135 = (0, create_contains_conditions_1.createContainsConditions)('address.city.number', [1, 13, 5], generic_1.ConditionTypeQualifier.IS);
|
|
68
|
+
exports.exampleConditionContainsIsNot1135 = (0, create_contains_conditions_1.createContainsConditions)('address.city.number', [1, 13, 5], generic_1.ConditionTypeQualifier.IS_NOT);
|
|
69
|
+
//#endregion condition CONTAINS
|
|
70
|
+
//#region condition STARTS_WITH / ENDS_WITH
|
|
71
|
+
exports.exampleConditionStartsWithIsCal = (0, create_starts_end_with_conditions_1.createStartsEndsWithConditions)('address.city.name', generic_1.ConditionTypeStartsEndsWith.STARTS_WITH, 'cal', generic_1.ConditionTypeQualifier.IS);
|
|
72
|
+
exports.exampleConditionStartsWithIsNotCal = (0, create_starts_end_with_conditions_1.createStartsEndsWithConditions)('address.city.name', generic_1.ConditionTypeStartsEndsWith.STARTS_WITH, 'cal', generic_1.ConditionTypeQualifier.IS_NOT);
|
|
73
|
+
exports.exampleConditionEndsWithIsGary = (0, create_starts_end_with_conditions_1.createStartsEndsWithConditions)('address.city.name', generic_1.ConditionTypeStartsEndsWith.ENDS_WITH, 'gary', generic_1.ConditionTypeQualifier.IS);
|
|
74
|
+
exports.exampleConditionEndsWithIsNotGary = (0, create_starts_end_with_conditions_1.createStartsEndsWithConditions)('address.city.name', generic_1.ConditionTypeStartsEndsWith.ENDS_WITH, 'gary', generic_1.ConditionTypeQualifier.IS_NOT);
|
|
75
|
+
//#endregion condition STARTS_WITH / ENDS_WITH
|
|
76
|
+
//#region condition NULL
|
|
77
|
+
exports.exampleConditionIsNull = (0, create_null_conditions_1.createNullConditions)('address.city.name', generic_1.ConditionTypeQualifier.IS);
|
|
78
|
+
exports.exampleConditionIsNotNull = (0, create_null_conditions_1.createNullConditions)('address.city.name', generic_1.ConditionTypeQualifier.IS_NOT);
|
|
79
|
+
//#endregion condition NULL
|
|
80
|
+
//#region condition BOOLEAN
|
|
81
|
+
exports.exampleConditionBooleanIsTrue = (0, create_boolean_conditions_1.createBooleanConditions)('address.isActive', generic_1.ConditionTypeBoolean.TRUE, generic_1.ConditionTypeQualifier.IS);
|
|
82
|
+
exports.exampleConditionBooleanIsNotTrue = (0, create_boolean_conditions_1.createBooleanConditions)('address.isActive', generic_1.ConditionTypeBoolean.TRUE, generic_1.ConditionTypeQualifier.IS_NOT);
|
|
83
|
+
exports.exampleConditionBooleanIsFalse = (0, create_boolean_conditions_1.createBooleanConditions)('address.isActive', generic_1.ConditionTypeBoolean.FALSE, generic_1.ConditionTypeQualifier.IS);
|
|
84
|
+
exports.exampleConditionBooleanIsNotFalse = (0, create_boolean_conditions_1.createBooleanConditions)('address.isActive', generic_1.ConditionTypeBoolean.FALSE, generic_1.ConditionTypeQualifier.IS_NOT);
|
|
85
|
+
//#endregion condition BOOLEAN
|
|
86
|
+
//#region condition EMPTY
|
|
87
|
+
exports.exampleConditionIsEmpty = (0, create_empty_conditions_1.createEmptyConditions)('address.street2', generic_1.ConditionTypeQualifier.IS);
|
|
88
|
+
exports.exampleConditionIsNotEmpty = (0, create_empty_conditions_1.createEmptyConditions)('address.street2', generic_1.ConditionTypeQualifier.IS_NOT);
|
|
89
|
+
//#endregion condition EMPTY
|
|
90
|
+
//#region condition SPECIAL
|
|
91
|
+
exports.exampleConditionSpecialIsPattern = (0, create_special_conditions_1.createSpecialConditions)('address.city.name', generic_1.ConditionTypeSpecial.PATTERN, '^[a-zA-Z0-9]*$', generic_1.ConditionTypeQualifier.IS);
|
|
92
|
+
exports.exampleConditionSpecialIsNotPattern = (0, create_special_conditions_1.createSpecialConditions)('address.city.name', generic_1.ConditionTypeSpecial.PATTERN, '^[a-zA-Z0-9]*$', generic_1.ConditionTypeQualifier.IS_NOT);
|
|
93
|
+
//#endregion condition SPECIAL
|
|
94
|
+
//#region condition SHARE_RULE
|
|
95
|
+
exports.nestedShareRule = {
|
|
96
|
+
ruleId: 'nestedRule',
|
|
97
|
+
currentDataConditions: [
|
|
98
|
+
{
|
|
99
|
+
targettedProperty: 'nestedProperty',
|
|
100
|
+
conditionType: generic_1.ConditionTypeSingle.EQUAL,
|
|
101
|
+
conditionValue: 'expectedValue',
|
|
102
|
+
conditionTypeQualifier: generic_1.ConditionTypeQualifier.IS,
|
|
103
|
+
},
|
|
104
|
+
],
|
|
105
|
+
proposedDataConditions: [
|
|
106
|
+
{
|
|
107
|
+
targettedProperty: 'nestedProperty',
|
|
108
|
+
conditionType: generic_1.ConditionTypeSingle.EQUAL,
|
|
109
|
+
conditionValue: 'newValue',
|
|
110
|
+
conditionTypeQualifier: generic_1.ConditionTypeQualifier.IS,
|
|
111
|
+
},
|
|
112
|
+
],
|
|
113
|
+
};
|
|
114
|
+
exports.exampleConditionIsShareRule = (0, create_share_rule_conditions_1.createShareRuleConditions)('parentProperty', exports.nestedShareRule);
|
|
115
|
+
exports.exampleConditionIsNotShareRule = (0, create_share_rule_conditions_1.createShareRuleConditions)('parentProperty', exports.nestedShareRule, generic_1.ConditionTypeQualifier.IS_NOT);
|
|
116
|
+
//#endregion condition SHARE_RULE
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rules.test-data.d.ts","sourceRoot":"","sources":["../../../src/__testdata__/rules/rules.test-data.ts"],"names":[],"mappings":"AAAA,OAAO,EAMH,UAAU,EACV,iBAAiB,EACjB,eAAe,EACf,aAAa,EAEhB,MAAM,qBAAqB,CAAC;AAK7B,eAAO,MAAM,oBAAoB,EAAE,UASlC,CAAA;AACD,eAAO,MAAM,gBAAgB,EAAE,iBAU9B,CAAC;AAEF,eAAO,MAAM,wBAAwB,EAAE,iBAStC,CAAA;AAED,eAAO,MAAM,0BAA0B,EAAE,iBAWxC,CAAC;AAEF,eAAO,MAAM,gBAAgB,EAAE,iBAW9B,CAAC;AAEF,eAAO,MAAM,2BAA2B,EAAE,iBAazC,CAAC;AAEF,eAAO,MAAM,gBAAgB,EAAE,iBAU9B,CAAC;AAmBF,eAAO,MAAM,mBAAmB,EAAE,eAGjC,CAAA;AAED,eAAO,MAAM,uBAAuB,EAAE,eAGrC,CAAA;AAED,eAAO,MAAM,uBAAuB,EAAE,eAGrC,CAAA;
|
|
1
|
+
{"version":3,"file":"rules.test-data.d.ts","sourceRoot":"","sources":["../../../src/__testdata__/rules/rules.test-data.ts"],"names":[],"mappings":"AAAA,OAAO,EAMH,UAAU,EACV,iBAAiB,EACjB,eAAe,EACf,aAAa,EAEhB,MAAM,qBAAqB,CAAC;AAK7B,eAAO,MAAM,oBAA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
+
* This function creates a share rule condition for the sharedata rules engine.
|
|
4
|
+
*
|
|
5
|
+
* @param targettedProperty the property to check
|
|
6
|
+
* @param conditionValue the value to check against
|
|
7
|
+
* @param conditionTypeQualifier the condition type qualifier
|
|
8
|
+
* @returns
|
|
9
|
+
*/
|
|
10
|
+
declare const createShareRuleConditions: (targettedProperty: string, conditionValue: IShareRule, conditionTypeQualifier?: ConditionTypeQualifier) => IConditionShareRule;
|
|
11
|
+
export { createShareRuleConditions };
|
|
12
|
+
//# sourceMappingURL=create-share-rule-conditions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-share-rule-conditions.d.ts","sourceRoot":"","sources":["../../../src/create/conditions/create-share-rule-conditions.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,sBAAsB,EAEtB,mBAAmB,EACnB,UAAU,EACb,MAAM,qBAAqB,CAAC;AAE7B;;;;;;;GAOG;AACH,QAAA,MAAM,yBAAyB,sBACR,MAAM,kBACT,UAAU,2BACF,sBAAsB,KAC/C,mBAOF,CAAC;AAEF,OAAO,EAAE,yBAAyB,EAAE,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createShareRuleConditions = void 0;
|
|
4
|
+
const generic_1 = require("@degenerate/generic");
|
|
5
|
+
/**
|
|
6
|
+
* This function creates a share rule condition for the sharedata rules engine.
|
|
7
|
+
*
|
|
8
|
+
* @param targettedProperty the property to check
|
|
9
|
+
* @param conditionValue the value to check against
|
|
10
|
+
* @param conditionTypeQualifier the condition type qualifier
|
|
11
|
+
* @returns
|
|
12
|
+
*/
|
|
13
|
+
const createShareRuleConditions = (targettedProperty, conditionValue, conditionTypeQualifier = generic_1.ConditionTypeQualifier.IS) => {
|
|
14
|
+
return {
|
|
15
|
+
targettedProperty,
|
|
16
|
+
conditionType: generic_1.ConditionTypeSingle.SHARE_RULE,
|
|
17
|
+
conditionValue,
|
|
18
|
+
conditionTypeQualifier,
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
exports.createShareRuleConditions = createShareRuleConditions;
|
|
@@ -7,6 +7,6 @@ import { ConditionTypeOf, IConditionTypeOf, ConditionTypeQualifier } from '@dege
|
|
|
7
7
|
* @param conditionValue the value to check against
|
|
8
8
|
* @returns
|
|
9
9
|
*/
|
|
10
|
-
declare const
|
|
11
|
-
export {
|
|
10
|
+
declare const createTypeOfConditions: (targettedProperty: string, conditionValue: ConditionTypeOf, conditionTypeQualifier?: ConditionTypeQualifier) => IConditionTypeOf;
|
|
11
|
+
export { createTypeOfConditions };
|
|
12
12
|
//# sourceMappingURL=create-typeof-conditions.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-typeof-conditions.d.ts","sourceRoot":"","sources":["../../../src/create/conditions/create-typeof-conditions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAuB,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAErH;;;;;;;GAOG;AACH,QAAA,MAAM,
|
|
1
|
+
{"version":3,"file":"create-typeof-conditions.d.ts","sourceRoot":"","sources":["../../../src/create/conditions/create-typeof-conditions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAuB,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAErH;;;;;;;GAOG;AACH,QAAA,MAAM,sBAAsB,sBACL,MAAM,kBACT,eAAe,2BACP,sBAAsB,KAC/C,gBAOF,CAAA;AAED,OAAO,EAAE,sBAAsB,EAAE,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.createTypeOfConditions = void 0;
|
|
4
4
|
const generic_1 = require("@degenerate/generic");
|
|
5
5
|
/**
|
|
6
6
|
* This function creates a typeof condition for the sharedata rules engine.
|
|
@@ -10,7 +10,7 @@ const generic_1 = require("@degenerate/generic");
|
|
|
10
10
|
* @param conditionValue the value to check against
|
|
11
11
|
* @returns
|
|
12
12
|
*/
|
|
13
|
-
const
|
|
13
|
+
const createTypeOfConditions = (targettedProperty, conditionValue, conditionTypeQualifier = generic_1.ConditionTypeQualifier.IS) => {
|
|
14
14
|
return {
|
|
15
15
|
targettedProperty,
|
|
16
16
|
conditionType: generic_1.ConditionTypeSingle.TYPEOF,
|
|
@@ -18,4 +18,4 @@ const createConditionTypeOf = (targettedProperty, conditionValue, conditionTypeQ
|
|
|
18
18
|
conditionTypeQualifier,
|
|
19
19
|
};
|
|
20
20
|
};
|
|
21
|
-
exports.
|
|
21
|
+
exports.createTypeOfConditions = createTypeOfConditions;
|
package/dist/create/index.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ export * from './conditions/create-empty-conditions';
|
|
|
4
4
|
export * from './conditions/create-equality-conditions';
|
|
5
5
|
export * from './conditions/create-null-conditions';
|
|
6
6
|
export * from './conditions/create-range-conditions';
|
|
7
|
+
export * from './conditions/create-share-rule-conditions';
|
|
7
8
|
export * from './conditions/create-special-conditions';
|
|
8
9
|
export * from './conditions/create-starts-end-with-conditions';
|
|
9
10
|
export * from './conditions/create-typeof-conditions';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/create/index.ts"],"names":[],"mappings":"AAEA,cAAc,wCAAwC,CAAC;AACvD,cAAc,yCAAyC,CAAC;AACxD,cAAc,sCAAsC,CAAC;AACrD,cAAc,yCAAyC,CAAC;AACxD,cAAc,qCAAqC,CAAC;AACpD,cAAc,sCAAsC,CAAC;AACrD,cAAc,wCAAwC,CAAC;AACvD,cAAc,gDAAgD,CAAC;AAC/D,cAAc,uCAAuC,CAAC;AAItD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,wBAAwB,CAAC;AACvC,cAAc,yBAAyB,CAAC;AACxC,cAAc,qBAAqB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/create/index.ts"],"names":[],"mappings":"AAEA,cAAc,wCAAwC,CAAC;AACvD,cAAc,yCAAyC,CAAC;AACxD,cAAc,sCAAsC,CAAC;AACrD,cAAc,yCAAyC,CAAC;AACxD,cAAc,qCAAqC,CAAC;AACpD,cAAc,sCAAsC,CAAC;AACrD,cAAc,2CAA2C,CAAC;AAC1D,cAAc,wCAAwC,CAAC;AACvD,cAAc,gDAAgD,CAAC;AAC/D,cAAc,uCAAuC,CAAC;AAItD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,wBAAwB,CAAC;AACvC,cAAc,yBAAyB,CAAC;AACxC,cAAc,qBAAqB,CAAC"}
|
package/dist/create/index.js
CHANGED
|
@@ -21,6 +21,7 @@ __exportStar(require("./conditions/create-empty-conditions"), exports);
|
|
|
21
21
|
__exportStar(require("./conditions/create-equality-conditions"), exports);
|
|
22
22
|
__exportStar(require("./conditions/create-null-conditions"), exports);
|
|
23
23
|
__exportStar(require("./conditions/create-range-conditions"), exports);
|
|
24
|
+
__exportStar(require("./conditions/create-share-rule-conditions"), exports);
|
|
24
25
|
__exportStar(require("./conditions/create-special-conditions"), exports);
|
|
25
26
|
__exportStar(require("./conditions/create-starts-end-with-conditions"), exports);
|
|
26
27
|
__exportStar(require("./conditions/create-typeof-conditions"), exports);
|
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.1.
|
|
4
|
+
"version": "0.1.10",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
7
|
"devDependencies": {
|
|
@@ -35,8 +35,8 @@
|
|
|
35
35
|
"homepage": "https://github.com/syncrude/safe#readme",
|
|
36
36
|
"author": "Degenerate Inc.",
|
|
37
37
|
"license": "ISC",
|
|
38
|
-
"gitHead": "
|
|
38
|
+
"gitHead": "2c7096896ce9690807a9b492c6fbd20dbed47b0b",
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@degenerate/generic": "^0.1.
|
|
40
|
+
"@degenerate/generic": "^0.1.10"
|
|
41
41
|
}
|
|
42
42
|
}
|