*Update dist
This commit is contained in:
parent
5cefe245af
commit
9095cd5b5a
|
@ -1 +1 @@
|
||||||
{"version":3,"file":"rpcQuery.d.ts","sourceRoot":"","sources":["../src/rpcQuery.ts"],"names":[],"mappings":"AACA,OAAO,UAAU,MAAM,iBAAiB,CAAC;AAEzC,OAAO,EAAE,UAAU,EAAe,MAAM,SAAS,CAAC;AAMlD,MAAM,CAAC,OAAO,OAAO,QAAQ;IAC3B,OAAO,CAAC,QAAQ,CAAa;IAC7B,OAAO,CAAC,MAAM,CAAa;IAC3B,OAAO,CAAC,QAAQ,CAAC,CAAe;IAChC,OAAO,CAAC,aAAa,CAAC,CAAM;IAC5B,OAAO,CAAC,QAAQ,CAAkB;IAClC,OAAO,CAAC,UAAU,CAAkB;IACpC,OAAO,CAAC,UAAU,CAAwC;IAC1D,OAAO,CAAC,eAAe,CAAC,CAAsB;gBAElC,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,UAAU;IAMlD,IAAI,MAAM,IAAI,OAAO,CAAC,GAAG,CAAC,CAEzB;IAED,OAAO,CAAC,YAAY;IAIpB,OAAO,CAAC,OAAO;YAQD,IAAI;YA2BJ,UAAU;IAgCxB,OAAO,CAAC,cAAc;IA8CtB,OAAO,CAAC,KAAK;CASd"}
|
{"version":3,"file":"rpcQuery.d.ts","sourceRoot":"","sources":["../src/rpcQuery.ts"],"names":[],"mappings":"AACA,OAAO,UAAU,MAAM,iBAAiB,CAAC;AAEzC,OAAO,EAAE,UAAU,EAAe,MAAM,SAAS,CAAC;AAKlD,MAAM,CAAC,OAAO,OAAO,QAAQ;IAC3B,OAAO,CAAC,QAAQ,CAAa;IAC7B,OAAO,CAAC,MAAM,CAAa;IAC3B,OAAO,CAAC,QAAQ,CAAC,CAAe;IAChC,OAAO,CAAC,aAAa,CAAC,CAAM;IAC5B,OAAO,CAAC,QAAQ,CAAkB;IAClC,OAAO,CAAC,UAAU,CAAkB;IACpC,OAAO,CAAC,UAAU,CAAwC;IAC1D,OAAO,CAAC,eAAe,CAAC,CAAsB;gBAElC,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,UAAU;IAMlD,IAAI,MAAM,IAAI,OAAO,CAAC,GAAG,CAAC,CAEzB;IAED,OAAO,CAAC,YAAY;IAIpB,OAAO,CAAC,OAAO;YAQD,IAAI;YA2BJ,UAAU;IAgCxB,OAAO,CAAC,cAAc;IAgDtB,OAAO,CAAC,KAAK;CASd"}
|
|
@ -2,7 +2,7 @@ import { clearTimeout, setTimeout } from "timers";
|
||||||
import { pack, unpack } from "msgpackr";
|
import { pack, unpack } from "msgpackr";
|
||||||
import { Buffer } from "buffer";
|
import { Buffer } from "buffer";
|
||||||
import { blake2b } from "libskynet";
|
import { blake2b } from "libskynet";
|
||||||
import jsonStringify from "json-stable-stringify";
|
import { flatten } from "./util.js";
|
||||||
export default class RpcQuery {
|
export default class RpcQuery {
|
||||||
_network;
|
_network;
|
||||||
_query;
|
_query;
|
||||||
|
@ -83,12 +83,14 @@ export default class RpcQuery {
|
||||||
const responseStore = this._responses;
|
const responseStore = this._responses;
|
||||||
const responseStoreData = Object.values(responseStore);
|
const responseStoreData = Object.values(responseStore);
|
||||||
const responseObjects = responseStoreData.reduce((output, item) => {
|
const responseObjects = responseStoreData.reduce((output, item) => {
|
||||||
const hash = Buffer.from(blake2b(Buffer.from(jsonStringify(item?.data)))).toString("hex");
|
const itemFlattened = flatten(item?.data).sort();
|
||||||
|
const hash = Buffer.from(blake2b(Buffer.from(JSON.stringify(itemFlattened)))).toString("hex");
|
||||||
output[hash] = item?.data;
|
output[hash] = item?.data;
|
||||||
return output;
|
return output;
|
||||||
}, {});
|
}, {});
|
||||||
const responses = responseStoreData.reduce((output, item) => {
|
const responses = responseStoreData.reduce((output, item) => {
|
||||||
const hash = Buffer.from(blake2b(Buffer.from(jsonStringify(item?.data)))).toString("hex");
|
const itemFlattened = flatten(item?.data).sort();
|
||||||
|
const hash = Buffer.from(blake2b(Buffer.from(JSON.stringify(itemFlattened)))).toString("hex");
|
||||||
output[hash] = output[hash] ?? 0;
|
output[hash] = output[hash] ?? 0;
|
||||||
output[hash]++;
|
output[hash]++;
|
||||||
return output;
|
return output;
|
||||||
|
|
Loading…
Reference in New Issue