chore: add post install

This commit is contained in:
Vasco Santos 2020-12-02 16:56:43 +01:00
parent a24fafd570
commit d2f8b51d44
99 changed files with 1632 additions and 1 deletions

1
.gitignore vendored
View File

@ -5,7 +5,6 @@
.nyc_output
build
dist
docs
# Dependency directory

1
dist/index.min.js vendored Normal file
View File

@ -0,0 +1 @@
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.Libp2pInterfaces=t():e.Libp2pInterfaces=t()}(self,(function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=0)}([function(e,t,n){e.exports=n(1)},function(e,t,n){}])}));

233
dist/src/connection/connection.d.ts vendored Normal file
View File

@ -0,0 +1,233 @@
export = Connection;
/**
* @typedef {import('../stream-muxer/types').MuxedStream} MuxedStream
* @typedef {import('./status').Status} Status
*/
/**
* @typedef {Object} Timeline
* @property {number} open - connection opening timestamp.
* @property {number} [upgraded] - connection upgraded timestamp.
* @property {number} [close]
*
* @typedef {Object} ConectionStat
* @property {string} direction - connection establishment direction ("inbound" or "outbound").
* @property {Timeline} timeline - connection relevant events timestamp.
* @property {string} [multiplexer] - connection multiplexing identifier.
* @property {string} [encryption] - connection encryption method identifier.
*
* @typedef {Object} ConnectionOptions
* @property {multiaddr} [localAddr] - local multiaddr of the connection if known.
* @property {multiaddr} remoteAddr - remote multiaddr of the connection.
* @property {PeerId} localPeer - local peer-id.
* @property {PeerId} remotePeer - remote peer-id.
* @property {(protocols: string|string[]) => Promise<{stream: MuxedStream, protocol: string}>} newStream - new stream muxer function.
* @property {() => Promise<void>} close - close raw connection function.
* @property {() => MuxedStream[]} getStreams - get streams from muxer function.
* @property {ConectionStat} stat - metadata of the connection.
*
* @typedef {Object} StreamData
* @property {string} protocol - the protocol used by the stream
* @property {Object} [metadata] - metadata of the stream
*/
/**
* An implementation of the js-libp2p connection.
* Any libp2p transport should use an upgrader to return this connection.
*/
declare class Connection {
/**
* Checks if the given value is a `Connection` instance.
*
* @param {any} other
* @returns {other is Connection}
*/
static isConnection(other: any): other is Connection;
/**
* An implementation of the js-libp2p connection.
* Any libp2p transport should use an upgrader to return this connection.
*
* @class
* @param {ConnectionOptions} options
*/
constructor({ localAddr, remoteAddr, localPeer, remotePeer, newStream, close, getStreams, stat }: ConnectionOptions);
/**
* Connection identifier.
*/
id: string;
/**
* Observed multiaddr of the local peer
*/
localAddr: import("multiaddr") | undefined;
/**
* Observed multiaddr of the remote peer
*/
remoteAddr: import("multiaddr");
/**
* Local peer id.
*/
localPeer: import("peer-id");
/**
* Remote peer id.
*/
remotePeer: import("peer-id");
/**
* Connection metadata.
*
* @type {ConectionStat & {status: Status}}
*/
_stat: ConectionStat & {
status: Status;
};
/**
* Reference to the new stream function of the multiplexer
*/
_newStream: (protocols: string | string[]) => Promise<{
stream: MuxedStream;
protocol: string;
}>;
/**
* Reference to the close function of the raw connection
*/
_close: () => Promise<void>;
/**
* Reference to the getStreams function of the muxer
*/
_getStreams: () => MuxedStream[];
/**
* Connection streams registry
*/
registry: Map<any, any>;
/**
* User provided tags
*
* @type {string[]}
*/
tags: string[];
get [Symbol.toStringTag](): string;
/**
* Get connection metadata
*
* @this {Connection}
*/
get stat(): ConectionStat & {
status: Status;
};
/**
* Get all the streams of the muxer.
*
* @this {Connection}
*/
get streams(): import("../stream-muxer/types").MuxedStream[];
/**
* Create a new stream from this connection
*
* @param {string|string[]} protocols - intended protocol for the stream
* @returns {Promise<{stream: MuxedStream, protocol: string}>} with muxed+multistream-selected stream and selected protocol
*/
newStream(protocols: string | string[]): Promise<{
stream: MuxedStream;
protocol: string;
}>;
/**
* Add a stream when it is opened to the registry.
*
* @param {MuxedStream} muxedStream - a muxed stream
* @param {StreamData} data - the stream data to be registered
* @returns {void}
*/
addStream(muxedStream: MuxedStream, { protocol, metadata }: StreamData): void;
/**
* Remove stream registry after it is closed.
*
* @param {string} id - identifier of the stream
*/
removeStream(id: string): void;
/**
* Close the connection.
*
* @returns {Promise<void>}
*/
close(): Promise<void>;
_closing: void | undefined;
}
declare namespace Connection {
export { MuxedStream, Status, Timeline, ConectionStat, ConnectionOptions, StreamData };
}
type ConectionStat = {
/**
* - connection establishment direction ("inbound" or "outbound").
*/
direction: string;
/**
* - connection relevant events timestamp.
*/
timeline: Timeline;
/**
* - connection multiplexing identifier.
*/
multiplexer?: string | undefined;
/**
* - connection encryption method identifier.
*/
encryption?: string | undefined;
};
type Status = "open" | "closing" | "closed";
type MuxedStream = import("../stream-muxer/types").MuxedStream;
type StreamData = {
/**
* - the protocol used by the stream
*/
protocol: string;
/**
* - metadata of the stream
*/
metadata?: any;
};
type ConnectionOptions = {
/**
* - local multiaddr of the connection if known.
*/
localAddr?: import("multiaddr") | undefined;
/**
* - remote multiaddr of the connection.
*/
remoteAddr: import("multiaddr");
/**
* - local peer-id.
*/
localPeer: import("peer-id");
/**
* - remote peer-id.
*/
remotePeer: import("peer-id");
/**
* - new stream muxer function.
*/
newStream: (protocols: string | string[]) => Promise<{
stream: MuxedStream;
protocol: string;
}>;
/**
* - close raw connection function.
*/
close: () => Promise<void>;
/**
* - get streams from muxer function.
*/
getStreams: () => MuxedStream[];
/**
* - metadata of the connection.
*/
stat: ConectionStat;
};
type Timeline = {
/**
* - connection opening timestamp.
*/
open: number;
/**
* - connection upgraded timestamp.
*/
upgraded?: number | undefined;
close?: number | undefined;
};
//# sourceMappingURL=connection.d.ts.map

View File

@ -0,0 +1 @@
{"version":3,"file":"connection.d.ts","sourceRoot":"","sources":["../../../src/connection/connection.js"],"names":[],"mappings":";AASA;;;GAGG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH;;;GAGG;AACH;IAkFE;;;;;OAKG;IACH,2BAHW,GAAG,uBAKb;IAzFD;;;;;;OAMG;IACH,kGAFW,iBAAiB,EAkE3B;IA7DC;;OAEG;IACH,WAA2E;IAE3E;;OAEG;IACH,2CAA0B;IAE1B;;OAEG;IACH,gCAA4B;IAE5B;;OAEG;IACH,6BAA0B;IAE1B;;OAEG;IACH,8BAA4B;IAE5B;;;;OAIG;IACH,OAFU,aAAa,GAAG;QAAC,QAAQ,MAAM,CAAA;KAAC,CAKzC;IAED;;OAEG;IACH,wBA/DsB,MAAM,GAAC,MAAM,EAAE,KAAK,QAAQ;QAAC,MAAM,EAAE,WAAW,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAC,CAAC,CA+D/D;IAE3B;;OAEG;IACH,cAnEgB,QAAQ,IAAI,CAAC,CAmEV;IAEnB;;OAEG;IACH,mBAvEgB,WAAW,EAAE,CAuEA;IAE7B;;OAEG;IACH,wBAAyB;IAEzB;;;;OAIG;IACH,MAFU,MAAM,EAAE,CAEJ;IAGhB,mCAEC;IAgBD;;;;OAIG;IACH;gBA1DqC,MAAM;MA4D1C;IAED;;;;OAIG;IACH,6DAEC;IAED;;;;;OAKG;IACH,qBAHW,MAAM,GAAC,MAAM,EAAE;gBACI,WAAW;kBAAY,MAAM;OAqB1D;IAED;;;;;;OAMG;IACH,uBAJW,WAAW,0BACX,UAAU,GACR,IAAI,CAQhB;IAED;;;;OAIG;IACH,iBAFW,MAAM,QAIhB;IAED;;;;OAIG;IACH,SAFa,QAAQ,IAAI,CAAC,CAkBzB;IAJC,2BAAmC;CAKtC;;;;;;;;eA/Ma,MAAM;;;;cACN,QAAQ;;;;;;;;;;;;;;;;cAeR,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;2BANM,MAAM,GAAC,MAAM,EAAE,KAAK,QAAQ;QAAC,MAAM,EAAE,WAAW,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAC,CAAC;;;;WAChF,MAAM,QAAQ,IAAI,CAAC;;;;gBACnB,MAAM,WAAW,EAAE;;;;UACnB,aAAa;;;;;;UAlBb,MAAM"}

2
dist/src/connection/index.d.ts vendored Normal file
View File

