Skip to content

Commit 77f1cb6

Browse files
Address lint errors + add/fix few tests
1 parent ad74ca5 commit 77f1cb6

File tree

5 files changed

+28
-12
lines changed

5 files changed

+28
-12
lines changed

common/api-review/remote-config.api.md

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,11 @@ import { FirebaseApp } from '@firebase/app';
99
// @public
1010
export function activate(remoteConfig: RemoteConfig): Promise<boolean>;
1111

12-
// @alpha
13-
export type CustomSignals = {
12+
// @public
13+
export interface CustomSignals {
14+
// (undocumented)
1415
[key: string]: string | number;
15-
};
16+
}
1617

1718
// @public
1819
export function ensureInitialized(remoteConfig: RemoteConfig): Promise<void>;
@@ -67,9 +68,7 @@ export interface RemoteConfigSettings {
6768
minimumFetchIntervalMillis: number;
6869
}
6970

70-
// Warning: (ae-incompatible-release-tags) The symbol "setCustomSignals" is marked as @public, but its signature references "CustomSignals" which is marked as @alpha
71-
//
72-
// @public (undocumented)
71+
// @public
7372
export function setCustomSignals(remoteConfig: RemoteConfig, customSignals: CustomSignals): Promise<void>;
7473

7574
// @public

packages/remote-config-compat/src/remoteConfig.test.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,4 +157,16 @@ describe('Remote Config Compat', () => {
157157
'debug'
158158
);
159159
});
160+
161+
it('setCustomSignals() calls modular setCustomSignals()', async () => {
162+
const modularSetCustomSignalsStub = stub(modularApi, 'setCustomSignals').callsFake(() =>
163+
Promise.resolve()
164+
);
165+
await remoteConfig.setCustomSignals({'customSignal': 'value'});
166+
167+
expect(modularSetCustomSignalsStub).to.have.been.calledWithExactly(
168+
fakeModularRemoteConfig,
169+
{'customSignal': 'value'}
170+
);
171+
});
160172
});

packages/remote-config-types/index.d.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,8 +187,6 @@ export type LogLevel = 'debug' | 'error' | 'silent';
187187
* <li><code>string</code>
188188
* <li><code>number</code>
189189
* </ul>
190-
*
191-
* @alpha
192190
*/
193191
export type CustomSignals = {[key: string]: string | number};
194192

packages/remote-config/src/api.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,6 @@ export async function fetchConfig(remoteConfig: RemoteConfig): Promise<void> {
109109
// * it applies to all retries (like curl's max-time arg)
110110
// * it is consistent with the Fetch API's signal input
111111
const abortSignal = new RemoteConfigAbortSignal();
112-
const customSignals = rc._storageCache.getCustomSignals();
113112

114113
setTimeout(async () => {
115114
// Note a very low delay, eg < 10ms, can elapse before listeners are initialized.
@@ -262,6 +261,14 @@ function getAllKeys(obj1: {} = {}, obj2: {} = {}): string[] {
262261
return Object.keys({ ...obj1, ...obj2 });
263262
}
264263

264+
/**
265+
* Sets the custom signals for the app instance.
266+
*
267+
* @param remoteConfig - The {@link RemoteConfig} instance.
268+
* @param customSignals - Map (key, value) of the custom signals to be set for the app instance.
269+
*
270+
* @public
271+
*/
265272
export async function setCustomSignals(
266273
remoteConfig: RemoteConfig, customSignals: CustomSignals): Promise<void> {
267274
const rc = getModularInstance(remoteConfig) as RemoteConfigImpl;

packages/remote-config/src/public_types.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -143,10 +143,10 @@ export type LogLevel = 'debug' | 'error' | 'silent';
143143
* <li><code>string</code>
144144
* <li><code>number</code>
145145
* </ul>
146-
*
147-
* @alpha
146+
*
147+
* @public
148148
*/
149-
export type CustomSignals = {[key: string]: string | number};
149+
export interface CustomSignals {[key: string]: string | number};
150150

151151
declare module '@firebase/component' {
152152
interface NameServiceMapping {

0 commit comments

Comments
 (0)