Skip to content

Commit

Permalink
feat: Add support for client-side prerequisite events (#37)
Browse files Browse the repository at this point in the history
  • Loading branch information
keelerm84 authored Oct 30, 2024
1 parent 563fa04 commit 2d530a7
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
6 changes: 6 additions & 0 deletions rawsrc/LaunchDarklyClient.brs
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,12 @@ function LaunchDarklyClientSharedFunctions(launchDarklyParamSceneGraphNode as Ob

m.private.handleEventsForEval(launchDarklyLocalState)

if launchDarklyLocalFlag.prerequisites <> invalid then
For Each prereqKey in launchDarklyLocalFlag.prerequisites
m.variationDetail(prereqKey, invalid, launchDarklyParamEmbedReason, launchDarklyParamStrong)
End For
end if

launchDarklyLocalDetails = {}
launchDarklyLocalDetails["result"] = launchDarklyLocalValue
launchDarklyLocalDetails["reason"] = launchDarklyLocalReason
Expand Down
5 changes: 4 additions & 1 deletion rawsrc/LaunchDarklyEventProcessor.brs
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,14 @@ function LaunchDarklyEventProcessor(launchDarklyParamConfig as Object, context a
launchdarklyLocalFeature = m.summary.lookup(launchDarklyLocalFeatureKey)

launchDarklyLocalFeatureNode = {
default: launchDarklyLocalFeature.default,
"contextKinds": launchdarklyLocalFeature["contextKinds"].Keys(),
counters: createObject("roArray", 0, true)
}

if launchDarklyLocalFeature.default <> invalid then
launchDarklyLocalFeatureNode.default = launchDarklyLocalFeature.default
end if

for each launchDarklyLocalCounterKey in launchDarklyLocalFeature.counters
launchDarklyLocalCounter = launchDarklyLocalFeature.counters.lookup(launchDarklyLocalCounterKey)

Expand Down
1 change: 1 addition & 0 deletions src/contract-tests/components/HttpServerTask.brs
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,7 @@ function Handler(clients as Object, launchDarklyNode as Object) as Object
"user-type",
"inline-context",
"anonymous-redaction",
"client-prereq-events",
]

return m.makeResponse(200, "OK", status)
Expand Down

0 comments on commit 2d530a7

Please sign in to comment.