@depup/firebase__remote-config 0.8.1-depup.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. package/README.md +31 -0
  2. package/changes.json +10 -0
  3. package/dist/esm/index.esm.js +2199 -0
  4. package/dist/esm/index.esm.js.map +1 -0
  5. package/dist/esm/package.json +1 -0
  6. package/dist/esm/src/abt/experiment.d.ts +13 -0
  7. package/dist/esm/src/api.d.ts +144 -0
  8. package/dist/esm/src/api2.d.ts +40 -0
  9. package/dist/esm/src/client/caching_client.d.ts +46 -0
  10. package/dist/esm/src/client/eventEmitter.d.ts +39 -0
  11. package/dist/esm/src/client/realtime_handler.d.ts +141 -0
  12. package/dist/esm/src/client/remote_config_fetch_client.d.ts +104 -0
  13. package/dist/esm/src/client/rest_client.d.ts +41 -0
  14. package/dist/esm/src/client/retrying_client.d.ts +50 -0
  15. package/dist/esm/src/client/visibility_monitor.d.ts +23 -0
  16. package/dist/esm/src/constants.d.ts +20 -0
  17. package/dist/esm/src/errors.d.ts +87 -0
  18. package/dist/esm/src/index.d.ts +14 -0
  19. package/dist/esm/src/language.d.ts +26 -0
  20. package/dist/esm/src/public_types.d.ts +274 -0
  21. package/dist/esm/src/register.d.ts +2 -0
  22. package/dist/esm/src/remote_config.d.ts +98 -0
  23. package/dist/esm/src/storage/storage.d.ts +118 -0
  24. package/dist/esm/src/storage/storage_cache.d.ts +51 -0
  25. package/dist/esm/src/value.d.ts +26 -0
  26. package/dist/esm/test/setup.d.ts +17 -0
  27. package/dist/index.cjs.js +2216 -0
  28. package/dist/index.cjs.js.map +1 -0
  29. package/dist/remote-config-public.d.ts +441 -0
  30. package/dist/remote-config.d.ts +441 -0
  31. package/dist/src/abt/experiment.d.ts +13 -0
  32. package/dist/src/api.d.ts +144 -0
  33. package/dist/src/api2.d.ts +40 -0
  34. package/dist/src/client/caching_client.d.ts +46 -0
  35. package/dist/src/client/eventEmitter.d.ts +39 -0
  36. package/dist/src/client/realtime_handler.d.ts +141 -0
  37. package/dist/src/client/remote_config_fetch_client.d.ts +104 -0
  38. package/dist/src/client/rest_client.d.ts +41 -0
  39. package/dist/src/client/retrying_client.d.ts +50 -0
  40. package/dist/src/client/visibility_monitor.d.ts +23 -0
  41. package/dist/src/constants.d.ts +20 -0
  42. package/dist/src/errors.d.ts +87 -0
  43. package/dist/src/global_index.d.ts +674 -0
  44. package/dist/src/index.d.ts +14 -0
  45. package/dist/src/language.d.ts +26 -0
  46. package/dist/src/public_types.d.ts +274 -0
  47. package/dist/src/register.d.ts +2 -0
  48. package/dist/src/remote_config.d.ts +98 -0
  49. package/dist/src/storage/storage.d.ts +118 -0
  50. package/dist/src/storage/storage_cache.d.ts +51 -0
  51. package/dist/src/tsdoc-metadata.json +11 -0
  52. package/dist/src/value.d.ts +26 -0
  53. package/dist/test/setup.d.ts +17 -0
  54. package/package.json +93 -0
