@tinycloud/node-sdk 2.9.0-beta.0 → 2.10.0-beta.0

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.cjs CHANGED
@@ -20911,6 +20911,7 @@ var _TinyCloudNode = class _TinyCloudNode {
20911
20911
  const address = binding?.address ?? this._address;
20912
20912
  const chainId = binding?.chainId ?? this._chainId;
20913
20913
  const crypto2 = this.createEncryptionCrypto();
20914
+ const descriptorCache = /* @__PURE__ */ new Map();
20914
20915
  const transport = {
20915
20916
  postDecrypt: async ({ networkId, authorization, canonicalBody, signal }) => {
20916
20917
  graph.assertActive();
@@ -20967,7 +20968,18 @@ var _TinyCloudNode = class _TinyCloudNode {
20967
20968
  node: {
20968
20969
  fetchByNetworkId: async (networkId) => {
20969
20970
  graph.assertActive();
20970
- const descriptor = await this.fetchEncryptionNetworkAt(host, networkId, graph.fetch);
20971
+ let pending = descriptorCache.get(networkId);
20972
+ if (!pending) {
20973
+ pending = this.fetchEncryptionNetworkAt(host, networkId, graph.fetch).then((descriptor2) => {
20974
+ if (descriptor2 === null) descriptorCache.delete(networkId);
20975
+ return descriptor2;
20976
+ }).catch((error) => {
20977
+ descriptorCache.delete(networkId);
20978
+ throw error;
20979
+ });
20980
+ descriptorCache.set(networkId, pending);
20981
+ }
20982
+ const descriptor = await pending;
20971
20983
  graph.assertActive();
20972
20984
  return descriptor;
20973
20985
  }