@firebase/remote-config 0.4.10 → 0.4.11
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 +1193 -1193
- package/dist/esm/index.esm2017.js.map +1 -1
- package/dist/esm/src/api.d.ts +115 -115
- package/dist/esm/src/api2.d.ts +40 -40
- package/dist/esm/src/client/caching_client.d.ts +45 -45
- package/dist/esm/src/client/remote_config_fetch_client.d.ts +123 -123
- package/dist/esm/src/client/rest_client.d.ts +40 -40
- package/dist/esm/src/client/retrying_client.d.ts +49 -49
- package/dist/esm/src/constants.d.ts +17 -17
- package/dist/esm/src/errors.d.ts +62 -62
- package/dist/esm/src/index.d.ts +14 -14
- package/dist/esm/src/language.d.ts +26 -26
- package/dist/esm/src/public_types.d.ts +128 -128
- package/dist/esm/src/register.d.ts +2 -2
- package/dist/esm/src/remote_config.d.ts +79 -79
- package/dist/esm/src/storage/storage.d.ts +76 -76
- package/dist/esm/src/storage/storage_cache.d.ts +48 -48
- package/dist/esm/src/value.d.ts +26 -26
- package/dist/esm/test/client/caching_client.test.d.ts +17 -17
- package/dist/esm/test/client/rest_client.test.d.ts +17 -17
- package/dist/esm/test/client/retrying_client.test.d.ts +17 -17
- package/dist/esm/test/errors.test.d.ts +17 -17
- package/dist/esm/test/language.test.d.ts +17 -17
- package/dist/esm/test/remote_config.test.d.ts +17 -17
- package/dist/esm/test/setup.d.ts +17 -17
- package/dist/esm/test/storage/storage.test.d.ts +17 -17
- package/dist/esm/test/storage/storage_cache.test.d.ts +17 -17
- package/dist/esm/test/value.test.d.ts +17 -17
- package/dist/index.cjs.js +1193 -1193
- package/dist/index.cjs.js.map +1 -1
- package/dist/src/api.d.ts +115 -115
- package/dist/src/api2.d.ts +40 -40
- package/dist/src/client/caching_client.d.ts +45 -45
- package/dist/src/client/remote_config_fetch_client.d.ts +123 -123
- package/dist/src/client/rest_client.d.ts +40 -40
- package/dist/src/client/retrying_client.d.ts +49 -49
- package/dist/src/constants.d.ts +17 -17
- package/dist/src/errors.d.ts +62 -62
- package/dist/src/index.d.ts +14 -14
- package/dist/src/language.d.ts +26 -26
- package/dist/src/public_types.d.ts +128 -128
- package/dist/src/register.d.ts +2 -2
- package/dist/src/remote_config.d.ts +79 -79
- package/dist/src/storage/storage.d.ts +76 -76
- package/dist/src/storage/storage_cache.d.ts +48 -48
- package/dist/src/value.d.ts +26 -26
- package/dist/test/client/caching_client.test.d.ts +17 -17
- package/dist/test/client/rest_client.test.d.ts +17 -17
- package/dist/test/client/retrying_client.test.d.ts +17 -17
- package/dist/test/errors.test.d.ts +17 -17
- package/dist/test/language.test.d.ts +17 -17
- package/dist/test/remote_config.test.d.ts +17 -17
- package/dist/test/setup.d.ts +17 -17
- package/dist/test/storage/storage.test.d.ts +17 -17
- package/dist/test/storage/storage_cache.test.d.ts +17 -17
- package/dist/test/value.test.d.ts +17 -17
- package/package.json +7 -7
|
@@ -1,128 +1,128 @@
|
|
|
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 } 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
|
-
* Indicates the source of a value.
|
|
51
|
-
*
|
|
52
|
-
* <ul>
|
|
53
|
-
* <li>"static" indicates the value was defined by a static constant.</li>
|
|
54
|
-
* <li>"default" indicates the value was defined by default config.</li>
|
|
55
|
-
* <li>"remote" indicates the value was defined by fetched config.</li>
|
|
56
|
-
* </ul>
|
|
57
|
-
*
|
|
58
|
-
* @public
|
|
59
|
-
*/
|
|
60
|
-
export
|
|
61
|
-
/**
|
|
62
|
-
* Wraps a value with metadata and type-safe getters.
|
|
63
|
-
*
|
|
64
|
-
* @public
|
|
65
|
-
*/
|
|
66
|
-
export interface Value {
|
|
67
|
-
/**
|
|
68
|
-
* Gets the value as a boolean.
|
|
69
|
-
*
|
|
70
|
-
* The following values (case-insensitive) are interpreted as true:
|
|
71
|
-
* "1", "true", "t", "yes", "y", "on". Other values are interpreted as false.
|
|
72
|
-
*/
|
|
73
|
-
asBoolean(): boolean;
|
|
74
|
-
/**
|
|
75
|
-
* Gets the value as a number. Comparable to calling <code>Number(value) || 0</code>.
|
|
76
|
-
*/
|
|
77
|
-
asNumber(): number;
|
|
78
|
-
/**
|
|
79
|
-
* Gets the value as a string.
|
|
80
|
-
*/
|
|
81
|
-
asString(): string;
|
|
82
|
-
/**
|
|
83
|
-
* Gets the {@link ValueSource} for the given key.
|
|
84
|
-
*/
|
|
85
|
-
getSource(): ValueSource;
|
|
86
|
-
}
|
|
87
|
-
/**
|
|
88
|
-
* Defines configuration options for the Remote Config SDK.
|
|
89
|
-
*
|
|
90
|
-
* @public
|
|
91
|
-
*/
|
|
92
|
-
export interface RemoteConfigSettings {
|
|
93
|
-
/**
|
|
94
|
-
* Defines the maximum age in milliseconds of an entry in the config cache before
|
|
95
|
-
* it is considered stale. Defaults to 43200000 (Twelve hours).
|
|
96
|
-
*/
|
|
97
|
-
minimumFetchIntervalMillis: number;
|
|
98
|
-
/**
|
|
99
|
-
* Defines the maximum amount of milliseconds to wait for a response when fetching
|
|
100
|
-
* configuration from the Remote Config server. Defaults to 60000 (One minute).
|
|
101
|
-
*/
|
|
102
|
-
fetchTimeoutMillis: number;
|
|
103
|
-
}
|
|
104
|
-
/**
|
|
105
|
-
* Summarizes the outcome of the last attempt to fetch config from the Firebase Remote Config server.
|
|
106
|
-
*
|
|
107
|
-
* <ul>
|
|
108
|
-
* <li>"no-fetch-yet" indicates the {@link RemoteConfig} instance has not yet attempted
|
|
109
|
-
* to fetch config, or that SDK initialization is incomplete.</li>
|
|
110
|
-
* <li>"success" indicates the last attempt succeeded.</li>
|
|
111
|
-
* <li>"failure" indicates the last attempt failed.</li>
|
|
112
|
-
* <li>"throttle" indicates the last attempt was rate-limited.</li>
|
|
113
|
-
* </ul>
|
|
114
|
-
*
|
|
115
|
-
* @public
|
|
116
|
-
*/
|
|
117
|
-
export
|
|
118
|
-
/**
|
|
119
|
-
* Defines levels of Remote Config logging.
|
|
120
|
-
*
|
|
121
|
-
* @public
|
|
122
|
-
*/
|
|
123
|
-
export
|
|
124
|
-
declare module '@firebase/component' {
|
|
125
|
-
interface NameServiceMapping {
|
|
126
|
-
'remote-config': RemoteConfig;
|
|
127
|
-
}
|
|
128
|
-
}
|
|
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 } 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
|
+
* Indicates the source of a value.
|
|
51
|
+
*
|
|
52
|
+
* <ul>
|
|
53
|
+
* <li>"static" indicates the value was defined by a static constant.</li>
|
|
54
|
+
* <li>"default" indicates the value was defined by default config.</li>
|
|
55
|
+
* <li>"remote" indicates the value was defined by fetched config.</li>
|
|
56
|
+
* </ul>
|
|
57
|
+
*
|
|
58
|
+
* @public
|
|
59
|
+
*/
|
|
60
|
+
export type ValueSource = 'static' | 'default' | 'remote';
|
|
61
|
+
/**
|
|
62
|
+
* Wraps a value with metadata and type-safe getters.
|
|
63
|
+
*
|
|
64
|
+
* @public
|
|
65
|
+
*/
|
|
66
|
+
export interface Value {
|
|
67
|
+
/**
|
|
68
|
+
* Gets the value as a boolean.
|
|
69
|
+
*
|
|
70
|
+
* The following values (case-insensitive) are interpreted as true:
|
|
71
|
+
* "1", "true", "t", "yes", "y", "on". Other values are interpreted as false.
|
|
72
|
+
*/
|
|
73
|
+
asBoolean(): boolean;
|
|
74
|
+
/**
|
|
75
|
+
* Gets the value as a number. Comparable to calling <code>Number(value) || 0</code>.
|
|
76
|
+
*/
|
|
77
|
+
asNumber(): number;
|
|
78
|
+
/**
|
|
79
|
+
* Gets the value as a string.
|
|
80
|
+
*/
|
|
81
|
+
asString(): string;
|
|
82
|
+
/**
|
|
83
|
+
* Gets the {@link ValueSource} for the given key.
|
|
84
|
+
*/
|
|
85
|
+
getSource(): ValueSource;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Defines configuration options for the Remote Config SDK.
|
|
89
|
+
*
|
|
90
|
+
* @public
|
|
91
|
+
*/
|
|
92
|
+
export interface RemoteConfigSettings {
|
|
93
|
+
/**
|
|
94
|
+
* Defines the maximum age in milliseconds of an entry in the config cache before
|
|
95
|
+
* it is considered stale. Defaults to 43200000 (Twelve hours).
|
|
96
|
+
*/
|
|
97
|
+
minimumFetchIntervalMillis: number;
|
|
98
|
+
/**
|
|
99
|
+
* Defines the maximum amount of milliseconds to wait for a response when fetching
|
|
100
|
+
* configuration from the Remote Config server. Defaults to 60000 (One minute).
|
|
101
|
+
*/
|
|
102
|
+
fetchTimeoutMillis: number;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Summarizes the outcome of the last attempt to fetch config from the Firebase Remote Config server.
|
|
106
|
+
*
|
|
107
|
+
* <ul>
|
|
108
|
+
* <li>"no-fetch-yet" indicates the {@link RemoteConfig} instance has not yet attempted
|
|
109
|
+
* to fetch config, or that SDK initialization is incomplete.</li>
|
|
110
|
+
* <li>"success" indicates the last attempt succeeded.</li>
|
|
111
|
+
* <li>"failure" indicates the last attempt failed.</li>
|
|
112
|
+
* <li>"throttle" indicates the last attempt was rate-limited.</li>
|
|
113
|
+
* </ul>
|
|
114
|
+
*
|
|
115
|
+
* @public
|
|
116
|
+
*/
|
|
117
|
+
export type FetchStatus = 'no-fetch-yet' | 'success' | 'failure' | 'throttle';
|
|
118
|
+
/**
|
|
119
|
+
* Defines levels of Remote Config logging.
|
|
120
|
+
*
|
|
121
|
+
* @public
|
|
122
|
+
*/
|
|
123
|
+
export type LogLevel = 'debug' | 'error' | 'silent';
|
|
124
|
+
declare module '@firebase/component' {
|
|
125
|
+
interface NameServiceMapping {
|
|
126
|
+
'remote-config': RemoteConfig;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import '@firebase/installations';
|
|
2
|
-
export declare function registerRemoteConfig(): void;
|
|
1
|
+
import '@firebase/installations';
|
|
2
|
+
export declare function registerRemoteConfig(): void;
|
|
@@ -1,79 +1,79 @@
|
|
|
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
|
-
/**
|
|
24
|
-
* Encapsulates business logic mapping network and storage dependencies to the public SDK API.
|
|
25
|
-
*
|
|
26
|
-
* See {@link https://github.com/firebase/firebase-js-sdk/blob/main/packages/firebase/index.d.ts|interface documentation} for method descriptions.
|
|
27
|
-
*/
|
|
28
|
-
export declare class RemoteConfig implements RemoteConfigType {
|
|
29
|
-
readonly app: FirebaseApp;
|
|
30
|
-
/**
|
|
31
|
-
* @internal
|
|
32
|
-
*/
|
|
33
|
-
readonly _client: RemoteConfigFetchClient;
|
|
34
|
-
/**
|
|
35
|
-
* @internal
|
|
36
|
-
*/
|
|
37
|
-
readonly _storageCache: StorageCache;
|
|
38
|
-
/**
|
|
39
|
-
* @internal
|
|
40
|
-
*/
|
|
41
|
-
readonly _storage: Storage;
|
|
42
|
-
/**
|
|
43
|
-
* @internal
|
|
44
|
-
*/
|
|
45
|
-
readonly _logger: Logger;
|
|
46
|
-
/**
|
|
47
|
-
* Tracks completion of initialization promise.
|
|
48
|
-
* @internal
|
|
49
|
-
*/
|
|
50
|
-
_isInitializationComplete: boolean;
|
|
51
|
-
/**
|
|
52
|
-
* De-duplicates initialization calls.
|
|
53
|
-
* @internal
|
|
54
|
-
*/
|
|
55
|
-
_initializePromise?: Promise<void>;
|
|
56
|
-
settings: RemoteConfigSettings;
|
|
57
|
-
defaultConfig: {
|
|
58
|
-
[key: string]: string | number | boolean;
|
|
59
|
-
};
|
|
60
|
-
get fetchTimeMillis(): number;
|
|
61
|
-
get lastFetchStatus(): FetchStatus;
|
|
62
|
-
constructor(app: FirebaseApp,
|
|
63
|
-
/**
|
|
64
|
-
* @internal
|
|
65
|
-
*/
|
|
66
|
-
_client: RemoteConfigFetchClient,
|
|
67
|
-
/**
|
|
68
|
-
* @internal
|
|
69
|
-
*/
|
|
70
|
-
_storageCache: StorageCache,
|
|
71
|
-
/**
|
|
72
|
-
* @internal
|
|
73
|
-
*/
|
|
74
|
-
_storage: Storage,
|
|
75
|
-
/**
|
|
76
|
-
* @internal
|
|
77
|
-
*/
|
|
78
|
-
_logger: Logger);
|
|
79
|
-
}
|
|
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
|
+
/**
|
|
24
|
+
* Encapsulates business logic mapping network and storage dependencies to the public SDK API.
|
|
25
|
+
*
|
|
26
|
+
* See {@link https://github.com/firebase/firebase-js-sdk/blob/main/packages/firebase/index.d.ts|interface documentation} for method descriptions.
|
|
27
|
+
*/
|
|
28
|
+
export declare class RemoteConfig implements RemoteConfigType {
|
|
29
|
+
readonly app: FirebaseApp;
|
|
30
|
+
/**
|
|
31
|
+
* @internal
|
|
32
|
+
*/
|
|
33
|
+
readonly _client: RemoteConfigFetchClient;
|
|
34
|
+
/**
|
|
35
|
+
* @internal
|
|
36
|
+
*/
|
|
37
|
+
readonly _storageCache: StorageCache;
|
|
38
|
+
/**
|
|
39
|
+
* @internal
|
|
40
|
+
*/
|
|
41
|
+
readonly _storage: Storage;
|
|
42
|
+
/**
|
|
43
|
+
* @internal
|
|
44
|
+
*/
|
|
45
|
+
readonly _logger: Logger;
|
|
46
|
+
/**
|
|
47
|
+
* Tracks completion of initialization promise.
|
|
48
|
+
* @internal
|
|
49
|
+
*/
|
|
50
|
+
_isInitializationComplete: boolean;
|
|
51
|
+
/**
|
|
52
|
+
* De-duplicates initialization calls.
|
|
53
|
+
* @internal
|
|
54
|
+
*/
|
|
55
|
+
_initializePromise?: Promise<void>;
|
|
56
|
+
settings: RemoteConfigSettings;
|
|
57
|
+
defaultConfig: {
|
|
58
|
+
[key: string]: string | number | boolean;
|
|
59
|
+
};
|
|
60
|
+
get fetchTimeMillis(): number;
|
|
61
|
+
get lastFetchStatus(): FetchStatus;
|
|
62
|
+
constructor(app: FirebaseApp,
|
|
63
|
+
/**
|
|
64
|
+
* @internal
|
|
65
|
+
*/
|
|
66
|
+
_client: RemoteConfigFetchClient,
|
|
67
|
+
/**
|
|
68
|
+
* @internal
|
|
69
|
+
*/
|
|
70
|
+
_storageCache: StorageCache,
|
|
71
|
+
/**
|
|
72
|
+
* @internal
|
|
73
|
+
*/
|
|
74
|
+
_storage: Storage,
|
|
75
|
+
/**
|
|
76
|
+
* @internal
|
|
77
|
+
*/
|
|
78
|
+
_logger: Logger);
|
|
79
|
+
}
|
|
@@ -1,76 +1,76 @@
|
|
|
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 } from '@firebase/remote-config-types';
|
|
18
|
-
import { FetchResponse, FirebaseRemoteConfigObject } from '../client/remote_config_fetch_client';
|
|
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
|
-
/**
|
|
38
|
-
* Provides type-safety for the "key" field used by {@link APP_NAMESPACE_STORE}.
|
|
39
|
-
*
|
|
40
|
-
* <p>This seems like a small price to avoid potentially subtle bugs caused by a typo.
|
|
41
|
-
*/
|
|
42
|
-
|
|
43
|
-
export declare function openDatabase(): Promise<IDBDatabase>;
|
|
44
|
-
/**
|
|
45
|
-
* Abstracts data persistence.
|
|
46
|
-
*/
|
|
47
|
-
export declare class Storage {
|
|
48
|
-
private readonly appId;
|
|
49
|
-
private readonly appName;
|
|
50
|
-
private readonly namespace;
|
|
51
|
-
private readonly openDbPromise;
|
|
52
|
-
/**
|
|
53
|
-
* @param appId enables storage segmentation by app (ID + name).
|
|
54
|
-
* @param appName enables storage segmentation by app (ID + name).
|
|
55
|
-
* @param namespace enables storage segmentation by namespace.
|
|
56
|
-
*/
|
|
57
|
-
constructor(appId: string, appName: string, namespace: string, openDbPromise?: Promise<IDBDatabase>);
|
|
58
|
-
getLastFetchStatus(): Promise<FetchStatus | undefined>;
|
|
59
|
-
setLastFetchStatus(status: FetchStatus): Promise<void>;
|
|
60
|
-
getLastSuccessfulFetchTimestampMillis(): Promise<number | undefined>;
|
|
61
|
-
setLastSuccessfulFetchTimestampMillis(timestamp: number): Promise<void>;
|
|
62
|
-
getLastSuccessfulFetchResponse(): Promise<FetchResponse | undefined>;
|
|
63
|
-
setLastSuccessfulFetchResponse(response: FetchResponse): Promise<void>;
|
|
64
|
-
getActiveConfig(): Promise<FirebaseRemoteConfigObject | undefined>;
|
|
65
|
-
setActiveConfig(config: FirebaseRemoteConfigObject): Promise<void>;
|
|
66
|
-
getActiveConfigEtag(): Promise<string | undefined>;
|
|
67
|
-
setActiveConfigEtag(etag: string): Promise<void>;
|
|
68
|
-
getThrottleMetadata(): Promise<ThrottleMetadata | undefined>;
|
|
69
|
-
setThrottleMetadata(metadata: ThrottleMetadata): Promise<void>;
|
|
70
|
-
deleteThrottleMetadata(): Promise<void>;
|
|
71
|
-
get<T>(key: ProjectNamespaceKeyFieldValue): Promise<T | undefined>;
|
|
72
|
-
set<T>(key: ProjectNamespaceKeyFieldValue, value: T): Promise<void>;
|
|
73
|
-
delete(key: ProjectNamespaceKeyFieldValue): Promise<void>;
|
|
74
|
-
createCompositeKey(key: ProjectNamespaceKeyFieldValue): string;
|
|
75
|
-
}
|
|
76
|
-
export {};
|
|
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 } from '@firebase/remote-config-types';
|
|
18
|
+
import { FetchResponse, FirebaseRemoteConfigObject } from '../client/remote_config_fetch_client';
|
|
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
|
+
/**
|
|
38
|
+
* Provides type-safety for the "key" field used by {@link APP_NAMESPACE_STORE}.
|
|
39
|
+
*
|
|
40
|
+
* <p>This seems like a small price to avoid potentially subtle bugs caused by a typo.
|
|
41
|
+
*/
|
|
42
|
+
type ProjectNamespaceKeyFieldValue = 'active_config' | 'active_config_etag' | 'last_fetch_status' | 'last_successful_fetch_timestamp_millis' | 'last_successful_fetch_response' | 'settings' | 'throttle_metadata';
|
|
43
|
+
export declare function openDatabase(): Promise<IDBDatabase>;
|
|
44
|
+
/**
|
|
45
|
+
* Abstracts data persistence.
|
|
46
|
+
*/
|
|
47
|
+
export declare class Storage {
|
|
48
|
+
private readonly appId;
|
|
49
|
+
private readonly appName;
|
|
50
|
+
private readonly namespace;
|
|
51
|
+
private readonly openDbPromise;
|
|
52
|
+
/**
|
|
53
|
+
* @param appId enables storage segmentation by app (ID + name).
|
|
54
|
+
* @param appName enables storage segmentation by app (ID + name).
|
|
55
|
+
* @param namespace enables storage segmentation by namespace.
|
|
56
|
+
*/
|
|
57
|
+
constructor(appId: string, appName: string, namespace: string, openDbPromise?: Promise<IDBDatabase>);
|
|
58
|
+
getLastFetchStatus(): Promise<FetchStatus | undefined>;
|
|
59
|
+
setLastFetchStatus(status: FetchStatus): Promise<void>;
|
|
60
|
+
getLastSuccessfulFetchTimestampMillis(): Promise<number | undefined>;
|
|
61
|
+
setLastSuccessfulFetchTimestampMillis(timestamp: number): Promise<void>;
|
|
62
|
+
getLastSuccessfulFetchResponse(): Promise<FetchResponse | undefined>;
|
|
63
|
+
setLastSuccessfulFetchResponse(response: FetchResponse): Promise<void>;
|
|
64
|
+
getActiveConfig(): Promise<FirebaseRemoteConfigObject | undefined>;
|
|
65
|
+
setActiveConfig(config: FirebaseRemoteConfigObject): Promise<void>;
|
|
66
|
+
getActiveConfigEtag(): Promise<string | undefined>;
|
|
67
|
+
setActiveConfigEtag(etag: string): Promise<void>;
|
|
68
|
+
getThrottleMetadata(): Promise<ThrottleMetadata | undefined>;
|
|
69
|
+
setThrottleMetadata(metadata: ThrottleMetadata): Promise<void>;
|
|
70
|
+
deleteThrottleMetadata(): Promise<void>;
|
|
71
|
+
get<T>(key: ProjectNamespaceKeyFieldValue): Promise<T | undefined>;
|
|
72
|
+
set<T>(key: ProjectNamespaceKeyFieldValue, value: T): Promise<void>;
|
|
73
|
+
delete(key: ProjectNamespaceKeyFieldValue): Promise<void>;
|
|
74
|
+
createCompositeKey(key: ProjectNamespaceKeyFieldValue): string;
|
|
75
|
+
}
|
|
76
|
+
export {};
|