@ccci/micro-server 1.0.117 → 1.0.119

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.
package/dist/index.js CHANGED
@@ -250966,13 +250966,29 @@ class PushNotifier {
250966
250966
  }
250967
250967
  }
250968
250968
  static async sendNotifications(tokens, message, metadata = {}, options) {
250969
+ try {
250970
+ let params = [];
250971
+ tokens.forEach((token) => {
250972
+ params.push({
250973
+ token,
250974
+ notification: message,
250975
+ data: metadata
250976
+ });
250977
+ });
250978
+ let result = await PushNotifier.FirebaseAdmin.messaging().sendEach(params);
250979
+ return result;
250980
+ } catch (error) {
250981
+ console.log("error :>> ", error);
250982
+ }
250983
+ }
250984
+ static async sendNotification(token, message, metadata = {}, options) {
250969
250985
  try {
250970
250986
  let params = {
250971
- tokens,
250987
+ token,
250972
250988
  notification: message,
250973
250989
  data: metadata
250974
250990
  };
250975
- let result = await PushNotifier.FirebaseAdmin.messaging().sendEachForMulticast(params);
250991
+ let result = await PushNotifier.FirebaseAdmin.messaging().send(params);
250976
250992
  return result;
250977
250993
  } catch (error) {
250978
250994
  console.log("error :>> ", error);
@@ -14,5 +14,6 @@ export default class PushNotifier {
14
14
  * @param options
15
15
  */
16
16
  static sendNotifications(tokens: Array<string>, message: NotificationType, metadata?: any, options?: NotificationOptions): Promise<BatchResponse | undefined>;
17
+ static sendNotification(token: string, message: NotificationType, metadata?: any, options?: NotificationOptions): Promise<string | undefined>;
17
18
  }
18
19
  //# sourceMappingURL=PushNotifier.d.ts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ccci/micro-server",
3
- "version": "1.0.117",
3
+ "version": "1.0.119",
4
4
  "module": "index.ts",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",