@@ -159,7 +159,7 @@ export type RuleResultSerializable = Pick<
159
159
160
160
export interface RuleResult {
161
161
name : string ;
162
- conditions : TopLevelCondition ;
162
+ conditions : TopLevelConditionResult ;
163
163
event ?: Event ;
164
164
priority ?: number ;
165
165
result : any ;
@@ -184,6 +184,14 @@ export class Rule implements RuleProperties {
184
184
) : T extends true ? string : RuleSerializable ;
185
185
}
186
186
187
+ interface BooleanConditionResultProperties {
188
+ result : boolean
189
+ }
190
+
191
+ interface ConditionResultProperties extends BooleanConditionResultProperties {
192
+ factResult : any
193
+ }
194
+
187
195
interface ConditionProperties {
188
196
fact : string ;
189
197
operator : string ;
@@ -194,25 +202,41 @@ interface ConditionProperties {
194
202
name ?: string ;
195
203
}
196
204
205
+ type ConditionPropertiesResult = ConditionProperties & ConditionResultProperties
206
+
197
207
type NestedCondition = ConditionProperties | TopLevelCondition ;
208
+ type NestedConditionResult = ConditionPropertiesResult | TopLevelConditionResult ;
198
209
type AllConditions = {
199
210
all : NestedCondition [ ] ;
200
211
name ?: string ;
201
212
priority ?: number ;
202
213
} ;
214
+ type AllConditionsResult = AllConditions & {
215
+ all : NestedConditionResult [ ]
216
+ } & BooleanConditionResultProperties
203
217
type AnyConditions = {
204
218
any : NestedCondition [ ] ;
205
219
name ?: string ;
206
220
priority ?: number ;
207
221
} ;
222
+ type AnyConditionsResult = AnyConditions & {
223
+ any : NestedConditionResult [ ]
224
+ } & BooleanConditionResultProperties
208
225
type NotConditions = { not : NestedCondition ; name ?: string ; priority ?: number } ;
226
+ type NotConditionsResult = NotConditions & { not : NestedConditionResult } & BooleanConditionResultProperties ;
209
227
type ConditionReference = {
210
228
condition : string ;
211
229
name ?: string ;
212
230
priority ?: number ;
213
231
} ;
232
+ type ConditionReferenceResult = ConditionReference & ConditionResultProperties ;
214
233
export type TopLevelCondition =
215
234
| AllConditions
216
235
| AnyConditions
217
236
| NotConditions
218
237
| ConditionReference ;
238
+ export type TopLevelConditionResult =
239
+ | AllConditionsResult
240
+ | AnyConditionsResult
241
+ | NotConditionsResult
242
+ | ConditionReferenceResult
0 commit comments