@peerbit/rpc 5.0.7-e1db01f → 5.0.8-4ec760d

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.
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EACN,KAAK,YAAY,EACjB,KAAK,eAAe,EAEpB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,KAAK,GAAG,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,KAAK,EACX,iBAAiB,EACjB,yBAAyB,EACzB,WAAW,EACX,MAAM,SAAS,CAAC;AAEjB,qBAAa,qBAAsB,SAAQ,KAAK;gBACnC,OAAO,EAAE,MAAM;CAG3B;AACD,MAAM,MAAM,oBAAoB,CAAC,CAAC,IAAI,yBAAyB,CAAC,CAAC,CAAC,GACjE,iBAAiB,GAAG;IAAE,IAAI,CAAC,EAAE,WAAW,CAAC,YAAY,CAAC,CAAA;CAAE,GAAG,eAAe,CAAC;AAE5E,eAAO,MAAM,QAAQ,GAAI,CAAC,EAAE,CAAC,OACvB,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,UACN,MAAM,EAAE,EAAE,WACT,CAAC,mBACO,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC,CAAC,EAAE,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,YAC3D,oBAAoB,CAAC,CAAC,CAAC,GAAG,SAAS,kBA8D7C,CAAC"}
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EACN,KAAK,YAAY,EACjB,KAAK,eAAe,EAEpB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,KAAK,GAAG,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,KAAK,EACX,iBAAiB,EACjB,yBAAyB,EACzB,WAAW,EACX,MAAM,SAAS,CAAC;AAEjB,qBAAa,qBAAsB,SAAQ,KAAK;gBACnC,OAAO,EAAE,MAAM;CAG3B;AACD,MAAM,MAAM,oBAAoB,CAAC,CAAC,IAAI,yBAAyB,CAAC,CAAC,CAAC,GACjE,iBAAiB,GAAG;IAAE,IAAI,CAAC,EAAE,WAAW,CAAC,YAAY,CAAC,CAAA;CAAE,GAAG,eAAe,CAAC;AAE5E,eAAO,MAAM,QAAQ,GAAU,CAAC,EAAE,CAAC,OAC7B,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,UACN,MAAM,EAAE,EAAE,WACT,CAAC,mBACO,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC,CAAC,EAAE,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,YAC3D,oBAAoB,CAAC,CAAC,CAAC,GAAG,SAAS,kBA6D7C,CAAC"}
package/dist/src/utils.js CHANGED
@@ -6,57 +6,55 @@ export class MissingResponsesError extends Error {
6
6
  super(message);
7
7
  }
8
8
  }
