Skip to content

Commit e758b15

Browse files
authored
feat: Exposed firebase-admin/project-management entry point (#1157)
1 parent 9c89065 commit e758b15

17 files changed

+430
-465
lines changed

etc/firebase-admin.api.md

Lines changed: 33 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -607,67 +607,42 @@ export namespace messaging {
607607
}
608608

609609
// @public
610-
export function projectManagement(app?: app.App): projectManagement.ProjectManagement;
610+
export function projectManagement(app?: App): projectManagement.ProjectManagement;
611611

612612
// @public (undocumented)
613613
export namespace projectManagement {
614-
export interface AndroidApp {
615-
addShaCertificate(certificateToAdd: ShaCertificate): Promise<void>;
616-
// (undocumented)
617-
appId: string;
618-
deleteShaCertificate(certificateToRemove: ShaCertificate): Promise<void>;
619-
getConfig(): Promise<string>;
620-
getMetadata(): Promise<AndroidAppMetadata>;
621-
getShaCertificates(): Promise<ShaCertificate[]>;
622-
setDisplayName(newDisplayName: string): Promise<void>;
623-
}
624-
export interface AndroidAppMetadata extends AppMetadata {
625-
packageName: string;
626-
// (undocumented)
627-
platform: AppPlatform.ANDROID;
628-
}
629-
export interface AppMetadata {
630-
appId: string;
631-
displayName?: string;
632-
platform: AppPlatform;
633-
projectId: string;
634-
resourceName: string;
635-
}
636-
export enum AppPlatform {
637-
ANDROID = "ANDROID",
638-
IOS = "IOS",
639-
PLATFORM_UNKNOWN = "PLATFORM_UNKNOWN"
640-
}
641-
export interface IosApp {
642-
// (undocumented)
643-
appId: string;
644-
getConfig(): Promise<string>;
645-
getMetadata(): Promise<IosAppMetadata>;
646-
setDisplayName(newDisplayName: string): Promise<void>;
647-
}
648-
export interface IosAppMetadata extends AppMetadata {
649-
bundleId: string;
650-
// (undocumented)
651-
platform: AppPlatform.IOS;
652-
}
653-
export interface ProjectManagement {
654-
androidApp(appId: string): AndroidApp;
655-
// (undocumented)
656-
app: app.App;
657-
createAndroidApp(packageName: string, displayName?: string): Promise<AndroidApp>;
658-
createIosApp(bundleId: string, displayName?: string): Promise<IosApp>;
659-
iosApp(appId: string): IosApp;
660-
listAndroidApps(): Promise<AndroidApp[]>;
661-
listAppMetadata(): Promise<AppMetadata[]>;
662-
listIosApps(): Promise<IosApp[]>;
663-
setDisplayName(newDisplayName: string): Promise<void>;
664-
shaCertificate(shaHash: string): ShaCertificate;
665-
}
666-
export interface ShaCertificate {
667-
certType: ('sha1' | 'sha256');
668-
resourceName?: string;
669-
shaHash: string;
670-
}
614+
// Warning: (ae-forgotten-export) The symbol "AndroidApp" needs to be exported by the entry point default-namespace.d.ts
615+
//
616+
// (undocumented)
617+
export type AndroidApp = AndroidApp;
618+
// Warning: (ae-forgotten-export) The symbol "AndroidAppMetadata" needs to be exported by the entry point default-namespace.d.ts
619+
//
620+
// (undocumented)
621+
export type AndroidAppMetadata = AndroidAppMetadata;
622+
// Warning: (ae-forgotten-export) The symbol "AppMetadata" needs to be exported by the entry point default-namespace.d.ts
623+
//
624+
// (undocumented)
625+
export type AppMetadata = AppMetadata;
626+
// Warning: (ae-forgotten-export) The symbol "AppPlatform" needs to be exported by the entry point default-namespace.d.ts
627+
//
628+
// (undocumented)
629+
export type AppPlatform = AppPlatform;
630+
// Warning: (ae-forgotten-export) The symbol "IosApp" needs to be exported by the entry point default-namespace.d.ts
631+
//
632+
// (undocumented)
633+
export type IosApp = IosApp;
634+
// Warning: (ae-forgotten-export) The symbol "IosAppMetadata" needs to be exported by the entry point default-namespace.d.ts
635+
//
636+
// (undocumented)
637+
export type IosAppMetadata = IosAppMetadata;
638+
// Warning: (ae-forgotten-export) The symbol "ProjectManagement" needs to be exported by the entry point default-namespace.d.ts
639+
//
640+
// (undocumented)
641+
export type ProjectManagement = ProjectManagement;
642+
// Warning: (ae-forgotten-export) The symbol "ShaCertificate" needs to be exported by the entry point default-namespace.d.ts
643+
//
644+
// (undocumented)
645+
export type ShaCertificate = ShaCertificate;
671646
}
672647

673648
// @public (undocumented)
Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
## API Report File for "firebase-admin.project-management"
2+
3+
> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
4+
5+
```ts
6+
7+
import { Agent } from 'http';
8+
9+
// @public (undocumented)
10+
export class AndroidApp {
11+
addShaCertificate(certificateToAdd: ShaCertificate): Promise<void>;
12+
// (undocumented)
13+
readonly appId: string;
14+
deleteShaCertificate(certificateToDelete: ShaCertificate): Promise<void>;
15+
getConfig(): Promise<string>;
16+
getMetadata(): Promise<AndroidAppMetadata>;
17+
getShaCertificates(): Promise<ShaCertificate[]>;
18+
setDisplayName(newDisplayName: string): Promise<void>;
19+
}
20+
21+
// @public
22+
export interface AndroidAppMetadata extends AppMetadata {
23+
packageName: string;
24+
// (undocumented)
25+
platform: AppPlatform.ANDROID;
26+
}
27+
28+
// @public
29+
export interface AppMetadata {
30+
appId: string;
31+
displayName?: string;
32+
platform: AppPlatform;
33+
projectId: string;
34+
resourceName: string;
35+
}
36+
37+
// @public
38+
export enum AppPlatform {
39+
ANDROID = "ANDROID",
40+
IOS = "IOS",
41+
PLATFORM_UNKNOWN = "PLATFORM_UNKNOWN"
42+
}
43+
44+
// Warning: (ae-forgotten-export) The symbol "App" needs to be exported by the entry point index.d.ts
45+
//
46+
// @public (undocumented)
47+
export function getProjectManagement(app?: App): ProjectManagement;
48+
49+
// @public (undocumented)
50+
export class IosApp {
51+
// (undocumented)
52+
readonly appId: string;
53+
getConfig(): Promise<string>;
54+
getMetadata(): Promise<IosAppMetadata>;
55+
setDisplayName(newDisplayName: string): Promise<void>;
56+
}
57+
58+
// @public
59+
export interface IosAppMetadata extends AppMetadata {
60+
bundleId: string;
61+
// (undocumented)
62+
platform: AppPlatform.IOS;
63+
}
64+
65+
// @public
66+
export class ProjectManagement {
67+
androidApp(appId: string): AndroidApp;
68+
// (undocumented)
69+
readonly app: App;
70+
createAndroidApp(packageName: string, displayName?: string): Promise<AndroidApp>;
71+
createIosApp(bundleId: string, displayName?: string): Promise<IosApp>;
72+
iosApp(appId: string): IosApp;
73+
listAndroidApps(): Promise<AndroidApp[]>;
74+
listAppMetadata(): Promise<AppMetadata[]>;
75+
listIosApps(): Promise<IosApp[]>;
76+
setDisplayName(newDisplayName: string): Promise<void>;
77+
shaCertificate(shaHash: string): ShaCertificate;
78+
}
79+
80+
// @public
81+
export function projectManagement(app?: App): projectManagement.ProjectManagement;
82+
83+
// @public (undocumented)
84+
export namespace projectManagement {
85+
// (undocumented)
86+
export type AndroidApp = AndroidApp;
87+
// (undocumented)
88+
export type AndroidAppMetadata = AndroidAppMetadata;
89+
// (undocumented)
90+
export type AppMetadata = AppMetadata;
91+
// (undocumented)
92+
export type AppPlatform = AppPlatform;
93+
// (undocumented)
94+
export type IosApp = IosApp;
95+
// (undocumented)
96+
export type IosAppMetadata = IosAppMetadata;
97+
// (undocumented)
98+
export type ProjectManagement = ProjectManagement;
99+
// (undocumented)
100+
export type ShaCertificate = ShaCertificate;
101+
}
102+
103+
// @public
104+
export class ShaCertificate {
105+
readonly certType: ('sha1' | 'sha256');
106+
// (undocumented)
107+
readonly resourceName?: string | undefined;
108+
// (undocumented)
109+
readonly shaHash: string;
110+
}
111+
112+
113+
// (No @packageDocumentation comment for this package)
114+
115+
```

generate-reports.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ const entryPoints = {
4040
'firebase-admin/firestore': './lib/firestore/index.d.ts',
4141
'firebase-admin/instance-id': './lib/instance-id/index.d.ts',
4242
'firebase-admin/messaging': './lib/messaging/index.d.ts',
43+
'firebase-admin/project-management': './lib/project-management/index.d.ts',
4344
'firebase-admin/security-rules': './lib/security-rules/index.d.ts',
4445
'firebase-admin/remote-config': './lib/remote-config/index.d.ts',
4546
};

gulpfile.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ gulp.task('compile', function() {
9393
'lib/firestore/*.d.ts',
9494
'lib/instance-id/*.d.ts',
9595
'lib/messaging/*.d.ts',
96+
'lib/project-management/*.d.ts',
9697
'lib/security-rules/*.d.ts',
9798
'lib/remote-config/*.d.ts',
9899
'!lib/utils/index.d.ts',

src/app/firebase-app.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ import { Storage } from '../storage/storage';
3030
import { Database } from '../database/index';
3131
import { Firestore } from '../firestore/index';
3232
import { InstanceId } from '../instance-id/index';
33-
import { ProjectManagement } from '../project-management/project-management';
33+
import { ProjectManagement } from '../project-management/index';
3434
import { SecurityRules } from '../security-rules/index';
3535
import { RemoteConfig } from '../remote-config/index';
3636

@@ -343,11 +343,8 @@ export class FirebaseApp implements app.App {
343343
* @return The ProjectManagement service instance of this app.
344344
*/
345345
public projectManagement(): ProjectManagement {
346-
return this.ensureService_('project-management', () => {
347-
const projectManagementService: typeof ProjectManagement =
348-
require('../project-management/project-management').ProjectManagement;
349-
return new projectManagementService(this);
350-
});
346+
const fn = require('../project-management/index').getProjectManagement;
347+
return fn(this);
351348
}
352349

353350
/**

src/project-management/android-app.ts

Lines changed: 27 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,34 @@
1717
import { FirebaseProjectManagementError } from '../utils/error';
1818
import * as validator from '../utils/validator';
1919
import { ProjectManagementRequestHandler, assertServerResponse } from './project-management-api-request-internal';
20-
import { projectManagement } from './index';
20+
import { AppMetadata, AppPlatform } from './app-metadata';
2121

22-
import AndroidAppInterface = projectManagement.AndroidApp;
23-
import AndroidAppMetadata = projectManagement.AndroidAppMetadata;
24-
import AppPlatform = projectManagement.AppPlatform;
25-
import ShaCertificateInterface = projectManagement.ShaCertificate;
2622

27-
export class AndroidApp implements AndroidAppInterface {
23+
/**
24+
* Metadata about a Firebase Android App.
25+
*/
26+
export interface AndroidAppMetadata extends AppMetadata {
27+
28+
platform: AppPlatform.ANDROID;
29+
30+
/**
31+
* The canonical package name of the Android App, as would appear in the Google Play Developer
32+
* Console.
33+
*
34+
* @example
35+
* ```javascript
36+
* var packageName = androidAppMetadata.packageName;
37+
* ```
38+
*/
39+
packageName: string;
40+
}
41+
42+
export class AndroidApp {
2843
private readonly resourceName: string;
2944

45+
/**
46+
* @internal
47+
*/
3048
constructor(
3149
public readonly appId: string,
3250
private readonly requestHandler: ProjectManagementRequestHandler) {
@@ -184,7 +202,7 @@ export class AndroidApp implements AndroidAppInterface {
184202
* Do not call this constructor directly. Instead, use
185203
* [`projectManagement.shaCertificate()`](projectManagement.ProjectManagement#shaCertificate).
186204
*/
187-
export class ShaCertificate implements ShaCertificateInterface {
205+
export class ShaCertificate {
188206
/**
189207
* The SHA certificate type.
190208
*
@@ -210,6 +228,8 @@ export class ShaCertificate implements ShaCertificateInterface {
210228
* ```javascript
211229
* var resourceName = shaCertificate.resourceName;
212230
* ```
231+
*
232+
* @internal
213233
*/
214234
constructor(public readonly shaHash: string, public readonly resourceName?: string) {
215235
if (/^[a-fA-F0-9]{40}$/.test(shaHash)) {

0 commit comments

Comments
 (0)