libp2p 0.35.8 → 0.36.0
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.
- package/dist/index.min.js +55 -0
- package/dist/src/circuit/auto-relay.d.ts +8 -10
- package/dist/src/circuit/auto-relay.d.ts.map +1 -1
- package/dist/src/config.d.ts +2 -0
- package/dist/src/config.d.ts.map +1 -1
- package/dist/src/connection-manager/auto-dialler.d.ts +1 -1
- package/dist/src/connection-manager/auto-dialler.d.ts.map +1 -1
- package/dist/src/connection-manager/index.d.ts +1 -2
- package/dist/src/connection-manager/index.d.ts.map +1 -1
- package/dist/src/content-routing/utils.d.ts +3 -3
- package/dist/src/content-routing/utils.d.ts.map +1 -1
- package/dist/src/dialer/dial-request.d.ts.map +1 -1
- package/dist/src/dialer/index.d.ts +12 -7
- package/dist/src/dialer/index.d.ts.map +1 -1
- package/dist/src/errors.d.ts +2 -0
- package/dist/src/fetch/constants.d.ts +2 -0
- package/dist/src/fetch/constants.d.ts.map +1 -0
- package/dist/src/fetch/index.d.ts +76 -0
- package/dist/src/fetch/index.d.ts.map +1 -0
- package/dist/src/fetch/proto.d.ts +134 -0
- package/dist/src/identify/index.d.ts +4 -4
- package/dist/src/identify/index.d.ts.map +1 -1
- package/dist/src/index.d.ts +116 -7
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/metrics/index.d.ts +9 -4
- package/dist/src/metrics/index.d.ts.map +1 -1
- package/dist/src/metrics/tracked-map.d.ts +6 -1
- package/dist/src/metrics/tracked-map.d.ts.map +1 -1
- package/dist/src/peer-routing.d.ts +1 -1
- package/dist/src/peer-routing.d.ts.map +1 -1
- package/dist/src/peer-store/address-book.d.ts +30 -84
- package/dist/src/peer-store/address-book.d.ts.map +1 -1
- package/dist/src/peer-store/index.d.ts +28 -94
- package/dist/src/peer-store/index.d.ts.map +1 -1
- package/dist/src/peer-store/key-book.d.ts +31 -15
- package/dist/src/peer-store/key-book.d.ts.map +1 -1
- package/dist/src/peer-store/metadata-book.d.ts +33 -29
- package/dist/src/peer-store/metadata-book.d.ts.map +1 -1
- package/dist/src/peer-store/pb/peer.d.ts +222 -0
- package/dist/src/peer-store/proto-book.d.ts +27 -28
- package/dist/src/peer-store/proto-book.d.ts.map +1 -1
- package/dist/src/peer-store/store.d.ts +73 -0
- package/dist/src/peer-store/store.d.ts.map +1 -0
- package/dist/src/peer-store/types.d.ts +202 -0
- package/dist/src/peer-store/types.d.ts.map +1 -0
- package/dist/src/ping/index.d.ts.map +1 -1
- package/dist/src/record/peer-record/index.d.ts +2 -2
- package/dist/src/record/peer-record/index.d.ts.map +1 -1
- package/dist/src/registrar.d.ts +5 -5
- package/dist/src/registrar.d.ts.map +1 -1
- package/dist/src/types.d.ts +90 -0
- package/dist/src/types.d.ts.map +1 -0
- package/dist/src/upgrader.d.ts +8 -2
- package/dist/src/upgrader.d.ts.map +1 -1
- package/package.json +23 -26
- package/src/circuit/auto-relay.js +52 -38
- package/src/config.js +2 -0
- package/src/connection-manager/auto-dialler.js +20 -8
- package/src/connection-manager/index.js +42 -22
- package/src/content-routing/utils.js +4 -4
- package/src/dialer/dial-request.js +4 -1
- package/src/dialer/index.js +38 -8
- package/src/errors.js +2 -0
- package/src/fetch/README.md +36 -0
- package/src/fetch/constants.js +6 -0
- package/src/fetch/index.js +159 -0
- package/src/fetch/proto.d.ts +134 -0
- package/src/fetch/proto.js +333 -0
- package/src/fetch/proto.proto +15 -0
- package/src/identify/index.js +47 -38
- package/src/index.js +72 -27
- package/src/metrics/index.js +15 -8
- package/src/metrics/tracked-map.js +40 -14
- package/src/peer-routing.js +4 -1
- package/src/peer-store/address-book.js +254 -226
- package/src/peer-store/index.js +79 -110
- package/src/peer-store/key-book.js +99 -54
- package/src/peer-store/metadata-book.js +171 -101
- package/src/peer-store/pb/peer.d.ts +222 -0
- package/src/peer-store/pb/peer.js +643 -0
- package/src/peer-store/pb/peer.proto +31 -0
- package/src/peer-store/proto-book.js +171 -105
- package/src/peer-store/store.js +263 -0
- package/src/peer-store/types.ts +245 -0
- package/src/ping/index.js +6 -0
- package/src/record/peer-record/index.js +1 -1
- package/src/record/utils.js +1 -1
- package/src/registrar.js +4 -4
- package/src/types.ts +98 -0
- package/src/upgrader.js +32 -2
- package/dist/src/peer-store/book.d.ts +0 -81
- package/dist/src/peer-store/book.d.ts.map +0 -1
- package/dist/src/peer-store/persistent/consts.d.ts +0 -6
- package/dist/src/peer-store/persistent/consts.d.ts.map +0 -1
- package/dist/src/peer-store/persistent/index.d.ts +0 -129
- package/dist/src/peer-store/persistent/index.d.ts.map +0 -1
- package/dist/src/peer-store/persistent/pb/address-book.d.ts +0 -198
- package/dist/src/peer-store/persistent/pb/proto-book.d.ts +0 -59
- package/src/peer-store/book.js +0 -124
- package/src/peer-store/persistent/consts.js +0 -15
- package/src/peer-store/persistent/index.js +0 -408
- package/src/peer-store/persistent/pb/address-book.d.ts +0 -198
- package/src/peer-store/persistent/pb/address-book.js +0 -522
- package/src/peer-store/persistent/pb/address-book.proto +0 -27
- package/src/peer-store/persistent/pb/proto-book.d.ts +0 -59
- package/src/peer-store/persistent/pb/proto-book.js +0 -157
- package/src/peer-store/persistent/pb/proto-book.proto +0 -5
package/dist/src/index.d.ts
CHANGED
|
@@ -12,6 +12,7 @@ export = Libp2p;
|
|
|
12
12
|
* @typedef {import('libp2p-interfaces/src/pubsub').PubsubOptions} PubsubOptions
|
|
13
13
|
* @typedef {import('interface-datastore').Datastore} Datastore
|
|
14
14
|
* @typedef {import('./pnet')} Protector
|
|
15
|
+
* @typedef {import('./types').ConnectionGater} ConnectionGater
|
|
15
16
|
* @typedef {Object} PersistentPeerStoreOptions
|
|
16
17
|
* @property {number} [threshold]
|
|
17
18
|
*/
|
|
@@ -69,13 +70,14 @@ export = Libp2p;
|
|
|
69
70
|
* @property {Libp2pModules} modules libp2p modules to use
|
|
70
71
|
* @property {import('./address-manager').AddressManagerOptions} [addresses]
|
|
71
72
|
* @property {import('./connection-manager').ConnectionManagerOptions} [connectionManager]
|
|
73
|
+
* @property {Partial<import('./types').ConnectionGater>} [connectionGater]
|
|
72
74
|
* @property {Datastore} [datastore]
|
|
73
75
|
* @property {import('./dialer').DialerOptions} [dialer]
|
|
74
76
|
* @property {import('./identify/index').HostProperties} [host] libp2p host
|
|
75
77
|
* @property {KeychainOptions & import('./keychain/index').KeychainOptions} [keychain]
|
|
76
78
|
* @property {MetricsOptions & import('./metrics').MetricsOptions} [metrics]
|
|
77
79
|
* @property {import('./peer-routing').PeerRoutingOptions} [peerRouting]
|
|
78
|
-
* @property {PeerStoreOptions
|
|
80
|
+
* @property {PeerStoreOptions} [peerStore]
|
|
79
81
|
* @property {import('./transport-manager').TransportManagerOptions} [transportManager]
|
|
80
82
|
* @property {Libp2pConfig} [config]
|
|
81
83
|
*
|
|
@@ -115,6 +117,7 @@ declare class Libp2p extends EventEmitter {
|
|
|
115
117
|
connectionManager: {
|
|
116
118
|
minConnections: number;
|
|
117
119
|
};
|
|
120
|
+
connectionGater: {};
|
|
118
121
|
transportManager: {
|
|
119
122
|
faultTolerance: number;
|
|
120
123
|
};
|
|
@@ -134,6 +137,98 @@ declare class Libp2p extends EventEmitter {
|
|
|
134
137
|
enabled: boolean;
|
|
135
138
|
};
|
|
136
139
|
peerStore: {
|
|
140
|
+
/**
|
|
141
|
+
* @typedef {import('libp2p-interfaces/src/connection').Connection} Connection
|
|
142
|
+
* @typedef {import('libp2p-interfaces/src/stream-muxer/types').MuxedStream} MuxedStream
|
|
143
|
+
* @typedef {import('libp2p-interfaces/src/transport/types').TransportFactory<any, any>} TransportFactory
|
|
144
|
+
* @typedef {import('libp2p-interfaces/src/stream-muxer/types').MuxerFactory} MuxerFactory
|
|
145
|
+
* @typedef {import('libp2p-interfaces/src/content-routing/types').ContentRouting} ContentRoutingModule
|
|
146
|
+
* @typedef {import('libp2p-interfaces/src/peer-discovery/types').PeerDiscoveryFactory} PeerDiscoveryFactory
|
|
147
|
+
* @typedef {import('libp2p-interfaces/src/peer-routing/types').PeerRouting} PeerRoutingModule
|
|
148
|
+
* @typedef {import('libp2p-interfaces/src/crypto/types').Crypto} Crypto
|
|
149
|
+
* @typedef {import('libp2p-interfaces/src/pubsub')} Pubsub
|
|
150
|
+
* @typedef {import('libp2p-interfaces/src/pubsub').PubsubOptions} PubsubOptions
|
|
151
|
+
* @typedef {import('interface-datastore').Datastore} Datastore
|
|
152
|
+
* @typedef {import('./pnet')} Protector
|
|
153
|
+
* @typedef {import('./types').ConnectionGater} ConnectionGater
|
|
154
|
+
* @typedef {Object} PersistentPeerStoreOptions
|
|
155
|
+
* @property {number} [threshold]
|
|
156
|
+
*/
|
|
157
|
+
/**
|
|
158
|
+
* @typedef {Object} HandlerProps
|
|
159
|
+
* @property {Connection} connection
|
|
160
|
+
* @property {MuxedStream} stream
|
|
161
|
+
* @property {string} protocol
|
|
162
|
+
*
|
|
163
|
+
* @typedef {Object} DhtOptions
|
|
164
|
+
* @property {boolean} [enabled = false]
|
|
165
|
+
* @property {number} [kBucketSize = 20]
|
|
166
|
+
* @property {boolean} [clientMode]
|
|
167
|
+
* @property {import('libp2p-interfaces/src/types').DhtSelectors} [selectors]
|
|
168
|
+
* @property {import('libp2p-interfaces/src/types').DhtValidators} [validators]
|
|
169
|
+
*
|
|
170
|
+
* @typedef {Object} KeychainOptions
|
|
171
|
+
* @property {Datastore} [datastore]
|
|
172
|
+
*
|
|
173
|
+
* @typedef {Object} PeerStoreOptions
|
|
174
|
+
* @property {boolean} persistence
|
|
175
|
+
*
|
|
176
|
+
* @typedef {Object} PubsubLocalOptions
|
|
177
|
+
* @property {boolean} enabled
|
|
178
|
+
*
|
|
179
|
+
* @typedef {Object} MetricsOptions
|
|
180
|
+
* @property {boolean} enabled
|
|
181
|
+
*
|
|
182
|
+
* @typedef {Object} RelayOptions
|
|
183
|
+
* @property {boolean} [enabled = true]
|
|
184
|
+
* @property {import('./circuit').RelayAdvertiseOptions} [advertise]
|
|
185
|
+
* @property {import('./circuit').HopOptions} [hop]
|
|
186
|
+
* @property {import('./circuit').AutoRelayOptions} [autoRelay]
|
|
187
|
+
*
|
|
188
|
+
* @typedef {Object} Libp2pConfig
|
|
189
|
+
* @property {DhtOptions} [dht] dht module options
|
|
190
|
+
* @property {import('./nat-manager').NatManagerOptions} [nat]
|
|
191
|
+
* @property {Record<string, Object|boolean>} [peerDiscovery]
|
|
192
|
+
* @property {PubsubLocalOptions & PubsubOptions} [pubsub] pubsub module options
|
|
193
|
+
* @property {RelayOptions} [relay]
|
|
194
|
+
* @property {Record<string, Object>} [transport] transport options indexed by transport key
|
|
195
|
+
*
|
|
196
|
+
* @typedef {Object} Libp2pModules
|
|
197
|
+
* @property {TransportFactory[]} transport
|
|
198
|
+
* @property {MuxerFactory[]} streamMuxer
|
|
199
|
+
* @property {Crypto[]} connEncryption
|
|
200
|
+
* @property {PeerDiscoveryFactory[]} [peerDiscovery]
|
|
201
|
+
* @property {PeerRoutingModule[]} [peerRouting]
|
|
202
|
+
* @property {ContentRoutingModule[]} [contentRouting]
|
|
203
|
+
* @property {Object} [dht]
|
|
204
|
+
* @property {{new(...args: any[]): Pubsub}} [pubsub]
|
|
205
|
+
* @property {Protector} [connProtector]
|
|
206
|
+
*
|
|
207
|
+
* @typedef {Object} Libp2pOptions
|
|
208
|
+
* @property {Libp2pModules} modules libp2p modules to use
|
|
209
|
+
* @property {import('./address-manager').AddressManagerOptions} [addresses]
|
|
210
|
+
* @property {import('./connection-manager').ConnectionManagerOptions} [connectionManager]
|
|
211
|
+
* @property {Partial<import('./types').ConnectionGater>} [connectionGater]
|
|
212
|
+
* @property {Datastore} [datastore]
|
|
213
|
+
* @property {import('./dialer').DialerOptions} [dialer]
|
|
214
|
+
* @property {import('./identify/index').HostProperties} [host] libp2p host
|
|
215
|
+
* @property {KeychainOptions & import('./keychain/index').KeychainOptions} [keychain]
|
|
216
|
+
* @property {MetricsOptions & import('./metrics').MetricsOptions} [metrics]
|
|
217
|
+
* @property {import('./peer-routing').PeerRoutingOptions} [peerRouting]
|
|
218
|
+
* @property {PeerStoreOptions} [peerStore]
|
|
219
|
+
* @property {import('./transport-manager').TransportManagerOptions} [transportManager]
|
|
220
|
+
* @property {Libp2pConfig} [config]
|
|
221
|
+
*
|
|
222
|
+
* @typedef {Object} constructorOptions
|
|
223
|
+
* @property {PeerId} peerId
|
|
224
|
+
*
|
|
225
|
+
* @typedef {Object} CreateOptions
|
|
226
|
+
* @property {PeerId} [peerId]
|
|
227
|
+
*
|
|
228
|
+
* @extends {EventEmitter}
|
|
229
|
+
* @fires Libp2p#error Emitted when an error occurs
|
|
230
|
+
* @fires Libp2p#peer:discovery Emitted when a peer is discovered
|
|
231
|
+
*/
|
|
137
232
|
persistence: boolean;
|
|
138
233
|
threshold: number;
|
|
139
234
|
};
|
|
@@ -189,7 +284,10 @@ declare class Libp2p extends EventEmitter {
|
|
|
189
284
|
peerId: PeerId;
|
|
190
285
|
datastore: import("interface-datastore").Datastore | undefined;
|
|
191
286
|
metrics: Metrics | undefined;
|
|
192
|
-
|
|
287
|
+
/** @type {ConnectionGater} */
|
|
288
|
+
connectionGater: ConnectionGater;
|
|
289
|
+
/** @type {import('./peer-store/types').PeerStore} */
|
|
290
|
+
peerStore: import('./peer-store/types').PeerStore;
|
|
193
291
|
addresses: {
|
|
194
292
|
listen: never[];
|
|
195
293
|
announce: never[];
|
|
@@ -253,7 +351,7 @@ declare class Libp2p extends EventEmitter {
|
|
|
253
351
|
* @param {string[]|string} protocols
|
|
254
352
|
* @param {(props: HandlerProps) => void} handler
|
|
255
353
|
*/
|
|
256
|
-
handle(protocols: string[] | string, handler: (props: HandlerProps) => void): void
|
|
354
|
+
handle(protocols: string[] | string, handler: (props: HandlerProps) => void): Promise<void>;
|
|
257
355
|
dialer: Dialer;
|
|
258
356
|
relay: Relay | undefined;
|
|
259
357
|
identifyService: IdentifyService | undefined;
|
|
@@ -270,6 +368,7 @@ declare class Libp2p extends EventEmitter {
|
|
|
270
368
|
* @param {{ id: PeerId, multiaddrs: Multiaddr[], protocols: string[] }} peer
|
|
271
369
|
*/
|
|
272
370
|
private _onDiscoveryPeer;
|
|
371
|
+
fetchService: FetchService;
|
|
273
372
|
/**
|
|
274
373
|
* Starts the libp2p node and all its subsystems
|
|
275
374
|
*
|
|
@@ -354,6 +453,14 @@ declare class Libp2p extends EventEmitter {
|
|
|
354
453
|
* @returns {Promise<void>}
|
|
355
454
|
*/
|
|
356
455
|
hangUp(peer: PeerId | Multiaddr | string): Promise<void>;
|
|
456
|
+
/**
|
|
457
|
+
* Sends a request to fetch the value associated with the given key from the given peer.
|
|
458
|
+
*
|
|
459
|
+
* @param {PeerId|Multiaddr} peer
|
|
460
|
+
* @param {string} key
|
|
461
|
+
* @returns {Promise<Uint8Array | null>}
|
|
462
|
+
*/
|
|
463
|
+
fetch(peer: PeerId | Multiaddr, key: string): Promise<Uint8Array | null>;
|
|
357
464
|
/**
|
|
358
465
|
* Pings the given peer in order to obtain the operation latency.
|
|
359
466
|
*
|
|
@@ -367,7 +474,7 @@ declare class Libp2p extends EventEmitter {
|
|
|
367
474
|
*
|
|
368
475
|
* @param {string[]|string} protocols
|
|
369
476
|
*/
|
|
370
|
-
unhandle(protocols: string[] | string): void
|
|
477
|
+
unhandle(protocols: string[] | string): Promise<void>;
|
|
371
478
|
_onStarting(): Promise<void>;
|
|
372
479
|
/**
|
|
373
480
|
* Called when libp2p has started and before it returns
|
|
@@ -393,7 +500,7 @@ declare class Libp2p extends EventEmitter {
|
|
|
393
500
|
private _setupPeerDiscovery;
|
|
394
501
|
}
|
|
395
502
|
declare namespace Libp2p {
|
|
396
|
-
export { Connection, MuxedStream, TransportFactory, MuxerFactory, ContentRoutingModule, PeerDiscoveryFactory, PeerRoutingModule, Crypto, Pubsub, PubsubOptions, Datastore, Protector, PersistentPeerStoreOptions, HandlerProps, DhtOptions, KeychainOptions, PeerStoreOptions, PubsubLocalOptions, MetricsOptions, RelayOptions, Libp2pConfig, Libp2pModules, Libp2pOptions, constructorOptions, CreateOptions };
|
|
503
|
+
export { Connection, MuxedStream, TransportFactory, MuxerFactory, ContentRoutingModule, PeerDiscoveryFactory, PeerRoutingModule, Crypto, Pubsub, PubsubOptions, Datastore, Protector, ConnectionGater, PersistentPeerStoreOptions, HandlerProps, DhtOptions, KeychainOptions, PeerStoreOptions, PubsubLocalOptions, MetricsOptions, RelayOptions, Libp2pConfig, Libp2pModules, Libp2pOptions, constructorOptions, CreateOptions };
|
|
397
504
|
}
|
|
398
505
|
import { EventEmitter } from "events";
|
|
399
506
|
type Libp2pOptions = {
|
|
@@ -403,6 +510,7 @@ type Libp2pOptions = {
|
|
|
403
510
|
modules: Libp2pModules;
|
|
404
511
|
addresses?: AddressManager.AddressManagerOptions | undefined;
|
|
405
512
|
connectionManager?: ConnectionManager.ConnectionManagerOptions | undefined;
|
|
513
|
+
connectionGater?: Partial<import("./types").ConnectionGater> | undefined;
|
|
406
514
|
datastore?: import("interface-datastore").Datastore | undefined;
|
|
407
515
|
dialer?: Dialer.DialerOptions | undefined;
|
|
408
516
|
/**
|
|
@@ -412,7 +520,7 @@ type Libp2pOptions = {
|
|
|
412
520
|
keychain?: (KeychainOptions & Keychain.KeychainOptions) | undefined;
|
|
413
521
|
metrics?: (MetricsOptions & Metrics.MetricsOptions) | undefined;
|
|
414
522
|
peerRouting?: PeerRouting.PeerRoutingOptions | undefined;
|
|
415
|
-
peerStore?:
|
|
523
|
+
peerStore?: PeerStoreOptions | undefined;
|
|
416
524
|
transportManager?: TransportManager.TransportManagerOptions | undefined;
|
|
417
525
|
config?: Libp2pConfig | undefined;
|
|
418
526
|
};
|
|
@@ -421,7 +529,7 @@ type constructorOptions = {
|
|
|
421
529
|
};
|
|
422
530
|
import PeerId = require("peer-id");
|
|
423
531
|
import Metrics = require("./metrics");
|
|
424
|
-
|
|
532
|
+
type ConnectionGater = import('./types').ConnectionGater;
|
|
425
533
|
import AddressManager = require("./address-manager");
|
|
426
534
|
type Libp2pModules = {
|
|
427
535
|
transport: import("libp2p-interfaces/src/transport/types").TransportFactory<any, any>[];
|
|
@@ -468,6 +576,7 @@ import Relay = require("./circuit");
|
|
|
468
576
|
import IdentifyService = require("./identify");
|
|
469
577
|
import PeerRouting = require("./peer-routing");
|
|
470
578
|
import ContentRouting = require("./content-routing");
|
|
579
|
+
import FetchService = require("./fetch");
|
|
471
580
|
import { Multiaddr } from "multiaddr";
|
|
472
581
|
type Connection = import("libp2p-interfaces/src/connection/connection");
|
|
473
582
|
type CreateOptions = {
|
package/dist/src/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.js"],"names":[],"mappings":";AAqCA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.js"],"names":[],"mappings":"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"}
|
|
@@ -45,7 +45,7 @@ declare class Metrics {
|
|
|
45
45
|
* @returns {void}
|
|
46
46
|
*/
|
|
47
47
|
private _onMessage;
|
|
48
|
-
|
|
48
|
+
_systems: Map<any, any>;
|
|
49
49
|
/**
|
|
50
50
|
* Must be called for stats to saved. Any data pushed for tracking
|
|
51
51
|
* will be ignored.
|
|
@@ -69,10 +69,15 @@ declare class Metrics {
|
|
|
69
69
|
*/
|
|
70
70
|
get peers(): string[];
|
|
71
71
|
/**
|
|
72
|
-
* @returns {Map}
|
|
72
|
+
* @returns {Map<string, Map<string, Map<string, any>>>}
|
|
73
73
|
*/
|
|
74
|
-
getComponentMetrics(): Map<
|
|
75
|
-
updateComponentMetric(
|
|
74
|
+
getComponentMetrics(): Map<string, Map<string, Map<string, any>>>;
|
|
75
|
+
updateComponentMetric({ system, component, metric, value }: {
|
|
76
|
+
system?: string | undefined;
|
|
77
|
+
component: any;
|
|
78
|
+
metric: any;
|
|
79
|
+
value: any;
|
|
80
|
+
}): void;
|
|
76
81
|
/**
|
|
77
82
|
* Returns the `Stats` object for the given `PeerId` whether it
|
|
78
83
|
* is a live peer, or in the disconnected peer LRU cache.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/metrics/index.js"],"names":[],"mappings":";AAoBA;;;GAGG;AAEH;;;;;;GAMG;AAEH;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/metrics/index.js"],"names":[],"mappings":";AAoBA;;;GAGG;AAEH;;;;;;GAMG;AAEH;IA4OE;;;;;;;OAOG;IACH,0BAJW,KAAK,SACL,KAAK,GACH,KAAK,CAWjB;IA5PD;;;OAGG;IACH,qBAFW,cAAc,EAWxB;IARC,cAAqD;IACrD,oBAA6D;IAC7D,0BAA2B;IAC3B,8BAA+B;IAC/B,eAA+D;IAC/D,kBAAqB;IAqHvB;;;;;;;;;;;;OAYG;IACH,mBAwBC;IAxJC,wBAAyB;IAG3B;;;OAGG;IACH,cAEC;IAED;;;OAGG;IACH,aASC;IAED;;;;OAIG;IACH,oBAEC;IAED;;;;OAIG;IACH,sBAEC;IAED;;OAEG;IACH,uBAFa,IAAI,MAAM,EAAE,IAAI,MAAM,EAAE,IAAI,MAAM,EAAE,GAAG,CAAC,CAAC,CAAC,CAItD;IAED;;;;;aAcC;IAED;;;;;;OAMG;IACH,gBAHW,MAAM,GACJ,KAAK,CAKjB;IAED;;;;OAIG;IACH,0BAEC;IAED;;;;;OAKG;IACH,sBAHW,MAAM,GACJ,KAAK,CAIjB;IAED;;;;;;OAMG;IACH,2BAFW,MAAM,QAUhB;IAyCD;;;;;;;;OAQG;IACH,+BAJW,MAAM,UACN,MAAM,GACJ,IAAI,CAoBhB;IAED;;;;;;;;;;;;OAYG;IACH;QALwC,MAAM,EAAnC,mBAAmB;QACF,UAAU;QACV,QAAQ;QACvB,mBAAmB,CA2B/B;CAoBF;;;;;cA1QY,OAAO,SAAS,CAAC;2BACjB,OAAO,uCAAuC,EAAE,mBAAmB"}
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
-
declare function _exports<K, V>(
|
|
1
|
+
declare function _exports<K, V>({ system, component, metric, metrics }: {
|
|
2
|
+
system?: string | undefined;
|
|
3
|
+
component: string;
|
|
4
|
+
metric: string;
|
|
5
|
+
metrics?: import(".") | undefined;
|
|
6
|
+
}): Map<K, V>;
|
|
2
7
|
export = _exports;
|
|
3
8
|
//# sourceMappingURL=tracked-map.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tracked-map.d.ts","sourceRoot":"","sources":["../../../src/metrics/tracked-map.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"tracked-map.d.ts","sourceRoot":"","sources":["../../../src/metrics/tracked-map.js"],"names":[],"mappings":"AAkFiB;IANW,MAAM;IACP,SAAS,EAAzB,MAAM;IACU,MAAM,EAAtB,MAAM;IACgB,OAAO;cAcvC"}
|
|
@@ -21,7 +21,7 @@ declare class PeerRouting {
|
|
|
21
21
|
*/
|
|
22
22
|
constructor(libp2p: import('./'));
|
|
23
23
|
_peerId: import("peer-id");
|
|
24
|
-
_peerStore: import("./peer-store");
|
|
24
|
+
_peerStore: import("./peer-store/types").PeerStore;
|
|
25
25
|
/** @type {PeerRoutingModule[]} */
|
|
26
26
|
_routers: PeerRoutingModule[];
|
|
27
27
|
_refreshManagerOptions: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"peer-routing.d.ts","sourceRoot":"","sources":["../../src/peer-routing.js"],"names":[],"mappings":";AA6BA;;;;GAIG;AAEH;;;;;;;;;GASG;AAEH;IACE;;;OAGG;IACH,oBAFW,OAAO,IAAI,CAAC,EAgBtB;IAbC,2BAA4B;IAC5B,
|
|
1
|
+
{"version":3,"file":"peer-routing.d.ts","sourceRoot":"","sources":["../../src/peer-routing.js"],"names":[],"mappings":";AA6BA;;;;GAIG;AAEH;;;;;;;;;GASG;AAEH;IACE;;;OAGG;IACH,oBAFW,OAAO,IAAI,CAAC,EAgBtB;IAbC,2BAA4B;IAC5B,mDAAkC;IAClC,kCAAkC;IAClC,UADW,iBAAiB,EAAE,CACmB;IAOjD;;;;8BAAwE;IAkB1E;;OAEG;IACH,uCAOC;IAvBD;;OAEG;IACH,cAQC;IAHC,gBAEC;IAeH;;OAEG;IACH,aAEC;IAED;;;;;;;OAOG;IACH,aALW,MAAM;;oBAGJ,QAAQ;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,SAAS,EAAE,CAAA;KAAE,CAAC,CA+B5D;IAED;;;;;;;;OAQG;IACH,qBANW,UAAU;;;oBAIR,cAAc;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,SAAS,EAAE,CAAA;KAAE,CAAC,CA2BlE;CACF;;;;yBA7IY,OAAO,0CAA0C,EAAE,WAAW;;;;;;;;;;;;;;;;;;;cAF9D,OAAO,SAAS,CAAC;iBACjB,OAAO,WAAW,EAAE,SAAS"}
|
|
@@ -1,121 +1,67 @@
|
|
|
1
|
-
export =
|
|
1
|
+
export = PeerStoreAddressBook;
|
|
2
2
|
/**
|
|
3
|
-
* @
|
|
3
|
+
* @implements {AddressBook}
|
|
4
4
|
*/
|
|
5
|
-
|
|
6
|
-
* @typedef {Object} Address
|
|
7
|
-
* @property {Multiaddr} multiaddr peer multiaddr.
|
|
8
|
-
* @property {boolean} isCertified obtained from a signed peer record.
|
|
9
|
-
*
|
|
10
|
-
* @typedef {Object} CertifiedRecord
|
|
11
|
-
* @property {Uint8Array} raw raw envelope.
|
|
12
|
-
* @property {number} seqNumber seq counter.
|
|
13
|
-
*
|
|
14
|
-
* @typedef {Object} Entry
|
|
15
|
-
* @property {Address[]} addresses peer Addresses.
|
|
16
|
-
* @property {CertifiedRecord} record certified peer record.
|
|
17
|
-
*/
|
|
18
|
-
/**
|
|
19
|
-
* @extends {Book}
|
|
20
|
-
*/
|
|
21
|
-
declare class AddressBook extends Book {
|
|
5
|
+
declare class PeerStoreAddressBook implements AddressBook {
|
|
22
6
|
/**
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
* @
|
|
26
|
-
* @param {PeerStore} peerStore
|
|
7
|
+
* @param {PeerStore["emit"]} emit
|
|
8
|
+
* @param {import('./types').Store} store
|
|
9
|
+
* @param {(peerId: PeerId, multiaddr: Multiaddr) => Promise<boolean>} addressFilter
|
|
27
10
|
*/
|
|
28
|
-
constructor(
|
|
11
|
+
constructor(emit: PeerStore["emit"], store: import('./types').Store, addressFilter: (peerId: PeerId, multiaddr: Multiaddr) => Promise<boolean>);
|
|
12
|
+
_emit: <U extends keyof import("./types").PeerStoreEvents>(event: U, ...args: Parameters<import("./types").PeerStoreEvents[U]>) => boolean;
|
|
13
|
+
_store: import("./types").Store;
|
|
14
|
+
_addressFilter: (peerId: PeerId, multiaddr: Multiaddr) => Promise<boolean>;
|
|
29
15
|
/**
|
|
30
16
|
* ConsumePeerRecord adds addresses from a signed peer record contained in a record envelope.
|
|
31
17
|
* This will return a boolean that indicates if the record was successfully processed and added
|
|
32
18
|
* into the AddressBook.
|
|
33
19
|
*
|
|
34
20
|
* @param {Envelope} envelope
|
|
35
|
-
* @returns {boolean}
|
|
36
21
|
*/
|
|
37
|
-
consumePeerRecord(envelope: Envelope): boolean
|
|
22
|
+
consumePeerRecord(envelope: Envelope): Promise<boolean>;
|
|
38
23
|
/**
|
|
39
|
-
* Get the raw Envelope for a peer. Returns
|
|
40
|
-
* undefined if no Envelope is found.
|
|
41
|
-
*
|
|
42
24
|
* @param {PeerId} peerId
|
|
43
|
-
* @returns {Uint8Array|undefined}
|
|
44
25
|
*/
|
|
45
|
-
getRawEnvelope(peerId: PeerId): Uint8Array | undefined
|
|
26
|
+
getRawEnvelope(peerId: PeerId): Promise<Uint8Array | undefined>;
|
|
46
27
|
/**
|
|
47
28
|
* Get an Envelope containing a PeerRecord for the given peer.
|
|
48
29
|
* Returns undefined if no record exists.
|
|
49
30
|
*
|
|
50
31
|
* @param {PeerId} peerId
|
|
51
|
-
* @returns {Promise<Envelope|void>|undefined}
|
|
52
32
|
*/
|
|
53
|
-
getPeerRecord(peerId: PeerId): Promise<Envelope |
|
|
33
|
+
getPeerRecord(peerId: PeerId): Promise<Envelope | undefined>;
|
|
34
|
+
/**
|
|
35
|
+
* @param {PeerId} peerId
|
|
36
|
+
*/
|
|
37
|
+
get(peerId: PeerId): Promise<import("./types").Address[]>;
|
|
54
38
|
/**
|
|
55
|
-
* Add known addresses of a provided peer.
|
|
56
|
-
* If the peer is not known, it is set with the given addresses.
|
|
57
|
-
*
|
|
58
39
|
* @param {PeerId} peerId
|
|
59
40
|
* @param {Multiaddr[]} multiaddrs
|
|
60
|
-
* @returns {AddressBook}
|
|
61
41
|
*/
|
|
62
|
-
|
|
42
|
+
set(peerId: PeerId, multiaddrs: Multiaddr[]): Promise<void>;
|
|
63
43
|
/**
|
|
64
|
-
*
|
|
65
|
-
*
|
|
66
|
-
* @private
|
|
44
|
+
* @param {PeerId} peerId
|
|
67
45
|
* @param {Multiaddr[]} multiaddrs
|
|
68
|
-
* @param {boolean} [isCertified]
|
|
69
|
-
* @returns {Address[]}
|
|
70
46
|
*/
|
|
71
|
-
|
|
47
|
+
add(peerId: PeerId, multiaddrs: Multiaddr[]): Promise<void>;
|
|
48
|
+
/**
|
|
49
|
+
* @param {PeerId} peerId
|
|
50
|
+
*/
|
|
51
|
+
delete(peerId: PeerId): Promise<void>;
|
|
72
52
|
/**
|
|
73
|
-
* Get the known multiaddrs for a given peer. All returned multiaddrs
|
|
74
|
-
* will include the encapsulated `PeerId` of the peer.
|
|
75
|
-
* Returns `undefined` if there are no known multiaddrs for the given peer.
|
|
76
|
-
*
|
|
77
53
|
* @param {PeerId} peerId
|
|
78
54
|
* @param {(addresses: Address[]) => Address[]} [addressSorter]
|
|
79
|
-
* @returns {Multiaddr[]|undefined}
|
|
80
55
|
*/
|
|
81
|
-
getMultiaddrsForPeer(peerId: PeerId, addressSorter?: ((addresses: Address[]) => Address[]) | undefined): Multiaddr[]
|
|
56
|
+
getMultiaddrsForPeer(peerId: PeerId, addressSorter?: ((addresses: Address[]) => Address[]) | undefined): Promise<Multiaddr[]>;
|
|
82
57
|
}
|
|
83
|
-
declare namespace
|
|
84
|
-
export { PeerStore, Address,
|
|
58
|
+
declare namespace PeerStoreAddressBook {
|
|
59
|
+
export { PeerStore, Address, AddressBook };
|
|
85
60
|
}
|
|
86
|
-
|
|
61
|
+
type AddressBook = import('./types').AddressBook;
|
|
87
62
|
import Envelope = require("../record/envelope");
|
|
88
63
|
import PeerId = require("peer-id");
|
|
89
64
|
import { Multiaddr } from "multiaddr";
|
|
90
|
-
type PeerStore = import('./');
|
|
91
|
-
type Address =
|
|
92
|
-
/**
|
|
93
|
-
* peer multiaddr.
|
|
94
|
-
*/
|
|
95
|
-
multiaddr: Multiaddr;
|
|
96
|
-
/**
|
|
97
|
-
* obtained from a signed peer record.
|
|
98
|
-
*/
|
|
99
|
-
isCertified: boolean;
|
|
100
|
-
};
|
|
101
|
-
type CertifiedRecord = {
|
|
102
|
-
/**
|
|
103
|
-
* raw envelope.
|
|
104
|
-
*/
|
|
105
|
-
raw: Uint8Array;
|
|
106
|
-
/**
|
|
107
|
-
* seq counter.
|
|
108
|
-
*/
|
|
109
|
-
seqNumber: number;
|
|
110
|
-
};
|
|
111
|
-
type Entry = {
|
|
112
|
-
/**
|
|
113
|
-
* peer Addresses.
|
|
114
|
-
*/
|
|
115
|
-
addresses: Address[];
|
|
116
|
-
/**
|
|
117
|
-
* certified peer record.
|
|
118
|
-
*/
|
|
119
|
-
record: CertifiedRecord;
|
|
120
|
-
};
|
|
65
|
+
type PeerStore = import('./types').PeerStore;
|
|
66
|
+
type Address = import('./types').Address;
|
|
121
67
|
//# sourceMappingURL=address-book.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"address-book.d.ts","sourceRoot":"","sources":["../../../src/peer-store/address-book.js"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"address-book.d.ts","sourceRoot":"","sources":["../../../src/peer-store/address-book.js"],"names":[],"mappings":";AA2BA;;GAEG;AACH;IACE;;;;OAIG;IACH,kBAJW,SAAS,CAAC,MAAM,CAAC,SACjB,OAAO,SAAS,EAAE,KAAK,0BACd,MAAM,aAAa,SAAS,KAAK,QAAQ,OAAO,CAAC,EAMpE;IAHC,2IAAiB;IACjB,gCAAmB;IACnB,yBALkB,MAAM,aAAa,SAAS,KAAK,QAAQ,OAAO,CAAC,CAKhC;IAGrC;;;;;;OAMG;IACH,4BAFW,QAAQ,oBA+DlB;IAED;;OAEG;IACH,uBAFW,MAAM,mCAmBhB;IAED;;;;;OAKG;IACH,sBAFW,MAAM,iCAUhB;IAED;;OAEG;IACH,YAFW,MAAM,wCA0BhB;IAED;;;OAGG;IACH,YAHW,MAAM,cACN,SAAS,EAAE,iBA2DrB;IAED;;;OAGG;IACH,YAHW,MAAM,cACN,SAAS,EAAE,iBA0DrB;IAED;;OAEG;IACH,eAFW,MAAM,iBA4BhB;IAED;;;OAGG;IACH,6BAHW,MAAM,+BACM,OAAO,EAAE,KAAK,OAAO,EAAE,qCAe7C;CACF;;;;mBA/UY,OAAO,SAAS,EAAE,WAAW;;;;iBAF7B,OAAO,SAAS,EAAE,SAAS;eAC3B,OAAO,SAAS,EAAE,OAAO"}
|
|
@@ -1,124 +1,58 @@
|
|
|
1
|
-
export =
|
|
1
|
+
export = DefaultPeerStore;
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* @extends {EventEmitter}
|
|
3
|
+
* An implementation of PeerStore that stores data in a Datastore
|
|
7
4
|
*
|
|
8
|
-
* @
|
|
9
|
-
* @fires PeerStore#change:protocols Emitted when a known peer supports a different set of protocols.
|
|
10
|
-
* @fires PeerStore#change:multiaddrs Emitted when a known peer has a different set of multiaddrs.
|
|
11
|
-
* @fires PeerStore#change:pubkey Emitted emitted when a peer's public key is known.
|
|
12
|
-
* @fires PeerStore#change:metadata Emitted when the known metadata of a peer change.
|
|
5
|
+
* @implements {PeerStore}
|
|
13
6
|
*/
|
|
14
|
-
declare class
|
|
15
|
-
/**
|
|
16
|
-
* Peer object
|
|
17
|
-
*
|
|
18
|
-
* @typedef {Object} Peer
|
|
19
|
-
* @property {PeerId} id peer's peer-id instance.
|
|
20
|
-
* @property {Address[]} addresses peer's addresses containing its multiaddrs and metadata.
|
|
21
|
-
* @property {string[]} protocols peer's supported protocols.
|
|
22
|
-
* @property {Map<string, Uint8Array>|undefined} metadata peer's metadata map.
|
|
23
|
-
*/
|
|
7
|
+
declare class DefaultPeerStore extends EventEmitter implements PeerStore {
|
|
24
8
|
/**
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
* @param {
|
|
28
|
-
* @param {PeerId}
|
|
29
|
-
* @class
|
|
9
|
+
* @param {object} properties
|
|
10
|
+
* @param {PeerId} properties.peerId
|
|
11
|
+
* @param {import('interface-datastore').Datastore} properties.datastore
|
|
12
|
+
* @param {(peerId: PeerId, multiaddr: Multiaddr) => Promise<boolean>} properties.addressFilter
|
|
30
13
|
*/
|
|
31
|
-
constructor({ peerId }: {
|
|
14
|
+
constructor({ peerId, datastore, addressFilter }: {
|
|
32
15
|
peerId: PeerId;
|
|
16
|
+
datastore: import('interface-datastore').Datastore;
|
|
17
|
+
addressFilter: (peerId: PeerId, multiaddr: Multiaddr) => Promise<boolean>;
|
|
33
18
|
});
|
|
34
|
-
_peerId:
|
|
35
|
-
|
|
36
|
-
* AddressBook containing a map of peerIdStr to Address.
|
|
37
|
-
*/
|
|
19
|
+
_peerId: import("peer-id");
|
|
20
|
+
_store: Store;
|
|
38
21
|
addressBook: AddressBook;
|
|
39
|
-
/**
|
|
40
|
-
* KeyBook containing a map of peerIdStr to their PeerId with public keys.
|
|
41
|
-
*/
|
|
42
22
|
keyBook: KeyBook;
|
|
43
|
-
/**
|
|
44
|
-
* MetadataBook containing a map of peerIdStr to their metadata Map.
|
|
45
|
-
*/
|
|
46
23
|
metadataBook: MetadataBook;
|
|
47
|
-
/**
|
|
48
|
-
* ProtoBook containing a map of peerIdStr to supported protocols.
|
|
49
|
-
*/
|
|
50
24
|
protoBook: ProtoBook;
|
|
25
|
+
getPeers(): AsyncGenerator<import("./types").Peer, void, unknown>;
|
|
51
26
|
/**
|
|
52
|
-
*
|
|
53
|
-
*/
|
|
54
|
-
start(): void;
|
|
55
|
-
/**
|
|
56
|
-
* Stop the PeerStore.
|
|
57
|
-
*/
|
|
58
|
-
stop(): void;
|
|
59
|
-
/**
|
|
60
|
-
* Get all the stored information of every peer known.
|
|
27
|
+
* Delete the information of the given peer in every book
|
|
61
28
|
*
|
|
62
|
-
* @
|
|
29
|
+
* @param {PeerId} peerId
|
|
63
30
|
*/
|
|
64
|
-
|
|
65
|
-
/**
|
|
66
|
-
* peer's peer-id instance.
|
|
67
|
-
*/
|
|
68
|
-
id: PeerId;
|
|
69
|
-
/**
|
|
70
|
-
* peer's addresses containing its multiaddrs and metadata.
|
|
71
|
-
*/
|
|
72
|
-
addresses: Address[];
|
|
73
|
-
/**
|
|
74
|
-
* peer's supported protocols.
|
|
75
|
-
*/
|
|
76
|
-
protocols: string[];
|
|
77
|
-
/**
|
|
78
|
-
* peer's metadata map.
|
|
79
|
-
*/
|
|
80
|
-
metadata: Map<string, Uint8Array> | undefined;
|
|
81
|
-
}>;
|
|
31
|
+
delete(peerId: PeerId): Promise<void>;
|
|
82
32
|
/**
|
|
83
|
-
*
|
|
33
|
+
* Get the stored information of a given peer
|
|
84
34
|
*
|
|
85
35
|
* @param {PeerId} peerId
|
|
86
|
-
* @returns {boolean} true if found and removed
|
|
87
36
|
*/
|
|
88
|
-
|
|
37
|
+
get(peerId: PeerId): Promise<import("./types").Peer>;
|
|
89
38
|
/**
|
|
90
|
-
*
|
|
39
|
+
* Returns true if we have a record of the peer
|
|
91
40
|
*
|
|
92
41
|
* @param {PeerId} peerId
|
|
93
|
-
* @returns {Peer|undefined}
|
|
94
42
|
*/
|
|
95
|
-
|
|
96
|
-
/**
|
|
97
|
-
* peer's peer-id instance.
|
|
98
|
-
*/
|
|
99
|
-
id: PeerId;
|
|
100
|
-
/**
|
|
101
|
-
* peer's addresses containing its multiaddrs and metadata.
|
|
102
|
-
*/
|
|
103
|
-
addresses: Address[];
|
|
104
|
-
/**
|
|
105
|
-
* peer's supported protocols.
|
|
106
|
-
*/
|
|
107
|
-
protocols: string[];
|
|
108
|
-
/**
|
|
109
|
-
* peer's metadata map.
|
|
110
|
-
*/
|
|
111
|
-
metadata: Map<string, Uint8Array> | undefined;
|
|
112
|
-
} | undefined;
|
|
43
|
+
has(peerId: PeerId): Promise<boolean>;
|
|
113
44
|
}
|
|
114
|
-
declare namespace
|
|
115
|
-
export {
|
|
45
|
+
declare namespace DefaultPeerStore {
|
|
46
|
+
export { PeerStore, Peer, PeerId, Multiaddr };
|
|
116
47
|
}
|
|
48
|
+
type PeerStore = import('./types').PeerStore;
|
|
117
49
|
import { EventEmitter } from "events";
|
|
118
|
-
import
|
|
50
|
+
import Store = require("./store");
|
|
119
51
|
import AddressBook = require("./address-book");
|
|
120
52
|
import KeyBook = require("./key-book");
|
|
121
53
|
import MetadataBook = require("./metadata-book");
|
|
122
54
|
import ProtoBook = require("./proto-book");
|
|
123
|
-
type
|
|
55
|
+
type PeerId = import('peer-id');
|
|
56
|
+
type Multiaddr = import('multiaddr').Multiaddr;
|
|
57
|
+
type Peer = import('./types').Peer;
|
|
124
58
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/peer-store/index.js"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/peer-store/index.js"],"names":[],"mappings":";AAqBA;;;;GAIG;AACH;IACE;;;;;OAKG;IACH;gBAJW,MAAM;mBACN,OAAO,qBAAqB,EAAE,SAAS;gCAC9B,MAAM,aAAa,SAAS,KAAK,QAAQ,OAAO,CAAC;OAYpE;IAPC,2BAAqB;IACrB,cAAkC;IAElC,yBAAoF;IACpF,iBAA6D;IAC7D,2BAAuE;IACvE,qBAAiE;IAGnE,kEAkBC;IAED;;;;OAIG;IACH,eAFW,MAAM,iBAahB;IAED;;;;OAIG;IACH,YAFW,MAAM,mCAahB;IAED;;;;OAIG;IACH,YAFW,MAAM,oBAahB;CACF;;;;iBA3GY,OAAO,SAAS,EAAE,SAAS;;;;;;;cAE3B,OAAO,SAAS,CAAC;iBACjB,OAAO,WAAW,EAAE,SAAS;YAF7B,OAAO,SAAS,EAAE,IAAI"}
|