Commit 8f8051c
authored
feat: FDv2DataManagerBase for mode switching and data source lifecycle (#1210)
## Summary
- Add `FDv2DataManagerBase` — shared data manager orchestrating FDv2
connection mode switching, state debouncing, and data source lifecycle
- Implements `DataManager` interface with foreground/background mode
support, forced/automatic streaming control, and flush callbacks
- Includes `FlagManager.applyChanges` from #1208 for full/partial/none
flag update semantics
Stacked on #1209 and #1208.
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> **Medium Risk**
> Adds a new shared FDv2 data manager that controls connection-mode
resolution and data source lifecycle, plus updates public `dataSystem`
option shapes; mistakes here could affect SDK initialization,
reconnection behavior, and flag freshness across platforms.
>
> **Overview**
> Introduces `createFDv2DataManagerBase` (and exported types) as a
shared FDv2 orchestration layer that performs mode
resolution/debouncing, manages `FDv2DataSource` creation/teardown across
identifies and mode changes, tracks selector state, triggers a
background flush callback, and optionally appends a blocked FDv1 polling
fallback synchronizer.
>
> Updates the public `dataSystem` configuration model by renaming
`initialConnectionMode` to `foregroundConnectionMode` in platform
defaults and by making `automaticModeSwitching` a discriminated union
(`{type:'automatic'}` vs `{type:'manual', initialConnectionMode}`), with
validator support via `validatorOf(..., { is })`; tests are updated and
expanded accordingly, including a large new test suite for
`FDv2DataManagerBase`.
>
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
0786b64. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
<!-- devin-review-badge-begin -->
---
<a href="https://app.devin.ai/review/launchdarkly/js-core/pull/1210"
target="_blank">
<picture>
<source media="(prefers-color-scheme: dark)"
srcset="https://static.devin.ai/assets/gh-open-in-devin-review-dark.svg?v=1">
<img
src="https://static.devin.ai/assets/gh-open-in-devin-review-light.svg?v=1"
alt="Open with Devin">
</picture>
</a>
<!-- devin-review-badge-end -->1 parent 669cc0c commit 8f8051c
10 files changed
Lines changed: 1784 additions & 124 deletions
File tree
Lines changed: 29 additions & 16 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
187 | 187 | | |
188 | 188 | | |
189 | 189 | | |
190 | | - | |
| 190 | + | |
191 | 191 | | |
192 | 192 | | |
193 | 193 | | |
| |||
203 | 203 | | |
204 | 204 | | |
205 | 205 | | |
206 | | - | |
| 206 | + | |
207 | 207 | | |
208 | 208 | | |
209 | 209 | | |
210 | 210 | | |
211 | 211 | | |
212 | | - | |
213 | 212 | | |
214 | 213 | | |
215 | 214 | | |
216 | 215 | | |
217 | 216 | | |
218 | 217 | | |
219 | | - | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
220 | 223 | | |
221 | 224 | | |
222 | 225 | | |
223 | 226 | | |
224 | | - | |
| 227 | + | |
225 | 228 | | |
226 | 229 | | |
227 | 230 | | |
228 | 231 | | |
229 | 232 | | |
230 | 233 | | |
231 | | - | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
232 | 238 | | |
233 | | - | |
234 | 239 | | |
235 | 240 | | |
236 | 241 | | |
237 | 242 | | |
238 | 243 | | |
239 | 244 | | |
240 | | - | |
| 245 | + | |
241 | 246 | | |
242 | 247 | | |
243 | 248 | | |
244 | 249 | | |
245 | | - | |
| 250 | + | |
246 | 251 | | |
247 | 252 | | |
248 | 253 | | |
249 | 254 | | |
250 | 255 | | |
251 | | - | |
252 | 256 | | |
253 | | - | |
| 257 | + | |
254 | 258 | | |
255 | 259 | | |
256 | 260 | | |
257 | 261 | | |
258 | 262 | | |
259 | 263 | | |
260 | | - | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
261 | 269 | | |
262 | 270 | | |
263 | 271 | | |
| |||
276 | 284 | | |
277 | 285 | | |
278 | 286 | | |
279 | | - | |
| 287 | + | |
280 | 288 | | |
281 | 289 | | |
282 | 290 | | |
| |||
288 | 296 | | |
289 | 297 | | |
290 | 298 | | |
291 | | - | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
292 | 304 | | |
293 | 305 | | |
294 | 306 | | |
295 | 307 | | |
296 | | - | |
| 308 | + | |
297 | 309 | | |
298 | 310 | | |
299 | 311 | | |
300 | 312 | | |
301 | 313 | | |
302 | 314 | | |
| 315 | + | |
303 | 316 | | |
304 | 317 | | |
305 | 318 | | |
| |||
312 | 325 | | |
313 | 326 | | |
314 | 327 | | |
315 | | - | |
| 328 | + | |
316 | 329 | | |
317 | 330 | | |
318 | 331 | | |
| |||
0 commit comments