9
- export const queryAll = (rpc, groups, request, responseHandler, options) => {
9
+ export const queryAll = async (rpc, groups, request, responseHandler, options) => {
10
10
  // In each shard/group only query a subset
11
11
  groups = [...groups].filter((x) => !x.find((y) => y === rpc.node.identity.publicKey.hashcode()));
12
12
  const sendModeType = options?.mode || SilentDelivery;
13
13
  let rng = Math.round(Math.random() * groups.length);
14
14
  const startRng = rng;
15
- const fn = async () => {
16
- let missingReponses = false;
17
- while (groups.length > 0) {
18
- const peersToQuery = new Array(groups.length);
19
- let counter = 0;
20
- const peerToGroupIndex = new Map();
21
- for (let i = 0; i < groups.length; i++) {
22
- const group = groups[i];
23
- peersToQuery[counter] = group[rng % group.length];
24
- peerToGroupIndex.set(peersToQuery[counter], i);
25
- counter++;
15
+ let missingReponses = undefined;
16
+ while (groups.length > 0) {
17
+ const peersToQuery = new Array(groups.length);
18
+ let counter = 0;
19
+ const peerToGroupIndex = new Map();
20
+ for (let i = 0; i < groups.length; i++) {
21
+ const group = groups[i];
22
+ peersToQuery[counter] = group[rng % group.length];
23
+ peerToGroupIndex.set(peersToQuery[counter], i);
24
+ counter++;
25
+ }
26
+ if (peersToQuery.length > 0) {
27
+ const results = await rpc.request(request, {
28
+ ...options,
29
+ // eslint-disable-next-line new-cap
30
+ mode: new sendModeType({ to: peersToQuery, redundancy: 1 }), // TODO configuration redundancy?
31
+ });
32
+ for (const result of results) {
33
+ if (!result.from) {
34
+ throw new Error("Unexpected, missing from");
35
+ }
36
+ peerToGroupIndex.delete(result.from.hashcode());
26
37
  }
27
- if (peersToQuery.length > 0) {
28
- const results = await rpc.request(request, {
29
- ...options,
30
- // eslint-disable-next-line new-cap
31
- mode: new sendModeType({ to: peersToQuery, redundancy: 1 }), // TODO configuration redundancy?
32
- });
33
- for (const result of results) {
34
- if (!result.from) {
35
- throw new Error("Unexpected, missing from");
38
+ await responseHandler(results);
39
+ const indicesLeft = new Set([...peerToGroupIndex.values()]);
40
+ rng += 1;
41
+ groups = groups.filter((v, ix) => {
42
+ if (indicesLeft.has(ix)) {
43
+ const peerIndex = rng % v.length;
44
+ if (rng === startRng || peerIndex === startRng % v.length) {
45
+ // TODO Last condition needed?
46
+ (missingReponses || (missingReponses = [])).push(v);
47
+ return false;
36
48
  }
37
- peerToGroupIndex.delete(result.from.hashcode());
49
+ return true;
38
50
  }
39
- await responseHandler(results);
40
- const indicesLeft = new Set([...peerToGroupIndex.values()]);
41
- rng += 1;
42
- groups = groups.filter((v, ix) => {
43
- if (indicesLeft.has(ix)) {
44
- const peerIndex = rng % v.length;
45
- if (rng === startRng || peerIndex === startRng % v.length) {
46
- // TODO Last condition needed?
47
- missingReponses = true;
48
- return false;
49
- }
50
- return true;
51
- }
52
- return false;
53
- });
54
- }
51
+ return false;
52
+ });
55
53
  }
56
- if (missingReponses) {
57
- throw new MissingResponsesError("Did not receive responses from all shards");
58
- }
59
- };
60
- return fn();
54
+ }
55
+ if (missingReponses) {
56
+ throw new MissingResponsesError("Did not receive responses from all shards: " +
57
+ JSON.stringify(missingReponses));
58
+ }
61
59
  };
62
60
  //# sourceMappingURL=utils.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAGN,cAAc,GACd,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAY,MAAM,iBAAiB,CAAC;AAO3C,MAAM,OAAO,qBAAsB,SAAQ,KAAK;IAC/C,YAAY,OAAe;QAC1B,KAAK,CAAC,OAAO,CAAC,CAAC;IAChB,CAAC;CACD;AAID,MAAM,CAAC,MAAM,QAAQ,GAAG,CACvB,GAAc,EACd,MAAkB,EAClB,OAAU,EACV,eAAqE,EACrE,OAA6C,EAC5C,EAAE;IACH,0CAA0C;IAC1C,MAAM,GAAG,CAAC,GAAG,MAAM,CAAC,CAAC,MAAM,CAC1B,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,QAAQ,EAAE,CAAC,CACnE,CAAC;IAEF,MAAM,YAAY,GAAG,OAAO,EAAE,IAAI,IAAI,cAAc,CAAC;IACrD,IAAI,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC;IACpD,MAAM,QAAQ,GAAG,GAAG,CAAC;IACrB,MAAM,EAAE,GAAG,KAAK,IAAI,EAAE;QACrB,IAAI,eAAe,GAAG,KAAK,CAAC;QAC5B,OAAO,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAC1B,MAAM,YAAY,GAAa,IAAI,KAAK,CAAC,M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
5
  "sideEffects": false,
6
6
  "type": "module",
@@ -59,12 +59,12 @@
59
59
  "license": "MIT",
60
60
  "dependencies": {
61
61
  "@dao-xyz/borsh": "^5.2.3",
62
- "@peerbit/crypto": "2.3.0-e1db01f",
63
- "@peerbit/logger": "1.0.3-e1db01f",
64
- "@peerbit/program": "5.0.1-e1db01f",
65
- "@peerbit/time": "2.0.7-e1db01f"
62
+ "@peerbit/crypto": "2.3.1-4ec760d",
63
+ "@peerbit/logger": "1.0.3-4ec760d",
64
+ "@peerbit/program": "5.0.2-4ec760d",
65
+ "@peerbit/time": "2.0.7-4ec760d"
66
66
  },
67
67
  "devDependencies": {
68
- "@peerbit/test-utils": "2.0.41-e1db01f"
68
+ "@peerbit/test-utils": "2.0.42-4ec760d"
69
69
  }
70
70
  }
package/src/utils.ts CHANGED
@@ -19,7 +19,7 @@ export class MissingResponsesError extends Error {
19
19
  export type RPCRequestAllOptions<R> = RPCRequestResponseOptions<R> &
20
20
  EncryptionOptions & { mode?: Constructor<DeliveryMode> } & PriorityOptions;
21
21
 
22
- export const queryAll = <Q, R>(
22
+ export const queryAll = async <Q, R>(
23
23
  rpc: RPC<Q, R>,
24
24
  groups: string[][],
25
25
  request: Q,
@@ -34,56 +34,55 @@ export const queryAll = <Q, R>(
34
34
  const sendModeType = options?.mode || SilentDelivery;
35
35
  let rng = Math.round(Math.random() * groups.length);
36
36
  const startRng = rng;
37
- const fn = async () => {
38
- let missingReponses = false;
39
- while (groups.length > 0) {
40
- const peersToQuery: string[] = new Array(groups.length);
41
- let counter = 0;
42
- const peerToGroupIndex = new Map<string, number>();
43
- for (let i = 0; i < groups.length; i++) {
44
- const group = groups[i];
45
- peersToQuery[counter] = group[rng % group.length];
46
- peerToGroupIndex.set(peersToQuery[counter], i);
47
- counter++;
48
- }
49
- if (peersToQuery.length > 0) {
50
- const results = await rpc.request(request, {
51
- ...options,
52
- // eslint-disable-next-line new-cap
53
- mode: new sendModeType({ to: peersToQuery, redundancy: 1 }), // TODO configuration redundancy?
54
- });
55
37
 
56
- for (const result of results) {
57
- if (!result.from) {
58
- throw new Error("Unexpected, missing from");
59
- }
60
- peerToGroupIndex.delete(result.from.hashcode());
38
+ let missingReponses: string[][] | undefined = undefined;
39
+ while (groups.length > 0) {
40
+ const peersToQuery: string[] = new Array(groups.length);
41
+ let counter = 0;
42
+ const peerToGroupIndex = new Map<string, number>();
43
+ for (let i = 0; i < groups.length; i++) {
44
+ const group = groups[i];
45
+ peersToQuery[counter] = group[rng % group.length];
46
+ peerToGroupIndex.set(peersToQuery[counter], i);
47
+ counter++;
48
+ }
49
+ if (peersToQuery.length > 0) {
50
+ const results = await rpc.request(request, {
51
+ ...options,
52
+ // eslint-disable-next-line new-cap
53
+ mode: new sendModeType({ to: peersToQuery, redundancy: 1 }), // TODO configuration redundancy?
54
+ });
55
+
56
+ for (const result of results) {
57
+ if (!result.from) {
58
+ throw new Error("Unexpected, missing from");
61
59
  }
60
+ peerToGroupIndex.delete(result.from.hashcode());
61
+ }
62
62
 
63
- await responseHandler(results);
63
+ await responseHandler(results);
64
64
 
65
- const indicesLeft = new Set([...peerToGroupIndex.values()]);
65
+ const indicesLeft = new Set([...peerToGroupIndex.values()]);
66
66
 
67
- rng += 1;
68
- groups = groups.filter((v, ix) => {
69
- if (indicesLeft.has(ix)) {
70
- const peerIndex = rng % v.length;
71
- if (rng === startRng || peerIndex === startRng % v.length) {
72
- // TODO Last condition needed?
73
- missingReponses = true;
74
- return false;
75
- }
76
- return true;
67
+ rng += 1;
68
+ groups = groups.filter((v, ix) => {
69
+ if (indicesLeft.has(ix)) {
70
+ const peerIndex = rng % v.length;
71
+ if (rng === startRng || peerIndex === startRng % v.length) {
72
+ // TODO Last condition needed?
73
+ (missingReponses || (missingReponses = [])).push(v);
74
+ return false;
77
75
  }
78
- return false;
79
- });
80
- }
81
- }
82
- if (missingReponses) {
83
- throw new MissingResponsesError(
84
- "Did not receive responses from all shards",
85
- );
76
+ return true;
77
+ }
78
+ return false;
79
+ });
86
80
  }
87
- };
88
- return fn();
81
+ }
82
+ if (missingReponses) {
83
+ throw new MissingResponsesError(
84
+ "Did not receive responses from all shards: " +
85
+ JSON.stringify(missingReponses),
86
+ );
87
+ }
89
88
  };