@@ -78,7 +78,7 @@ type BulkEvent =
7878 }
7979 | {
8080 type : "feature-flag-event" ;
81- action : "check" | "evaluate" | " check-config" | "evaluate -config";
81+ action : "check" | "check-config" ;
8282 key : string ;
8383 targetingVersion ?: number ;
8484 evalResult :
@@ -126,7 +126,6 @@ export class ReflagClient {
126126 fallbackFlags ?: Record < TypedFlagKey , RawFlag > ;
127127 flagOverrides : FlagOverridesFn ;
128128 offline : boolean ;
129- emitEvaluationEvents : boolean ;
130129 configFile ?: string ;
131130 flagsFetchRetries : number ;
132131 fetchTimeoutMs : number ;
@@ -302,7 +301,6 @@ export class ReflagClient {
302301
303302 this . _config = {
304303 offline,
305- emitEvaluationEvents : config . emitEvaluationEvents ?? true ,
306304 apiBaseUrl : ( config . apiBaseUrl ?? config . host ) || API_BASE_URL ,
307305 headers : {
308306 "Content-Type" : "application/json" ,
@@ -841,10 +839,7 @@ export class ReflagClient {
841839 ok ( typeof event === "object" , "event must be an object" ) ;
842840 ok (
843841 typeof event . action === "string" &&
844- ( event . action === "evaluate" ||
845- event . action === "evaluate-config" ||
846- event . action === "check" ||
847- event . action === "check-config" ) ,
842+ ( event . action === "check" || event . action === "check-config" ) ,
848843 "event must have an action" ,
849844 ) ;
850845 ok (
@@ -883,13 +878,6 @@ export class ReflagClient {
883878 return ;
884879 }
885880
886- if (
887- ! this . _config . emitEvaluationEvents &&
888- ( event . action === "evaluate" || event . action === "evaluate-config" )
889- ) {
890- return ;
891- }
892-
893881 if (
894882 ! this . rateLimiter . isAllowed (
895883 hashObject ( {
@@ -1056,7 +1044,7 @@ export class ReflagClient {
10561044 flagDefinitions = flagDefs ;
10571045 }
10581046
1059- const { enableTracking = true , meta : _ , ...context } = options ;
1047+ const { enableTracking : _ , meta : __ , ...context } = options ;
10601048
10611049 const evaluated = flagDefinitions
10621050 . filter ( ( { key : flagKey } ) => ( key ? key === flagKey : true ) )
@@ -1076,55 +1064,6 @@ export class ReflagClient {
10761064 } satisfies EvaluationResult < any > ) ,
10771065 } ) ) ;
10781066
1079- if ( enableTracking ) {
1080- const promises = evaluated
1081- . map ( ( res ) => {
1082- const outPromises : Promise < void > [ ] = [ ] ;
1083- outPromises . push (
1084- this . sendFlagEvent ( {
1085- action : "evaluate" ,
1086- key : res . flagKey ,
1087- targetingVersion : res . targetingVersion ,
1088- evalResult : res . enabledResult . value ?? false ,
1089- evalContext : res . enabledResult . context ,
1090- evalRuleResults : res . enabledResult . ruleEvaluationResults ,
1091- evalMissingFields : res . enabledResult . missingContextFields ,
1092- } ) ,
1093- ) ;
1094-
1095- const config = res . configResult ;
1096- if ( config . value ) {
1097- outPromises . push (
1098- this . sendFlagEvent ( {
1099- action : "evaluate-config" ,
1100- key : res . flagKey ,
1101- targetingVersion : res . configVersion ,
1102- evalResult : config . value ,
1103- evalContext : config . context ,
1104- evalRuleResults : config . ruleEvaluationResults ,
1105- evalMissingFields : config . missingContextFields ,
1106- } ) ,
1107- ) ;
1108- }
1109-
1110- return outPromises ;
1111- } )
1112- . flat ( ) ;
1113-
1114- void Promise . allSettled ( promises ) . then ( ( results ) => {
1115- const failed = results
1116- . map ( ( result ) =>
1117- result . status === "rejected" ? result . reason : undefined ,
1118- )
1119- . filter ( Boolean ) ;
1120- if ( failed . length > 0 ) {
1121- this . logger . error ( `failed to queue some evaluate events.` , {
1122- errors : failed ,
1123- } ) ;
1124- }
1125- } ) ;
1126- }
1127-
11281067 let evaluatedFlags = evaluated . reduce (
11291068 ( acc , res ) => {
11301069 acc [ res . flagKey as TypedFlagKey ] = {
0 commit comments