Skip to content

Commit 646d90f

Browse files
chore(rc): Move manual typings remote-config typings to separate folder (#975)
* Move remote-config typings to another file Co-authored-by: Lahiru Maramba <[email protected]>
1 parent f3d9da5 commit 646d90f

File tree

2 files changed

+363
-345
lines changed

2 files changed

+363
-345
lines changed

src/index.d.ts

Lines changed: 13 additions & 345 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import * as _database from './database';
2323
import * as _messaging from './messaging';
2424
import * as _instanceId from './instance-id';
2525
import * as _projectManagement from './project-management';
26+
import * as _remoteConfig from './remote-config';
2627
import * as _securityRules from './security-rules';
2728

2829
/* eslint-disable @typescript-eslint/ban-types */
@@ -847,351 +848,18 @@ declare namespace admin.projectManagement {
847848
}
848849

849850
declare namespace admin.remoteConfig {
850-
851-
/**
852-
* Colors that are associated with conditions for display purposes.
853-
*/
854-
type TagColor = 'BLUE' | 'BROWN' | 'CYAN' | 'DEEP_ORANGE' | 'GREEN' |
855-
'INDIGO' | 'LIME' | 'ORANGE' | 'PINK' | 'PURPLE' | 'TEAL';
856-
857-
/**
858-
* Interface representing a Remote Config template.
859-
*/
860-
interface RemoteConfigTemplate {
861-
/**
862-
* A list of conditions in descending order by priority.
863-
*/
864-
conditions: RemoteConfigCondition[];
865-
866-
/**
867-
* Map of parameter keys to their optional default values and optional conditional values.
868-
*/
869-
parameters: { [key: string]: RemoteConfigParameter };
870-
871-
/**
872-
* Map of parameter group names to their parameter group objects.
873-
* A group's name is mutable but must be unique among groups in the Remote Config template.
874-
* The name is limited to 256 characters and intended to be human-readable. Any Unicode
875-
* characters are allowed.
876-
*/
877-
parameterGroups: { [key: string]: RemoteConfigParameterGroup };
878-
879-
/**
880-
* ETag of the current Remote Config template (readonly).
881-
*/
882-
readonly etag: string;
883-
884-
/**
885-
* Version information for the current Remote Config template.
886-
*/
887-
version?: Version;
888-
}
889-
890-
/**
891-
* Interface representing a Remote Config parameter.
892-
* At minimum, a `defaultValue` or a `conditionalValues` entry must be present for the
893-
* parameter to have any effect.
894-
*/
895-
interface RemoteConfigParameter {
896-
897-
/**
898-
* The value to set the parameter to, when none of the named conditions evaluate to `true`.
899-
*/
900-
defaultValue?: RemoteConfigParameterValue;
901-
902-
/**
903-
* A `(condition name, value)` map. The condition name of the highest priority
904-
* (the one listed first in the Remote Config template's conditions list) determines the value of
905-
* this parameter.
906-
*/
907-
conditionalValues?: { [key: string]: RemoteConfigParameterValue };
908-
909-
/**
910-
* A description for this parameter. Should not be over 100 characters and may contain any
911-
* Unicode characters.
912-
*/
913-
description?: string;
914-
}
915-
916-
/**
917-
* Interface representing a Remote Config parameter group.
918-
* Grouping parameters is only for management purposes and does not affect client-side
919-
* fetching of parameter values.
920-
*/
921-
export interface RemoteConfigParameterGroup {
922-
/**
923-
* A description for the group. Its length must be less than or equal to 256 characters.
924-
* A description may contain any Unicode characters.
925-
*/
926-
description?: string;
927-
928-
/**
929-
* Map of parameter keys to their optional default values and optional conditional values for
930-
* parameters that belong to this group. A parameter only appears once per
931-
* Remote Config template. An ungrouped parameter appears at the top level, whereas a
932-
* parameter organized within a group appears within its group's map of parameters.
933-
*/
934-
parameters: { [key: string]: RemoteConfigParameter };
935-
}
936-
937-
/**
938-
* Interface representing a Remote Config condition.
939-
* A condition targets a specific group of users. A list of these conditions make up
940-
* part of a Remote Config template.
941-
*/
942-
interface RemoteConfigCondition {
943-
944-
/**
945-
* A non-empty and unique name of this condition.
946-
*/
947-
name: string;
948-
949-
/**
950-
* The logic of this condition.
951-
* See the documentation on
952-
* {@link https://firebase.google.com/docs/remote-config/condition-reference condition expressions}
953-
* for the expected syntax of this field.
954-
*/
955-
expression: string;
956-
957-
/**
958-
* The color associated with this condition for display purposes in the Firebase Console.
959-
* Not specifying this value results in the console picking an arbitrary color to associate
960-
* with the condition.
961-
*/
962-
tagColor?: TagColor;
963-
}
964-
965-
/**
966-
* Interface representing an explicit parameter value.
967-
*/
968-
interface ExplicitParameterValue {
969-
/**
970-
* The `string` value that the parameter is set to.
971-
*/
972-
value: string;
973-
}
974-
975-
/**
976-
* Interface representing an in-app-default value.
977-
*/
978-
interface InAppDefaultValue {
979-
/**
980-
* If `true`, the parameter is omitted from the parameter values returned to a client.
981-
*/
982-
useInAppDefault: boolean;
983-
}
984-
985-
/**
986-
* Type representing a Remote Config parameter value.
987-
* A `RemoteConfigParameterValue` could be either an `ExplicitParameterValue` or
988-
* an `InAppDefaultValue`.
989-
*/
990-
type RemoteConfigParameterValue = ExplicitParameterValue | InAppDefaultValue;
991-
992-
/**
993-
* Interface representing a Remote Config template version.
994-
* Output only, except for the version description. Contains metadata about a particular
995-
* version of the Remote Config template. All fields are set at the time the specified Remote
996-
* Config template is published. A version's description field may be specified in
997-
* `publishTemplate` calls.
998-
*/
999-
export interface Version {
1000-
/**
1001-
* The version number of a Remote Config template.
1002-
*/
1003-
versionNumber?: string;
1004-
1005-
/**
1006-
* The timestamp of when this version of the Remote Config template was written to the
1007-
* Remote Config backend.
1008-
*/
1009-
updateTime?: string;
1010-
1011-
/**
1012-
* The origin of the template update action.
1013-
*/
1014-
updateOrigin?: ('REMOTE_CONFIG_UPDATE_ORIGIN_UNSPECIFIED' | 'CONSOLE' |
1015-
'REST_API' | 'ADMIN_SDK_NODE');
1016-
1017-
/**
1018-
* The type of the template update action.
1019-
*/
1020-
updateType?: ('REMOTE_CONFIG_UPDATE_TYPE_UNSPECIFIED' |
1021-
'INCREMENTAL_UPDATE' | 'FORCED_UPDATE' | 'ROLLBACK');
1022-
1023-
/**
1024-
* Aggregation of all metadata fields about the account that performed the update.
1025-
*/
1026-
updateUser?: RemoteConfigUser;
1027-
1028-
/**
1029-
* The user-provided description of the corresponding Remote Config template.
1030-
*/
1031-
description?: string;
1032-
1033-
/**
1034-
* The version number of the Remote Config template that has become the current version
1035-
* due to a rollback. Only present if this version is the result of a rollback.
1036-
*/
1037-
rollbackSource?: string;
1038-
1039-
/**
1040-
* Indicates whether this Remote Config template was published before version history was
1041-
* supported.
1042-
*/
1043-
isLegacy?: boolean;
1044-
}
1045-
1046-
/** Interface representing a list of Remote Config template versions. */
1047-
export interface ListVersionsResult {
1048-
/**
1049-
* A list of version metadata objects, sorted in reverse chronological order.
1050-
*/
1051-
versions: Version[];
1052-
1053-
/**
1054-
* Token to retrieve the next page of results, or empty if there are no more results
1055-
* in the list.
1056-
*/
1057-
nextPageToken?: string;
1058-
}
1059-
1060-
/** Interface representing options for Remote Config list versions operation. */
1061-
export interface ListVersionsOptions {
1062-
/**
1063-
* The maximum number of items to return per page.
1064-
*/
1065-
pageSize?: number;
1066-
1067-
/**
1068-
* The `nextPageToken` value returned from a previous list versions request, if any.
1069-
*/
1070-
pageToken?: string;
1071-
1072-
/**
1073-
* Specifies the newest version number to include in the results.
1074-
* If specified, must be greater than zero. Defaults to the newest version.
1075-
*/
1076-
endVersionNumber?: string | number;
1077-
1078-
/**
1079-
* Specifies the earliest update time to include in the results. Any entries updated before this
1080-
* time are omitted.
1081-
*/
1082-
startTime?: Date | string;
1083-
1084-
/**
1085-
* Specifies the latest update time to include in the results. Any entries updated on or after
1086-
* this time are omitted.
1087-
*/
1088-
endTime?: Date | string;
1089-
}
1090-
1091-
/** Interface representing a Remote Config user.*/
1092-
export interface RemoteConfigUser {
1093-
/**
1094-
* Email address. Output only.
1095-
*/
1096-
email: string;
1097-
1098-
/**
1099-
* Display name. Output only.
1100-
*/
1101-
name?: string;
1102-
1103-
/**
1104-
* Image URL. Output only.
1105-
*/
1106-
imageUrl?: string;
1107-
}
1108-
1109-
/**
1110-
* The Firebase `RemoteConfig` service interface.
1111-
*
1112-
* Do not call this constructor directly. Instead, use
1113-
* [`admin.remoteConfig()`](admin.remoteConfig#remoteConfig).
1114-
*/
1115-
interface RemoteConfig {
1116-
app: admin.app.App;
1117-
1118-
/**
1119-
* Gets the current active version of the {@link admin.remoteConfig.RemoteConfigTemplate
1120-
* `RemoteConfigTemplate`} of the project.
1121-
*
1122-
* @return A promise that fulfills with a `RemoteConfigTemplate`.
1123-
*/
1124-
getTemplate(): Promise<RemoteConfigTemplate>;
1125-
1126-
/**
1127-
* Gets the requested version of the {@link admin.remoteConfig.RemoteConfigTemplate
1128-
* `RemoteConfigTemplate`} of the project.
1129-
*
1130-
* @param versionNumber Version number of the Remote Config template to look up.
1131-
*
1132-
* @return A promise that fulfills with a `RemoteConfigTemplate`.
1133-
*/
1134-
getTemplateAtVersion(versionNumber: number | string): Promise<RemoteConfigTemplate>;
1135-
1136-
/**
1137-
* Validates a {@link admin.remoteConfig.RemoteConfigTemplate `RemoteConfigTemplate`}.
1138-
*
1139-
* @param template The Remote Config template to be validated.
1140-
* @returns A promise that fulfills with the validated `RemoteConfigTemplate`.
1141-
*/
1142-
validateTemplate(template: RemoteConfigTemplate): Promise<RemoteConfigTemplate>;
1143-
1144-
/**
1145-
* Publishes a Remote Config template.
1146-
*
1147-
* @param template The Remote Config template to be published.
1148-
* @param options Optional options object when publishing a Remote Config template:
1149-
* - {boolean} `force` Setting this to `true` forces the Remote Config template to
1150-
* be updated and circumvent the ETag. This approach is not recommended
1151-
* because it risks causing the loss of updates to your Remote Config
1152-
* template if multiple clients are updating the Remote Config template.
1153-
* See {@link https://firebase.google.com/docs/remote-config/use-config-rest#etag_usage_and_forced_updates
1154-
* ETag usage and forced updates}.
1155-
*
1156-
* @return A Promise that fulfills with the published `RemoteConfigTemplate`.
1157-
*/
1158-
publishTemplate(template: RemoteConfigTemplate, options?: { force: boolean }): Promise<RemoteConfigTemplate>;
1159-
1160-
/**
1161-
* Rolls back a project's published Remote Config template to the specified version.
1162-
* A rollback is equivalent to getting a previously published Remote Config
1163-
* template and re-publishing it using a force update.
1164-
*
1165-
* @param versionNumber The version number of the Remote Config template to roll back to.
1166-
* The specified version number must be lower than the current version number, and not have
1167-
* been deleted due to staleness. Only the last 300 versions are stored.
1168-
* All versions that correspond to non-active Remote Config templates (that is, all except the
1169-
* template that is being fetched by clients) are also deleted if they are more than 90 days old.
1170-
* @return A promise that fulfills with the published `RemoteConfigTemplate`.
1171-
*/
1172-
rollback(versionNumber: string | number): Promise<RemoteConfigTemplate>;
1173-
1174-
/**
1175-
* Gets a list of Remote Config template versions that have been published, sorted in reverse
1176-
* chronological order. Only the last 300 versions are stored.
1177-
* All versions that correspond to non-active Remote Config templates (that is, all except the
1178-
* template that is being fetched by clients) are also deleted if they are more than 90 days old.
1179-
*
1180-
* @param options Optional {@link admin.remoteConfig.ListVersionsOptions `ListVersionsOptions`}
1181-
* object for getting a list of template versions.
1182-
* @return A promise that fulfills with a `ListVersionsResult`.
1183-
*/
1184-
listVersions(options?: ListVersionsOptions): Promise<ListVersionsResult>;
1185-
1186-
/**
1187-
* Creates and returns a new Remote Config template from a JSON string.
1188-
*
1189-
* @param json The JSON string to populate a Remote Config template.
1190-
*
1191-
* @return A new template instance.
1192-
*/
1193-
createTemplateFromJSON(json: string): RemoteConfigTemplate;
1194-
}
851+
export import TagColor = _remoteConfig.admin.remoteConfig.TagColor;
852+
export import RemoteConfigTemplate = _remoteConfig.admin.remoteConfig.RemoteConfigTemplate;
853+
export import RemoteConfigParameter = _remoteConfig.admin.remoteConfig.RemoteConfigParameter;
854+
export import RemoteConfigParameterGroup = _remoteConfig.admin.remoteConfig.RemoteConfigParameterGroup;
855+
export import RemoteConfigCondition = _remoteConfig.admin.remoteConfig.RemoteConfigCondition;
856+
export import ExplicitParameterValue = _remoteConfig.admin.remoteConfig.ExplicitParameterValue;
857+
export import InAppDefaultValue = _remoteConfig.admin.remoteConfig.InAppDefaultValue;
858+
export import RemoteConfigParameterValue = _remoteConfig.admin.remoteConfig.RemoteConfigParameterValue;
859+
export import Version = _remoteConfig.admin.remoteConfig.Version;
860+
export import ListVersionsResult = _remoteConfig.admin.remoteConfig.ListVersionsResult;
861+
export import RemoteConfigUser = _remoteConfig.admin.remoteConfig.RemoteConfigUser;
862+
export import RemoteConfig = _remoteConfig.admin.remoteConfig.RemoteConfig;
1195863
}
1196864

1197865
declare namespace admin.securityRules {

0 commit comments

Comments
 (0)