@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.
@@ -3887,30 +3887,43 @@ class DeltaCompressionManager {
3887
3887
  baseMessage = channelState.getBaseMessage(conflationKey, baseIndex);
3888
3888
  if (!baseMessage) {
3889
3889
  this.error(
3890
- `No base message for channel ${channel}, key ${conflationKey}, index ${baseIndex}`
3891
- );
3892
- if (this.options.debug) {
3893
- this.log("Current conflation cache snapshot", {
3890
+ `No base message (conflation path) for channel ${channel}`,
3891
+ {
3892
+ path: "conflation",
3894
3893
  channel,
3895
- conflationKey: channelState.conflationKey,
3896
- cacheSizes: Array.from(
3894
+ deltaConflationKey: conflationKey,
3895
+ deltaBaseIndex: baseIndex,
3896
+ deltaSeq: sequence,
3897
+ channelStateConflationKey: channelState.conflationKey,
3898
+ channelStateBaseMessage: channelState.baseMessage ? "exists" : null,
3899
+ channelStateBaseSequence: channelState.baseSequence,
3900
+ channelStateLastSequence: channelState.lastSequence,
3901
+ conflationCacheKeys: Array.from(channelState.conflationCaches.keys()),
3902
+ conflationCacheSizes: Array.from(
3897
3903
  channelState.conflationCaches.entries()
3898
3904
  ).map(([key, cache]) => ({ key, size: cache.length }))
3899
- });
3900
- }
3905
+ }
3906
+ );
3901
3907
  this.requestResync(channel);
3902
3908
  return null;
3903
3909
  }
3904
3910
  } else {
3905
3911
  baseMessage = channelState.baseMessage;
3906
3912
  if (!baseMessage) {
3907
- this.error(`No base message for channel ${channel}`);
3908
- if (this.options.debug) {
3909
- this.log("Channel state missing base", {
3913
+ this.error(
3914
+ `No base message (legacy path) for channel ${channel}`,
3915
+ {
3916
+ path: "legacy",
3910
3917
  channel,
3911
- lastSequence: channelState.lastSequence
3912
- });
3913
- }
3918
+ deltaConflationKey: conflationKey,
3919
+ deltaBaseIndex: baseIndex,
3920
+ deltaSeq: sequence,
3921
+ channelStateConflationKey: channelState.conflationKey,
3922
+ channelStateBaseMessage: null,
3923
+ channelStateBaseSequence: channelState.baseSequence,
3924
+ channelStateLastSequence: channelState.lastSequence
3925
+ }
3926
+ );
3914
3927
  this.requestResync(channel);
3915
3928
  return null;
3916
3929
  }
@@ -3957,10 +3970,17 @@ class DeltaCompressionManager {
3957
3970
  });
3958
3971
  try {
3959
3972
  const parsedMessage = JSON.parse(reconstructedMessage);
3973
+ let data = parsedMessage.data || parsedMessage;
3974
+ if (typeof data === "string") {
3975
+ try {
3976
+ data = JSON.parse(data);
3977
+ } catch (e) {
3978
+ }
3979
+ }
3960
3980
  return {
3961
3981
  event,
3962
3982
  channel,
3963
- data: parsedMessage.data || parsedMessage
3983
+ data
3964
3984
  };
3965
3985
  } catch (e) {
3966
3986
  return {