Skip to content

Commit 08e2aa3

Browse files
authored
Remove remote-config-types-exp (#4496)
* remove remote-config-types exp * fix remote-config-compat * remove api report for types * correct d.ts path
1 parent 04b4986 commit 08e2aa3

File tree

22 files changed

+62
-134
lines changed

22 files changed

+62
-134
lines changed

.changeset/config.json

-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
"@firebase/performance-exp",
2929
"@firebase/performance-types-exp",
3030
"@firebase/remote-config-exp",
31-
"@firebase/remote-config-types-exp",
3231
"@firebase/remote-config-compat",
3332
"firebase-exp",
3433
"@firebase/app-compat",

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

+33-9
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,6 @@
55
```ts
66

77
import { FirebaseApp } from '@firebase/app-exp';
8-
import { RemoteConfig } from '@firebase/remote-config-types-exp';
9-
import { LogLevel as RemoteConfigLogLevel } from '@firebase/remote-config-types-exp';
10-
import { Value as ValueType } from '@firebase/remote-config-types-exp';
118

129
// @public
1310
export function activate(remoteConfig: RemoteConfig): Promise<boolean>;
@@ -22,7 +19,10 @@ export function fetchAndActivate(remoteConfig: RemoteConfig): Promise<boolean>;
2219
export function fetchConfig(remoteConfig: RemoteConfig): Promise<void>;
2320

2421
// @public
25-
export function getAll(remoteConfig: RemoteConfig): Record<string, ValueType>;
22+
export type FetchStatus = 'no-fetch-yet' | 'success' | 'failure' | 'throttle';
23+
24+
// @public
25+
export function getAll(remoteConfig: RemoteConfig): Record<string, Value>;
2626

2727
// @public
2828
export function getBoolean(remoteConfig: RemoteConfig, key: string): boolean;
@@ -37,16 +37,40 @@ export function getRemoteConfig(app: FirebaseApp): RemoteConfig;
3737
export function getString(remoteConfig: RemoteConfig, key: string): string;
3838

3939
// @public
40-
export function getValue(remoteConfig: RemoteConfig, key: string): ValueType;
40+
export function getValue(remoteConfig: RemoteConfig, key: string): Value;
4141

42-
export { RemoteConfig }
42+
// @public
43+
export type LogLevel = 'debug' | 'error' | 'silent';
4344

44-
export { RemoteConfigLogLevel }
45+
// @public
46+
export interface RemoteConfig {
47+
defaultConfig: {
48+
[key: string]: string | number | boolean;
49+
};
50+
fetchTimeMillis: number;
51+
lastFetchStatus: FetchStatus;
52+
settings: Settings;
53+
}
4554

4655
// @public
47-
export function setLogLevel(remoteConfig: RemoteConfig, logLevel: RemoteConfigLogLevel): void;
56+
export function setLogLevel(remoteConfig: RemoteConfig, logLevel: LogLevel): void;
4857

49-
export { ValueType }
58+
// @public
59+
export interface Settings {
60+
fetchTimeoutMillis: number;
61+
minimumFetchIntervalMillis: number;
62+
}
63+
64+
// @public
65+
export interface Value {
66+
asBoolean(): boolean;
67+
asNumber(): number;
68+
asString(): string;
69+
getSource(): ValueSource;
70+
}
71+
72+
// @public
73+
export type ValueSource = 'static' | 'default' | 'remote';
5074

5175

5276
// (No @packageDocumentation comment for this package)

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

-48
This file was deleted.

packages-exp/auth-exp/test/helpers/integration/helpers.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
import { deleteApp, initializeApp } from '@firebase/app-exp';
1919
import { Auth, User } from '@firebase/auth-types-exp';
2020

21-
import { getAuth } from '../../../'; // Use browser OR node dist entrypoint depending on test env.
21+
import { getAuth } from '../../../'; // Use browser OR node dist entrypoint depending on test env.
2222
import { _generateEventId } from '../../../src/core/util/event_id';
2323

2424
// eslint-disable-next-line @typescript-eslint/no-require-imports

packages-exp/remote-config-compat/package.json

+1-2
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,7 @@
2929
"@firebase/app-compat": "0.x"
3030
},
3131
"dependencies": {
32-
"@firebase/remote-config-exp": "0.0.900",
33-
"@firebase/remote-config-types-exp": "0.0.900",
32+
"@firebase/remote-config-exp": "0.0.900",
3433
"@firebase/util": "0.3.4",
3534
"@firebase/logger": "0.2.6",
3635
"@firebase/component": "0.2.0",

packages-exp/remote-config-compat/src/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import { RemoteConfigCompatImpl } from './remoteConfig';
2525
import { name as packageName, version } from '../package.json';
2626
import { RemoteConfig as RemoteConfigCompat } from '@firebase/remote-config-types';
2727

28-
// TODO: move it to the future remote-config-compat-types package
28+
// TODO: move it to remote-config-types package
2929
declare module '@firebase/component' {
3030
interface NameServiceMapping {
3131
'remote-config-compat': RemoteConfigCompat;

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

+1-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ import { stub } from 'sinon';
2121
import { RemoteConfigCompatImpl } from './remoteConfig';
2222
import { getFakeApp, getFakeModularRemoteConfig } from '../test/util';
2323
import * as modularApi from '@firebase/remote-config-exp';
24-
import { Value } from '@firebase/remote-config-types-exp';
2524

2625
describe('Remote Config Compat', () => {
2726
let remoteConfig!: RemoteConfigCompatImpl;
@@ -134,7 +133,7 @@ describe('Remote Config Compat', () => {
134133
});
135134

136135
it('getValue() calls modular getValue()', () => {
137-
const fakeValue = {} as Value;
136+
const fakeValue = {} as modularApi.Value;
138137
const modularGetValue = stub(modularApi, 'getValue').callsFake(
139138
() => fakeValue
140139
);

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
*/
1717

1818
import { FirebaseApp, _FirebaseService } from '@firebase/app-compat';
19-
import { RemoteConfig } from '@firebase/remote-config-types-exp';
2019
import {
2120
Value as ValueCompat,
2221
FetchStatus as FetchSTatusCompat,
@@ -25,6 +24,7 @@ import {
2524
RemoteConfig as RemoteConfigCompat
2625
} from '@firebase/remote-config-types';
2726
import {
27+
RemoteConfig,
2828
setLogLevel,
2929
activate,
3030
ensureInitialized,

packages-exp/remote-config-compat/test/util.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
*/
1717

1818
import { FirebaseApp } from '@firebase/app-compat';
19-
import { RemoteConfig } from '@firebase/remote-config-types-exp';
19+
import { RemoteConfig } from '@firebase/remote-config-exp';
2020

2121
export function getFakeApp(): FirebaseApp {
2222
return {

packages-exp/remote-config-exp/api-extractor.json

+3-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
// Point it to your entry point d.ts file.
44
"mainEntryPointFilePath": "<projectFolder>/dist/src/index.d.ts",
55
"dtsRollup": {
6-
"enabled": true
6+
"enabled": true,
7+
"untrimmedFilePath": "<projectFolder>/dist/<unscopedPackageName>.d.ts",
8+
"publicTrimmedFilePath": "<projectFolder>/dist/<unscopedPackageName>-public.d.ts"
79
}
810
}

packages-exp/remote-config-exp/package.json

+5-4
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"lint:fix": "eslint --fix -c .eslintrc.js '**/*.ts' --ignore-path '../../.gitignore'",
1717
"build": "rollup -c && yarn api-report",
1818
"build:deps": "lerna run --scope @firebase/remote-config-exp --include-dependencies build",
19-
"build:release": "rollup -c rollup.config.release.js && yarn api-report",
19+
"build:release": "rollup -c rollup.config.release.js && yarn api-report && yarn typings:public",
2020
"dev": "rollup -c -w",
2121
"test": "run-p lint test:browser",
2222
"test:ci": "node ../../scripts/run_tests_in_ci.js -s test:browser",
@@ -26,15 +26,16 @@
2626
"api-report": "api-extractor run --local --verbose",
2727
"predoc": "node ../../scripts/exp/remove-exp.js temp",
2828
"doc": "api-documenter markdown --input temp --output docs",
29-
"build:doc": "yarn build && yarn doc"
29+
"build:doc": "yarn build && yarn doc",
30+
"typings:public": "node ../../scripts/exp/use_typings.js ./dist/remote-config-exp-public.d.ts",
31+
"typings:internal": "node ../../scripts/exp/use_typings.js ./dist/src/index.d.ts"
3032
},
3133
"peerDependencies": {
3234
"@firebase/app-exp": "0.x"
3335
},
3436
"dependencies": {
3537
"@firebase/installations-exp": "0.0.900",
3638
"@firebase/logger": "0.2.6",
37-
"@firebase/remote-config-types-exp": "0.0.900",
3839
"@firebase/util": "0.3.4",
3940
"@firebase/component": "0.2.0",
4041
"tslib": "^1.11.1"
@@ -54,7 +55,7 @@
5455
"bugs": {
5556
"url": "https://github.com/firebase/firebase-js-sdk/issues"
5657
},
57-
"typings": "dist/remote-config-exp.d.ts",
58+
"typings": "dist/src/index.d.ts",
5859
"nyc": {
5960
"extension": [
6061
".ts"

packages-exp/remote-config-exp/src/api.ts

+9-11
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,13 @@ import { _getProvider, FirebaseApp } from '@firebase/app-exp';
1919
import {
2020
LogLevel as RemoteConfigLogLevel,
2121
RemoteConfig,
22-
Value as ValueType
23-
} from '@firebase/remote-config-types-exp';
22+
Value
23+
} from './public_types';
2424
import { RemoteConfigAbortSignal } from './client/remote_config_fetch_client';
2525
import { RC_COMPONENT_NAME } from './constants';
2626
import { ErrorCode, hasErrorCode } from './errors';
2727
import { RemoteConfig as RemoteConfigImpl } from './remote_config';
28-
import { Value } from './value';
28+
import { Value as ValueImpl } from './value';
2929
import { LogLevel as FirebaseLogLevel } from '@firebase/logger';
3030

3131
/**
@@ -137,15 +137,15 @@ export async function fetchConfig(remoteConfig: RemoteConfig): Promise<void> {
137137
*
138138
* @public
139139
*/
140-
export function getAll(remoteConfig: RemoteConfig): Record<string, ValueType> {
140+
export function getAll(remoteConfig: RemoteConfig): Record<string, Value> {
141141
const rc = remoteConfig as RemoteConfigImpl;
142142
return getAllKeys(
143143
rc._storageCache.getActiveConfig(),
144144
rc.defaultConfig
145145
).reduce((allConfigs, key) => {
146146
allConfigs[key] = getValue(remoteConfig, key);
147147
return allConfigs;
148-
}, {} as Record<string, ValueType>);
148+
}, {} as Record<string, Value>);
149149
}
150150

151151
/**
@@ -204,7 +204,7 @@ export function getString(remoteConfig: RemoteConfig, key: string): string {
204204
*
205205
* @public
206206
*/
207-
export function getValue(remoteConfig: RemoteConfig, key: string): ValueType {
207+
export function getValue(remoteConfig: RemoteConfig, key: string): Value {
208208
const rc = remoteConfig as RemoteConfigImpl;
209209
if (!rc._isInitializationComplete) {
210210
rc._logger.debug(
@@ -214,15 +214,15 @@ export function getValue(remoteConfig: RemoteConfig, key: string): ValueType {
214214
}
215215
const activeConfig = rc._storageCache.getActiveConfig();
216216
if (activeConfig && activeConfig[key] !== undefined) {
217-
return new Value('remote', activeConfig[key]);
217+
return new ValueImpl('remote', activeConfig[key]);
218218
} else if (rc.defaultConfig && rc.defaultConfig[key] !== undefined) {
219-
return new Value('default', String(rc.defaultConfig[key]));
219+
return new ValueImpl('default', String(rc.defaultConfig[key]));
220220
}
221221
rc._logger.debug(
222222
`Returning static value for key "${key}".` +
223223
' Define a default or remote value if this is unintentional.'
224224
);
225-
return new Value('static');
225+
return new ValueImpl('static');
226226
}
227227

228228
/**
@@ -256,5 +256,3 @@ export function setLogLevel(
256256
function getAllKeys(obj1: {} = {}, obj2: {} = {}): string[] {
257257
return Object.keys({ ...obj1, ...obj2 });
258258
}
259-
260-
export { RemoteConfig, ValueType, RemoteConfigLogLevel };

packages-exp/remote-config-exp/src/api2.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
* limitations under the License.
1616
*/
1717

18-
import { RemoteConfig } from '@firebase/remote-config-types-exp';
18+
import { RemoteConfig } from './public_types';
1919
import { activate, fetchConfig } from './api';
2020

2121
// This API is put in a separate file, so we can stub fetchConfig and activate in tests.

packages-exp/remote-config-exp/src/index.ts

+1
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ declare global {
2929

3030
export * from './api';
3131
export * from './api2';
32+
export * from './public_types';
3233

3334
/** register component and version */
3435
registerRemoteConfig();

packages-exp/remote-config-types-exp/index.d.ts renamed to packages-exp/remote-config-exp/src/public_types.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
22
* @license
3-
* Copyright 2019 Google LLC
3+
* Copyright 2020 Google LLC
44
*
55
* Licensed under the Apache License, Version 2.0 (the "License");
66
* you may not use this file except in compliance with the License.

packages-exp/remote-config-exp/src/register.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import {
2525
ComponentContainer
2626
} from '@firebase/component';
2727
import { Logger, LogLevel as FirebaseLogLevel } from '@firebase/logger';
28-
import { RemoteConfig } from '@firebase/remote-config-types-exp';
28+
import { RemoteConfig } from './public_types';
2929
import { name as packageName, version } from '../package.json';
3030
import { ensureInitialized } from './api';
3131
import { CachingClient } from './client/caching_client';

packages-exp/remote-config-exp/src/remote_config.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import {
2020
RemoteConfig as RemoteConfigType,
2121
FetchStatus,
2222
Settings
23-
} from '@firebase/remote-config-types-exp';
23+
} from './public_types';
2424
import { StorageCache } from './storage/storage_cache';
2525
import { RemoteConfigFetchClient } from './client/remote_config_fetch_client';
2626
import { Storage } from './storage/storage';

packages-exp/remote-config-exp/test/remote_config.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import { FirebaseApp } from '@firebase/app-exp';
1919
import {
2020
RemoteConfig as RemoteConfigType,
2121
LogLevel as RemoteConfigLogLevel
22-
} from '@firebase/remote-config-types-exp';
22+
} from '../src/public_types';
2323
import { expect } from 'chai';
2424
import * as sinon from 'sinon';
2525
import { StorageCache } from '../src/storage/storage_cache';

packages-exp/remote-config-types-exp/README.md

-3
This file was deleted.

packages-exp/remote-config-types-exp/api-extractor.json

-5
This file was deleted.

0 commit comments

Comments
 (0)