@firebase/remote-config 0.3.0 → 0.3.1-canary.2322b6023
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/CHANGELOG.md +9 -0
- package/dist/{index.esm.js → esm/index.esm.js} +5 -2
- package/dist/esm/index.esm.js.map +1 -0
- package/dist/{index.esm2017.js → esm/index.esm2017.js} +5 -2
- package/dist/esm/index.esm2017.js.map +1 -0
- package/dist/esm/package.json +1 -0
- package/dist/esm/src/api.d.ts +115 -0
- package/dist/esm/src/api2.d.ts +40 -0
- package/dist/esm/src/client/caching_client.d.ts +45 -0
- package/dist/esm/src/client/remote_config_fetch_client.d.ts +123 -0
- package/dist/esm/src/client/rest_client.d.ts +40 -0
- package/dist/esm/src/client/retrying_client.d.ts +49 -0
- package/dist/esm/src/constants.d.ts +17 -0
- package/dist/esm/src/errors.d.ts +62 -0
- package/dist/esm/src/index.d.ts +13 -0
- package/dist/esm/src/language.d.ts +26 -0
- package/dist/esm/src/public_types.d.ts +128 -0
- package/dist/esm/src/register.d.ts +2 -0
- package/dist/esm/src/remote_config.d.ts +79 -0
- package/dist/esm/src/storage/storage.d.ts +76 -0
- package/dist/esm/src/storage/storage_cache.d.ts +48 -0
- package/dist/esm/src/value.d.ts +26 -0
- package/dist/esm/test/client/caching_client.test.d.ts +17 -0
- package/dist/esm/test/client/rest_client.test.d.ts +17 -0
- package/dist/esm/test/client/retrying_client.test.d.ts +17 -0
- package/dist/esm/test/errors.test.d.ts +17 -0
- package/dist/esm/test/language.test.d.ts +17 -0
- package/dist/esm/test/remote_config.test.d.ts +17 -0
- package/dist/esm/test/setup.d.ts +17 -0
- package/dist/esm/test/storage/storage.test.d.ts +17 -0
- package/dist/esm/test/storage/storage_cache.test.d.ts +17 -0
- package/dist/esm/test/value.test.d.ts +17 -0
- package/dist/index.cjs.js +5 -2
- package/dist/index.cjs.js.map +1 -1
- package/package.json +19 -12
- package/dist/index.esm.js.map +0 -1
- package/dist/index.esm2017.js.map +0 -1
|
@@ -0,0 +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
|
+
declare 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 {};
|
|
@@ -0,0 +1,48 @@
|
|
|
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 { FirebaseRemoteConfigObject } from '../client/remote_config_fetch_client';
|
|
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
|
+
/**
|
|
33
|
+
* Memory-only getters
|
|
34
|
+
*/
|
|
35
|
+
getLastFetchStatus(): FetchStatus | undefined;
|
|
36
|
+
getLastSuccessfulFetchTimestampMillis(): number | undefined;
|
|
37
|
+
getActiveConfig(): FirebaseRemoteConfigObject | undefined;
|
|
38
|
+
/**
|
|
39
|
+
* Read-ahead getter
|
|
40
|
+
*/
|
|
41
|
+
loadFromStorage(): Promise<void>;
|
|
42
|
+
/**
|
|
43
|
+
* Write-through setters
|
|
44
|
+
*/
|
|
45
|
+
setLastFetchStatus(status: FetchStatus): Promise<void>;
|
|
46
|
+
setLastSuccessfulFetchTimestampMillis(timestampMillis: number): Promise<void>;
|
|
47
|
+
setActiveConfig(activeConfig: FirebaseRemoteConfigObject): Promise<void>;
|
|
48
|
+
}
|
|
@@ -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
|
+
import '../setup';
|
|
@@ -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
|
+
import '../setup';
|
|
@@ -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
|
+
import '../setup';
|
|
@@ -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
|
+
import './setup';
|
|
@@ -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
|
+
import './setup';
|
|
@@ -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
|
+
import './setup';
|
|
@@ -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 {};
|
|
@@ -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
|
+
import '../setup';
|
|
@@ -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
|
+
import '../setup';
|
|
@@ -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
|
+
import './setup';
|
package/dist/index.cjs.js
CHANGED
|
@@ -10,7 +10,7 @@ var tslib = require('tslib');
|
|
|
10
10
|
require('@firebase/installations');
|
|
11
11
|
|
|
12
12
|
var name = "@firebase/remote-config";
|
|
13
|
-
var version = "0.3.
|
|
13
|
+
var version = "0.3.1-canary.2322b6023";
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
16
|
* @license
|
|
@@ -1210,7 +1210,8 @@ var StorageCache = /** @class */ (function () {
|
|
|
1210
1210
|
case 2:
|
|
1211
1211
|
lastSuccessfulFetchTimestampMillis = _a.sent();
|
|
1212
1212
|
if (lastSuccessfulFetchTimestampMillis) {
|
|
1213
|
-
this.lastSuccessfulFetchTimestampMillis =
|
|
1213
|
+
this.lastSuccessfulFetchTimestampMillis =
|
|
1214
|
+
lastSuccessfulFetchTimestampMillis;
|
|
1214
1215
|
}
|
|
1215
1216
|
return [4 /*yield*/, activeConfigPromise];
|
|
1216
1217
|
case 3:
|
|
@@ -1260,6 +1261,8 @@ var StorageCache = /** @class */ (function () {
|
|
|
1260
1261
|
function registerRemoteConfig() {
|
|
1261
1262
|
app._registerComponent(new component.Component(RC_COMPONENT_NAME, remoteConfigFactory, "PUBLIC" /* PUBLIC */).setMultipleInstances(true));
|
|
1262
1263
|
app.registerVersion(name, version);
|
|
1264
|
+
// BUILD_TARGET will be replaced by values like esm5, esm2017, cjs5, etc during the compilation
|
|
1265
|
+
app.registerVersion(name, version, 'cjs5');
|
|
1263
1266
|
function remoteConfigFactory(container, _a) {
|
|
1264
1267
|
var namespace = _a.instanceIdentifier;
|
|
1265
1268
|
/* Dependencies */
|