@cendarsoss/pusher-js 8.4.11 → 8.4.13

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.
@@ -5353,30 +5353,43 @@ class DeltaCompressionManager {
5353
5353
  baseMessage = channelState.getBaseMessage(conflationKey, baseIndex);
5354
5354
  if (!baseMessage) {
5355
5355
  this.error(
5356
- `No base message for channel ${channel}, key ${conflationKey}, index ${baseIndex}`
5357
- );
5358
- if (this.options.debug) {
5359
- this.log("Current conflation cache snapshot", {
5356
+ `No base message (conflation path) for channel ${channel}`,
5357
+ {
5358
+ path: "conflation",
5360
5359
  channel,
5361
- conflationKey: channelState.conflationKey,
5362
- cacheSizes: Array.from(
5360
+ deltaConflationKey: conflationKey,
5361
+ deltaBaseIndex: baseIndex,
5362
+ deltaSeq: sequence,
5363
+ channelStateConflationKey: channelState.conflationKey,
5364
+ channelStateBaseMessage: channelState.baseMessage ? "exists" : null,
5365
+ channelStateBaseSequence: channelState.baseSequence,
5366
+ channelStateLastSequence: channelState.lastSequence,
5367
+ conflationCacheKeys: Array.from(channelState.conflationCaches.keys()),
5368
+ conflationCacheSizes: Array.from(
5363
5369
  channelState.conflationCaches.entries()
5364
5370
  ).map(([key, cache]) => ({ key, size: cache.length }))
5365
- });
5366
- }
5371
+ }
5372
+ );
5367
5373
  this.requestResync(channel);
5368
5374
  return null;
5369
5375
  }
5370
5376
  } else {
5371
5377
  baseMessage = channelState.baseMessage;
5372
5378
  if (!baseMessage) {
5373
- this.error(`No base message for channel ${channel}`);
5374
- if (this.options.debug) {
5375
- this.log("Channel state missing base", {
5379
+ this.error(
5380
+ `No base message (legacy path) for channel ${channel}`,
5381
+ {
5382
+ path: "legacy",
5376
5383
  channel,
5377
- lastSequence: channelState.lastSequence
5378
- });
5379
- }
5384
+ deltaConflationKey: conflationKey,
5385
+ deltaBaseIndex: baseIndex,
5386
+ deltaSeq: sequence,
5387
+ channelStateConflationKey: channelState.conflationKey,
5388
+ channelStateBaseMessage: null,
5389
+ channelStateBaseSequence: channelState.baseSequence,
5390
+ channelStateLastSequence: channelState.lastSequence
5391
+ }
5392
+ );
5380
5393
  this.requestResync(channel);
5381
5394
  return null;
5382
5395
  }
@@ -5423,10 +5436,17 @@ class DeltaCompressionManager {
5423
5436
  });
5424
5437
  try {
5425
5438
  const parsedMessage = JSON.parse(reconstructedMessage);
5439
+ let data = parsedMessage.data || parsedMessage;
5440
+ if (typeof data === "string") {
5441
+ try {
5442
+ data = JSON.parse(data);
5443
+ } catch (e) {
5444
+ }
5445
+ }
5426
5446
  return {
5427
5447
  event,
5428
5448
  channel,
5429
- data: parsedMessage.data || parsedMessage
5449
+ data
5430
5450
  };
5431
5451
  } catch (e) {
5432
5452
  return {