@ -0,0 +1,2 @@
export var Connection: typeof import("./connection");
//# sourceMappingURL=index.d.ts.map

1
dist/src/connection/index.d.ts.map vendored Normal file
View File

@ -0,0 +1 @@
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/connection/index.js"],"names":[],"mappings":""}

2
dist/src/connection/status.d.ts vendored Normal file
View File

@ -0,0 +1,2 @@
export type Status = "open" | "closing" | "closed";
//# sourceMappingURL=status.d.ts.map

1
dist/src/connection/status.d.ts.map vendored Normal file
View File

@ -0,0 +1 @@
{"version":3,"file":"status.d.ts","sourceRoot":"","sources":["../../../src/connection/status.js"],"names":[],"mappings":""}

View File

@ -0,0 +1,3 @@
declare function _exports(test: any): void;
export = _exports;
//# sourceMappingURL=connection.d.ts.map

View File

@ -0,0 +1 @@
{"version":3,"file":"connection.d.ts","sourceRoot":"","sources":["../../../../src/connection/tests/connection.js"],"names":[],"mappings":"AAUiB,2CA4KhB"}

3
dist/src/connection/tests/index.d.ts vendored Normal file
View File

@ -0,0 +1,3 @@
declare function _exports(test: any): void;
export = _exports;
//# sourceMappingURL=index.d.ts.map

View File

@ -0,0 +1 @@
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/connection/tests/index.js"],"names":[],"mappings":"AAMiB,2CAEhB"}

1
dist/src/content-routing/types.d.ts vendored Normal file
View File

@ -0,0 +1 @@
//# sourceMappingURL=types.d.ts.map

View File

@ -0,0 +1 @@
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/content-routing/types.ts"],"names":[],"mappings":""}

16
dist/src/crypto/errors.d.ts vendored Normal file
View File

@ -0,0 +1,16 @@
export class UnexpectedPeerError extends Error {
static get code(): string;
constructor(message?: string);
code: string;
}
export class InvalidCryptoExchangeError extends Error {
static get code(): string;
constructor(message?: string);
code: string;
}
export class InvalidCryptoTransmissionError extends Error {
static get code(): string;
constructor(message?: string);
code: string;
}
//# sourceMappingURL=errors.d.ts.map

1
dist/src/crypto/errors.d.ts.map vendored Normal file
View File

@ -0,0 +1 @@
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../src/crypto/errors.js"],"names":[],"mappings":"AAEA;IAME,0BAEC;IAPD,8BAGC;IADC,aAAoC;CAMvC;AAED;IAME,0BAEC;IAPD,8BAGC;IADC,aAA2C;CAM9C;AAED;IAME,0BAEC;IAPD,8BAGC;IADC,aAA+C;CAMlD"}

3
dist/src/crypto/tests/index.d.ts vendored Normal file
View File

@ -0,0 +1,3 @@
declare function _exports(common: any): void;
export = _exports;
//# sourceMappingURL=index.d.ts.map

1
dist/src/crypto/tests/index.d.ts.map vendored Normal file
View File

@ -0,0 +1 @@
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/crypto/tests/index.js"],"names":[],"mappings":"AAgBiB,6CAwFhB"}

24
dist/src/crypto/types.d.ts vendored Normal file
View File

@ -0,0 +1,24 @@
/// <reference types="node" />
import PeerId from 'peer-id';
import { MultiaddrConnection } from '../transport/types';
/**
* A libp2p crypto module must be compliant to this interface
* to ensure all exchanged data between two peers is encrypted.
*/
export interface Crypto {
protocol: string;
/**
* Encrypt outgoing data to the remote party.
*/
secureOutbound(localPeer: PeerId, connection: MultiaddrConnection, remotePeer: PeerId): Promise<SecureOutbound>;
/**
* Decrypt incoming data.
*/
secureInbound(localPeer: PeerId, connection: MultiaddrConnection, remotePeer?: PeerId): Promise<SecureOutbound>;
}
export declare type SecureOutbound = {
conn: MultiaddrConnection;
remoteEarlyData: Buffer;
remotePeer: PeerId;
};
//# sourceMappingURL=types.d.ts.map

1
dist/src/crypto/types.d.ts.map vendored Normal file
View File

@ -0,0 +1 @@
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/crypto/types.ts"],"names":[],"mappings":";AAAA,OAAO,MAAM,MAAM,SAAS,CAAA;AAC5B,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAA;AAExD;;;GAGG;AACH,MAAM,WAAW,MAAM;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,cAAc,CAAC,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,mBAAmB,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;IAChH;;OAEG;IACH,aAAa,CAAC,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,mBAAmB,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;CACjH;AAED,oBAAY,cAAc,GAAG;IAC3B,IAAI,EAAE,mBAAmB,CAAC;IAC1B,eAAe,EAAE,MAAM,CAAC;IACxB,UAAU,EAAE,MAAM,CAAC;CACpB,CAAA"}

1
dist/src/index.d.ts vendored Normal file
View File

@ -0,0 +1 @@
//# sourceMappingURL=index.d.ts.map

1
dist/src/index.d.ts.map vendored Normal file
View File

@ -0,0 +1 @@
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.js"],"names":[],"mappings":""}

View File

@ -0,0 +1,3 @@
declare function _exports(common: any): void;
export = _exports;
//# sourceMappingURL=index.d.ts.map

View File

@ -0,0 +1 @@
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/peer-discovery/tests/index.js"],"names":[],"mappings":"AAaiB,6CA8EhB"}

12
dist/src/pubsub/errors.d.ts vendored Normal file
View File

@ -0,0 +1,12 @@
export namespace codes {
const ERR_INVALID_SIGNATURE_POLICY: string;
const ERR_UNHANDLED_SIGNATURE_POLICY: string;
const ERR_MISSING_SIGNATURE: string;
const ERR_MISSING_SEQNO: string;
const ERR_INVALID_SIGNATURE: string;
const ERR_UNEXPECTED_FROM: string;
const ERR_UNEXPECTED_SIGNATURE: string;
const ERR_UNEXPECTED_KEY: string;
const ERR_UNEXPECTED_SEQNO: string;
}
//# sourceMappingURL=errors.d.ts.map

1
dist/src/pubsub/errors.d.ts.map vendored Normal file
View File

@ -0,0 +1 @@
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../src/pubsub/errors.js"],"names":[],"mappings":""}

355
dist/src/pubsub/index.d.ts vendored Normal file
View File

