Skip to content

Commit b865bf9

Browse files
feat(rc): Exposed RC APIs from firebase-admin/remote-config entry point (#1152)
* feat(rc): Exposed RC APIs from firebase-admin/remote-config entry point * Update test/unit/remote-config/index.spec.ts Co-authored-by: Lahiru Maramba <[email protected]> Co-authored-by: Lahiru Maramba <[email protected]>
1 parent 0168b15 commit b865bf9

12 files changed

+650
-461
lines changed

etc/firebase-admin.api.md

+53-77
Original file line numberDiff line numberDiff line change
@@ -819,86 +819,62 @@ export namespace projectManagement {
819819
export function refreshToken(refreshTokenPathOrObject: string | object, httpAgent?: Agent): Credential;
820820

821821
// @public
822-
export function remoteConfig(app?: app.App): remoteConfig.RemoteConfig;
822+
export function remoteConfig(app?: App): remoteConfig.RemoteConfig;
823823

824824
// @public (undocumented)
825825
export namespace remoteConfig {
826-
export interface ExplicitParameterValue {
827-
value: string;
828-
}
829-
export interface InAppDefaultValue {
830-
useInAppDefault: boolean;
831-
}
832-
export interface ListVersionsOptions {
833-
endTime?: Date | string;
834-
endVersionNumber?: string | number;
835-
pageSize?: number;
836-
pageToken?: string;
837-
startTime?: Date | string;
838-
}
839-
export interface ListVersionsResult {
840-
nextPageToken?: string;
841-
versions: Version[];
842-
}
843-
export interface RemoteConfig {
844-
// (undocumented)
845-
app: app.App;
846-
createTemplateFromJSON(json: string): RemoteConfigTemplate;
847-
getTemplate(): Promise<RemoteConfigTemplate>;
848-
getTemplateAtVersion(versionNumber: number | string): Promise<RemoteConfigTemplate>;
849-
listVersions(options?: ListVersionsOptions): Promise<ListVersionsResult>;
850-
publishTemplate(template: RemoteConfigTemplate, options?: {
851-
force: boolean;
852-
}): Promise<RemoteConfigTemplate>;
853-
rollback(versionNumber: string | number): Promise<RemoteConfigTemplate>;
854-
validateTemplate(template: RemoteConfigTemplate): Promise<RemoteConfigTemplate>;
855-
}
856-
export interface RemoteConfigCondition {
857-
expression: string;
858-
name: string;
859-
tagColor?: TagColor;
860-
}
861-
export interface RemoteConfigParameter {
862-
conditionalValues?: {
863-
[key: string]: RemoteConfigParameterValue;
864-
};
865-
defaultValue?: RemoteConfigParameterValue;
866-
description?: string;
867-
}
868-
export interface RemoteConfigParameterGroup {
869-
description?: string;
870-
parameters: {
871-
[key: string]: RemoteConfigParameter;
872-
};
873-
}
874-
export type RemoteConfigParameterValue = ExplicitParameterValue | InAppDefaultValue;
875-
export interface RemoteConfigTemplate {
876-
conditions: RemoteConfigCondition[];
877-
readonly etag: string;
878-
parameterGroups: {
879-
[key: string]: RemoteConfigParameterGroup;
880-
};
881-
parameters: {
882-
[key: string]: RemoteConfigParameter;
883-
};
884-
version?: Version;
885-
}
886-
export interface RemoteConfigUser {
887-
email: string;
888-
imageUrl?: string;
889-
name?: string;
890-
}
891-
export type TagColor = 'BLUE' | 'BROWN' | 'CYAN' | 'DEEP_ORANGE' | 'GREEN' | 'INDIGO' | 'LIME' | 'ORANGE' | 'PINK' | 'PURPLE' | 'TEAL';
892-
export interface Version {
893-
description?: string;
894-
isLegacy?: boolean;
895-
rollbackSource?: string;
896-
updateOrigin?: ('REMOTE_CONFIG_UPDATE_ORIGIN_UNSPECIFIED' | 'CONSOLE' | 'REST_API' | 'ADMIN_SDK_NODE');
897-
updateTime?: string;
898-
updateType?: ('REMOTE_CONFIG_UPDATE_TYPE_UNSPECIFIED' | 'INCREMENTAL_UPDATE' | 'FORCED_UPDATE' | 'ROLLBACK');
899-
updateUser?: RemoteConfigUser;
900-
versionNumber?: string;
901-
}
826+
// Warning: (ae-forgotten-export) The symbol "ExplicitParameterValue" needs to be exported by the entry point default-namespace.d.ts
827+
//
828+
// (undocumented)
829+
export type ExplicitParameterValue = ExplicitParameterValue;
830+
// Warning: (ae-forgotten-export) The symbol "InAppDefaultValue" needs to be exported by the entry point default-namespace.d.ts
831+
//
832+
// (undocumented)
833+
export type InAppDefaultValue = InAppDefaultValue;
834+
// Warning: (ae-forgotten-export) The symbol "ListVersionsOptions" needs to be exported by the entry point default-namespace.d.ts
835+
//
836+
// (undocumented)
837+
export type ListVersionsOptions = ListVersionsOptions;
838+
// Warning: (ae-forgotten-export) The symbol "ListVersionsResult" needs to be exported by the entry point default-namespace.d.ts
839+
//
840+
// (undocumented)
841+
export type ListVersionsResult = ListVersionsResult;
842+
// Warning: (ae-forgotten-export) The symbol "RemoteConfig" needs to be exported by the entry point default-namespace.d.ts
843+
//
844+
// (undocumented)
845+
export type RemoteConfig = RemoteConfig;
846+
// Warning: (ae-forgotten-export) The symbol "RemoteConfigCondition" needs to be exported by the entry point default-namespace.d.ts
847+
//
848+
// (undocumented)
849+
export type RemoteConfigCondition = RemoteConfigCondition;
850+
// Warning: (ae-forgotten-export) The symbol "RemoteConfigParameter" needs to be exported by the entry point default-namespace.d.ts
851+
//
852+
// (undocumented)
853+
export type RemoteConfigParameter = RemoteConfigParameter;
854+
// Warning: (ae-forgotten-export) The symbol "RemoteConfigParameterGroup" needs to be exported by the entry point default-namespace.d.ts
855+
//
856+
// (undocumented)
857+
export type RemoteConfigParameterGroup = RemoteConfigParameterGroup;
858+
// Warning: (ae-forgotten-export) The symbol "RemoteConfigParameterValue" needs to be exported by the entry point default-namespace.d.ts
859+
//
860+
// (undocumented)
861+
export type RemoteConfigParameterValue = RemoteConfigParameterValue;
862+
// Warning: (ae-forgotten-export) The symbol "RemoteConfigTemplate" needs to be exported by the entry point default-namespace.d.ts
863+
//
864+
// (undocumented)
865+
export type RemoteConfigTemplate = RemoteConfigTemplate;
866+
// Warning: (ae-forgotten-export) The symbol "RemoteConfigUser" needs to be exported by the entry point default-namespace.d.ts
867+
//
868+
// (undocumented)
869+
export type RemoteConfigUser = RemoteConfigUser;
870+
// Warning: (ae-forgotten-export) The symbol "TagColor" needs to be exported by the entry point default-namespace.d.ts
871+
//
872+
// (undocumented)
873+
export type TagColor = TagColor;
874+
// Warning: (ae-forgotten-export) The symbol "Version" needs to be exported by the entry point default-namespace.d.ts
875+
//
876+
// (undocumented)
877+
export type Version = Version;
902878
}
903879

904880
// @public (undocumented)
+152
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,152 @@
1+
## API Report File for "firebase-admin.remote-config"
2+
3+
> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
4+
5+
```ts
6+
7+
import { Agent } from 'http';
8+
9+
// @public
10+
export interface ExplicitParameterValue {
11+
value: string;
12+
}
13+
14+
// Warning: (ae-forgotten-export) The symbol "App" needs to be exported by the entry point index.d.ts
15+
//
16+
// @public (undocumented)
17+
export function getRemoteConfig(app?: App): RemoteConfig;
18+
19+
// @public
20+
export interface InAppDefaultValue {
21+
useInAppDefault: boolean;
22+
}
23+
24+
// @public
25+
export interface ListVersionsOptions {
26+
endTime?: Date | string;
27+
endVersionNumber?: string | number;
28+
pageSize?: number;
29+
pageToken?: string;
30+
startTime?: Date | string;
31+
}
32+
33+
// @public
34+
export interface ListVersionsResult {
35+
nextPageToken?: string;
36+
versions: Version[];
37+
}
38+
39+
// @public
40+
export class RemoteConfig {
41+
// (undocumented)
42+
readonly app: App;
43+
createTemplateFromJSON(json: string): RemoteConfigTemplate;
44+
getTemplate(): Promise<RemoteConfigTemplate>;
45+
getTemplateAtVersion(versionNumber: number | string): Promise<RemoteConfigTemplate>;
46+
listVersions(options?: ListVersionsOptions): Promise<ListVersionsResult>;
47+
publishTemplate(template: RemoteConfigTemplate, options?: {
48+
force: boolean;
49+
}): Promise<RemoteConfigTemplate>;
50+
rollback(versionNumber: number | string): Promise<RemoteConfigTemplate>;
51+
validateTemplate(template: RemoteConfigTemplate): Promise<RemoteConfigTemplate>;
52+
}
53+
54+
// @public
55+
export function remoteConfig(app?: App): remoteConfig.RemoteConfig;
56+
57+
// @public (undocumented)
58+
export namespace remoteConfig {
59+
// (undocumented)
60+
export type ExplicitParameterValue = ExplicitParameterValue;
61+
// (undocumented)
62+
export type InAppDefaultValue = InAppDefaultValue;
63+
// (undocumented)
64+
export type ListVersionsOptions = ListVersionsOptions;
65+
// (undocumented)
66+
export type ListVersionsResult = ListVersionsResult;
67+
// (undocumented)
68+
export type RemoteConfig = RemoteConfig;
69+
// (undocumented)
70+
export type RemoteConfigCondition = RemoteConfigCondition;
71+
// (undocumented)
72+
export type RemoteConfigParameter = RemoteConfigParameter;
73+
// (undocumented)
74+
export type RemoteConfigParameterGroup = RemoteConfigParameterGroup;
75+
// (undocumented)
76+
export type RemoteConfigParameterValue = RemoteConfigParameterValue;
77+
// (undocumented)
78+
export type RemoteConfigTemplate = RemoteConfigTemplate;
79+
// (undocumented)
80+
export type RemoteConfigUser = RemoteConfigUser;
81+
// (undocumented)
82+
export type TagColor = TagColor;
83+
// (undocumented)
84+
export type Version = Version;
85+
}
86+
87+
// @public
88+
export interface RemoteConfigCondition {
89+
expression: string;
90+
name: string;
91+
tagColor?: TagColor;
92+
}
93+
94+
// @public
95+
export interface RemoteConfigParameter {
96+
conditionalValues?: {
97+
[key: string]: RemoteConfigParameterValue;
98+
};
99+
defaultValue?: RemoteConfigParameterValue;
100+
description?: string;
101+
}
102+
103+
// @public
104+
export interface RemoteConfigParameterGroup {
105+
description?: string;
106+
parameters: {
107+
[key: string]: RemoteConfigParameter;
108+
};
109+
}
110+
111+
// @public
112+
export type RemoteConfigParameterValue = ExplicitParameterValue | InAppDefaultValue;
113+
114+
// @public
115+
export interface RemoteConfigTemplate {
116+
conditions: RemoteConfigCondition[];
117+
readonly etag: string;
118+
parameterGroups: {
119+
[key: string]: RemoteConfigParameterGroup;
120+
};
121+
parameters: {
122+
[key: string]: RemoteConfigParameter;
123+
};
124+
version?: Version;
125+
}
126+
127+
// @public
128+
export interface RemoteConfigUser {
129+
email: string;
130+
imageUrl?: string;
131+
name?: string;
132+
}
133+
134+
// @public
135+
export type TagColor = 'BLUE' | 'BROWN' | 'CYAN' | 'DEEP_ORANGE' | 'GREEN' | 'INDIGO' | 'LIME' | 'ORANGE' | 'PINK' | 'PURPLE' | 'TEAL';
136+
137+
// @public
138+
export interface Version {
139+
description?: string;
140+
isLegacy?: boolean;
141+
rollbackSource?: string;
142+
updateOrigin?: ('REMOTE_CONFIG_UPDATE_ORIGIN_UNSPECIFIED' | 'CONSOLE' | 'REST_API' | 'ADMIN_SDK_NODE');
143+
updateTime?: string;
144+
updateType?: ('REMOTE_CONFIG_UPDATE_TYPE_UNSPECIFIED' | 'INCREMENTAL_UPDATE' | 'FORCED_UPDATE' | 'ROLLBACK');
145+
updateUser?: RemoteConfigUser;
146+
versionNumber?: string;
147+
}
148+
149+
150+
// (No @packageDocumentation comment for this package)
151+
152+
```

generate-reports.js

+1
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ const entryPoints = {
3939
'firebase-admin/database': './lib/database/index.d.ts',
4040
'firebase-admin/firestore': './lib/firestore/index.d.ts',
4141
'firebase-admin/instance-id': './lib/instance-id/index.d.ts',
42+
'firebase-admin/remote-config': './lib/remote-config/index.d.ts',
4243
};
4344

4445
const tempConfigFile = 'api-extractor.tmp';

gulpfile.js

+1
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ gulp.task('compile', function() {
9292
'lib/database/*.d.ts',
9393
'lib/firestore/*.d.ts',
9494
'lib/instance-id/*.d.ts',
95+
'lib/remote-config/*.d.ts',
9596
'!lib/utils/index.d.ts',
9697
];
9798

src/app/firebase-app.ts

+3-5
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ import { Firestore } from '@google-cloud/firestore';
3232
import { InstanceId } from '../instance-id/index';
3333
import { ProjectManagement } from '../project-management/project-management';
3434
import { SecurityRules } from '../security-rules/security-rules';
35-
import { RemoteConfig } from '../remote-config/remote-config';
35+
import { RemoteConfig } from '../remote-config/index';
3636

3737
/**
3838
* Type representing a callback which is called every time an app lifecycle event occurs.
@@ -371,10 +371,8 @@ export class FirebaseApp implements app.App {
371371
* @return The RemoteConfig service instance of this app.
372372
*/
373373
public remoteConfig(): RemoteConfig {
374-
return this.ensureService_('remoteConfig', () => {
375-
const remoteConfigService: typeof RemoteConfig = require('../remote-config/remote-config').RemoteConfig;
376-
return new remoteConfigService(this);
377-
});
374+
const fn = require('../remote-config/index').getRemoteConfig;
375+
return fn(this);
378376
}
379377

380378
/**

0 commit comments

Comments
 (0)