From 5a0640d3b2f5644dac4eb2fbe8f0b2b998fd3ea9 Mon Sep 17 00:00:00 2001
From: librelois <elois@ifee.fr>
Date: Fri, 3 Apr 2020 01:43:35 +0200
Subject: [PATCH] [ref] migrate dubp-wot-rs -> duniteroxyde

---
 app/lib/blockchain/DuniterBlockchain.ts              | 2 +-
 app/lib/dal/fileDAL.ts                               | 2 +-
 app/lib/indexer.ts                                   | 4 ++--
 app/lib/system/directory.ts                          | 4 ++--
 app/modules/crawler/lib/sync/v2/GlobalIndexStream.ts | 2 +-
 package.json                                         | 2 +-
 test/integration/wot/wotb.ts                         | 2 +-
 yarn.lock                                            | 8 ++++----
 8 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/app/lib/blockchain/DuniterBlockchain.ts b/app/lib/blockchain/DuniterBlockchain.ts
index 6e8955c17..cb036850e 100644
--- a/app/lib/blockchain/DuniterBlockchain.ts
+++ b/app/lib/blockchain/DuniterBlockchain.ts
@@ -38,7 +38,7 @@ import {DBTx} from "../db/DBTx"
 import {Underscore} from "../common-libs/underscore"
 import {OtherConstants} from "../other_constants"
 import {MonitorExecutionTime} from "../debug/MonitorExecutionTime"
