user hace 6 años
padre
commit
da23883172
Se han modificado 4 ficheros con 31 adiciones y 31 borrados
  1. 1 1
      lib/index.d.ts
  2. 15 15
      lib/index.js
  3. 1 1
      lib/index.js.map
  4. 14 14
      src/index.ts

+ 1 - 1
lib/index.d.ts

@@ -32,8 +32,8 @@ export declare class BankClient {
     getContactById(peerId: string, contactId: string): Promise<any>;
     updateContact(peerId: string, contactId: string, newProperties: any): Promise<any>;
     getContentItemByHash(hash: string): Promise<ContentItem>;
+    getItemsForCommaList(commaList: string): Promise<any[]>;
     private connectWebsocket;
-    private getItemsForCommaList;
     private getPriv;
     private makePlaintextPayload;
 }

+ 15 - 15
lib/index.js

@@ -296,6 +296,21 @@ class BankClient {
             return new content_item_1.ContentItem(hash, contentParams);
         });
     }
+    getItemsForCommaList(commaList) {
+        return __awaiter(this, void 0, void 0, function* () {
+            const itemHashes = commaList.split(',').filter(x => x.trim() !== '');
+            const items = yield Promise.all(itemHashes.map(itemId => {
+                return this.webClient.requestJSON({
+                    method: 'get',
+                    url: this.ipfsUrlBase + '/ipfs/' + itemId,
+                });
+            }));
+            for (const item of items) {
+                item.hash = itemHashes.shift();
+            }
+            return items;
+        });
+    }
     connectWebsocket(peerAddr, topic, connectCallback, messageCallback) {
         return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
             const nonce = yield this.getNonce();
@@ -336,21 +351,6 @@ class BankClient {
             resolve();
         }));
     }
-    getItemsForCommaList(commaList) {
-        return __awaiter(this, void 0, void 0, function* () {
-            const itemHashes = commaList.split(',').filter(x => x.trim() !== '');
-            const items = yield Promise.all(itemHashes.map(itemId => {
-                return this.webClient.requestJSON({
-                    method: 'get',
-                    url: this.ipfsUrlBase + '/ipfs/' + itemId,
-                });
-            }));
-            for (const item of items) {
-                item.hash = itemHashes.shift();
-            }
-            return items;
-        });
-    }
     getPriv() {
         if (!this.privateKey) {
             throw new Error('missing private key');

La diferencia del archivo ha sido suprimido porque es demasiado grande
+ 1 - 1
lib/index.js.map


+ 14 - 14
src/index.ts

@@ -285,6 +285,20 @@ export class BankClient {
       return new ContentItem(hash, contentParams);
     }
 
+    public async getItemsForCommaList(commaList: string): Promise<any[]> {
+      const itemHashes = commaList.split(',').filter(x => x.trim() !== '');
+      const items: any[] = await Promise.all(itemHashes.map(itemId => {
+        return this.webClient.requestJSON({
+          method: 'get',
+          url: this.ipfsUrlBase + '/ipfs/' + itemId,
+        });
+      }));
+      for (const item of items) {
+        item.hash = itemHashes.shift();
+      }
+      return items;
+    }
+
   private connectWebsocket(peerAddr: string, topic: string, connectCallback: () => void, messageCallback: (data: any) => void) {
     return new Promise(async (resolve, reject) => {
       const nonce = await this.getNonce();
@@ -331,20 +345,6 @@ export class BankClient {
     
   }
 
-    private async getItemsForCommaList(commaList: string): Promise<any[]> {
-      const itemHashes = commaList.split(',').filter(x => x.trim() !== '');
-      const items: any[] = await Promise.all(itemHashes.map(itemId => {
-        return this.webClient.requestJSON({
-          method: 'get',
-          url: this.ipfsUrlBase + '/ipfs/' + itemId,
-        });
-      }));
-      for (const item of items) {
-        item.hash = itemHashes.shift();
-      }
-      return items;
-    }
-
     private getPriv(): RsaPrivateKey {
       if (!this.privateKey) {
         throw new Error('missing private key');