File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -22,6 +22,7 @@ import { MemoryOnlyConfigurationStore } from '../configuration-store/memory.stor
22
22
import {
23
23
ConfigurationWireV1 ,
24
24
IConfigurationWire ,
25
+ inflateResponse ,
25
26
IPrecomputedConfiguration ,
26
27
PrecomputedConfiguration ,
27
28
} from '../configuration-wire/configuration-wire-types' ;
@@ -325,7 +326,32 @@ export default class EppoClient {
325
326
) ;
326
327
}
327
328
329
+ bootstrap ( configuration : IConfigurationWire ) {
330
+ if ( ! configuration . config ) {
331
+ throw new Error ( 'Flag configuration not provided' ) ;
332
+ }
333
+ const flagConfigResponse = inflateResponse ( configuration . config . response ) ;
334
+ const banditParamResponse = configuration . bandits
335
+ ? inflateResponse ( configuration . bandits . response )
336
+ : undefined ;
337
+
338
+ this . configurationManager . hydrateConfigurationStoresFromUfc (
339
+ flagConfigResponse ,
340
+ banditParamResponse ,
341
+ ) ;
342
+
343
+ // Still initialize the client in case polling is needed.
344
+ this . inititalize ( ) ;
345
+ }
346
+
347
+ /**
348
+ * @deprecated use `initialize` instead.
349
+ */
328
350
async fetchFlagConfigurations ( ) {
351
+ return this . inititalize ( ) ;
352
+ }
353
+
354
+ async inititalize ( ) {
329
355
if ( ! this . configurationRequestParameters ) {
330
356
throw new Error (
331
357
'Eppo SDK unable to fetch flag configurations without configuration request parameters' ,
You can’t perform that action at this time.
0 commit comments