@ -0,0 +1,355 @@
/// <reference types="node" />
export = PubsubBaseProtocol;
declare const PubsubBaseProtocol_base: typeof import("events").EventEmitter;
/**
* @typedef {any} Libp2p
* @typedef {import('peer-id')} PeerId
* @typedef {import('bl')} BufferList
* @typedef {import('../stream-muxer/types').MuxedStream} MuxedStream
* @typedef {import('../connection/connection')} Connection
* @typedef {import('./message').RPC} RPC
* @typedef {import('./message').SubOpts} RPCSubOpts
* @typedef {import('./message').Message} RPCMessage
* @typedef {import('./signature-policy').SignaturePolicyType} SignaturePolicyType
*/
/**
* @typedef {Object} InMessage
* @property {string} [from]
* @property {string} receivedFrom
* @property {string[]} topicIDs
* @property {Uint8Array} [seqno]
* @property {Uint8Array} data
* @property {Uint8Array} [signature]
* @property {Uint8Array} [key]
*/
/**
* PubsubBaseProtocol handles the peers and connections logic for pubsub routers
* and specifies the API that pubsub routers should have.
*/
declare class PubsubBaseProtocol extends PubsubBaseProtocol_base {
/**
* @param {Object} props
* @param {string} props.debugName - log namespace
* @param {Array<string>|string} props.multicodecs - protocol identificers to connect
* @param {Libp2p} props.libp2p
* @param {SignaturePolicyType} [props.globalSignaturePolicy = SignaturePolicy.StrictSign] - defines how signatures should be handled
* @param {boolean} [props.canRelayMessage = false] - if can relay messages not subscribed
* @param {boolean} [props.emitSelf = false] - if publish should emit to self, if subscribed
* @abstract
*/
constructor({ debugName, multicodecs, libp2p, globalSignaturePolicy, canRelayMessage, emitSelf }: {
debugName: string;
multicodecs: Array<string> | string;
libp2p: Libp2p;
globalSignaturePolicy: "StrictSign" | "StrictNoSign" | undefined;
canRelayMessage: boolean | undefined;
emitSelf: boolean | undefined;
});
log: any;
/**
* @type {Array<string>}
*/
multicodecs: Array<string>;
_libp2p: any;
registrar: any;
/**
* @type {PeerId}
*/
peerId: PeerId;
started: boolean;
/**
* Map of topics to which peers are subscribed to
*
* @type {Map<string, Set<string>>}
*/
topics: Map<string, Set<string>>;
/**
* List of our subscriptions
*
* @type {Set<string>}
*/
subscriptions: Set<string>;
/**
* Map of peer streams
*
* @type {Map<string, import('./peer-streams')>}
*/
peers: Map<string, import('./peer-streams')>;
/**
* The signature policy to follow by default
*
* @type {string}
*/
globalSignaturePolicy: string;
/**
* If router can relay received messages, even if not subscribed
*
* @type {boolean}
*/
canRelayMessage: boolean;
/**
* if publish should emit to self, if subscribed
*
* @type {boolean}
*/
emitSelf: boolean;
/**
* Topic validator function
*
* @typedef {function(string, InMessage): Promise<void>} validator
*/
/**
* Topic validator map
*
* Keyed by topic
* Topic validators are functions with the following input:
*
* @type {Map<string, validator>}
*/
topicValidators: Map<string, (arg0: string, arg1: InMessage) => Promise<void>>;
_registrarId: any;
/**
* On an inbound stream opened.
*
* @protected
* @param {Object} props
* @param {string} props.protocol
* @param {MuxedStream} props.stream
* @param {Connection} props.connection - connection
*/
protected _onIncomingStream({ protocol, stream, connection }: {
protocol: string;
stream: MuxedStream;
connection: Connection;
}): void;
/**
* Registrar notifies an established connection with pubsub protocol.
*
* @protected
* @param {PeerId} peerId - remote peer-id
* @param {Connection} conn - connection to the peer
*/
protected _onPeerConnected(peerId: PeerId, conn: Connection): Promise<void>;
/**
* Registrar notifies a closing connection with pubsub protocol.
*
* @protected
* @param {PeerId} peerId - peerId
* @param {Error} [err] - error for connection end
*/
protected _onPeerDisconnected(peerId: PeerId, err?: Error | undefined): void;
/**
* Register the pubsub protocol onto the libp2p node.
*
* @returns {void}
*/
start(): void;
/**
* Unregister the pubsub protocol and the streams with other peers will be closed.
*
* @returns {void}
*/
stop(): void;
/**
* Notifies the router that a peer has been connected
*
* @protected
* @param {PeerId} peerId
* @param {string} protocol
* @returns {PeerStreams}
*/
protected _addPeer(peerId: PeerId, protocol: string): import("./peer-streams");
/**
* Notifies the router that a peer has been disconnected.
*
* @protected
* @param {PeerId} peerId
* @returns {PeerStreams | undefined}
*/
protected _removePeer(peerId: PeerId): import("./peer-streams") | undefined;
/**
* Responsible for processing each RPC message received by other peers.
*
* @param {string} idB58Str - peer id string in base58
* @param {AsyncIterable<Uint8Array|BufferList>} stream - inbound stream
* @param {PeerStreams} peerStreams - PubSub peer
* @returns {Promise<void>}
*/
_processMessages(idB58Str: string, stream: AsyncIterable<Uint8Array | BufferList>, peerStreams: import("./peer-streams")): Promise<void>;
/**
* Handles an rpc request from a peer
*
* @param {string} idB58Str
* @param {PeerStreams} peerStreams
* @param {RPC} rpc
* @returns {boolean}
*/
_processRpc(idB58Str: string, peerStreams: import("./peer-streams"), rpc: RPC): boolean;
/**
* Handles a subscription change from a peer
*
* @param {string} id
* @param {RPCSubOpts} subOpt
*/
_processRpcSubOpt(id: string, subOpt: RPCSubOpts): void;
/**
* Handles an message from a peer
*
* @param {InMessage} msg
* @returns {Promise<void>}
*/
_processRpcMessage(msg: InMessage): Promise<void>;
/**
* Emit a message from a peer
*
* @param {InMessage} message
*/
_emitMessage(message: InMessage): void;
/**
* The default msgID implementation
* Child class can override this.
*
* @param {RPCMessage} msg - the message object
* @returns {Uint8Array} message id as bytes
*/
getMsgId(msg: RPCMessage): Uint8Array;
/**
* Whether to accept a message from a peer
* Override to create a graylist
*
* @override
* @param {string} id
* @returns {boolean}
*/
_acceptFrom(id: string): boolean;
/**
* Decode Uint8Array into an RPC object.
* This can be override to use a custom router protobuf.
*
* @param {Uint8Array} bytes
* @returns {RPC}
*/
_decodeRpc(bytes: Uint8Array): RPC;
/**
* Encode RPC object into a Uint8Array.
* This can be override to use a custom router protobuf.
*
* @param {RPC} rpc
* @returns {Uint8Array}
*/
_encodeRpc(rpc: RPC): Uint8Array;
/**
* Send an rpc object to a peer
*
* @param {string} id - peer id
* @param {RPC} rpc
* @returns {void}
*/
_sendRpc(id: string, rpc: RPC): void;
/**
* Send subscroptions to a peer
*
* @param {string} id - peer id
* @param {string[]} topics
* @param {boolean} subscribe - set to false for unsubscriptions
* @returns {void}
*/
_sendSubscriptions(id: string, topics: string[], subscribe: boolean): void;
/**
* Validates the given message. The signature will be checked for authenticity.
* Throws an error on invalid messages
*
* @param {InMessage} message
* @returns {Promise<void>}
*/
validate(message: InMessage): Promise<void>;
/**
* Normalizes the message and signs it, if signing is enabled.
* Should be used by the routers to create the message to send.
*
* @protected
* @param {RPCMessage} message
* @returns {Promise<RPCMessage>}
*/
protected _buildMessage(message: RPCMessage): Promise<RPCMessage>;
/**
* Get a list of the peer-ids that are subscribed to one topic.
*
* @param {string} topic
* @returns {Array<string>}
*/
getSubscribers(topic: string): Array<string>;
/**
* Publishes messages to all subscribed peers
*
* @override
* @param {string} topic
* @param {Buffer} message
* @returns {Promise<void>}
*/
publish(topic: string, message: Buffer): Promise<void>;
/**
* Overriding the implementation of publish should handle the appropriate algorithms for the publish/subscriber implementation.
* For example, a Floodsub implementation might simply publish each message to each topic for every peer
*
* @abstract
* @param {InMessage} message
* @returns {Promise<void>}
*
*/
_publish(message: InMessage): Promise<void>;
/**
* Subscribes to a given topic.
*
* @abstract
* @param {string} topic
* @returns {void}
*/
subscribe(topic: string): void;
/**
* Unsubscribe from the given topic.
*
* @override
* @param {string} topic
* @returns {void}
*/
unsubscribe(topic: string): void;
/**
* Get the list of topics which the peer is subscribed to.
*
* @override
* @returns {Array<string>}
*/
getTopics(): Array<string>;
}
declare namespace PubsubBaseProtocol {
export { message, utils, SignaturePolicy, Libp2p, PeerId, BufferList, MuxedStream, Connection, RPC, RPCSubOpts, RPCMessage, SignaturePolicyType, InMessage };
}
type PeerId = import("peer-id");
type InMessage = {
from?: string | undefined;
receivedFrom: string;
topicIDs: string[];
seqno?: Uint8Array | undefined;
data: Uint8Array;
signature?: Uint8Array | undefined;
key?: Uint8Array | undefined;
};
type MuxedStream = import("../stream-muxer/types").MuxedStream;
type Connection = import("../connection/connection");
type BufferList = import("bl");
type RPC = any;
type RPCSubOpts = any;
type RPCMessage = any;
type Libp2p = any;
/**
* @type {typeof import('./message')}
*/
declare const message: typeof import('./message');
declare const utils: typeof import("./utils");
declare const SignaturePolicy: {
StrictSign: "StrictSign";
StrictNoSign: "StrictNoSign";
};
type SignaturePolicyType = "StrictSign" | "StrictNoSign";
//# sourceMappingURL=index.d.ts.map

1
dist/src/pubsub/index.d.ts.map vendored Normal file
View File

