Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@libp2p/interfaces

Package Overview
Dependencies
Maintainers
4
Versions
71
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@libp2p/interfaces - npm Package Compare versions

Comparing version 1.0.1 to 1.0.2

5

dist/src/stream-muxer/index.d.ts

@@ -0,1 +1,2 @@

import type { Duplex } from 'it-stream-types';
export interface MuxerFactory {

@@ -33,8 +34,6 @@ new (options: MuxerOptions): Muxer;

}
export interface MuxedStream<T = Uint8Array> extends AsyncIterable<T> {
export interface MuxedStream extends Duplex<Uint8Array> {
close: () => void;
abort: () => void;
reset: () => void;
sink: (source: AsyncIterable<T>) => Promise<void>;
source: AsyncIterable<T>;
timeline: MuxedTimeline;

@@ -41,0 +40,0 @@ id: string;

14

dist/src/transport/index.d.ts
/// <reference types="node" />
import type events from 'events';
import type { Multiaddr } from '@multiformats/multiaddr';
import type { Connection } from '../connection';
import type { Connection } from '../connection/index.js';
import type { AbortOptions } from '../index.js';
import type { Duplex } from 'it-stream-types';
export interface TransportFactory<DialOptions extends {

@@ -17,6 +18,9 @@ signal?: AbortSignal;

}
export interface ListenerOptions {
handler?: ConnectionHandler;
}
/**
* A libp2p transport is understood as something that offers a dial and listen interface to establish connections.
*/
export interface Transport<DialOptions extends AbortOptions = AbortOptions, ListenerOptions = Record<string, any>> {
export interface Transport<DialOptions extends AbortOptions = AbortOptions, CreateListenerOptions extends ListenerOptions = ListenerOptions> {
/**

@@ -29,3 +33,3 @@ * Dial a given multiaddr.

*/
createListener: (options: ListenerOptions, handler?: ConnectionHandler) => Listener;
createListener: (options?: CreateListenerOptions) => Listener;
/**

@@ -67,5 +71,3 @@ * Takes a list of `Multiaddr`s and returns only valid addresses for the transport

}
export interface MultiaddrConnection<T = Uint8Array> {
sink: (source: AsyncIterable<T>) => Promise<void>;
source: AsyncIterable<T>;
export interface MultiaddrConnection extends Duplex<Uint8Array, Uint8Array, Promise<void>> {
close: (err?: Error) => Promise<void>;

@@ -72,0 +74,0 @@ conn: unknown;

{
"name": "@libp2p/interfaces",
"version": "1.0.1",
"version": "1.0.2",
"description": "Interfaces for JS Libp2p",

@@ -5,0 +5,0 @@ "type": "module",

@@ -0,1 +1,2 @@

import type { Duplex } from 'it-stream-types'

@@ -40,10 +41,8 @@ export interface MuxerFactory {

export interface MuxedStream<T = Uint8Array> extends AsyncIterable<T> {
export interface MuxedStream extends Duplex<Uint8Array> {
close: () => void
abort: () => void
reset: () => void
sink: (source: AsyncIterable<T>) => Promise<void>
source: AsyncIterable<T>
timeline: MuxedTimeline
id: string
}

@@ -56,3 +56,3 @@ # interface-stream-muxer

const Muxer = require('your-muxer-module')
import pipe from 'it-pipe'
import { pipe } from 'it-pipe'

@@ -59,0 +59,0 @@ // Create a duplex muxer

import type events from 'events'
import type { Multiaddr } from '@multiformats/multiaddr'
import type { Connection } from '../connection'
import type { Connection } from '../connection/index.js'
import type { AbortOptions } from '../index.js'
import type { Duplex } from 'it-stream-types'

@@ -14,6 +15,10 @@ export interface TransportFactory<DialOptions extends { signal?: AbortSignal }, ListenerOptions> {

export interface ListenerOptions {
handler?: ConnectionHandler
}
/**
* A libp2p transport is understood as something that offers a dial and listen interface to establish connections.
*/
export interface Transport <DialOptions extends AbortOptions = AbortOptions, ListenerOptions = Record<string, any>> {
export interface Transport <DialOptions extends AbortOptions = AbortOptions, CreateListenerOptions extends ListenerOptions = ListenerOptions> {
/**

@@ -26,3 +31,3 @@ * Dial a given multiaddr.

*/
createListener: (options: ListenerOptions, handler?: ConnectionHandler) => Listener
createListener: (options?: CreateListenerOptions) => Listener
/**

@@ -69,5 +74,3 @@ * Takes a list of `Multiaddr`s and returns only valid addresses for the transport

export interface MultiaddrConnection<T = Uint8Array> {
sink: (source: AsyncIterable<T>) => Promise<void>
source: AsyncIterable<T>
export interface MultiaddrConnection extends Duplex<Uint8Array, Uint8Array, Promise<void>> {
close: (err?: Error) => Promise<void>

@@ -74,0 +77,0 @@ conn: unknown

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc