@minip2p/core 0.1.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,9 +1,22 @@
1
1
  # @minip2p/core
2
2
 
3
- Platform-neutral types and SDK behavior for minip2p.
3
+ Promise-first, platform-neutral TypeScript SDK behavior for minip2p.
4
4
 
5
- Applications normally install a platform package such as `react-native-minip2p` or `@minip2p/node`; those packages bind the SDK to a native backend and re-export the public core types.
5
+ Applications normally install a platform package such as `@minip2p/react-native` or `@minip2p/node`; those packages bind the SDK to a native backend and re-export the public core types.
6
6
 
7
7
  Adapter authors implement the deliberately small contract exported from `@minip2p/core/backend`. The core package never imports React Native, Node.js, UniFFI, napi-rs, or generated native code.
8
8
 
9
- The shared endpoint API covers identity and Identify snapshots, QUIC connections, explicit ping, relay/AutoNAT/DCUtR state, gossipsub or floodsub, signed discovery, mDNS, and arbitrary negotiated protocols/streams. Platform adapters own the background driver that implements Rust's caller-driven poll/wake contract.
9
+ The public API uses named typed events, cancellable Promise operations, and `Stream` handles:
10
+
11
+ ```ts
12
+ const path = await endpoint.connectAddr(remoteAddress);
13
+ await endpoint.waitPeerReady(path.peerId);
14
+ const rttMs = await endpoint.ping(path.peerId);
15
+ const stream = await endpoint.openStream(path.peerId, "/example/files/1");
16
+ stream.write(new Uint8Array([1, 2, 3]));
17
+ stream.closeWrite();
18
+ ```
19
+
20
+ Use `endpoint.on("stream", handler)` to claim inbound streams. Catch-all event handlers receive only safe `inboundStream` metadata, never a live handle. Operations accept `{ timeoutMs, signal }`; the default timeout is 65 seconds and `timeoutMs: 0` disables it.
21
+
22
+ Raw native `{ tag, inner }` unions and the `Minip2pBackend` adapter contract are available only from `@minip2p/core/backend`.
package/dist/backend.d.ts CHANGED
@@ -1,42 +1,89 @@
1
- import type { Bytes, IdentifyInfo, KnownPeerInfo, MiniP2pConfig, P2pEvent, Reachability, RelayReservationInfo } from "./types.js";
2
- /** Native endpoint operations required by the platform-neutral SDK. */
3
- export interface MiniP2pBackend {
1
+ import type { Bytes, IdentifyInfo, KnownPeerInfo, Minip2pConfig, PathKind, P2pEvent, Reachability, RelayReservationInfo } from "./types.js";
2
+ /** Full native identity allocated for an outbound stream. */
3
+ export interface BackendOpenStream {
4
+ /** Endpoint-local connection carrying the stream. */
5
+ readonly connId: number;
6
+ /** Endpoint-local transport stream identifier. */
7
+ readonly streamId: number;
8
+ }
9
+ /**
10
+ * Native endpoint contract consumed by {@link Minip2pBase}.
11
+ *
12
+ * Platform packages implement this interface; application code normally uses
13
+ * the high-level endpoint instead.
14
+ */
15
+ export interface Minip2pBackend {
16
+ /** Starts native event delivery exactly once. */
4
17
  start: (listener: (event: P2pEvent) => void) => void;
18
+ /** Idempotently releases the native endpoint. */
5
19
  close: () => void;
20
+ /** Returns the local peer ID. */
6
21
  peerId: () => string;
22
+ /** Returns bound peer multiaddresses. */
7
23
  listenAddrs: () => string[];
24
+ /** Returns currently connected peer IDs. */
8
25
  connectedPeers: () => string[];
26
+ /** Returns whether Identify completed for a peer. */
9
27
  isPeerReady: (peerId: string) => boolean;
28
+ /** Returns the latest Identify snapshot. */
10
29
  peerInfo: (peerId: string) => IdentifyInfo | undefined;
30
+ /** Returns the merged discovery address book. */
11
31
  knownPeers: () => KnownPeerInfo[];
32
+ /** Returns the discovery clock when enabled. */
12
33
  discoveryNowMs: () => number | undefined;
34
+ /** Returns the active relay reservation. */
13
35
  activeReservation: () => RelayReservationInfo | undefined;
36
+ /** Returns the authoritative native path to a peer. */
37
+ path: (peerId: string) => PathKind | undefined;
38
+ /** Builds a circuit address through a relay. */
14
39
  circuitAddress: (relayAddress: string, peerId: string) => string;
40
+ /** Returns the native reachability state. */
15
41
  reachability: () => Reachability;
42
+ /** Returns whether the driver accepts work. */
16
43
  isRunning: () => boolean;
44
+ /** Selects foreground or idle polling. */
17
45
  setActive: (active: boolean) => void;
46
+ /** Subscribes to a pubsub topic. */
18
47
  subscribe: (topic: string) => boolean;
48
+ /** Unsubscribes from a pubsub topic. */
19
49
  unsubscribe: (topic: string) => boolean;
50
+ /** Publishes one binary pubsub message. */
20
51
  publish: (topic: string, data: Uint8Array) => void;
52
+ /** Starts one native ping operation. */
21
53
  ping: (peerId: string) => void;
54
+ /** Registers an application protocol. */
22
55
  addProtocol: (protocolId: string) => void;
23
- openStream: (peerId: string, protocolId: string) => number;
56
+ /** Starts opening and negotiating an application stream. */
57
+ openStream: (peerId: string, protocolId: string) => BackendOpenStream;
58
+ /** Sends bytes on an application stream. */
24
59
  sendStream: (peerId: string, streamId: number, data: Uint8Array) => void;
60
+ /** Half-closes the local stream write side. */
25
61
  closeStreamWrite: (peerId: string, streamId: number) => void;
62
+ /** Abruptly resets a stream. */
26
63
  resetStream: (peerId: string, streamId: number) => void;
64
+ /** Resets and relinquishes a stream. */
27
65
  abandonStream: (peerId: string, streamId: number) => void;
66
+ /** Starts a NAT-orchestrated connection attempt. */
28
67
  connect: (peerId: string) => number;
68
+ /** Starts a connection attempt with explicit addresses. */
29
69
  connectWithAddrs: (peerId: string, addresses: readonly string[]) => number;
70
+ /** Starts a connection attempt from one full peer address. */
30
71
  connectAddr: (address: string) => number;
72
+ /** Starts direct dials for applicable address families. */
31
73
  dial: (address: string) => number[];
74
+ /** Starts one direct IPv4 dial. */
32
75
  dialIp4: (address: string) => number;
76
+ /** Starts one direct IPv6 dial. */
33
77
  dialIp6: (address: string) => number;
78
+ /** Cancels a connection attempt. */
34
79
  cancelConnect: (id: number) => void;
80
+ /** Closes the active connection to a peer. */
35
81
  disconnect: (peerId: string) => void;
36
82
  }
83
+ export { P2pEvent_Tags, PathKind_Tags, type P2pEvent, type P2pEventByTag, type PathKind, } from "./types.js";
37
84
  /** Platform implementation used to construct endpoints and identity helpers. */
38
- export interface MiniP2pBackendFactory {
39
- create: (config: MiniP2pConfig) => MiniP2pBackend;
85
+ export interface Minip2pBackendFactory {
86
+ create: (config: Minip2pConfig) => Minip2pBackend;
40
87
  generateSecretKey: () => Uint8Array;
41
88
  peerIdFromSecretKey: (secretKey: Bytes) => string;
42
89
  circuitAddress: (relayAddress: string, peerId: string) => string;
@@ -1 +1 @@
1
- {"version":3,"file":"backend.d.ts","sourceRoot":"","sources":["../src/backend.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,KAAK,EACL,YAAY,EACZ,aAAa,EACb,aAAa,EACb,QAAQ,EACR,YAAY,EACZ,oBAAoB,EACrB,MAAM,YAAY,CAAC;AAEpB,uEAAuE;AACvE,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,QAAQ,KAAK,IAAI,KAAK,IAAI,CAAC;IACrD,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB,MAAM,EAAE,MAAM,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,MAAM,EAAE,CAAC;IAC5B,cAAc,EAAE,MAAM,MAAM,EAAE,CAAC;IAC/B,WAAW,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,OAAO,CAAC;IACzC,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,YAAY,GAAG,SAAS,CAAC;IACvD,UAAU,EAAE,MAAM,aAAa,EAAE,CAAC;IAClC,cAAc,EAAE,MAAM,MAAM,GAAG,SAAS,CAAC;IACzC,iBAAiB,EAAE,MAAM,oBAAoB,GAAG,SAAS,CAAC;IAC1D,cAAc,EAAE,CAAC,YAAY,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,KAAK,MAAM,CAAC;IACjE,YAAY,EAAE,MAAM,YAAY,CAAC;IACjC,SAAS,EAAE,MAAM,OAAO,CAAC;IACzB,SAAS,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,IAAI,CAAC;IACrC,SAAS,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC;IACtC,WAAW,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC;IACxC,OAAO,EAAE,CAAC,KAAK,E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1,2 +1,2 @@
1
- export {};
1
+ export { P2pEvent_Tags, PathKind_Tags, } from "./types.js";
2
2
  //# sourceMappingURL=backend.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"backend.js","sourceRoot":"","sources":["../src/backend.ts"],"names":[],"mappings":""}
1
+ {"version":3,"file":"backend.js","sourceRoot":"","sources":["../src/backend.ts"],"names":[],"mappings":"AA8FA,OAAO,EACL,aAAa,EACb,aAAa,GAId,MAAM,YAAY,CAAC"}
package/dist/errors.d.ts CHANGED
@@ -1,32 +1,83 @@
1
- import type { DriverFailureKind } from "./types.js";
2
- /** The native pubsub queue rejected work because it is full. */
1
+ import type { DriverFailureKind, EndpointErrorKind, NatErrorKind } from "./types.js";
2
+ /** Pubsub rejected a publish because its bounded native queue is full. */
3
3
  export declare class BackpressureError extends Error {
4
4
  constructor();
5
5
  }
6
- /** The payload exceeds the native pubsub protocol limit. */
6
+ /** A payload exceeds the native protocol size limit. */
7
7
  export declare class MessageTooLargeError extends Error {
8
8
  constructor();
9
9
  }
10
- /** A valid operation was rejected by endpoint policy. */
10
+ /** Native policy rejected an otherwise valid operation. */
11
11
  export declare class NotPermittedError extends Error {
12
12
  constructor(message?: string);
13
13
  }
14
- /** A bounded SDK wait elapsed without a matching event. */
14
+ /** Platform-neutral operation cancellation error. */
15
+ export declare class AbortError extends Error {
16
+ constructor(message?: string);
17
+ }
18
+ /** A Promise-based SDK operation exceeded its configured timeout. */
15
19
  export declare class TimeoutError extends Error {
16
- constructor(timeoutMs: number);
20
+ /** Configured timeout in milliseconds, when known. */
21
+ readonly timeoutMs?: number;
22
+ constructor(timeoutMs?: number);
17
23
  }
18
- /** The SDK was closed before an operation could complete. */
24
+ /** The endpoint or stream is already closed. */
19
25
  export declare class ClosedError extends Error {
20
26
  constructor();
21
27
  }
22
- /** The native background driver terminated with a fatal failure. */
28
+ /** The native background driver stopped unexpectedly. */
23
29
  export declare class DriverFailedError extends Error {
30
+ /** Native subsystem that caused the terminal failure. */
24
31
  readonly kind: DriverFailureKind;
25
32
  constructor(kind: DriverFailureKind, detail: string);
26
33
  }
27
- /** A peer disconnected before the awaited operation could complete. */
34
+ /** A NAT-orchestrated connection attempt ended without a usable path. */
35
+ export declare class ConnectFailedError extends Error {
36
+ /** Endpoint-local connection-attempt identifier. */
37
+ readonly connectId: number;
38
+ /** Target peer ID. */
39
+ readonly peerId: string;
40
+ /** Machine-readable terminal failure category. */
41
+ readonly kind: NatErrorKind;
42
+ constructor(connectId: number, peerId: string, kind: NatErrorKind, detail: string);
43
+ }
44
+ /** A connection result is unknown, already awaited, or already consumed. */
45
+ export declare class ConnectResultUnavailableError extends Error {
46
+ readonly connectId: number;
47
+ constructor(connectId: number);
48
+ }
49
+ /** A peer disconnected before an operation could complete. */
28
50
  export declare class PeerDisconnectedError extends Error {
29
51
  readonly peerId: string;
30
- constructor(peerId: string);
52
+ readonly operation?: string;
53
+ constructor(peerId: string, operation?: string);
54
+ }
55
+ /** Outbound stream opening or protocol negotiation failed. */
56
+ export declare class OpenStreamError extends Error {
57
+ /** Machine-readable native error category, or a synchronous adapter error. */
58
+ readonly kind: EndpointErrorKind | "synchronous";
59
+ /** Target peer ID. */
60
+ readonly peerId: string;
61
+ /** Connection carrying the attempted stream, when allocated. */
62
+ readonly connId?: number;
63
+ /** Native stream identifier, when allocated. */
64
+ readonly streamId?: number;
65
+ /** Human-readable native or adapter diagnostic. */
66
+ readonly detail: string;
67
+ constructor(options: {
68
+ kind: EndpointErrorKind | "synchronous";
69
+ peerId: string;
70
+ connId?: number;
71
+ streamId?: number;
72
+ detail: string;
73
+ });
74
+ }
75
+ /** A stream closed before outbound negotiation completed. */
76
+ export declare class StreamClosedError extends Error {
77
+ constructor(message?: string);
78
+ }
79
+ /** Native event loss made an in-flight operation's result unknowable. */
80
+ export declare class EventQueueOverflowError extends Error {
81
+ constructor();
31
82
  }
32
83
  //# sourceMappingURL=errors.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"errors.d.ts","sourceRoot":"","sources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mD;IACnD,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;gBAEZ,OAAO,EAAE;QACnB,IAAI,EAAE,iBAAiB,GAAG,aAAa,CAAC;QACxC,MAAM,EAAE,MAAM,CAAC;QACf,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,MAAM,EAAE,MAAM,CAAC;KAChB;CASF;AAED,6DAA6D;AAC7D,qBAAa,iBAAkB,SAAQ,KAAK;gBAC9B,OAAO,SAA6C;CAIjE;AAED,yEAAyE;AACzE,qBAAa,uBAAwB,SAAQ,KAAK;;CAKjD"}
package/dist/errors.js CHANGED
@@ -1,41 +1,54 @@
1
- /* oxlint-disable max-classes-per-file -- The small public SDK error family is intentionally colocated and exported from one module. */
2
- /** The native pubsub queue rejected work because it is full. */
1
+ /* oxlint-disable max-classes-per-file -- Public error types are intentionally colocated. */
2
+ /** Pubsub rejected a publish because its bounded native queue is full. */
3
3
  export class BackpressureError extends Error {
4
4
  constructor() {
5
5
  super("The native pubsub queue is full");
6
6
  this.name = "BackpressureError";
7
7
  }
8
8
  }
9
- /** The payload exceeds the native pubsub protocol limit. */
9
+ /** A payload exceeds the native protocol size limit. */
10
10
  export class MessageTooLargeError extends Error {
11
11
  constructor() {
12
12
  super("The message exceeds the native pubsub size limit");
13
13
  this.name = "MessageTooLargeError";
14
14
  }
15
15
  }
16
- /** A valid operation was rejected by endpoint policy. */
16
+ /** Native policy rejected an otherwise valid operation. */
17
17
  export class NotPermittedError extends Error {
18
18
  constructor(message = "The operation is not permitted") {
19
19
  super(message);
20
20
  this.name = "NotPermittedError";
21
21
  }
22
22
  }
23
- /** A bounded SDK wait elapsed without a matching event. */
23
+ /** Platform-neutral operation cancellation error. */
24
+ export class AbortError extends Error {
25
+ constructor(message = "The operation was aborted") {
26
+ super(message);
27
+ this.name = "AbortError";
28
+ }
29
+ }
30
+ /** A Promise-based SDK operation exceeded its configured timeout. */
24
31
  export class TimeoutError extends Error {
32
+ /** Configured timeout in milliseconds, when known. */
33
+ timeoutMs;
25
34
  constructor(timeoutMs) {
26
- super(`Timed out after ${timeoutMs} ms`);
35
+ super(timeoutMs === undefined
36
+ ? "The operation timed out"
37
+ : `Timed out after ${timeoutMs} ms`);
27
38
  this.name = "TimeoutError";
39
+ this.timeoutMs = timeoutMs;
28
40
  }
29
41
  }
30
- /** The SDK was closed before an operation could complete. */
42
+ /** The endpoint or stream is already closed. */
31
43
  export class ClosedError extends Error {
32
44
  constructor() {
33
45
  super("The minip2p endpoint is closed");
34
46
  this.name = "ClosedError";
35
47
  }
36
48
  }
37
- /** The native background driver terminated with a fatal failure. */
49
+ /** The native background driver stopped unexpectedly. */
38
50
  export class DriverFailedError extends Error {
51
+ /** Native subsystem that caused the terminal failure. */
39
52
  kind;
40
53
  constructor(kind, detail) {
41
54
  super(detail.length > 0 ? detail : "The minip2p driver failed");
@@ -43,13 +56,78 @@ export class DriverFailedError extends Error {
43
56
  this.kind = kind;
44
57
  }
45
58
  }
46
- /** A peer disconnected before the awaited operation could complete. */
59
+ /** A NAT-orchestrated connection attempt ended without a usable path. */
60
+ export class ConnectFailedError extends Error {
61
+ /** Endpoint-local connection-attempt identifier. */
62
+ connectId;
63
+ /** Target peer ID. */
64
+ peerId;
65
+ /** Machine-readable terminal failure category. */
66
+ kind;
67
+ constructor(connectId, peerId, kind, detail) {
68
+ super(detail.length > 0 ? detail : `Connection to ${peerId} failed`);
69
+ this.name = "ConnectFailedError";
70
+ this.connectId = connectId;
71
+ this.peerId = peerId;
72
+ this.kind = kind;
73
+ }
74
+ }
75
+ /** A connection result is unknown, already awaited, or already consumed. */
76
+ export class ConnectResultUnavailableError extends Error {
77
+ connectId;
78
+ constructor(connectId) {
79
+ super(`Connection result ${connectId} is unknown or already consumed`);
80
+ this.name = "ConnectResultUnavailableError";
81
+ this.connectId = connectId;
82
+ }
83
+ }
84
+ /** A peer disconnected before an operation could complete. */
47
85
  export class PeerDisconnectedError extends Error {
48
86
  peerId;
49
- constructor(peerId) {
50
- super(`Peer ${peerId} disconnected before becoming ready`);
87
+ operation;
88
+ constructor(peerId, operation) {
89
+ super(operation === undefined
90
+ ? `Peer ${peerId} disconnected`
91
+ : `Peer ${peerId} disconnected during ${operation}`);
51
92
  this.name = "PeerDisconnectedError";
52
93
  this.peerId = peerId;
94
+ this.operation = operation;
95
+ }
96
+ }
97
+ /** Outbound stream opening or protocol negotiation failed. */
98
+ export class OpenStreamError extends Error {
99
+ /** Machine-readable native error category, or a synchronous adapter error. */
100
+ kind;
101
+ /** Target peer ID. */
102
+ peerId;
103
+ /** Connection carrying the attempted stream, when allocated. */
104
+ connId;
105
+ /** Native stream identifier, when allocated. */
106
+ streamId;
107
+ /** Human-readable native or adapter diagnostic. */
108
+ detail;
109
+ constructor(options) {
110
+ super(options.detail || `Opening a stream to ${options.peerId} failed`);
111
+ this.name = "OpenStreamError";
112
+ this.kind = options.kind;
113
+ this.peerId = options.peerId;
114
+ this.connId = options.connId;
115
+ this.streamId = options.streamId;
116
+ this.detail = options.detail;
117
+ }
118
+ }
119
+ /** A stream closed before outbound negotiation completed. */
120
+ export class StreamClosedError extends Error {
121
+ constructor(message = "The stream closed before it became ready") {
122
+ super(message);
123
+ this.name = "StreamClosedError";
124
+ }
125
+ }
126
+ /** Native event loss made an in-flight operation's result unknowable. */
127
+ export class EventQueueOverflowError extends Error {
128
+ constructor() {
129
+ super("The native event queue overflowed before the operation completed");
130
+ this.name = "EventQueueOverflowError";
53
131
  }
54
132
  }
55
133
  //# sourceMappingURL=errors.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,uIAAuI;AAIvI,gEAAgE;AAChE,MAAM,OAAO,iBAAkB,SAAQ,KAAK;IAC1C;QACE,KAAK,CAAC,iCAAiC,CAAC,CAAC;QACzC,IAAI,CAAC,IAAI,GAAG,mBAAmB,CAAC;IAClC,CAAC;CACF;AAED,4DAA4D;AAC5D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AC1E,IAAI,CAAC,IAAI,GAAG,yBAAyB,CAAC;IACxC,CAAC;CACF"}
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { BackpressureError, ClosedError, DriverFailedError, MessageTooLargeError, NotPermittedError, PeerDisconnectedError, TimeoutError, } from "./errors.js";
2
- export { MiniP2pBase } from "./sdk.js";
3
- export { DiscoverySource, DriverFailureKind, EndpointErrorKind, NatErrorKind, P2pEvent_Tags, PathKind_Tags, PubsubRouter, Reachability, type Bytes, type IdentifyInfo, type KnownPeerInfo, type MiniP2pConfig, type MiniP2pDiscoveryOptions, type MiniP2pMdnsOptions, type MiniP2pEvent, type P2pEvent, type P2pEventByTag, type PathKind, type QueueOverflowEvent, type RelayReservationInfo, type Unsubscribe, } from "./types.js";
1
+ export { AbortError, BackpressureError, ClosedError, ConnectFailedError, ConnectResultUnavailableError, DriverFailedError, EventQueueOverflowError, MessageTooLargeError, NotPermittedError, OpenStreamError, PeerDisconnectedError, StreamClosedError, TimeoutError, } from "./errors.js";
2
+ export { Minip2pBase, Stream, type StreamEventMap } from "./sdk.js";
3
+ export { DiscoverySource, DriverFailureKind, EndpointErrorKind, NatErrorKind, PubsubRouter, Reachability, type Bytes, type CloseReason, type ConnectResult, type IdentifyInfo, type InboundStreamMeta, type KnownPeerInfo, type Minip2pCatchAllEventMap, type Minip2pConfig, type Minip2pDiscoveryOptions, type Minip2pEvent, type Minip2pMdnsOptions, type Minip2pNamedEventMap, type OnceOptions, type OpOptions, type Path, type RelayReservationInfo, type Unsubscribe, type WaitForOptions, } from "./types.js";
4
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,WAAW,EACX,iBAAiB,EACjB,oBAAoB,EACpB,iBAAiB,EACjB,qBAAqB,EACrB,YAAY,GACb,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACvC,OAAO,EACL,eAAe,EACf,iBAAiB,EACjB,iBAAiB,EACjB,YAAY,EACZ,aAAa,EACb,aAAa,EACb,YAAY,EACZ,YAAY,EACZ,KAAK,KAAK,EACV,KAAK,YAAY,EACjB,KAAK,aAAa,EAClB,KAAK,aAAa,EAClB,KAAK,uBAAuB,EAC5B,KAAK,kBAAkB,EACvB,KAAK,YAAY,EACjB,KAAK,QAAQ,EACb,KAAK,aAAa,EAClB,KAAK,QAAQ,EACb,KAAK,kBAAkB,EACvB,KAAK,oBAAoB,EACzB,KAAK,WAAW,GACjB,MAAM,YAAY,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,iBAAiB,EACjB,WAAW,EACX,kBAAkB,EAClB,6BAA6B,EAC7B,iBAAiB,EACjB,uBAAuB,EACvB,oBAAoB,EACpB,iBAAiB,EACjB,eAAe,EACf,qBAAqB,EACrB,iBAAiB,EACjB,YAAY,GACb,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,KAAK,cAAc,EAAE,MAAM,UAAU,CAAC;AACpE,OAAO,EACL,eAAe,EACf,iBAAiB,EACjB,iBAAiB,EACjB,YAAY,EACZ,YAAY,EACZ,YAAY,EACZ,KAAK,KAAK,EACV,KAAK,WAAW,EAChB,KAAK,aAAa,EAClB,KAAK,YAAY,EACjB,KAAK,iBAAiB,EACtB,KAAK,aAAa,EAClB,KAAK,uBAAuB,EAC5B,KAAK,aAAa,EAClB,KAAK,uBAAuB,EAC5B,KAAK,YAAY,EACjB,KAAK,kBAAkB,EACvB,KAAK,oBAAoB,EACzB,KAAK,WAAW,EAChB,KAAK,SAAS,EACd,KAAK,IAAI,EACT,KAAK,oBAAoB,EACzB,KAAK,WAAW,EAChB,KAAK,cAAc,GACpB,MAAM,YAAY,CAAC"}
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- export { BackpressureError, ClosedError, DriverFailedError, MessageTooLargeError, NotPermittedError, PeerDisconnectedError, TimeoutError, } from "./errors.js";
2
- export { MiniP2pBase } from "./sdk.js";
3
- export { DiscoverySource, DriverFailureKind, EndpointErrorKind, NatErrorKind, P2pEvent_Tags, PathKind_Tags, PubsubRouter, Reachability, } from "./types.js";
1
+ export { AbortError, BackpressureError, ClosedError, ConnectFailedError, ConnectResultUnavailableError, DriverFailedError, EventQueueOverflowError, MessageTooLargeError, NotPermittedError, OpenStreamError, PeerDisconnectedError, StreamClosedError, TimeoutError, } from "./errors.js";
2
+ export { Minip2pBase, Stream } from "./sdk.js";
3
+ export { DiscoverySource, DriverFailureKind, EndpointErrorKind, NatErrorKind, PubsubRouter, Reachability, } from "./types.js";
4
4
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,WAAW,EACX,iBAAiB,EACjB,oBAAoB,EACpB,iBAAiB,EACjB,qBAAqB,EACrB,YAAY,GACb,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACvC,OAAO,EACL,eAAe,EACf,iBAAiB,EACjB,iBAAiB,EACjB,YAAY,EACZ,aAAa,EACb,aAAa,EACb,YAAY,EACZ,YAAY,GAcb,MAAM,YAAY,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,iBAAiB,EACjB,WAAW,EACX,kBAAkB,EAClB,6BAA6B,EAC7B,iBAAiB,EACjB,uBAAuB,EACvB,oBAAoB,EACpB,iBAAiB,EACjB,eAAe,EACf,qBAAqB,EACrB,iBAAiB,EACjB,YAAY,GACb,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,WAAW,EAAE,MAAM,EAAuB,MAAM,UAAU,CAAC;AACpE,OAAO,EACL,eAAe,EACf,iBAAiB,EACjB,iBAAiB,EACjB,YAAY,EACZ,YAAY,EACZ,YAAY,GAmBb,MAAM,YAAY,CAAC"}