holosphere 2.0.0-alpha6 → 2.0.0-alpha7

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.
Files changed (28) hide show
  1. package/dist/cjs/holosphere.cjs +1 -1
  2. package/dist/esm/holosphere.js +1 -1
  3. package/dist/{index-BtKHqqet.cjs → index-Bvwyvd0T.cjs} +3 -3
  4. package/dist/index-Bvwyvd0T.cjs.map +1 -0
  5. package/dist/{index-CmzkI7SI.cjs → index-C-IlLYlk.cjs} +2 -2
  6. package/dist/{index-CmzkI7SI.cjs.map → index-C-IlLYlk.cjs.map} +1 -1
  7. package/dist/{index-NOravBLu.js → index-d6f4RJBM.js} +35 -52
  8. package/dist/index-d6f4RJBM.js.map +1 -0
  9. package/dist/{index-JFz-dW43.js → index-jmTHEbR2.js} +2 -2
  10. package/dist/{index-JFz-dW43.js.map → index-jmTHEbR2.js.map} +1 -1
  11. package/dist/{indexeddb-storage-OtSAVDZY.js → indexeddb-storage-D8kOl0oK.js} +2 -2
  12. package/dist/{indexeddb-storage-OtSAVDZY.js.map → indexeddb-storage-D8kOl0oK.js.map} +1 -1
  13. package/dist/{indexeddb-storage-C4HsulhA.cjs → indexeddb-storage-a8GipaDr.cjs} +2 -2
  14. package/dist/{indexeddb-storage-C4HsulhA.cjs.map → indexeddb-storage-a8GipaDr.cjs.map} +1 -1
  15. package/dist/{memory-storage-ChpcYvxA.js → memory-storage-DBQK622V.js} +2 -2
  16. package/dist/{memory-storage-ChpcYvxA.js.map → memory-storage-DBQK622V.js.map} +1 -1
  17. package/dist/{memory-storage-MD6ED00P.cjs → memory-storage-gfRovk2O.cjs} +2 -2
  18. package/dist/{memory-storage-MD6ED00P.cjs.map → memory-storage-gfRovk2O.cjs.map} +1 -1
  19. package/dist/{secp256k1-DcTYQrqC.cjs → secp256k1-BCAPF45D.cjs} +2 -2
  20. package/dist/{secp256k1-DcTYQrqC.cjs.map → secp256k1-BCAPF45D.cjs.map} +1 -1
  21. package/dist/{secp256k1-PfNOEI7a.js → secp256k1-DYm_CMqW.js} +2 -2
  22. package/dist/{secp256k1-PfNOEI7a.js.map → secp256k1-DYm_CMqW.js.map} +1 -1
  23. package/package.json +1 -1
  24. package/src/storage/gun-async.js +14 -12
  25. package/src/storage/gun-auth.js +26 -18
  26. package/src/storage/gun-wrapper.js +11 -25
  27. package/dist/index-BtKHqqet.cjs.map +0 -1
  28. package/dist/index-NOravBLu.js.map +0 -1