@ -0,0 +1 @@
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/pubsub/index.js"],"names":[],"mappings":";;;AAuBA;;;;;;;;;;GAUG;AAEH;;;;;;;;;GASG;AAEH;;;GAGG;AACH;IACE;;;;;;;;;OASG;IACH;QARyB,SAAS,EAAvB,MAAM;QACsB,WAAW,EAAvC,MAAM,MAAM,CAAC,GAAC,MAAM;QACN,MAAM,EAApB,MAAM;QACsB,qBAAqB;QACjC,eAAe;QACf,QAAQ;OA2GlC;IAlFC,SAA2B;IAG3B;;OAEG;IACH,aAFU,MAAM,MAAM,CAAC,CAE0B;IACjD,aAAqB;IACrB,eAAiC;IACjC;;OAEG;IACH,QAFU,MAAM,CAEW;IAE3B,iBAAoB;IAEpB;;;;OAIG;IACH,QAFU,IAAI,MAAM,EAAE,IAAI,MAAM,CAAC,CAAC,CAEX;IAEvB;;;;OAIG;IACH,eAFU,IAAI,MAAM,CAAC,CAES;IAE9B;;;;OAIG;IACH,OAFU,IAAI,MAAM,EAAE,OAAO,gBAAgB,CAAC,CAAC,CAEzB;IAOtB;;;;OAIG;IACH,uBAFU,MAAM,CAEkC;IAElD;;;;OAIG;IACH,iBAFU,OAAO,CAEqB;IAEtC;;;;OAIG;IACH,UAFU,OAAO,CAEO;IAExB;;;;OAIG;IACH;;;;;;;OAOG;IACH,oCAVsB,MAAM,sBAAc,QAAQ,IAAI,CAAC,EAUvB;IAEhC,kBAA6B;IA4D/B;;;;;;;;OAQG;IACH;kBAJW,MAAM;gBACN,WAAW;oBACX,UAAU;aASpB;IAED;;;;;;OAMG;IACH,mCAHW,MAAM,QACN,UAAU,iBAgBpB;IAED;;;;;;OAMG;IACH,sCAHW,MAAM,iCAQhB;IAzGD;;;;OAIG;IACH,SAFa,IAAI,CAyBhB;IAED;;;;OAIG;IACH,QAFa,IAAI,CAiBhB;IAyDD;;;;;;;OAOG;IACH,2BAJW,MAAM,YACN,MAAM,4BAwBhB;IAED;;;;;;OAMG;IACH,8BAHW,MAAM,GACJ,2BAAc,SAAS,CAsBnC;IAID;;;;;;;OAOG;IACH,2BALW,MAAM,UACN,cAAc,UAAU,GAAC,UAAU,CAAC,0CAElC,QAAQ,IAAI,CAAC,CAkBzB;IAED;;;;;;;OAOG;IACH,sBALW,MAAM,8CAEN,GAAG,GACD,OAAO,CA6BnB;IAED;;;;;OAKG;IACH,sBAHW,MAAM,UACN,UAAU,QAkBpB;IAED;;;;;OAKG;IACH,wBAHW,SAAS,GACP,QAAQ,IAAI,CAAC,CAmBzB;IAED;;;;OAIG;IACH,uCAMC;IAED;;;;;;OAMG;IACH,cAHW,UAAU,GACR,UAAU,CAYtB;IAED;;;;;;;OAOG;IACH,gBAHW,MAAM,GACJ,OAAO,CAInB;IAED;;;;;;OAMG;IACH,kBAHW,UAAU,GACR,GAAG,CAIf;IAED;;;;;;OAMG;IACH,gBAHW,GAAG,GACD,UAAU,CAItB;IAED;;;;;;OAMG;IACH,aAJW,MAAM,OACN,GAAG,GACD,IAAI,CAWhB;IAED;;;;;;;OAOG;IACH,uBALW,MAAM,UACN,MAAM,EAAE,aACR,OAAO,GACL,IAAI,CAMhB;IAED;;;;;;OAMG;IACH,kBAHW,SAAS,GACP,QAAQ,IAAI,CAAC,CAwCzB;IAED;;;;;;;OAOG;IACH,iCAHW,UAAU,GACR,QAAQ,UAAU,CAAC,CAc/B;IAID;;;;;OAKG;IACH,sBAHW,MAAM,GACJ,MAAM,MAAM,CAAC,CAgBzB;IAED;;;;;;;OAOG;IACH,eAJW,MAAM,WACN,MAAM,GACJ,QAAQ,IAAI,CAAC,CAyBzB;IAED;;;;;;;;OAQG;IACH,kBAJW,SAAS,GACP,QAAQ,IAAI,CAAC,CAKzB;IAED;;;;;;OAMG;IACH,iBAHW,MAAM,GACJ,IAAI,CAWhB;IAED;;;;;;OAMG;IACH,mBAHW,MAAM,GACJ,IAAI,CAWhB;IAED;;;;;OAKG;IACH,aAFa,MAAM,MAAM,CAAC,CAQzB;CACF;;;;;;;kBA1rBa,MAAM;cACN,MAAM,EAAE;;UAER,UAAU;;;;;;;;;;;AA/BxB;;GAEG;AACH,uBAFU,cAAc,WAAW,CAAC,CAEA;AAGpC,8CAAgC"}

6
dist/src/pubsub/message/index.d.ts vendored Normal file
View File

@ -0,0 +1,6 @@
export var rpc: any;
export var td: any;
export var RPC: any;
export var Message: any;
export var SubOpts: any;
//# sourceMappingURL=index.d.ts.map

View File

@ -0,0 +1 @@
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/pubsub/message/index.js"],"names":[],"mappings":""}

View File

@ -0,0 +1,3 @@
declare const _exports: string;
export = _exports;
//# sourceMappingURL=rpc.proto.d.ts.map

View File

@ -0,0 +1 @@
{"version":3,"file":"rpc.proto.d.ts","sourceRoot":"","sources":["../../../../src/pubsub/message/rpc.proto.js"],"names":[],"mappings":""}

35
dist/src/pubsub/message/sign.d.ts vendored Normal file
View File

@ -0,0 +1,35 @@
export type InMessage = {
from?: string | undefined;
receivedFrom: string;
topicIDs: string[];
seqno?: Uint8Array | undefined;
data: Uint8Array;
signature?: Uint8Array | undefined;
key?: Uint8Array | undefined;
};
export type PublicKey = import("libp2p-crypto").PublicKey;
/**
* Returns the PublicKey associated with the given message.
* If no, valid PublicKey can be retrieved an error will be returned.
*
* @param {InMessage} message
* @returns {Promise<PublicKey>}
*/
export function messagePublicKey(message: InMessage): Promise<PublicKey>;
/**
* Signs the provided message with the given `peerId`
*
* @param {PeerId} peerId
* @param {Message} message
* @returns {Promise<Message>}
*/
export function signMessage(peerId: import("peer-id"), message: any): Promise<any>;
export const SignPrefix: any;
/**
* Verifies the signature of the given message
*
* @param {InMessage} message
* @returns {Promise<boolean>}
*/
export function verifySignature(message: InMessage): Promise<boolean>;
//# sourceMappingURL=sign.d.ts.map

1
dist/src/pubsub/message/sign.d.ts.map vendored Normal file
View File

@ -0,0 +1 @@
{"version":3,"file":"sign.d.ts","sourceRoot":"","sources":["../../../../src/pubsub/message/sign.js"],"names":[],"mappings":";;;;;;;;;;AA4DA;;;;;;GAMG;AACH,0CAHW,SAAS,GACP,QAAQ,SAAS,CAAC,CAsB9B;AA/ED;;;;;;GAMG;AACH,sEAFa,YAAgB,CAgB5B;AAvBD,6BAAyD;AAyBzD;;;;;GAKG;AACH,yCAHW,SAAS,GACP,QAAQ,OAAO,CAAC,CAuB5B"}

View File

@ -0,0 +1,3 @@
declare const _exports: string;
export = _exports;
//# sourceMappingURL=topic-descriptor.proto.d.ts.map

View File

@ -0,0 +1 @@
{"version":3,"file":"topic-descriptor.proto.d.ts","sourceRoot":"","sources":["../../../../src/pubsub/message/topic-descriptor.proto.js"],"names":[],"mappings":""}

112
dist/src/pubsub/peer-streams.d.ts vendored Normal file
View File

@ -0,0 +1,112 @@
/// <reference types="node" />
export = PeerStreams;
declare const PeerStreams_base: typeof import("events").EventEmitter;
/**
* @typedef {import('../stream-muxer/types').MuxedStream} MuxedStream
* @typedef {import('peer-id')} PeerId
* @typedef {import('it-pushable').Pushable<Uint8Array>} PushableStream
*/
/**
* Thin wrapper around a peer's inbound / outbound pubsub streams
*/
declare class PeerStreams extends PeerStreams_base {
/**
* @param {object} properties - properties of the PeerStreams.
* @param {PeerId} properties.id
* @param {string} properties.protocol
*/
constructor({ id, protocol }: {
id: PeerId;
protocol: string;
});
/**
* @type {import('peer-id')}
*/
id: import('peer-id');
/**
* Established protocol
*
* @type {string}
*/
protocol: string;
/**
* The raw outbound stream, as retrieved from conn.newStream
*
* @private
* @type {null|MuxedStream}
*/
private _rawOutboundStream;
/**
* The raw inbound stream, as retrieved from the callback from libp2p.handle
*
* @private
* @type {null|MuxedStream}
*/
private _rawInboundStream;
/**
* An AbortController for controlled shutdown of the inbound stream
*
* @private
* @type {AbortController}
*/
private _inboundAbortController;
/**
* Write stream -- its preferable to use the write method
*
* @type {null|PushableStream}
*/
outboundStream: null | import("it-pushable").Pushable<Uint8Array>;
/**
* Read stream
*
* @type {null| AsyncIterable<Uint8Array>}
*/
inboundStream: null | AsyncIterable<Uint8Array>;
/**
* Do we have a connection to read from?
*
* @type {boolean}
*/
get isReadable(): boolean;
/**
* Do we have a connection to write on?
*
* @type {boolean}
*/
get isWritable(): boolean;
/**
* Send a message to this peer.
* Throws if there is no `stream` to write to available.
*
* @param {Uint8Array} data
* @returns {void}
*/
write(data: Uint8Array): void;
/**
* Attach a raw inbound stream and setup a read stream
*
* @param {MuxedStream} stream
* @returns {AsyncIterable<Uint8Array>}
*/
attachInboundStream(stream: MuxedStream): AsyncIterable<Uint8Array>;
/**
* Attach a raw outbound stream and setup a write stream
*
* @param {MuxedStream} stream
* @returns {Promise<void>}
*/
attachOutboundStream(stream: MuxedStream): Promise<void>;
/**
* Closes the open connection to peer
*
* @returns {void}
*/
close(): void;
}
declare namespace PeerStreams {
export { MuxedStream, PeerId, PushableStream };
}
type MuxedStream = import("../stream-muxer/types").MuxedStream;
type PeerId = import("peer-id");
type PushableStream = import("it-pushable").Pushable<Uint8Array>;
//# sourceMappingURL=peer-streams.d.ts.map

1
dist/src/pubsub/peer-streams.d.ts.map vendored Normal file
View File

