@firebase/remote-config 0.6.6 → 0.7.0-canary.cb3bdd812
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.
- package/dist/esm/index.esm.js +737 -8
- package/dist/esm/index.esm.js.map +1 -1
- package/dist/esm/src/api.d.ts +17 -1
- package/dist/esm/src/client/eventEmitter.d.ts +39 -0
- package/dist/esm/src/client/realtime_handler.d.ts +141 -0
- package/dist/esm/src/client/remote_config_fetch_client.d.ts +13 -1
- package/dist/esm/src/client/visibility_monitor.d.ts +23 -0
- package/dist/esm/src/errors.d.ts +17 -1
- package/dist/esm/src/public_types.d.ts +60 -1
- package/dist/esm/src/remote_config.d.ts +10 -1
- package/dist/esm/src/storage/storage.d.ts +9 -1
- package/dist/index.cjs.js +736 -6
- package/dist/index.cjs.js.map +1 -1
- package/dist/remote-config-public.d.ts +81 -0
- package/dist/remote-config.d.ts +81 -0
- package/dist/src/api.d.ts +17 -1
- package/dist/src/client/eventEmitter.d.ts +39 -0
- package/dist/src/client/realtime_handler.d.ts +141 -0
- package/dist/src/client/remote_config_fetch_client.d.ts +13 -1
- package/dist/src/client/visibility_monitor.d.ts +23 -0
- package/dist/src/errors.d.ts +17 -1
- package/dist/src/global_index.d.ts +90 -1
- package/dist/src/public_types.d.ts +60 -1
- package/dist/src/remote_config.d.ts +10 -1
- package/dist/src/storage/storage.d.ts +9 -1
- package/package.json +7 -7
package/dist/esm/src/api.d.ts
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
* limitations under the License.
|
|
16
16
|
*/
|
|
17
17
|
import { FirebaseApp } from '@firebase/app';
|
|
18
|
-
import { CustomSignals, LogLevel as RemoteConfigLogLevel, RemoteConfig, Value, RemoteConfigOptions } from './public_types';
|
|
18
|
+
import { CustomSignals, LogLevel as RemoteConfigLogLevel, RemoteConfig, Value, RemoteConfigOptions, ConfigUpdateObserver, Unsubscribe } from './public_types';
|
|
19
19
|
/**
|
|
20
20
|
*
|
|
21
21
|
* @param app - The {@link @firebase/app#FirebaseApp} instance.
|
|
@@ -126,3 +126,19 @@ export declare function setLogLevel(remoteConfig: RemoteConfig, logLevel: Remote
|
|
|
126
126
|
* @public
|
|
127
127
|
*/
|
|
128
128
|
export declare function setCustomSignals(remoteConfig: RemoteConfig, customSignals: CustomSignals): Promise<void>;
|
|
129
|
+
/**
|
|
130
|
+
* Starts listening for real-time config updates from the Remote Config backend and automatically
|
|
131
|
+
* fetches updates from the Remote Config backend when they are available.
|
|
132
|
+
*
|
|
133
|
+
* @remarks
|
|
134
|
+
* If a connection to the Remote Config backend is not already open, calling this method will
|
|
135
|
+
* open it. Multiple listeners can be added by calling this method again, but subsequent calls
|
|
136
|
+
* re-use the same connection to the backend.
|
|
137
|
+
*
|
|
138
|
+
* @param remoteConfig - The {@link RemoteConfig} instance.
|
|
139
|
+
* @param observer - The {@link ConfigUpdateObserver} to be notified of config updates.
|
|
140
|
+
* @returns An {@link Unsubscribe} function to remove the listener.
|
|
141
|
+
*
|
|
142
|
+
* @public
|
|
143
|
+
*/
|
|
144
|
+
export declare function onConfigUpdate(remoteConfig: RemoteConfig, observer: ConfigUpdateObserver): Unsubscribe;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2025 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
|
+
/**
|
|
18
|
+
* Base class to be used if you want to emit events. Call the constructor with
|
|
19
|
+
* the set of allowed event names.
|
|
20
|
+
*/
|
|
21
|
+
export declare abstract class EventEmitter {
|
|
22
|
+
private allowedEvents_;
|
|
23
|
+
private listeners_;
|
|
24
|
+
constructor(allowedEvents_: string[]);
|
|
25
|
+
/**
|
|
26
|
+
* To be overridden by derived classes in order to fire an initial event when
|
|
27
|
+
* somebody subscribes for data.
|
|
28
|
+
*
|
|
29
|
+
* @returns {Array.<*>} Array of parameters to trigger initial event with.
|
|
30
|
+
*/
|
|
31
|
+
abstract getInitialEvent(eventType: string): unknown[];
|
|
32
|
+
/**
|
|
33
|
+
* To be called by derived classes to trigger events.
|
|
34
|
+
*/
|
|
35
|
+
protected trigger(eventType: string, ...varArgs: unknown[]): void;
|
|
36
|
+
on(eventType: string, callback: (a: unknown) => void, context: unknown): void;
|
|
37
|
+
off(eventType: string, callback: (a: unknown) => void, context: unknown): void;
|
|
38
|
+
private validateEventType_;
|
|
39
|
+
}
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2025 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 { _FirebaseInstallationsInternal } from '@firebase/installations';
|
|
18
|
+
import { Logger } from '@firebase/logger';
|
|
19
|
+
import { ConfigUpdateObserver } from '../public_types';
|
|
20
|
+
import { Storage } from '../storage/storage';
|
|
21
|
+
import { StorageCache } from '../storage/storage_cache';
|
|
22
|
+
import { CachingClient } from './caching_client';
|
|
23
|
+
export declare class RealtimeHandler {
|
|
24
|
+
private readonly firebaseInstallations;
|
|
25
|
+
private readonly storage;
|
|
26
|
+
private readonly sdkVersion;
|
|
27
|
+
private readonly namespace;
|
|
28
|
+
private readonly projectId;
|
|
29
|
+
private readonly apiKey;
|
|
30
|
+
private readonly appId;
|
|
31
|
+
private readonly logger;
|
|
32
|
+
private readonly storageCache;
|
|
33
|
+
private readonly cachingClient;
|
|
34
|
+
constructor(firebaseInstallations: _FirebaseInstallationsInternal, storage: Storage, sdkVersion: string, namespace: string, projectId: string, apiKey: string, appId: string, logger: Logger, storageCache: StorageCache, cachingClient: CachingClient);
|
|
35
|
+
private observers;
|
|
36
|
+
private isConnectionActive;
|
|
37
|
+
private isRealtimeDisabled;
|
|
38
|
+
private controller?;
|
|
39
|
+
private reader;
|
|
40
|
+
private httpRetriesRemaining;
|
|
41
|
+
private isInBackground;
|
|
42
|
+
private readonly decoder;
|
|
43
|
+
private isClosingConnection;
|
|
44
|
+
private setRetriesRemaining;
|
|
45
|
+
private propagateError;
|
|
46
|
+
/**
|
|
47
|
+
* Increment the number of failed stream attempts, increase the backoff duration, set the backoff
|
|
48
|
+
* end time to "backoff duration" after `lastFailedStreamTime` and persist the new
|
|
49
|
+
* values to storage metadata.
|
|
50
|
+
*/
|
|
51
|
+
private updateBackoffMetadataWithLastFailedStreamConnectionTime;
|
|
52
|
+
/**
|
|
53
|
+
* Increase the backoff duration with a new end time based on Retry Interval.
|
|
54
|
+
*/
|
|
55
|
+
private updateBackoffMetadataWithRetryInterval;
|
|
56
|
+
/**
|
|
57
|
+
* HTTP status code that the Realtime client should retry on.
|
|
58
|
+
*/
|
|
59
|
+
private isStatusCodeRetryable;
|
|
60
|
+
/**
|
|
61
|
+
* Closes the realtime HTTP connection.
|
|
62
|
+
* Note: This method is designed to be called only once at a time.
|
|
63
|
+
* If a call is already in progress, subsequent calls will be ignored.
|
|
64
|
+
*/
|
|
65
|
+
private closeRealtimeHttpConnection;
|
|
66
|
+
private resetRealtimeBackoff;
|
|
67
|
+
private resetRetryCount;
|
|
68
|
+
/**
|
|
69
|
+
* Assembles the request headers and body and executes the fetch request to
|
|
70
|
+
* establish the real-time streaming connection. This is the "worker" method
|
|
71
|
+
* that performs the actual network communication.
|
|
72
|
+
*/
|
|
73
|
+
private establishRealtimeConnection;
|
|
74
|
+
private getRealtimeUrl;
|
|
75
|
+
private createRealtimeConnection;
|
|
76
|
+
/**
|
|
77
|
+
* Retries HTTP stream connection asyncly in random time intervals.
|
|
78
|
+
*/
|
|
79
|
+
private retryHttpConnectionWhenBackoffEnds;
|
|
80
|
+
private setIsHttpConnectionRunning;
|
|
81
|
+
/**
|
|
82
|
+
* Combines the check and set operations to prevent multiple asynchronous
|
|
83
|
+
* calls from redundantly starting an HTTP connection. This ensures that
|
|
84
|
+
* only one attempt is made at a time.
|
|
85
|
+
*/
|
|
86
|
+
private checkAndSetHttpConnectionFlagIfNotRunning;
|
|
87
|
+
private fetchResponseIsUpToDate;
|
|
88
|
+
private parseAndValidateConfigUpdateMessage;
|
|
89
|
+
private isEventListenersEmpty;
|
|
90
|
+
private getRandomInt;
|
|
91
|
+
private executeAllListenerCallbacks;
|
|
92
|
+
/**
|
|
93
|
+
* Compares two configuration objects and returns a set of keys that have changed.
|
|
94
|
+
* A key is considered changed if it's new, removed, or has a different value.
|
|
95
|
+
*/
|
|
96
|
+
private getChangedParams;
|
|
97
|
+
private fetchLatestConfig;
|
|
98
|
+
private autoFetch;
|
|
99
|
+
/**
|
|
100
|
+
* Processes a stream of real-time messages for configuration updates.
|
|
101
|
+
* This method reassembles fragmented messages, validates and parses the JSON,
|
|
102
|
+
* and automatically fetches a new config if a newer template version is available.
|
|
103
|
+
* It also handles server-specified retry intervals and propagates errors for
|
|
104
|
+
* invalid messages or when real-time updates are disabled.
|
|
105
|
+
*/
|
|
106
|
+
private handleNotifications;
|
|
107
|
+
private listenForNotifications;
|
|
108
|
+
/**
|
|
109
|
+
* Open the real-time connection, begin listening for updates, and auto-fetch when an update is
|
|
110
|
+
* received.
|
|
111
|
+
*
|
|
112
|
+
* If the connection is successful, this method will block on its thread while it reads the
|
|
113
|
+
* chunk-encoded HTTP body. When the connection closes, it attempts to reestablish the stream.
|
|
114
|
+
*/
|
|
115
|
+
private prepareAndBeginRealtimeHttpStream;
|
|
116
|
+
/**
|
|
117
|
+
* Checks whether connection can be made or not based on some conditions
|
|
118
|
+
* @returns booelean
|
|
119
|
+
*/
|
|
120
|
+
private canEstablishStreamConnection;
|
|
121
|
+
private makeRealtimeHttpConnection;
|
|
122
|
+
private beginRealtime;
|
|
123
|
+
/**
|
|
124
|
+
* Adds an observer to the realtime updates.
|
|
125
|
+
* @param observer The observer to add.
|
|
126
|
+
*/
|
|
127
|
+
addObserver(observer: ConfigUpdateObserver): void;
|
|
128
|
+
/**
|
|
129
|
+
* Removes an observer from the realtime updates.
|
|
130
|
+
* @param observer The observer to remove.
|
|
131
|
+
*/
|
|
132
|
+
removeObserver(observer: ConfigUpdateObserver): void;
|
|
133
|
+
/**
|
|
134
|
+
* Handles changes to the application's visibility state, managing the real-time connection.
|
|
135
|
+
*
|
|
136
|
+
* When the application is moved to the background, this method closes the existing
|
|
137
|
+
* real-time connection to save resources. When the application returns to the
|
|
138
|
+
* foreground, it attempts to re-establish the connection.
|
|
139
|
+
*/
|
|
140
|
+
private onVisibilityChange;
|
|
141
|
+
}
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* See the License for the specific language governing permissions and
|
|
15
15
|
* limitations under the License.
|
|
16
16
|
*/
|
|
17
|
-
import { CustomSignals, FetchResponse } from '../public_types';
|
|
17
|
+
import { CustomSignals, FetchResponse, FetchType } from '../public_types';
|
|
18
18
|
/**
|
|
19
19
|
* Defines a client, as in https://en.wikipedia.org/wiki/Client%E2%80%93server_model, for the
|
|
20
20
|
* Remote Config server (https://firebase.google.com/docs/reference/remote-config/rest).
|
|
@@ -89,4 +89,16 @@ export interface FetchRequest {
|
|
|
89
89
|
* <p>Optional in case no custom signals are set for the instance.
|
|
90
90
|
*/
|
|
91
91
|
customSignals?: CustomSignals;
|
|
92
|
+
/**
|
|
93
|
+
* The type of fetch to perform, such as a regular fetch or a real-time fetch.
|
|
94
|
+
*
|
|
95
|
+
* Optional as not all fetch requests need to be distinguished.
|
|
96
|
+
*/
|
|
97
|
+
fetchType?: FetchType;
|
|
98
|
+
/**
|
|
99
|
+
* The number of fetch attempts made so far for this request.
|
|
100
|
+
*
|
|
101
|
+
* Optional as not all fetch requests are part of a retry series.
|
|
102
|
+
*/
|
|
103
|
+
fetchAttempt?: number;
|
|
92
104
|
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2025 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 { EventEmitter } from './eventEmitter';
|
|
18
|
+
export declare class VisibilityMonitor extends EventEmitter {
|
|
19
|
+
private visible_;
|
|
20
|
+
static getInstance(): VisibilityMonitor;
|
|
21
|
+
constructor();
|
|
22
|
+
getInitialEvent(eventType: string): boolean[];
|
|
23
|
+
}
|
package/dist/esm/src/errors.d.ts
CHANGED
|
@@ -31,7 +31,11 @@ export declare const enum ErrorCode {
|
|
|
31
31
|
FETCH_PARSE = "fetch-client-parse",
|
|
32
32
|
FETCH_STATUS = "fetch-status",
|
|
33
33
|
INDEXED_DB_UNAVAILABLE = "indexed-db-unavailable",
|
|
34
|
-
CUSTOM_SIGNAL_MAX_ALLOWED_SIGNALS = "custom-signal-max-allowed-signals"
|
|
34
|
+
CUSTOM_SIGNAL_MAX_ALLOWED_SIGNALS = "custom-signal-max-allowed-signals",
|
|
35
|
+
CONFIG_UPDATE_STREAM_ERROR = "stream-error",
|
|
36
|
+
CONFIG_UPDATE_UNAVAILABLE = "realtime-unavailable",
|
|
37
|
+
CONFIG_UPDATE_MESSAGE_INVALID = "update-message-invalid",
|
|
38
|
+
CONFIG_UPDATE_NOT_FETCHED = "update-not-fetched"
|
|
35
39
|
}
|
|
36
40
|
interface ErrorParams {
|
|
37
41
|
[ErrorCode.STORAGE_OPEN]: {
|
|
@@ -61,6 +65,18 @@ interface ErrorParams {
|
|
|
61
65
|
[ErrorCode.CUSTOM_SIGNAL_MAX_ALLOWED_SIGNALS]: {
|
|
62
66
|
maxSignals: number;
|
|
63
67
|
};
|
|
68
|
+
[ErrorCode.CONFIG_UPDATE_STREAM_ERROR]: {
|
|
69
|
+
originalErrorMessage: string;
|
|
70
|
+
};
|
|
71
|
+
[ErrorCode.CONFIG_UPDATE_UNAVAILABLE]: {
|
|
72
|
+
originalErrorMessage: string;
|
|
73
|
+
};
|
|
74
|
+
[ErrorCode.CONFIG_UPDATE_MESSAGE_INVALID]: {
|
|
75
|
+
originalErrorMessage: string;
|
|
76
|
+
};
|
|
77
|
+
[ErrorCode.CONFIG_UPDATE_NOT_FETCHED]: {
|
|
78
|
+
originalErrorMessage: string;
|
|
79
|
+
};
|
|
64
80
|
}
|
|
65
81
|
export declare const ERROR_FACTORY: ErrorFactory<ErrorCode, ErrorParams>;
|
|
66
82
|
export declare function hasErrorCode(e: Error, errorCode: ErrorCode): boolean;
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* See the License for the specific language governing permissions and
|
|
15
15
|
* limitations under the License.
|
|
16
16
|
*/
|
|
17
|
-
import { FirebaseApp } from '@firebase/app';
|
|
17
|
+
import { FirebaseApp, FirebaseError } from '@firebase/app';
|
|
18
18
|
/**
|
|
19
19
|
* The Firebase Remote Config service interface.
|
|
20
20
|
*
|
|
@@ -48,6 +48,8 @@ export interface RemoteConfig {
|
|
|
48
48
|
}
|
|
49
49
|
/**
|
|
50
50
|
* Defines a self-descriptive reference for config key-value pairs.
|
|
51
|
+
*
|
|
52
|
+
* @public
|
|
51
53
|
*/
|
|
52
54
|
export interface FirebaseRemoteConfigObject {
|
|
53
55
|
[key: string]: string;
|
|
@@ -57,6 +59,8 @@ export interface FirebaseRemoteConfigObject {
|
|
|
57
59
|
*
|
|
58
60
|
* <p>Modeled after the native `Response` interface, but simplified for Remote Config's
|
|
59
61
|
* use case.
|
|
62
|
+
*
|
|
63
|
+
* @public
|
|
60
64
|
*/
|
|
61
65
|
export interface FetchResponse {
|
|
62
66
|
/**
|
|
@@ -82,6 +86,10 @@ export interface FetchResponse {
|
|
|
82
86
|
* <p>Only defined for 200 responses.
|
|
83
87
|
*/
|
|
84
88
|
config?: FirebaseRemoteConfigObject;
|
|
89
|
+
/**
|
|
90
|
+
* The version number of the config template fetched from the server.
|
|
91
|
+
*/
|
|
92
|
+
templateVersion?: number;
|
|
85
93
|
}
|
|
86
94
|
/**
|
|
87
95
|
* Options for Remote Config initialization.
|
|
@@ -189,6 +197,57 @@ export type LogLevel = 'debug' | 'error' | 'silent';
|
|
|
189
197
|
export interface CustomSignals {
|
|
190
198
|
[key: string]: string | number | null;
|
|
191
199
|
}
|
|
200
|
+
/**
|
|
201
|
+
* Contains information about which keys have been updated.
|
|
202
|
+
*
|
|
203
|
+
* @public
|
|
204
|
+
*/
|
|
205
|
+
export interface ConfigUpdate {
|
|
206
|
+
/**
|
|
207
|
+
* Parameter keys whose values have been updated from the currently activated values.
|
|
208
|
+
* Includes keys that are added, deleted, or whose value, value source, or metadata has changed.
|
|
209
|
+
*/
|
|
210
|
+
getUpdatedKeys(): Set<string>;
|
|
211
|
+
}
|
|
212
|
+
/**
|
|
213
|
+
* Observer interface for receiving real-time Remote Config update notifications.
|
|
214
|
+
*
|
|
215
|
+
* NOTE: Although an `complete` callback can be provided, it will
|
|
216
|
+
* never be called because the ConfigUpdate stream is never-ending.
|
|
217
|
+
*
|
|
218
|
+
* @public
|
|
219
|
+
*/
|
|
220
|
+
export interface ConfigUpdateObserver {
|
|
221
|
+
/**
|
|
222
|
+
* Called when a new ConfigUpdate is available.
|
|
223
|
+
*/
|
|
224
|
+
next: (configUpdate: ConfigUpdate) => void;
|
|
225
|
+
/**
|
|
226
|
+
* Called if an error occurs during the stream.
|
|
227
|
+
*/
|
|
228
|
+
error: (error: FirebaseError) => void;
|
|
229
|
+
/**
|
|
230
|
+
* Called when the stream is gracefully terminated.
|
|
231
|
+
*/
|
|
232
|
+
complete: () => void;
|
|
233
|
+
}
|
|
234
|
+
/**
|
|
235
|
+
* A function that unsubscribes from a real-time event stream.
|
|
236
|
+
*
|
|
237
|
+
* @public
|
|
238
|
+
*/
|
|
239
|
+
export type Unsubscribe = () => void;
|
|
240
|
+
/**
|
|
241
|
+
* Indicates the type of fetch request.
|
|
242
|
+
*
|
|
243
|
+
* <ul>
|
|
244
|
+
* <li>"BASE" indicates a standard fetch request.</li>
|
|
245
|
+
* <li>"REALTIME" indicates a fetch request triggered by a real-time update.</li>
|
|
246
|
+
* </ul>
|
|
247
|
+
*
|
|
248
|
+
* @public
|
|
249
|
+
*/
|
|
250
|
+
export type FetchType = 'BASE' | 'REALTIME';
|
|
192
251
|
declare module '@firebase/component' {
|
|
193
252
|
interface NameServiceMapping {
|
|
194
253
|
'remote-config': RemoteConfig;
|
|
@@ -20,6 +20,7 @@ import { StorageCache } from './storage/storage_cache';
|
|
|
20
20
|
import { RemoteConfigFetchClient } from './client/remote_config_fetch_client';
|
|
21
21
|
import { Storage } from './storage/storage';
|
|
22
22
|
import { Logger } from '@firebase/logger';
|
|
23
|
+
import { RealtimeHandler } from './client/realtime_handler';
|
|
23
24
|
/**
|
|
24
25
|
* Encapsulates business logic mapping network and storage dependencies to the public SDK API.
|
|
25
26
|
*
|
|
@@ -43,6 +44,10 @@ export declare class RemoteConfig implements RemoteConfigType {
|
|
|
43
44
|
* @internal
|
|
44
45
|
*/
|
|
45
46
|
readonly _logger: Logger;
|
|
47
|
+
/**
|
|
48
|
+
* @internal
|
|
49
|
+
*/
|
|
50
|
+
readonly _realtimeHandler: RealtimeHandler;
|
|
46
51
|
/**
|
|
47
52
|
* Tracks completion of initialization promise.
|
|
48
53
|
* @internal
|
|
@@ -75,5 +80,9 @@ export declare class RemoteConfig implements RemoteConfigType {
|
|
|
75
80
|
/**
|
|
76
81
|
* @internal
|
|
77
82
|
*/
|
|
78
|
-
_logger: Logger
|
|
83
|
+
_logger: Logger,
|
|
84
|
+
/**
|
|
85
|
+
* @internal
|
|
86
|
+
*/
|
|
87
|
+
_realtimeHandler: RealtimeHandler);
|
|
79
88
|
}
|
|
@@ -34,12 +34,16 @@ export interface ThrottleMetadata {
|
|
|
34
34
|
backoffCount: number;
|
|
35
35
|
throttleEndTimeMillis: number;
|
|
36
36
|
}
|
|
37
|
+
export interface RealtimeBackoffMetadata {
|
|
38
|
+
numFailedStreams: number;
|
|
39
|
+
backoffEndTimeMillis: Date;
|
|
40
|
+
}
|
|
37
41
|
/**
|
|
38
42
|
* Provides type-safety for the "key" field used by {@link APP_NAMESPACE_STORE}.
|
|
39
43
|
*
|
|
40
44
|
* <p>This seems like a small price to avoid potentially subtle bugs caused by a typo.
|
|
41
45
|
*/
|
|
42
|
-
type ProjectNamespaceKeyFieldValue = 'active_config' | 'active_config_etag' | 'last_fetch_status' | 'last_successful_fetch_timestamp_millis' | 'last_successful_fetch_response' | 'settings' | 'throttle_metadata' | 'custom_signals';
|
|
46
|
+
type ProjectNamespaceKeyFieldValue = 'active_config' | 'active_config_etag' | 'last_fetch_status' | 'last_successful_fetch_timestamp_millis' | 'last_successful_fetch_response' | 'settings' | 'throttle_metadata' | 'custom_signals' | 'realtime_backoff_metadata' | 'last_known_template_version';
|
|
43
47
|
export declare function openDatabase(): Promise<IDBDatabase>;
|
|
44
48
|
/**
|
|
45
49
|
* Abstracts data persistence.
|
|
@@ -63,6 +67,10 @@ export declare abstract class Storage {
|
|
|
63
67
|
abstract get<T>(key: ProjectNamespaceKeyFieldValue): Promise<T | undefined>;
|
|
64
68
|
abstract set<T>(key: ProjectNamespaceKeyFieldValue, value: T): Promise<void>;
|
|
65
69
|
abstract delete(key: ProjectNamespaceKeyFieldValue): Promise<void>;
|
|
70
|
+
getRealtimeBackoffMetadata(): Promise<RealtimeBackoffMetadata | undefined>;
|
|
71
|
+
setRealtimeBackoffMetadata(realtimeMetadata: RealtimeBackoffMetadata): Promise<void>;
|
|
72
|
+
getActiveConfigTemplateVersion(): Promise<number | undefined>;
|
|
73
|
+
setActiveConfigTemplateVersion(version: number): Promise<void>;
|
|
66
74
|
}
|
|
67
75
|
export declare class IndexedDbStorage extends Storage {
|
|
68
76
|
private readonly appId;
|