@naturalcycles/backend-lib 9.61.0 → 9.62.0

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
  import type { App, AppOptions, ServiceAccount } from 'firebase-admin/app';
2
2
  import type { Auth } from 'firebase-admin/auth';
3
+ import type { Messaging } from 'firebase-admin/messaging';
3
4
  export interface FirebaseSharedServiceCfg {
4
5
  /**
5
6
  * If undefined - will try to use credential.applicationDefault()
@@ -34,4 +35,5 @@ export declare class FirebaseSharedService {
34
35
  init(): Promise<void>;
35
36
  admin(): Promise<App>;
36
37
  auth(): Promise<Auth>;
38
+ messaging(): Promise<Messaging>;
37
39
  }
@@ -23,6 +23,11 @@ export class FirebaseSharedService {
23
23
  const { getAuth } = await import('firebase-admin/auth');
24
24
  return getAuth(app);
25
25
  }
26
+ async messaging() {
27
+ const app = await this.admin();
28
+ const { getMessaging } = await import('firebase-admin/messaging');
29
+ return getMessaging(app);
30
+ }
26
31
  }
27
32
  __decorate([
28
33
  _Memo()
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@naturalcycles/backend-lib",
3
3
  "type": "module",
4
- "version": "9.61.0",
4
+ "version": "9.62.0",
5
5
  "dependencies": {
6
6
  "@naturalcycles/db-lib": "^10",
7
7
  "@naturalcycles/js-lib": "^15",
@@ -1,6 +1,7 @@
1
1
  import { _Memo } from '@naturalcycles/js-lib/decorators/memo.decorator.js'
2
2
  import type { App, AppOptions, ServiceAccount } from 'firebase-admin/app'
3
3
  import type { Auth } from 'firebase-admin/auth'
4
+ import type { Messaging } from 'firebase-admin/messaging'
4
5
 
5
6
  export interface FirebaseSharedServiceCfg {
6
7
  /**
@@ -66,4 +67,10 @@ export class FirebaseSharedService {
66
67
  const { getAuth } = await import('firebase-admin/auth')
67
68
  return getAuth(app)
68
69
  }
70
+
71
+ async messaging(): Promise<Messaging> {
72
+ const app = await this.admin()
73
+ const { getMessaging } = await import('firebase-admin/messaging')
74
+ return getMessaging(app)
75
+ }
69
76
  }