nestjs-firebase-admin 0.0.3 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import { Observable } from 'rxjs';
|
|
3
|
+
import Admin from 'firebase-admin';
|
|
3
4
|
import type { App } from 'firebase-admin/app';
|
|
4
5
|
import type { Agent } from 'node:http';
|
|
5
6
|
import type { AdminModuleOptions } from './types';
|
|
@@ -10,7 +11,8 @@ export declare class AdminService {
|
|
|
10
11
|
deleteApp(app: App): Promise<void>;
|
|
11
12
|
get getApps(): App[];
|
|
12
13
|
get getApp(): App;
|
|
13
|
-
|
|
14
|
+
admin(): typeof Admin;
|
|
14
15
|
initializeAppObservable<T = App>(): Observable<App>;
|
|
15
16
|
get appRef(): App;
|
|
17
|
+
private initializeApp;
|
|
16
18
|
}
|
|
@@ -24,6 +24,7 @@ const admin_constants_1 = require("./admin.constants");
|
|
|
24
24
|
let AdminService = class AdminService {
|
|
25
25
|
constructor(options) {
|
|
26
26
|
this.options = options;
|
|
27
|
+
this.initializeApp();
|
|
27
28
|
}
|
|
28
29
|
applicationDefault(httpAgent) {
|
|
29
30
|
return (0, app_1.applicationDefault)(httpAgent);
|
|
@@ -37,8 +38,8 @@ let AdminService = class AdminService {
|
|
|
37
38
|
get getApp() {
|
|
38
39
|
return (0, app_1.getApp)();
|
|
39
40
|
}
|
|
40
|
-
|
|
41
|
-
return
|
|
41
|
+
admin() {
|
|
42
|
+
return firebase_admin_1.default;
|
|
42
43
|
}
|
|
43
44
|
initializeAppObservable() {
|
|
44
45
|
return new rxjs_1.Observable(subscriber => {
|
|
@@ -55,6 +56,9 @@ let AdminService = class AdminService {
|
|
|
55
56
|
get appRef() {
|
|
56
57
|
return this.initializeApp();
|
|
57
58
|
}
|
|
59
|
+
initializeApp() {
|
|
60
|
+
return firebase_admin_1.default.initializeApp(Object.assign(Object.assign({}, this.options), { credential: firebase_admin_1.default.credential.cert(this.options.credential) }));
|
|
61
|
+
}
|
|
58
62
|
};
|
|
59
63
|
AdminService = __decorate([
|
|
60
64
|
__param(0, (0, common_1.Inject)(admin_constants_1.FIREBASE_ADMIN_INSTANCE_TOKEN)),
|