@@ -30,6 +30,7 @@ export function evaluateFeature(
3030 splitName : string ,
3131 attributes : SplitIO . Attributes | undefined ,
3232 storage : IStorageSync | IStorageAsync ,
33+ options ?: SplitIO . EvaluationOptions
3334) : MaybeThenable < IEvaluationResult > {
3435 let parsedSplit ;
3536
@@ -47,6 +48,7 @@ export function evaluateFeature(
4748 split ,
4849 attributes ,
4950 storage ,
51+ options ,
5052 ) ) . catch (
5153 // Exception on async `getSplit` storage. For example, when the storage is redis or
5254 // pluggable and there is a connection issue and we can't retrieve the split to be evaluated
@@ -60,6 +62,7 @@ export function evaluateFeature(
6062 parsedSplit ,
6163 attributes ,
6264 storage ,
65+ options ,
6366 ) ;
6467}
6568
@@ -69,6 +72,7 @@ export function evaluateFeatures(
6972 splitNames : string [ ] ,
7073 attributes : SplitIO . Attributes | undefined ,
7174 storage : IStorageSync | IStorageAsync ,
75+ options ?: SplitIO . EvaluationOptions ,
7276) : MaybeThenable < Record < string , IEvaluationResult > > {
7377 let parsedSplits ;
7478
@@ -80,13 +84,13 @@ export function evaluateFeatures(
8084 }
8185
8286 return thenable ( parsedSplits ) ?
83- parsedSplits . then ( splits => getEvaluations ( log , key , splitNames , splits , attributes , storage ) )
87+ parsedSplits . then ( splits => getEvaluations ( log , key , splitNames , splits , attributes , storage , options ) )
8488 . catch ( ( ) => {
8589 // Exception on async `getSplits` storage. For example, when the storage is redis or
8690 // pluggable and there is a connection issue and we can't retrieve the split to be evaluated
8791 return treatmentsException ( splitNames ) ;
8892 } ) :
89- getEvaluations ( log , key , splitNames , parsedSplits , attributes , storage ) ;
93+ getEvaluations ( log , key , splitNames , parsedSplits , attributes , storage , options ) ;
9094}
9195
9296export function evaluateFeaturesByFlagSets (
@@ -96,6 +100,7 @@ export function evaluateFeaturesByFlagSets(
96100 attributes : SplitIO . Attributes | undefined ,
97101 storage : IStorageSync | IStorageAsync ,
98102 method : string ,
103+ options ?: SplitIO . EvaluationOptions ,
99104) : MaybeThenable < Record < string , IEvaluationResult > > {
100105 let storedFlagNames : MaybeThenable < Set < string > [ ] > ;
101106
@@ -111,7 +116,7 @@ export function evaluateFeaturesByFlagSets(
111116 }
112117
113118 return featureFlags . size ?
114- evaluateFeatures ( log , key , setToArray ( featureFlags ) , attributes , storage ) :
119+ evaluateFeatures ( log , key , setToArray ( featureFlags ) , attributes , storage , options ) :
115120 { } ;
116121 }
117122
@@ -138,6 +143,7 @@ function getEvaluation(
138143 splitJSON : ISplit | null ,
139144 attributes : SplitIO . Attributes | undefined ,
140145 storage : IStorageSync | IStorageAsync ,
146+ options ?: SplitIO . EvaluationOptions ,
141147) : MaybeThenable < IEvaluationResult > {
142148 let evaluation : MaybeThenable < IEvaluationResult > = {
143149 treatment : CONTROL ,
@@ -154,14 +160,14 @@ function getEvaluation(
154160 return evaluation . then ( result => {
155161 result . changeNumber = splitJSON . changeNumber ;
156162 result . config = splitJSON . configurations && splitJSON . configurations [ result . treatment ] || null ;
157- result . impressionsDisabled = splitJSON . impressionsDisabled ;
163+ result . impressionsDisabled = options ?. impressionsDisabled || splitJSON . impressionsDisabled ;
158164
159165 return result ;
160166 } ) ;
161167 } else {
162168 evaluation . changeNumber = splitJSON . changeNumber ;
163169 evaluation . config = splitJSON . configurations && splitJSON . configurations [ evaluation . treatment ] || null ;
164- evaluation . impressionsDisabled = splitJSON . impressionsDisabled ;
170+ evaluation . impressionsDisabled = options ?. impressionsDisabled || splitJSON . impressionsDisabled ;
165171 }
166172 }
167173
@@ -175,6 +181,7 @@ function getEvaluations(
175181 splits : Record < string , ISplit | null > ,
176182 attributes : SplitIO . Attributes | undefined ,
177183 storage : IStorageSync | IStorageAsync ,
184+ options ?: SplitIO . EvaluationOptions ,
178185) : MaybeThenable < Record < string , IEvaluationResult > > {
179186 const result : Record < string , IEvaluationResult > = { } ;
180187 const thenables : Promise < void > [ ] = [ ] ;
@@ -184,7 +191,8 @@ function getEvaluations(
184191 key ,
185192 splits [ splitName ] ,
186193 attributes ,
187- storage
194+ storage ,
195+ options
188196 ) ;
189197 if ( thenable ( evaluation ) ) {
190198 thenables . push ( evaluation . then ( res => {
0 commit comments