@firebase/remote-config 0.6.4 → 0.6.5
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.esm2017.js +1 -1
- package/dist/index.cjs.js +1 -1
- package/dist/src/global_index.d.ts +566 -0
- package/package.json +6 -5
package/dist/index.cjs.js
CHANGED
|
@@ -0,0 +1,566 @@
|
|
|
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
|
+
interface VersionService {
|
|
18
|
+
library: string;
|
|
19
|
+
version: string;
|
|
20
|
+
}
|
|
21
|
+
interface PlatformLoggerService {
|
|
22
|
+
getPlatformInfoString(): string;
|
|
23
|
+
}
|
|
24
|
+
interface HeartbeatService {
|
|
25
|
+
/**
|
|
26
|
+
* Called to report a heartbeat. The function will generate
|
|
27
|
+
* a HeartbeatsByUserAgent object, update heartbeatsCache, and persist it
|
|
28
|
+
* to IndexedDB.
|
|
29
|
+
* Note that we only store one heartbeat per day. So if a heartbeat for today is
|
|
30
|
+
* already logged, subsequent calls to this function in the same day will be ignored.
|
|
31
|
+
*/
|
|
32
|
+
triggerHeartbeat(): Promise<void>;
|
|
33
|
+
/**
|
|
34
|
+
* Returns a base64 encoded string which can be attached to the heartbeat-specific header directly.
|
|
35
|
+
* It also clears all heartbeats from memory as well as in IndexedDB.
|
|
36
|
+
*/
|
|
37
|
+
getHeartbeatsHeader(): Promise<string>;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* @license
|
|
42
|
+
* Copyright 2020 Google LLC
|
|
43
|
+
*
|
|
44
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
45
|
+
* you may not use this file except in compliance with the License.
|
|
46
|
+
* You may obtain a copy of the License at
|
|
47
|
+
*
|
|
48
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
49
|
+
*
|
|
50
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
51
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
52
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
53
|
+
* See the License for the specific language governing permissions and
|
|
54
|
+
* limitations under the License.
|
|
55
|
+
*/
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* A {@link @firebase/app#FirebaseApp} holds the initialization information for a collection of
|
|
59
|
+
* services.
|
|
60
|
+
*
|
|
61
|
+
* Do not call this constructor directly. Instead, use
|
|
62
|
+
* {@link (initializeApp:1) | initializeApp()} to create an app.
|
|
63
|
+
*
|
|
64
|
+
* @public
|
|
65
|
+
*/
|
|
66
|
+
interface FirebaseApp {
|
|
67
|
+
/**
|
|
68
|
+
* The (read-only) name for this app.
|
|
69
|
+
*
|
|
70
|
+
* The default app's name is `"[DEFAULT]"`.
|
|
71
|
+
*
|
|
72
|
+
* @example
|
|
73
|
+
* ```javascript
|
|
74
|
+
* // The default app's name is "[DEFAULT]"
|
|
75
|
+
* const app = initializeApp(defaultAppConfig);
|
|
76
|
+
* console.log(app.name); // "[DEFAULT]"
|
|
77
|
+
* ```
|
|
78
|
+
*
|
|
79
|
+
* @example
|
|
80
|
+
* ```javascript
|
|
81
|
+
* // A named app's name is what you provide to initializeApp()
|
|
82
|
+
* const otherApp = initializeApp(otherAppConfig, "other");
|
|
83
|
+
* console.log(otherApp.name); // "other"
|
|
84
|
+
* ```
|
|
85
|
+
*/
|
|
86
|
+
readonly name: string;
|
|
87
|
+
/**
|
|
88
|
+
* The (read-only) configuration options for this app. These are the original
|
|
89
|
+
* parameters given in {@link (initializeApp:1) | initializeApp()}.
|
|
90
|
+
*
|
|
91
|
+
* @example
|
|
92
|
+
* ```javascript
|
|
93
|
+
* const app = initializeApp(config);
|
|
94
|
+
* console.log(app.options.databaseURL === config.databaseURL); // true
|
|
95
|
+
* ```
|
|
96
|
+
*/
|
|
97
|
+
readonly options: FirebaseOptions;
|
|
98
|
+
/**
|
|
99
|
+
* The settable config flag for GDPR opt-in/opt-out
|
|
100
|
+
*/
|
|
101
|
+
automaticDataCollectionEnabled: boolean;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* @public
|
|
105
|
+
*
|
|
106
|
+
* Firebase configuration object. Contains a set of parameters required by
|
|
107
|
+
* services in order to successfully communicate with Firebase server APIs
|
|
108
|
+
* and to associate client data with your Firebase project and
|
|
109
|
+
* Firebase application. Typically this object is populated by the Firebase
|
|
110
|
+
* console at project setup. See also:
|
|
111
|
+
* {@link https://firebase.google.com/docs/web/setup#config-object | Learn about the Firebase config object}.
|
|
112
|
+
*/
|
|
113
|
+
interface FirebaseOptions {
|
|
114
|
+
/**
|
|
115
|
+
* An encrypted string used when calling certain APIs that don't need to
|
|
116
|
+
* access private user data
|
|
117
|
+
* (example value: `AIzaSyDOCAbC123dEf456GhI789jKl012-MnO`).
|
|
118
|
+
*/
|
|
119
|
+
apiKey?: string;
|
|
120
|
+
/**
|
|
121
|
+
* Auth domain for the project ID.
|
|
122
|
+
*/
|
|
123
|
+
authDomain?: string;
|
|
124
|
+
/**
|
|
125
|
+
* Default Realtime Database URL.
|
|
126
|
+
*/
|
|
127
|
+
databaseURL?: string;
|
|
128
|
+
/**
|
|
129
|
+
* The unique identifier for the project across all of Firebase and
|
|
130
|
+
* Google Cloud.
|
|
131
|
+
*/
|
|
132
|
+
projectId?: string;
|
|
133
|
+
/**
|
|
134
|
+
* The default Cloud Storage bucket name.
|
|
135
|
+
*/
|
|
136
|
+
storageBucket?: string;
|
|
137
|
+
/**
|
|
138
|
+
* Unique numerical value used to identify each sender that can send
|
|
139
|
+
* Firebase Cloud Messaging messages to client apps.
|
|
140
|
+
*/
|
|
141
|
+
messagingSenderId?: string;
|
|
142
|
+
/**
|
|
143
|
+
* Unique identifier for the app.
|
|
144
|
+
*/
|
|
145
|
+
appId?: string;
|
|
146
|
+
/**
|
|
147
|
+
* An ID automatically created when you enable Analytics in your
|
|
148
|
+
* Firebase project and register a web app. In versions 7.20.0
|
|
149
|
+
* and higher, this parameter is optional.
|
|
150
|
+
*/
|
|
151
|
+
measurementId?: string;
|
|
152
|
+
}
|
|
153
|
+
declare module '@firebase/component' {
|
|
154
|
+
interface NameServiceMapping {
|
|
155
|
+
'app': FirebaseApp;
|
|
156
|
+
'app-version': VersionService;
|
|
157
|
+
'heartbeat': HeartbeatService;
|
|
158
|
+
'platform-logger': PlatformLoggerService;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* An object that can be injected into the environment as __FIREBASE_DEFAULTS__,
|
|
164
|
+
* either as a property of globalThis, a shell environment variable, or a
|
|
165
|
+
* cookie.
|
|
166
|
+
*
|
|
167
|
+
* This object can be used to automatically configure and initialize
|
|
168
|
+
* a Firebase app as well as any emulators.
|
|
169
|
+
*
|
|
170
|
+
* @public
|
|
171
|
+
*/
|
|
172
|
+
interface FirebaseDefaults {
|
|
173
|
+
config?: Record<string, string>;
|
|
174
|
+
emulatorHosts?: Record<string, string>;
|
|
175
|
+
_authTokenSyncURL?: string;
|
|
176
|
+
_authIdTokenMaxAge?: number;
|
|
177
|
+
/**
|
|
178
|
+
* Override Firebase's runtime environment detection and
|
|
179
|
+
* force the SDK to act as if it were in the specified environment.
|
|
180
|
+
*/
|
|
181
|
+
forceEnvironment?: 'browser' | 'node';
|
|
182
|
+
[key: string]: unknown;
|
|
183
|
+
}
|
|
184
|
+
declare global {
|
|
185
|
+
var __FIREBASE_DEFAULTS__: FirebaseDefaults | undefined;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
/**
|
|
189
|
+
* @license
|
|
190
|
+
* Copyright 2020 Google LLC
|
|
191
|
+
*
|
|
192
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
* you may not use this file except in compliance with the License.
|
|
194
|
+
* You may obtain a copy of the License at
|
|
195
|
+
*
|
|
196
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
*
|
|
198
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
* See the License for the specific language governing permissions and
|
|
202
|
+
* limitations under the License.
|
|
203
|
+
*/
|
|
204
|
+
|
|
205
|
+
/**
|
|
206
|
+
* The Firebase Remote Config service interface.
|
|
207
|
+
*
|
|
208
|
+
* @public
|
|
209
|
+
*/
|
|
210
|
+
interface RemoteConfig {
|
|
211
|
+
/**
|
|
212
|
+
* The {@link @firebase/app#FirebaseApp} this `RemoteConfig` instance is associated with.
|
|
213
|
+
*/
|
|
214
|
+
app: FirebaseApp;
|
|
215
|
+
/**
|
|
216
|
+
* Defines configuration for the Remote Config SDK.
|
|
217
|
+
*/
|
|
218
|
+
settings: RemoteConfigSettings;
|
|
219
|
+
/**
|
|
220
|
+
* Object containing default values for configs.
|
|
221
|
+
*/
|
|
222
|
+
defaultConfig: {
|
|
223
|
+
[key: string]: string | number | boolean;
|
|
224
|
+
};
|
|
225
|
+
/**
|
|
226
|
+
* The Unix timestamp in milliseconds of the last <i>successful</i> fetch, or negative one if
|
|
227
|
+
* the {@link RemoteConfig} instance either hasn't fetched or initialization
|
|
228
|
+
* is incomplete.
|
|
229
|
+
*/
|
|
230
|
+
fetchTimeMillis: number;
|
|
231
|
+
/**
|
|
232
|
+
* The status of the last fetch <i>attempt</i>.
|
|
233
|
+
*/
|
|
234
|
+
lastFetchStatus: FetchStatus;
|
|
235
|
+
}
|
|
236
|
+
/**
|
|
237
|
+
* Defines a self-descriptive reference for config key-value pairs.
|
|
238
|
+
*/
|
|
239
|
+
interface FirebaseRemoteConfigObject {
|
|
240
|
+
[key: string]: string;
|
|
241
|
+
}
|
|
242
|
+
/**
|
|
243
|
+
* Defines a successful response (200 or 304).
|
|
244
|
+
*
|
|
245
|
+
* <p>Modeled after the native `Response` interface, but simplified for Remote Config's
|
|
246
|
+
* use case.
|
|
247
|
+
*/
|
|
248
|
+
interface FetchResponse {
|
|
249
|
+
/**
|
|
250
|
+
* The HTTP status, which is useful for differentiating success responses with data from
|
|
251
|
+
* those without.
|
|
252
|
+
*
|
|
253
|
+
* <p>The Remote Config client is modeled after the native `Fetch` interface, so
|
|
254
|
+
* HTTP status is first-class.
|
|
255
|
+
*
|
|
256
|
+
* <p>Disambiguation: the fetch response returns a legacy "state" value that is redundant with the
|
|
257
|
+
* HTTP status code. The former is normalized into the latter.
|
|
258
|
+
*/
|
|
259
|
+
status: number;
|
|
260
|
+
/**
|
|
261
|
+
* Defines the ETag response header value.
|
|
262
|
+
*
|
|
263
|
+
* <p>Only defined for 200 and 304 responses.
|
|
264
|
+
*/
|
|
265
|
+
eTag?: string;
|
|
266
|
+
/**
|
|
267
|
+
* Defines the map of parameters returned as "entries" in the fetch response body.
|
|
268
|
+
*
|
|
269
|
+
* <p>Only defined for 200 responses.
|
|
270
|
+
*/
|
|
271
|
+
config?: FirebaseRemoteConfigObject;
|
|
272
|
+
}
|
|
273
|
+
/**
|
|
274
|
+
* Options for Remote Config initialization.
|
|
275
|
+
*
|
|
276
|
+
* @public
|
|
277
|
+
*/
|
|
278
|
+
interface RemoteConfigOptions {
|
|
279
|
+
/**
|
|
280
|
+
* The ID of the template to use. If not provided, defaults to "firebase".
|
|
281
|
+
*/
|
|
282
|
+
templateId?: string;
|
|
283
|
+
/**
|
|
284
|
+
* Hydrates the state with an initial fetch response.
|
|
285
|
+
*/
|
|
286
|
+
initialFetchResponse?: FetchResponse;
|
|
287
|
+
}
|
|
288
|
+
/**
|
|
289
|
+
* Indicates the source of a value.
|
|
290
|
+
*
|
|
291
|
+
* <ul>
|
|
292
|
+
* <li>"static" indicates the value was defined by a static constant.</li>
|
|
293
|
+
* <li>"default" indicates the value was defined by default config.</li>
|
|
294
|
+
* <li>"remote" indicates the value was defined by fetched config.</li>
|
|
295
|
+
* </ul>
|
|
296
|
+
*
|
|
297
|
+
* @public
|
|
298
|
+
*/
|
|
299
|
+
type ValueSource = 'static' | 'default' | 'remote';
|
|
300
|
+
/**
|
|
301
|
+
* Wraps a value with metadata and type-safe getters.
|
|
302
|
+
*
|
|
303
|
+
* @public
|
|
304
|
+
*/
|
|
305
|
+
interface Value {
|
|
306
|
+
/**
|
|
307
|
+
* Gets the value as a boolean.
|
|
308
|
+
*
|
|
309
|
+
* The following values (case-insensitive) are interpreted as true:
|
|
310
|
+
* "1", "true", "t", "yes", "y", "on". Other values are interpreted as false.
|
|
311
|
+
*/
|
|
312
|
+
asBoolean(): boolean;
|
|
313
|
+
/**
|
|
314
|
+
* Gets the value as a number. Comparable to calling <code>Number(value) || 0</code>.
|
|
315
|
+
*/
|
|
316
|
+
asNumber(): number;
|
|
317
|
+
/**
|
|
318
|
+
* Gets the value as a string.
|
|
319
|
+
*/
|
|
320
|
+
asString(): string;
|
|
321
|
+
/**
|
|
322
|
+
* Gets the {@link ValueSource} for the given key.
|
|
323
|
+
*/
|
|
324
|
+
getSource(): ValueSource;
|
|
325
|
+
}
|
|
326
|
+
/**
|
|
327
|
+
* Defines configuration options for the Remote Config SDK.
|
|
328
|
+
*
|
|
329
|
+
* @public
|
|
330
|
+
*/
|
|
331
|
+
interface RemoteConfigSettings {
|
|
332
|
+
/**
|
|
333
|
+
* Defines the maximum age in milliseconds of an entry in the config cache before
|
|
334
|
+
* it is considered stale. Defaults to 43200000 (Twelve hours).
|
|
335
|
+
*/
|
|
336
|
+
minimumFetchIntervalMillis: number;
|
|
337
|
+
/**
|
|
338
|
+
* Defines the maximum amount of milliseconds to wait for a response when fetching
|
|
339
|
+
* configuration from the Remote Config server. Defaults to 60000 (One minute).
|
|
340
|
+
*/
|
|
341
|
+
fetchTimeoutMillis: number;
|
|
342
|
+
}
|
|
343
|
+
/**
|
|
344
|
+
* Summarizes the outcome of the last attempt to fetch config from the Firebase Remote Config server.
|
|
345
|
+
*
|
|
346
|
+
* <ul>
|
|
347
|
+
* <li>"no-fetch-yet" indicates the {@link RemoteConfig} instance has not yet attempted
|
|
348
|
+
* to fetch config, or that SDK initialization is incomplete.</li>
|
|
349
|
+
* <li>"success" indicates the last attempt succeeded.</li>
|
|
350
|
+
* <li>"failure" indicates the last attempt failed.</li>
|
|
351
|
+
* <li>"throttle" indicates the last attempt was rate-limited.</li>
|
|
352
|
+
* </ul>
|
|
353
|
+
*
|
|
354
|
+
* @public
|
|
355
|
+
*/
|
|
356
|
+
type FetchStatus = 'no-fetch-yet' | 'success' | 'failure' | 'throttle';
|
|
357
|
+
/**
|
|
358
|
+
* Defines levels of Remote Config logging.
|
|
359
|
+
*
|
|
360
|
+
* @public
|
|
361
|
+
*/
|
|
362
|
+
type LogLevel = 'debug' | 'error' | 'silent';
|
|
363
|
+
/**
|
|
364
|
+
* Defines the type for representing custom signals and their values.
|
|
365
|
+
*
|
|
366
|
+
* <p>The values in CustomSignals must be one of the following types:
|
|
367
|
+
*
|
|
368
|
+
* <ul>
|
|
369
|
+
* <li><code>string</code>
|
|
370
|
+
* <li><code>number</code>
|
|
371
|
+
* <li><code>null</code>
|
|
372
|
+
* </ul>
|
|
373
|
+
*
|
|
374
|
+
* @public
|
|
375
|
+
*/
|
|
376
|
+
interface CustomSignals {
|
|
377
|
+
[key: string]: string | number | null;
|
|
378
|
+
}
|
|
379
|
+
declare module '@firebase/component' {
|
|
380
|
+
interface NameServiceMapping {
|
|
381
|
+
'remote-config': RemoteConfig;
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
/**
|
|
386
|
+
* @license
|
|
387
|
+
* Copyright 2020 Google LLC
|
|
388
|
+
*
|
|
389
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
390
|
+
* you may not use this file except in compliance with the License.
|
|
391
|
+
* You may obtain a copy of the License at
|
|
392
|
+
*
|
|
393
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
394
|
+
*
|
|
395
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
396
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
397
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
398
|
+
* See the License for the specific language governing permissions and
|
|
399
|
+
* limitations under the License.
|
|
400
|
+
*/
|
|
401
|
+
|
|
402
|
+
/**
|
|
403
|
+
*
|
|
404
|
+
* @param app - The {@link @firebase/app#FirebaseApp} instance.
|
|
405
|
+
* @param options - Optional. The {@link RemoteConfigOptions} with which to instantiate the
|
|
406
|
+
* Remote Config instance.
|
|
407
|
+
* @returns A {@link RemoteConfig} instance.
|
|
408
|
+
*
|
|
409
|
+
* @public
|
|
410
|
+
*/
|
|
411
|
+
declare function getRemoteConfig(app?: FirebaseApp, options?: RemoteConfigOptions): RemoteConfig;
|
|
412
|
+
/**
|
|
413
|
+
* Makes the last fetched config available to the getters.
|
|
414
|
+
* @param remoteConfig - The {@link RemoteConfig} instance.
|
|
415
|
+
* @returns A `Promise` which resolves to true if the current call activated the fetched configs.
|
|
416
|
+
* If the fetched configs were already activated, the `Promise` will resolve to false.
|
|
417
|
+
*
|
|
418
|
+
* @public
|
|
419
|
+
*/
|
|
420
|
+
declare function activate(remoteConfig: RemoteConfig): Promise<boolean>;
|
|
421
|
+
/**
|
|
422
|
+
* Ensures the last activated config are available to the getters.
|
|
423
|
+
* @param remoteConfig - The {@link RemoteConfig} instance.
|
|
424
|
+
*
|
|
425
|
+
* @returns A `Promise` that resolves when the last activated config is available to the getters.
|
|
426
|
+
* @public
|
|
427
|
+
*/
|
|
428
|
+
declare function ensureInitialized(remoteConfig: RemoteConfig): Promise<void>;
|
|
429
|
+
/**
|
|
430
|
+
* Fetches and caches configuration from the Remote Config service.
|
|
431
|
+
* @param remoteConfig - The {@link RemoteConfig} instance.
|
|
432
|
+
* @public
|
|
433
|
+
*/
|
|
434
|
+
declare function fetchConfig(remoteConfig: RemoteConfig): Promise<void>;
|
|
435
|
+
/**
|
|
436
|
+
* Gets all config.
|
|
437
|
+
*
|
|
438
|
+
* @param remoteConfig - The {@link RemoteConfig} instance.
|
|
439
|
+
* @returns All config.
|
|
440
|
+
*
|
|
441
|
+
* @public
|
|
442
|
+
*/
|
|
443
|
+
declare function getAll(remoteConfig: RemoteConfig): Record<string, Value>;
|
|
444
|
+
/**
|
|
445
|
+
* Gets the value for the given key as a boolean.
|
|
446
|
+
*
|
|
447
|
+
* Convenience method for calling <code>remoteConfig.getValue(key).asBoolean()</code>.
|
|
448
|
+
*
|
|
449
|
+
* @param remoteConfig - The {@link RemoteConfig} instance.
|
|
450
|
+
* @param key - The name of the parameter.
|
|
451
|
+
*
|
|
452
|
+
* @returns The value for the given key as a boolean.
|
|
453
|
+
* @public
|
|
454
|
+
*/
|
|
455
|
+
declare function getBoolean(remoteConfig: RemoteConfig, key: string): boolean;
|
|
456
|
+
/**
|
|
457
|
+
* Gets the value for the given key as a number.
|
|
458
|
+
*
|
|
459
|
+
* Convenience method for calling <code>remoteConfig.getValue(key).asNumber()</code>.
|
|
460
|
+
*
|
|
461
|
+
* @param remoteConfig - The {@link RemoteConfig} instance.
|
|
462
|
+
* @param key - The name of the parameter.
|
|
463
|
+
*
|
|
464
|
+
* @returns The value for the given key as a number.
|
|
465
|
+
*
|
|
466
|
+
* @public
|
|
467
|
+
*/
|
|
468
|
+
declare function getNumber(remoteConfig: RemoteConfig, key: string): number;
|
|
469
|
+
/**
|
|
470
|
+
* Gets the value for the given key as a string.
|
|
471
|
+
* Convenience method for calling <code>remoteConfig.getValue(key).asString()</code>.
|
|
472
|
+
*
|
|
473
|
+
* @param remoteConfig - The {@link RemoteConfig} instance.
|
|
474
|
+
* @param key - The name of the parameter.
|
|
475
|
+
*
|
|
476
|
+
* @returns The value for the given key as a string.
|
|
477
|
+
*
|
|
478
|
+
* @public
|
|
479
|
+
*/
|
|
480
|
+
declare function getString(remoteConfig: RemoteConfig, key: string): string;
|
|
481
|
+
/**
|
|
482
|
+
* Gets the {@link Value} for the given key.
|
|
483
|
+
*
|
|
484
|
+
* @param remoteConfig - The {@link RemoteConfig} instance.
|
|
485
|
+
* @param key - The name of the parameter.
|
|
486
|
+
*
|
|
487
|
+
* @returns The value for the given key.
|
|
488
|
+
*
|
|
489
|
+
* @public
|
|
490
|
+
*/
|
|
491
|
+
declare function getValue(remoteConfig: RemoteConfig, key: string): Value;
|
|
492
|
+
/**
|
|
493
|
+
* Defines the log level to use.
|
|
494
|
+
*
|
|
495
|
+
* @param remoteConfig - The {@link RemoteConfig} instance.
|
|
496
|
+
* @param logLevel - The log level to set.
|
|
497
|
+
*
|
|
498
|
+
* @public
|
|
499
|
+
*/
|
|
500
|
+
declare function setLogLevel(remoteConfig: RemoteConfig, logLevel: LogLevel): void;
|
|
501
|
+
/**
|
|
502
|
+
* Sets the custom signals for the app instance.
|
|
503
|
+
*
|
|
504
|
+
* @param remoteConfig - The {@link RemoteConfig} instance.
|
|
505
|
+
* @param customSignals - Map (key, value) of the custom signals to be set for the app instance. If
|
|
506
|
+
* a key already exists, the value is overwritten. Setting the value of a custom signal to null
|
|
507
|
+
* unsets the signal. The signals will be persisted locally on the client.
|
|
508
|
+
*
|
|
509
|
+
* @public
|
|
510
|
+
*/
|
|
511
|
+
declare function setCustomSignals(remoteConfig: RemoteConfig, customSignals: CustomSignals): Promise<void>;
|
|
512
|
+
|
|
513
|
+
/**
|
|
514
|
+
* @license
|
|
515
|
+
* Copyright 2020 Google LLC
|
|
516
|
+
*
|
|
517
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
518
|
+
* you may not use this file except in compliance with the License.
|
|
519
|
+
* You may obtain a copy of the License at
|
|
520
|
+
*
|
|
521
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
522
|
+
*
|
|
523
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
524
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
525
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
526
|
+
* See the License for the specific language governing permissions and
|
|
527
|
+
* limitations under the License.
|
|
528
|
+
*/
|
|
529
|
+
|
|
530
|
+
/**
|
|
531
|
+
*
|
|
532
|
+
* Performs fetch and activate operations, as a convenience.
|
|
533
|
+
*
|
|
534
|
+
* @param remoteConfig - The {@link RemoteConfig} instance.
|
|
535
|
+
*
|
|
536
|
+
* @returns A `Promise` which resolves to true if the current call activated the fetched configs.
|
|
537
|
+
* If the fetched configs were already activated, the `Promise` will resolve to false.
|
|
538
|
+
*
|
|
539
|
+
* @public
|
|
540
|
+
*/
|
|
541
|
+
declare function fetchAndActivate(remoteConfig: RemoteConfig): Promise<boolean>;
|
|
542
|
+
/**
|
|
543
|
+
* This method provides two different checks:
|
|
544
|
+
*
|
|
545
|
+
* 1. Check if IndexedDB exists in the browser environment.
|
|
546
|
+
* 2. Check if the current browser context allows IndexedDB `open()` calls.
|
|
547
|
+
*
|
|
548
|
+
* @returns A `Promise` which resolves to true if a {@link RemoteConfig} instance
|
|
549
|
+
* can be initialized in this environment, or false if it cannot.
|
|
550
|
+
* @public
|
|
551
|
+
*/
|
|
552
|
+
declare function isSupported(): Promise<boolean>;
|
|
553
|
+
|
|
554
|
+
/**
|
|
555
|
+
* The Firebase Remote Config Web SDK.
|
|
556
|
+
* This SDK does not work in a Node.js environment.
|
|
557
|
+
*
|
|
558
|
+
* @packageDocumentation
|
|
559
|
+
*/
|
|
560
|
+
declare global {
|
|
561
|
+
interface Window {
|
|
562
|
+
FIREBASE_REMOTE_CONFIG_URL_BASE: string;
|
|
563
|
+
}
|
|
564
|
+
}
|
|
565
|
+
|
|
566
|
+
export { CustomSignals, FetchResponse, FetchStatus, FirebaseRemoteConfigObject, LogLevel, RemoteConfig, RemoteConfigOptions, RemoteConfigSettings, Value, ValueSource, activate, ensureInitialized, fetchAndActivate, fetchConfig, getAll, getBoolean, getNumber, getRemoteConfig, getString, getValue, isSupported, setCustomSignals, setLogLevel };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@firebase/remote-config",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.5",
|
|
4
4
|
"description": "The Remote Config package of the Firebase JS SDK",
|
|
5
5
|
"author": "Firebase <firebase-support@google.com> (https://firebase.google.com/)",
|
|
6
6
|
"main": "dist/index.cjs.js",
|
|
@@ -40,16 +40,17 @@
|
|
|
40
40
|
"@firebase/app": "0.x"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@firebase/installations": "0.6.
|
|
43
|
+
"@firebase/installations": "0.6.18",
|
|
44
44
|
"@firebase/logger": "0.4.4",
|
|
45
|
-
"@firebase/util": "1.12.
|
|
46
|
-
"@firebase/component": "0.6.
|
|
45
|
+
"@firebase/util": "1.12.1",
|
|
46
|
+
"@firebase/component": "0.6.18",
|
|
47
47
|
"tslib": "^2.1.0"
|
|
48
48
|
},
|
|
49
49
|
"license": "Apache-2.0",
|
|
50
50
|
"devDependencies": {
|
|
51
|
-
"@firebase/app": "0.13.
|
|
51
|
+
"@firebase/app": "0.13.2",
|
|
52
52
|
"rollup": "2.79.2",
|
|
53
|
+
"rollup-plugin-dts": "5.3.1",
|
|
53
54
|
"rollup-plugin-typescript2": "0.36.0",
|
|
54
55
|
"typescript": "5.5.4"
|
|
55
56
|
},
|