-
Notifications
You must be signed in to change notification settings - Fork 2
Offline Init Part 2 of 4: Add getBanditsConfiguration() to export bandit models as JSON #117
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: aarsilv/ffesupport-461-offline-init-part1-get-flags-configuration
Are you sure you want to change the base?
Changes from all commits
00ab1ec
41441ba
128bac6
1eb8a4e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,7 +6,7 @@ env: | |
|
|
||
| on: | ||
| pull_request: | ||
| branches: [ "*" ] | ||
| branches: [ "**" ] | ||
| workflow_dispatch: | ||
| workflow_call: | ||
| inputs: | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -253,6 +253,35 @@ function reconstructBanditReferences(): Record< | |
| return banditReferences; | ||
| } | ||
|
|
||
| /** | ||
| * Returns the current bandits configuration as a JSON string. | ||
| * This can be used together with getFlagsConfiguration() to bootstrap | ||
| * another SDK instance using offlineInit(). | ||
| * | ||
| * @returns JSON string containing the bandits configuration, or null if not initialized or no bandits | ||
| * @public | ||
| */ | ||
| export function getBanditsConfiguration(): string | null { | ||
| if (!banditModelConfigurationStore) { | ||
| return null; | ||
| } | ||
|
Comment on lines
+264
to
+267
|
||
|
|
||
| const bandits = banditModelConfigurationStore.entries(); | ||
|
|
||
| // Return null if there are no bandits | ||
| if (Object.keys(bandits).length === 0) { | ||
| return null; | ||
| } | ||
|
|
||
| const configuration: { | ||
| bandits: Record<string, BanditParameters>; | ||
| } = { | ||
| bandits, | ||
| }; | ||
|
Comment on lines
+276
to
+280
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is simpler than the original flag configuration because we basically store bandit configurations (model parameters) as-is |
||
|
|
||
| return JSON.stringify(configuration); | ||
| } | ||
|
|
||
| function newEventDispatcher( | ||
| sdkKey: string, | ||
| config: IClientConfig['eventTracking'] = {}, | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
still apply if merging into branches with slashes in their name