From a01fe561babf1ca606d6b6ec6e4ab1796b702a5a Mon Sep 17 00:00:00 2001 From: Xin Wei Date: Tue, 13 Feb 2024 10:49:01 -0800 Subject: [PATCH 1/2] [SSRC] Add API changes needed for SSRC --- src/remote-config/remote-config-api.ts | 80 +++++++++++++++++++++++++- 1 file changed, 79 insertions(+), 1 deletion(-) diff --git a/src/remote-config/remote-config-api.ts b/src/remote-config/remote-config-api.ts index 90f3bd4970..15d601ff6c 100644 --- a/src/remote-config/remote-config-api.ts +++ b/src/remote-config/remote-config-api.ts @@ -54,6 +54,27 @@ export interface RemoteConfigCondition { tagColor?: TagColor; } +/** + * Interface representing a Remote Config condition in the data-plane. + * A condition targets a specific group of users. A list of these conditions make up + * part of a Remote Config template. + */ +export interface RemoteConfigServerCondition { + + /** + * A non-empty and unique name of this condition. + */ + name: string; + + /** + * The logic of this condition. + * See the documentation on + * {@link https://firebase.google.com/docs/remote-config/condition-reference | condition expressions} + * for the expected syntax of this field. + */ + expression: string; +} + /** * Interface representing an explicit parameter value. */ @@ -135,7 +156,7 @@ export interface RemoteConfigParameterGroup { } /** - * Interface representing a Remote Config template. + * Interface representing a Remote Config client template. */ export interface RemoteConfigTemplate { /** @@ -167,6 +188,58 @@ export interface RemoteConfigTemplate { version?: Version; } +/** + * Interface representing the template data returned by the Remote Config API in the data-plane. + */ +export interface RemoteConfigServerTemplateData { + /** + * A list of conditions in descending order by priority. + */ + conditions: RemoteConfigServerCondition[]; + + /** + * Map of parameter keys to their optional default values and optional conditional values. + */ + parameters: { [key: string]: RemoteConfigParameter }; + + /** + * ETag of the current Remote Config template (readonly). + */ + readonly etag: string; + + /** + * Version information for the current Remote Config template. + */ + version?: Version; +} + +/** + * Interface representing non-API data for the Remote Config template in the data-plane. + */ +export interface RemoteConfigServerTemplate { + + /** + * Cached {@link RemoteConfigServerTemplateData} + */ + cache: RemoteConfigServerTemplateData; + + /** + * A {@link RemoteConfigServerConfig} containing default values for Config + */ + defaultConfig: RemoteConfigServerConfig; + + /** + * Evaluates the current template to produce a {@link RemoteConfigServerConfig} + */ + evaluate(): RemoteConfigServerConfig; + + /** + * Fetches and caches the current active version of the + * {@link RemoteConfigServerTemplate} of the project. + */ + load(): Promise; +} + /** * Interface representing a Remote Config user. */ @@ -289,3 +362,8 @@ export interface ListVersionsOptions { */ endTime?: Date | string; } + +/** + * Defines the type for the configuration produced by evaluating a server template. + */ +export type RemoteConfigServerConfig = { [key: string]: string | boolean | number } From e48a65ab9d113fb587cda9edb72eff4ab5b3b6e8 Mon Sep 17 00:00:00 2001 From: Erik Eldridge Date: Tue, 13 Feb 2024 11:45:05 -0800 Subject: [PATCH 2/2] Strip whitespace and improve documentation consistency --- src/remote-config/remote-config-api.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/remote-config/remote-config-api.ts b/src/remote-config/remote-config-api.ts index 15d601ff6c..dd9f641034 100644 --- a/src/remote-config/remote-config-api.ts +++ b/src/remote-config/remote-config-api.ts @@ -189,7 +189,7 @@ export interface RemoteConfigTemplate { } /** - * Interface representing the template data returned by the Remote Config API in the data-plane. + * Interface representing the data in a Remote Config server template. */ export interface RemoteConfigServerTemplateData { /** @@ -214,7 +214,7 @@ export interface RemoteConfigServerTemplateData { } /** - * Interface representing non-API data for the Remote Config template in the data-plane. + * Interface representing a stateful abstraction for a Remote Config server template. */ export interface RemoteConfigServerTemplate { @@ -234,7 +234,7 @@ export interface RemoteConfigServerTemplate { evaluate(): RemoteConfigServerConfig; /** - * Fetches and caches the current active version of the + * Fetches and caches the current active version of the * {@link RemoteConfigServerTemplate} of the project. */ load(): Promise; @@ -364,6 +364,6 @@ export interface ListVersionsOptions { } /** - * Defines the type for the configuration produced by evaluating a server template. + * Type representing the configuration produced by evaluating a server template. */ export type RemoteConfigServerConfig = { [key: string]: string | boolean | number }