@ -0,0 +1 @@
{"version":3,"file":"peer-streams.d.ts","sourceRoot":"","sources":["../../../src/pubsub/peer-streams.js"],"names":[],"mappings":";;;AAiBA;;;;GAIG;AAEH;;GAEG;AACH;IACE;;;;OAIG;IACH;QAH8B,EAAE,EAArB,MAAM;QACa,QAAQ,EAA3B,MAAM;OAgDhB;IA3CC;;OAEG;IACH,IAFU,OAAO,SAAS,CAAC,CAEf;IACZ;;;;OAIG;IACH,UAFU,MAAM,CAEQ;IACxB;;;;;OAKG;IACH,2BAA8B;IAC9B;;;;;OAKG;IACH,0BAA6B;IAC7B;;;;;OAKG;IACH,gCAAoD;IACpD;;;;OAIG;IACH,gBAFU,IAAI,6CAAe,CAEH;IAC1B;;;;OAIG;IACH,eAFU,IAAI,GAAE,cAAc,UAAU,CAAC,CAEhB;IAG3B;;;;OAIG;IACH,0BAEC;IAED;;;;OAIG;IACH,0BAEC;IAED;;;;;;OAMG;IACH,YAHW,UAAU,GACR,IAAI,CAShB;IAED;;;;;OAKG;IACH,4BAHW,WAAW,GACT,cAAc,UAAU,CAAC,CAmBrC;IAED;;;;;OAKG;IACH,6BAHW,WAAW,GACT,QAAQ,IAAI,CAAC,CAmCzB;IAED;;;;OAIG;IACH,SAFa,IAAI,CAiBhB;CACF"}

6
dist/src/pubsub/signature-policy.d.ts vendored Normal file
View File

@ -0,0 +1,6 @@
export namespace SignaturePolicy {
const StrictSign: 'StrictSign';
const StrictNoSign: 'StrictNoSign';
}
export type SignaturePolicyType = "StrictSign" | "StrictNoSign";
//# sourceMappingURL=signature-policy.d.ts.map

View File

@ -0,0 +1 @@
{"version":3,"file":"signature-policy.d.ts","sourceRoot":"","sources":["../../../src/pubsub/signature-policy.js"],"names":[],"mappings":";sBAeyB,YAAY;wBAWV,cAAc"}

3
dist/src/pubsub/tests/api.d.ts vendored Normal file
View File

@ -0,0 +1,3 @@
declare function _exports(common: any): void;
export = _exports;
//# sourceMappingURL=api.d.ts.map

1
dist/src/pubsub/tests/api.d.ts.map vendored Normal file
View File

@ -0,0 +1 @@
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../../../src/pubsub/tests/api.js"],"names":[],"mappings":"AAciB,6CA8EhB"}

3
dist/src/pubsub/tests/emit-self.d.ts vendored Normal file
View File

@ -0,0 +1,3 @@
declare function _exports(common: any): void;
export = _exports;
//# sourceMappingURL=emit-self.d.ts.map

View File

@ -0,0 +1 @@
{"version":3,"file":"emit-self.d.ts","sourceRoot":"","sources":["../../../../src/pubsub/tests/emit-self.js"],"names":[],"mappings":"AAaiB,6CAuDhB"}

3
dist/src/pubsub/tests/index.d.ts vendored Normal file
View File

@ -0,0 +1,3 @@
declare function _exports(common: any): void;
export = _exports;
//# sourceMappingURL=index.d.ts.map

1
dist/src/pubsub/tests/index.d.ts.map vendored Normal file
View File

@ -0,0 +1 @@
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/pubsub/tests/index.js"],"names":[],"mappings":"AASiB,6CAQhB"}

3
dist/src/pubsub/tests/messages.d.ts vendored Normal file
View File

@ -0,0 +1,3 @@
declare function _exports(common: any): void;
export = _exports;
//# sourceMappingURL=messages.d.ts.map

View File