@@ -361,12 +361,12 @@ async function createPersistentStorage(namespace, options = {}) {
361
361
  const isBrowser = typeof window !== "undefined" && typeof window.indexedDB !== "undefined";
362
362
  typeof process !== "undefined" && process.versions && void 0;
363
363
  if (isBrowser) {
364
- const { IndexedDBStorage } = await import("./indexeddb-storage-OtSAVDZY.js");
364
+ const { IndexedDBStorage } = await import("./indexeddb-storage-D8kOl0oK.js");
365
365
  const storage = new IndexedDBStorage();
366
366
  await storage.init(namespace);
367
367
  return storage;
368
368
  } else {
369
- const { MemoryStorage } = await import("./memory-storage-ChpcYvxA.js");
369
+ const { MemoryStorage } = await import("./memory-storage-DBQK622V.js");
370
370
  const storage = new MemoryStorage();
371
371
  await storage.init(namespace);
372
372
  return storage;
@@ -1586,15 +1586,13 @@ async function gunMap(gunChain, timeout = 5e3) {
1586
1586
  resolve({});
1587
1587
  return;
1588
1588
  }
1589
- expectedCount = keys.filter((k) => {
1590
- const item = parentData[k];
1591
- return item && typeof item === "object" && item["#"];
1592
- }).length;
1593
- if (expectedCount === 0) {
1594
- settled = true;
1595
- resolve({});
1596
- return;
1589
+ for (const key of keys) {
1590
+ const rawItem = parentData[key];
1591
+ if (!rawItem) continue;
1592
+ if (typeof rawItem === "object" && rawItem["#"]) continue;
1593
+ items[key] = rawItem;
1597
1594
  }
1595
+ expectedCount = keys.length;
1598
1596
  gunChain.map().once((data, key) => {
1599
1597
  if (settled || !data || key.startsWith("_")) return;
1600
1598
  items[key] = data;
@@ -1716,20 +1714,7 @@ async function readAll$2(gun, path, timeout = 5e3) {
1716
1714
  }
1717
1715
  };
1718
1716
  const parseItem = (data) => {
1719
- if (!data) return null;
1720
- let item = null;
1721
- if (data._json && typeof data._json === "string") {
1722
- try {
1723
- item = JSON.parse(data._json);
1724
- } catch (e) {
1725
- }
1726
- } else if (typeof data === "string") {
1727
- try {
1728
- item = JSON.parse(data);
1729
- } catch (e) {
1730
- }
1731
- }
1732
- return item;
1717
+ return deserializeFromGun(data);
1733
1718
  };
1734
1719
  ref.once((parentData) => {
1735
1720
  if (settled) return;
@@ -1744,21 +1729,18 @@ async function readAll$2(gun, path, timeout = 5e3) {
1744
1729
  resolve([]);
1745
1730
  return;
1746
1731
  }
1747
- const referenceKeys = [];
1748
1732
  for (const key of keys) {
1749
1733
  const rawItem = parentData[key];
1750
1734
  if (!rawItem) continue;
1751
1735
  if (typeof rawItem === "object" && rawItem["#"]) {
1752
- referenceKeys.push(key);
1753
1736
  continue;
1754
1737
  }
1755
1738
  const item = parseItem(rawItem);
1756
1739
  if (item && item.id && !item._deleted) {
1757
1740
  output2.set(item.id, item);
1758
- receivedCount++;
1759
1741
  }
1760
1742
  }
1761
- expectedCount = referenceKeys.length;
1743
+ expectedCount = keys.length;
1762
1744
  if (expectedCount === 0) {
1763
1745
  settled = true;
1764
1746
  resolve(Array.from(output2.values()));
@@ -1770,13 +1752,10 @@ async function readAll$2(gun, path, timeout = 5e3) {
1770
1752
  if (item && item.id && !item._deleted) {
1771
1753
  if (!output2.has(item.id)) {
1772
1754
  output2.set(item.id, item);
1773
- receivedCount++;
1774
- tryResolve();
1775
1755
  }
1776
- } else {
1777
- receivedCount++;
1778
- tryResolve();
1779
1756
  }
1757
+ receivedCount++;
1758
+ tryResolve();
1780
1759
  });
1781
1760
  });
1782
1761
  setTimeout(() => {
@@ -2924,21 +2903,25 @@ class GunAuth {
2924
2903
  resolve([]);
2925
2904
  return;
2926
2905
  }
2927
- expectedCount = keys.filter((k) => {
2928
- const item = parentData[k];
2929
- return item && typeof item === "object" && item["#"];
2930
- }).length;
2931
- if (expectedCount === 0) {
2932
- settled = true;
2933
- resolve([]);
2934
- return;
2906
+ for (const key of keys) {
2907
+ const rawItem = parentData[key];
2908
+ if (!rawItem) continue;
2909
+ if (typeof rawItem === "object" && rawItem["#"]) continue;
2910
+ const parsed = parseItem(rawItem);
2911
+ if (parsed && !parsed._deleted && !seen.has(key)) {
2912
+ seen.add(key);
2913
+ results.push(parsed);
2914
+ }
2935
2915
  }
2916
+ expectedCount = keys.length;
2936
2917
  ref.map().once((data, key) => {
2937
- if (settled || !data || key.startsWith("_") || seen.has(key)) return;
2938
- seen.add(key);
2939
- const parsed = parseItem(data);
2940
- if (parsed && !parsed._deleted) {
2941
- results.push(parsed);
2918
+ if (settled || !data || key.startsWith("_")) return;
2919
+ if (!seen.has(key)) {
2920
+ seen.add(key);
2921
+ const parsed = parseItem(data);
2922
+ if (parsed && !parsed._deleted) {
2923
+ results.push(parsed);
2924
+ }
2942
2925
  }
2943
2926
  receivedCount++;
2944
2927
  tryResolve();
@@ -3646,7 +3629,7 @@ class GunDBBackend extends StorageBackend {
3646
3629
  }
3647
3630
  }
3648
3631
  const name = "holosphere";
3649
- const version$1 = "2.0.0-alpha6";
3632
+ const version$1 = "2.0.0-alpha7";
3650
3633
  const description = "Holonic geospatial communication infrastructure combining H3 hexagonal indexing with distributed P2P storage";
3651
3634
  const type = "module";
3652
3635
  const bin = {
@@ -5543,7 +5526,7 @@ const sha256 = sha256$1;
5543
5526
  let secp256k1 = null;
5544
5527
  async function loadCrypto() {
5545
5528
  if (!secp256k1) {
5546
- const module2 = await import("./secp256k1-PfNOEI7a.js");
5529
+ const module2 = await import("./secp256k1-DYm_CMqW.js");
5547
5530
  secp256k1 = module2.secp256k1;
5548
5531
  }
5549
5532
  return secp256k1;
@@ -17177,7 +17160,7 @@ class ChainManager {
17177
17160
  */
17178
17161
  async _loadEthers() {
17179
17162
  if (!this.ethers) {
17180
- const ethersModule = await import("./index-JFz-dW43.js");
17163
+ const ethersModule = await import("./index-jmTHEbR2.js");
17181
17164
  this.ethers = ethersModule;
17182
17165
  }
17183
17166
  return this.ethers;
@@ -25946,7 +25929,7 @@ class ContractDeployer {
25946
25929
  */
25947
25930
  async _loadEthers() {
25948
25931
  if (!this.ethers) {
25949
- this.ethers = await import("./index-JFz-dW43.js");
25932
+ this.ethers = await import("./index-jmTHEbR2.js");
25950
25933
  }
25951
25934
  return this.ethers;
25952
25935
  }
@@ -26308,7 +26291,7 @@ class ContractOperations {
26308
26291
  */
26309
26292
  async _loadEthers() {
26310
26293
  if (!this.ethers) {
26311
- this.ethers = await import("./index-JFz-dW43.js");
26294
+ this.ethers = await import("./index-jmTHEbR2.js");
26312
26295
  }
26313
26296
  return this.ethers;
26314
26297
  }
@@ -37989,4 +37972,4 @@ export {
37989
37972
  exists as y,
37990
37973
  bytes as z
37991
37974
  };
37992
- //# sourceMappingURL=index-NOravBLu.js.map
37975
+ //# sourceMappingURL=index-d6f4RJBM.js.map