Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Differentiate options for sync and async SSRC initialization (#2506)
  • Loading branch information
erikeldridge authored Apr 2, 2024
commit 69c12622a7ba467128066c86d1f2195ede6c0e50
20 changes: 12 additions & 8 deletions etc/firebase-admin.remote-config.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,21 @@ export interface ExplicitParameterValue {
// @public
export function getRemoteConfig(app?: App): RemoteConfig;

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

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

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

// @public
export interface ListVersionsOptions {
endTime?: Date | string;
Expand Down Expand Up @@ -98,10 +108,10 @@ export class RemoteConfig {
// (undocumented)
readonly app: App;
createTemplateFromJSON(json: string): RemoteConfigTemplate;
getServerTemplate(options?: ServerTemplateOptions): Promise<ServerTemplate>;
getServerTemplate(options?: GetServerTemplateOptions): Promise<ServerTemplate>;
getTemplate(): Promise<RemoteConfigTemplate>;
getTemplateAtVersion(versionNumber: number | string): Promise<RemoteConfigTemplate>;
initServerTemplate(options?: ServerTemplateOptions): ServerTemplate;
initServerTemplate(options?: InitServerTemplateOptions): ServerTemplate;
listVersions(options?: ListVersionsOptions): Promise<ListVersionsResult>;
publishTemplate(template: RemoteConfigTemplate, options?: {
force: boolean;
Expand Down Expand Up @@ -180,12 +190,6 @@ export interface ServerTemplateData {
version?: Version;
}

// @public
export interface ServerTemplateOptions {
defaultConfig?: ServerConfig;
template?: ServerTemplateData;
}

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

Expand Down
3 changes: 2 additions & 1 deletion src/remote-config/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ export {
AndCondition,
EvaluationContext,
ExplicitParameterValue,
GetServerTemplateOptions,
InAppDefaultValue,
InitServerTemplateOptions,
ListVersionsOptions,
ListVersionsResult,
MicroPercentRange,
Expand All @@ -47,7 +49,6 @@ export {
ServerConfig,
ServerTemplate,
ServerTemplateData,
ServerTemplateOptions,
TagColor,
Version,
} from './remote-config-api';
Expand Down
9 changes: 8 additions & 1 deletion src/remote-config/remote-config-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -354,14 +354,21 @@ export interface ServerTemplateData {
/**
* Represents optional arguments that can be used when instantiating {@link ServerTemplate}.
*/
export interface ServerTemplateOptions {
export interface GetServerTemplateOptions {

/**
* Defines in-app default parameter values, so that your app behaves as
* intended before it connects to the Remote Config backend, and so that
* default values are available if none are set on the backend.
*/
defaultConfig?: ServerConfig,
}

/**
* Represents optional arguments that can be used when instantiating
* {@link ServerTemplate} synchonously.
*/
export interface InitServerTemplateOptions extends GetServerTemplateOptions {

/**
* Enables integrations to use template data loaded independently. For
Expand Down
7 changes: 4 additions & 3 deletions src/remote-config/remote-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,9 @@ import {
RemoteConfigParameterValue,
EvaluationContext,
ServerTemplateData,
ServerTemplateOptions,
NamedCondition,
GetServerTemplateOptions,
InitServerTemplateOptions,
} from './remote-config-api';

/**
Expand Down Expand Up @@ -184,7 +185,7 @@ export class RemoteConfig {
* Instantiates {@link ServerTemplate} and then fetches and caches the latest
* template version of the project.
*/
public async getServerTemplate(options?: ServerTemplateOptions): Promise<ServerTemplate> {
public async getServerTemplate(options?: GetServerTemplateOptions): Promise<ServerTemplate> {
const template = this.initServerTemplate(options);
await template.load();
return template;
Expand All @@ -193,7 +194,7 @@ export class RemoteConfig {
/**
* Synchronously instantiates {@link ServerTemplate}.
*/
public initServerTemplate(options?: ServerTemplateOptions): ServerTemplate {
public initServerTemplate(options?: InitServerTemplateOptions): ServerTemplate {
const template = new ServerTemplateImpl(
this.client, new ConditionEvaluator(), options?.defaultConfig);
if (options?.template) {
Expand Down