@@ -60,6 +60,8 @@ import {
6060
6161const bucketConfigDefaultFile = "bucketConfig.json" ;
6262
63+ type PartialBy < T , K extends keyof T > = Omit < T , K > & Partial < Pick < T , K > > ;
64+
6365type BulkEvent =
6466 | {
6567 type : "company" ;
@@ -1045,7 +1047,7 @@ export class BucketClient {
10451047 if ( key ) {
10461048 return this . _wrapRawFeature (
10471049 { ...options , enableChecks : true } ,
1048- { key, isEnabled : false , ...fallbackFeatures [ key ] } ,
1050+ { key, ...fallbackFeatures [ key ] } ,
10491051 ) ;
10501052 }
10511053 return Object . fromEntries (
@@ -1177,11 +1179,7 @@ export class BucketClient {
11771179 if ( key ) {
11781180 return this . _wrapRawFeature (
11791181 { ...options , enableChecks : true } ,
1180- {
1181- key,
1182- isEnabled : false ,
1183- ...evaluatedFeatures [ key ] ,
1184- } ,
1182+ { key, ...evaluatedFeatures [ key ] } ,
11851183 ) ;
11861184 }
11871185
@@ -1199,7 +1197,7 @@ export class BucketClient {
11991197 enableChecks = false ,
12001198 ...context
12011199 } : { enableTracking : boolean ; enableChecks ?: boolean } & Context ,
1202- { config, ...feature } : RawFeature ,
1200+ { config, ...feature } : PartialBy < RawFeature , "isEnabled" > ,
12031201 ) : TypedFeatures [ TKey ] {
12041202 // eslint-disable-next-line @typescript-eslint/no-this-alias
12051203 const client = this ;
@@ -1218,7 +1216,7 @@ export class BucketClient {
12181216 action : "check" ,
12191217 key : feature . key ,
12201218 targetingVersion : feature . targetingVersion ,
1221- evalResult : feature . isEnabled ,
1219+ evalResult : feature . isEnabled ?? false ,
12221220 evalContext : context ,
12231221 evalRuleResults : feature . ruleEvaluationResults ,
12241222 evalMissingFields : feature . missingContextFields ,
@@ -1230,7 +1228,7 @@ export class BucketClient {
12301228 ) ;
12311229 } ) ;
12321230 }
1233- return feature . isEnabled ;
1231+ return feature . isEnabled ?? false ;
12341232 } ,
12351233 get config ( ) {
12361234 if ( enableTracking && enableChecks ) {
@@ -1323,11 +1321,7 @@ export class BucketClient {
13231321 if ( ! feature ) {
13241322 this . logger . error ( `feature ${ key } not found` ) ;
13251323 }
1326- return this . _wrapRawFeature ( contextWithTracking , {
1327- key,
1328- isEnabled : false ,
1329- ...feature ,
1330- } ) ;
1324+ return this . _wrapRawFeature ( contextWithTracking , { key, ...feature } ) ;
13311325 } else {
13321326 return res ?. features
13331327 ? Object . fromEntries (
0 commit comments