-import {Wot} from "dubp-wot-rs"
+import {Wot} from "duniteroxyde"
 import { Directory } from "../system/directory"
 
 export class DuniterBlockchain {
diff --git a/app/lib/dal/fileDAL.ts b/app/lib/dal/fileDAL.ts
index ef4a60730..8827044ed 100644
--- a/app/lib/dal/fileDAL.ts
+++ b/app/lib/dal/fileDAL.ts
@@ -43,7 +43,7 @@ import {MetaDAL} from "./sqliteDAL/MetaDAL"
 import {DataErrors} from "../common-libs/errors"
 import {BasicRevocableIdentity, IdentityDTO} from "../dto/IdentityDTO"
 import {FileSystem} from "../system/directory"
-import {Wot} from "dubp-wot-rs"
+import {Wot} from "duniteroxyde"
 import {IIndexDAO} from "./indexDAL/abstract/IIndexDAO"
 import {BIndexDAO} from "./indexDAL/abstract/BIndexDAO"
 import {MIndexDAO} from "./indexDAL/abstract/MIndexDAO"
diff --git a/app/lib/indexer.ts b/app/lib/indexer.ts
index e27a8a66a..dc602ee75 100644
--- a/app/lib/indexer.ts
+++ b/app/lib/indexer.ts
@@ -31,7 +31,7 @@ import {Underscore} from "./common-libs/underscore"
 import {DataErrors} from "./common-libs/errors"
 import {MonitorExecutionTime} from "./debug/MonitorExecutionTime"
 import {NewLogger} from "./logger"
-import { wotMemCopy } from "dubp-wot-rs"
+import { WotBuilder } from "duniteroxyde"
 
 const constants       = CommonConstants
 
@@ -2021,7 +2021,7 @@ export function reduceBy<T extends IndexEntry>(reducables: T[], properties: (key
 }
 
 async function checkPeopleAreNotOudistanced (pubkeys: string[], newLinks: { [k:string]: string[] }, newcomers: string[], conf: ConfDTO, dal:FileDAL) {
-  let wotb = wotMemCopy(dal.wotb);
+  let wotb = WotBuilder.fromWot(dal.wotb);
   let current = await dal.getCurrentBlockOrNull();
   let membersCount = current ? current.membersCount : 0;
   // We add temporarily the newcomers to the WoT, to integrate their new links
diff --git a/app/lib/system/directory.ts b/app/lib/system/directory.ts
index 0571c8602..742055668 100644
--- a/app/lib/system/directory.ts
+++ b/app/lib/system/directory.ts
@@ -15,7 +15,7 @@ import * as path from "path"
 import * as fs from 'fs'
 import {SQLiteDriver} from "../dal/drivers/SQLiteDriver"
 import {CFSCore} from "../dal/fileDALs/CFSCore"
-import {Wot} from "dubp-wot-rs"
+import {Wot, WotBuilder} from "duniteroxyde"
 import {FileDALParams} from "../dal/fileDAL"
 import {cliprogram} from "../common-libs/programOptions"
 import {LevelDBDriver} from "../dal/drivers/LevelDBDriver"
@@ -211,7 +211,7 @@ export const Directory = {
       const sqlitePath = path.join(home, Directory.DUNITER_DB_NAME + '.db');
       dbf = () => new SQLiteDriver(sqlitePath);
       let wotbFilePath = await Directory.getWotbFilePath(home);
-      wotbf = () => new Wot(wotbFilePath)
+      wotbf = () => WotBuilder.fromFile(wotbFilePath)
     }
     return {
       home: params.home,
diff --git a/app/modules/crawler/lib/sync/v2/GlobalIndexStream.ts b/app/modules/crawler/lib/sync/v2/GlobalIndexStream.ts
index a1b73922d..c2bb86ff2 100644
--- a/app/modules/crawler/lib/sync/v2/GlobalIndexStream.ts
+++ b/app/modules/crawler/lib/sync/v2/GlobalIndexStream.ts
@@ -15,7 +15,7 @@ import {DuniterBlockchain, requiredBindexSizeForTail} from "../../../../../lib/b
 import {BlockDTO} from "../../../../../lib/dto/BlockDTO"
 import {Underscore} from "../../../../../lib/common-libs/underscore"
 import {MonitorExecutionTime} from "../../../../../lib/debug/MonitorExecutionTime"
-import {Wot} from "dubp-wot-rs"
+import {Wot} from "duniteroxyde"
 import {NewLogger} from "../../../../../lib/logger"
 import {CommonConstants} from "../../../../../lib/common-libs/constants"
 import {DBBlock} from "../../../../../lib/db/DBBlock"
diff --git a/package.json b/package.json
index 3421b79ce..21a186cad 100644
--- a/package.json
+++ b/package.json
@@ -71,7 +71,7 @@
     "cors": "2.8.2",
     "daemonize2": "0.4.2",
     "ddos": "0.1.16",
-    "dubp-wot-rs": "0.7.0",
+    "duniteroxyde": "0.1.0",
     "errorhandler": "1.5.0",
     "event-stream": "3.3.4",
     "express": "4.15.2",
diff --git a/test/integration/wot/wotb.ts b/test/integration/wot/wotb.ts
index 74fb35f96..894b1c6e8 100644
--- a/test/integration/wot/wotb.ts
+++ b/test/integration/wot/wotb.ts
@@ -14,7 +14,7 @@
 import {TestUser} from "../tools/TestUser"
 import {NewTestingServer, TestingServer} from "../tools/toolbox"
 import {BmaDependency} from "../../../app/modules/bma/index"
-import {Wot, wotMemCopy} from "dubp-wot-rs"
+import {Wot} from "duniteroxyde"
 import {Underscore} from "../../../app/lib/common-libs/underscore"
 import {shutDownEngine} from "../tools/shutdown-engine"
 import {CommonConstants} from "../../../app/lib/common-libs/constants"
diff --git a/yarn.lock b/yarn.lock
index 3792b3553..bb70a6a16 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -1495,10 +1495,10 @@ doctrine@^2.1.0:
   dependencies:
     esutils "^2.0.2"
 
-dubp-wot-rs@0.6.0:
-  version "0.6.0"
-  resolved "https://registry.yarnpkg.com/dubp-wot-rs/-/dubp-wot-rs-0.6.0.tgz#42ecaae435840a77bfc2cf023c4a8d4f7b22924d"
-  integrity sha512-5imOlrpD15zAVCoBPhNF2nQPA/vcr90Rs/0SZ71SgdNtQbMFOWCkcr3LQecazsaqLzJkBEUkFyABvQF4AI1MJw==
+duniteroxyde@0.1.0:
+  version "0.1.0"
+  resolved "https://registry.yarnpkg.com/duniteroxyde/-/duniteroxyde-0.1.0.tgz#acc06fb7ac6e269a5d8b25f09c5d48088a087917"
+  integrity sha512-EDfxKlVhJrUyuWd9gBNHC1wrQ6Zc6z5JYR1LQf4yhW6N/LNPzM3S0uI95gWeSyNqwSlIiLiIOMoRxJenozqH4g==
   dependencies:
     neon-cli "^0.4.0"
 
-- 
GitLab