@@ -0,0 +1,274 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2020 Google LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ import { FirebaseApp, FirebaseError } from '@firebase/app';
18
+ /**
19
+ * The Firebase Remote Config service interface.
20
+ *
21
+ * @public
22
+ */
23
+ export interface RemoteConfig {
24
+ /**
25
+ * The {@link @firebase/app#FirebaseApp} this `RemoteConfig` instance is associated with.
26
+ */
27
+ app: FirebaseApp;
28
+ /**
29
+ * Defines configuration for the Remote Config SDK.
30
+ */
31
+ settings: RemoteConfigSettings;
32
+ /**
33
+ * Object containing default values for configs.
34
+ */
35
+ defaultConfig: {
36
+ [key: string]: string | number | boolean;
37
+ };
38
+ /**
39
+ * The Unix timestamp in milliseconds of the last <i>successful</i> fetch, or negative one if
40
+ * the {@link RemoteConfig} instance either hasn't fetched or initialization
41
+ * is incomplete.
42
+ */
43
+ fetchTimeMillis: number;
44
+ /**
45
+ * The status of the last fetch <i>attempt</i>.
46
+ */
47
+ lastFetchStatus: FetchStatus;
48
+ }
49
+ /**
50
+ * Defines a self-descriptive reference for config key-value pairs.
51
+ *
52
+ * @public
53
+ */
54
+ export interface FirebaseRemoteConfigObject {
55
+ [key: string]: string;
56
+ }
57
+ /**
58
+ * Defines experiment and variant attached to a config parameter.
59
+ *
60
+ * @public
61
+ */
62
+ export interface FirebaseExperimentDescription {
63
+ experimentId: string;
64
+ variantId: string;
65
+ experimentStartTime: string;
66
+ triggerTimeoutMillis: string;
67
+ timeToLiveMillis: string;
68
+ affectedParameterKeys?: string[];
69
+ }
70
+ /**
71
+ * Defines a successful response (200 or 304).
72
+ *
73
+ * <p>Modeled after the native `Response` interface, but simplified for Remote Config's
74
+ * use case.
75
+ *
76
+ * @public
77
+ */
78
+ export interface FetchResponse {
79
+ /**
80
+ * The HTTP status, which is useful for differentiating success responses with data from
81
+ * those without.
82
+ *
83
+ * <p>The Remote Config client is modeled after the native `Fetch` interface, so
84
+ * HTTP status is first-class.
85
+ *
86
+ * <p>Disambiguation: the fetch response returns a legacy "state" value that is redundant with the
87
+ * HTTP status code. The former is normalized into the latter.
88
+ */
89
+ status: number;
90
+ /**
91
+ * Defines the ETag response header value.
92
+ *
93
+ * <p>Only defined for 200 and 304 responses.
94
+ */
95
+ eTag?: string;
96
+ /**
97
+ * Defines the map of parameters returned as "entries" in the fetch response body.
98
+ *
99
+ * <p>Only defined for 200 responses.
100
+ */
101
+ config?: FirebaseRemoteConfigObject;
102
+ /**
103
+ * The version number of the config template fetched from the server.
104
+ */
105
+ templateVersion?: number;
106
+ /**
107
+ * Metadata for A/B testing and Remote Config Rollout experiments.
108
+ *
109
+ * @remarks Only defined for 200 responses.
110
+ */
111
+ experiments?: FirebaseExperimentDescription[];
112
+ }
113
+ /**
114
+ * Options for Remote Config initialization.
115
+ *
116
+ * @public
117
+ */
118
+ export interface RemoteConfigOptions {
119
+ /**
120
+ * The ID of the template to use. If not provided, defaults to "firebase".
121
+ */
122
+ templateId?: string;
123
+ /**
124
+ * Hydrates the state with an initial fetch response.
125
+ */
126
+ initialFetchResponse?: FetchResponse;
127
+ }
128
+ /**
129
+ * Indicates the source of a value.
130
+ *
131
+ * <ul>
132
+ * <li>"static" indicates the value was defined by a static constant.</li>
133
+ * <li>"default" indicates the value was defined by default config.</li>
134
+ * <li>"remote" indicates the value was defined by fetched config.</li>
135
+ * </ul>
136
+ *
137
+ * @public
138
+ */
139
+ export type ValueSource = 'static' | 'default' | 'remote';
140
+ /**
141
+ * Wraps a value with metadata and type-safe getters.
142
+ *
143
+ * @public
144
+ */
145
+ export interface Value {
146
+ /**
147
+ * Gets the value as a boolean.
148
+ *
149
+ * The following values (case-insensitive) are interpreted as true:
150
+ * "1", "true", "t", "yes", "y", "on". Other values are interpreted as false.
151
+ */
152
+ asBoolean(): boolean;
153
+ /**
154
+ * Gets the value as a number. Comparable to calling <code>Number(value) || 0</code>.
155
+ */
156
+ asNumber(): number;
157
+ /**
158
+ * Gets the value as a string.
159
+ */
160
+ asString(): string;
161
+ /**
162
+ * Gets the {@link ValueSource} for the given key.
163
+ */
164
+ getSource(): ValueSource;
165
+ }
166
+ /**
167
+ * Defines configuration options for the Remote Config SDK.
168
+ *
169
+ * @public
170
+ */
171
+ export interface RemoteConfigSettings {
172
+ /**
173
+ * Defines the maximum age in milliseconds of an entry in the config cache before
174
+ * it is considered stale. Defaults to 43200000 (Twelve hours).
175
+ */
176
+ minimumFetchIntervalMillis: number;
177
+ /**
178
+ * Defines the maximum amount of milliseconds to wait for a response when fetching
179
+ * configuration from the Remote Config server. Defaults to 60000 (One minute).
180
+ */
181
+ fetchTimeoutMillis: number;
182
+ }
183
+ /**
184
+ * Summarizes the outcome of the last attempt to fetch config from the Firebase Remote Config server.
185
+ *
186
+ * <ul>
187
+ * <li>"no-fetch-yet" indicates the {@link RemoteConfig} instance has not yet attempted
188
+ * to fetch config, or that SDK initialization is incomplete.</li>
189
+ * <li>"success" indicates the last attempt succeeded.</li>
190
+ * <li>"failure" indicates the last attempt failed.</li>
191
+ * <li>"throttle" indicates the last attempt was rate-limited.</li>
192
+ * </ul>
193
+ *
194
+ * @public
195
+ */
196
+ export type FetchStatus = 'no-fetch-yet' | 'success' | 'failure' | 'throttle';
197
+ /**
198
+ * Defines levels of Remote Config logging.
199
+ *
200
+ * @public
201
+ */
202
+ export type LogLevel = 'debug' | 'error' | 'silent';
203
+ /**
204
+ * Defines the type for representing custom signals and their values.
205
+ *
206
+ * <p>The values in CustomSignals must be one of the following types:
207
+ *
208
+ * <ul>
209
+ * <li><code>string</code>
210
+ * <li><code>number</code>
211
+ * <li><code>null</code>
212
+ * </ul>
213
+ *
214
+ * @public
215
+ */
216
+ export interface CustomSignals {
217
+ [key: string]: string | number | null;
218
+ }
219
+ /**
220
+ * Contains information about which keys have been updated.
221
+ *
222
+ * @public
223
+ */
224
+ export interface ConfigUpdate {
225
+ /**
226
+ * Parameter keys whose values have been updated from the currently activated values.
227
+ * Includes keys that are added, deleted, or whose value, value source, or metadata has changed.
228
+ */
229
+ getUpdatedKeys(): Set<string>;
230
+ }
231
+ /**
232
+ * Observer interface for receiving real-time Remote Config update notifications.
233
+ *
234
+ * NOTE: Although an `complete` callback can be provided, it will
235
+ * never be called because the ConfigUpdate stream is never-ending.
236
+ *
237
+ * @public
238
+ */
239
+ export interface ConfigUpdateObserver {
240
+ /**
241
+ * Called when a new ConfigUpdate is available.
242
+ */
243
+ next: (configUpdate: ConfigUpdate) => void;
244
+ /**
245
+ * Called if an error occurs during the stream.
246
+ */
247
+ error: (error: FirebaseError) => void;
248
+ /**
249
+ * Called when the stream is gracefully terminated.
250
+ */
251
+ complete: () => void;
252
+ }
253
+ /**
254
+ * A function that unsubscribes from a real-time event stream.
255
+ *
256
+ * @public
257
+ */
258
+ export type Unsubscribe = () => void;
259
+ /**
260
+ * Indicates the type of fetch request.
261
+ *
262
+ * <ul>
263
+ * <li>"BASE" indicates a standard fetch request.</li>
264
+ * <li>"REALTIME" indicates a fetch request triggered by a real-time update.</li>
265
+ * </ul>
266
+ *
267
+ * @public
268
+ */
269
+ export type FetchType = 'BASE' | 'REALTIME';
270
+ declare module '@firebase/component' {
271
+ interface NameServiceMapping {
272
+ 'remote-config': RemoteConfig;
273
+ }
274
+ }
@@ -0,0 +1,2 @@
1
+ import '@firebase/installations';
2
+ export declare function registerRemoteConfig(): void;
@@ -0,0 +1,98 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2019 Google LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ import { FirebaseApp } from '@firebase/app';
18
+ import { RemoteConfig as RemoteConfigType, FetchStatus, RemoteConfigSettings } from './public_types';
19
+ import { StorageCache } from './storage/storage_cache';
20
+ import { RemoteConfigFetchClient } from './client/remote_config_fetch_client';
21
+ import { Storage } from './storage/storage';
22
+ import { Logger } from '@firebase/logger';
23
+ import { FirebaseAnalyticsInternalName } from '@firebase/analytics-interop-types';
24
+ import { Provider } from '@firebase/component';
25
+ import { RealtimeHandler } from './client/realtime_handler';
26
+ /**
27
+ * Encapsulates business logic mapping network and storage dependencies to the public SDK API.
28
+ *
29
+ * See {@link https://github.com/firebase/firebase-js-sdk/blob/main/packages/firebase/compat/index.d.ts|interface documentation} for method descriptions.
30
+ */
31
+ export declare class RemoteConfig implements RemoteConfigType {
32
+ readonly app: FirebaseApp;
33
+ /**
34
+ * @internal
35
+ */
36
+ readonly _client: RemoteConfigFetchClient;
37
+ /**
38
+ * @internal
39
+ */
40
+ readonly _storageCache: StorageCache;
41
+ /**
42
+ * @internal
43
+ */
44
+ readonly _storage: Storage;
45
+ /**
46
+ * @internal
47
+ */
48
+ readonly _logger: Logger;
49
+ /**
50
+ * @internal
51
+ */
52
+ readonly _realtimeHandler: RealtimeHandler;
53
+ /**
54
+ * @internal
55
+ */
56
+ readonly _analyticsProvider: Provider<FirebaseAnalyticsInternalName>;
57
+ /**
58
+ * Tracks completion of initialization promise.
59
+ * @internal
60
+ */
61
+ _isInitializationComplete: boolean;
62
+ /**
63
+ * De-duplicates initialization calls.
64
+ * @internal
65
+ */
66
+ _initializePromise?: Promise<void>;
67
+ settings: RemoteConfigSettings;
68
+ defaultConfig: {
69
+ [key: string]: string | number | boolean;
70
+ };
71
+ get fetchTimeMillis(): number;
72
+ get lastFetchStatus(): FetchStatus;
73
+ constructor(app: FirebaseApp,
74
+ /**
75
+ * @internal
76
+ */
77
+ _client: RemoteConfigFetchClient,
78
+ /**
79
+ * @internal
80
+ */
81
+ _storageCache: StorageCache,
82
+ /**
83
+ * @internal
84
+ */
85
+ _storage: Storage,
86
+ /**
87
+ * @internal
88
+ */
89
+ _logger: Logger,
90
+ /**
91
+ * @internal
92
+ */
93
+ _realtimeHandler: RealtimeHandler,
94
+ /**
95
+ * @internal
96
+ */
97
+ _analyticsProvider: Provider<FirebaseAnalyticsInternalName>);
98
+ }
@@ -0,0 +1,118 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2019 Google LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ import { FetchStatus, CustomSignals } from '@firebase/remote-config-types';
18
+ import { FetchResponse, FirebaseRemoteConfigObject } from '../public_types';
19
+ /**
20
+ * A general-purpose store keyed by app + namespace + {@link
21
+ * ProjectNamespaceKeyFieldValue}.
22
+ *
23
+ * <p>The Remote Config SDK can be used with multiple app installations, and each app can interact
24
+ * with multiple namespaces, so this store uses app (ID + name) and namespace as common parent keys
25
+ * for a set of key-value pairs. See {@link Storage#createCompositeKey}.
26
+ *
27
+ * <p>Visible for testing.
28
+ */
29
+ export declare const APP_NAMESPACE_STORE = "app_namespace_store";
30
+ /**
31
+ * Encapsulates metadata concerning throttled fetch requests.
32
+ */
33
+ export interface ThrottleMetadata {
34
+ backoffCount: number;
35
+ throttleEndTimeMillis: number;
36
+ }
37
+ export interface RealtimeBackoffMetadata {
38
+ numFailedStreams: number;
39
+ backoffEndTimeMillis: Date;
40
+ }
41
+ /**
42
+ * Provides type-safety for the "key" field used by {@link APP_NAMESPACE_STORE}.
43
+ *
44
+ * <p>This seems like a small price to avoid potentially subtle bugs caused by a typo.
45
+ */
46
+ type ProjectNamespaceKeyFieldValue = 'active_config' | 'active_config_etag' | 'active_experiments' | 'last_fetch_status' | 'last_successful_fetch_timestamp_millis' | 'last_successful_fetch_response' | 'settings' | 'throttle_metadata' | 'custom_signals' | 'realtime_backoff_metadata' | 'last_known_template_version';
47
+ export declare function openDatabase(): Promise<IDBDatabase>;
48
+ /**
49
+ * Abstracts data persistence.
50
+ */
51
+ export declare abstract class Storage {
52
+ getLastFetchStatus(): Promise<FetchStatus | undefined>;
53
+ setLastFetchStatus(status: FetchStatus): Promise<void>;
54
+ getLastSuccessfulFetchTimestampMillis(): Promise<number | undefined>;
55
+ setLastSuccessfulFetchTimestampMillis(timestamp: number): Promise<void>;
56
+ getLastSuccessfulFetchResponse(): Promise<FetchResponse | undefined>;
57
+ setLastSuccessfulFetchResponse(response: FetchResponse): Promise<void>;
58
+ getActiveConfig(): Promise<FirebaseRemoteConfigObject | undefined>;
59
+ setActiveConfig(config: FirebaseRemoteConfigObject): Promise<void>;
60
+ getActiveConfigEtag(): Promise<string | undefined>;
61
+ setActiveConfigEtag(etag: string): Promise<void>;
62
+ getActiveExperiments(): Promise<Set<string> | undefined>;
63
+ setActiveExperiments(experiments: Set<string>): Promise<void>;
64
+ getThrottleMetadata(): Promise<ThrottleMetadata | undefined>;
65
+ setThrottleMetadata(metadata: ThrottleMetadata): Promise<void>;
66
+ deleteThrottleMetadata(): Promise<void>;
67
+ getCustomSignals(): Promise<CustomSignals | undefined>;
68
+ abstract setCustomSignals(customSignals: CustomSignals): Promise<CustomSignals>;
69
+ abstract get<T>(key: ProjectNamespaceKeyFieldValue): Promise<T | undefined>;
70
+ abstract set<T>(key: ProjectNamespaceKeyFieldValue, value: T): Promise<void>;
71
+ abstract delete(key: ProjectNamespaceKeyFieldValue): Promise<void>;
72
+ getRealtimeBackoffMetadata(): Promise<RealtimeBackoffMetadata | undefined>;
73
+ setRealtimeBackoffMetadata(realtimeMetadata: RealtimeBackoffMetadata): Promise<void>;
74
+ getActiveConfigTemplateVersion(): Promise<number | undefined>;
75
+ setActiveConfigTemplateVersion(version: number): Promise<void>;
76
+ }
77
+ export declare class IndexedDbStorage extends Storage {
78
+ private readonly appId;
79
+ private readonly appName;
80
+ private readonly namespace;
81
+ private readonly openDbPromise;
82
+ /**
83
+ * @param appId enables storage segmentation by app (ID + name).
84
+ * @param appName enables storage segmentation by app (ID + name).
85
+ * @param namespace enables storage segmentation by namespace.
86
+ */
87
+ constructor(appId: string, appName: string, namespace: string, openDbPromise?: Promise<IDBDatabase>);
88
+ setCustomSignals(customSignals: CustomSignals): Promise<CustomSignals>;
89
+ /**
90
+ * Gets a value from the database using the provided transaction.
91
+ *
92
+ * @param key The key of the value to get.
93
+ * @param transaction The transaction to use for the operation.
94
+ * @returns The value associated with the key, or undefined if no such value exists.
95
+ */
96
+ getWithTransaction<T>(key: ProjectNamespaceKeyFieldValue, transaction: IDBTransaction): Promise<T | undefined>;
97
+ /**
98
+ * Sets a value in the database using the provided transaction.
99
+ *
100
+ * @param key The key of the value to set.
101
+ * @param value The value to set.
102
+ * @param transaction The transaction to use for the operation.
103
+ * @returns A promise that resolves when the operation is complete.
104
+ */
105
+ setWithTransaction<T>(key: ProjectNamespaceKeyFieldValue, value: T, transaction: IDBTransaction): Promise<void>;
106
+ get<T>(key: ProjectNamespaceKeyFieldValue): Promise<T | undefined>;
107
+ set<T>(key: ProjectNamespaceKeyFieldValue, value: T): Promise<void>;
108
+ delete(key: ProjectNamespaceKeyFieldValue): Promise<void>;
109
+ createCompositeKey(key: ProjectNamespaceKeyFieldValue): string;
110
+ }
111
+ export declare class InMemoryStorage extends Storage {
112
+ private storage;
113
+ get<T>(key: ProjectNamespaceKeyFieldValue): Promise<T>;
114
+ set<T>(key: ProjectNamespaceKeyFieldValue, value: T): Promise<void>;
115
+ delete(key: ProjectNamespaceKeyFieldValue): Promise<void>;
116
+ setCustomSignals(customSignals: CustomSignals): Promise<CustomSignals>;
117
+ }
118
+ export {};
@@ -0,0 +1,51 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2019 Google LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ import { FetchStatus, CustomSignals } from '@firebase/remote-config-types';
18
+ import { FirebaseRemoteConfigObject } from '../public_types';
19
+ import { Storage } from './storage';
20
+ /**
21
+ * A memory cache layer over storage to support the SDK's synchronous read requirements.
22
+ */
23
+ export declare class StorageCache {
24
+ private readonly storage;
25
+ constructor(storage: Storage);
26
+ /**
27
+ * Memory caches.
28
+ */
29
+ private lastFetchStatus?;
30
+ private lastSuccessfulFetchTimestampMillis?;
31
+ private activeConfig?;
32
+ private customSignals?;
33
+ /**
34
+ * Memory-only getters
35
+ */
36
+ getLastFetchStatus(): FetchStatus | undefined;
37
+ getLastSuccessfulFetchTimestampMillis(): number | undefined;
38
+ getActiveConfig(): FirebaseRemoteConfigObject | undefined;
39
+ getCustomSignals(): CustomSignals | undefined;
40
+ /**
41
+ * Read-ahead getter
42
+ */
43
+ loadFromStorage(): Promise<void>;
44
+ /**
45
+ * Write-through setters
46
+ */
47
+ setLastFetchStatus(status: FetchStatus): Promise<void>;
48
+ setLastSuccessfulFetchTimestampMillis(timestampMillis: number): Promise<void>;
49
+ setActiveConfig(activeConfig: FirebaseRemoteConfigObject): Promise<void>;
50
+ setCustomSignals(customSignals: CustomSignals): Promise<void>;
51
+ }
@@ -0,0 +1,26 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2019 Google LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ import { Value as ValueType, ValueSource } from '@firebase/remote-config-types';
18
+ export declare class Value implements ValueType {
19
+ private readonly _source;
20
+ private readonly _value;
21
+ constructor(_source: ValueSource, _value?: string);
22
+ asString(): string;
23
+ asBoolean(): boolean;
24
+ asNumber(): number;
25
+ getSource(): ValueSource;
26
+ }
@@ -0,0 +1,17 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2019 Google LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ export {};