Skip to content

Commit f89632a

Browse files
authored
Remove product prefix from SSRC types (#2496)
We have a Firebase AIP to avoid these prefixes.
1 parent 5c9b649 commit f89632a

File tree

7 files changed

+110
-123
lines changed

7 files changed

+110
-123
lines changed

etc/firebase-admin.remote-config.api.md

Lines changed: 34 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,11 @@ export interface ListVersionsResult {
3838
versions: Version[];
3939
}
4040

41+
// @public
42+
export interface NamedCondition {
43+
name: string;
44+
}
45+
4146
// @public
4247
export type ParameterValueType = 'STRING' | 'BOOLEAN' | 'NUMBER' | 'JSON';
4348

@@ -46,10 +51,10 @@ export class RemoteConfig {
4651
// (undocumented)
4752
readonly app: App;
4853
createTemplateFromJSON(json: string): RemoteConfigTemplate;
49-
getServerTemplate(options?: RemoteConfigServerTemplateOptions): Promise<RemoteConfigServerTemplate>;
54+
getServerTemplate(options?: ServerTemplateOptions): Promise<ServerTemplate>;
5055
getTemplate(): Promise<RemoteConfigTemplate>;
5156
getTemplateAtVersion(versionNumber: number | string): Promise<RemoteConfigTemplate>;
52-
initServerTemplate(options?: RemoteConfigServerTemplateOptions): RemoteConfigServerTemplate;
57+
initServerTemplate(options?: ServerTemplateOptions): ServerTemplate;
5358
listVersions(options?: ListVersionsOptions): Promise<ListVersionsResult>;
5459
publishTemplate(template: RemoteConfigTemplate, options?: {
5560
force: boolean;
@@ -87,58 +92,52 @@ export interface RemoteConfigParameterGroup {
8792
export type RemoteConfigParameterValue = ExplicitParameterValue | InAppDefaultValue;
8893

8994
// @public
90-
export interface RemoteConfigServerCondition {
91-
expression: string;
92-
name: string;
93-
}
94-
95-
// @public
96-
export type RemoteConfigServerConfig = {
97-
[key: string]: string | boolean | number;
98-
};
99-
100-
// @public
101-
export interface RemoteConfigServerTemplate {
102-
cache: RemoteConfigServerTemplateData;
103-
defaultConfig: RemoteConfigServerConfig;
104-
evaluate(): RemoteConfigServerConfig;
105-
load(): Promise<void>;
106-
}
107-
108-
// @public
109-
export interface RemoteConfigServerTemplateData {
110-
conditions: RemoteConfigServerCondition[];
95+
export interface RemoteConfigTemplate {
96+
conditions: RemoteConfigCondition[];
11197
readonly etag: string;
98+
parameterGroups: {
99+
[key: string]: RemoteConfigParameterGroup;
100+
};
112101
parameters: {
113102
[key: string]: RemoteConfigParameter;
114103
};
115104
version?: Version;
116105
}
117106

118107
// @public
119-
export interface RemoteConfigServerTemplateOptions {
120-
defaultConfig?: RemoteConfigServerConfig;
121-
template?: RemoteConfigServerTemplateData;
108+
export interface RemoteConfigUser {
109+
email: string;
110+
imageUrl?: string;
111+
name?: string;
122112
}
123113

124114
// @public
125-
export interface RemoteConfigTemplate {
126-
conditions: RemoteConfigCondition[];
115+
export type ServerConfig = {
116+
[key: string]: string | boolean | number;
117+
};
118+
119+
// @public
120+
export interface ServerTemplate {
121+
cache: ServerTemplateData;
122+
defaultConfig: ServerConfig;
123+
evaluate(): ServerConfig;
124+
load(): Promise<void>;
125+
}
126+
127+
// @public
128+
export interface ServerTemplateData {
129+
conditions: NamedCondition[];
127130
readonly etag: string;
128-
parameterGroups: {
129-
[key: string]: RemoteConfigParameterGroup;
130-
};
131131
parameters: {
132132
[key: string]: RemoteConfigParameter;
133133
};
134134
version?: Version;
135135
}
136136

137137
// @public
138-
export interface RemoteConfigUser {
139-
email: string;
140-
imageUrl?: string;
141-
name?: string;
138+
export interface ServerTemplateOptions {
139+
defaultConfig?: ServerConfig;
140+
template?: ServerTemplateData;
142141
}
143142

144143
// @public

src/remote-config/index.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,18 +29,18 @@ export {
2929
InAppDefaultValue,
3030
ListVersionsOptions,
3131
ListVersionsResult,
32+
NamedCondition,
3233
ParameterValueType,
3334
RemoteConfigCondition,
3435
RemoteConfigParameter,
3536
RemoteConfigParameterGroup,
3637
RemoteConfigParameterValue,
3738
RemoteConfigTemplate,
38-
RemoteConfigServerCondition,
39-
RemoteConfigServerConfig,
40-
RemoteConfigServerTemplate,
41-
RemoteConfigServerTemplateData,
42-
RemoteConfigServerTemplateOptions,
4339
RemoteConfigUser,
40+
ServerConfig,
41+
ServerTemplate,
42+
ServerTemplateData,
43+
ServerTemplateOptions,
4444
TagColor,
4545
Version,
4646
} from './remote-config-api';

src/remote-config/remote-config-api-client-internal.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import {
2525
ListVersionsOptions,
2626
ListVersionsResult,
2727
RemoteConfigTemplate,
28-
RemoteConfigServerTemplateData
28+
ServerTemplateData
2929
} from './remote-config-api';
3030

3131
// Remote Config backend constants
@@ -175,7 +175,7 @@ export class RemoteConfigApiClient {
175175
});
176176
}
177177

178-
public getServerTemplate(): Promise<RemoteConfigServerTemplateData> {
178+
public getServerTemplate(): Promise<ServerTemplateData> {
179179
return this.getUrl()
180180
.then((url) => {
181181
const request: HttpRequestConfig = {
@@ -289,7 +289,7 @@ export class RemoteConfigApiClient {
289289
* @param {HttpResponse} resp API response object.
290290
* @param {string} customEtag A custom etag to replace the etag fom the API response (Optional).
291291
*/
292-
private toRemoteConfigServerTemplate(resp: HttpResponse, customEtag?: string): RemoteConfigServerTemplateData {
292+
private toRemoteConfigServerTemplate(resp: HttpResponse, customEtag?: string): ServerTemplateData {
293293
const etag = (typeof customEtag === 'undefined') ? resp.headers['etag'] : customEtag;
294294
this.validateEtag(etag);
295295
return {

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

Lines changed: 16 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -59,20 +59,12 @@ export interface RemoteConfigCondition {
5959
* A condition targets a specific group of users. A list of these conditions make up
6060
* part of a Remote Config template.
6161
*/
62-
export interface RemoteConfigServerCondition {
62+
export interface NamedCondition {
6363

6464
/**
6565
* A non-empty and unique name of this condition.
6666
*/
6767
name: string;
68-
69-
/**
70-
* The logic of this condition.
71-
* See the documentation on
72-
* {@link https://firebase.google.com/docs/remote-config/condition-reference | condition expressions}
73-
* for the expected syntax of this field.
74-
*/
75-
expression: string;
7668
}
7769

7870
/**
@@ -191,11 +183,11 @@ export interface RemoteConfigTemplate {
191183
/**
192184
* Represents the data in a Remote Config server template.
193185
*/
194-
export interface RemoteConfigServerTemplateData {
186+
export interface ServerTemplateData {
195187
/**
196188
* A list of conditions in descending order by priority.
197189
*/
198-
conditions: RemoteConfigServerCondition[];
190+
conditions: NamedCondition[];
199191

200192
/**
201193
* Map of parameter keys to their optional default values and optional conditional values.
@@ -214,49 +206,49 @@ export interface RemoteConfigServerTemplateData {
214206
}
215207

216208
/**
217-
* Represents optional arguments that can be used when instantiating {@link RemoteConfigServerTemplate}.
209+
* Represents optional arguments that can be used when instantiating {@link ServerTemplate}.
218210
*/
219-
export interface RemoteConfigServerTemplateOptions {
211+
export interface ServerTemplateOptions {
220212

221213
/**
222214
* Defines in-app default parameter values, so that your app behaves as
223215
* intended before it connects to the Remote Config backend, and so that
224216
* default values are available if none are set on the backend.
225217
*/
226-
defaultConfig?: RemoteConfigServerConfig,
218+
defaultConfig?: ServerConfig,
227219

228220
/**
229221
* Enables integrations to use template data loaded independently. For
230222
* example, customers can reduce initialization latency by pre-fetching and
231223
* caching template data and then using this option to initialize the SDK with
232224
* that data.
233225
*/
234-
template?: RemoteConfigServerTemplateData,
226+
template?: ServerTemplateData,
235227
}
236228

237229
/**
238230
* Represents a stateful abstraction for a Remote Config server template.
239231
*/
240-
export interface RemoteConfigServerTemplate {
232+
export interface ServerTemplate {
241233

242234
/**
243-
* Cached {@link RemoteConfigServerTemplateData}.
235+
* Cached {@link ServerTemplateData}.
244236
*/
245-
cache: RemoteConfigServerTemplateData;
237+
cache: ServerTemplateData;
246238

247239
/**
248-
* A {@link RemoteConfigServerConfig} that contains default Config values.
240+
* A {@link ServerConfig} that contains default Config values.
249241
*/
250-
defaultConfig: RemoteConfigServerConfig;
242+
defaultConfig: ServerConfig;
251243

252244
/**
253-
* Evaluates the current template to produce a {@link RemoteConfigServerConfig}.
245+
* Evaluates the current template to produce a {@link ServerConfig}.
254246
*/
255-
evaluate(): RemoteConfigServerConfig;
247+
evaluate(): ServerConfig;
256248

257249
/**
258250
* Fetches and caches the current active version of the
259-
* project's {@link RemoteConfigServerTemplate}.
251+
* project's {@link ServerTemplate}.
260252
*/
261253
load(): Promise<void>;
262254
}
@@ -387,4 +379,4 @@ export interface ListVersionsOptions {
387379
/**
388380
* Represents the configuration produced by evaluating a server template.
389381
*/
390-
export type RemoteConfigServerConfig = { [key: string]: string | boolean | number }
382+
export type ServerConfig = { [key: string]: string | boolean | number }

src/remote-config/remote-config.ts

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,17 @@ import {
2323
RemoteConfigCondition,
2424
RemoteConfigParameter,
2525
RemoteConfigParameterGroup,
26-
RemoteConfigServerTemplate,
26+
ServerTemplate,
2727
RemoteConfigTemplate,
2828
RemoteConfigUser,
2929
Version,
3030
ExplicitParameterValue,
3131
InAppDefaultValue,
3232
ParameterValueType,
33-
RemoteConfigServerConfig,
34-
RemoteConfigServerTemplateData,
35-
RemoteConfigServerTemplateOptions,
33+
ServerConfig,
34+
ServerTemplateData,
35+
ServerTemplateOptions,
36+
NamedCondition,
3637
} from './remote-config-api';
3738

3839
/**
@@ -177,20 +178,20 @@ export class RemoteConfig {
177178
}
178179

179180
/**
180-
* Instantiates {@link RemoteConfigServerTemplate} and then fetches and caches the latest
181+
* Instantiates {@link ServerTemplate} and then fetches and caches the latest
181182
* template version of the project.
182183
*/
183-
public async getServerTemplate(options?: RemoteConfigServerTemplateOptions): Promise<RemoteConfigServerTemplate> {
184+
public async getServerTemplate(options?: ServerTemplateOptions): Promise<ServerTemplate> {
184185
const template = this.initServerTemplate(options);
185186
await template.load();
186187
return template;
187188
}
188189

189190
/**
190-
* Synchronously instantiates {@link RemoteConfigServerTemplate}.
191+
* Synchronously instantiates {@link ServerTemplate}.
191192
*/
192-
public initServerTemplate(options?: RemoteConfigServerTemplateOptions): RemoteConfigServerTemplate {
193-
const template = new RemoteConfigServerTemplateImpl(this.client, options?.defaultConfig);
193+
public initServerTemplate(options?: ServerTemplateOptions): ServerTemplate {
194+
const template = new ServerTemplateImpl(this.client, options?.defaultConfig);
194195
if (options?.template) {
195196
template.cache = options?.template;
196197
}
@@ -285,35 +286,35 @@ class RemoteConfigTemplateImpl implements RemoteConfigTemplate {
285286
/**
286287
* Remote Config dataplane template data implementation.
287288
*/
288-
class RemoteConfigServerTemplateImpl implements RemoteConfigServerTemplate {
289-
public cache: RemoteConfigServerTemplateData;
289+
class ServerTemplateImpl implements ServerTemplate {
290+
public cache: ServerTemplateData;
290291

291292
constructor(
292293
private readonly apiClient: RemoteConfigApiClient,
293-
public readonly defaultConfig: RemoteConfigServerConfig = {}
294+
public readonly defaultConfig: ServerConfig = {}
294295
) { }
295296

296297
/**
297-
* Fetches and caches the current active version of the project's {@link RemoteConfigServerTemplate}.
298+
* Fetches and caches the current active version of the project's {@link ServerTemplate}.
298299
*/
299300
public load(): Promise<void> {
300301
return this.apiClient.getServerTemplate()
301302
.then((template) => {
302-
this.cache = new RemoteConfigServerTemplateDataImpl(template);
303+
this.cache = new ServerTemplateDataImpl(template);
303304
});
304305
}
305306

306307
/**
307-
* Evaluates the current template in cache to produce a {@link RemoteConfigServerConfig}.
308+
* Evaluates the current template in cache to produce a {@link ServerConfig}.
308309
*/
309-
public evaluate(): RemoteConfigServerConfig {
310+
public evaluate(): ServerConfig {
310311
if (!this.cache) {
311312
throw new FirebaseRemoteConfigError(
312313
'failed-precondition',
313314
'No Remote Config Server template in cache. Call load() before calling evaluate().');
314315
}
315316

316-
const evaluatedConfig: RemoteConfigServerConfig = {};
317+
const evaluatedConfig: ServerConfig = {};
317318

318319
for (const [key, parameter] of Object.entries(this.cache.parameters)) {
319320
const { defaultValue, valueType } = parameter;
@@ -339,7 +340,7 @@ class RemoteConfigServerTemplateImpl implements RemoteConfigServerTemplate {
339340
// Enables config to be a convenient object, but with the ability to perform additional
340341
// functionality when a value is retrieved.
341342
const proxyHandler = {
342-
get(target: RemoteConfigServerConfig, prop: string) {
343+
get(target: ServerConfig, prop: string) {
343344
return target[prop];
344345
}
345346
};
@@ -374,14 +375,14 @@ class RemoteConfigServerTemplateImpl implements RemoteConfigServerTemplate {
374375
/**
375376
* Remote Config dataplane template data implementation.
376377
*/
377-
class RemoteConfigServerTemplateDataImpl implements RemoteConfigServerTemplateData {
378+
class ServerTemplateDataImpl implements ServerTemplateData {
378379
public parameters: { [key: string]: RemoteConfigParameter };
379380
public parameterGroups: { [key: string]: RemoteConfigParameterGroup };
380-
public conditions: RemoteConfigCondition[];
381+
public conditions: NamedCondition[];
381382
public readonly etag: string;
382383
public version?: Version;
383384

384-
constructor(template: RemoteConfigServerTemplateData) {
385+
constructor(template: ServerTemplateData) {
385386
if (!validator.isNonNullObject(template) ||
386387
!validator.isNonEmptyString(template.etag)) {
387388
throw new FirebaseRemoteConfigError(

0 commit comments

Comments
 (0)