@libp2p/utils 5.1.0 → 5.1.1-581574d6d
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.
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Metrics } from '@libp2p/interface';
|
|
2
|
+
export interface CreateTrackedListInit {
|
|
3
|
+
/**
|
|
4
|
+
* The metric name to use
|
|
5
|
+
*/
|
|
6
|
+
name: string;
|
|
7
|
+
/**
|
|
8
|
+
* A metrics implementation
|
|
9
|
+
*/
|
|
10
|
+
metrics?: Metrics;
|
|
11
|
+
}
|
|
12
|
+
export declare function trackedList<V>(config: CreateTrackedListInit): V[];
|
|
13
|
+
//# sourceMappingURL=tracked-list.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tracked-list.d.ts","sourceRoot":"","sources":["../../src/tracked-list.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAA;AAEhD,MAAM,WAAW,qBAAqB;IACpC;;OAEG;IACH,IAAI,EAAE,MAAM,CAAA;IAEZ;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB;AAED,wBAAgB,WAAW,CAAE,CAAC,EAAG,MAAM,EAAE,qBAAqB,GAAG,CAAC,EAAE,CAWnE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tracked-list.js","sourceRoot":"","sources":["../../src/tracked-list.ts"],"names":[],"mappings":"AAcA,MAAM,UAAU,WAAW,CAAM,MAA6B;IAC5D,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,MAAM,CAAA;IAChC,MAAM,IAAI,GAAQ,EAAE,CAAA;IAEpB,OAAO,EAAE,cAAc,CAAC,IAAI,EAAE;QAC5B,SAAS,EAAE,GAAG,EAAE;YACd,OAAO,IAAI,CAAC,MAAM,CAAA;QACpB,CAAC;KACF,CAAC,CAAA;IAEF,OAAO,IAAI,CAAA;AACb,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@libp2p/utils",
|
|
3
|
-
"version": "5.1.
|
|
3
|
+
"version": "5.1.1-581574d6d",
|
|
4
4
|
"description": "Package to aggregate shared logic and dependencies for the libp2p ecosystem",
|
|
5
5
|
"license": "Apache-2.0 OR MIT",
|
|
6
6
|
"homepage": "https://github.com/libp2p/js-libp2p/tree/main/packages/utils#readme",
|
|
@@ -84,6 +84,10 @@
|
|
|
84
84
|
"types": "./dist/src/stream-to-ma-conn.d.ts",
|
|
85
85
|
"import": "./dist/src/stream-to-ma-conn.js"
|
|
86
86
|
},
|
|
87
|
+
"./tracked-list": {
|
|
88
|
+
"types": "./dist/src/tracked-list.d.ts",
|
|
89
|
+
"import": "./dist/src/tracked-list.js"
|
|
90
|
+
},
|
|
87
91
|
"./tracked-map": {
|
|
88
92
|
"types": "./dist/src/tracked-map.d.ts",
|
|
89
93
|
"import": "./dist/src/tracked-map.js"
|
|
@@ -111,8 +115,8 @@
|
|
|
111
115
|
},
|
|
112
116
|
"dependencies": {
|
|
113
117
|
"@chainsafe/is-ip": "^2.0.2",
|
|
114
|
-
"@libp2p/interface": "
|
|
115
|
-
"@libp2p/peer-collections": "
|
|
118
|
+
"@libp2p/interface": "1.1.0-581574d6d",
|
|
119
|
+
"@libp2p/peer-collections": "5.1.2-581574d6d",
|
|
116
120
|
"@multiformats/multiaddr": "^12.1.10",
|
|
117
121
|
"@multiformats/multiaddr-matcher": "^1.1.0",
|
|
118
122
|
"get-iterator": "^2.0.1",
|
|
@@ -125,8 +129,8 @@
|
|
|
125
129
|
"uint8arraylist": "^2.4.3"
|
|
126
130
|
},
|
|
127
131
|
"devDependencies": {
|
|
128
|
-
"@libp2p/logger": "
|
|
129
|
-
"@libp2p/peer-id-factory": "
|
|
132
|
+
"@libp2p/logger": "4.0.3-581574d6d",
|
|
133
|
+
"@libp2p/peer-id-factory": "4.0.2-581574d6d",
|
|
130
134
|
"aegir": "^41.0.2",
|
|
131
135
|
"delay": "^6.0.0",
|
|
132
136
|
"it-all": "^3.0.3",
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { Metrics } from '@libp2p/interface'
|
|
2
|
+
|
|
3
|
+
export interface CreateTrackedListInit {
|
|
4
|
+
/**
|
|
5
|
+
* The metric name to use
|
|
6
|
+
*/
|
|
7
|
+
name: string
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* A metrics implementation
|
|
11
|
+
*/
|
|
12
|
+
metrics?: Metrics
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export function trackedList <V> (config: CreateTrackedListInit): V[] {
|
|
16
|
+
const { name, metrics } = config
|
|
17
|
+
const list: V[] = []
|
|
18
|
+
|
|
19
|
+
metrics?.registerMetric(name, {
|
|
20
|
+
calculate: () => {
|
|
21
|
+
return list.length
|
|
22
|
+
}
|
|
23
|
+
})
|
|
24
|
+
|
|
25
|
+
return list
|
|
26
|
+
}
|
package/dist/typedoc-urls.json
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"AbstractStream": "https://libp2p.github.io/js-libp2p/classes/_libp2p_utils.abstract_stream.AbstractStream.html",
|
|
3
|
-
"./abstract-stream:AbstractStream": "https://libp2p.github.io/js-libp2p/classes/_libp2p_utils.abstract_stream.AbstractStream.html",
|
|
4
|
-
"AbstractStreamInit": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_utils.abstract_stream.AbstractStreamInit.html",
|
|
5
|
-
"./abstract-stream:AbstractStreamInit": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_utils.abstract_stream.AbstractStreamInit.html",
|
|
6
|
-
"certifiedAddressesFirst": "https://libp2p.github.io/js-libp2p/functions/_libp2p_utils.address_sort.certifiedAddressesFirst.html",
|
|
7
|
-
"./address-sort:certifiedAddressesFirst": "https://libp2p.github.io/js-libp2p/functions/_libp2p_utils.address_sort.certifiedAddressesFirst.html",
|
|
8
|
-
"circuitRelayAddressesLast": "https://libp2p.github.io/js-libp2p/functions/_libp2p_utils.address_sort.circuitRelayAddressesLast.html",
|
|
9
|
-
"./address-sort:circuitRelayAddressesLast": "https://libp2p.github.io/js-libp2p/functions/_libp2p_utils.address_sort.circuitRelayAddressesLast.html",
|
|
10
|
-
"defaultAddressSort": "https://libp2p.github.io/js-libp2p/functions/_libp2p_utils.address_sort.defaultAddressSort.html",
|
|
11
|
-
"./address-sort:defaultAddressSort": "https://libp2p.github.io/js-libp2p/functions/_libp2p_utils.address_sort.defaultAddressSort.html",
|
|
12
|
-
"publicAddressesFirst": "https://libp2p.github.io/js-libp2p/functions/_libp2p_utils.address_sort.publicAddressesFirst.html",
|
|
13
|
-
"./address-sort:publicAddressesFirst": "https://libp2p.github.io/js-libp2p/functions/_libp2p_utils.address_sort.publicAddressesFirst.html",
|
|
14
|
-
"arrayEquals": "https://libp2p.github.io/js-libp2p/functions/_libp2p_utils.array_equals.arrayEquals.html",
|
|
15
|
-
"./array-equals:arrayEquals": "https://libp2p.github.io/js-libp2p/functions/_libp2p_utils.array_equals.arrayEquals.html",
|
|
16
|
-
"closeSource": "https://libp2p.github.io/js-libp2p/functions/_libp2p_utils.close_source.closeSource.html",
|
|
17
|
-
"./close-source:closeSource": "https://libp2p.github.io/js-libp2p/functions/_libp2p_utils.close_source.closeSource.html",
|
|
18
|
-
"Errors": "https://libp2p.github.io/js-libp2p/variables/_libp2p_utils.ip_port_to_multiaddr.Errors.html",
|
|
19
|
-
"./ip-port-to-multiaddr:Errors": "https://libp2p.github.io/js-libp2p/variables/_libp2p_utils.ip_port_to_multiaddr.Errors.html",
|
|
20
|
-
"ipPortToMultiaddr": "https://libp2p.github.io/js-libp2p/functions/_libp2p_utils.ip_port_to_multiaddr.ipPortToMultiaddr.html",
|
|
21
|
-
"./ip-port-to-multiaddr:ipPortToMultiaddr": "https://libp2p.github.io/js-libp2p/functions/_libp2p_utils.ip_port_to_multiaddr.ipPortToMultiaddr.html",
|
|
22
|
-
"isPromise": "https://libp2p.github.io/js-libp2p/functions/_libp2p_utils.is_promise.isPromise.html",
|
|
23
|
-
"./is-promise:isPromise": "https://libp2p.github.io/js-libp2p/functions/_libp2p_utils.is_promise.isPromise.html",
|
|
24
|
-
"isLoopback": "https://libp2p.github.io/js-libp2p/functions/_libp2p_utils.multiaddr_is_loopback.isLoopback.html",
|
|
25
|
-
"./multiaddr/is-loopback:isLoopback": "https://libp2p.github.io/js-libp2p/functions/_libp2p_utils.multiaddr_is_loopback.isLoopback.html",
|
|
26
|
-
"isPrivate": "https://libp2p.github.io/js-libp2p/functions/_libp2p_utils.multiaddr_is_private.isPrivate.html",
|
|
27
|
-
"./multiaddr/is-private:isPrivate": "https://libp2p.github.io/js-libp2p/functions/_libp2p_utils.multiaddr_is_private.isPrivate.html",
|
|
28
|
-
"PeerJobQueue": "https://libp2p.github.io/js-libp2p/classes/_libp2p_utils.peer_job_queue.PeerJobQueue.html",
|
|
29
|
-
"./peer-job-queue:PeerJobQueue": "https://libp2p.github.io/js-libp2p/classes/_libp2p_utils.peer_job_queue.PeerJobQueue.html",
|
|
30
|
-
"PeerPriorityQueueOptions": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_utils.peer_job_queue.PeerPriorityQueueOptions.html",
|
|
31
|
-
"./peer-job-queue:PeerPriorityQueueOptions": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_utils.peer_job_queue.PeerPriorityQueueOptions.html",
|
|
32
|
-
"StreamProperties": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_utils.stream_to_ma_conn.StreamProperties.html",
|
|
33
|
-
"./stream-to-ma-conn:StreamProperties": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_utils.stream_to_ma_conn.StreamProperties.html",
|
|
34
|
-
"streamToMaConnection": "https://libp2p.github.io/js-libp2p/functions/_libp2p_utils.stream_to_ma_conn.streamToMaConnection.html",
|
|
35
|
-
"./stream-to-ma-conn:streamToMaConnection": "https://libp2p.github.io/js-libp2p/functions/_libp2p_utils.stream_to_ma_conn.streamToMaConnection.html"
|
|
36
|
-
}
|