@@ -4,6 +4,7 @@ import type {
4
4
ISyncStore ,
5
5
} from '@eppo/js-client-sdk-common' ;
6
6
import type {
7
+ Environment ,
7
8
Flag ,
8
9
ObfuscatedFlag ,
9
10
} from '@eppo/js-client-sdk-common/dist/interfaces' ;
@@ -35,6 +36,10 @@ class AsyncStorageStore<T> implements ISyncStore<T> {
35
36
return Object . keys ( this . cache ) ;
36
37
}
37
38
39
+ entries ( ) : Record < string , T > {
40
+ return this . cache ;
41
+ }
42
+
38
43
public setEntries ( entries : Record < string , T > ) : void {
39
44
for ( var key in entries ) {
40
45
this . cache [ key ] = entries [ key ] ;
@@ -51,11 +56,16 @@ export class EppoAsyncStorage
51
56
servingStore : ISyncStore < Flag | ObfuscatedFlag > ;
52
57
persistentStore : IAsyncStore < Flag | ObfuscatedFlag > | null ;
53
58
private initialized : boolean ;
59
+ private environment : Environment | null = null ;
60
+ private configFetchedAt : string | null = null ;
61
+ private configPublishedAt : string | null = null ;
54
62
55
63
constructor ( ) {
56
64
this . servingStore = new AsyncStorageStore < Flag | ObfuscatedFlag > ( ) ;
57
65
this . persistentStore = null ;
58
66
this . initialized = false ;
67
+ this . configFetchedAt = '' ;
68
+ this . configPublishedAt = '' ;
59
69
}
60
70
61
71
init ( ) : Promise < void > {
@@ -79,10 +89,39 @@ export class EppoAsyncStorage
79
89
return this . initialized ;
80
90
}
81
91
92
+ entries ( ) : Record < string , Flag | ObfuscatedFlag > {
93
+ return this . servingStore . entries ( ) ;
94
+ }
95
+
82
96
async setEntries (
83
97
entries : Record < string , Flag | ObfuscatedFlag >
84
- ) : Promise < void > {
98
+ ) : Promise < boolean > {
85
99
this . servingStore . setEntries ( entries ) ;
86
100
this . initialized = true ;
101
+ return true ;
102
+ }
103
+
104
+ getEnvironment ( ) : Environment | null {
105
+ return this . environment ;
106
+ }
107
+
108
+ setEnvironment ( environment : Environment ) : void {
109
+ this . environment = environment ;
110
+ }
111
+
112
+ public getConfigFetchedAt ( ) : string | null {
113
+ return this . configFetchedAt ;
114
+ }
115
+
116
+ public setConfigFetchedAt ( configFetchedAt : string ) : void {
117
+ this . configFetchedAt = configFetchedAt ;
118
+ }
119
+
120
+ public getConfigPublishedAt ( ) : string | null {
121
+ return this . configPublishedAt ;
122
+ }
123
+
124
+ public setConfigPublishedAt ( configPublishedAt : string ) : void {
125
+ this . configPublishedAt = configPublishedAt ;
87
126
}
88
127
}
0 commit comments