@eluvio/elv-client-js 4.0.59 → 4.0.61

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/src/ElvClient.js CHANGED
@@ -20,7 +20,7 @@ const Pako = require("pako");
20
20
  const {
21
21
  ValidatePresence
22
22
  } = require("./Validation");
23
- const CBOR = require("cbor");
23
+ const CBOR = require("cbor-x");
24
24
 
25
25
  const networks = {
26
26
  "main": "https://main.net955305.contentfabric.io",
@@ -595,24 +595,27 @@ class ElvClient {
595
595
  formatArguments: true
596
596
  });
597
597
 
598
+ let nodeId = this.utils.AddressToNodeId(addr);
599
+
600
+ if(matchNodeId && nodeId !== matchNodeId) {
601
+ return;
602
+ }
603
+
598
604
  let locatorsHex = await this.CallContractMethod({
599
605
  contractAddress: this.contentSpaceAddress,
600
606
  methodName: "activeNodeLocators",
601
607
  methodArgs: [bigi]
602
608
  });
603
609
 
604
- let nodeId = this.utils.AddressToNodeId(addr);
605
-
606
- if(matchNodeId &&nodeId !== matchNodeId) {
607
- return;
608
- }
609
-
610
610
  let node = {id: nodeId, endpoints: []};
611
611
 
612
612
  // Parse locators CBOR
613
- let buffer = locatorsHex.slice(2, locatorsHex.length); // Skip "0x"
614
- let hex = buffer.toString("hex");
615
- let locators = CBOR.decodeAllSync(hex);
613
+ let locators = CBOR.decodeMultiple(
614
+ Buffer.from(
615
+ locatorsHex.slice(2, locatorsHex.length),
616
+ "hex"
617
+ )
618
+ );
616
619
 
617
620
  let match = false;
618
621
 
package/src/Utils.js CHANGED
@@ -754,7 +754,7 @@ const Utils = {
754
754
  "capLevelToPlayerSize": false,
755
755
  "enableWorker": true,
756
756
  "lowLatencyMode": true,
757
- "maxBufferLength": 4,
757
+ "maxBufferLength": 8,
758
758
  "backBufferLength": 4,
759
759
  "liveSyncDuration": 4,
760
760
  "liveMaxLatencyDuration": 5,
@@ -33,21 +33,26 @@ exports.ListAccessGroups = async function() {
33
33
  5,
34
34
  addresses,
35
35
  async address => {
36
- const id = this.utils.AddressToHash(address);
37
- const meta = (await this.ContentObjectMetadata({
38
- libraryId: this.contentSpaceLibraryId,
39
- objectId: `iq__${id}`
40
- })) || {};
41
-
42
- return {
43
- address,
44
- id: `igrp${id}`,
45
- meta
46
- };
36
+ try {
37
+ const id = this.utils.AddressToHash(address);
38
+ const meta = (await this.ContentObjectMetadata({
39
+ libraryId: this.contentSpaceLibraryId,
40
+ objectId: `iq__${id}`
41
+ })) || {};
42
+
43
+ return {
44
+ address,
45
+ id: `igrp${id}`,
46
+ meta
47
+ };
48
+ } catch(error) {
49
+ this.Log(error, true);
50
+ }
47
51
  }
48
52
  );
49
53
 
50
54
  return groups
55
+ .filter(g => g)
51
56
  .sort((a, b) => {
52
57
  const name1 = (a.meta.public || {}).name || `zz__${a.address}`;
53
58
  const name2 = (b.meta.public || {}).name || `zz__${b.address}`;