@@ -96,62 +96,6 @@ interface BanditsConfigurationResponse {
9696 */
9797const DEFAULT_ASSIGNMENT_CACHE_SIZE = 50_000 ;
9898
99- /**
100- * Validates that the parsed flags configuration has all required fields.
101- * Returns an array of validation error messages, or empty array if valid.
102- */
103- function validateFlagsConfiguration ( config : unknown ) : string [ ] {
104- const errors : string [ ] = [ ] ;
105-
106- if ( ! config || typeof config !== 'object' ) {
107- errors . push ( 'Configuration must be an object' ) ;
108- return errors ;
109- }
110-
111- const cfg = config as Record < string , unknown > ;
112-
113- if ( typeof cfg . createdAt !== 'string' ) {
114- errors . push ( 'Missing or invalid "createdAt" field' ) ;
115- }
116- if ( typeof cfg . format !== 'string' ) {
117- errors . push ( 'Missing or invalid "format" field' ) ;
118- }
119- if ( ! cfg . environment || typeof cfg . environment !== 'object' ) {
120- errors . push ( 'Missing or invalid "environment" field' ) ;
121- } else if ( typeof ( cfg . environment as Record < string , unknown > ) . name !== 'string' ) {
122- errors . push ( 'Missing or invalid "environment.name" field' ) ;
123- }
124- if ( ! cfg . flags || typeof cfg . flags !== 'object' ) {
125- errors . push ( 'Missing or invalid "flags" field' ) ;
126- }
127- if ( ! cfg . banditReferences || typeof cfg . banditReferences !== 'object' ) {
128- errors . push ( 'Missing or invalid "banditReferences" field' ) ;
129- }
130-
131- return errors ;
132- }
133-
134- /**
135- * Validates that the parsed bandits configuration has all required fields.
136- * Returns an array of validation error messages, or empty array if valid.
137- */
138- function validateBanditsConfiguration ( config : unknown ) : string [ ] {
139- const errors : string [ ] = [ ] ;
140-
141- if ( ! config || typeof config !== 'object' ) {
142- errors . push ( 'Configuration must be an object' ) ;
143- return errors ;
144- }
145-
146- const cfg = config as Record < string , unknown > ;
147-
148- if ( ! cfg . bandits || typeof cfg . bandits !== 'object' ) {
149- errors . push ( 'Missing or invalid "bandits" field' ) ;
150- }
151-
152- return errors ;
153- }
154-
15599/**
156100 * @deprecated Eppo has discontinued eventing support. Event tracking will be handled by Datadog SDKs.
157101 */
@@ -387,7 +331,11 @@ export function offlineInit(config: IOfflineClientConfig): EppoClient {
387331 flagConfigurationStore
388332 . setEntries ( flagsConfigResponse . flags )
389333 . catch ( ( err ) =>
390- applicationLogger . warn ( `Error setting flags for memory-only configuration store: ${ err } ` ) ,
334+ applicationLogger . warn (
335+ `Error setting flags for memory-only configuration store: ${
336+ err instanceof Error ? err . message : err
337+ } `,
338+ ) ,
391339 ) ;
392340
393341 // Set configuration timestamp
@@ -412,7 +360,9 @@ export function offlineInit(config: IOfflineClientConfig): EppoClient {
412360 . setEntries ( banditVariationsByFlagKey )
413361 . catch ( ( err ) =>
414362 applicationLogger . warn (
415- `Error setting bandit variations for memory-only configuration store: ${ err } ` ,
363+ `Error setting bandit variations for memory-only configuration store: ${
364+ err instanceof Error ? err . message : err
365+ } `,
416366 ) ,
417367 ) ;
418368 }
@@ -437,7 +387,9 @@ export function offlineInit(config: IOfflineClientConfig): EppoClient {
437387 . setEntries ( banditsConfigResponse . bandits )
438388 . catch ( ( err ) =>
439389 applicationLogger . warn (
440- `Error setting bandit models for memory-only configuration store: ${ err } ` ,
390+ `Error setting bandit models for memory-only configuration store: ${
391+ err instanceof Error ? err . message : err
392+ } `,
441393 ) ,
442394 ) ;
443395 }
@@ -476,6 +428,62 @@ export function offlineInit(config: IOfflineClientConfig): EppoClient {
476428 }
477429}
478430
431+ /**
432+ * Validates that the parsed flags configuration has all required fields.
433+ * Returns an array of validation error messages, or empty array if valid.
434+ */
435+ function validateFlagsConfiguration ( config : unknown ) : string [ ] {
436+ const errors : string [ ] = [ ] ;
437+
438+ if ( ! config || typeof config !== 'object' ) {
439+ errors . push ( 'Configuration must be an object' ) ;
440+ return errors ;
441+ }
442+
443+ const cfg = config as Record < string , unknown > ;
444+
445+ if ( typeof cfg . createdAt !== 'string' ) {
446+ errors . push ( 'Missing or invalid "createdAt" field' ) ;
447+ }
448+ if ( typeof cfg . format !== 'string' ) {
449+ errors . push ( 'Missing or invalid "format" field' ) ;
450+ }
451+ if ( ! cfg . environment || typeof cfg . environment !== 'object' ) {
452+ errors . push ( 'Missing or invalid "environment" field' ) ;
453+ } else if ( typeof ( cfg . environment as Record < string , unknown > ) . name !== 'string' ) {
454+ errors . push ( 'Missing or invalid "environment.name" field' ) ;
455+ }
456+ if ( ! cfg . flags || typeof cfg . flags !== 'object' ) {
457+ errors . push ( 'Missing or invalid "flags" field' ) ;
458+ }
459+ if ( ! cfg . banditReferences || typeof cfg . banditReferences !== 'object' ) {
460+ errors . push ( 'Missing or invalid "banditReferences" field' ) ;
461+ }
462+
463+ return errors ;
464+ }
465+
466+ /**
467+ * Validates that the parsed bandits configuration has all required fields.
468+ * Returns an array of validation error messages, or empty array if valid.
469+ */
470+ function validateBanditsConfiguration ( config : unknown ) : string [ ] {
471+ const errors : string [ ] = [ ] ;
472+
473+ if ( ! config || typeof config !== 'object' ) {
474+ errors . push ( 'Configuration must be an object' ) ;
475+ return errors ;
476+ }
477+
478+ const cfg = config as Record < string , unknown > ;
479+
480+ if ( ! cfg . bandits || typeof cfg . bandits !== 'object' ) {
481+ errors . push ( 'Missing or invalid "bandits" field' ) ;
482+ }
483+
484+ return errors ;
485+ }
486+
479487/**
480488 * @deprecated Eppo has discontinued eventing support. Event tracking will be handled by Datadog SDKs.
481489 */
0 commit comments