@hiroosy/baileys-lite 0.3.7 → 0.3.8

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hiroosy/baileys-lite",
3
- "version": "0.3.7",
3
+ "version": "0.3.8",
4
4
  "description": "A Lightweight Baileys built with NodeJs 18+",
5
5
  "repository": {
6
6
  "type": "git",
@@ -1,4 +1,3 @@
1
- import { toError } from '../shim/util.js';
2
1
  import { randomInt } from '../crypto/primitives.js';
3
2
  import { RtpHeader, RtpPacket } from '../media/rtp.js';
4
3
  import { decodeAppDataPayload, encodeReactionPayload } from './protocol.js';
@@ -55,10 +54,6 @@ export class WaAppDataStream {
55
54
  if (this.configuredPayloadType !== null || this.learnedPayloadType === payloadType)
56
55
  return;
57
56
  this.learnedPayloadType = payloadType;
58
- this.logger.debug('app data payload type learned from peer', {
59
- payloadType,
60
- ssrc: `0x${this.ssrc.toString(16)}`
61
- });
62
57
  }
63
58
 
64
59
  setSframe(required, protect) {
@@ -74,13 +69,6 @@ export class WaAppDataStream {
74
69
  this.txReactionCount++;
75
70
  const sent = this.transmit();
76
71
  this.armRetransmission();
77
- this.logger.debug('call reaction queued', {
78
- reaction,
79
- transactionId: transactionId.toString(),
80
- ssrc: `0x${this.ssrc.toString(16)}`,
81
- firstAttemptSent: sent,
82
- total: this.txReactionCount
83
- });
84
72
  return sent;
85
73
  }
86
74
 
@@ -89,20 +77,8 @@ export class WaAppDataStream {
89
77
  return EMPTY_REACTIONS;
90
78
  const decoded = decodeAppDataPayload(payload);
91
79
  if (!decoded) {
92
- this.logger.debug('app data payload not understood', {
93
- ssrc: `0x${this.ssrc.toString(16)}`,
94
- bytes: payload.length,
95
- sframeRequired: this.sframeRequired,
96
- sframeKeyed: this.sframeProtect !== null
97
- });
98
80
  return EMPTY_REACTIONS;
99
81
  }
100
- if (decoded.truncated) {
101
- this.logger.debug('app data payload carried more messages than are read', {
102
- ssrc: `0x${ssrc.toString(16)}`,
103
- read: decoded.items.length
104
- });
105
- }
106
82
  const fresh = [];
107
83
  for (const item of decoded.items) {
108
84
  const reaction = item.reaction;
@@ -115,13 +91,6 @@ export class WaAppDataStream {
115
91
  this.rxReactionCount++;
116
92
  fresh.push(reaction);
117
93
  }
118
- if (fresh.length > 0) {
119
- this.logger.debug('call reaction received', {
120
- shape: decoded.shape,
121
- count: fresh.length,
122
- total: this.rxReactionCount
123
- });
124
- }
125
94
  return fresh;
126
95
  }
127
96
  close() {
@@ -151,9 +120,6 @@ export class WaAppDataStream {
151
120
  return;
152
121
  }
153
122
  if (Date.now() >= outgoing.clearAt) {
154
- this.logger.debug('call reaction cleared from send buffer', {
155
- transactionId: outgoing.transactionId.toString()
156
- });
157
123
  this.clearOutgoing();
158
124
  return;
159
125
  }
@@ -181,11 +147,6 @@ export class WaAppDataStream {
181
147
  }
182
148
  catch (err) {
183
149
  this.txReactionErrorCount++;
184
- this.logger.debug('failed to send app data rtp packet', {
185
- ssrc: `0x${this.ssrc.toString(16)}`,
186
- errors: this.txReactionErrorCount,
187
- message: toError(err).message
188
- });
189
150
  return false;
190
151
  }
191
152
  }
@@ -51,7 +51,6 @@ export class WaCallManager extends EventEmitter {
51
51
  }
52
52
  info.applyTransition({ type: 'offer_sent' });
53
53
  this.emitState(info);
54
- this.logger.debug('outgoing offer sent', { callId, peerJid });
55
54
  return callId;
56
55
  }
57
56
  async acceptCall(callId) {
@@ -154,7 +153,6 @@ export class WaCallManager extends EventEmitter {
154
153
  const existing = this.calls.get(callId);
155
154
  if (existing) {
156
155
  if (!existing.info.isEnded) {
157
- this.logger.debug('duplicate offer for active call, ignoring', { callId });
158
156
  return;
159
157
  }
160
158
  existing.cleanup();
@@ -197,11 +195,7 @@ export class WaCallManager extends EventEmitter {
197
195
  try {
198
196
  info.applyTransition({ type: 'terminated', reason: EndCallReason.Failed });
199
197
  }
200
- catch (transitionErr) {
201
- this.logger.trace('failed-activation transition skipped', {
202
- message: toError(transitionErr).message
203
- });
204
- }
198
+ catch { }
205
199
  this.emit('call_ended', info);
206
200
  this.emitState(info);
207
201
  session.cleanup();
@@ -210,23 +204,8 @@ export class WaCallManager extends EventEmitter {
210
204
  return;
211
205
  }
212
206
  }
213
- else {
214
- this.logger.debug('incoming call waiting, at capacity', {
215
- callId,
216
- peerJid,
217
- maxConcurrentCalls: this.maxConcurrentCalls
218
- });
219
- }
220
207
  this.emit('call_incoming', info);
221
208
  this.emitState(info);
222
- this.logger.debug('incoming call', {
223
- callId,
224
- peerJid,
225
- callCreator,
226
- isVideo,
227
- relayCount: relays.length,
228
- acceptBlocked: atCapacity
229
- });
230
209
  }
231
210
  async handleCallAccept(node, peerJid) {
232
211
  const session = this.resolveSessionFromNode(node);
@@ -349,6 +328,8 @@ export class WaCallManager extends EventEmitter {
349
328
  emitCallReaction: (call, reaction) => this.emit('call_reaction', call, reaction),
350
329
  emitScreenShare: (call, share) => this.emit('call_screen_share', call, share),
351
330
  emitOutboundAudioFinished: (call) => this.emit('call_outbound_audio_finished', call),
331
+ emitReconnecting: (call, detail) => this.emit('call_reconnecting', call, detail),
332
+ emitReconnected: (call) => this.emit('call_reconnected', call),
352
333
 
353
334
  emitVideoState: (call, videoState) => this.emit('call_video_state', call, videoState),
354
335
 
@@ -368,12 +349,10 @@ export class WaCallManager extends EventEmitter {
368
349
  resolveSessionFromNode(node) {
369
350
  const nodeInfo = extractNodeInfo(node);
370
351
  if (!nodeInfo?.callId) {
371
- this.logger.debug('stanza missing call-id, ignored');
372
352
  return null;
373
353
  }
374
354
  const session = this.calls.get(nodeInfo.callId);
375
355
  if (!session) {
376
- this.logger.debug('no session for call-id', { callId: nodeInfo.callId });
377
356
  return null;
378
357
  }
379
358
  return session;
@@ -397,10 +376,6 @@ export class WaCallManager extends EventEmitter {
397
376
  if (outgoing.length === 1)
398
377
  return outgoing[0];
399
378
 
400
- this.logger.trace('offer ack could not be routed', {
401
- callId: callId ?? null,
402
- candidateCount: outgoing.length
403
- });
404
379
  return null;
405
380
  }
406
381
  emitState(call) {
@@ -414,9 +389,7 @@ export class WaCallManager extends EventEmitter {
414
389
  if (mapped?.lidJid)
415
390
  return mapped.lidJid;
416
391
  }
417
- catch (err) {
418
- this.logger.trace('lid resolution failed', { message: toError(err).message });
419
- }
392
+ catch { }
420
393
  return peerJid;
421
394
  }
422
395
  async maybeUnblockWaitingCalls() {
@@ -437,6 +410,5 @@ export class WaCallManager extends EventEmitter {
437
410
  await session.sendIncomingPreaccept(session.info.peerJid);
438
411
  await session.sendIncomingRelayLatency();
439
412
  this.emitState(session.info);
440
- this.logger.debug('waiting incoming call unblocked', { callId: session.callId });
441
413
  }
442
414
  }