user 6 年之前
父節點
當前提交
a380e24c00
共有 7 個文件被更改,包括 14 次插入41 次删除
  1. 1 12
      lib/index.d.ts
  2. 1 10
      lib/index.js
  3. 1 1
      lib/index.js.map
  4. 6 1
      lib/sample.js
  5. 1 1
      lib/sample.js.map
  6. 1 15
      src/index.ts
  7. 3 1
      src/sample.ts

+ 1 - 12
lib/index.d.ts

@@ -2,17 +2,6 @@ import { Storage } from './storage';
 import { IWebClient } from './webclient';
 import { ContentItem } from './content-item';
 import { UploadItemParameters } from './upload-item-parameters';
-export * from './storage';
-export * from './storage-node';
-export * from './webclient';
-export * from './webclient-fetch';
-export * from './webclient-options';
-export * from './content-item';
-export * from './content-link';
-export * from './content-params';
-export * from './upload-item-link';
-export * from './upload-item-parameters';
-export * from './util';
 export declare class BankClient {
     private urlBase;
     private ipfsUrlBase;
@@ -27,7 +16,7 @@ export declare class BankClient {
     private wsUrlBase;
     private bootstrapPromise;
     private bootstrapResult;
-    constructor(urlBase: string, ipfsUrlBase: string, storage?: Storage, webClient?: IWebClient);
+    constructor(urlBase: string, ipfsUrlBase: string, storage: Storage, webClient: IWebClient);
     getPub(): Promise<string>;
     bootstrap(): any;
     getNonce(): Promise<number>;

+ 1 - 10
lib/index.js

@@ -7,27 +7,18 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
         step((generator = generator.apply(thisArg, _arguments || [])).next());
     });
 };
-function __export(m) {
-    for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
-}
 var __importDefault = (this && this.__importDefault) || function (mod) {
     return (mod && mod.__esModule) ? mod : { "default": mod };
 };
 Object.defineProperty(exports, "__esModule", { value: true });
 const crypto = require("libp2p-crypto");
 const util = require("util");
-const storage_node_1 = require("./storage-node");
 const TextEncoder = util.TextEncoder;
 const ws_1 = __importDefault(require("ws"));
 const content_item_1 = require("./content-item");
 const util_1 = require("./util");
-const webclient_node_1 = __importDefault(require("./webclient-node"));
-__export(require("./storage-node"));
-__export(require("./webclient-fetch"));
-__export(require("./content-item"));
-__export(require("./util"));
 class BankClient {
-    constructor(urlBase, ipfsUrlBase, storage = new storage_node_1.StorageNode('bankClient'), webClient = new webclient_node_1.default()) {
+    constructor(urlBase, ipfsUrlBase, storage, webClient) {
         this.urlBase = urlBase;
         this.ipfsUrlBase = ipfsUrlBase;
         this.storage = storage;

文件差異過大導致無法顯示
+ 1 - 1
lib/index.js.map


+ 6 - 1
lib/sample.js

@@ -7,10 +7,15 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
         step((generator = generator.apply(thisArg, _arguments || [])).next());
     });
 };
+var __importDefault = (this && this.__importDefault) || function (mod) {
+    return (mod && mod.__esModule) ? mod : { "default": mod };
+};
 Object.defineProperty(exports, "__esModule", { value: true });
 const index_1 = require("./index");
+const storage_node_1 = require("./storage-node");
+const webclient_node_1 = __importDefault(require("./webclient-node"));
 const host = 'https://distributing.fun';
-const bankClient = new index_1.BankClient(host, 'https://distributing.fun');
+const bankClient = new index_1.BankClient(host, 'https://distributing.fun', new storage_node_1.StorageNode('bankClient'), new webclient_node_1.default());
 (() => __awaiter(this, void 0, void 0, function* () {
     yield bankClient.bootstrap();
     const peerId = yield bankClient.getPub();

文件差異過大導致無法顯示
+ 1 - 1
lib/sample.js.map


+ 1 - 15
src/index.ts

@@ -2,7 +2,6 @@ import crypto = require('libp2p-crypto');
 import util = require('util');
 import RsaPrivateKey = crypto.keys;
 import { Storage } from './storage';
-import { StorageNode } from './storage-node';
 import { IWebClient } from './webclient';
 const TextEncoder = util.TextEncoder;
 import WebSocket from 'ws';
@@ -10,19 +9,6 @@ import { ContentItem } from './content-item';
 import { ContentParams } from './content-params';
 import { UploadItemParameters } from './upload-item-parameters';
 import { encodeHex, mergeDeep, uuid } from './util';
-import WebClientNode from './webclient-node';
-
-export * from './storage';
-export * from './storage-node';
-export * from './webclient';
-export * from './webclient-fetch';
-export * from './webclient-options';
-export * from './content-item';
-export * from './content-link';
-export * from './content-params';
-export * from './upload-item-link';
-export * from './upload-item-parameters';
-export * from './util';
 
 export class BankClient {
 
@@ -50,7 +36,7 @@ export class BankClient {
     private bootstrapPromise: any;
     private bootstrapResult: any;
     
-    constructor(private urlBase: string, private ipfsUrlBase: string, private storage: Storage = new StorageNode('bankClient'), private webClient: IWebClient = new WebClientNode()) {
+    constructor(private urlBase: string, private ipfsUrlBase: string, private storage: Storage, private webClient: IWebClient) {
       this.wsUrlBase = urlBase.replace(/^http/i, 'ws');
     }
 

+ 3 - 1
src/sample.ts

@@ -1,7 +1,9 @@
 import { BankClient } from './index';
+import { StorageNode } from './storage-node';
+import WebClientNode from './webclient-node';
 const host = 'https://distributing.fun';
 
-const bankClient = new BankClient(host, 'https://distributing.fun');
+const bankClient = new BankClient(host, 'https://distributing.fun', new StorageNode('bankClient'), new WebClientNode());
 
 (async () => {
     await bankClient.bootstrap();