Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(rc): Add server side Remote Config support #2529

Merged
merged 17 commits into from
Apr 15, 2024
Merged
Show file tree
Hide file tree
Changes from 14 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
109 changes: 109 additions & 0 deletions etc/firebase-admin.remote-config.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,21 @@

import { Agent } from 'http';

// @public
export interface AndCondition {
conditions?: Array<OneOfCondition>;
}

// @public
export type DefaultConfig = {
[key: string]: string | number | boolean;
};

// @public
export type EvaluationContext = {
randomizationId?: string;
};

// @public
export interface ExplicitParameterValue {
value: string;
Expand All @@ -18,11 +33,21 @@ export interface ExplicitParameterValue {
// @public
export function getRemoteConfig(app?: App): RemoteConfig;

// @public
export interface GetServerTemplateOptions {
defaultConfig?: DefaultConfig;
}

// @public
export interface InAppDefaultValue {
useInAppDefault: boolean;
}

// @public
export interface InitServerTemplateOptions extends GetServerTemplateOptions {
template?: ServerTemplateDataType;
}

// @public
export interface ListVersionsOptions {
endTime?: Date | string;
Expand All @@ -38,16 +63,60 @@ export interface ListVersionsResult {
versions: Version[];
}

// @public
export interface MicroPercentRange {
microPercentLowerBound?: number;
microPercentUpperBound?: number;
}

// @public
export interface NamedCondition {
condition: OneOfCondition;
name: string;
}

// @public
export interface OneOfCondition {
andCondition?: AndCondition;
false?: Record<string, never>;
orCondition?: OrCondition;
percent?: PercentCondition;
true?: Record<string, never>;
}

// @public
export interface OrCondition {
conditions?: Array<OneOfCondition>;
}

// @public
export type ParameterValueType = 'STRING' | 'BOOLEAN' | 'NUMBER' | 'JSON';

// @public
export interface PercentCondition {
microPercent?: number;
microPercentRange?: MicroPercentRange;
percentOperator?: PercentConditionOperator;
seed?: string;
}

// @public
export enum PercentConditionOperator {
BETWEEN = "BETWEEN",
GREATER_THAN = "GREATER_THAN",
LESS_OR_EQUAL = "LESS_OR_EQUAL",
UNKNOWN = "UNKNOWN"
}

// @public
export class RemoteConfig {
// (undocumented)
readonly app: App;
createTemplateFromJSON(json: string): RemoteConfigTemplate;
getServerTemplate(options?: GetServerTemplateOptions): Promise<ServerTemplate>;
getTemplate(): Promise<RemoteConfigTemplate>;
getTemplateAtVersion(versionNumber: number | string): Promise<RemoteConfigTemplate>;
initServerTemplate(options?: InitServerTemplateOptions): ServerTemplate;
listVersions(options?: ListVersionsOptions): Promise<ListVersionsResult>;
publishTemplate(template: RemoteConfigTemplate, options?: {
force: boolean;
Expand Down Expand Up @@ -104,9 +173,49 @@ export interface RemoteConfigUser {
name?: string;
}

// @public
export interface ServerConfig {
getBoolean(key: string): boolean;
getNumber(key: string): number;
getString(key: string): string;
getValue(key: string): Value;
}

// @public
export interface ServerTemplate {
evaluate(context?: EvaluationContext): ServerConfig;
load(): Promise<void>;
set(template: ServerTemplateDataType): void;
toJSON(): ServerTemplateData;
}

// @public
export interface ServerTemplateData {
conditions: NamedCondition[];
readonly etag: string;
parameters: {
[key: string]: RemoteConfigParameter;
};
version?: Version;
}

// @public
export type ServerTemplateDataType = ServerTemplateData | string;

// @public
export type TagColor = 'BLUE' | 'BROWN' | 'CYAN' | 'DEEP_ORANGE' | 'GREEN' | 'INDIGO' | 'LIME' | 'ORANGE' | 'PINK' | 'PURPLE' | 'TEAL';

// @public
export interface Value {
asBoolean(): boolean;
asNumber(): number;
asString(): string;
getSource(): ValueSource;
}

// @public
export type ValueSource = 'static' | 'default' | 'remote';

// @public
export interface Version {
description?: string;
Expand Down
Loading
Loading