From d2f8b51d44052cb252bb2c9e154a27e928f5960e Mon Sep 17 00:00:00 2001 From: Vasco Santos Date: Wed, 2 Dec 2020 16:56:43 +0100 Subject: [PATCH] chore: add post install --- .gitignore | 1 - dist/index.min.js | 1 + dist/src/connection/connection.d.ts | 233 +++++++++++ dist/src/connection/connection.d.ts.map | 1 + dist/src/connection/index.d.ts | 2 + dist/src/connection/index.d.ts.map | 1 + dist/src/connection/status.d.ts | 2 + dist/src/connection/status.d.ts.map | 1 + dist/src/connection/tests/connection.d.ts | 3 + dist/src/connection/tests/connection.d.ts.map | 1 + dist/src/connection/tests/index.d.ts | 3 + dist/src/connection/tests/index.d.ts.map | 1 + dist/src/content-routing/types.d.ts | 1 + dist/src/content-routing/types.d.ts.map | 1 + dist/src/crypto/errors.d.ts | 16 + dist/src/crypto/errors.d.ts.map | 1 + dist/src/crypto/tests/index.d.ts | 3 + dist/src/crypto/tests/index.d.ts.map | 1 + dist/src/crypto/types.d.ts | 24 ++ dist/src/crypto/types.d.ts.map | 1 + dist/src/index.d.ts | 1 + dist/src/index.d.ts.map | 1 + dist/src/peer-discovery/tests/index.d.ts | 3 + dist/src/peer-discovery/tests/index.d.ts.map | 1 + dist/src/pubsub/errors.d.ts | 12 + dist/src/pubsub/errors.d.ts.map | 1 + dist/src/pubsub/index.d.ts | 355 +++++++++++++++++ dist/src/pubsub/index.d.ts.map | 1 + dist/src/pubsub/message/index.d.ts | 6 + dist/src/pubsub/message/index.d.ts.map | 1 + dist/src/pubsub/message/rpc.proto.d.ts | 3 + dist/src/pubsub/message/rpc.proto.d.ts.map | 1 + dist/src/pubsub/message/sign.d.ts | 35 ++ dist/src/pubsub/message/sign.d.ts.map | 1 + .../message/topic-descriptor.proto.d.ts | 3 + .../message/topic-descriptor.proto.d.ts.map | 1 + dist/src/pubsub/peer-streams.d.ts | 112 ++++++ dist/src/pubsub/peer-streams.d.ts.map | 1 + dist/src/pubsub/signature-policy.d.ts | 6 + dist/src/pubsub/signature-policy.d.ts.map | 1 + dist/src/pubsub/tests/api.d.ts | 3 + dist/src/pubsub/tests/api.d.ts.map | 1 + dist/src/pubsub/tests/emit-self.d.ts | 3 + dist/src/pubsub/tests/emit-self.d.ts.map | 1 + dist/src/pubsub/tests/index.d.ts | 3 + dist/src/pubsub/tests/index.d.ts.map | 1 + dist/src/pubsub/tests/messages.d.ts | 3 + dist/src/pubsub/tests/messages.d.ts.map | 1 + dist/src/pubsub/tests/multiple-nodes.d.ts | 3 + dist/src/pubsub/tests/multiple-nodes.d.ts.map | 1 + dist/src/pubsub/tests/two-nodes.d.ts | 3 + dist/src/pubsub/tests/two-nodes.d.ts.map | 1 + dist/src/pubsub/tests/utils.d.ts | 3 + dist/src/pubsub/tests/utils.d.ts.map | 1 + dist/src/pubsub/utils.d.ts | 22 + dist/src/pubsub/utils.d.ts.map | 1 + dist/src/record/tests/index.d.ts | 3 + dist/src/record/tests/index.d.ts.map | 1 + dist/src/record/types.d.ts | 22 + dist/src/record/types.d.ts.map | 1 + dist/src/stream-muxer/tests/base-test.d.ts | 3 + .../src/stream-muxer/tests/base-test.d.ts.map | 1 + dist/src/stream-muxer/tests/close-test.d.ts | 3 + .../stream-muxer/tests/close-test.d.ts.map | 1 + dist/src/stream-muxer/tests/index.d.ts | 3 + dist/src/stream-muxer/tests/index.d.ts.map | 1 + .../stream-muxer/tests/mega-stress-test.d.ts | 3 + .../tests/mega-stress-test.d.ts.map | 1 + dist/src/stream-muxer/tests/spawner.d.ts | 3 + dist/src/stream-muxer/tests/spawner.d.ts.map | 1 + dist/src/stream-muxer/tests/stress-test.d.ts | 3 + .../stream-muxer/tests/stress-test.d.ts.map | 1 + dist/src/stream-muxer/types.d.ts | 44 ++ dist/src/stream-muxer/types.d.ts.map | 1 + dist/src/topology/index.d.ts | 76 ++++ dist/src/topology/index.d.ts.map | 1 + dist/src/topology/multicodec-topology.d.ts | 80 ++++ .../src/topology/multicodec-topology.d.ts.map | 1 + .../topology/tests/multicodec-topology.d.ts | 3 + .../tests/multicodec-topology.d.ts.map | 1 + dist/src/topology/tests/topology.d.ts | 3 + dist/src/topology/tests/topology.d.ts.map | 1 + dist/src/transport/errors.d.ts | 7 + dist/src/transport/errors.d.ts.map | 1 + dist/src/transport/tests/dial-test.d.ts | 3 + dist/src/transport/tests/dial-test.d.ts.map | 1 + dist/src/transport/tests/filter-test.d.ts | 3 + dist/src/transport/tests/filter-test.d.ts.map | 1 + dist/src/transport/tests/index.d.ts | 3 + dist/src/transport/tests/index.d.ts.map | 1 + dist/src/transport/tests/listen-test.d.ts | 3 + dist/src/transport/tests/listen-test.d.ts.map | 1 + dist/src/transport/tests/utils/index.d.ts | 2 + dist/src/transport/tests/utils/index.d.ts.map | 1 + dist/src/transport/types.d.ts | 70 ++++ dist/src/transport/types.d.ts.map | 1 + dist/src/utils/peers.d.ts | 376 ++++++++++++++++++ dist/src/utils/peers.d.ts.map | 1 + package.json | 1 + 99 files changed, 1632 insertions(+), 1 deletion(-) create mode 100644 dist/index.min.js create mode 100644 dist/src/connection/connection.d.ts create mode 100644 dist/src/connection/connection.d.ts.map create mode 100644 dist/src/connection/index.d.ts create mode 100644 dist/src/connection/index.d.ts.map create mode 100644 dist/src/connection/status.d.ts create mode 100644 dist/src/connection/status.d.ts.map create mode 100644 dist/src/connection/tests/connection.d.ts create mode 100644 dist/src/connection/tests/connection.d.ts.map create mode 100644 dist/src/connection/tests/index.d.ts create mode 100644 dist/src/connection/tests/index.d.ts.map create mode 100644 dist/src/content-routing/types.d.ts create mode 100644 dist/src/content-routing/types.d.ts.map create mode 100644 dist/src/crypto/errors.d.ts create mode 100644 dist/src/crypto/errors.d.ts.map create mode 100644 dist/src/crypto/tests/index.d.ts create mode 100644 dist/src/crypto/tests/index.d.ts.map create mode 100644 dist/src/crypto/types.d.ts create mode 100644 dist/src/crypto/types.d.ts.map create mode 100644 dist/src/index.d.ts create mode 100644 dist/src/index.d.ts.map create mode 100644 dist/src/peer-discovery/tests/index.d.ts create mode 100644 dist/src/peer-discovery/tests/index.d.ts.map create mode 100644 dist/src/pubsub/errors.d.ts create mode 100644 dist/src/pubsub/errors.d.ts.map create mode 100644 dist/src/pubsub/index.d.ts create mode 100644 dist/src/pubsub/index.d.ts.map create mode 100644 dist/src/pubsub/message/index.d.ts create mode 100644 dist/src/pubsub/message/index.d.ts.map create mode 100644 dist/src/pubsub/message/rpc.proto.d.ts create mode 100644 dist/src/pubsub/message/rpc.proto.d.ts.map create mode 100644 dist/src/pubsub/message/sign.d.ts create mode 100644 dist/src/pubsub/message/sign.d.ts.map create mode 100644 dist/src/pubsub/message/topic-descriptor.proto.d.ts create mode 100644 dist/src/pubsub/message/topic-descriptor.proto.d.ts.map create mode 100644 dist/src/pubsub/peer-streams.d.ts create mode 100644 dist/src/pubsub/peer-streams.d.ts.map create mode 100644 dist/src/pubsub/signature-policy.d.ts create mode 100644 dist/src/pubsub/signature-policy.d.ts.map create mode 100644 dist/src/pubsub/tests/api.d.ts create mode 100644 dist/src/pubsub/tests/api.d.ts.map create mode 100644 dist/src/pubsub/tests/emit-self.d.ts create mode 100644 dist/src/pubsub/tests/emit-self.d.ts.map create mode 100644 dist/src/pubsub/tests/index.d.ts create mode 100644 dist/src/pubsub/tests/index.d.ts.map create mode 100644 dist/src/pubsub/tests/messages.d.ts create mode 100644 dist/src/pubsub/tests/messages.d.ts.map create mode 100644 dist/src/pubsub/tests/multiple-nodes.d.ts create mode 100644 dist/src/pubsub/tests/multiple-nodes.d.ts.map create mode 100644 dist/src/pubsub/tests/two-nodes.d.ts create mode 100644 dist/src/pubsub/tests/two-nodes.d.ts.map create mode 100644 dist/src/pubsub/tests/utils.d.ts create mode 100644 dist/src/pubsub/tests/utils.d.ts.map create mode 100644 dist/src/pubsub/utils.d.ts create mode 100644 dist/src/pubsub/utils.d.ts.map create mode 100644 dist/src/record/tests/index.d.ts create mode 100644 dist/src/record/tests/index.d.ts.map create mode 100644 dist/src/record/types.d.ts create mode 100644 dist/src/record/types.d.ts.map create mode 100644 dist/src/stream-muxer/tests/base-test.d.ts create mode 100644 dist/src/stream-muxer/tests/base-test.d.ts.map create mode 100644 dist/src/stream-muxer/tests/close-test.d.ts create mode 100644 dist/src/stream-muxer/tests/close-test.d.ts.map create mode 100644 dist/src/stream-muxer/tests/index.d.ts create mode 100644 dist/src/stream-muxer/tests/index.d.ts.map create mode 100644 dist/src/stream-muxer/tests/mega-stress-test.d.ts create mode 100644 dist/src/stream-muxer/tests/mega-stress-test.d.ts.map create mode 100644 dist/src/stream-muxer/tests/spawner.d.ts create mode 100644 dist/src/stream-muxer/tests/spawner.d.ts.map create mode 100644 dist/src/stream-muxer/tests/stress-test.d.ts create mode 100644 dist/src/stream-muxer/tests/stress-test.d.ts.map create mode 100644 dist/src/stream-muxer/types.d.ts create mode 100644 dist/src/stream-muxer/types.d.ts.map create mode 100644 dist/src/topology/index.d.ts create mode 100644 dist/src/topology/index.d.ts.map create mode 100644 dist/src/topology/multicodec-topology.d.ts create mode 100644 dist/src/topology/multicodec-topology.d.ts.map create mode 100644 dist/src/topology/tests/multicodec-topology.d.ts create mode 100644 dist/src/topology/tests/multicodec-topology.d.ts.map create mode 100644 dist/src/topology/tests/topology.d.ts create mode 100644 dist/src/topology/tests/topology.d.ts.map create mode 100644 dist/src/transport/errors.d.ts create mode 100644 dist/src/transport/errors.d.ts.map create mode 100644 dist/src/transport/tests/dial-test.d.ts create mode 100644 dist/src/transport/tests/dial-test.d.ts.map create mode 100644 dist/src/transport/tests/filter-test.d.ts create mode 100644 dist/src/transport/tests/filter-test.d.ts.map create mode 100644 dist/src/transport/tests/index.d.ts create mode 100644 dist/src/transport/tests/index.d.ts.map create mode 100644 dist/src/transport/tests/listen-test.d.ts create mode 100644 dist/src/transport/tests/listen-test.d.ts.map create mode 100644 dist/src/transport/tests/utils/index.d.ts create mode 100644 dist/src/transport/tests/utils/index.d.ts.map create mode 100644 dist/src/transport/types.d.ts create mode 100644 dist/src/transport/types.d.ts.map create mode 100644 dist/src/utils/peers.d.ts create mode 100644 dist/src/utils/peers.d.ts.map diff --git a/.gitignore b/.gitignore index d6f38cb..1d59a10 100644 --- a/.gitignore +++ b/.gitignore @@ -5,7 +5,6 @@ .nyc_output build -dist docs # Dependency directory diff --git a/dist/index.min.js b/dist/index.min.js new file mode 100644 index 0000000..6324446 --- /dev/null +++ b/dist/index.min.js @@ -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){}])})); \ No newline at end of file diff --git a/dist/src/connection/connection.d.ts b/dist/src/connection/connection.d.ts new file mode 100644 index 0000000..d161e7f --- /dev/null +++ b/dist/src/connection/connection.d.ts @@ -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} 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; + /** + * Reference to the getStreams function of the muxer + */ + _getStreams: () => MuxedStream[]; + /** + * Connection streams registry + */ + registry: Map; + /** + * 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} + */ + close(): Promise; + _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; + /** + * - 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 \ No newline at end of file diff --git a/dist/src/connection/connection.d.ts.map b/dist/src/connection/connection.d.ts.map new file mode 100644 index 0000000..13cd05c --- /dev/null +++ b/dist/src/connection/connection.d.ts.map @@ -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"} \ No newline at end of file diff --git a/dist/src/connection/index.d.ts b/dist/src/connection/index.d.ts new file mode 100644 index 0000000..8cb5263 --- /dev/null +++ b/dist/src/connection/index.d.ts @@ -0,0 +1,2 @@ +export var Connection: typeof import("./connection"); +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/dist/src/connection/index.d.ts.map b/dist/src/connection/index.d.ts.map new file mode 100644 index 0000000..07cb0a1 --- /dev/null +++ b/dist/src/connection/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/connection/index.js"],"names":[],"mappings":""} \ No newline at end of file diff --git a/dist/src/connection/status.d.ts b/dist/src/connection/status.d.ts new file mode 100644 index 0000000..e157c79 --- /dev/null +++ b/dist/src/connection/status.d.ts @@ -0,0 +1,2 @@ +export type Status = "open" | "closing" | "closed"; +//# sourceMappingURL=status.d.ts.map \ No newline at end of file diff --git a/dist/src/connection/status.d.ts.map b/dist/src/connection/status.d.ts.map new file mode 100644 index 0000000..7dda01a --- /dev/null +++ b/dist/src/connection/status.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"status.d.ts","sourceRoot":"","sources":["../../../src/connection/status.js"],"names":[],"mappings":""} \ No newline at end of file diff --git a/dist/src/connection/tests/connection.d.ts b/dist/src/connection/tests/connection.d.ts new file mode 100644 index 0000000..fd6b1b1 --- /dev/null +++ b/dist/src/connection/tests/connection.d.ts @@ -0,0 +1,3 @@ +declare function _exports(test: any): void; +export = _exports; +//# sourceMappingURL=connection.d.ts.map \ No newline at end of file diff --git a/dist/src/connection/tests/connection.d.ts.map b/dist/src/connection/tests/connection.d.ts.map new file mode 100644 index 0000000..7778bd9 --- /dev/null +++ b/dist/src/connection/tests/connection.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"connection.d.ts","sourceRoot":"","sources":["../../../../src/connection/tests/connection.js"],"names":[],"mappings":"AAUiB,2CA4KhB"} \ No newline at end of file diff --git a/dist/src/connection/tests/index.d.ts b/dist/src/connection/tests/index.d.ts new file mode 100644 index 0000000..eceb82e --- /dev/null +++ b/dist/src/connection/tests/index.d.ts @@ -0,0 +1,3 @@ +declare function _exports(test: any): void; +export = _exports; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/dist/src/connection/tests/index.d.ts.map b/dist/src/connection/tests/index.d.ts.map new file mode 100644 index 0000000..080bdca --- /dev/null +++ b/dist/src/connection/tests/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/connection/tests/index.js"],"names":[],"mappings":"AAMiB,2CAEhB"} \ No newline at end of file diff --git a/dist/src/content-routing/types.d.ts b/dist/src/content-routing/types.d.ts new file mode 100644 index 0000000..2324761 --- /dev/null +++ b/dist/src/content-routing/types.d.ts @@ -0,0 +1 @@ +//# sourceMappingURL=types.d.ts.map \ No newline at end of file diff --git a/dist/src/content-routing/types.d.ts.map b/dist/src/content-routing/types.d.ts.map new file mode 100644 index 0000000..1ca54bb --- /dev/null +++ b/dist/src/content-routing/types.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/content-routing/types.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/dist/src/crypto/errors.d.ts b/dist/src/crypto/errors.d.ts new file mode 100644 index 0000000..41b9006 --- /dev/null +++ b/dist/src/crypto/errors.d.ts @@ -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 \ No newline at end of file diff --git a/dist/src/crypto/errors.d.ts.map b/dist/src/crypto/errors.d.ts.map new file mode 100644 index 0000000..c701e21 --- /dev/null +++ b/dist/src/crypto/errors.d.ts.map @@ -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"} \ No newline at end of file diff --git a/dist/src/crypto/tests/index.d.ts b/dist/src/crypto/tests/index.d.ts new file mode 100644 index 0000000..1c87129 --- /dev/null +++ b/dist/src/crypto/tests/index.d.ts @@ -0,0 +1,3 @@ +declare function _exports(common: any): void; +export = _exports; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/dist/src/crypto/tests/index.d.ts.map b/dist/src/crypto/tests/index.d.ts.map new file mode 100644 index 0000000..28a5ff6 --- /dev/null +++ b/dist/src/crypto/tests/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/crypto/tests/index.js"],"names":[],"mappings":"AAgBiB,6CAwFhB"} \ No newline at end of file diff --git a/dist/src/crypto/types.d.ts b/dist/src/crypto/types.d.ts new file mode 100644 index 0000000..3cadaec --- /dev/null +++ b/dist/src/crypto/types.d.ts @@ -0,0 +1,24 @@ +/// +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; + /** + * Decrypt incoming data. + */ + secureInbound(localPeer: PeerId, connection: MultiaddrConnection, remotePeer?: PeerId): Promise; +} +export declare type SecureOutbound = { + conn: MultiaddrConnection; + remoteEarlyData: Buffer; + remotePeer: PeerId; +}; +//# sourceMappingURL=types.d.ts.map \ No newline at end of file diff --git a/dist/src/crypto/types.d.ts.map b/dist/src/crypto/types.d.ts.map new file mode 100644 index 0000000..44be7d8 --- /dev/null +++ b/dist/src/crypto/types.d.ts.map @@ -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"} \ No newline at end of file diff --git a/dist/src/index.d.ts b/dist/src/index.d.ts new file mode 100644 index 0000000..f36479a --- /dev/null +++ b/dist/src/index.d.ts @@ -0,0 +1 @@ +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/dist/src/index.d.ts.map b/dist/src/index.d.ts.map new file mode 100644 index 0000000..4b136e2 --- /dev/null +++ b/dist/src/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.js"],"names":[],"mappings":""} \ No newline at end of file diff --git a/dist/src/peer-discovery/tests/index.d.ts b/dist/src/peer-discovery/tests/index.d.ts new file mode 100644 index 0000000..1c87129 --- /dev/null +++ b/dist/src/peer-discovery/tests/index.d.ts @@ -0,0 +1,3 @@ +declare function _exports(common: any): void; +export = _exports; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/dist/src/peer-discovery/tests/index.d.ts.map b/dist/src/peer-discovery/tests/index.d.ts.map new file mode 100644 index 0000000..cb83d65 --- /dev/null +++ b/dist/src/peer-discovery/tests/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/peer-discovery/tests/index.js"],"names":[],"mappings":"AAaiB,6CA8EhB"} \ No newline at end of file diff --git a/dist/src/pubsub/errors.d.ts b/dist/src/pubsub/errors.d.ts new file mode 100644 index 0000000..b47b37a --- /dev/null +++ b/dist/src/pubsub/errors.d.ts @@ -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 \ No newline at end of file diff --git a/dist/src/pubsub/errors.d.ts.map b/dist/src/pubsub/errors.d.ts.map new file mode 100644 index 0000000..b1d71c0 --- /dev/null +++ b/dist/src/pubsub/errors.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../src/pubsub/errors.js"],"names":[],"mappings":""} \ No newline at end of file diff --git a/dist/src/pubsub/index.d.ts b/dist/src/pubsub/index.d.ts new file mode 100644 index 0000000..329fd41 --- /dev/null +++ b/dist/src/pubsub/index.d.ts @@ -0,0 +1,355 @@ +/// +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} 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; + libp2p: Libp2p; + globalSignaturePolicy: "StrictSign" | "StrictNoSign" | undefined; + canRelayMessage: boolean | undefined; + emitSelf: boolean | undefined; + }); + log: any; + /** + * @type {Array} + */ + multicodecs: Array; + _libp2p: any; + registrar: any; + /** + * @type {PeerId} + */ + peerId: PeerId; + started: boolean; + /** + * Map of topics to which peers are subscribed to + * + * @type {Map>} + */ + topics: Map>; + /** + * List of our subscriptions + * + * @type {Set} + */ + subscriptions: Set; + /** + * Map of peer streams + * + * @type {Map} + */ + peers: Map; + /** + * 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} validator + */ + /** + * Topic validator map + * + * Keyed by topic + * Topic validators are functions with the following input: + * + * @type {Map} + */ + topicValidators: Map Promise>; + _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; + /** + * 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} stream - inbound stream + * @param {PeerStreams} peerStreams - PubSub peer + * @returns {Promise} + */ + _processMessages(idB58Str: string, stream: AsyncIterable, peerStreams: import("./peer-streams")): Promise; + /** + * 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} + */ + _processRpcMessage(msg: InMessage): Promise; + /** + * 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} + */ + validate(message: InMessage): Promise; + /** + * 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} + */ + protected _buildMessage(message: RPCMessage): Promise; + /** + * Get a list of the peer-ids that are subscribed to one topic. + * + * @param {string} topic + * @returns {Array} + */ + getSubscribers(topic: string): Array; + /** + * Publishes messages to all subscribed peers + * + * @override + * @param {string} topic + * @param {Buffer} message + * @returns {Promise} + */ + publish(topic: string, message: Buffer): Promise; + /** + * 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} + * + */ + _publish(message: InMessage): Promise; + /** + * 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} + */ + getTopics(): Array; +} +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 \ No newline at end of file diff --git a/dist/src/pubsub/index.d.ts.map b/dist/src/pubsub/index.d.ts.map new file mode 100644 index 0000000..bdbc450 --- /dev/null +++ b/dist/src/pubsub/index.d.ts.map @@ -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"} \ No newline at end of file diff --git a/dist/src/pubsub/message/index.d.ts b/dist/src/pubsub/message/index.d.ts new file mode 100644 index 0000000..52a000e --- /dev/null +++ b/dist/src/pubsub/message/index.d.ts @@ -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 \ No newline at end of file diff --git a/dist/src/pubsub/message/index.d.ts.map b/dist/src/pubsub/message/index.d.ts.map new file mode 100644 index 0000000..f8bb39a --- /dev/null +++ b/dist/src/pubsub/message/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/pubsub/message/index.js"],"names":[],"mappings":""} \ No newline at end of file diff --git a/dist/src/pubsub/message/rpc.proto.d.ts b/dist/src/pubsub/message/rpc.proto.d.ts new file mode 100644 index 0000000..4cee2c2 --- /dev/null +++ b/dist/src/pubsub/message/rpc.proto.d.ts @@ -0,0 +1,3 @@ +declare const _exports: string; +export = _exports; +//# sourceMappingURL=rpc.proto.d.ts.map \ No newline at end of file diff --git a/dist/src/pubsub/message/rpc.proto.d.ts.map b/dist/src/pubsub/message/rpc.proto.d.ts.map new file mode 100644 index 0000000..13a2be5 --- /dev/null +++ b/dist/src/pubsub/message/rpc.proto.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"rpc.proto.d.ts","sourceRoot":"","sources":["../../../../src/pubsub/message/rpc.proto.js"],"names":[],"mappings":""} \ No newline at end of file diff --git a/dist/src/pubsub/message/sign.d.ts b/dist/src/pubsub/message/sign.d.ts new file mode 100644 index 0000000..f5911de --- /dev/null +++ b/dist/src/pubsub/message/sign.d.ts @@ -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} + */ +export function messagePublicKey(message: InMessage): Promise; +/** + * Signs the provided message with the given `peerId` + * + * @param {PeerId} peerId + * @param {Message} message + * @returns {Promise} + */ +export function signMessage(peerId: import("peer-id"), message: any): Promise; +export const SignPrefix: any; +/** + * Verifies the signature of the given message + * + * @param {InMessage} message + * @returns {Promise} + */ +export function verifySignature(message: InMessage): Promise; +//# sourceMappingURL=sign.d.ts.map \ No newline at end of file diff --git a/dist/src/pubsub/message/sign.d.ts.map b/dist/src/pubsub/message/sign.d.ts.map new file mode 100644 index 0000000..46d4589 --- /dev/null +++ b/dist/src/pubsub/message/sign.d.ts.map @@ -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"} \ No newline at end of file diff --git a/dist/src/pubsub/message/topic-descriptor.proto.d.ts b/dist/src/pubsub/message/topic-descriptor.proto.d.ts new file mode 100644 index 0000000..9708511 --- /dev/null +++ b/dist/src/pubsub/message/topic-descriptor.proto.d.ts @@ -0,0 +1,3 @@ +declare const _exports: string; +export = _exports; +//# sourceMappingURL=topic-descriptor.proto.d.ts.map \ No newline at end of file diff --git a/dist/src/pubsub/message/topic-descriptor.proto.d.ts.map b/dist/src/pubsub/message/topic-descriptor.proto.d.ts.map new file mode 100644 index 0000000..a3de87f --- /dev/null +++ b/dist/src/pubsub/message/topic-descriptor.proto.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"topic-descriptor.proto.d.ts","sourceRoot":"","sources":["../../../../src/pubsub/message/topic-descriptor.proto.js"],"names":[],"mappings":""} \ No newline at end of file diff --git a/dist/src/pubsub/peer-streams.d.ts b/dist/src/pubsub/peer-streams.d.ts new file mode 100644 index 0000000..54b36aa --- /dev/null +++ b/dist/src/pubsub/peer-streams.d.ts @@ -0,0 +1,112 @@ +/// +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} 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; + /** + * Read stream + * + * @type {null| AsyncIterable} + */ + inboundStream: null | AsyncIterable; + /** + * 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} + */ + attachInboundStream(stream: MuxedStream): AsyncIterable; + /** + * Attach a raw outbound stream and setup a write stream + * + * @param {MuxedStream} stream + * @returns {Promise} + */ + attachOutboundStream(stream: MuxedStream): Promise; + /** + * 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; +//# sourceMappingURL=peer-streams.d.ts.map \ No newline at end of file diff --git a/dist/src/pubsub/peer-streams.d.ts.map b/dist/src/pubsub/peer-streams.d.ts.map new file mode 100644 index 0000000..8b50250 --- /dev/null +++ b/dist/src/pubsub/peer-streams.d.ts.map @@ -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"} \ No newline at end of file diff --git a/dist/src/pubsub/signature-policy.d.ts b/dist/src/pubsub/signature-policy.d.ts new file mode 100644 index 0000000..89be480 --- /dev/null +++ b/dist/src/pubsub/signature-policy.d.ts @@ -0,0 +1,6 @@ +export namespace SignaturePolicy { + const StrictSign: 'StrictSign'; + const StrictNoSign: 'StrictNoSign'; +} +export type SignaturePolicyType = "StrictSign" | "StrictNoSign"; +//# sourceMappingURL=signature-policy.d.ts.map \ No newline at end of file diff --git a/dist/src/pubsub/signature-policy.d.ts.map b/dist/src/pubsub/signature-policy.d.ts.map new file mode 100644 index 0000000..f192951 --- /dev/null +++ b/dist/src/pubsub/signature-policy.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"signature-policy.d.ts","sourceRoot":"","sources":["../../../src/pubsub/signature-policy.js"],"names":[],"mappings":";sBAeyB,YAAY;wBAWV,cAAc"} \ No newline at end of file diff --git a/dist/src/pubsub/tests/api.d.ts b/dist/src/pubsub/tests/api.d.ts new file mode 100644 index 0000000..f333cea --- /dev/null +++ b/dist/src/pubsub/tests/api.d.ts @@ -0,0 +1,3 @@ +declare function _exports(common: any): void; +export = _exports; +//# sourceMappingURL=api.d.ts.map \ No newline at end of file diff --git a/dist/src/pubsub/tests/api.d.ts.map b/dist/src/pubsub/tests/api.d.ts.map new file mode 100644 index 0000000..2897ad1 --- /dev/null +++ b/dist/src/pubsub/tests/api.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../../../src/pubsub/tests/api.js"],"names":[],"mappings":"AAciB,6CA8EhB"} \ No newline at end of file diff --git a/dist/src/pubsub/tests/emit-self.d.ts b/dist/src/pubsub/tests/emit-self.d.ts new file mode 100644 index 0000000..8e675d4 --- /dev/null +++ b/dist/src/pubsub/tests/emit-self.d.ts @@ -0,0 +1,3 @@ +declare function _exports(common: any): void; +export = _exports; +//# sourceMappingURL=emit-self.d.ts.map \ No newline at end of file diff --git a/dist/src/pubsub/tests/emit-self.d.ts.map b/dist/src/pubsub/tests/emit-self.d.ts.map new file mode 100644 index 0000000..583672e --- /dev/null +++ b/dist/src/pubsub/tests/emit-self.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"emit-self.d.ts","sourceRoot":"","sources":["../../../../src/pubsub/tests/emit-self.js"],"names":[],"mappings":"AAaiB,6CAuDhB"} \ No newline at end of file diff --git a/dist/src/pubsub/tests/index.d.ts b/dist/src/pubsub/tests/index.d.ts new file mode 100644 index 0000000..1c87129 --- /dev/null +++ b/dist/src/pubsub/tests/index.d.ts @@ -0,0 +1,3 @@ +declare function _exports(common: any): void; +export = _exports; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/dist/src/pubsub/tests/index.d.ts.map b/dist/src/pubsub/tests/index.d.ts.map new file mode 100644 index 0000000..cf982d1 --- /dev/null +++ b/dist/src/pubsub/tests/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/pubsub/tests/index.js"],"names":[],"mappings":"AASiB,6CAQhB"} \ No newline at end of file diff --git a/dist/src/pubsub/tests/messages.d.ts b/dist/src/pubsub/tests/messages.d.ts new file mode 100644 index 0000000..93bbf69 --- /dev/null +++ b/dist/src/pubsub/tests/messages.d.ts @@ -0,0 +1,3 @@ +declare function _exports(common: any): void; +export = _exports; +//# sourceMappingURL=messages.d.ts.map \ No newline at end of file diff --git a/dist/src/pubsub/tests/messages.d.ts.map b/dist/src/pubsub/tests/messages.d.ts.map new file mode 100644 index 0000000..5c1d6d6 --- /dev/null +++ b/dist/src/pubsub/tests/messages.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["../../../../src/pubsub/tests/messages.js"],"names":[],"mappings":"AAiBiB,6CAiGhB"} \ No newline at end of file diff --git a/dist/src/pubsub/tests/multiple-nodes.d.ts b/dist/src/pubsub/tests/multiple-nodes.d.ts new file mode 100644 index 0000000..34deb59 --- /dev/null +++ b/dist/src/pubsub/tests/multiple-nodes.d.ts @@ -0,0 +1,3 @@ +declare function _exports(common: any): void; +export = _exports; +//# sourceMappingURL=multiple-nodes.d.ts.map \ No newline at end of file diff --git a/dist/src/pubsub/tests/multiple-nodes.d.ts.map b/dist/src/pubsub/tests/multiple-nodes.d.ts.map new file mode 100644 index 0000000..9b84101 --- /dev/null +++ b/dist/src/pubsub/tests/multiple-nodes.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"multiple-nodes.d.ts","sourceRoot":"","sources":["../../../../src/pubsub/tests/multiple-nodes.js"],"names":[],"mappings":"AAgBiB,6CAmUhB"} \ No newline at end of file diff --git a/dist/src/pubsub/tests/two-nodes.d.ts b/dist/src/pubsub/tests/two-nodes.d.ts new file mode 100644 index 0000000..e07588a --- /dev/null +++ b/dist/src/pubsub/tests/two-nodes.d.ts @@ -0,0 +1,3 @@ +declare function _exports(common: any): void; +export = _exports; +//# sourceMappingURL=two-nodes.d.ts.map \ No newline at end of file diff --git a/dist/src/pubsub/tests/two-nodes.d.ts.map b/dist/src/pubsub/tests/two-nodes.d.ts.map new file mode 100644 index 0000000..62fedb3 --- /dev/null +++ b/dist/src/pubsub/tests/two-nodes.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"two-nodes.d.ts","sourceRoot":"","sources":["../../../../src/pubsub/tests/two-nodes.js"],"names":[],"mappings":"AAwBiB,6CA2MhB"} \ No newline at end of file diff --git a/dist/src/pubsub/tests/utils.d.ts b/dist/src/pubsub/tests/utils.d.ts new file mode 100644 index 0000000..9ea5d1a --- /dev/null +++ b/dist/src/pubsub/tests/utils.d.ts @@ -0,0 +1,3 @@ +export function first(map: any): any; +export function expectSet(set: any, subs: any): void; +//# sourceMappingURL=utils.d.ts.map \ No newline at end of file diff --git a/dist/src/pubsub/tests/utils.d.ts.map b/dist/src/pubsub/tests/utils.d.ts.map new file mode 100644 index 0000000..4bcda63 --- /dev/null +++ b/dist/src/pubsub/tests/utils.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../src/pubsub/tests/utils.js"],"names":[],"mappings":"AAIgB,qCAAkC;AAE9B,qDAEnB"} \ No newline at end of file diff --git a/dist/src/pubsub/utils.d.ts b/dist/src/pubsub/utils.d.ts new file mode 100644 index 0000000..569a4aa --- /dev/null +++ b/dist/src/pubsub/utils.d.ts @@ -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[], b: Set | any[]): boolean; +export function ensureArray(maybeArray: T | T[]): T[]; +export function normalizeInRpcMessage(message: T & { + from?: string | undefined; + receivedFrom: string; +}, peerId?: string | undefined): T & { + from?: string | undefined; + peerId?: string | undefined; +}; +export function normalizeOutRpcMessage(message: T): T & { + from?: Uint8Array | undefined; + data?: Uint8Array | undefined; +}; +//# sourceMappingURL=utils.d.ts.map \ No newline at end of file diff --git a/dist/src/pubsub/utils.d.ts.map b/dist/src/pubsub/utils.d.ts.map new file mode 100644 index 0000000..9805851 --- /dev/null +++ b/dist/src/pubsub/utils.d.ts.map @@ -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"} \ No newline at end of file diff --git a/dist/src/record/tests/index.d.ts b/dist/src/record/tests/index.d.ts new file mode 100644 index 0000000..eceb82e --- /dev/null +++ b/dist/src/record/tests/index.d.ts @@ -0,0 +1,3 @@ +declare function _exports(test: any): void; +export = _exports; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/dist/src/record/tests/index.d.ts.map b/dist/src/record/tests/index.d.ts.map new file mode 100644 index 0000000..49ca235 --- /dev/null +++ b/dist/src/record/tests/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/record/tests/index.js"],"names":[],"mappings":"AAQiB,2CA0BhB"} \ No newline at end of file diff --git a/dist/src/record/types.d.ts b/dist/src/record/types.d.ts new file mode 100644 index 0000000..da32897 --- /dev/null +++ b/dist/src/record/types.d.ts @@ -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 \ No newline at end of file diff --git a/dist/src/record/types.d.ts.map b/dist/src/record/types.d.ts.map new file mode 100644 index 0000000..6bb8668 --- /dev/null +++ b/dist/src/record/types.d.ts.map @@ -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"} \ No newline at end of file diff --git a/dist/src/stream-muxer/tests/base-test.d.ts b/dist/src/stream-muxer/tests/base-test.d.ts new file mode 100644 index 0000000..3c1a63c --- /dev/null +++ b/dist/src/stream-muxer/tests/base-test.d.ts @@ -0,0 +1,3 @@ +declare function _exports(common: any): void; +export = _exports; +//# sourceMappingURL=base-test.d.ts.map \ No newline at end of file diff --git a/dist/src/stream-muxer/tests/base-test.d.ts.map b/dist/src/stream-muxer/tests/base-test.d.ts.map new file mode 100644 index 0000000..6e8d2c6 --- /dev/null +++ b/dist/src/stream-muxer/tests/base-test.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"base-test.d.ts","sourceRoot":"","sources":["../../../../src/stream-muxer/tests/base-test.js"],"names":[],"mappings":"AAiCiB,6CAwHhB"} \ No newline at end of file diff --git a/dist/src/stream-muxer/tests/close-test.d.ts b/dist/src/stream-muxer/tests/close-test.d.ts new file mode 100644 index 0000000..27187dd --- /dev/null +++ b/dist/src/stream-muxer/tests/close-test.d.ts @@ -0,0 +1,3 @@ +declare function _exports(common: any): void; +export = _exports; +//# sourceMappingURL=close-test.d.ts.map \ No newline at end of file diff --git a/dist/src/stream-muxer/tests/close-test.d.ts.map b/dist/src/stream-muxer/tests/close-test.d.ts.map new file mode 100644 index 0000000..35f2506 --- /dev/null +++ b/dist/src/stream-muxer/tests/close-test.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"close-test.d.ts","sourceRoot":"","sources":["../../../../src/stream-muxer/tests/close-test.js"],"names":[],"mappings":"AAgCiB,6CAsFhB"} \ No newline at end of file diff --git a/dist/src/stream-muxer/tests/index.d.ts b/dist/src/stream-muxer/tests/index.d.ts new file mode 100644 index 0000000..1c87129 --- /dev/null +++ b/dist/src/stream-muxer/tests/index.d.ts @@ -0,0 +1,3 @@ +declare function _exports(common: any): void; +export = _exports; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/dist/src/stream-muxer/tests/index.d.ts.map b/dist/src/stream-muxer/tests/index.d.ts.map new file mode 100644 index 0000000..dcc3dee --- /dev/null +++ b/dist/src/stream-muxer/tests/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/stream-muxer/tests/index.js"],"names":[],"mappings":"AAQiB,6CAUhB"} \ No newline at end of file diff --git a/dist/src/stream-muxer/tests/mega-stress-test.d.ts b/dist/src/stream-muxer/tests/mega-stress-test.d.ts new file mode 100644 index 0000000..63ef4ed --- /dev/null +++ b/dist/src/stream-muxer/tests/mega-stress-test.d.ts @@ -0,0 +1,3 @@ +declare function _exports(common: any): void; +export = _exports; +//# sourceMappingURL=mega-stress-test.d.ts.map \ No newline at end of file diff --git a/dist/src/stream-muxer/tests/mega-stress-test.d.ts.map b/dist/src/stream-muxer/tests/mega-stress-test.d.ts.map new file mode 100644 index 0000000..949632e --- /dev/null +++ b/dist/src/stream-muxer/tests/mega-stress-test.d.ts.map @@ -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"} \ No newline at end of file diff --git a/dist/src/stream-muxer/tests/spawner.d.ts b/dist/src/stream-muxer/tests/spawner.d.ts new file mode 100644 index 0000000..a2253e8 --- /dev/null +++ b/dist/src/stream-muxer/tests/spawner.d.ts @@ -0,0 +1,3 @@ +declare function _exports(Muxer: any, nStreams: any, nMsg: any, limit: any): Promise; +export = _exports; +//# sourceMappingURL=spawner.d.ts.map \ No newline at end of file diff --git a/dist/src/stream-muxer/tests/spawner.d.ts.map b/dist/src/stream-muxer/tests/spawner.d.ts.map new file mode 100644 index 0000000..e421362 --- /dev/null +++ b/dist/src/stream-muxer/tests/spawner.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"spawner.d.ts","sourceRoot":"","sources":["../../../../src/stream-muxer/tests/spawner.js"],"names":[],"mappings":"AASiB,2FAoDhB"} \ No newline at end of file diff --git a/dist/src/stream-muxer/tests/stress-test.d.ts b/dist/src/stream-muxer/tests/stress-test.d.ts new file mode 100644 index 0000000..1d786a7 --- /dev/null +++ b/dist/src/stream-muxer/tests/stress-test.d.ts @@ -0,0 +1,3 @@ +declare function _exports(common: any): void; +export = _exports; +//# sourceMappingURL=stress-test.d.ts.map \ No newline at end of file diff --git a/dist/src/stream-muxer/tests/stress-test.d.ts.map b/dist/src/stream-muxer/tests/stress-test.d.ts.map new file mode 100644 index 0000000..96dbf7d --- /dev/null +++ b/dist/src/stream-muxer/tests/stress-test.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"stress-test.d.ts","sourceRoot":"","sources":["../../../../src/stream-muxer/tests/stress-test.js"],"names":[],"mappings":"AAKiB,6CAwBhB"} \ No newline at end of file diff --git a/dist/src/stream-muxer/types.d.ts b/dist/src/stream-muxer/types.d.ts new file mode 100644 index 0000000..98914ce --- /dev/null +++ b/dist/src/stream-muxer/types.d.ts @@ -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; + /** + * 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 { + close: () => void; + abort: () => void; + reset: () => void; + sink: Sink; + source: () => AsyncIterable; + timeline: MuxedTimeline; + id: string; +} +export declare type Sink = (source: Uint8Array) => Promise; +//# sourceMappingURL=types.d.ts.map \ No newline at end of file diff --git a/dist/src/stream-muxer/types.d.ts.map b/dist/src/stream-muxer/types.d.ts.map new file mode 100644 index 0000000..732e81b --- /dev/null +++ b/dist/src/stream-muxer/types.d.ts.map @@ -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"} \ No newline at end of file diff --git a/dist/src/topology/index.d.ts b/dist/src/topology/index.d.ts new file mode 100644 index 0000000..6fe7ebe --- /dev/null +++ b/dist/src/topology/index.d.ts @@ -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} + */ + peers: Set; + 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 \ No newline at end of file diff --git a/dist/src/topology/index.d.ts.map b/dist/src/topology/index.d.ts.map new file mode 100644 index 0000000..213e7bb --- /dev/null +++ b/dist/src/topology/index.d.ts.map @@ -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"} \ No newline at end of file diff --git a/dist/src/topology/multicodec-topology.d.ts b/dist/src/topology/multicodec-topology.d.ts new file mode 100644 index 0000000..0f429c1 --- /dev/null +++ b/dist/src/topology/multicodec-topology.d.ts @@ -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} props.protocols + */ + _onProtocolChange({ peerId, protocols }: { + peerId: PeerId; + protocols: Array; + }): 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, protocols: Array}>} peerDataIterable + * @returns {void} + */ + _updatePeers(peerDataIterable: Array<{ + id: PeerId; + multiaddrs: Array; + protocols: Array; + }>): 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; +}; +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 \ No newline at end of file diff --git a/dist/src/topology/multicodec-topology.d.ts.map b/dist/src/topology/multicodec-topology.d.ts.map new file mode 100644 index 0000000..04cd503 --- /dev/null +++ b/dist/src/topology/multicodec-topology.d.ts.map @@ -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"} \ No newline at end of file diff --git a/dist/src/topology/tests/multicodec-topology.d.ts b/dist/src/topology/tests/multicodec-topology.d.ts new file mode 100644 index 0000000..0eebeed --- /dev/null +++ b/dist/src/topology/tests/multicodec-topology.d.ts @@ -0,0 +1,3 @@ +declare function _exports(test: any): void; +export = _exports; +//# sourceMappingURL=multicodec-topology.d.ts.map \ No newline at end of file diff --git a/dist/src/topology/tests/multicodec-topology.d.ts.map b/dist/src/topology/tests/multicodec-topology.d.ts.map new file mode 100644 index 0000000..03595a0 --- /dev/null +++ b/dist/src/topology/tests/multicodec-topology.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"multicodec-topology.d.ts","sourceRoot":"","sources":["../../../../src/topology/tests/multicodec-topology.js"],"names":[],"mappings":"AAaiB,2CAuHhB"} \ No newline at end of file diff --git a/dist/src/topology/tests/topology.d.ts b/dist/src/topology/tests/topology.d.ts new file mode 100644 index 0000000..a060091 --- /dev/null +++ b/dist/src/topology/tests/topology.d.ts @@ -0,0 +1,3 @@ +declare function _exports(test: any): void; +export = _exports; +//# sourceMappingURL=topology.d.ts.map \ No newline at end of file diff --git a/dist/src/topology/tests/topology.d.ts.map b/dist/src/topology/tests/topology.d.ts.map new file mode 100644 index 0000000..49c2d70 --- /dev/null +++ b/dist/src/topology/tests/topology.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"topology.d.ts","sourceRoot":"","sources":["../../../../src/topology/tests/topology.js"],"names":[],"mappings":"AAYiB,2CA+BhB"} \ No newline at end of file diff --git a/dist/src/transport/errors.d.ts b/dist/src/transport/errors.d.ts new file mode 100644 index 0000000..699bf68 --- /dev/null +++ b/dist/src/transport/errors.d.ts @@ -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 \ No newline at end of file diff --git a/dist/src/transport/errors.d.ts.map b/dist/src/transport/errors.d.ts.map new file mode 100644 index 0000000..1603f8d --- /dev/null +++ b/dist/src/transport/errors.d.ts.map @@ -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"} \ No newline at end of file diff --git a/dist/src/transport/tests/dial-test.d.ts b/dist/src/transport/tests/dial-test.d.ts new file mode 100644 index 0000000..d25ebfe --- /dev/null +++ b/dist/src/transport/tests/dial-test.d.ts @@ -0,0 +1,3 @@ +declare function _exports(common: any): void; +export = _exports; +//# sourceMappingURL=dial-test.d.ts.map \ No newline at end of file diff --git a/dist/src/transport/tests/dial-test.d.ts.map b/dist/src/transport/tests/dial-test.d.ts.map new file mode 100644 index 0000000..7cf2c43 --- /dev/null +++ b/dist/src/transport/tests/dial-test.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"dial-test.d.ts","sourceRoot":"","sources":["../../../../src/transport/tests/dial-test.js"],"names":[],"mappings":"AAgBiB,6CA0LhB"} \ No newline at end of file diff --git a/dist/src/transport/tests/filter-test.d.ts b/dist/src/transport/tests/filter-test.d.ts new file mode 100644 index 0000000..4a11718 --- /dev/null +++ b/dist/src/transport/tests/filter-test.d.ts @@ -0,0 +1,3 @@ +declare function _exports(common: any): void; +export = _exports; +//# sourceMappingURL=filter-test.d.ts.map \ No newline at end of file diff --git a/dist/src/transport/tests/filter-test.d.ts.map b/dist/src/transport/tests/filter-test.d.ts.map new file mode 100644 index 0000000..60e7178 --- /dev/null +++ b/dist/src/transport/tests/filter-test.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"filter-test.d.ts","sourceRoot":"","sources":["../../../../src/transport/tests/filter-test.js"],"names":[],"mappings":"AAQiB,6CA4BhB"} \ No newline at end of file diff --git a/dist/src/transport/tests/index.d.ts b/dist/src/transport/tests/index.d.ts new file mode 100644 index 0000000..1c87129 --- /dev/null +++ b/dist/src/transport/tests/index.d.ts @@ -0,0 +1,3 @@ +declare function _exports(common: any): void; +export = _exports; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/dist/src/transport/tests/index.d.ts.map b/dist/src/transport/tests/index.d.ts.map new file mode 100644 index 0000000..c5da50b --- /dev/null +++ b/dist/src/transport/tests/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/transport/tests/index.js"],"names":[],"mappings":"AAOiB,6CAMhB"} \ No newline at end of file diff --git a/dist/src/transport/tests/listen-test.d.ts b/dist/src/transport/tests/listen-test.d.ts new file mode 100644 index 0000000..c15df53 --- /dev/null +++ b/dist/src/transport/tests/listen-test.d.ts @@ -0,0 +1,3 @@ +declare function _exports(common: any): void; +export = _exports; +//# sourceMappingURL=listen-test.d.ts.map \ No newline at end of file diff --git a/dist/src/transport/tests/listen-test.d.ts.map b/dist/src/transport/tests/listen-test.d.ts.map new file mode 100644 index 0000000..4bb7fe3 --- /dev/null +++ b/dist/src/transport/tests/listen-test.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"listen-test.d.ts","sourceRoot":"","sources":["../../../../src/transport/tests/listen-test.js"],"names":[],"mappings":"AAeiB,6CAmJhB"} \ No newline at end of file diff --git a/dist/src/transport/tests/utils/index.d.ts b/dist/src/transport/tests/utils/index.d.ts new file mode 100644 index 0000000..43f1d86 --- /dev/null +++ b/dist/src/transport/tests/utils/index.d.ts @@ -0,0 +1,2 @@ +export function isValidTick(date: number, ms?: number): boolean; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/dist/src/transport/tests/utils/index.d.ts.map b/dist/src/transport/tests/utils/index.d.ts.map new file mode 100644 index 0000000..1ea39b6 --- /dev/null +++ b/dist/src/transport/tests/utils/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/transport/tests/utils/index.js"],"names":[],"mappings":"AAWe,gEAIZ"} \ No newline at end of file diff --git a/dist/src/transport/types.d.ts b/dist/src/transport/types.d.ts new file mode 100644 index 0000000..05a0ec3 --- /dev/null +++ b/dist/src/transport/types.d.ts @@ -0,0 +1,70 @@ +/// +import events from 'events'; +import Multiaddr from 'multiaddr'; +import Connection from '../connection/connection'; +import { Sink } from '../stream-muxer/types'; +export interface TransportFactory { + new (upgrader: Upgrader): Transport; +} +/** + * A libp2p transport is understood as something that offers a dial and listen interface to establish connections. + */ +export interface Transport { + /** + * Dial a given multiaddr. + */ + dial(ma: Multiaddr, options?: DialOptions): Promise; + /** + * 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; + /** + * Get listen addresses + */ + getAddrs(): Multiaddr[]; + /** + * Close listener + * + * @returns {Promise} + */ + close(): Promise; +} +export interface Upgrader { + /** + * Upgrades an outbound connection on `transport.dial`. + */ + upgradeOutbound(maConn: MultiaddrConnection): Promise; + /** + * Upgrades an inbound connection on transport listener. + */ + upgradeInbound(maConn: MultiaddrConnection): Promise; +} +export declare type MultiaddrConnectionTimeline = { + open: number; + upgraded?: number; + close?: number; +}; +export declare type MultiaddrConnection = { + sink: Sink; + source: () => AsyncIterable; + close: (err?: Error) => Promise; + conn: unknown; + remoteAddr: Multiaddr; + localAddr?: Multiaddr; + timeline: MultiaddrConnectionTimeline; +}; +//# sourceMappingURL=types.d.ts.map \ No newline at end of file diff --git a/dist/src/transport/types.d.ts.map b/dist/src/transport/types.d.ts.map new file mode 100644 index 0000000..c5df542 --- /dev/null +++ b/dist/src/transport/types.d.ts.map @@ -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"} \ No newline at end of file diff --git a/dist/src/utils/peers.d.ts b/dist/src/utils/peers.d.ts new file mode 100644 index 0000000..f37e07b --- /dev/null +++ b/dist/src/utils/peers.d.ts @@ -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(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(callbackfn: (value: { + id: string; + privKey: string; + pubKey: string; + }, index: number, array: { + id: string; + privKey: string; + pubKey: string; + }[]) => U, thisArg?: any): U[]; + filter(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(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(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(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; + 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(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(this: A, depth?: D | undefined): FlatArray[]; +}; +export = _exports; +//# sourceMappingURL=peers.d.ts.map \ No newline at end of file diff --git a/dist/src/utils/peers.d.ts.map b/dist/src/utils/peers.d.ts.map new file mode 100644 index 0000000..573e8f3 --- /dev/null +++ b/dist/src/utils/peers.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"peers.d.ts","sourceRoot":"","sources":["../../../src/utils/peers.js"],"names":[],"mappings":""} \ No newline at end of file diff --git a/package.json b/package.json index a3de50b..40f8abc 100644 --- a/package.json +++ b/package.json @@ -22,6 +22,7 @@ "extends": "ipfs" }, "scripts": { + "prepare": "aegir build", "lint": "aegir lint", "build": "aegir build", "test": "aegir test",