Skip to content

feat(rc): Exposed RC APIs from firebase-admin/remote-config entry point #1152

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

Merged
merged 2 commits into from
Feb 2, 2021
Merged
Show file tree
Hide file tree
Changes from all 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
130 changes: 53 additions & 77 deletions etc/firebase-admin.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -819,86 +819,62 @@ export namespace projectManagement {
export function refreshToken(refreshTokenPathOrObject: string | object, httpAgent?: Agent): Credential;

// @public
export function remoteConfig(app?: app.App): remoteConfig.RemoteConfig;
export function remoteConfig(app?: App): remoteConfig.RemoteConfig;

// @public (undocumented)
export namespace remoteConfig {
export interface ExplicitParameterValue {
value: string;
}
export interface InAppDefaultValue {
useInAppDefault: boolean;
}
export interface ListVersionsOptions {
endTime?: Date | string;
endVersionNumber?: string | number;
pageSize?: number;
pageToken?: string;
startTime?: Date | string;
}
export interface ListVersionsResult {
nextPageToken?: string;
versions: Version[];
}
export interface RemoteConfig {
// (undocumented)
app: app.App;
createTemplateFromJSON(json: string): RemoteConfigTemplate;
getTemplate(): Promise<RemoteConfigTemplate>;
getTemplateAtVersion(versionNumber: number | string): Promise<RemoteConfigTemplate>;
listVersions(options?: ListVersionsOptions): Promise<ListVersionsResult>;
publishTemplate(template: RemoteConfigTemplate, options?: {
force: boolean;
}): Promise<RemoteConfigTemplate>;
rollback(versionNumber: string | number): Promise<RemoteConfigTemplate>;
validateTemplate(template: RemoteConfigTemplate): Promise<RemoteConfigTemplate>;
}
export interface RemoteConfigCondition {
expression: string;
name: string;
tagColor?: TagColor;
}
export interface RemoteConfigParameter {
conditionalValues?: {
[key: string]: RemoteConfigParameterValue;
};
defaultValue?: RemoteConfigParameterValue;
description?: string;
}
export interface RemoteConfigParameterGroup {
description?: string;
parameters: {
[key: string]: RemoteConfigParameter;
};
}
export type RemoteConfigParameterValue = ExplicitParameterValue | InAppDefaultValue;
export interface RemoteConfigTemplate {
conditions: RemoteConfigCondition[];
readonly etag: string;
parameterGroups: {
[key: string]: RemoteConfigParameterGroup;
};
parameters: {
[key: string]: RemoteConfigParameter;
};
version?: Version;
}
export interface RemoteConfigUser {
email: string;
imageUrl?: string;
name?: string;
}
export type TagColor = 'BLUE' | 'BROWN' | 'CYAN' | 'DEEP_ORANGE' | 'GREEN' | 'INDIGO' | 'LIME' | 'ORANGE' | 'PINK' | 'PURPLE' | 'TEAL';
export interface Version {
description?: string;
isLegacy?: boolean;
rollbackSource?: string;
updateOrigin?: ('REMOTE_CONFIG_UPDATE_ORIGIN_UNSPECIFIED' | 'CONSOLE' | 'REST_API' | 'ADMIN_SDK_NODE');
updateTime?: string;
updateType?: ('REMOTE_CONFIG_UPDATE_TYPE_UNSPECIFIED' | 'INCREMENTAL_UPDATE' | 'FORCED_UPDATE' | 'ROLLBACK');
updateUser?: RemoteConfigUser;
versionNumber?: string;
}
// Warning: (ae-forgotten-export) The symbol "ExplicitParameterValue" needs to be exported by the entry point default-namespace.d.ts
//
// (undocumented)
export type ExplicitParameterValue = ExplicitParameterValue;
// Warning: (ae-forgotten-export) The symbol "InAppDefaultValue" needs to be exported by the entry point default-namespace.d.ts
//
// (undocumented)
export type InAppDefaultValue = InAppDefaultValue;
// Warning: (ae-forgotten-export) The symbol "ListVersionsOptions" needs to be exported by the entry point default-namespace.d.ts
//
// (undocumented)
export type ListVersionsOptions = ListVersionsOptions;
// Warning: (ae-forgotten-export) The symbol "ListVersionsResult" needs to be exported by the entry point default-namespace.d.ts
//
// (undocumented)
export type ListVersionsResult = ListVersionsResult;
// Warning: (ae-forgotten-export) The symbol "RemoteConfig" needs to be exported by the entry point default-namespace.d.ts
//
// (undocumented)
export type RemoteConfig = RemoteConfig;
// Warning: (ae-forgotten-export) The symbol "RemoteConfigCondition" needs to be exported by the entry point default-namespace.d.ts
//
// (undocumented)
export type RemoteConfigCondition = RemoteConfigCondition;
// Warning: (ae-forgotten-export) The symbol "RemoteConfigParameter" needs to be exported by the entry point default-namespace.d.ts
//
// (undocumented)
export type RemoteConfigParameter = RemoteConfigParameter;
// Warning: (ae-forgotten-export) The symbol "RemoteConfigParameterGroup" needs to be exported by the entry point default-namespace.d.ts
//
// (undocumented)
export type RemoteConfigParameterGroup = RemoteConfigParameterGroup;
// Warning: (ae-forgotten-export) The symbol "RemoteConfigParameterValue" needs to be exported by the entry point default-namespace.d.ts
//
// (undocumented)
export type RemoteConfigParameterValue = RemoteConfigParameterValue;
// Warning: (ae-forgotten-export) The symbol "RemoteConfigTemplate" needs to be exported by the entry point default-namespace.d.ts
//
// (undocumented)
export type RemoteConfigTemplate = RemoteConfigTemplate;
// Warning: (ae-forgotten-export) The symbol "RemoteConfigUser" needs to be exported by the entry point default-namespace.d.ts
//
// (undocumented)
export type RemoteConfigUser = RemoteConfigUser;
// Warning: (ae-forgotten-export) The symbol "TagColor" needs to be exported by the entry point default-namespace.d.ts
//
// (undocumented)
export type TagColor = TagColor;
// Warning: (ae-forgotten-export) The symbol "Version" needs to be exported by the entry point default-namespace.d.ts
//
// (undocumented)
export type Version = Version;
}

// @public (undocumented)
Expand Down
152 changes: 152 additions & 0 deletions etc/firebase-admin.remote-config.api.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,152 @@
## API Report File for "firebase-admin.remote-config"

> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).

