@solana/kit 2.2.0 → 2.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.
@@ -4263,7 +4263,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
4263
4263
  ...config.headers ? normalizeHeaders2(config.headers) : void 0,
4264
4264
  ...{
4265
4265
  // Keep these headers lowercase so they will override any user-supplied headers above.
4266
- "solana-client": `js/${"2.2.0"}`
4266
+ "solana-client": `js/${"2.2.1"}`
4267
4267
  }
4268
4268
  }
4269
4269
  }),
@@ -4620,20 +4620,28 @@ this.globalThis.solanaWeb3 = (function (exports) {
4620
4620
  function incrementSubscriberCount(channel, subscriptionId) {
4621
4621
  augmentSubscriberCountAndReturnNewCount(1, channel, subscriptionId);
4622
4622
  }
4623
+ function getSubscriberCountBySubscriptionIdForChannel(channel) {
4624
+ let subscriberCountBySubscriptionId = subscriberCountBySubscriptionIdByChannel.get(channel);
4625
+ if (!subscriberCountBySubscriptionId) {
4626
+ subscriberCountBySubscriptionIdByChannel.set(channel, subscriberCountBySubscriptionId = {});
4627
+ }
4628
+ return subscriberCountBySubscriptionId;
4629
+ }
4623
4630
  function augmentSubscriberCountAndReturnNewCount(amount, channel, subscriptionId) {
4624
4631
  if (subscriptionId === void 0) {
4625
4632
  return;
4626
4633
  }
4627
- let subscriberCountBySubscriptionId = subscriberCountBySubscriptionIdByChannel.get(channel);
4628
- if (!subscriberCountBySubscriptionId && amount > 0) {
4629
- subscriberCountBySubscriptionIdByChannel.set(
4630
- channel,
4631
- subscriberCountBySubscriptionId = { [subscriptionId]: 0 }
4632
- );
4634
+ const subscriberCountBySubscriptionId = getSubscriberCountBySubscriptionIdForChannel(channel);
4635
+ if (!subscriberCountBySubscriptionId[subscriptionId] && amount > 0) {
4636
+ subscriberCountBySubscriptionId[subscriptionId] = 0;
4633
4637
  }
4634
- if ((subscriberCountBySubscriptionId == null ? void 0 : subscriberCountBySubscriptionId[subscriptionId]) !== void 0) {
4635
- return subscriberCountBySubscriptionId[subscriptionId] = amount + subscriberCountBySubscriptionId[subscriptionId];
4638
+ const newCount = amount + subscriberCountBySubscriptionId[subscriptionId];
4639
+ if (newCount <= 0) {
4640
+ delete subscriberCountBySubscriptionId[subscriptionId];
4641
+ } else {
4642
+ subscriberCountBySubscriptionId[subscriptionId] = newCount;
4636
4643
  }
4644
+ return newCount;
4637
4645
  }
4638
4646
  var cache = /* @__PURE__ */ new WeakMap();
4639
4647
  function getMemoizedDemultiplexedNotificationPublisherFromChannelAndResponseTransformer(channel, subscribeRequest, responseTransformer) {