@firebase/remote-config 0.4.10 → 0.4.11-canary.0755a723d
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 +1299 -1194
- package/dist/esm/index.esm2017.js.map +1 -1
- package/dist/esm/src/api.d.ts +126 -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 +129 -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 +20 -17
- package/dist/esm/src/errors.d.ts +66 -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 +144 -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 +95 -76
- package/dist/esm/src/storage/storage_cache.d.ts +51 -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 +1299 -1193
- package/dist/index.cjs.js.map +1 -1
- package/dist/remote-config-public.d.ts +29 -0
- package/dist/remote-config.d.ts +29 -0
- package/dist/src/api.d.ts +126 -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 +129 -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 +20 -17
- package/dist/src/errors.d.ts +66 -62
- package/dist/src/index.d.ts +14 -14
- package/dist/src/language.d.ts +26 -26
- package/dist/src/public_types.d.ts +144 -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 +95 -76
- package/dist/src/storage/storage_cache.d.ts +51 -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 +8 -8
|
@@ -1,123 +1,129 @@
|
|
|
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
|
-
|
|
18
|
-
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
*
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
*
|
|
64
|
-
*
|
|
65
|
-
*
|
|
66
|
-
*
|
|
67
|
-
*
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
*
|
|
73
|
-
*
|
|
74
|
-
*
|
|
75
|
-
*
|
|
76
|
-
*
|
|
77
|
-
*
|
|
78
|
-
*
|
|
79
|
-
*
|
|
80
|
-
*
|
|
81
|
-
*
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
*
|
|
87
|
-
*
|
|
88
|
-
*
|
|
89
|
-
*
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
/**
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
*
|
|
108
|
-
*
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
*
|
|
113
|
-
*
|
|
114
|
-
*
|
|
115
|
-
*/
|
|
116
|
-
|
|
117
|
-
/**
|
|
118
|
-
* Defines the
|
|
119
|
-
*
|
|
120
|
-
* <p>Only defined for 200 responses.
|
|
121
|
-
*/
|
|
122
|
-
|
|
123
|
-
|
|
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 { CustomSignals } from '../public_types';
|
|
18
|
+
/**
|
|
19
|
+
* Defines a client, as in https://en.wikipedia.org/wiki/Client%E2%80%93server_model, for the
|
|
20
|
+
* Remote Config server (https://firebase.google.com/docs/reference/remote-config/rest).
|
|
21
|
+
*
|
|
22
|
+
* <p>Abstracts throttle, response cache and network implementation details.
|
|
23
|
+
*
|
|
24
|
+
* <p>Modeled after the native {@link GlobalFetch} interface, which is relatively modern and
|
|
25
|
+
* convenient, but simplified for Remote Config's use case.
|
|
26
|
+
*
|
|
27
|
+
* Disambiguation: {@link GlobalFetch} interface and the Remote Config service define "fetch"
|
|
28
|
+
* methods. The RestClient uses the former to make HTTP calls. This interface abstracts the latter.
|
|
29
|
+
*/
|
|
30
|
+
export interface RemoteConfigFetchClient {
|
|
31
|
+
/**
|
|
32
|
+
* @throws if response status is not 200 or 304.
|
|
33
|
+
*/
|
|
34
|
+
fetch(request: FetchRequest): Promise<FetchResponse>;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Defines a self-descriptive reference for config key-value pairs.
|
|
38
|
+
*/
|
|
39
|
+
export interface FirebaseRemoteConfigObject {
|
|
40
|
+
[key: string]: string;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Shims a minimal AbortSignal.
|
|
44
|
+
*
|
|
45
|
+
* <p>AbortController's AbortSignal conveniently decouples fetch timeout logic from other aspects
|
|
46
|
+
* of networking, such as retries. Firebase doesn't use AbortController enough to justify a
|
|
47
|
+
* polyfill recommendation, like we do with the Fetch API, but this minimal shim can easily be
|
|
48
|
+
* swapped out if/when we do.
|
|
49
|
+
*/
|
|
50
|
+
export declare class RemoteConfigAbortSignal {
|
|
51
|
+
listeners: Array<() => void>;
|
|
52
|
+
addEventListener(listener: () => void): void;
|
|
53
|
+
abort(): void;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Defines per-request inputs for the Remote Config fetch request.
|
|
57
|
+
*
|
|
58
|
+
* <p>Modeled after the native {@link Request} interface, but simplified for Remote Config's
|
|
59
|
+
* use case.
|
|
60
|
+
*/
|
|
61
|
+
export interface FetchRequest {
|
|
62
|
+
/**
|
|
63
|
+
* Uses cached config if it is younger than this age.
|
|
64
|
+
*
|
|
65
|
+
* <p>Required because it's defined by settings, which always have a value.
|
|
66
|
+
*
|
|
67
|
+
* <p>Comparable to passing `headers = { 'Cache-Control': max-age <maxAge> }` to the native
|
|
68
|
+
* Fetch API.
|
|
69
|
+
*/
|
|
70
|
+
cacheMaxAgeMillis: number;
|
|
71
|
+
/**
|
|
72
|
+
* An event bus for the signal to abort a request.
|
|
73
|
+
*
|
|
74
|
+
* <p>Required because all requests should be abortable.
|
|
75
|
+
*
|
|
76
|
+
* <p>Comparable to the native
|
|
77
|
+
* Fetch API's "signal" field on its request configuration object
|
|
78
|
+
* https://fetch.spec.whatwg.org/#dom-requestinit-signal.
|
|
79
|
+
*
|
|
80
|
+
* <p>Disambiguation: Remote Config commonly refers to API inputs as
|
|
81
|
+
* "signals". See the private ConfigFetchRequestBody interface for those:
|
|
82
|
+
* http://google3/firebase/remote_config/web/src/core/rest_client.ts?l=14&rcl=255515243.
|
|
83
|
+
*/
|
|
84
|
+
signal: RemoteConfigAbortSignal;
|
|
85
|
+
/**
|
|
86
|
+
* The ETag header value from the last response.
|
|
87
|
+
*
|
|
88
|
+
* <p>Optional in case this is the first request.
|
|
89
|
+
*
|
|
90
|
+
* <p>Comparable to passing `headers = { 'If-None-Match': <eTag> }` to the native Fetch API.
|
|
91
|
+
*/
|
|
92
|
+
eTag?: string;
|
|
93
|
+
/** The custom signals stored for the app instance.
|
|
94
|
+
*
|
|
95
|
+
* <p>Optional in case no custom signals are set for the instance.
|
|
96
|
+
*/
|
|
97
|
+
customSignals?: CustomSignals;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Defines a successful response (200 or 304).
|
|
101
|
+
*
|
|
102
|
+
* <p>Modeled after the native {@link Response} interface, but simplified for Remote Config's
|
|
103
|
+
* use case.
|
|
104
|
+
*/
|
|
105
|
+
export interface FetchResponse {
|
|
106
|
+
/**
|
|
107
|
+
* The HTTP status, which is useful for differentiating success responses with data from
|
|
108
|
+
* those without.
|
|
109
|
+
*
|
|
110
|
+
* <p>{@link RemoteConfigClient} is modeled after the native {@link GlobalFetch} interface, so
|
|
111
|
+
* HTTP status is first-class.
|
|
112
|
+
*
|
|
113
|
+
* <p>Disambiguation: the fetch response returns a legacy "state" value that is redundant with the
|
|
114
|
+
* HTTP status code. The former is normalized into the latter.
|
|
115
|
+
*/
|
|
116
|
+
status: number;
|
|
117
|
+
/**
|
|
118
|
+
* Defines the ETag response header value.
|
|
119
|
+
*
|
|
120
|
+
* <p>Only defined for 200 and 304 responses.
|
|
121
|
+
*/
|
|
122
|
+
eTag?: string;
|
|
123
|
+
/**
|
|
124
|
+
* Defines the map of parameters returned as "entries" in the fetch response body.
|
|
125
|
+
*
|
|
126
|
+
* <p>Only defined for 200 responses.
|
|
127
|
+
*/
|
|
128
|
+
config?: FirebaseRemoteConfigObject;
|
|
129
|
+
}
|
|
@@ -1,40 +1,40 @@
|
|
|
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 { FetchResponse, RemoteConfigFetchClient, FetchRequest } from './remote_config_fetch_client';
|
|
18
|
-
import { _FirebaseInstallationsInternal } from '@firebase/installations';
|
|
19
|
-
/**
|
|
20
|
-
* Implements the Client abstraction for the Remote Config REST API.
|
|
21
|
-
*/
|
|
22
|
-
export declare class RestClient implements RemoteConfigFetchClient {
|
|
23
|
-
private readonly firebaseInstallations;
|
|
24
|
-
private readonly sdkVersion;
|
|
25
|
-
private readonly namespace;
|
|
26
|
-
private readonly projectId;
|
|
27
|
-
private readonly apiKey;
|
|
28
|
-
private readonly appId;
|
|
29
|
-
constructor(firebaseInstallations: _FirebaseInstallationsInternal, sdkVersion: string, namespace: string, projectId: string, apiKey: string, appId: string);
|
|
30
|
-
/**
|
|
31
|
-
* Fetches from the Remote Config REST API.
|
|
32
|
-
*
|
|
33
|
-
* @throws a {@link ErrorCode.FETCH_NETWORK} error if {@link GlobalFetch#fetch} can't
|
|
34
|
-
* connect to the network.
|
|
35
|
-
* @throws a {@link ErrorCode.FETCH_PARSE} error if {@link Response#json} can't parse the
|
|
36
|
-
* fetch response.
|
|
37
|
-
* @throws a {@link ErrorCode.FETCH_STATUS} error if the service returns an HTTP error status.
|
|
38
|
-
*/
|
|
39
|
-
fetch(request: FetchRequest): Promise<FetchResponse>;
|
|
40
|
-
}
|
|
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 { FetchResponse, RemoteConfigFetchClient, FetchRequest } from './remote_config_fetch_client';
|
|
18
|
+
import { _FirebaseInstallationsInternal } from '@firebase/installations';
|
|
19
|
+
/**
|
|
20
|
+
* Implements the Client abstraction for the Remote Config REST API.
|
|
21
|
+
*/
|
|
22
|
+
export declare class RestClient implements RemoteConfigFetchClient {
|
|
23
|
+
private readonly firebaseInstallations;
|
|
24
|
+
private readonly sdkVersion;
|
|
25
|
+
private readonly namespace;
|
|
26
|
+
private readonly projectId;
|
|
27
|
+
private readonly apiKey;
|
|
28
|
+
private readonly appId;
|
|
29
|
+
constructor(firebaseInstallations: _FirebaseInstallationsInternal, sdkVersion: string, namespace: string, projectId: string, apiKey: string, appId: string);
|
|
30
|
+
/**
|
|
31
|
+
* Fetches from the Remote Config REST API.
|
|
32
|
+
*
|
|
33
|
+
* @throws a {@link ErrorCode.FETCH_NETWORK} error if {@link GlobalFetch#fetch} can't
|
|
34
|
+
* connect to the network.
|
|
35
|
+
* @throws a {@link ErrorCode.FETCH_PARSE} error if {@link Response#json} can't parse the
|
|
36
|
+
* fetch response.
|
|
37
|
+
* @throws a {@link ErrorCode.FETCH_STATUS} error if the service returns an HTTP error status.
|
|
38
|
+
*/
|
|
39
|
+
fetch(request: FetchRequest): Promise<FetchResponse>;
|
|
40
|
+
}
|
|
@@ -1,49 +1,49 @@
|
|
|
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 { RemoteConfigAbortSignal, RemoteConfigFetchClient, FetchResponse, FetchRequest } from './remote_config_fetch_client';
|
|
18
|
-
import { ThrottleMetadata, Storage } from '../storage/storage';
|
|
19
|
-
/**
|
|
20
|
-
* Supports waiting on a backoff by:
|
|
21
|
-
*
|
|
22
|
-
* <ul>
|
|
23
|
-
* <li>Promisifying setTimeout, so we can set a timeout in our Promise chain</li>
|
|
24
|
-
* <li>Listening on a signal bus for abort events, just like the Fetch API</li>
|
|
25
|
-
* <li>Failing in the same way the Fetch API fails, so timing out a live request and a throttled
|
|
26
|
-
* request appear the same.</li>
|
|
27
|
-
* </ul>
|
|
28
|
-
*
|
|
29
|
-
* <p>Visible for testing.
|
|
30
|
-
*/
|
|
31
|
-
export declare function setAbortableTimeout(signal: RemoteConfigAbortSignal, throttleEndTimeMillis: number): Promise<void>;
|
|
32
|
-
/**
|
|
33
|
-
* Decorates a Client with retry logic.
|
|
34
|
-
*
|
|
35
|
-
* <p>Comparable to CachingClient, but uses backoff logic instead of cache max age and doesn't cache
|
|
36
|
-
* responses (because the SDK has no use for error responses).
|
|
37
|
-
*/
|
|
38
|
-
export declare class RetryingClient implements RemoteConfigFetchClient {
|
|
39
|
-
private readonly client;
|
|
40
|
-
private readonly storage;
|
|
41
|
-
constructor(client: RemoteConfigFetchClient, storage: Storage);
|
|
42
|
-
fetch(request: FetchRequest): Promise<FetchResponse>;
|
|
43
|
-
/**
|
|
44
|
-
* A recursive helper for attempting a fetch request repeatedly.
|
|
45
|
-
*
|
|
46
|
-
* @throws any non-retriable errors.
|
|
47
|
-
*/
|
|
48
|
-
attemptFetch(request: FetchRequest, { throttleEndTimeMillis, backoffCount }: ThrottleMetadata): Promise<FetchResponse>;
|
|
49
|
-
}
|
|
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 { RemoteConfigAbortSignal, RemoteConfigFetchClient, FetchResponse, FetchRequest } from './remote_config_fetch_client';
|
|
18
|
+
import { ThrottleMetadata, Storage } from '../storage/storage';
|
|
19
|
+
/**
|
|
20
|
+
* Supports waiting on a backoff by:
|
|
21
|
+
*
|
|
22
|
+
* <ul>
|
|
23
|
+
* <li>Promisifying setTimeout, so we can set a timeout in our Promise chain</li>
|
|
24
|
+
* <li>Listening on a signal bus for abort events, just like the Fetch API</li>
|
|
25
|
+
* <li>Failing in the same way the Fetch API fails, so timing out a live request and a throttled
|
|
26
|
+
* request appear the same.</li>
|
|
27
|
+
* </ul>
|
|
28
|
+
*
|
|
29
|
+
* <p>Visible for testing.
|
|
30
|
+
*/
|
|
31
|
+
export declare function setAbortableTimeout(signal: RemoteConfigAbortSignal, throttleEndTimeMillis: number): Promise<void>;
|
|
32
|
+
/**
|
|
33
|
+
* Decorates a Client with retry logic.
|
|
34
|
+
*
|
|
35
|
+
* <p>Comparable to CachingClient, but uses backoff logic instead of cache max age and doesn't cache
|
|
36
|
+
* responses (because the SDK has no use for error responses).
|
|
37
|
+
*/
|
|
38
|
+
export declare class RetryingClient implements RemoteConfigFetchClient {
|
|
39
|
+
private readonly client;
|
|
40
|
+
private readonly storage;
|
|
41
|
+
constructor(client: RemoteConfigFetchClient, storage: Storage);
|
|
42
|
+
fetch(request: FetchRequest): Promise<FetchResponse>;
|
|
43
|
+
/**
|
|
44
|
+
* A recursive helper for attempting a fetch request repeatedly.
|
|
45
|
+
*
|
|
46
|
+
* @throws any non-retriable errors.
|
|
47
|
+
*/
|
|
48
|
+
attemptFetch(request: FetchRequest, { throttleEndTimeMillis, backoffCount }: ThrottleMetadata): Promise<FetchResponse>;
|
|
49
|
+
}
|
|
@@ -1,17 +1,20 @@
|
|
|
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
|
-
export declare const RC_COMPONENT_NAME = "remote-config";
|
|
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
|
+
export declare const RC_COMPONENT_NAME = "remote-config";
|
|
18
|
+
export declare const RC_CUSTOM_SIGNAL_MAX_ALLOWED_SIGNALS = 100;
|
|
19
|
+
export declare const RC_CUSTOM_SIGNAL_KEY_MAX_LENGTH = 250;
|
|
20
|
+
export declare const RC_CUSTOM_SIGNAL_VALUE_MAX_LENGTH = 500;
|
package/dist/esm/src/errors.d.ts
CHANGED
|
@@ -1,62 +1,66 @@
|
|
|
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 { ErrorFactory } from '@firebase/util';
|
|
18
|
-
export declare const enum ErrorCode {
|
|
19
|
-
REGISTRATION_WINDOW = "registration-window",
|
|
20
|
-
REGISTRATION_PROJECT_ID = "registration-project-id",
|
|
21
|
-
REGISTRATION_API_KEY = "registration-api-key",
|
|
22
|
-
REGISTRATION_APP_ID = "registration-app-id",
|
|
23
|
-
STORAGE_OPEN = "storage-open",
|
|
24
|
-
STORAGE_GET = "storage-get",
|
|
25
|
-
STORAGE_SET = "storage-set",
|
|
26
|
-
STORAGE_DELETE = "storage-delete",
|
|
27
|
-
FETCH_NETWORK = "fetch-client-network",
|
|
28
|
-
FETCH_TIMEOUT = "fetch-timeout",
|
|
29
|
-
FETCH_THROTTLE = "fetch-throttle",
|
|
30
|
-
FETCH_PARSE = "fetch-client-parse",
|
|
31
|
-
FETCH_STATUS = "fetch-status",
|
|
32
|
-
INDEXED_DB_UNAVAILABLE = "indexed-db-unavailable"
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
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 { ErrorFactory } from '@firebase/util';
|
|
18
|
+
export declare const enum ErrorCode {
|
|
19
|
+
REGISTRATION_WINDOW = "registration-window",
|
|
20
|
+
REGISTRATION_PROJECT_ID = "registration-project-id",
|
|
21
|
+
REGISTRATION_API_KEY = "registration-api-key",
|
|
22
|
+
REGISTRATION_APP_ID = "registration-app-id",
|
|
23
|
+
STORAGE_OPEN = "storage-open",
|
|
24
|
+
STORAGE_GET = "storage-get",
|
|
25
|
+
STORAGE_SET = "storage-set",
|
|
26
|
+
STORAGE_DELETE = "storage-delete",
|
|
27
|
+
FETCH_NETWORK = "fetch-client-network",
|
|
28
|
+
FETCH_TIMEOUT = "fetch-timeout",
|
|
29
|
+
FETCH_THROTTLE = "fetch-throttle",
|
|
30
|
+
FETCH_PARSE = "fetch-client-parse",
|
|
31
|
+
FETCH_STATUS = "fetch-status",
|
|
32
|
+
INDEXED_DB_UNAVAILABLE = "indexed-db-unavailable",
|
|
33
|
+
CUSTOM_SIGNAL_MAX_ALLOWED_SIGNALS = "custom-signal-max-allowed-signals"
|
|
34
|
+
}
|
|
35
|
+
interface ErrorParams {
|
|
36
|
+
[ErrorCode.STORAGE_OPEN]: {
|
|
37
|
+
originalErrorMessage: string | undefined;
|
|
38
|
+
};
|
|
39
|
+
[ErrorCode.STORAGE_GET]: {
|
|
40
|
+
originalErrorMessage: string | undefined;
|
|
41
|
+
};
|
|
42
|
+
[ErrorCode.STORAGE_SET]: {
|
|
43
|
+
originalErrorMessage: string | undefined;
|
|
44
|
+
};
|
|
45
|
+
[ErrorCode.STORAGE_DELETE]: {
|
|
46
|
+
originalErrorMessage: string | undefined;
|
|
47
|
+
};
|
|
48
|
+
[ErrorCode.FETCH_NETWORK]: {
|
|
49
|
+
originalErrorMessage: string;
|
|
50
|
+
};
|
|
51
|
+
[ErrorCode.FETCH_THROTTLE]: {
|
|
52
|
+
throttleEndTimeMillis: number;
|
|
53
|
+
};
|
|
54
|
+
[ErrorCode.FETCH_PARSE]: {
|
|
55
|
+
originalErrorMessage: string;
|
|
56
|
+
};
|
|
57
|
+
[ErrorCode.FETCH_STATUS]: {
|
|
58
|
+
httpStatus: number;
|
|
59
|
+
};
|
|
60
|
+
[ErrorCode.CUSTOM_SIGNAL_MAX_ALLOWED_SIGNALS]: {
|
|
61
|
+
maxSignals: number;
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
export declare const ERROR_FACTORY: ErrorFactory<ErrorCode, ErrorParams>;
|
|
65
|
+
export declare function hasErrorCode(e: Error, errorCode: ErrorCode): boolean;
|
|
66
|
+
export {};
|
package/dist/esm/src/index.d.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The Firebase Remote Config Web SDK.
|
|
3
|
-
* This SDK does not work in a Node.js environment.
|
|
4
|
-
*
|
|
5
|
-
* @packageDocumentation
|
|
6
|
-
*/
|
|
7
|
-
declare global {
|
|
8
|
-
interface Window {
|
|
9
|
-
FIREBASE_REMOTE_CONFIG_URL_BASE: string;
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
export * from './api';
|
|
13
|
-
export * from './api2';
|
|
14
|
-
export * from './public_types';
|
|
1
|
+
/**
|
|
2
|
+
* The Firebase Remote Config Web SDK.
|
|
3
|
+
* This SDK does not work in a Node.js environment.
|
|
4
|
+
*
|
|
5
|
+
* @packageDocumentation
|
|
6
|
+
*/
|
|
7
|
+
declare global {
|
|
8
|
+
interface Window {
|
|
9
|
+
FIREBASE_REMOTE_CONFIG_URL_BASE: string;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
export * from './api';
|
|
13
|
+
export * from './api2';
|
|
14
|
+
export * from './public_types';
|