Skip to content

8.0.0

Latest

Choose a tag to compare

@alex-friedl alex-friedl released this 29 Nov 22:46

Nothing changes at runtime. This is a major release because the package now ships its own TypeScript types, which are stricter than @types/node-pushnotifications.

TypeScript types

Types are included in the package. Remove @types/node-pushnotifications. They need TypeScript 5.5 or later and @types/node.

They cover topic and condition destinations and the 7.0 results. Checking method on a result narrows its entries, for example to a FirebaseError with code for FCM, or the subscription and statusCode for Web Push.

Code written against the old types may hit these errors:

  • send() always returns a promise, also with a callback.
  • gcm and mpns settings are gone. apn takes node-apn's options, so old keys it ignores, such as voip and cacheLength, are rejected.
  • settings.fcm needs serviceAccountKey or credential, and settings.wns needs notificationMethod. Without them, sends always failed.
  • A string data is only accepted for Web Push destinations.
  • An FCM topic or condition destination needs type: 'fcm', and can't also have an id.

Fixes

  • A string alert was sent to APNs, and to iOS through FCM, as { "0": "H", "1": "e", ... }. It's now sent as the alert text.
  • A string custom was split the same way for APNs, the FCM data and ADM. It's now sent as { message }, as Android already did.
  • WNS with an access token: when wns threw, the rejection could go unhandled and exit the process. A throw in the WNS sender also no longer skips the ADM and Web Push sends of the same call. send() still rejects with the error.

Full Changelog: 7.0.0...8.0.0