```ts

import { Agent } from 'http';

// @public
export interface ExplicitParameterValue {
value: string;
}

// Warning: (ae-forgotten-export) The symbol "App" needs to be exported by the entry point index.d.ts
//
// @public (undocumented)
export function getRemoteConfig(app?: App): RemoteConfig;

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

// @public
export interface ListVersionsOptions {
endTime?: Date | string;
endVersionNumber?: string | number;
pageSize?: number;
pageToken?: string;
startTime?: Date | string;
}

// @public
export interface ListVersionsResult {
nextPageToken?: string;
versions: Version[];
}

// @public
export class RemoteConfig {
// (undocumented)
readonly app: App;
createTemplateFromJSON(json: string): RemoteConfigTemplate;
getTemplate(): Promise<RemoteConfigTemplate>;
getTemplateAtVersion(versionNumber: number | string): Promise<RemoteConfigTemplate>;
listVersions(options?: ListVersionsOptions): Promise<ListVersionsResult>;
publishTemplate(template: RemoteConfigTemplate, options?: {
force: boolean;
}): Promise<RemoteConfigTemplate>;
rollback(versionNumber: number | string): Promise<RemoteConfigTemplate>;
validateTemplate(template: RemoteConfigTemplate): Promise<RemoteConfigTemplate>;
}

// @public
export function remoteConfig(app?: App): remoteConfig.RemoteConfig;

// @public (undocumented)
export namespace remoteConfig {
// (undocumented)
export type ExplicitParameterValue = ExplicitParameterValue;
// (undocumented)
export type InAppDefaultValue = InAppDefaultValue;
// (undocumented)
export type ListVersionsOptions = ListVersionsOptions;
// (undocumented)
export type ListVersionsResult = ListVersionsResult;
// (undocumented)
export type RemoteConfig = RemoteConfig;
// (undocumented)
export type RemoteConfigCondition = RemoteConfigCondition;
// (undocumented)
export type RemoteConfigParameter = RemoteConfigParameter;
// (undocumented)
export type RemoteConfigParameterGroup = RemoteConfigParameterGroup;
// (undocumented)
export type RemoteConfigParameterValue = RemoteConfigParameterValue;
// (undocumented)
export type RemoteConfigTemplate = RemoteConfigTemplate;
// (undocumented)
export type RemoteConfigUser = RemoteConfigUser;
// (undocumented)
export type TagColor = TagColor;
// (undocumented)
export type Version = Version;
}

// @public
export interface RemoteConfigCondition {
expression: string;
name: string;
tagColor?: TagColor;
}

// @public
export interface RemoteConfigParameter {
conditionalValues?: {
[key: string]: RemoteConfigParameterValue;
};
defaultValue?: RemoteConfigParameterValue;
description?: string;
}

// @public
export interface RemoteConfigParameterGroup {
description?: string;
parameters: {
[key: string]: RemoteConfigParameter;
};
}

// @public
export type RemoteConfigParameterValue = ExplicitParameterValue | InAppDefaultValue;

// @public
export interface RemoteConfigTemplate {
conditions: RemoteConfigCondition[];
readonly etag: string;
parameterGroups: {
[key: string]: RemoteConfigParameterGroup;
};
parameters: {
[key: string]: RemoteConfigParameter;
};
version?: Version;
}

// @public
export interface RemoteConfigUser {
email: string;
imageUrl?: string;
name?: string;
}

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

// @public
export interface Version {
description?: string;
isLegacy?: boolean;
rollbackSource?: string;
updateOrigin?: ('REMOTE_CONFIG_UPDATE_ORIGIN_UNSPECIFIED' | 'CONSOLE' | 'REST_API' | 'ADMIN_SDK_NODE');
updateTime?: string;
updateType?: ('REMOTE_CONFIG_UPDATE_TYPE_UNSPECIFIED' | 'INCREMENTAL_UPDATE' | 'FORCED_UPDATE' | 'ROLLBACK');
updateUser?: RemoteConfigUser;
versionNumber?: string;
}


// (No @packageDocumentation comment for this package)

```
1 change: 1 addition & 0 deletions generate-reports.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ const entryPoints = {
'firebase-admin/database': './lib/database/index.d.ts',
'firebase-admin/firestore': './lib/firestore/index.d.ts',
'firebase-admin/instance-id': './lib/instance-id/index.d.ts',
'firebase-admin/remote-config': './lib/remote-config/index.d.ts',
};

