@astratra/notify 1.1.0 → 1.2.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.
Files changed (2) hide show
  1. package/package.json +2 -2
  2. package/src/apns.js +9 -5
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@astratra/notify",
3
- "version": "1.1.0",
3
+ "version": "1.2.0",
4
4
  "description": "Outbound messages done once — email, SMS and push. Transport injected, never throws, header-injection safe, loud simulation when unconfigured, dead push subscriptions handed back for pruning.",
5
5
  "engines": {
6
- "node": ">=20"
6
+ "node": ">=22"
7
7
  },
8
8
  "main": "src/index.js",
9
9
  "types": "src/index.d.ts",
package/src/apns.js CHANGED
@@ -90,11 +90,15 @@ function createApnsTransport(options = {}) {
90
90
  let session = null;
91
91
  function connection() {
92
92
  if (session && !session.closed && !session.destroyed) return session;
93
- session = http2.connect(url);
94
- session.on('error', () => { /* surfaced on the request; the next send reconnects */ });
95
- session.on('goaway', () => { session.close(); });
96
- session.unref?.();
97
- return session;
93
+ /* Chaque écouteur vise SA connexion : la variable partagée vaut null après
94
+ close(), ou désigne déjà la suivante après une reconnexion. Un GOAWAY
95
+ tardif levait alors une exception hors de toute requête. */
96
+ const current = http2.connect(url);
97
+ current.on('error', () => { /* surfaced on the request; the next send reconnects */ });
98
+ current.on('goaway', () => { if (!current.closed && !current.destroyed) current.close(); });
99
+ current.unref?.();
100
+ session = current;
101
+ return current;
98
102
  }
99
103
 
100
104
  async function transport(subscription, payload) {