Skip to content
This repository was archived by the owner on Jul 21, 2023. It is now read-only.

Commit fd60ebf

Browse files
chore: update deps (#217)
Co-authored-by: Alex Potsides <[email protected]>
1 parent c1f6b70 commit fd60ebf

File tree

16 files changed

+1154
-53
lines changed

16 files changed

+1154
-53
lines changed

.aegir.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
module.exports = {
2-
bundlesize: { maxSize: '170kB' }
2+
bundlesize: { maxSize: '190kB' }
33
}
44

package.json

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,12 @@
66
"main": "src/index.js",
77
"scripts": {
88
"lint": "aegir lint",
9+
"prepare": "npm run build",
10+
"build": "npm run build:proto && npm run build:proto-types && aegir build",
11+
"build:proto": "pbjs -t static-module -w commonjs -r libp2p-dht-message --force-number --no-verify --no-delimited --no-create --no-beautify --no-defaults --lint eslint-disable -o src/message/dht.js ./src/message/dht.proto",
12+
"build:proto-types": "pbts -o src/message/dht.d.ts src/message/dht.js",
913
"test": "aegir test -t node",
1014
"test:node": "aegir test -t node",
11-
"prepare": "aegir build --no-bundle",
1215
"docs": "aegir docs",
1316
"release": "aegir release --docs -t node",
1417
"release-minor": "aegir release --type minor --docs -t node",
@@ -17,9 +20,6 @@
1720
"coverage-publish": "aegir-coverage publish",
1821
"sim": "node test/simulation/index.js"
1922
},
20-
"pre-push": [
21-
"lint"
22-
],
2323
"files": [
2424
"src",
2525
"dist"
@@ -36,8 +36,7 @@
3636
"url": "https://github.com/libp2p/js-libp2p-kad-dht/issues"
3737
},
3838
"engines": {
39-
"node": ">=12.0.0",
40-
"npm": ">=6.0.0"
39+
"node": ">=14.0.0"
4140
},
4241
"eslintConfig": {
4342
"extends": "ipfs"
@@ -51,15 +50,15 @@
5150
"err-code": "^3.0.0",
5251
"hashlru": "^2.3.0",
5352
"heap": "~0.2.6",
54-
"interface-datastore": "^3.0.4",
53+
"interface-datastore": "^4.0.0",
5554
"it-first": "^1.0.4",
56-
"it-length-prefixed": "^3.1.0",
55+
"it-length-prefixed": "^5.0.2",
5756
"it-pipe": "^1.1.0",
5857
"k-bucket": "^5.0.0",
5958
"libp2p-crypto": "^0.19.0",
60-
"libp2p-interfaces": "^0.8.2",
59+
"libp2p-interfaces": "^0.10.0",
6160
"libp2p-record": "^0.10.0",
62-
"multiaddr": "^8.1.2",
61+
"multiaddr": "^9.0.0",
6362
"multihashing-async": "^2.1.0",
6463
"p-filter": "^2.1.0",
6564
"p-map": "^4.0.0",
@@ -68,31 +67,31 @@
6867
"p-times": "^3.0.0",
6968
"peer-id": "^0.14.2",
7069
"promise-to-callback": "^1.0.0",
71-
"protons": "^2.0.0",
70+
"protobufjs": "^6.10.2",
7271
"streaming-iterables": "^5.0.4",
73-
"uint8arrays": "^2.0.5",
72+
"uint8arrays": "^2.1.4",
7473
"varint": "^6.0.0",
7574
"xor-distance": "^2.0.0"
7675
},
7776
"devDependencies": {
7877
"@types/debug": "^4.1.5",
7978
"aegir": "^30.3.0",
8079
"async-iterator-all": "^1.0.0",
81-
"chai": "^4.2.0",
80+
"chai": "^4.3.0",
8281
"chai-checkmark": "^1.0.1",
83-
"datastore-level": "^4.0.0",
82+
"datastore-level": "^5.0.0",
8483
"delay": "^5.0.0",
8584
"dirty-chai": "^2.0.1",
8685
"it-pair": "^1.0.0",
87-
"libp2p": "^0.30.7",
86+
"libp2p": "^0.31.0",
8887
"lodash": "^4.17.11",
8988
"lodash.random": "^3.2.0",
9089
"lodash.range": "^3.2.0",
9190
"p-defer": "^3.0.0",
9291
"p-each-series": "^2.1.0",
9392
"p-map-series": "^2.1.0",
9493
"p-retry": "^4.2.0",
95-
"sinon": "^9.0.0"
94+
"sinon": "^10.0.0"
9695
},
9796
"contributors": [
9897
"Vasco Santos <[email protected]>",

src/content-routing/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ const utils = require('../utils')
1212
/**
1313
* @typedef {import('cids')} CID
1414
* @typedef {import('peer-id')} PeerId
15-
* @typedef {import('multiaddr')} Multiaddr
15+
* @typedef {import('multiaddr').Multiaddr} Multiaddr
1616
*/
1717

1818
/**

src/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ const Record = libp2pRecord.Record
3030
* @typedef {import('libp2p/src/dialer')} Dialer
3131
* @typedef {import('libp2p/src/registrar')} Registrar
3232
* @typedef {import('cids')} CID
33-
* @typedef {import('multiaddr')} Multiaddr
33+
* @typedef {import('multiaddr').Multiaddr} Multiaddr
3434
* @typedef {object} PeerData
3535
* @property {PeerId} id
3636
* @property {Multiaddr[]} multiaddrs

src/message/dht.d.ts

Lines changed: 264 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,264 @@
1+
import * as $protobuf from "protobufjs";
2+
/** Properties of a Record. */
3+
export interface IRecord {
4+
5+
/** Record key */
6+
key?: (Uint8Array|null);
7+
8+
/** Record value */
9+
value?: (Uint8Array|null);
10+
11+
/** Record author */
12+
author?: (Uint8Array|null);
13+
14+
/** Record signature */
15+
signature?: (Uint8Array|null);
16+
17+
/** Record timeReceived */
18+
timeReceived?: (string|null);
19+
}
20+
21+
/** Represents a Record. */
22+
export class Record implements IRecord {
23+
24+
/**
25+
* Constructs a new Record.
26+
* @param [p] Properties to set
27+
*/
28+
constructor(p?: IRecord);
29+
30+
/** Record key. */
31+
public key: Uint8Array;
32+
33+
/** Record value. */
34+
public value: Uint8Array;
35+
36+
/** Record author. */
37+
public author: Uint8Array;
38+
39+
/** Record signature. */
40+
public signature: Uint8Array;
41+
42+
/** Record timeReceived. */
43+
public timeReceived: string;
44+
45+
/**
46+
* Encodes the specified Record message. Does not implicitly {@link Record.verify|verify} messages.
47+
* @param m Record message or plain object to encode
48+
* @param [w] Writer to encode to
49+
* @returns Writer
50+
*/
51+
public static encode(m: IRecord, w?: $protobuf.Writer): $protobuf.Writer;
52+
53+
/**
54+
* Decodes a Record message from the specified reader or buffer.
55+
* @param r Reader or buffer to decode from
56+
* @param [l] Message length if known beforehand
57+
* @returns Record
58+
* @throws {Error} If the payload is not a reader or valid buffer
59+
* @throws {$protobuf.util.ProtocolError} If required fields are missing
60+
*/
61+
public static decode(r: ($protobuf.Reader|Uint8Array), l?: number): Record;
62+
63+
/**
64+
* Creates a Record message from a plain object. Also converts values to their respective internal types.
65+
* @param d Plain object
66+
* @returns Record
67+
*/
68+
public static fromObject(d: { [k: string]: any }): Record;
69+
70+
/**
71+
* Creates a plain object from a Record message. Also converts values to other types if specified.
72+
* @param m Record
73+
* @param [o] Conversion options
74+
* @returns Plain object
75+
*/
76+
public static toObject(m: Record, o?: $protobuf.IConversionOptions): { [k: string]: any };
77+
78+
/**
79+
* Converts this Record to JSON.
80+
* @returns JSON object
81+
*/
82+
public toJSON(): { [k: string]: any };
83+
}
84+
85+
/** Properties of a Message. */
86+
export interface IMessage {
87+
88+
/** Message type */
89+
type?: (Message.MessageType|null);
90+
91+
/** Message clusterLevelRaw */
92+
clusterLevelRaw?: (number|null);
93+
94+
/** Message key */
95+
key?: (Uint8Array|null);
96+
97+
/** Message record */
98+
record?: (Uint8Array|null);
99+
100+
/** Message closerPeers */
101+
closerPeers?: (Message.IPeer[]|null);
102+
103+
/** Message providerPeers */
104+
providerPeers?: (Message.IPeer[]|null);
105+
}
106+
107+
/** Represents a Message. */
108+
export class Message implements IMessage {
109+
110+
/**
111+
* Constructs a new Message.
112+
* @param [p] Properties to set
113+
*/
114+
constructor(p?: IMessage);
115+
116+
/** Message type. */
117+
public type: Message.MessageType;
118+
119+
/** Message clusterLevelRaw. */
120+
public clusterLevelRaw: number;
121+
122+
/** Message key. */
123+
public key: Uint8Array;
124+
125+
/** Message record. */
126+
public record: Uint8Array;
127+
128+
/** Message closerPeers. */
129+
public closerPeers: Message.IPeer[];
130+
131+
/** Message providerPeers. */
132+
public providerPeers: Message.IPeer[];
133+
134+
/**
135+
* Encodes the specified Message message. Does not implicitly {@link Message.verify|verify} messages.
136+
* @param m Message message or plain object to encode
137+
* @param [w] Writer to encode to
138+
* @returns Writer
139+
*/
140+
public static encode(m: IMessage, w?: $protobuf.Writer): $protobuf.Writer;
141+
142+
/**
143+
* Decodes a Message message from the specified reader or buffer.
144+
* @param r Reader or buffer to decode from
145+
* @param [l] Message length if known beforehand
146+
* @returns Message
147+
* @throws {Error} If the payload is not a reader or valid buffer
148+
* @throws {$protobuf.util.ProtocolError} If required fields are missing
149+
*/
150+
public static decode(r: ($protobuf.Reader|Uint8Array), l?: number): Message;
151+
152+
/**
153+
* Creates a Message message from a plain object. Also converts values to their respective internal types.
154+
* @param d Plain object
155+
* @returns Message
156+
*/
157+
public static fromObject(d: { [k: string]: any }): Message;
158+
159+
/**
160+
* Creates a plain object from a Message message. Also converts values to other types if specified.
161+
* @param m Message
162+
* @param [o] Conversion options
163+
* @returns Plain object
164+
*/
165+
public static toObject(m: Message, o?: $protobuf.IConversionOptions): { [k: string]: any };
166+
167+
/**
168+
* Converts this Message to JSON.
169+
* @returns JSON object
170+
*/
171+
public toJSON(): { [k: string]: any };
172+
}
173+
174+
export namespace Message {
175+
176+
/** MessageType enum. */
177+
enum MessageType {
178+
PUT_VALUE = 0,
179+
GET_VALUE = 1,
180+
ADD_PROVIDER = 2,
181+
GET_PROVIDERS = 3,
182+
FIND_NODE = 4,
183+
PING = 5
184+
}
185+
186+
/** ConnectionType enum. */
187+
enum ConnectionType {
188+
NOT_CONNECTED = 0,
189+
CONNECTED = 1,
190+
CAN_CONNECT = 2,
191+
CANNOT_CONNECT = 3
192+
}
193+
194+
/** Properties of a Peer. */
195+
interface IPeer {
196+
197+
/** Peer id */
198+
id?: (Uint8Array|null);
199+
200+
/** Peer addrs */
201+
addrs?: (Uint8Array[]|null);
202+
203+
/** Peer connection */
204+
connection?: (Message.ConnectionType|null);
205+
}
206+
207+
/** Represents a Peer. */
208+
class Peer implements IPeer {
209+
210+
/**
211+
* Constructs a new Peer.
212+
* @param [p] Properties to set
213+
*/
214+
constructor(p?: Message.IPeer);
215+
216+
/** Peer id. */
217+
public id: Uint8Array;
218+
219+
/** Peer addrs. */
220+
public addrs: Uint8Array[];
221+
222+
/** Peer connection. */
223+
public connection: Message.ConnectionType;
224+
225+
/**
226+
* Encodes the specified Peer message. Does not implicitly {@link Message.Peer.verify|verify} messages.
227+
* @param m Peer message or plain object to encode
228+
* @param [w] Writer to encode to
229+
* @returns Writer
230+
*/
231+
public static encode(m: Message.IPeer, w?: $protobuf.Writer): $protobuf.Writer;
232+
233+
/**
234+
* Decodes a Peer message from the specified reader or buffer.
235+
* @param r Reader or buffer to decode from
236+
* @param [l] Message length if known beforehand
237+
* @returns Peer
238+
* @throws {Error} If the payload is not a reader or valid buffer
239+
* @throws {$protobuf.util.ProtocolError} If required fields are missing
240+
*/
241+
public static decode(r: ($protobuf.Reader|Uint8Array), l?: number): Message.Peer;
242+
243+
/**
244+
* Creates a Peer message from a plain object. Also converts values to their respective internal types.
245+
* @param d Plain object
246+
* @returns Peer
247+
*/
248+
public static fromObject(d: { [k: string]: any }): Message.Peer;
249+
250+
/**
251+
* Creates a plain object from a Peer message. Also converts values to other types if specified.
252+
* @param m Peer
253+
* @param [o] Conversion options
254+
* @returns Plain object
255+
*/
256+
public static toObject(m: Message.Peer, o?: $protobuf.IConversionOptions): { [k: string]: any };
257+
258+
/**
259+
* Converts this Peer to JSON.
260+
* @returns JSON object
261+
*/
262+
public toJSON(): { [k: string]: any };
263+
}
264+
}

0 commit comments

Comments
 (0)