@ -0,0 +1 @@
{"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["../../../../src/pubsub/tests/messages.js"],"names":[],"mappings":"AAiBiB,6CAiGhB"}

View File

@ -0,0 +1,3 @@
declare function _exports(common: any): void;
export = _exports;
//# sourceMappingURL=multiple-nodes.d.ts.map

View File

@ -0,0 +1 @@
{"version":3,"file":"multiple-nodes.d.ts","sourceRoot":"","sources":["../../../../src/pubsub/tests/multiple-nodes.js"],"names":[],"mappings":"AAgBiB,6CAmUhB"}

3
dist/src/pubsub/tests/two-nodes.d.ts vendored Normal file
View File

@ -0,0 +1,3 @@
declare function _exports(common: any): void;
export = _exports;
//# sourceMappingURL=two-nodes.d.ts.map

View File

@ -0,0 +1 @@
{"version":3,"file":"two-nodes.d.ts","sourceRoot":"","sources":["../../../../src/pubsub/tests/two-nodes.js"],"names":[],"mappings":"AAwBiB,6CA2MhB"}

3
dist/src/pubsub/tests/utils.d.ts vendored Normal file
View File

@ -0,0 +1,3 @@
export function first(map: any): any;
export function expectSet(set: any, subs: any): void;
//# sourceMappingURL=utils.d.ts.map

1
dist/src/pubsub/tests/utils.d.ts.map vendored Normal file
View File

@ -0,0 +1 @@
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../src/pubsub/tests/utils.js"],"names":[],"mappings":"AAIgB,qCAAkC;AAE9B,qDAEnB"}

22
dist/src/pubsub/utils.d.ts vendored Normal file
View File

@ -0,0 +1,22 @@
export function randomSeqno(): Uint8Array;
export function msgId(from: string, seqno: Uint8Array): Uint8Array;
export function noSignMsgId(data: Uint8Array): Uint8Array;
export function anyMatch(a: Set<any> | any[], b: Set<any> | any[]): boolean;
export function ensureArray<T>(maybeArray: T | T[]): T[];
export function normalizeInRpcMessage<T extends {
from?: any;
}>(message: T & {
from?: string | undefined;
receivedFrom: string;
}, peerId?: string | undefined): T & {
from?: string | undefined;
peerId?: string | undefined;
};
export function normalizeOutRpcMessage<T extends {
from?: any;
data?: any;
}>(message: T): T & {
from?: Uint8Array | undefined;
data?: Uint8Array | undefined;
};
//# sourceMappingURL=utils.d.ts.map

1
dist/src/pubsub/utils.d.ts.map vendored Normal file
View File

@ -0,0 +1 @@
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/pubsub/utils.js"],"names":[],"mappings":"AAesB,+BAHT,UAAU,CAKtB;AAUe,4BALL,MAAM,SACN,UAAU,GACR,UAAU,CAStB;AASqB,kCAJX,UAAU,GACR,UAAU,CAG2C;AAW/C,4BALR,gBAAS,KACT,gBAAS,GACP,OAAO,CAkBnB;AAUqB,yDAMrB;AAU+B;WALX,GAAG;;;kBACmB,MAAM;;;;EAahD;AAQgC;WALZ,GAAG;WAAQ,GAAG;;;;EAclC"}

3
dist/src/record/tests/index.d.ts vendored Normal file
View File

@ -0,0 +1,3 @@
declare function _exports(test: any): void;
export = _exports;
//# sourceMappingURL=index.d.ts.map

1
dist/src/record/tests/index.d.ts.map vendored Normal file
View File

@ -0,0 +1 @@
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/record/tests/index.js"],"names":[],"mappings":"AAQiB,2CA0BhB"}

22
dist/src/record/types.d.ts vendored Normal file
View File

@ -0,0 +1,22 @@
/**
* Record is the base implementation of a record that can be used as the payload of a libp2p envelope.
*/
export interface Record {
/**
* signature domain.
*/
domain: string;
/**
* identifier of the type of record
*/
codec: Uint8Array;
/**
* Marshal a record to be used in an envelope.
*/
marshal(): Uint8Array;
/**
* Verifies if the other provided Record is identical to this one.
*/
equals(other: unknown): boolean;
}
//# sourceMappingURL=types.d.ts.map

1
dist/src/record/types.d.ts.map vendored Normal file
View File

@ -0,0 +1 @@
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/record/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,MAAM;IACrB;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,KAAK,EAAE,UAAU,CAAC;IAClB;;OAEG;IACH,OAAO,IAAI,UAAU,CAAC;IACtB;;OAEG;IACH,MAAM,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAAA;CAChC"}

View File

@ -0,0 +1,3 @@
declare function _exports(common: any): void;
export = _exports;
//# sourceMappingURL=base-test.d.ts.map

View File

@ -0,0 +1 @@
{"version":3,"file":"base-test.d.ts","sourceRoot":"","sources":["../../../../src/stream-muxer/tests/base-test.js"],"names":[],"mappings":"AAiCiB,6CAwHhB"}

View File

@ -0,0 +1,3 @@
declare function _exports(common: any): void;
export = _exports;
//# sourceMappingURL=close-test.d.ts.map

View File

@ -0,0 +1 @@
{"version":3,"file":"close-test.d.ts","sourceRoot":"","sources":["../../../../src/stream-muxer/tests/close-test.js"],"names":[],"mappings":"AAgCiB,6CAsFhB"}

View File

@ -0,0 +1,3 @@
declare function _exports(common: any): void;
export = _exports;
//# sourceMappingURL=index.d.ts.map

View File

@ -0,0 +1 @@
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/stream-muxer/tests/index.js"],"names":[],"mappings":"AAQiB,6CAUhB"}

View File

@ -0,0 +1,3 @@
declare function _exports(common: any): void;
export = _exports;
//# sourceMappingURL=mega-stress-test.d.ts.map

View File

@ -0,0 +1 @@
{"version":3,"file":"mega-stress-test.d.ts","sourceRoot":"","sources":["../../../../src/stream-muxer/tests/mega-stress-test.js"],"names":[],"mappings":"AAKiB,6CAWhB"}

View File

@ -0,0 +1,3 @@
declare function _exports(Muxer: any, nStreams: any, nMsg: any, limit: any): Promise<void>;
export = _exports;
//# sourceMappingURL=spawner.d.ts.map

View File

@ -0,0 +1 @@
{"version":3,"file":"spawner.d.ts","sourceRoot":"","sources":["../../../../src/stream-muxer/tests/spawner.js"],"names":[],"mappings":"AASiB,2FAoDhB"}

View File

@ -0,0 +1,3 @@
declare function _exports(common: any): void;
export = _exports;
//# sourceMappingURL=stress-test.d.ts.map

View File

@ -0,0 +1 @@
{"version":3,"file":"stress-test.d.ts","sourceRoot":"","sources":["../../../../src/stream-muxer/tests/stress-test.js"],"names":[],"mappings":"AAKiB,6CAwBhB"}

44
dist/src/stream-muxer/types.d.ts vendored Normal file
View File

@ -0,0 +1,44 @@
import BufferList from 'bl';
export interface MuxerFactory {
new (options: MuxerOptions): Muxer;
multicodec: string;
}
/**
* A libp2p stream muxer
*/
export interface Muxer {
readonly streams: Array<MuxedStream>;
/**
* Initiate a new stream with the given name. If no name is
* provided, the id of th stream will be used.
*/
newStream(name?: string): MuxedStream;
/**
* A function called when receiving a new stream from the remote.
*/
onStream(stream: MuxedStream): void;
/**
* A function called when a stream ends.
*/
onStreamEnd(stream: MuxedStream): void;
}
export declare type MuxerOptions = {
onStream: (stream: MuxedStream) => void;
onStreamEnd: (stream: MuxedStream) => void;
maxMsgSize?: number;
};
export declare type MuxedTimeline = {
open: number;
close?: number;
};
export interface MuxedStream extends AsyncIterable<Uint8Array | BufferList> {
close: () => void;
abort: () => void;
reset: () => void;
sink: Sink;
source: () => AsyncIterable<Uint8Array | BufferList>;
timeline: MuxedTimeline;
id: string;
}
export declare type Sink = (source: Uint8Array) => Promise<Uint8Array>;
//# sourceMappingURL=types.d.ts.map

1
dist/src/stream-muxer/types.d.ts.map vendored Normal file
View File

@ -0,0 +1 @@
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/stream-muxer/types.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,IAAI,CAAA;AAE3B,MAAM,WAAW,YAAY;IAC3B,KAAK,OAAO,EAAE,YAAY,GAAG,KAAK,CAAC;IACnC,UAAU,EAAE,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,KAAK;IACpB,QAAQ,CAAC,OAAO,EAAE,KAAK,CAAC,WAAW,CAAC,CAAC;IACrC;;;OAGG;IACH,SAAS,CAAE,IAAI,CAAC,EAAE,MAAM,GAAG,WAAW,CAAC;IAEvC;;OAEG;IACH,QAAQ,CAAE,MAAM,EAAE,WAAW,GAAG,IAAI,CAAC;IAErC;;OAEG;IACH,WAAW,CAAE,MAAM,EAAE,WAAW,GAAG,IAAI,CAAC;CACzC;AAED,oBAAY,YAAY,GAAG;IACzB,QAAQ,EAAE,CAAC,MAAM,EAAE,WAAW,KAAK,IAAI,CAAC;IACxC,WAAW,EAAE,CAAC,MAAM,EAAE,WAAW,KAAK,IAAI,CAAC;IAC3C,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAAA;AAED,oBAAY,aAAa,GAAG;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAA;AAED,MAAM,WAAW,WAAY,SAAQ,aAAa,CAAC,UAAU,GAAG,UAAU,CAAC;IACzE,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB,IAAI,EAAE,IAAI,CAAC;IACX,MAAM,EAAE,MAAM,aAAa,CAAC,UAAU,GAAG,UAAU,CAAC,CAAC;IACrD,QAAQ,EAAE,aAAa,CAAC;IACxB,EAAE,EAAE,MAAM,CAAC;CACZ;AAED,oBAAY,IAAI,GAAG,CAAC,MAAM,EAAE,UAAU,KAAK,OAAO,CAAC,UAAU,CAAC,CAAC"}

76
dist/src/topology/index.d.ts vendored Normal file
View File

@ -0,0 +1,76 @@
export = Topology;
/**
* @typedef {import('peer-id')} PeerId
*/
/**
* @typedef {Object} Options
* @property {number} [min=0] - minimum needed connections.
* @property {number} [max=Infinity] - maximum needed connections.
* @property {Handlers} [handlers]
*
* @typedef {Object} Handlers
* @property {(peerId: PeerId, conn: Connection) => void} [onConnect] - protocol "onConnect" handler
* @property {(peerId: PeerId, error?:Error) => void} [onDisconnect] - protocol "onDisconnect" handler
*
* @typedef {import('../connection/connection')} Connection
*/
declare class Topology {
/**
* Checks if the given value is a Topology instance.
*
* @param {any} other
* @returns {other is Topology}
*/
static isTopology(other: any): other is Topology;
/**
* @param {Options} options
*/
constructor({ min, max, handlers }: Options);
min: number;
max: number;
_onConnect: (peerId: PeerId, conn: Connection) => void;
_onDisconnect: (peerId: PeerId, error?: Error | undefined) => void;
/**
* Set of peers that support the protocol.
*
* @type {Set<string>}
*/
peers: Set<string>;
get [Symbol.toStringTag](): string;
set registrar(arg: any);
_registrar: any;
/**
* Notify about peer disconnected event.
*
* @param {PeerId} peerId
* @returns {void}
*/
disconnect(peerId: PeerId): void;
}
declare namespace Topology {
export { PeerId, Options, Handlers, Connection };
}
type PeerId = import("peer-id");
type Connection = import("../connection/connection");
type Options = {
/**
* - minimum needed connections.
*/
min?: number | undefined;
/**
* - maximum needed connections.
*/
max?: number | undefined;
handlers?: Handlers | undefined;
};
type Handlers = {
/**
* - protocol "onConnect" handler
*/
onConnect?: ((peerId: PeerId, conn: Connection) => void) | undefined;
/**
* - protocol "onDisconnect" handler
*/
onDisconnect?: ((peerId: PeerId, error?: Error | undefined) => void) | undefined;
};
//# sourceMappingURL=index.d.ts.map

1
dist/src/topology/index.d.ts.map vendored Normal file
View File

@ -0,0 +1 @@
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/topology/index.js"],"names":[],"mappings":";AAKA;;GAEG;AAEH;;;;;;;;;;;GAWG;AAEH;IAgCE;;;;;OAKG;IACH,yBAHW,GAAG,qBAKb;IAvCD;;OAEG;IACH,oCAFW,OAAO,EAoBjB;IAbC,YAAc;IACd,YAAc;IAGd,qBAnBmB,MAAM,QAAQ,UAAU,KAAK,IAAI,CAmBR;IAC5C,wBAnBmB,MAAM,gCAAmB,IAAI,CAmBE;IAElD;;;;OAIG;IACH,OAFU,IAAI,MAAM,CAAC,CAEC;IAGxB,mCAEC;IAgBD,wBAEC;IADC,gBAA2B;IAG7B;;;;;OAKG;IACH,mBAHW,MAAM,GACJ,IAAI,CAIhB;CACF;;;;;;;;;;;;;;;;;;;;;0BA7DsB,MAAM,QAAQ,UAAU,KAAK,IAAI;;;;6BACjC,MAAM,gCAAmB,IAAI"}

View File

@ -0,0 +1,80 @@
export = MulticodecTopology;
declare const MulticodecTopology_base: typeof import(".");
declare class MulticodecTopology extends MulticodecTopology_base {
/**
* Checks if the given value is a `MulticodecTopology` instance.
*
* @param {any} other
* @returns {other is MulticodecTopology}
*/
static isMulticodecTopology(other: any): other is MulticodecTopology;
/**
* @param {TopologyOptions & MulticodecOptions} props
*/
constructor({ min, max, multicodecs, handlers }: TopologyOptions & MulticodecOptions);
multicodecs: string[];
/**
* Check if a new peer support the multicodecs for this topology.
*
* @param {Object} props
* @param {PeerId} props.peerId
* @param {Array<string>} props.protocols
*/
_onProtocolChange({ peerId, protocols }: {
peerId: PeerId;
protocols: Array<string>;
}): void;
/**
* Verify if a new connected peer has a topology multicodec and call _onConnect.
*
* @param {Connection} connection
* @returns {void}
*/
_onPeerConnect(connection: Connection): void;
/**
* Update topology.
*
* @param {Array<{id: PeerId, multiaddrs: Array<Multiaddr>, protocols: Array<string>}>} peerDataIterable
* @returns {void}
*/
_updatePeers(peerDataIterable: Array<{
id: PeerId;
multiaddrs: Array<Multiaddr>;
protocols: Array<string>;
}>): void;
}
declare namespace MulticodecTopology {
export { PeerId, Multiaddr, Connection, TopologyOptions, MulticodecOptions, Handlers };
}
type PeerId = import("peer-id");
type Connection = import("../connection/connection");
type Multiaddr = import("multiaddr");
type TopologyOptions = {
/**
* - minimum needed connections.
*/
min?: number | undefined;
/**
* - maximum needed connections.
*/
max?: number | undefined;
handlers?: import(".").Handlers | undefined;
};
type MulticodecOptions = {
/**
* - protocol multicodecs
*/
multicodecs: string[];
handlers: Required<Handlers>;
};
type Handlers = {
/**
* - protocol "onConnect" handler
*/
onConnect?: ((peerId: import("peer-id"), conn: import("../connection/connection")) => void) | undefined;
/**
* - protocol "onDisconnect" handler
*/
onDisconnect?: ((peerId: import("peer-id"), error?: Error | undefined) => void) | undefined;
};
//# sourceMappingURL=multicodec-topology.d.ts.map

View File

@ -0,0 +1 @@
{"version":3,"file":"multicodec-topology.d.ts","sourceRoot":"","sources":["../../../src/topology/multicodec-topology.js"],"names":[],"mappings":";;AAKA;IA2CE;;;;;OAKG;IACH,mCAHW,GAAG,+BAKb;IAlDD;;OAEG;IACH,iDAFW,eAAe,GAAG,iBAAiB,EA+B7C;IALC,sBAA2E;IAuD7E;;;;;;OAMG;IACH;QAHyB,MAAM,EAApB,MAAM;QACe,SAAS,EAA9B,MAAM,MAAM,CAAC;aAmBvB;IAED;;;;;OAKG;IACH,2BAHW,UAAU,GACR,IAAI,CAehB;IAlED;;;;;OAKG;IACH,+BAHW,MAAM;QAAC,EAAE,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,SAAS,CAAC,CAAC;QAAC,SAAS,EAAE,MAAM,MAAM,CAAC,CAAA;KAAC,CAAC,GACzE,IAAI,CAehB;CAgDF;;;;;;;;;;;;;;;;;;;;;;iBAQa,MAAM,EAAE;cACR,SAAS,QAAQ,CAAC"}

View File

@ -0,0 +1,3 @@
declare function _exports(test: any): void;
export = _exports;
//# sourceMappingURL=multicodec-topology.d.ts.map

View File

@ -0,0 +1 @@
{"version":3,"file":"multicodec-topology.d.ts","sourceRoot":"","sources":["../../../../src/topology/tests/multicodec-topology.js"],"names":[],"mappings":"AAaiB,2CAuHhB"}

3
dist/src/topology/tests/topology.d.ts vendored Normal file
View File

@ -0,0 +1,3 @@
declare function _exports(test: any): void;
export = _exports;
//# sourceMappingURL=topology.d.ts.map

View File

@ -0,0 +1 @@
{"version":3,"file":"topology.d.ts","sourceRoot":"","sources":["../../../../src/topology/tests/topology.js"],"names":[],"mappings":"AAYiB,2CA+BhB"}

7
dist/src/transport/errors.d.ts vendored Normal file
View File

@ -0,0 +1,7 @@
export class AbortError extends Error {
static get code(): string;
static get type(): string;
code: string;
type: string;
}
//# sourceMappingURL=errors.d.ts.map

1
dist/src/transport/errors.d.ts.map vendored Normal file
View File

@ -0,0 +1 @@
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../src/transport/errors.js"],"names":[],"mappings":"AAEA;IAOE,0BAEC;IAED,0BAEC;IAVC,aAA2B;IAC3B,aAA2B;CAU9B"}

View File

@ -0,0 +1,3 @@
declare function _exports(common: any): void;
export = _exports;
//# sourceMappingURL=dial-test.d.ts.map

View File

@ -0,0 +1 @@
{"version":3,"file":"dial-test.d.ts","sourceRoot":"","sources":["../../../../src/transport/tests/dial-test.js"],"names":[],"mappings":"AAgBiB,6CA0LhB"}

View File

@ -0,0 +1,3 @@
declare function _exports(common: any): void;
export = _exports;
//# sourceMappingURL=filter-test.d.ts.map

View File

@ -0,0 +1 @@
{"version":3,"file":"filter-test.d.ts","sourceRoot":"","sources":["../../../../src/transport/tests/filter-test.js"],"names":[],"mappings":"AAQiB,6CA4BhB"}

3
dist/src/transport/tests/index.d.ts vendored Normal file
View File

@ -0,0 +1,3 @@
declare function _exports(common: any): void;
export = _exports;
//# sourceMappingURL=index.d.ts.map

View File

@ -0,0 +1 @@
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/transport/tests/index.js"],"names":[],"mappings":"AAOiB,6CAMhB"}

View File

@ -0,0 +1,3 @@
declare function _exports(common: any): void;
export = _exports;
//# sourceMappingURL=listen-test.d.ts.map

View File

@ -0,0 +1 @@
{"version":3,"file":"listen-test.d.ts","sourceRoot":"","sources":["../../../../src/transport/tests/listen-test.js"],"names":[],"mappings":"AAeiB,6CAmJhB"}

View File

@ -0,0 +1,2 @@
export function isValidTick(date: number, ms?: number): boolean;
//# sourceMappingURL=index.d.ts.map

View File

@ -0,0 +1 @@
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/transport/tests/utils/index.js"],"names":[],"mappings":"AAWe,gEAIZ"}

70
dist/src/transport/types.d.ts vendored Normal file
View File

@ -0,0 +1,70 @@
/// <reference types="node" />
import events from 'events';
import Multiaddr from 'multiaddr';
import Connection from '../connection/connection';
import { Sink } from '../stream-muxer/types';
export interface TransportFactory<DialOptions extends {
signal?: AbortSignal;
}, ListenerOptions> {
new (upgrader: Upgrader): Transport<DialOptions, ListenerOptions>;
}
/**
* A libp2p transport is understood as something that offers a dial and listen interface to establish connections.
*/
export interface Transport<DialOptions extends {
signal?: AbortSignal;
}, ListenerOptions> {
/**
* Dial a given multiaddr.
*/
dial(ma: Multiaddr, options?: DialOptions): Promise<Connection>;
/**
* Create transport listeners.
*/
createListener(options: ListenerOptions, handler?: (connection: Connection) => void): Listener;
/**
* Takes a list of `Multiaddr`s and returns only valid addresses for the transport
*/
filter(multiaddrs: Multiaddr[]): Multiaddr[];
}
export interface Listener extends events.EventEmitter {
/**
* Start a listener
*/
listen(multiaddr: Multiaddr): Promise<void>;
/**
* Get listen addresses
*/
getAddrs(): Multiaddr[];
/**
* Close listener
*
* @returns {Promise<void>}
*/
close(): Promise<void>;
}
export interface Upgrader {
/**
* Upgrades an outbound connection on `transport.dial`.
*/
upgradeOutbound(maConn: MultiaddrConnection): Promise<Connection>;
/**
* Upgrades an inbound connection on transport listener.
*/
upgradeInbound(maConn: MultiaddrConnection): Promise<Connection>;
}
export declare type MultiaddrConnectionTimeline = {
open: number;
upgraded?: number;
close?: number;
};
export declare type MultiaddrConnection = {
sink: Sink;
source: () => AsyncIterable<Uint8Array>;
close: (err?: Error) => Promise<void>;
conn: unknown;
remoteAddr: Multiaddr;
localAddr?: Multiaddr;
timeline: MultiaddrConnectionTimeline;
};
//# sourceMappingURL=types.d.ts.map

1
dist/src/transport/types.d.ts.map vendored Normal file
View File

@ -0,0 +1 @@
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/transport/types.ts"],"names":[],"mappings":";AAAA,OAAO,MAAM,MAAM,QAAQ,CAAA;AAC3B,OAAO,SAAS,MAAM,WAAW,CAAA;AACjC,OAAO,UAAU,MAAM,0BAA0B,CAAA;AACjD,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAA;AAE5C,MAAM,WAAW,gBAAgB,CAAC,WAAW,SAAS;IAAE,MAAM,CAAC,EAAE,WAAW,CAAA;CAAE,EAAE,eAAe;IAC7F,KAAI,QAAQ,EAAE,QAAQ,GAAG,SAAS,CAAC,WAAW,EAAE,eAAe,CAAC,CAAC;CAClE;AAED;;GAEG;AACH,MAAM,WAAW,SAAS,CAAE,WAAW,SAAS;IAAE,MAAM,CAAC,EAAE,WAAW,CAAA;CAAE,EAAE,eAAe;IACvF;;OAEG;IACH,IAAI,CAAC,EAAE,EAAE,SAAS,EAAE,OAAO,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;IAChE;;OAEG;IACH,cAAc,CAAC,OAAO,EAAE,eAAe,EAAE,OAAO,CAAC,EAAE,CAAC,UAAU,EAAE,UAAU,KAAK,IAAI,GAAG,QAAQ,CAAC;IAC/F;;OAEG;IACH,MAAM,CAAC,UAAU,EAAE,SAAS,EAAE,GAAG,SAAS,EAAE,CAAC;CAC9C;AAED,MAAM,WAAW,QAAS,SAAQ,MAAM,CAAC,YAAY;IACnD;;OAEG;IACH,MAAM,CAAC,SAAS,EAAE,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC5C;;OAEG;IACH,QAAQ,IAAI,SAAS,EAAE,CAAC;IACxB;;;;OAIG;IACH,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACxB;AAED,MAAM,WAAW,QAAQ;IACvB;;OAEG;IACH,eAAe,CAAC,MAAM,EAAE,mBAAmB,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;IAElE;;OAEG;IACH,cAAc,CAAC,MAAM,EAAE,mBAAmB,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;CAClE;AAED,oBAAY,2BAA2B,GAAG;IACxC,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAA;AAED,oBAAY,mBAAmB,GAAG;IAChC,IAAI,EAAE,IAAI,CAAC;IACX,MAAM,EAAE,MAAM,aAAa,CAAC,UAAU,CAAC,CAAC;IACxC,KAAK,EAAE,CAAC,GAAG,CAAC,EAAE,KAAK,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACtC,IAAI,EAAE,OAAO,CAAC;IACd,UAAU,EAAE,SAAS,CAAC;IACtB,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,QAAQ,EAAE,2BAA2B,CAAC;CACvC,CAAA"}

376
dist/src/utils/peers.d.ts vendored Normal file
View File

@ -0,0 +1,376 @@
declare const _exports: {
[n: number]: {
id: string;
privKey: string;
pubKey: string;
};
length: number;
toString(): string;
toLocaleString(): string;
pop(): {
id: string;
privKey: string;
pubKey: string;
} | undefined;
push(...items: {
id: string;
privKey: string;
pubKey: string;
}[]): number;
concat(...items: ConcatArray<{
id: string;
privKey: string;
pubKey: string;
}>[]): {
id: string;
privKey: string;
pubKey: string;
}[];
concat(...items: ({
id: string;
privKey: string;
pubKey: string;
} | ConcatArray<{
id: string;
privKey: string;
pubKey: string;
}>)[]): {
id: string;
privKey: string;
pubKey: string;
}[];
join(separator?: string | undefined): string;
reverse(): {
id: string;
privKey: string;
pubKey: string;
}[];
shift(): {
id: string;
privKey: string;
pubKey: string;
} | undefined;
slice(start?: number | undefined, end?: number | undefined): {
id: string;
privKey: string;
pubKey: string;
}[];
sort(compareFn?: ((a: {
id: string;
privKey: string;
pubKey: string;
}, b: {
id: string;
privKey: string;
pubKey: string;
}) => number) | undefined): {
id: string;
privKey: string;
pubKey: string;
}[];
splice(start: number, deleteCount?: number | undefined): {
id: string;
privKey: string;
pubKey: string;
}[];
splice(start: number, deleteCount: number, ...items: {
id: string;
privKey: string;
pubKey: string;
}[]): {
id: string;
privKey: string;
pubKey: string;
}[];
unshift(...items: {
id: string;
privKey: string;
pubKey: string;
}[]): number;
indexOf(searchElement: {
id: string;
privKey: string;
pubKey: string;
}, fromIndex?: number | undefined): number;
lastIndexOf(searchElement: {
id: string;
privKey: string;
pubKey: string;
}, fromIndex?: number | undefined): number;
every<S extends {
id: string;
privKey: string;
pubKey: string;
}>(predicate: (value: {
id: string;
privKey: string;
pubKey: string;
}, index: number, array: {
id: string;
privKey: string;
pubKey: string;
}[]) => value is S, thisArg?: any): this is S[];
every(predicate: (value: {
id: string;
privKey: string;
pubKey: string;
}, index: number, array: {
id: string;
privKey: string;
pubKey: string;
}[]) => unknown, thisArg?: any): boolean;
some(predicate: (value: {
id: string;
privKey: string;
pubKey: string;
}, index: number, array: {
id: string;
privKey: string;
pubKey: string;
}[]) => unknown, thisArg?: any): boolean;
forEach(callbackfn: (value: {
id: string;
privKey: string;
pubKey: string;
}, index: number, array: {
id: string;
privKey: string;
pubKey: string;
}[]) => void, thisArg?: any): void;
map<U>(callbackfn: (value: {
id: string;
privKey: string;
pubKey: string;
}, index: number, array: {
id: string;
privKey: string;
pubKey: string;
}[]) => U, thisArg?: any): U[];
filter<S_1 extends {
id: string;
privKey: string;
pubKey: string;
}>(predicate: (value: {
id: string;
privKey: string;
pubKey: string;
}, index: number, array: {
id: string;
privKey: string;
pubKey: string;
}[]) => value is S_1, thisArg?: any): S_1[];
filter(predicate: (value: {
id: string;
privKey: string;
pubKey: string;
}, index: number, array: {
id: string;
privKey: string;
pubKey: string;
}[]) => unknown, thisArg?: any): {
id: string;
privKey: string;
pubKey: string;
}[];
reduce(callbackfn: (previousValue: {
id: string;
privKey: string;
pubKey: string;
}, currentValue: {
id: string;
privKey: string;
pubKey: string;
}, currentIndex: number, array: {
id: string;
privKey: string;
pubKey: string;
}[]) => {
id: string;
privKey: string;
pubKey: string;
}): {
id: string;
privKey: string;
pubKey: string;
};
reduce(callbackfn: (previousValue: {
id: string;
privKey: string;
pubKey: string;
}, currentValue: {
id: string;
privKey: string;
pubKey: string;
}, currentIndex: number, array: {
id: string;
privKey: string;
pubKey: string;
}[]) => {
id: string;
privKey: string;
pubKey: string;
}, initialValue: {
id: string;
privKey: string;
pubKey: string;
}): {
id: string;
privKey: string;
pubKey: string;
};
reduce<U_1>(callbackfn: (previousValue: U_1, currentValue: {
id: string;
privKey: string;
pubKey: string;
}, currentIndex: number, array: {
id: string;
privKey: string;
pubKey: string;
}[]) => U_1, initialValue: U_1): U_1;
reduceRight(callbackfn: (previousValue: {
id: string;
privKey: string;
pubKey: string;
}, currentValue: {
id: string;
privKey: string;
pubKey: string;
}, currentIndex: number, array: {
id: string;
privKey: string;
pubKey: string;
}[]) => {
id: string;
privKey: string;
pubKey: string;
}): {
id: string;
privKey: string;
pubKey: string;
};
reduceRight(callbackfn: (previousValue: {
id: string;
privKey: string;
pubKey: string;
}, currentValue: {
id: string;
privKey: string;
pubKey: string;
}, currentIndex: number, array: {
id: string;
privKey: string;
pubKey: string;
}[]) => {
id: string;
privKey: string;
pubKey: string;
}, initialValue: {
id: string;
privKey: string;
pubKey: string;
}): {
id: string;
privKey: string;
pubKey: string;
};
reduceRight<U_2>(callbackfn: (previousValue: U_2, currentValue: {
id: string;
privKey: string;
pubKey: string;
}, currentIndex: number, array: {
id: string;
privKey: string;
pubKey: string;
}[]) => U_2, initialValue: U_2): U_2;
find<S_2 extends {
id: string;
privKey: string;
pubKey: string;
}>(predicate: (this: void, value: {
id: string;
privKey: string;
pubKey: string;
}, index: number, obj: {
id: string;
privKey: string;
pubKey: string;
}[]) => value is S_2, thisArg?: any): S_2 | undefined;
find(predicate: (value: {
id: string;
privKey: string;
pubKey: string;
}, index: number, obj: {
id: string;
privKey: string;
pubKey: string;
}[]) => unknown, thisArg?: any): {
id: string;
privKey: string;
pubKey: string;
} | undefined;
findIndex(predicate: (value: {
id: string;
privKey: string;
pubKey: string;
}, index: number, obj: {
id: string;
privKey: string;
pubKey: string;
}[]) => unknown, thisArg?: any): number;
fill(value: {
id: string;
privKey: string;
pubKey: string;
}, start?: number | undefined, end?: number | undefined): {
id: string;
privKey: string;
pubKey: string;
}[];
copyWithin(target: number, start: number, end?: number | undefined): {
id: string;
privKey: string;
pubKey: string;
}[];
[Symbol.iterator](): IterableIterator<{
id: string;
privKey: string;
pubKey: string;
}>;
entries(): IterableIterator<[number, {
id: string;
privKey: string;
pubKey: string;
}]>;
keys(): IterableIterator<number>;
values(): IterableIterator<{
id: string;
privKey: string;
pubKey: string;
}>;
[Symbol.unscopables](): {
copyWithin: boolean;
entries: boolean;
fill: boolean;
find: boolean;
findIndex: boolean;
keys: boolean;
values: boolean;
};
includes(searchElement: {
id: string;
privKey: string;
pubKey: string;
}, fromIndex?: number | undefined): boolean;
flatMap<U_3, This = undefined>(callback: (this: This, value: {
id: string;
privKey: string;
pubKey: string;
}, index: number, array: {
id: string;
privKey: string;
pubKey: string;
}[]) => U_3 | readonly U_3[], thisArg?: This | undefined): U_3[];
flat<A, D extends number = 1>(this: A, depth?: D | undefined): FlatArray<A, D>[];
};
export = _exports;
//# sourceMappingURL=peers.d.ts.map

1
dist/src/utils/peers.d.ts.map vendored Normal file
View File

@ -0,0 +1 @@
{"version":3,"file":"peers.d.ts","sourceRoot":"","sources":["../../../src/utils/peers.js"],"names":[],"mappings":""}

View File

@ -22,6 +22,7 @@
"extends": "ipfs"
},
"scripts": {
"prepare": "aegir build",
"lint": "aegir lint",
"build": "aegir build",
"test": "aegir test",