const tempConfigFile = 'api-extractor.tmp';
Expand Down
1 change: 1 addition & 0 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ gulp.task('compile', function() {
'lib/database/*.d.ts',
'lib/firestore/*.d.ts',
'lib/instance-id/*.d.ts',
'lib/remote-config/*.d.ts',
'!lib/utils/index.d.ts',
];

Expand Down
8 changes: 3 additions & 5 deletions src/app/firebase-app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import { Firestore } from '@google-cloud/firestore';
import { InstanceId } from '../instance-id/index';
import { ProjectManagement } from '../project-management/project-management';
import { SecurityRules } from '../security-rules/security-rules';
import { RemoteConfig } from '../remote-config/remote-config';
import { RemoteConfig } from '../remote-config/index';

/**
* Type representing a callback which is called every time an app lifecycle event occurs.
Expand Down Expand Up @@ -371,10 +371,8 @@ export class FirebaseApp implements app.App {
* @return The RemoteConfig service instance of this app.
*/
public remoteConfig(): RemoteConfig {
return this.ensureService_('remoteConfig', () => {
const remoteConfigService: typeof RemoteConfig = require('../remote-config/remote-config').RemoteConfig;
return new remoteConfigService(this);
});
const fn = require('../remote-config/index').getRemoteConfig;
return fn(this);
}

/**
Expand Down
Loading