@spectrum-ts/whatsapp-business 8.1.1 → 8.2.1
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 +6 -3
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -5,7 +5,7 @@ import { extension } from "mime-types";
|
|
|
5
5
|
import z from "zod";
|
|
6
6
|
//#region src/auth.ts
|
|
7
7
|
const log = createLogger("spectrum.whatsapp.auth");
|
|
8
|
-
const streamLog = createLogger("spectrum.whatsapp.stream");
|
|
8
|
+
const streamLog$1 = createLogger("spectrum.whatsapp.stream");
|
|
9
9
|
const RENEWAL_RATIO = .8;
|
|
10
10
|
const EXPIRY_BUFFER_MS = 3e4;
|
|
11
11
|
const RETRY_DELAY_MS = 3e4;
|
|
@@ -140,7 +140,7 @@ const pumpOnce = async (ctx) => {
|
|
|
140
140
|
for await (const event of sub) await ctx.emit(event);
|
|
141
141
|
return true;
|
|
142
142
|
} catch (error) {
|
|
143
|
-
streamLog.warn("whatsapp event stream interrupted; resubscribing", {
|
|
143
|
+
streamLog$1.warn("whatsapp event stream interrupted; resubscribing", {
|
|
144
144
|
"spectrum.whatsapp.resubscribe_in_ms": RESUBSCRIBE_BACKOFF_MS,
|
|
145
145
|
...errorAttrs(error)
|
|
146
146
|
}, error);
|
|
@@ -482,8 +482,11 @@ const contactToWa = (contact) => {
|
|
|
482
482
|
birthday: contact.birthday
|
|
483
483
|
};
|
|
484
484
|
};
|
|
485
|
+
const streamLog = createLogger("spectrum.whatsapp.stream");
|
|
485
486
|
const clientStream = (client) => {
|
|
486
|
-
const eventStream = client.events.subscribe(
|
|
487
|
+
const eventStream = client.events.subscribe({ reconnect: { onReconnect: (attempt) => {
|
|
488
|
+
streamLog.warn("whatsapp live stream reconnecting", { "spectrum.whatsapp.reconnect_attempt": attempt });
|
|
489
|
+
} } }).filter((e) => e.type === "message");
|
|
487
490
|
return stream((emit, end) => {
|
|
488
491
|
const pump = (async () => {
|
|
489
492
|
try {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@spectrum-ts/whatsapp-business",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.2.1",
|
|
4
4
|
"description": "WhatsApp Business provider for spectrum-ts.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"label": "WhatsApp Business"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@photon-ai/whatsapp-business": "^0.
|
|
34
|
+
"@photon-ai/whatsapp-business": "^0.2.0",
|
|
35
35
|
"mime-types": "^3.0.1",
|
|
36
36
|
"zod": "^4.2.1"
|
|
37
37
|
},
|